From d02f290089e3fee11475a34521085c9d310342de Mon Sep 17 00:00:00 2001 From: TeamSpen210 Date: Sun, 29 Dec 2019 17:59:37 +1000 Subject: [PATCH] Replace all the bookshelf models, in a more robust manner --- .../inspirations/building/BuildingClientProxy.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/knightminer/inspirations/building/BuildingClientProxy.java b/src/main/java/knightminer/inspirations/building/BuildingClientProxy.java index ae7eb34f..d82fc5b0 100644 --- a/src/main/java/knightminer/inspirations/building/BuildingClientProxy.java +++ b/src/main/java/knightminer/inspirations/building/BuildingClientProxy.java @@ -11,9 +11,11 @@ import knightminer.inspirations.library.client.ClientUtil; import knightminer.inspirations.library.util.TextureBlockUtil; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScreenManager; +import net.minecraft.client.renderer.BlockModelShapes; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.client.renderer.model.ModelResourceLocation; @@ -184,8 +186,8 @@ private static void replaceBookshelfModel(ModelBakeEvent event, BookshelfBlock s if (shelf.getRegistryName() == null) { throw new AssertionError("Null registry name"); } - for(Direction facing : Direction.Plane.HORIZONTAL){ - ModelResourceLocation location = new ModelResourceLocation(shelf.getRegistryName(), String.format("facing=%s", facing.getName())); + for (BlockState state:shelf.getStateContainer().getValidStates()) { + ModelResourceLocation location = BlockModelShapes.getModelLocation(shelf.getRegistryName(), state); replaceModel(event, location, BookshelfModel::new); } replaceTexturedModel(event, new ModelResourceLocation(shelf.getRegistryName(), "inventory"), "texture",true);