2012-11-05 20:29:04 +01:00
|
|
|
package mekanism.common;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
2012-12-20 22:53:39 +01:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.inventory.Container;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraft.world.World;
|
2012-09-08 18:48:24 +02:00
|
|
|
import net.minecraftforge.common.Configuration;
|
2013-04-18 04:40:11 +02:00
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
|
|
|
import cpw.mods.fml.common.registry.TickRegistry;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
/**
|
2012-11-05 20:29:04 +01:00
|
|
|
* Common proxy for the Mekanism mod.
|
2012-08-15 22:41:41 +02:00
|
|
|
* @author AidanBrady
|
|
|
|
*
|
|
|
|
*/
|
2012-08-31 01:27:35 +02:00
|
|
|
public class CommonProxy
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
2012-11-21 16:14:35 +01:00
|
|
|
/**
|
|
|
|
* Register tile entities that have special models. Overwritten in client to register TESRs.
|
|
|
|
*/
|
2013-01-21 02:15:59 +01:00
|
|
|
public void registerSpecialTileEntities()
|
|
|
|
{
|
2013-05-23 19:30:12 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityEnrichmentChamber.class, "EnrichmentChamber");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityOsmiumCompressor.class, "OsmiumCompressor");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityCombiner.class, "Combiner");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityCrusher.class, "Crusher");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityFactory.class, "SmeltingFactory");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityAdvancedFactory.class, "AdvancedSmeltingFactory");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityEliteFactory.class, "UltimateSmeltingFactory");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityPurificationChamber.class, "PurificationChamber");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityEnergizedSmelter.class, "EnergizedSmelter");
|
2013-01-21 02:15:59 +01:00
|
|
|
GameRegistry.registerTileEntity(TileEntityTheoreticalElementizer.class, "TheoreticalElementizer");
|
2013-04-05 22:26:48 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityMetallurgicInfuser.class, "MetallurgicInfuser");
|
2013-02-22 04:03:54 +01:00
|
|
|
GameRegistry.registerTileEntity(TileEntityPressurizedTube.class, "PressurizedTube");
|
2013-03-25 17:00:45 +01:00
|
|
|
GameRegistry.registerTileEntity(TileEntityUniversalCable.class, "UniversalCable");
|
2013-04-05 22:26:48 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityElectricPump.class, "ElectricPump");
|
2013-04-13 02:25:21 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityElectricChest.class, "ElectricChest");
|
2013-04-18 04:40:11 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityMechanicalPipe.class, "MechanicalPipe");
|
2013-04-28 21:23:08 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityDynamicTank.class, "DynamicTank");
|
|
|
|
GameRegistry.registerTileEntity(TileEntityDynamicValve.class, "DynamicValve");
|
2013-05-20 00:43:01 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityChargepad.class, "Chargepad");
|
2013-01-21 02:15:59 +01:00
|
|
|
}
|
2012-11-21 16:14:35 +01:00
|
|
|
|
2013-04-13 16:33:37 +02:00
|
|
|
/**
|
|
|
|
* Registers a client-side sound, assigned to a TileEntity.
|
2013-04-14 17:55:51 +02:00
|
|
|
* @param tileEntity - TileEntity who is registering the sound
|
2013-04-13 16:33:37 +02:00
|
|
|
*/
|
2013-04-18 04:40:11 +02:00
|
|
|
public void registerSound(TileEntity tileEntity) {}
|
2013-04-13 16:33:37 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unregisters a client-side sound, assigned to a TileEntity;
|
2013-04-14 17:55:51 +02:00
|
|
|
* @param tileEntity - TileEntity who is unregistering the sound
|
2013-04-13 16:33:37 +02:00
|
|
|
*/
|
|
|
|
public void unregisterSound(TileEntity tileEntity) {}
|
|
|
|
|
2013-04-13 03:32:43 +02:00
|
|
|
/**
|
|
|
|
* Handles an ELECTRIC_CHEST_CLIENT_OPEN packet via the proxy, not handled on the server-side.
|
|
|
|
* @param entityplayer - player the packet was sent from
|
|
|
|
* @param id - the electric chest gui ID to open
|
|
|
|
* @param windowId - the container-specific window ID
|
|
|
|
* @param isBlock - if the chest is a block
|
|
|
|
* @param x - x coordinate
|
|
|
|
* @param y - y coordinate
|
|
|
|
* @param z - z coordinate
|
|
|
|
*/
|
|
|
|
public void openElectricChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, int x, int y, int z) {}
|
|
|
|
|
2012-08-15 22:41:41 +02:00
|
|
|
/**
|
|
|
|
* Register and load client-only render information.
|
|
|
|
*/
|
2012-09-08 18:48:24 +02:00
|
|
|
public void registerRenderInformation() {}
|
2012-08-31 01:27:35 +02:00
|
|
|
|
2012-09-03 18:11:25 +02:00
|
|
|
/**
|
|
|
|
* Gets the armor index number from ClientProxy.
|
2012-12-30 22:34:45 +01:00
|
|
|
* @param string - armor indicator
|
2012-09-03 18:11:25 +02:00
|
|
|
* @return armor index number
|
|
|
|
*/
|
2012-09-20 15:59:30 +02:00
|
|
|
public int getArmorIndex(String string)
|
2012-08-31 01:27:35 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
/**
|
2012-09-08 18:48:24 +02:00
|
|
|
* Set and load the mod's common configuration properties.
|
2012-08-15 22:41:41 +02:00
|
|
|
*/
|
2012-09-08 18:48:24 +02:00
|
|
|
public void loadConfiguration()
|
2012-08-21 02:34:12 +02:00
|
|
|
{
|
2012-11-05 20:29:04 +01:00
|
|
|
Mekanism.configuration.load();
|
2012-11-21 16:14:35 +01:00
|
|
|
Mekanism.basicBlockID = Mekanism.configuration.getBlock("BasicBlock", 3000).getInt();
|
2012-11-05 20:29:04 +01:00
|
|
|
Mekanism.machineBlockID = Mekanism.configuration.getBlock("MachineBlock", 3001).getInt();
|
|
|
|
Mekanism.oreBlockID = Mekanism.configuration.getBlock("OreBlock", 3002).getInt();
|
|
|
|
Mekanism.obsidianTNTID = Mekanism.configuration.getBlock("ObsidianTNT", 3003).getInt();
|
2012-11-28 16:33:34 +01:00
|
|
|
Mekanism.energyCubeID = Mekanism.configuration.getBlock("EnergyCube", 3004).getInt();
|
2013-03-11 18:49:01 +01:00
|
|
|
Mekanism.boundingBlockID = Mekanism.configuration.getBlock("BoundingBlock", 3005).getInt();
|
2012-12-30 22:34:45 +01:00
|
|
|
Mekanism.gasTankID = Mekanism.configuration.getBlock("GasTank", 3006).getInt();
|
2013-03-25 17:00:45 +01:00
|
|
|
Mekanism.transmitterID = Mekanism.configuration.getBlock("Transmitter", 3007).getInt();
|
2012-12-30 22:34:45 +01:00
|
|
|
Mekanism.extrasEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ExtrasEnabled", true).getBoolean(true);
|
2013-02-27 02:21:30 +01:00
|
|
|
Mekanism.osmiumGenerationEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "OsmiumGenerationEnabled", true).getBoolean(true);
|
2013-01-23 21:42:45 +01:00
|
|
|
Mekanism.disableBCSteelCrafting = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DisableBCSteelCrafting", false).getBoolean(true);
|
|
|
|
Mekanism.disableBCBronzeCrafting = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DisableBCBronzeCrafting", false).getBoolean(true);
|
2013-01-30 13:53:36 +01:00
|
|
|
Mekanism.updateNotifications = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpdateNotifications", true).getBoolean(true);
|
2013-02-14 19:26:13 +01:00
|
|
|
Mekanism.controlCircuitOreDict = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ControlCircuitOreDict", true).getBoolean(true);
|
2013-05-14 17:34:26 +02:00
|
|
|
Mekanism.logPackets = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "LogPackets", false).getBoolean(true);
|
|
|
|
Mekanism.dynamicTankEasterEgg = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DynamicTankEasterEgg", false).getBoolean(true);
|
2013-03-18 17:23:57 +01:00
|
|
|
Mekanism.obsidianTNTDelay = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTDelay", 100).getInt();
|
|
|
|
Mekanism.obsidianTNTBlastRadius = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTBlastRadius", 12).getInt();
|
2013-03-28 18:27:27 +01:00
|
|
|
Mekanism.FROM_IC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "JoulesToEU", 10).getDouble(10);
|
|
|
|
Mekanism.TO_IC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EUToJoules", .1).getDouble(.1);
|
|
|
|
Mekanism.FROM_BC = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "JoulesToMJ", 25).getDouble(25);
|
|
|
|
Mekanism.TO_BC = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MJToJoules", .04).getDouble(.04);
|
2013-05-21 02:37:52 +02:00
|
|
|
Mekanism.ENERGY_PER_REDSTONE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyPerRedstone", 10000).getDouble(10000);
|
2012-11-05 20:29:04 +01:00
|
|
|
Mekanism.configuration.save();
|
2012-08-21 02:34:12 +02:00
|
|
|
}
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
/**
|
2013-04-13 16:33:37 +02:00
|
|
|
* Set up and load the utilities this mod uses.
|
2012-08-15 22:41:41 +02:00
|
|
|
*/
|
2013-04-13 16:33:37 +02:00
|
|
|
public void loadUtilities()
|
2013-01-21 02:15:59 +01:00
|
|
|
{
|
2013-04-21 06:34:54 +02:00
|
|
|
TickRegistry.registerTickHandler(new CommonPlayerTickHandler(), Side.SERVER);
|
|
|
|
TickRegistry.registerTickHandler(new CommonWorldTickHandler(), Side.SERVER);
|
2013-01-21 02:15:59 +01:00
|
|
|
}
|
2012-08-15 22:41:41 +02:00
|
|
|
|
2012-11-05 16:52:56 +01:00
|
|
|
/**
|
|
|
|
* Set up and load the sound handler.
|
|
|
|
*/
|
|
|
|
public void loadSoundHandler() {}
|
|
|
|
|
2012-12-30 22:34:45 +01:00
|
|
|
/**
|
|
|
|
* Unload the sound handler.
|
|
|
|
*/
|
|
|
|
public void unloadSoundHandler() {}
|
|
|
|
|
2013-05-09 14:56:36 +02:00
|
|
|
/**
|
|
|
|
* Whether or not the game is paused.
|
|
|
|
*/
|
2013-04-28 21:23:08 +02:00
|
|
|
public boolean isPaused()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-05-14 17:34:26 +02:00
|
|
|
/**
|
|
|
|
* Does the Dynamic Tank creation animation, starting from the rendering block.
|
|
|
|
*/
|
|
|
|
public void doTankAnimation(TileEntityDynamicTank tileEntity) {}
|
|
|
|
|
2012-08-15 22:41:41 +02:00
|
|
|
/**
|
2012-11-15 21:04:12 +01:00
|
|
|
* Get the actual interface for a GUI. Client-only.
|
2012-08-15 22:41:41 +02:00
|
|
|
* @param ID - gui ID
|
|
|
|
* @param player - player that opened the GUI
|
|
|
|
* @param world - world the GUI was opened in
|
|
|
|
* @param x - gui's x position
|
|
|
|
* @param y - gui's y position
|
|
|
|
* @param z - gui's z position
|
2012-11-15 21:04:12 +01:00
|
|
|
* @return the GuiScreen of the GUI
|
2012-08-15 22:41:41 +02:00
|
|
|
*/
|
2012-09-20 15:59:30 +02:00
|
|
|
public Object getClientGui(int ID, EntityPlayer player, World world, int x, int y, int z)
|
2012-08-31 01:27:35 +02:00
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
/**
|
2012-11-15 21:04:12 +01:00
|
|
|
* Get the container for a GUI. Common.
|
2012-08-15 22:41:41 +02:00
|
|
|
* @param ID - gui ID
|
|
|
|
* @param player - player that opened the GUI
|
|
|
|
* @param world - world the GUI was opened in
|
|
|
|
* @param x - gui's x position
|
|
|
|
* @param y - gui's y position
|
|
|
|
* @param z - gui's z position
|
2012-11-15 21:04:12 +01:00
|
|
|
* @return the Container of the GUI
|
2012-08-15 22:41:41 +02:00
|
|
|
*/
|
|
|
|
public Container getServerGui(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 3:
|
2012-11-15 21:04:12 +01:00
|
|
|
return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 4:
|
2012-11-15 21:04:12 +01:00
|
|
|
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 5:
|
2012-11-15 21:04:12 +01:00
|
|
|
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 6:
|
2012-11-15 21:04:12 +01:00
|
|
|
return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 7:
|
2012-11-15 21:04:12 +01:00
|
|
|
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
2012-10-02 20:39:40 +02:00
|
|
|
case 8:
|
2012-11-28 16:33:34 +01:00
|
|
|
return new ContainerEnergyCube(player.inventory, (TileEntityEnergyCube)tileEntity);
|
2012-11-15 21:04:12 +01:00
|
|
|
case 10:
|
2012-11-21 16:14:35 +01:00
|
|
|
return new ContainerGasTank(player.inventory, (TileEntityGasTank)tileEntity);
|
2012-12-19 21:23:55 +01:00
|
|
|
case 11:
|
2013-03-20 18:58:36 +01:00
|
|
|
return new ContainerFactory(player.inventory, (TileEntityFactory)tileEntity);
|
2012-12-20 22:53:39 +01:00
|
|
|
case 12:
|
|
|
|
return new ContainerMetallurgicInfuser(player.inventory, (TileEntityMetallurgicInfuser)tileEntity);
|
2013-01-21 02:15:59 +01:00
|
|
|
case 13:
|
|
|
|
return new ContainerTeleporter(player.inventory, (TileEntityTeleporter)tileEntity);
|
2013-01-23 21:42:45 +01:00
|
|
|
case 15:
|
|
|
|
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
2013-03-20 21:28:45 +01:00
|
|
|
case 16:
|
|
|
|
return new ContainerElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
|
2013-04-03 21:37:26 +02:00
|
|
|
case 17:
|
|
|
|
return new ContainerElectricPump(player.inventory, (TileEntityElectricPump)tileEntity);
|
2013-04-28 21:23:08 +02:00
|
|
|
case 18:
|
|
|
|
return new ContainerDynamicTank(player.inventory, (TileEntityDynamicTank)tileEntity);
|
2013-05-20 00:43:01 +02:00
|
|
|
case 21:
|
|
|
|
EntityRobit robit = (EntityRobit)world.getEntityByID(x);
|
|
|
|
if(robit != null)
|
|
|
|
{
|
|
|
|
return new ContainerRobitMain(player.inventory, robit);
|
|
|
|
}
|
|
|
|
case 22:
|
|
|
|
return new ContainerRobitCrafting(player.inventory, world);
|
|
|
|
case 23:
|
|
|
|
EntityRobit robit1 = (EntityRobit)world.getEntityByID(x);
|
|
|
|
if(robit1 != null)
|
|
|
|
{
|
|
|
|
return new ContainerRobitInventory(player.inventory, robit1);
|
|
|
|
}
|
2013-05-20 19:51:18 +02:00
|
|
|
case 24:
|
|
|
|
EntityRobit robit2 = (EntityRobit)world.getEntityByID(x);
|
|
|
|
if(robit2 != null)
|
|
|
|
{
|
|
|
|
return new ContainerRobitSmelting(player.inventory, robit2);
|
|
|
|
}
|
2013-05-20 21:06:10 +02:00
|
|
|
case 25:
|
|
|
|
return new ContainerRobitRepair(player.inventory, world);
|
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;
|
|
|
|
}
|
|
|
|
}
|