diff --git a/src/main/java/net/zepalesque/redux/data/gen/ReduxItemModelGen.java b/src/main/java/net/zepalesque/redux/data/gen/ReduxItemModelGen.java index 7524f47be..bfc5ae257 100644 --- a/src/main/java/net/zepalesque/redux/data/gen/ReduxItemModelGen.java +++ b/src/main/java/net/zepalesque/redux/data/gen/ReduxItemModelGen.java @@ -27,20 +27,20 @@ protected void registerModels() { this.itemBlock(ReduxBlocks.SENTRY_STONE_BASE.get()); this.itemBlock(ReduxBlocks.SENTRY_STONE_PILLAR.get()); - this.itemOverlayBlock(ReduxBlocks.LOCKED_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get(), "dungeon/lock"); - this.itemOverlayBlock(ReduxBlocks.LOCKED_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get(), "dungeon/lock"); - this.itemOverlayBlock(ReduxBlocks.LOCKED_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get(), "dungeon/lock"); - this.itemOverlayBlock(ReduxBlocks.LOCKED_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get(), "dungeon/lock"); - - this.itemOverlayBlock(ReduxBlocks.TRAPPED_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get(), "dungeon/exclamation"); - this.itemOverlayBlock(ReduxBlocks.TRAPPED_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get(), "dungeon/exclamation"); - this.itemOverlayBlock(ReduxBlocks.TRAPPED_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get(), "dungeon/exclamation"); - this.itemOverlayBlock(ReduxBlocks.TRAPPED_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get(), "dungeon/exclamation"); - - this.itemOverlayBlock(ReduxBlocks.BOSS_DOORWAY_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get(), "dungeon/door"); - this.itemOverlayBlock(ReduxBlocks.BOSS_DOORWAY_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get(), "dungeon/door"); - this.itemOverlayBlock(ReduxBlocks.BOSS_DOORWAY_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get(), "dungeon/door"); - this.itemOverlayBlock(ReduxBlocks.BOSS_DOORWAY_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get(), "dungeon/door"); + this.itemOverlayColumn(ReduxBlocks.LOCKED_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get(), "dungeon/lock", "dungeon/"); + this.itemOverlayColumn(ReduxBlocks.LOCKED_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get(), "dungeon/lock", "dungeon/"); + this.itemOverlayColumn(ReduxBlocks.LOCKED_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get(), "dungeon/lock", "dungeon/"); + this.itemOverlayColumn(ReduxBlocks.LOCKED_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get(), "dungeon/lock", "dungeon/"); + + this.itemOverlayColumn(ReduxBlocks.TRAPPED_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get(), "dungeon/exclamation", "dungeon/"); + this.itemOverlayColumn(ReduxBlocks.TRAPPED_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get(), "dungeon/exclamation", "dungeon/"); + this.itemOverlayColumn(ReduxBlocks.TRAPPED_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get(), "dungeon/exclamation", "dungeon/"); + this.itemOverlayColumn(ReduxBlocks.TRAPPED_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get(), "dungeon/exclamation", "dungeon/"); + + this.itemOverlayColumn(ReduxBlocks.BOSS_DOORWAY_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get(), "dungeon/door", "dungeon/"); + this.itemOverlayColumn(ReduxBlocks.BOSS_DOORWAY_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get(), "dungeon/door", "dungeon/"); + this.itemOverlayColumn(ReduxBlocks.BOSS_DOORWAY_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get(), "dungeon/door", "dungeon/"); + this.itemOverlayColumn(ReduxBlocks.BOSS_DOORWAY_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get(), "dungeon/door", "dungeon/"); } } diff --git a/src/main/java/net/zepalesque/redux/data/prov/ReduxBlockStateProvider.java b/src/main/java/net/zepalesque/redux/data/prov/ReduxBlockStateProvider.java index 9d4d7ffd5..7ff28c1be 100644 --- a/src/main/java/net/zepalesque/redux/data/prov/ReduxBlockStateProvider.java +++ b/src/main/java/net/zepalesque/redux/data/prov/ReduxBlockStateProvider.java @@ -3,6 +3,7 @@ import com.aetherteam.aether.block.dungeon.DoorwayBlock; import com.aetherteam.aether.data.providers.AetherBlockStateProvider; import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.PackOutput; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; @@ -140,4 +141,17 @@ public void invisiblePillar(Block block, Block other, String location) { .partialState().with(BlockStateProperties.AXIS, Direction.Axis.X).with(DoorwayBlock.INVISIBLE, true) .modelForState().modelFile(invisible).addModel(); } + + public static ResourceLocation extendStatic(ResourceLocation location, String suffix) { + return new ResourceLocation(location.getNamespace(), location.getPath() + suffix); + } + + public static String nameStatic(Block block) { + ResourceLocation location = BuiltInRegistries.BLOCK.getKey(block); + if (location != null) { + return location.getPath(); + } else { + throw new IllegalStateException("Unknown block: " + block.toString()); + } + } } diff --git a/src/main/java/net/zepalesque/redux/data/prov/ReduxItemModelProvider.java b/src/main/java/net/zepalesque/redux/data/prov/ReduxItemModelProvider.java index 85122b9fe..1a06647fe 100644 --- a/src/main/java/net/zepalesque/redux/data/prov/ReduxItemModelProvider.java +++ b/src/main/java/net/zepalesque/redux/data/prov/ReduxItemModelProvider.java @@ -3,11 +3,13 @@ import com.aetherteam.aether.Aether; import com.aetherteam.aether.data.providers.AetherItemModelProvider; import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.PackOutput; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.level.block.Block; import net.neoforged.neoforge.client.model.generators.ItemModelBuilder; +import net.neoforged.neoforge.client.model.generators.ModelFile; import net.neoforged.neoforge.common.data.ExistingFileHelper; import java.util.function.Supplier; @@ -15,7 +17,8 @@ public abstract class ReduxItemModelProvider extends AetherItemModelProvider { public ReduxItemModelProvider(PackOutput output, String id, ExistingFileHelper helper) { - super(output, id, helper); } + super(output, id, helper); + } public ItemModelBuilder itemBlockFlat(Supplier block, String location) { return withExistingParent(blockName(block.get()), mcLoc("item/generated")) @@ -28,8 +31,46 @@ public ItemModelBuilder itemBlockFlatCustomTexture(Supplier blo } public void itemOverlayBlock(Block block, Block baseBlock, String overlay) { - this.withExistingParent(this.blockName(block), this.texture(this.blockName(baseBlock))) + this.withExistingParent(this.blockName(block), this.blockName(baseBlock)) + .texture("overlay", new ResourceLocation(Aether.MODID, "block/" + overlay)) + .element().from(0.0F, 0.0F, -0.1F).to(16.0F, 16.0F, -0.1F).rotation().angle(0.0F).axis(Direction.Axis.Y).origin(8.0F, 8.0F, 6.9F).end().face(Direction.NORTH).texture("#overlay").emissivity(15, 15).end().end() + .transforms() + .transform(ItemDisplayContext.THIRD_PERSON_RIGHT_HAND).rotation(75.0F, 45.0F, 0.0F).translation(0.0F, 2.5F, 0.0F).scale(0.375F, 0.375F, 0.375F).end() + .transform(ItemDisplayContext.THIRD_PERSON_LEFT_HAND).rotation(75.0F, 45.0F, 0.0F).translation(0.0F, 2.5F, 0.0F).scale(0.375F, 0.375F, 0.375F).end() + .transform(ItemDisplayContext.FIRST_PERSON_RIGHT_HAND).rotation(-90.0F, -180.0F, -45.0F).scale(0.4F, 0.4F, 0.4F).end() + .transform(ItemDisplayContext.FIRST_PERSON_LEFT_HAND).rotation(-90.0F, -180.0F, -45.0F).scale(0.4F, 0.4F, 0.4F).end() + .transform(ItemDisplayContext.GROUND).rotation(90.0F, 0.0F, 0.0F).translation(0.0F, 3.0F, 0.0F).scale(0.25F, 0.25F, 0.25F).end() + .transform(ItemDisplayContext.GUI).rotation(30.0F, 135.0F, 0.0F).scale(0.625F, 0.625F, 0.625F).end() + .transform(ItemDisplayContext.FIXED).scale(0.5F, 0.5F, 0.5F).end() + .end(); + } + + public void itemOverlayColumn(Block block, Block baseBlock, String overlay, String location) { + ResourceLocation side = ReduxBlockStateProvider.extendStatic(this.texture(ReduxBlockStateProvider.nameStatic(baseBlock), location), "_side"); + ResourceLocation end = ReduxBlockStateProvider.extendStatic(this.texture(ReduxBlockStateProvider.nameStatic(baseBlock), location), "_top"); + this.withExistingParent(this.blockName(block), BLOCK_FOLDER + "/cube_column") .texture("overlay", new ResourceLocation(Aether.MODID, "block/" + overlay)) - .element().from(0.0F, 0.0F, -0.1F).to(16.0F, 16.0F, -0.1F).rotation().angle(0.0F).axis(Direction.Axis.Y).origin(8.0F, 8.0F, 6.9F).end().face(Direction.NORTH).texture("#overlay").emissivity(15, 15).end().end(); + .texture("side", side) + .texture("end", end) + .element().from(0.0F, 0.0F, 0.0F).to(16.0F, 16.0F, 16.0F) + .face(Direction.UP).texture("#end").end() + .face(Direction.DOWN).texture("#end").end() + .face(Direction.NORTH).texture("#side").end() + .face(Direction.SOUTH).texture("#side").end() + .face(Direction.EAST).texture("#side").end() + .face(Direction.WEST).texture("#side").end() + .end() + .element().from(0.0F, 0.0F, -0.1F).to(16.0F, 16.0F, -0.1F).rotation().angle(0.0F).axis(Direction.Axis.Y).origin(8.0F, 8.0F, 6.9F).end().face(Direction.NORTH).texture("#overlay").emissivity(15, 15).end().end() + .transforms() + .transform(ItemDisplayContext.THIRD_PERSON_RIGHT_HAND).rotation(75.0F, 45.0F, 0.0F).translation(0.0F, 2.5F, 0.0F).scale(0.375F, 0.375F, 0.375F).end() + .transform(ItemDisplayContext.THIRD_PERSON_LEFT_HAND).rotation(75.0F, 45.0F, 0.0F).translation(0.0F, 2.5F, 0.0F).scale(0.375F, 0.375F, 0.375F).end() + .transform(ItemDisplayContext.FIRST_PERSON_RIGHT_HAND).rotation(-90.0F, -180.0F, -45.0F).scale(0.4F, 0.4F, 0.4F).end() + .transform(ItemDisplayContext.FIRST_PERSON_LEFT_HAND).rotation(-90.0F, -180.0F, -45.0F).scale(0.4F, 0.4F, 0.4F).end() + .transform(ItemDisplayContext.GROUND).rotation(90.0F, 0.0F, 0.0F).translation(0.0F, 3.0F, 0.0F).scale(0.25F, 0.25F, 0.25F).end() + .transform(ItemDisplayContext.GUI).rotation(30.0F, 135.0F, 0.0F).scale(0.625F, 0.625F, 0.625F).end() + .transform(ItemDisplayContext.FIXED).scale(0.5F, 0.5F, 0.5F).end() + .end(); } + + }