diff --git a/src/main/java/biomesoplenty/common/init/ModBlocks.java b/src/main/java/biomesoplenty/common/init/ModBlocks.java index df67c334d..415808c15 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -14,10 +14,6 @@ import net.minecraft.block.BlockSlab; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.statemap.IStateMapper; -import net.minecraft.client.renderer.block.statemap.StateMap; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; @@ -270,10 +266,7 @@ public class ModBlocks public static void registerBlockVariant(Block block, String stateName, int stateMeta) { Item item = Item.getItemFromBlock(block); - if (item != null && FMLCommonHandler.instance().getSide() == Side.CLIENT) { - ModelBakery.addVariantName(item, BiomesOPlenty.MOD_ID + ":" + stateName); - ModelLoader.setCustomModelResourceLocation(item, stateMeta, new ModelResourceLocation(BiomesOPlenty.MOD_ID + ":" + stateName, "inventory")); - } + BiomesOPlenty.proxy.registerItemVariantModel(item, stateName, stateMeta); BOPCommand.blockCount++; } @@ -296,13 +289,7 @@ public class ModBlocks IBOPBlock bopBlock = (IBOPBlock)block; GameRegistry.registerBlock(block, bopBlock.getItemClass(), blockName); - IProperty[] nonRenderingProperties = bopBlock.getNonRenderingProperties(); - if (nonRenderingProperties != null) - { - // use a custom state mapper which will ignore the properties specified in the block as being non-rendering - IStateMapper custom_mapper = (new StateMap.Builder()).addPropertiesToIgnore(nonRenderingProperties).build(); - ModelLoader.setCustomStateMapper(block, custom_mapper); - } + BiomesOPlenty.proxy.registerNonRenderingProperties(block); // check for missing default states IBlockState defaultState = block.getDefaultState(); diff --git a/src/main/java/biomesoplenty/common/util/config/GeneratorTypeAdaptor.java b/src/main/java/biomesoplenty/common/util/config/GeneratorTypeAdaptor.java index 5e6580284..1ff9b125c 100644 --- a/src/main/java/biomesoplenty/common/util/config/GeneratorTypeAdaptor.java +++ b/src/main/java/biomesoplenty/common/util/config/GeneratorTypeAdaptor.java @@ -77,7 +77,7 @@ public class GeneratorTypeAdaptor implements JsonSerializer, JsonDes } catch (InstantiationException e) { - throw new RuntimeException("Generators must have a no-args constructor!", e); + throw new RuntimeException("Generators must have a no-args constructor", e); } catch (IllegalAccessException e) { @@ -85,6 +85,10 @@ public class GeneratorTypeAdaptor implements JsonSerializer, JsonDes } } } + else + { + throw new JsonSyntaxException("Entry missing generator property"); + } return null; } diff --git a/src/main/java/biomesoplenty/core/ClientProxy.java b/src/main/java/biomesoplenty/core/ClientProxy.java index 30768b424..ce314c1f2 100644 --- a/src/main/java/biomesoplenty/core/ClientProxy.java +++ b/src/main/java/biomesoplenty/core/ClientProxy.java @@ -8,8 +8,17 @@ package biomesoplenty.core; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.client.renderer.block.statemap.IStateMapper; +import net.minecraft.client.renderer.block.statemap.StateMap; +import net.minecraft.client.resources.model.ModelBakery; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.ModelLoader; +import biomesoplenty.api.block.IBOPBlock; import biomesoplenty.common.config.MiscConfigurationHandler; @@ -25,4 +34,31 @@ public class ClientProxy extends CommonProxy //Entity rendering and other stuff will go here in future } + + @Override + public void registerItemVariantModel(Item item, String name, int metadata) + { + if (item != null) + { + ModelBakery.addVariantName(item, BiomesOPlenty.MOD_ID + ":" + name); + ModelLoader.setCustomModelResourceLocation(item, metadata, new ModelResourceLocation(BiomesOPlenty.MOD_ID + ":" + name, "inventory")); + } + } + + @Override + public void registerNonRenderingProperties(Block block) + { + if (block instanceof IBOPBlock) + { + IBOPBlock bopBlock = (IBOPBlock)block; + IProperty[] nonRenderingProperties = bopBlock.getNonRenderingProperties(); + + if (nonRenderingProperties != null) + { + // use a custom state mapper which will ignore the properties specified in the block as being non-rendering + IStateMapper custom_mapper = (new StateMap.Builder()).addPropertiesToIgnore(nonRenderingProperties).build(); + ModelLoader.setCustomStateMapper(block, custom_mapper); + } + } + } } diff --git a/src/main/java/biomesoplenty/core/CommonProxy.java b/src/main/java/biomesoplenty/core/CommonProxy.java index 92f99075b..8bf004fea 100644 --- a/src/main/java/biomesoplenty/core/CommonProxy.java +++ b/src/main/java/biomesoplenty/core/CommonProxy.java @@ -8,8 +8,14 @@ package biomesoplenty.core; +import net.minecraft.block.Block; +import net.minecraft.item.Item; + public class CommonProxy { public void registerRenderers() {} + + public void registerItemVariantModel(Item item, String name, int metadata) {} + public void registerNonRenderingProperties(Block block) {} } \ No newline at end of file