2012-11-05 20:29:04 +01:00
|
|
|
package mekanism.client;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
|
2013-07-20 18:10:14 +02:00
|
|
|
import java.io.File;
|
2013-04-14 17:55:51 +02:00
|
|
|
import java.util.HashMap;
|
2013-04-13 16:33:37 +02:00
|
|
|
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.client.gui.GuiCombiner;
|
2013-10-30 20:22:43 +01:00
|
|
|
import mekanism.client.gui.GuiConfiguration;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.client.gui.GuiCredits;
|
|
|
|
import mekanism.client.gui.GuiCrusher;
|
2013-11-20 00:16:26 +01:00
|
|
|
import mekanism.client.gui.GuiDigitalMiner;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.client.gui.GuiDynamicTank;
|
|
|
|
import mekanism.client.gui.GuiElectricChest;
|
|
|
|
import mekanism.client.gui.GuiElectricPump;
|
|
|
|
import mekanism.client.gui.GuiEnergizedSmelter;
|
|
|
|
import mekanism.client.gui.GuiEnergyCube;
|
|
|
|
import mekanism.client.gui.GuiEnrichmentChamber;
|
|
|
|
import mekanism.client.gui.GuiFactory;
|
|
|
|
import mekanism.client.gui.GuiGasTank;
|
|
|
|
import mekanism.client.gui.GuiMetallurgicInfuser;
|
|
|
|
import mekanism.client.gui.GuiOsmiumCompressor;
|
|
|
|
import mekanism.client.gui.GuiPasswordEnter;
|
|
|
|
import mekanism.client.gui.GuiPasswordModify;
|
|
|
|
import mekanism.client.gui.GuiPortableTeleporter;
|
|
|
|
import mekanism.client.gui.GuiPurificationChamber;
|
|
|
|
import mekanism.client.gui.GuiRobitCrafting;
|
|
|
|
import mekanism.client.gui.GuiRobitInventory;
|
|
|
|
import mekanism.client.gui.GuiRobitMain;
|
|
|
|
import mekanism.client.gui.GuiRobitRepair;
|
|
|
|
import mekanism.client.gui.GuiRobitSmelting;
|
2013-11-28 22:01:23 +01:00
|
|
|
import mekanism.client.gui.GuiRotaryCondensentrator;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.client.gui.GuiTeleporter;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.client.render.MekanismRenderer;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.client.render.RenderTickHandler;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.client.render.block.BasicRenderingHandler;
|
|
|
|
import mekanism.client.render.block.MachineRenderingHandler;
|
|
|
|
import mekanism.client.render.block.TransmitterRenderingHandler;
|
2013-11-03 17:38:36 +01:00
|
|
|
import mekanism.client.render.entity.RenderObsidianTNTPrimed;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.client.render.entity.RenderRobit;
|
|
|
|
import mekanism.client.render.item.ItemRenderingHandler;
|
2013-11-12 01:27:36 +01:00
|
|
|
import mekanism.client.render.tileentity.RenderBin;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.client.render.tileentity.RenderChargepad;
|
|
|
|
import mekanism.client.render.tileentity.RenderConfigurableMachine;
|
2013-11-21 02:28:06 +01:00
|
|
|
import mekanism.client.render.tileentity.RenderDigitalMiner;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.client.render.tileentity.RenderDynamicTank;
|
|
|
|
import mekanism.client.render.tileentity.RenderElectricChest;
|
|
|
|
import mekanism.client.render.tileentity.RenderElectricPump;
|
2013-11-03 02:07:55 +01:00
|
|
|
import mekanism.client.render.tileentity.RenderEnergyCube;
|
2013-11-03 17:38:36 +01:00
|
|
|
import mekanism.client.render.tileentity.RenderGasTank;
|
2013-11-02 03:36:06 +01:00
|
|
|
import mekanism.client.render.tileentity.RenderLogisticalSorter;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.client.render.tileentity.RenderLogisticalTransporter;
|
|
|
|
import mekanism.client.render.tileentity.RenderMechanicalPipe;
|
|
|
|
import mekanism.client.render.tileentity.RenderMetallurgicInfuser;
|
2013-11-03 17:38:36 +01:00
|
|
|
import mekanism.client.render.tileentity.RenderObsidianTNT;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.client.render.tileentity.RenderPressurizedTube;
|
2013-11-28 00:17:44 +01:00
|
|
|
import mekanism.client.render.tileentity.RenderRotaryCondensentrator;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.client.render.tileentity.RenderUniversalCable;
|
|
|
|
import mekanism.client.sound.Sound;
|
|
|
|
import mekanism.client.sound.SoundHandler;
|
2012-11-05 20:29:04 +01:00
|
|
|
import mekanism.common.CommonProxy;
|
|
|
|
import mekanism.common.EntityObsidianTNT;
|
2013-05-20 00:43:01 +02:00
|
|
|
import mekanism.common.EntityRobit;
|
2013-11-30 18:29:49 +01:00
|
|
|
import mekanism.common.IInvConfiguration;
|
2013-04-13 03:32:43 +02:00
|
|
|
import mekanism.common.IElectricChest;
|
2012-11-05 20:29:04 +01:00
|
|
|
import mekanism.common.Mekanism;
|
2013-11-27 22:17:10 +01:00
|
|
|
import mekanism.common.block.BlockMachine.MachineType;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.common.inventory.InventoryElectricChest;
|
|
|
|
import mekanism.common.item.ItemPortableTeleporter;
|
|
|
|
import mekanism.common.tileentity.TileEntityAdvancedElectricMachine;
|
|
|
|
import mekanism.common.tileentity.TileEntityAdvancedFactory;
|
2013-11-12 01:27:36 +01:00
|
|
|
import mekanism.common.tileentity.TileEntityBin;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.common.tileentity.TileEntityChargepad;
|
|
|
|
import mekanism.common.tileentity.TileEntityCombiner;
|
|
|
|
import mekanism.common.tileentity.TileEntityCrusher;
|
2013-11-18 21:33:14 +01:00
|
|
|
import mekanism.common.tileentity.TileEntityDigitalMiner;
|
2013-11-24 19:12:42 +01:00
|
|
|
import mekanism.common.tileentity.TileEntityDiversionTransporter;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.common.tileentity.TileEntityDynamicTank;
|
|
|
|
import mekanism.common.tileentity.TileEntityDynamicValve;
|
|
|
|
import mekanism.common.tileentity.TileEntityElectricChest;
|
|
|
|
import mekanism.common.tileentity.TileEntityElectricMachine;
|
|
|
|
import mekanism.common.tileentity.TileEntityElectricPump;
|
|
|
|
import mekanism.common.tileentity.TileEntityEliteFactory;
|
|
|
|
import mekanism.common.tileentity.TileEntityEnergizedSmelter;
|
|
|
|
import mekanism.common.tileentity.TileEntityEnergyCube;
|
|
|
|
import mekanism.common.tileentity.TileEntityEnrichmentChamber;
|
|
|
|
import mekanism.common.tileentity.TileEntityFactory;
|
|
|
|
import mekanism.common.tileentity.TileEntityGasTank;
|
2013-11-02 03:36:06 +01:00
|
|
|
import mekanism.common.tileentity.TileEntityLogisticalSorter;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
|
|
|
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
|
|
|
import mekanism.common.tileentity.TileEntityMetallurgicInfuser;
|
2013-11-03 17:38:36 +01:00
|
|
|
import mekanism.common.tileentity.TileEntityObsidianTNT;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.common.tileentity.TileEntityOsmiumCompressor;
|
|
|
|
import mekanism.common.tileentity.TileEntityPressurizedTube;
|
|
|
|
import mekanism.common.tileentity.TileEntityPurificationChamber;
|
2013-11-28 00:17:44 +01:00
|
|
|
import mekanism.common.tileentity.TileEntityRotaryCondensentrator;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.common.tileentity.TileEntityTeleporter;
|
|
|
|
import mekanism.common.tileentity.TileEntityUniversalCable;
|
2013-07-20 18:10:14 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2012-12-20 22:53:39 +01:00
|
|
|
import net.minecraft.client.gui.GuiScreen;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2013-01-21 02:15:59 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
2012-12-20 22:53:39 +01:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraft.world.World;
|
2012-08-15 22:41:41 +02:00
|
|
|
import net.minecraftforge.client.MinecraftForgeClient;
|
2013-02-14 19:26:13 +01:00
|
|
|
import net.minecraftforge.common.Configuration;
|
2012-12-20 22:53:39 +01:00
|
|
|
import cpw.mods.fml.client.FMLClientHandler;
|
2012-12-23 20:46:11 +01:00
|
|
|
import cpw.mods.fml.client.registry.ClientRegistry;
|
2013-10-14 18:44:07 +02:00
|
|
|
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
2012-12-20 22:53:39 +01:00
|
|
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
2013-04-13 16:33:37 +02:00
|
|
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
2012-12-20 22:53:39 +01:00
|
|
|
import cpw.mods.fml.common.registry.TickRegistry;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
2013-04-13 16:33:37 +02:00
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
/**
|
2012-11-05 20:29:04 +01:00
|
|
|
* Client proxy for the Mekanism mod.
|
2012-08-15 22:41:41 +02:00
|
|
|
* @author AidanBrady
|
|
|
|
*
|
|
|
|
*/
|
2013-04-13 16:33:37 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
2012-08-15 22:41:41 +02:00
|
|
|
public class ClientProxy extends CommonProxy
|
|
|
|
{
|
2013-04-28 21:23:08 +02:00
|
|
|
public static int MACHINE_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
2013-03-25 17:00:45 +01:00
|
|
|
public static int TRANSMITTER_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
2013-04-28 21:23:08 +02:00
|
|
|
public static int BASIC_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
2012-11-28 16:33:34 +01:00
|
|
|
|
2013-02-14 19:26:13 +01:00
|
|
|
@Override
|
|
|
|
public void loadConfiguration()
|
|
|
|
{
|
|
|
|
super.loadConfiguration();
|
|
|
|
|
|
|
|
Mekanism.configuration.load();
|
2013-10-15 05:36:07 +02:00
|
|
|
MekanismClient.enableSounds = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableSounds", true).getBoolean(true);
|
|
|
|
MekanismClient.fancyUniversalCableRender = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "FancyUniversalCableRender", true).getBoolean(true);
|
2013-04-13 16:33:37 +02:00
|
|
|
Mekanism.configuration.save();
|
2013-02-14 19:26:13 +01:00
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-31 01:27:35 +02:00
|
|
|
public int getArmorIndex(String string)
|
|
|
|
{
|
|
|
|
return RenderingRegistry.addNewArmourRendererPrefix(string);
|
|
|
|
}
|
|
|
|
|
2013-04-13 16:33:37 +02:00
|
|
|
@Override
|
2013-04-14 17:55:51 +02:00
|
|
|
public void registerSound(TileEntity tileEntity)
|
2013-04-13 16:33:37 +02:00
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
if(MekanismClient.enableSounds && Minecraft.getMinecraft().sndManager.sndSystem != null)
|
2013-04-13 16:33:37 +02:00
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
synchronized(MekanismClient.audioHandler.sounds)
|
2013-04-28 21:23:08 +02:00
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
MekanismClient.audioHandler.register(tileEntity);
|
2013-04-28 21:23:08 +02:00
|
|
|
}
|
2013-04-13 16:33:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void unregisterSound(TileEntity tileEntity)
|
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
if(MekanismClient.enableSounds && Minecraft.getMinecraft().sndManager.sndSystem != null)
|
2013-04-13 16:33:37 +02:00
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
synchronized(MekanismClient.audioHandler.sounds)
|
2013-04-13 16:33:37 +02:00
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
if(MekanismClient.audioHandler.getFrom(tileEntity) != null)
|
2013-04-28 21:23:08 +02:00
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
MekanismClient.audioHandler.getFrom(tileEntity).remove();
|
2013-04-28 21:23:08 +02:00
|
|
|
}
|
2013-04-13 16:33:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-13 03:32:43 +02:00
|
|
|
@Override
|
|
|
|
public void openElectricChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, int x, int y, int z)
|
|
|
|
{
|
|
|
|
TileEntityElectricChest tileEntity = (TileEntityElectricChest)entityplayer.worldObj.getBlockTileEntity(x, y, z);
|
|
|
|
|
|
|
|
if(id == 0)
|
|
|
|
{
|
|
|
|
if(isBlock)
|
|
|
|
{
|
|
|
|
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiElectricChest(entityplayer.inventory, tileEntity));
|
|
|
|
entityplayer.openContainer.windowId = windowId;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
FMLClientHandler.instance().getClient().sndManager.playSoundFX("random.chestopen", 1.0F, 1.0F);
|
|
|
|
ItemStack stack = entityplayer.getCurrentEquippedItem();
|
2013-04-19 21:43:00 +02:00
|
|
|
|
2013-11-27 22:17:10 +01:00
|
|
|
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
|
2013-04-13 03:32:43 +02:00
|
|
|
{
|
2013-04-19 21:43:00 +02:00
|
|
|
InventoryElectricChest inventory = new InventoryElectricChest(entityplayer);
|
2013-04-13 03:32:43 +02:00
|
|
|
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiElectricChest(entityplayer.inventory, inventory));
|
|
|
|
entityplayer.openContainer.windowId = windowId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(id == 1)
|
|
|
|
{
|
|
|
|
if(isBlock)
|
|
|
|
{
|
|
|
|
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPasswordEnter(tileEntity));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ItemStack stack = entityplayer.getCurrentEquippedItem();
|
2013-11-13 04:43:06 +01:00
|
|
|
|
2013-11-27 22:17:10 +01:00
|
|
|
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
|
2013-04-13 03:32:43 +02:00
|
|
|
{
|
|
|
|
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPasswordEnter(stack));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(id == 2)
|
|
|
|
{
|
|
|
|
if(isBlock)
|
|
|
|
{
|
|
|
|
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPasswordModify(tileEntity));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ItemStack stack = entityplayer.getCurrentEquippedItem();
|
2013-11-13 04:43:06 +01:00
|
|
|
|
2013-11-27 22:17:10 +01:00
|
|
|
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
|
2013-04-13 03:32:43 +02:00
|
|
|
{
|
|
|
|
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPasswordModify(stack));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-23 20:46:11 +01:00
|
|
|
@Override
|
|
|
|
public void registerSpecialTileEntities()
|
|
|
|
{
|
2013-05-23 19:30:12 +02:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityEnrichmentChamber.class, "EnrichmentChamber", new RenderConfigurableMachine());
|
|
|
|
ClientRegistry.registerTileEntity(TileEntityOsmiumCompressor.class, "OsmiumCompressor", new RenderConfigurableMachine());
|
|
|
|
ClientRegistry.registerTileEntity(TileEntityCombiner.class, "Combiner", new RenderConfigurableMachine());
|
2013-11-18 21:33:14 +01:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityCrusher.class, "Crusher", new RenderConfigurableMachine());
|
2013-05-23 19:30:12 +02:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityFactory.class, "SmeltingFactory", new RenderConfigurableMachine());
|
|
|
|
ClientRegistry.registerTileEntity(TileEntityAdvancedFactory.class, "AdvancedSmeltingFactory", new RenderConfigurableMachine());
|
|
|
|
ClientRegistry.registerTileEntity(TileEntityEliteFactory.class, "UltimateSmeltingFactory", new RenderConfigurableMachine());
|
|
|
|
ClientRegistry.registerTileEntity(TileEntityPurificationChamber.class, "PurificationChamber", new RenderConfigurableMachine());
|
|
|
|
ClientRegistry.registerTileEntity(TileEntityEnergizedSmelter.class, "EnergizedSmelter", new RenderConfigurableMachine());
|
2013-04-05 22:26:48 +02:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityMetallurgicInfuser.class, "MetallurgicInfuser", new RenderMetallurgicInfuser());
|
2013-11-03 17:38:36 +01:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityObsidianTNT.class, "ObsidianTNT", new RenderObsidianTNT());
|
|
|
|
ClientRegistry.registerTileEntity(TileEntityGasTank.class, "GasTank", new RenderGasTank());
|
2013-11-03 02:07:55 +01:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityEnergyCube.class, "EnergyCube", new RenderEnergyCube());
|
2013-02-22 04:03:54 +01:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityPressurizedTube.class, "PressurizedTube", new RenderPressurizedTube());
|
2013-03-25 17:00:45 +01:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityUniversalCable.class, "UniversalCable", new RenderUniversalCable());
|
2013-04-05 22:26:48 +02:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityElectricPump.class, "ElectricPump", new RenderElectricPump());
|
2013-04-13 02:25:21 +02:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityElectricChest.class, "ElectricChest", new RenderElectricChest());
|
2013-04-18 04:40:11 +02:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityMechanicalPipe.class, "MechanicalPipe", new RenderMechanicalPipe());
|
2013-04-28 21:23:08 +02:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityDynamicTank.class, "DynamicTank", new RenderDynamicTank());
|
|
|
|
ClientRegistry.registerTileEntity(TileEntityDynamicValve.class, "DynamicValve", new RenderDynamicTank());
|
2013-05-20 00:43:01 +02:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityChargepad.class, "Chargepad", new RenderChargepad());
|
2013-08-06 05:58:44 +02:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityLogisticalTransporter.class, "LogisticalTransporter", new RenderLogisticalTransporter());
|
2013-11-23 21:01:18 +01:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityDiversionTransporter.class, "DiversionTransporter", new RenderLogisticalTransporter());
|
2013-11-02 03:36:06 +01:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityLogisticalSorter.class, "LogisticalSorter", new RenderLogisticalSorter());
|
2013-11-12 01:27:36 +01:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityBin.class, "Bin", new RenderBin());
|
2013-11-21 02:28:06 +01:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityDigitalMiner.class, "DigitalMiner", new RenderDigitalMiner());
|
2013-11-28 00:17:44 +01:00
|
|
|
ClientRegistry.registerTileEntity(TileEntityRotaryCondensentrator.class, "RotaryCondensentrator", new RenderRotaryCondensentrator());
|
2012-12-23 20:46:11 +01:00
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-15 22:41:41 +02:00
|
|
|
public void registerRenderInformation()
|
|
|
|
{
|
|
|
|
//Register entity rendering handlers
|
2013-11-03 17:38:36 +01:00
|
|
|
RenderingRegistry.registerEntityRenderingHandler(EntityObsidianTNT.class, new RenderObsidianTNTPrimed());
|
2013-05-20 00:43:01 +02:00
|
|
|
RenderingRegistry.registerEntityRenderingHandler(EntityRobit.class, new RenderRobit());
|
2012-11-21 16:14:35 +01:00
|
|
|
|
2012-11-28 16:33:34 +01:00
|
|
|
//Register item handler
|
2013-11-13 04:43:06 +01:00
|
|
|
ItemRenderingHandler handler = new ItemRenderingHandler();
|
|
|
|
|
|
|
|
MinecraftForgeClient.registerItemRenderer(Mekanism.energyCubeID, handler);
|
|
|
|
MinecraftForgeClient.registerItemRenderer(Mekanism.machineBlockID, handler);
|
2013-11-27 22:17:10 +01:00
|
|
|
MinecraftForgeClient.registerItemRenderer(Mekanism.machineBlock2ID, handler);
|
2013-11-13 04:43:06 +01:00
|
|
|
MinecraftForgeClient.registerItemRenderer(Mekanism.Robit.itemID, handler);
|
|
|
|
MinecraftForgeClient.registerItemRenderer(Mekanism.WalkieTalkie.itemID, handler);
|
|
|
|
MinecraftForgeClient.registerItemRenderer(Mekanism.gasTankID, handler);
|
|
|
|
MinecraftForgeClient.registerItemRenderer(Mekanism.obsidianTNTID, handler);
|
|
|
|
MinecraftForgeClient.registerItemRenderer(Mekanism.basicBlockID, handler);
|
2012-12-23 20:46:11 +01:00
|
|
|
|
2013-02-22 04:03:54 +01:00
|
|
|
//Register block handlers
|
2013-05-20 00:43:01 +02:00
|
|
|
RenderingRegistry.registerBlockHandler(new MachineRenderingHandler());
|
2013-08-27 00:49:32 +02:00
|
|
|
RenderingRegistry.registerBlockHandler(new TransmitterRenderingHandler());
|
2013-04-28 21:23:08 +02:00
|
|
|
RenderingRegistry.registerBlockHandler(new BasicRenderingHandler());
|
2012-11-28 16:33:34 +01:00
|
|
|
|
|
|
|
System.out.println("[Mekanism] Render registrations complete.");
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-15 22:41:41 +02:00
|
|
|
public GuiScreen getClientGui(int ID, EntityPlayer player, World world, int x, int y, int z)
|
|
|
|
{
|
2012-11-15 21:04:12 +01:00
|
|
|
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
|
|
|
|
2012-08-15 22:41:41 +02:00
|
|
|
switch(ID)
|
|
|
|
{
|
2012-09-25 21:15:47 +02:00
|
|
|
case 1:
|
2012-08-15 22:41:41 +02:00
|
|
|
return new GuiCredits();
|
2013-11-18 21:33:14 +01:00
|
|
|
case 2:
|
2013-11-20 00:16:26 +01:00
|
|
|
return new GuiDigitalMiner(player.inventory, (TileEntityDigitalMiner)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 3:
|
2013-01-23 21:42:45 +01:00
|
|
|
return new GuiEnrichmentChamber(player.inventory, (TileEntityElectricMachine)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 4:
|
2013-02-27 02:21:30 +01:00
|
|
|
return new GuiOsmiumCompressor(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 5:
|
2013-01-23 21:42:45 +01:00
|
|
|
return new GuiCombiner(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 6:
|
2013-01-23 21:42:45 +01:00
|
|
|
return new GuiCrusher(player.inventory, (TileEntityElectricMachine)tileEntity);
|
2013-11-28 00:17:44 +01:00
|
|
|
case 7:
|
2013-11-28 22:01:23 +01:00
|
|
|
return new GuiRotaryCondensentrator(player.inventory, (TileEntityRotaryCondensentrator)tileEntity);
|
2012-10-02 20:39:40 +02:00
|
|
|
case 8:
|
2012-11-28 16:33:34 +01:00
|
|
|
return new GuiEnergyCube(player.inventory, (TileEntityEnergyCube)tileEntity);
|
2012-10-28 23:18:23 +01:00
|
|
|
case 9:
|
2013-11-30 18:29:49 +01:00
|
|
|
return new GuiConfiguration(player, (IInvConfiguration)tileEntity);
|
2012-11-25 16:45:00 +01:00
|
|
|
case 10:
|
2012-11-21 16:14:35 +01:00
|
|
|
return new GuiGasTank(player.inventory, (TileEntityGasTank)tileEntity);
|
2012-12-19 21:23:55 +01:00
|
|
|
case 11:
|
2013-03-20 16:14:26 +01:00
|
|
|
return new GuiFactory(player.inventory, (TileEntityFactory)tileEntity);
|
2012-12-20 22:53:39 +01:00
|
|
|
case 12:
|
|
|
|
return new GuiMetallurgicInfuser(player.inventory, (TileEntityMetallurgicInfuser)tileEntity);
|
2013-01-21 02:15:59 +01:00
|
|
|
case 13:
|
|
|
|
return new GuiTeleporter(player.inventory, (TileEntityTeleporter)tileEntity);
|
|
|
|
case 14:
|
|
|
|
ItemStack itemStack = player.getCurrentEquippedItem();
|
|
|
|
if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter)
|
|
|
|
{
|
|
|
|
return new GuiPortableTeleporter(player, itemStack);
|
|
|
|
}
|
2013-01-23 21:42:45 +01:00
|
|
|
case 15:
|
|
|
|
return new GuiPurificationChamber(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
2013-03-20 21:28:45 +01:00
|
|
|
case 16:
|
|
|
|
return new GuiEnergizedSmelter(player.inventory, (TileEntityElectricMachine)tileEntity);
|
2013-04-03 21:37:26 +02:00
|
|
|
case 17:
|
|
|
|
return new GuiElectricPump(player.inventory, (TileEntityElectricPump)tileEntity);
|
2013-04-28 21:23:08 +02:00
|
|
|
case 18:
|
|
|
|
return new GuiDynamicTank(player.inventory, (TileEntityDynamicTank)tileEntity);
|
2013-04-13 02:25:21 +02:00
|
|
|
case 19:
|
|
|
|
return new GuiPasswordEnter((TileEntityElectricChest)tileEntity);
|
|
|
|
case 20:
|
|
|
|
return new GuiPasswordModify((TileEntityElectricChest)tileEntity);
|
2013-05-20 00:43:01 +02:00
|
|
|
case 21:
|
|
|
|
EntityRobit robit = (EntityRobit)world.getEntityByID(x);
|
|
|
|
if(robit != null)
|
|
|
|
{
|
|
|
|
return new GuiRobitMain(player.inventory, robit);
|
|
|
|
}
|
|
|
|
case 22:
|
|
|
|
return new GuiRobitCrafting(player.inventory, world, x);
|
|
|
|
case 23:
|
|
|
|
EntityRobit robit1 = (EntityRobit)world.getEntityByID(x);
|
|
|
|
if(robit1 != null)
|
|
|
|
{
|
|
|
|
return new GuiRobitInventory(player.inventory, robit1);
|
|
|
|
}
|
2013-05-20 19:51:18 +02:00
|
|
|
case 24:
|
|
|
|
EntityRobit robit2 = (EntityRobit)world.getEntityByID(x);
|
|
|
|
if(robit2 != null)
|
|
|
|
{
|
|
|
|
return new GuiRobitSmelting(player.inventory, robit2);
|
|
|
|
}
|
2013-05-20 21:06:10 +02:00
|
|
|
case 25:
|
|
|
|
return new GuiRobitRepair(player.inventory, world, x);
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
2013-05-20 00:43:01 +02:00
|
|
|
|
2012-08-15 22:41:41 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-05-14 17:34:26 +02:00
|
|
|
@Override
|
|
|
|
public void doTankAnimation(TileEntityDynamicTank tileEntity)
|
|
|
|
{
|
|
|
|
new ThreadTankSparkle(tileEntity).start();
|
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2013-04-13 16:33:37 +02:00
|
|
|
public void loadUtilities()
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
2013-04-13 16:33:37 +02:00
|
|
|
super.loadUtilities();
|
2013-01-21 02:15:59 +01:00
|
|
|
|
2012-08-15 22:41:41 +02:00
|
|
|
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
|
2013-03-31 00:13:59 +01:00
|
|
|
TickRegistry.registerTickHandler(new ClientPlayerTickHandler(), Side.CLIENT);
|
2013-05-14 17:34:26 +02:00
|
|
|
TickRegistry.registerTickHandler(new RenderTickHandler(), Side.CLIENT);
|
2013-04-13 16:33:37 +02:00
|
|
|
|
|
|
|
NetworkRegistry.instance().registerConnectionHandler(new ClientConnectionHandler());
|
2013-10-14 18:44:07 +02:00
|
|
|
|
|
|
|
KeyBindingRegistry.registerKeyBinding(new MekanismKeyHandler());
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
2012-11-05 16:52:56 +01:00
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-11-05 16:52:56 +01:00
|
|
|
public void loadSoundHandler()
|
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
if(MekanismClient.enableSounds)
|
2013-02-14 19:26:13 +01:00
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
MekanismClient.audioHandler = new SoundHandler();
|
2013-02-14 19:26:13 +01:00
|
|
|
}
|
2012-11-05 16:52:56 +01:00
|
|
|
}
|
2012-12-30 22:34:45 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void unloadSoundHandler()
|
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
if(MekanismClient.enableSounds)
|
2012-12-30 22:34:45 +01:00
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
if(MekanismClient.audioHandler != null)
|
2012-12-30 22:34:45 +01:00
|
|
|
{
|
2013-10-15 05:36:07 +02:00
|
|
|
synchronized(MekanismClient.audioHandler.sounds)
|
2013-04-28 21:23:08 +02:00
|
|
|
{
|
|
|
|
HashMap<TileEntity, Sound> sounds = new HashMap<TileEntity, Sound>();
|
2013-10-15 05:36:07 +02:00
|
|
|
sounds.putAll(MekanismClient.audioHandler.sounds);
|
2013-04-28 21:23:08 +02:00
|
|
|
|
|
|
|
for(Sound sound : sounds.values())
|
|
|
|
{
|
|
|
|
sound.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-24 19:12:42 +01:00
|
|
|
@Override
|
|
|
|
public void preInit()
|
|
|
|
{
|
|
|
|
MekanismRenderer.init();
|
|
|
|
}
|
|
|
|
|
2013-11-18 21:33:14 +01:00
|
|
|
@Override
|
|
|
|
public double getReach(EntityPlayer player)
|
|
|
|
{
|
|
|
|
return Minecraft.getMinecraft().playerController.getBlockReachDistance();
|
|
|
|
}
|
|
|
|
|
2013-04-28 21:23:08 +02:00
|
|
|
@Override
|
|
|
|
public boolean isPaused()
|
|
|
|
{
|
|
|
|
if(FMLClientHandler.instance().getClient().isSingleplayer() && !FMLClientHandler.instance().getClient().getIntegratedServer().getPublic())
|
|
|
|
{
|
|
|
|
GuiScreen screen = FMLClientHandler.instance().getClient().currentScreen;
|
|
|
|
|
2013-11-29 03:43:53 +01:00
|
|
|
if(screen != null && screen.doesGuiPauseGame())
|
2013-04-28 21:23:08 +02:00
|
|
|
{
|
2013-11-29 03:43:53 +01:00
|
|
|
return true;
|
2012-12-30 22:34:45 +01:00
|
|
|
}
|
|
|
|
}
|
2013-04-28 21:23:08 +02:00
|
|
|
|
|
|
|
return false;
|
2012-12-30 22:34:45 +01:00
|
|
|
}
|
2013-07-20 18:10:14 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public File getMinecraftDir()
|
|
|
|
{
|
|
|
|
return Minecraft.getMinecraft().mcDataDir;
|
|
|
|
}
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|