规范化glock 18

This commit is contained in:
17146 2025-05-21 19:28:40 +08:00 committed by Light_Quanta
parent b1380e867a
commit 132d759960
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
7 changed files with 67 additions and 46 deletions

View file

@ -1,4 +1,4 @@
// 1.21.1 2025-05-21T21:28:40.4565326 Item Models: superbwarfare // 1.21.1 2025-05-21T21:32:11.461574 Item Models: superbwarfare
6c48f5010e7e2b8cd4d3ff85c8de45cf56f53268 assets/superbwarfare/models/item/aa_12.json 6c48f5010e7e2b8cd4d3ff85c8de45cf56f53268 assets/superbwarfare/models/item/aa_12.json
fb3a995587b2c253571c3160ff02c2ad8c73ecf8 assets/superbwarfare/models/item/aa_12_base.json fb3a995587b2c253571c3160ff02c2ad8c73ecf8 assets/superbwarfare/models/item/aa_12_base.json
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/aa_12_blueprint.json 13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/aa_12_blueprint.json
@ -57,7 +57,10 @@ c102839d5f7d4bdc1c6cbfbf4c2c907b70f22052 assets/superbwarfare/models/item/fusee.
d842316fc4b25c17889fca4f89539d9e0829cda1 assets/superbwarfare/models/item/glock_17_base.json d842316fc4b25c17889fca4f89539d9e0829cda1 assets/superbwarfare/models/item/glock_17_base.json
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/glock_17_blueprint.json 13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/glock_17_blueprint.json
eb7c2404c141dde965b8cb13c1e368eab6a8fa16 assets/superbwarfare/models/item/glock_17_icon.json eb7c2404c141dde965b8cb13c1e368eab6a8fa16 assets/superbwarfare/models/item/glock_17_icon.json
59322dfc0e0a28d793ed3603ed2084a5ac045206 assets/superbwarfare/models/item/glock_18.json
d842316fc4b25c17889fca4f89539d9e0829cda1 assets/superbwarfare/models/item/glock_18_base.json
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/glock_18_blueprint.json 13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/glock_18_blueprint.json
eb7c2404c141dde965b8cb13c1e368eab6a8fa16 assets/superbwarfare/models/item/glock_18_icon.json
8752c2b2b648ff23d6b93eedcc6c0500c695afd7 assets/superbwarfare/models/item/grain.json 8752c2b2b648ff23d6b93eedcc6c0500c695afd7 assets/superbwarfare/models/item/grain.json
c256914755344645319528b6abfabb6179f75052 assets/superbwarfare/models/item/handgun_ammo.json c256914755344645319528b6abfabb6179f75052 assets/superbwarfare/models/item/handgun_ammo.json
afbfd24461fb7e6b43a8e029f0a894b84d8b6638 assets/superbwarfare/models/item/heavy_ammo.json afbfd24461fb7e6b43a8e029f0a894b84d8b6638 assets/superbwarfare/models/item/heavy_ammo.json

View file

