2012-11-05 20:29:04 +01:00
|
|
|
package mekanism.common;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
2013-01-21 02:15:59 +01:00
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
|
|
|
import cpw.mods.fml.common.registry.TickRegistry;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import mekanism.client.GuiTeleporter;
|
|
|
|
import mekanism.generators.common.TileEntityAdvancedSolarGenerator;
|
2012-12-20 22:53:39 +01:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.inventory.Container;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2013-01-05 05:58:53 +01:00
|
|
|
import net.minecraft.util.MovingObjectPosition;
|
2012-12-20 22:53:39 +01:00
|
|
|
import net.minecraft.world.World;
|
2012-09-08 18:48:24 +02:00
|
|
|
import net.minecraftforge.common.Configuration;
|
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()
|
|
|
|
{
|
|
|
|
GameRegistry.registerTileEntity(TileEntityTheoreticalElementizer.class, "TheoreticalElementizer");
|
2013-02-22 04:03:54 +01:00
|
|
|
GameRegistry.registerTileEntity(TileEntityPressurizedTube.class, "PressurizedTube");
|
2013-01-21 02:15:59 +01:00
|
|
|
}
|
2012-11-21 16:14:35 +01:00
|
|
|
|
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 world the client is using from ClientProxy.
|
|
|
|
* @return client world
|
|
|
|
*/
|
2012-09-20 15:59:30 +02:00
|
|
|
public World getClientWorld()
|
2012-09-03 18:11:25 +02:00
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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-02-22 04:03:54 +01:00
|
|
|
Mekanism.pressurizedTubeID = Mekanism.configuration.getBlock("PressurizedTube", 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-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();
|
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
|
|
|
|
|
|
|
/**
|
2012-09-08 18:48:24 +02:00
|
|
|
* Load and initiate utilities for the mod's proxy.
|
2012-08-15 22:41:41 +02:00
|
|
|
*/
|
2012-09-08 18:48:24 +02:00
|
|
|
public void loadUtilities() {}
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
/**
|
2013-01-21 02:15:59 +01:00
|
|
|
* Set up and load the tick handlers.
|
2012-08-15 22:41:41 +02:00
|
|
|
*/
|
2013-01-21 02:15:59 +01:00
|
|
|
public void loadTickHandler()
|
|
|
|
{
|
|
|
|
TickRegistry.registerTickHandler(new CommonTickHandler(), Side.SERVER);
|
|
|
|
}
|
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() {}
|
|
|
|
|
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);
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|