From df1308de75fe6e73b5ae9f16c14be05b8f437541 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Fri, 13 Mar 2015 06:32:48 +1100 Subject: [PATCH] Fixed server crashing Closes #426 --- .../java/biomesoplenty/common/handler/GuiEventHandler.java | 4 ++++ src/main/java/biomesoplenty/common/init/ModBlocks.java | 4 ++-- src/main/java/biomesoplenty/core/ClientProxy.java | 7 +++++++ src/main/java/biomesoplenty/core/CommonProxy.java | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/biomesoplenty/common/handler/GuiEventHandler.java b/src/main/java/biomesoplenty/common/handler/GuiEventHandler.java index 2b5d54ee8..cc0d37d28 100644 --- a/src/main/java/biomesoplenty/common/handler/GuiEventHandler.java +++ b/src/main/java/biomesoplenty/common/handler/GuiEventHandler.java @@ -18,6 +18,8 @@ import net.minecraft.world.WorldType; import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent; import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import biomesoplenty.common.config.MiscConfigurationHandler; import biomesoplenty.common.init.ModBiomes; @@ -25,6 +27,7 @@ public class GuiEventHandler { public static int blockCount = 0; + @SideOnly(Side.CLIENT) @SubscribeEvent public void onPreInitCreateWorld(InitGuiEvent.Pre event) { @@ -38,6 +41,7 @@ public class GuiEventHandler } } + @SideOnly(Side.CLIENT) @SubscribeEvent public void onDrawScreen(DrawScreenEvent.Post event) { diff --git a/src/main/java/biomesoplenty/common/init/ModBlocks.java b/src/main/java/biomesoplenty/common/init/ModBlocks.java index b3e02a728..ef66cdf76 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -76,7 +76,7 @@ public class ModBlocks { String stateName = block.getStateName(state, true); - ModelBakery.addVariantName(Item.getItemFromBlock(block), BiomesOPlenty.MOD_ID + ":" + stateName); + BiomesOPlenty.proxy.addVariantName(Item.getItemFromBlock(block), BiomesOPlenty.MOD_ID + ":" + stateName); BiomesOPlenty.proxy.registerBlockForMeshing(block, block.getMetaFromState(state), stateName); GuiEventHandler.blockCount++; @@ -86,7 +86,7 @@ public class ModBlocks { GameRegistry.registerBlock(block, name); - ModelBakery.addVariantName(Item.getItemFromBlock(block), BiomesOPlenty.MOD_ID + ":" + name); + BiomesOPlenty.proxy.addVariantName(Item.getItemFromBlock(block), BiomesOPlenty.MOD_ID + ":" + name); BiomesOPlenty.proxy.registerBlockForMeshing(block, 0, name); GuiEventHandler.blockCount++; diff --git a/src/main/java/biomesoplenty/core/ClientProxy.java b/src/main/java/biomesoplenty/core/ClientProxy.java index a14b7c188..d63168eae 100644 --- a/src/main/java/biomesoplenty/core/ClientProxy.java +++ b/src/main/java/biomesoplenty/core/ClientProxy.java @@ -11,6 +11,7 @@ package biomesoplenty.core; import java.util.ArrayList; import java.util.Map.Entry; +import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.item.Item; import biomesoplenty.api.block.BOPBlock; import biomesoplenty.client.util.ModelHelper; @@ -28,6 +29,12 @@ public class ClientProxy extends CommonProxy } } + @Override + public void addVariantName(Item item, String... names) + { + ModelBakery.addVariantName(item, names); + } + @Override public void registerBlockForMeshing(BOPBlock block, int metadata, String name) { diff --git a/src/main/java/biomesoplenty/core/CommonProxy.java b/src/main/java/biomesoplenty/core/CommonProxy.java index b40ba6dbc..6e2bf0419 100644 --- a/src/main/java/biomesoplenty/core/CommonProxy.java +++ b/src/main/java/biomesoplenty/core/CommonProxy.java @@ -17,6 +17,8 @@ public class CommonProxy public void registerRenderers() { } + + public void addVariantName(Item item, String... names) {} public void registerBlockForMeshing(BOPBlock block, int metadata, String name) {