@ -0,0 +1,28 @@
{
"parent": "minecraft:item/generated",
"base": {
"parent": "superbwarfare:item/glock_17_base"
},
"gui_light": "front",
"loader": "neoforge:separate_transforms",
"perspectives": {
"fixed": {
"parent": "superbwarfare:lod/glock_17"
},
"ground": {
"parent": "superbwarfare:lod/glock_17"
},
"gui": {
"parent": "superbwarfare:item/glock_17_icon"
},
"head": {
"parent": "superbwarfare:lod/glock_17"
},
"thirdperson_lefthand": {
"parent": "superbwarfare:lod/glock_17"
},
"thirdperson_righthand": {
"parent": "superbwarfare:lod/glock_17"
}
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "superbwarfare:displaysettings/glock_17.item",
"textures": {
"layer0": "superbwarfare:item/glock_17"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "superbwarfare:item/glock_17_icon"
}
}

View file

@ -34,6 +34,7 @@ public class ModItemModelProvider extends ItemModelProvider {
gunItem(ModItems.BOCEK); gunItem(ModItems.BOCEK);
gunItem(ModItems.DEVOTION); gunItem(ModItems.DEVOTION);
gunItem(ModItems.GLOCK_17); gunItem(ModItems.GLOCK_17);
gunItem(ModItems.GLOCK_18, "glock_17");
simpleItem(ModItems.EMPTY_PERK, "perk/"); simpleItem(ModItems.EMPTY_PERK, "perk/");
@ -218,21 +219,21 @@ public class ModItemModelProvider extends ItemModelProvider {
.texture("layer0", Mod.loc("item/" + item.getId().getPath())); .texture("layer0", Mod.loc("item/" + item.getId().getPath()));
} }
private ItemModelBuilder gunIcon(DeferredHolder<Item, ? extends Item> item) { private ItemModelBuilder gunIcon(DeferredHolder<Item, ? extends Item> item, String name) {
return withExistingParent(item.getId().getPath() + "_icon", ResourceLocation.withDefaultNamespace("item/generated")) return withExistingParent(item.getId().getPath() + "_icon", ResourceLocation.withDefaultNamespace("item/generated"))
.texture("layer0", Mod.loc("item/" + item.getId().getPath() + "_icon")); .texture("layer0", Mod.loc("item/" + name + "_icon"));
} }
private ItemModelBuilder gunBase(DeferredHolder<Item, ? extends Item> item) { private ItemModelBuilder gunBase(DeferredHolder<Item, ? extends Item> item, String name) {
return getBuilder(item.getId().getPath() + "_base") return getBuilder(item.getId().getPath() + "_base")
.parent(new ModelFile.UncheckedModelFile(modLoc("displaysettings/" + item.getId().getPath() + ".item"))) .parent(new ModelFile.UncheckedModelFile(modLoc("displaysettings/" + name + ".item")))
.texture("layer0", Mod.loc("item/" + item.getId().getPath())); .texture("layer0", Mod.loc("item/" + name));
} }
private ItemModelBuilder customSeparatedGunModel(DeferredHolder<Item, ? extends Item> item) { private ItemModelBuilder customSeparatedGunModel(DeferredHolder<Item, ? extends Item> item, String name) {
String lod = modLoc("lod/" + item.getId().getPath()).toString(); String lod = modLoc("lod/" + name).toString();
String base = modLoc("item/" + item.getId().getPath() + "_base").toString(); String base = modLoc("item/" + name + "_base").toString();
String icon = modLoc("item/" + item.getId().getPath() + "_icon").toString(); String icon = modLoc("item/" + name + "_icon").toString();
return withExistingParent(item.getId().getPath(), ResourceLocation.withDefaultNamespace("item/generated")) return withExistingParent(item.getId().getPath(), ResourceLocation.withDefaultNamespace("item/generated"))
.guiLight(BlockModel.GuiLight.FRONT) .guiLight(BlockModel.GuiLight.FRONT)
@ -248,8 +249,12 @@ public class ModItemModelProvider extends ItemModelProvider {
} }
public void gunItem(DeferredHolder<Item, ? extends Item> item) { public void gunItem(DeferredHolder<Item, ? extends Item> item) {
this.gunIcon(item); this.gunItem(item, item.getId().getPath());
this.gunBase(item); }
this.customSeparatedGunModel(item);
public void gunItem(DeferredHolder<Item, ? extends Item> item, String name) {
this.gunIcon(item, name);
this.gunBase(item, name);
this.customSeparatedGunModel(item, name);
} }
} }

View file

@ -44,14 +44,14 @@ public class Glock18Item extends GunItem implements GeoItem {
if (!(stack.getItem() instanceof GunItem)) return PlayState.STOP; if (!(stack.getItem() instanceof GunItem)) return PlayState.STOP;
if (GunData.from(stack).reload.empty()) { if (GunData.from(stack).reload.empty()) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.glock.reload_empty")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.glock_17.reload_empty"));
} }
if (GunData.from(stack).reload.normal()) { if (GunData.from(stack).reload.normal()) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.glock.reload_normal")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.glock_17.reload_normal"));
} }
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.idle")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock_17.idle"));
} }
private PlayState idlePredicate(AnimationState<Glock18Item> event) { private PlayState idlePredicate(AnimationState<Glock18Item> event) {
@ -64,13 +64,13 @@ public class Glock18Item extends GunItem implements GeoItem {
&& ClientEventHandler.cantSprint == 0 && ClientEventHandler.cantSprint == 0
&& !(GunData.from(stack).reload.normal() || GunData.from(stack).reload.empty()) && ClientEventHandler.drawTime < 0.01) { && !(GunData.from(stack).reload.normal() || GunData.from(stack).reload.empty()) && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) { if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.run_fast")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock_17.run_fast"));
} else { } else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.run")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock_17.run"));
} }
} }
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.idle")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock_17.idle"));
} }
@Override @Override

View file

@ -1,27 +0,0 @@
{
"loader": "neoforge:separate_transforms",
"gui_light": "front",
"base": {
"parent": "superbwarfare:item/glock_17_base"
},
"perspectives": {
"gui": {
"parent": "superbwarfare:item/glock17_icon"
},
"thirdperson_righthand": {
"parent": "superbwarfare:item/glock17_3d"
},
"thirdperson_lefthand": {
"parent": "superbwarfare:item/glock17_3d"
},
"ground": {
"parent": "superbwarfare:item/glock17_3d"
},
"fixed": {
"parent": "superbwarfare:item/glock17_3d"
},
"head": {
"parent": "superbwarfare:item/glock17_3d"
}
}
}