From e29bae36edc97a93199236f07bfdaa0b3f30fee1 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Sat, 2 May 2015 14:27:39 +1000 Subject: [PATCH] Fixed server crashing (Again!) --- build.properties | 2 +- .../java/biomesoplenty/common/init/ModBlocks.java | 5 +---- .../biomesoplenty/common/init/ModHandlers.java | 15 ++++++++++++++- src/main/java/biomesoplenty/core/ClientProxy.java | 11 +++++++++++ src/main/java/biomesoplenty/core/CommonProxy.java | 2 ++ 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/build.properties b/build.properties index 6c123d074..11669146e 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,5 @@ minecraft_version=1.8 -forge_version=11.14.1.1322 +forge_version=11.14.1.1397 mod_version=3.0.0 curse_project_id=220318 curse_release_type=alpha diff --git a/src/main/java/biomesoplenty/common/init/ModBlocks.java b/src/main/java/biomesoplenty/common/init/ModBlocks.java index adbbd84ce..9839dc209 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -201,11 +201,8 @@ public class ModBlocks public static Block registerFluidBlock(Fluid fluid, BlockFluidBase fluidBlock, String name) { Block block = GameRegistry.registerBlock(fluidBlock, null, name); - // use a custom state mapper which will ignore the LEVEL property - IStateMapper custom_mapper = (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] {BlockFluidBase.LEVEL}).build(); - ModelLoader.setCustomStateMapper(block, custom_mapper); + BiomesOPlenty.proxy.registerFluidBlockRendering(block, name); fluid.setBlock(fluidBlock); - ModelBakeHandler.fluidsToTextureStitch.add(name); return block; } diff --git a/src/main/java/biomesoplenty/common/init/ModHandlers.java b/src/main/java/biomesoplenty/common/init/ModHandlers.java index c82022490..15beb9113 100644 --- a/src/main/java/biomesoplenty/common/init/ModHandlers.java +++ b/src/main/java/biomesoplenty/common/init/ModHandlers.java @@ -9,6 +9,9 @@ package biomesoplenty.common.init; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import biomesoplenty.client.handler.ModelBakeHandler; import biomesoplenty.common.handler.DyeEventHandler; import biomesoplenty.common.handler.GuiEventHandler; @@ -24,8 +27,18 @@ public class ModHandlers DecorateBiomeEventHandler decorateBiomeHandler = new DecorateBiomeEventHandler(); MinecraftForge.EVENT_BUS.register(decorateBiomeHandler); MinecraftForge.TERRAIN_GEN_BUS.register(decorateBiomeHandler); + MinecraftForge.EVENT_BUS.register(new DyeEventHandler()); + + if (FMLCommonHandler.instance().getSide() == Side.CLIENT) + { + registerClientEvents(); + } + } + + @SideOnly(Side.CLIENT) + private static void registerClientEvents() + { MinecraftForge.EVENT_BUS.register(new ModelBakeHandler()); MinecraftForge.EVENT_BUS.register(new GuiEventHandler()); - MinecraftForge.EVENT_BUS.register(new DyeEventHandler()); } } diff --git a/src/main/java/biomesoplenty/core/ClientProxy.java b/src/main/java/biomesoplenty/core/ClientProxy.java index 365c8b1b4..0f473554d 100644 --- a/src/main/java/biomesoplenty/core/ClientProxy.java +++ b/src/main/java/biomesoplenty/core/ClientProxy.java @@ -23,9 +23,11 @@ import net.minecraft.item.Item; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fluids.BlockFluidBase; import net.minecraftforge.fml.client.registry.RenderingRegistry; import biomesoplenty.api.block.IBOPBlock; import biomesoplenty.api.particle.BOPParticleTypes; +import biomesoplenty.client.handler.ModelBakeHandler; import biomesoplenty.client.particle.*; import biomesoplenty.common.config.MiscConfigurationHandler; import biomesoplenty.common.entities.EntityPixie; @@ -84,6 +86,15 @@ public class ClientProxy extends CommonProxy } } + @Override + public void registerFluidBlockRendering(Block block, String name) + { + // use a custom state mapper which will ignore the LEVEL property + IStateMapper custom_mapper = (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] {BlockFluidBase.LEVEL}).build(); + ModelLoader.setCustomStateMapper(block, custom_mapper); + ModelBakeHandler.fluidsToTextureStitch.add(name); + } + @Override public void spawnParticle(BOPParticleTypes type, double x, double y, double z) { diff --git a/src/main/java/biomesoplenty/core/CommonProxy.java b/src/main/java/biomesoplenty/core/CommonProxy.java index 502a1bc25..5a17791eb 100644 --- a/src/main/java/biomesoplenty/core/CommonProxy.java +++ b/src/main/java/biomesoplenty/core/CommonProxy.java @@ -11,6 +11,7 @@ package biomesoplenty.core; import biomesoplenty.api.particle.BOPParticleTypes; import net.minecraft.block.Block; import net.minecraft.item.Item; +import net.minecraftforge.fluids.BlockFluidBase; public class CommonProxy @@ -18,5 +19,6 @@ public class CommonProxy public void registerRenderers() {} public void registerItemVariantModel(Item item, String name, int metadata) {} public void registerNonRenderingProperties(Block block) {} + public void registerFluidBlockRendering(Block block, String name) {} public void spawnParticle(BOPParticleTypes type, double x, double y, double z) {} } \ No newline at end of file