Fix crash related to loading TileEntitySpecialRenderer on server side. Closes #103

This commit is contained in:
alexbegt 2017-06-28 12:05:53 -04:00
parent 7900ab35b5
commit 282505120e
5 changed files with 26 additions and 12 deletions

View File

@ -46,8 +46,8 @@ targetCompatibility = 1.8
// Setup the forge minecraft plugin data. Specify the preferred forge/minecraft version here
minecraft {
version = "1.12-14.21.0.2359"
mappings = "snapshot_20170623"
version = "1.12-14.21.0.2375"
mappings = "snapshot_20170627"
runDir = "run"
}

View File

@ -59,6 +59,8 @@ public class IronChest
MinecraftForge.EVENT_BUS.register(new ICContent());
proxy.preInit();
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());

View File

@ -12,6 +12,8 @@ package cpw.mods.ironchest.client;
import cpw.mods.ironchest.client.gui.chest.GUIChest;
import cpw.mods.ironchest.client.gui.shulker.GUIShulkerChest;
import cpw.mods.ironchest.client.renderer.chest.TileEntityIronChestRenderer;
import cpw.mods.ironchest.client.renderer.shulker.TileEntityIronShulkerBoxRenderer;
import cpw.mods.ironchest.common.CommonProxy;
import cpw.mods.ironchest.common.blocks.chest.IronChestType;
import cpw.mods.ironchest.common.blocks.shulker.IronShulkerBoxType;
@ -22,12 +24,27 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ClientProxy extends CommonProxy
{
@Override
public void preInit()
{
for (IronChestType type : IronChestType.values())
{
ClientRegistry.bindTileEntitySpecialRenderer(type.clazz, new TileEntityIronChestRenderer());
}
for (IronShulkerBoxType type : IronShulkerBoxType.values())
{
ClientRegistry.bindTileEntitySpecialRenderer(type.clazz, new TileEntityIronShulkerBoxRenderer());
}
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{

View File

@ -22,6 +22,11 @@ import net.minecraftforge.fml.common.network.IGuiHandler;
public class CommonProxy implements IGuiHandler
{
public void preInit()
{
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{

View File

@ -11,8 +11,6 @@
package cpw.mods.ironchest.common;
import cpw.mods.ironchest.IronChest;
import cpw.mods.ironchest.client.renderer.chest.TileEntityIronChestRenderer;
import cpw.mods.ironchest.client.renderer.shulker.TileEntityIronShulkerBoxRenderer;
import cpw.mods.ironchest.common.blocks.chest.BlockIronChest;
import cpw.mods.ironchest.common.blocks.chest.IronChestType;
import cpw.mods.ironchest.common.blocks.shulker.BlockIronShulkerBox;
@ -34,7 +32,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.event.RegistryEvent.Register;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
@ -186,8 +183,6 @@ public class ICContent
ModelLoader.setCustomModelResourceLocation(chestItem, type.ordinal(), new ModelResourceLocation(chestItem.getRegistryName(), "variant=" + type.getName()));
//@formatter:on
}
ClientRegistry.bindTileEntitySpecialRenderer(type.clazz, new TileEntityIronChestRenderer());
}
for (ChestChangerType type : ChestChangerType.VALUES)
@ -214,11 +209,6 @@ public class ICContent
}
}
for (IronShulkerBoxType type : IronShulkerBoxType.values())
{
ClientRegistry.bindTileEntitySpecialRenderer(type.clazz, new TileEntityIronShulkerBoxRenderer());
}
for (ShulkerBoxChangerType type : ShulkerBoxChangerType.VALUES)
{
//@formatter:off