Fixed server crashing Closes #426

This commit is contained in:
Adubbz 2015-03-13 06:32:48 +11:00
parent b3eaca7d51
commit df1308de75
4 changed files with 15 additions and 2 deletions

View file

@ -18,6 +18,8 @@ import net.minecraft.world.WorldType;
import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent; import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent;
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 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.config.MiscConfigurationHandler;
import biomesoplenty.common.init.ModBiomes; import biomesoplenty.common.init.ModBiomes;
@ -25,6 +27,7 @@ public class GuiEventHandler
{ {
public static int blockCount = 0; public static int blockCount = 0;
@SideOnly(Side.CLIENT)
@SubscribeEvent @SubscribeEvent
public void onPreInitCreateWorld(InitGuiEvent.Pre event) public void onPreInitCreateWorld(InitGuiEvent.Pre event)
{ {
@ -38,6 +41,7 @@ public class GuiEventHandler
} }
} }
@SideOnly(Side.CLIENT)
@SubscribeEvent @SubscribeEvent
public void onDrawScreen(DrawScreenEvent.Post event) public void onDrawScreen(DrawScreenEvent.Post event)
{ {

View file

@ -76,7 +76,7 @@ public class ModBlocks
{ {
String stateName = block.getStateName(state, true); 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); BiomesOPlenty.proxy.registerBlockForMeshing(block, block.getMetaFromState(state), stateName);
GuiEventHandler.blockCount++; GuiEventHandler.blockCount++;
@ -86,7 +86,7 @@ public class ModBlocks
{ {
GameRegistry.registerBlock(block, name); 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); BiomesOPlenty.proxy.registerBlockForMeshing(block, 0, name);
GuiEventHandler.blockCount++; GuiEventHandler.blockCount++;

View file

@ -11,6 +11,7 @@ package biomesoplenty.core;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Map.Entry; import java.util.Map.Entry;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import biomesoplenty.api.block.BOPBlock; import biomesoplenty.api.block.BOPBlock;
import biomesoplenty.client.util.ModelHelper; 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 @Override
public void registerBlockForMeshing(BOPBlock block, int metadata, String name) public void registerBlockForMeshing(BOPBlock block, int metadata, String name)
{ {

View file

@ -18,6 +18,8 @@ public class CommonProxy
{ {
} }
public void addVariantName(Item item, String... names) {}
public void registerBlockForMeshing(BOPBlock block, int metadata, String name) public void registerBlockForMeshing(BOPBlock block, int metadata, String name)
{ {
} }