diff --git a/src/main/java/simelectricity/essential/client/BuiltInModelLoader.java b/src/main/java/simelectricity/essential/client/BuiltInModelLoader.java index 2324d1b..7a68336 100644 --- a/src/main/java/simelectricity/essential/client/BuiltInModelLoader.java +++ b/src/main/java/simelectricity/essential/client/BuiltInModelLoader.java @@ -86,10 +86,14 @@ else if (type.equals("distribution_transformer")) { EnumDistributionTransformerBlockType.forName( JSONUtils.getString(modelContents, "part")); - if (blockType.formed) { + if (blockType == EnumDistributionTransformerBlockType.PlaceHolder) { return new ModelGeometryWrapper(null, DistributionTransformerFormedModel.class, (context)->{ return DistributionTransformerFormedModel.instance; }); + } else if (blockType.formed) { + return new ModelGeometryWrapper(null, null, (context)->{ + return DistributionTransformerFormedModel.instanceNoBaking; + }); } else { return new ModelGeometryWrapper(null, DistributionTransformerComponentModel.class, (context)->{ Direction facing = context.getFacing(); diff --git a/src/main/java/simelectricity/essential/client/ModelDataProvider.java b/src/main/java/simelectricity/essential/client/ModelDataProvider.java index 58de0a7..f06dd42 100644 --- a/src/main/java/simelectricity/essential/client/ModelDataProvider.java +++ b/src/main/java/simelectricity/essential/client/ModelDataProvider.java @@ -392,6 +392,16 @@ private void distributionTransformer(BlockDistributionTransformer block) { }); // Generate item model - models().getBuilder("item/"+name).parent(modelFile); + BlockModelBuilder itemModelBuilder = models().getBuilder("item/"+name); + if (blockType.formed) { + itemModelBuilder.parent( + customLoader( + new ResourceLocation(domain, BuiltInModelLoader.dir + name + "_inventory"), + GeneratedModelLoader.placeholder() + ) + ); + } else { + itemModelBuilder.parent(modelFile); + } } } diff --git a/src/main/java/simelectricity/essential/client/grid/transformer/DistributionTransformerFormedModel.java b/src/main/java/simelectricity/essential/client/grid/transformer/DistributionTransformerFormedModel.java index 5fd0dc4..4a31fac 100644 --- a/src/main/java/simelectricity/essential/client/grid/transformer/DistributionTransformerFormedModel.java +++ b/src/main/java/simelectricity/essential/client/grid/transformer/DistributionTransformerFormedModel.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Random; import java.util.function.Function; -import com.google.common.collect.ImmutableList; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.model.BakedQuad; @@ -30,6 +29,7 @@ @OnlyIn(Dist.CLIENT) public class DistributionTransformerFormedModel extends CodeBasedModel { public final static DistributionTransformerFormedModel instance = new DistributionTransformerFormedModel(); + public final static NoBaking instanceNoBaking = new NoBaking(); @EasyTextureLoader.Mark(ResourcePaths.hv_cable) private final TextureAtlasSprite textureCable = null; @@ -60,25 +60,29 @@ private DistributionTransformerFormedModel() { } } } - + + protected boolean skipLegacyTextureRegistration() { + return true; + } + @Override public List getQuads(BlockState state, Direction side, Random rand, IModelData extraData) { if (side != null) - return ImmutableList.of(); + return emptyQuadList; IMultiBlockTile te = extraData.getData(IMultiBlockTile.prop); if (te == null) - return ImmutableList.of(); + return emptyQuadList; MultiBlockTileInfo mbInfo = te.getMultiBlockTileInfo(); if (mbInfo == null) - return ImmutableList.of(); + return emptyQuadList; EnumDistributionTransformerRenderPart part = mbInfo.lookup( BlockDistributionTransformer.renderParts); Direction facing = mbInfo.facing; if (part == null || facing == null) - return ImmutableList.of(); + return emptyQuadList; return quads[part.ordinal()][facing.ordinal()-2]; } @@ -361,4 +365,29 @@ private void bakePart(EnumDistributionTransformerRenderPart part, Direction faci model.translateCoord(0.5F, 0, 0.5F); model.bake(list); } + + private static class NoBaking extends CodeBasedModel { + protected boolean skipLegacyTextureRegistration() { + return true; + } + + @Override + public List getQuads(BlockState state, Direction side, Random rand, IModelData extraData) { + if (instance == null) + return emptyQuadList; + return instance.getQuads(state, side, rand, extraData); + } + + @Override + public TextureAtlasSprite getParticleTexture() { + if (instance == null) + return null; + return instance.getParticleTexture(); + } + + @Override + protected void bake(Function textureRegistry) { + + } + } }