Skip to content

Commit e878324

Browse files
Oxidizing Spears!
1 parent 885ee40 commit e878324

25 files changed

+283
-1
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"model": {
3+
"type": "minecraft:select",
4+
"cases": [
5+
{
6+
"model": {
7+
"type": "minecraft:select",
8+
"cases": [
9+
{
10+
"model": {
11+
"type": "minecraft:range_dispatch",
12+
"entries": [
13+
{
14+
"model": {
15+
"type": "minecraft:model",
16+
"model": "thecopperierage:item/copper_spear_exposed"
17+
},
18+
"threshold": 0.45
19+
},
20+
{
21+
"model": {
22+
"type": "minecraft:model",
23+
"model": "thecopperierage:item/copper_spear_weathered"
24+
},
25+
"threshold": 0.65
26+
},
27+
{
28+
"model": {
29+
"type": "minecraft:model",
30+
"model": "thecopperierage:item/copper_spear_oxidized"
31+
},
32+
"threshold": 0.85
33+
}
34+
],
35+
"fallback": {
36+
"type": "minecraft:model",
37+
"model": "minecraft:item/copper_spear"
38+
},
39+
"property": "minecraft:damage"
40+
},
41+
"when": true
42+
}
43+
],
44+
"fallback": {
45+
"type": "minecraft:model",
46+
"model": "minecraft:item/copper_spear"
47+
},
48+
"property": "thecopperierage:oxidized_items_enabled"
49+
},
50+
"when": [
51+
"gui",
52+
"ground",
53+
"fixed",
54+
"on_shelf"
55+
]
56+
}
57+
],
58+
"fallback": {
59+
"type": "minecraft:select",
60+
"cases": [
61+
{
62+
"model": {
63+
"type": "minecraft:range_dispatch",
64+
"entries": [
65+
{
66+
"model": {
67+
"type": "minecraft:model",
68+
"model": "thecopperierage:item/copper_spear_exposed_in_hand"
69+
},
70+
"threshold": 0.45
71+
},
72+
{
73+
"model": {
74+
"type": "minecraft:model",
75+
"model": "thecopperierage:item/copper_spear_weathered_in_hand"
76+
},
77+
"threshold": 0.65
78+
},
79+
{
80+
"model": {
81+
"type": "minecraft:model",
82+
"model": "thecopperierage:item/copper_spear_oxidized_in_hand"
83+
},
84+
"threshold": 0.85
85+
}
86+
],
87+
"fallback": {
88+
"type": "minecraft:model",
89+
"model": "minecraft:item/copper_spear_in_hand"
90+
},
91+
"property": "minecraft:damage"
92+
},
93+
"when": true
94+
}
95+
],
96+
"fallback": {
97+
"type": "minecraft:model",
98+
"model": "minecraft:item/copper_spear_in_hand"
99+
},
100+
"property": "thecopperierage:oxidized_items_enabled"
101+
},
102+
"property": "minecraft:display_context"
103+
},
104+
"swap_animation_scale": 1.9
105+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"parent": "minecraft:item/generated",
3+
"textures": {
4+
"layer0": "thecopperierage:item/copper_spear_exposed"
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"parent": "minecraft:item/spear_in_hand",
3+
"textures": {
4+
"layer0": "thecopperierage:item/copper_spear_exposed_in_hand"
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"parent": "minecraft:item/generated",
3+
"textures": {
4+
"layer0": "thecopperierage:item/copper_spear_oxidized"
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"parent": "minecraft:item/spear_in_hand",
3+
"textures": {
4+
"layer0": "thecopperierage:item/copper_spear_oxidized_in_hand"
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"parent": "minecraft:item/generated",
3+
"textures": {
4+
"layer0": "thecopperierage:item/copper_spear_weathered"
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"parent": "minecraft:item/spear_in_hand",
3+
"textures": {
4+
"layer0": "thecopperierage:item/copper_spear_weathered_in_hand"
5+
}
6+
}

src/main/generated/data/thecopperierage/tags/item/oxidizable_equipment.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"minecraft:copper_hoe",
66
"minecraft:copper_pickaxe",
77
"minecraft:copper_shovel",
8+
"minecraft:copper_spear",
89
"minecraft:copper_helmet",
910
"minecraft:copper_chestplate",
1011
"minecraft:copper_leggings",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"values": [
3+
"minecraft:copper_spear"
4+
]
5+
}

src/main/java/net/frozenblock/thecopperierage/datagen/model/TCAModelProvider.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import net.minecraft.client.data.models.model.TextureSlot;
4646
import net.minecraft.client.renderer.block.model.VariantMutator;
4747
import static net.minecraft.client.renderer.item.ItemModel.Unbaked;
48+
import net.minecraft.client.renderer.item.ClientItem;
4849
import net.minecraft.client.renderer.item.SelectItemModel;
4950
import net.minecraft.client.renderer.item.properties.numeric.Damage;
5051
import net.minecraft.client.renderer.item.properties.numeric.UseCycle;
@@ -147,6 +148,8 @@ public void generateItemModels(@NotNull ItemModelGenerators generator) {
147148
generateOxidizableItem(generator, Items.COPPER_SHOVEL, ModelTemplates.FLAT_HANDHELD_ITEM, false);
148149
generateOxidizableItem(generator, Items.COPPER_SWORD, ModelTemplates.FLAT_HANDHELD_ITEM, false);
149150

151+
generateOxidizableSpear(generator, Items.COPPER_SPEAR, false);
152+
150153
generateOxidizableTrimmableItem(generator, Items.COPPER_HELMET, EquipmentAssets.COPPER, ItemModelGenerators.TRIM_PREFIX_HELMET);
151154
generateOxidizableTrimmableItem(generator, Items.COPPER_CHESTPLATE, EquipmentAssets.COPPER, ItemModelGenerators.TRIM_PREFIX_CHESTPLATE);
152155
generateOxidizableTrimmableItem(generator, Items.COPPER_LEGGINGS, EquipmentAssets.COPPER, ItemModelGenerators.TRIM_PREFIX_LEGGINGS);
@@ -294,6 +297,33 @@ private static void generateOxidizableItem(@NotNull ItemModelGenerators generato
294297
generator.itemModelOutput.accept(item, createOxidizableDispatch(unaffected, exposed, weathered, oxidized));
295298
}
296299

300+
private static void generateOxidizableSpear(@NotNull ItemModelGenerators generator, Item item, boolean generateFirstModel) {
301+
final Unbaked unaffected = generateFirstModel
302+
? ItemModelUtils.plainModel(generator.createFlatItemModel(item, ModelTemplates.FLAT_ITEM))
303+
: ItemModelUtils.plainModel(ModelLocationUtils.getModelLocation(item));
304+
final Unbaked unaffectedInHand = generateFirstModel
305+
? ItemModelUtils.plainModel(ModelTemplates.SPEAR_IN_HAND.create(item, TextureMapping.layer0(TextureMapping.getItemTexture(item, "_in_hand")), generator.modelOutput))
306+
: ItemModelUtils.plainModel(ModelLocationUtils.getModelLocation(item, "_in_hand"));
307+
308+
final Unbaked exposed = ItemModelUtils.plainModel(createFlatItemModelWithTCANamespace(generator, item, "_exposed", ModelTemplates.FLAT_ITEM));
309+
final Unbaked exposedInHand = ItemModelUtils.plainModel(createFlatItemModelWithTCANamespace(generator, item, "_exposed_in_hand", ModelTemplates.SPEAR_IN_HAND));
310+
311+
final Unbaked weathered = ItemModelUtils.plainModel(createFlatItemModelWithTCANamespace(generator, item, "_weathered", ModelTemplates.FLAT_ITEM));
312+
final Unbaked weatheredInHand = ItemModelUtils.plainModel(createFlatItemModelWithTCANamespace(generator, item, "_weathered_in_hand", ModelTemplates.SPEAR_IN_HAND));
313+
314+
final Unbaked oxidized = ItemModelUtils.plainModel(createFlatItemModelWithTCANamespace(generator, item, "_oxidized", ModelTemplates.FLAT_ITEM));
315+
final Unbaked oxidizedInHand = ItemModelUtils.plainModel(createFlatItemModelWithTCANamespace(generator, item, "_oxidized_in_hand", ModelTemplates.SPEAR_IN_HAND));
316+
317+
generator.itemModelOutput.accept(
318+
item,
319+
ItemModelGenerators.createFlatModelDispatch(
320+
createOxidizableDispatch(unaffected, exposed, weathered, oxidized),
321+
createOxidizableDispatch(unaffectedInHand, exposedInHand, weatheredInHand, oxidizedInHand)
322+
),
323+
new ClientItem.Properties(true, false, 1.9F)
324+
);
325+
}
326+
297327
private static void generateOxidizableBrush(@NotNull ItemModelGenerators generator) {
298328
generator.itemModelOutput
299329
.accept(

0 commit comments

Comments
 (0)