Skip to content

Commit dfba2e5

Browse files
committed
Fixes #894
add ability to use handheld parent tag for rendering of cyphers/trinkets/artifacts
1 parent 3c5d9df commit dfba2e5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexItemModels.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import net.minecraftforge.common.data.ExistingFileHelper;
2727
import net.minecraftforge.registries.ForgeRegistries;
2828

29+
import java.util.Arrays;
2930
import java.util.Objects;
3031
import java.util.function.BiFunction;
3132

@@ -36,6 +37,8 @@ public HexItemModels(PackOutput output, ExistingFileHelper existingFileHelper) {
3637

3738
private static final String[] PHIAL_SIZES = {"small", "medium", "large", "larger", "largest"};
3839

40+
private static final Integer[] PACKAGED_SPELL_HANDHELD_VARIANTS = {5};
41+
3942
private static String getPath(Item item) {
4043
return Objects.requireNonNull(ForgeRegistries.ITEMS.getKey(item)).getPath();
4144
}
@@ -276,11 +279,14 @@ private void buildPackagedSpell(Item item, String stub, int numVariants) {
276279
var name = getPath(item);
277280
var builder = getBuilder(name);
278281
for (int i = 0; i < numVariants; i++) {
279-
var plain = i == 0 ? singleTexture(name, new ResourceLocation("item/generated"),
282+
283+
var parent_tag = Arrays.asList(PACKAGED_SPELL_HANDHELD_VARIANTS).contains(i) ? "item/handheld_rod" : "item/generated";
284+
285+
var plain = i == 0 ? singleTexture(name, new ResourceLocation(parent_tag),
280286
"layer0", modLoc("item/cad/" + i + "_" + stub))
281-
: withExistingParent(name + "_" + i, new ResourceLocation("item/generated"))
287+
: withExistingParent(name + "_" + i, new ResourceLocation(parent_tag))
282288
.texture("layer0", modLoc("item/cad/" + i + "_" + stub));
283-
var filled = withExistingParent(name + "_" + i + "_filled", new ResourceLocation("item/generated"))
289+
var filled = withExistingParent(name + "_" + i + "_filled", new ResourceLocation(parent_tag))
284290
.texture("layer0", modLoc("item/cad/" + i + "_" + stub))
285291
.texture("layer1", modLoc("item/cad/" + i + "_" + stub + "_overlay"));
286292
builder.override().predicate(ItemFocus.VARIANT_PRED, i).predicate(ItemPackagedHex.HAS_PATTERNS_PRED, -0.01f)

0 commit comments

Comments
 (0)