2012-11-25 10:45:00 -05:00
|
|
|
package mekanism.generators.common;
|
|
|
|
|
|
2014-08-01 00:58:12 +01:00
|
|
|
import mekanism.api.MekanismConfig.generators;
|
2012-11-25 10:45:00 -05:00
|
|
|
import mekanism.common.Mekanism;
|
2016-01-25 00:13:42 -05:00
|
|
|
import mekanism.common.base.IGuiProvider;
|
2016-05-21 13:58:09 -04:00
|
|
|
import mekanism.common.inventory.container.ContainerFilter;
|
2014-07-28 04:24:56 +01:00
|
|
|
import mekanism.common.inventory.container.ContainerNull;
|
2015-03-29 12:50:15 -04:00
|
|
|
import mekanism.common.tile.TileEntityContainerBlock;
|
2014-06-02 23:57:40 +02:00
|
|
|
import mekanism.generators.common.inventory.container.ContainerBioGenerator;
|
2014-06-10 12:24:44 +02:00
|
|
|
import mekanism.generators.common.inventory.container.ContainerGasGenerator;
|
2014-09-03 19:00:03 +01:00
|
|
|
import mekanism.generators.common.inventory.container.ContainerHeatGenerator;
|
2014-07-19 03:23:11 +01:00
|
|
|
import mekanism.generators.common.inventory.container.ContainerNeutronCapture;
|
|
|
|
|
import mekanism.generators.common.inventory.container.ContainerReactorController;
|
2014-06-02 23:57:40 +02:00
|
|
|
import mekanism.generators.common.inventory.container.ContainerSolarGenerator;
|
2016-01-17 15:59:02 -05:00
|
|
|
import mekanism.generators.common.inventory.container.ContainerWindGenerator;
|
2014-06-02 23:57:40 +02:00
|
|
|
import mekanism.generators.common.tile.TileEntityAdvancedSolarGenerator;
|
|
|
|
|
import mekanism.generators.common.tile.TileEntityBioGenerator;
|
2014-06-10 12:24:44 +02:00
|
|
|
import mekanism.generators.common.tile.TileEntityGasGenerator;
|
2014-09-03 19:00:03 +01:00
|
|
|
import mekanism.generators.common.tile.TileEntityHeatGenerator;
|
2014-06-02 23:57:40 +02:00
|
|
|
import mekanism.generators.common.tile.TileEntitySolarGenerator;
|
2016-01-17 15:59:02 -05:00
|
|
|
import mekanism.generators.common.tile.TileEntityWindGenerator;
|
2014-07-14 20:39:34 +01:00
|
|
|
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
|
|
|
|
|
import mekanism.generators.common.tile.reactor.TileEntityReactorFrame;
|
|
|
|
|
import mekanism.generators.common.tile.reactor.TileEntityReactorGlass;
|
|
|
|
|
import mekanism.generators.common.tile.reactor.TileEntityReactorLaserFocusMatrix;
|
2015-03-29 12:50:15 -04:00
|
|
|
import mekanism.generators.common.tile.reactor.TileEntityReactorLogicAdapter;
|
2014-07-14 20:39:34 +01:00
|
|
|
import mekanism.generators.common.tile.reactor.TileEntityReactorNeutronCapture;
|
|
|
|
|
import mekanism.generators.common.tile.reactor.TileEntityReactorPort;
|
2016-01-22 17:46:04 -05:00
|
|
|
import mekanism.generators.common.tile.turbine.TileEntityElectromagneticCoil;
|
2016-01-22 00:04:44 -05:00
|
|
|
import mekanism.generators.common.tile.turbine.TileEntityRotationalComplex;
|
2016-01-22 20:08:37 -05:00
|
|
|
import mekanism.generators.common.tile.turbine.TileEntityTurbineCasing;
|
2016-01-22 17:22:20 -05:00
|
|
|
import mekanism.generators.common.tile.turbine.TileEntityTurbineRotor;
|
2016-01-22 20:08:37 -05:00
|
|
|
import mekanism.generators.common.tile.turbine.TileEntityTurbineValve;
|
|
|
|
|
import mekanism.generators.common.tile.turbine.TileEntityTurbineVent;
|
2012-12-20 16:53:39 -05:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
import net.minecraft.inventory.Container;
|
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
|
import net.minecraft.world.World;
|
2015-03-18 21:39:01 +00:00
|
|
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
2014-06-02 23:57:40 +02:00
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
2012-11-25 10:45:00 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Common proxy for the Mekanism Generators module.
|
|
|
|
|
* @author AidanBrady
|
|
|
|
|
*
|
|
|
|
|
*/
|
2016-01-25 00:13:42 -05:00
|
|
|
public class GeneratorsCommonProxy implements IGuiProvider
|
2012-11-25 10:45:00 -05:00
|
|
|
{
|
2015-03-18 21:39:01 +00:00
|
|
|
public static int GENERATOR_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
|
|
|
|
|
2014-07-14 20:39:34 +01:00
|
|
|
/**
|
|
|
|
|
* Register normal tile entities
|
|
|
|
|
*/
|
|
|
|
|
public void registerRegularTileEntities()
|
|
|
|
|
{
|
|
|
|
|
GameRegistry.registerTileEntity(TileEntityReactorFrame.class, "ReactorFrame");
|
|
|
|
|
GameRegistry.registerTileEntity(TileEntityReactorGlass.class, "ReactorGlass");
|
|
|
|
|
GameRegistry.registerTileEntity(TileEntityReactorLaserFocusMatrix.class, "ReactorLaserFocus");
|
|
|
|
|
GameRegistry.registerTileEntity(TileEntityReactorNeutronCapture.class, "ReactorNeutronCapture");
|
|
|
|
|
GameRegistry.registerTileEntity(TileEntityReactorPort.class, "ReactorPort");
|
2015-03-29 12:50:15 -04:00
|
|
|
GameRegistry.registerTileEntity(TileEntityReactorLogicAdapter.class, "ReactorLogicAdapter");
|
2016-01-22 00:04:44 -05:00
|
|
|
GameRegistry.registerTileEntity(TileEntityRotationalComplex.class, "RotationalComplex");
|
2016-01-22 17:46:04 -05:00
|
|
|
GameRegistry.registerTileEntity(TileEntityElectromagneticCoil.class, "ElectromagneticCoil");
|
2014-07-14 20:39:34 +01:00
|
|
|
}
|
|
|
|
|
|
2012-11-25 10:45:00 -05:00
|
|
|
/**
|
|
|
|
|
* Register tile entities that have special models. Overwritten in client to register TESRs.
|
|
|
|
|
*/
|
2014-03-07 19:00:25 -06:00
|
|
|
public void registerSpecialTileEntities()
|
2012-11-25 10:45:00 -05:00
|
|
|
{
|
|
|
|
|
GameRegistry.registerTileEntity(TileEntityAdvancedSolarGenerator.class, "AdvancedSolarGenerator");
|
2013-11-02 12:00:29 -04:00
|
|
|
GameRegistry.registerTileEntity(TileEntitySolarGenerator.class, "SolarGenerator");
|
2012-11-25 10:45:00 -05:00
|
|
|
GameRegistry.registerTileEntity(TileEntityBioGenerator.class, "BioGenerator");
|
2012-12-19 15:23:55 -05:00
|
|
|
GameRegistry.registerTileEntity(TileEntityHeatGenerator.class, "HeatGenerator");
|
2014-06-10 12:24:44 +02:00
|
|
|
GameRegistry.registerTileEntity(TileEntityGasGenerator.class, "GasGenerator");
|
2016-01-17 15:59:02 -05:00
|
|
|
GameRegistry.registerTileEntity(TileEntityWindGenerator.class, "WindTurbine");
|
2014-07-31 22:57:30 +01:00
|
|
|
GameRegistry.registerTileEntity(TileEntityReactorController.class, "ReactorController");
|
2016-01-22 17:22:20 -05:00
|
|
|
GameRegistry.registerTileEntity(TileEntityTurbineRotor.class, "TurbineRod");
|
2016-01-22 20:08:37 -05:00
|
|
|
GameRegistry.registerTileEntity(TileEntityTurbineCasing.class, "TurbineCasing");
|
|
|
|
|
GameRegistry.registerTileEntity(TileEntityTurbineValve.class, "TurbineValve");
|
|
|
|
|
GameRegistry.registerTileEntity(TileEntityTurbineVent.class, "TurbineVent");
|
2012-11-25 10:45:00 -05:00
|
|
|
}
|
2014-03-07 19:00:25 -06:00
|
|
|
|
2012-11-25 10:45:00 -05:00
|
|
|
/**
|
|
|
|
|
* Register and load client-only render information.
|
|
|
|
|
*/
|
|
|
|
|
public void registerRenderInformation() {}
|
2014-03-07 19:00:25 -06:00
|
|
|
|
2012-11-25 10:45:00 -05:00
|
|
|
/**
|
|
|
|
|
* Set and load the mod's common configuration properties.
|
|
|
|
|
*/
|
|
|
|
|
public void loadConfiguration()
|
|
|
|
|
{
|
2016-01-30 08:46:36 -07:00
|
|
|
generators.advancedSolarGeneration = Mekanism.configuration.get("generation", "AdvancedSolarGeneration", 300D).getDouble();
|
|
|
|
|
generators.bioGeneration = Mekanism.configuration.get("generation", "BioGeneration", 350D).getDouble();
|
|
|
|
|
generators.heatGeneration = Mekanism.configuration.get("generation", "HeatGeneration", 150D).getDouble();
|
|
|
|
|
generators.heatGenerationLava = Mekanism.configuration.get("generation", "HeatGenerationLava", 5D).getDouble();
|
|
|
|
|
generators.heatGenerationNether = Mekanism.configuration.get("generation", "HeatGenerationNether", 100D).getDouble();
|
|
|
|
|
generators.solarGeneration = Mekanism.configuration.get("generation", "SolarGeneration", 50D).getDouble();
|
2015-02-10 18:39:15 -05:00
|
|
|
|
2014-08-02 12:56:41 -07:00
|
|
|
loadWindConfiguration();
|
2016-01-30 08:46:36 -07:00
|
|
|
|
|
|
|
|
generators.turbineBladesPerCoil = Mekanism.configuration.get("generation", "TurbineBladesPerCoil", 4).getInt();
|
|
|
|
|
generators.turbineVentGasFlow = Mekanism.configuration.get("generation", "TurbineVentGasFlow", 16000D).getDouble();
|
|
|
|
|
generators.turbineDisperserGasFlow = Mekanism.configuration.get("generation", "TurbineDisperserGasFlow", 640D).getDouble();
|
2014-07-07 21:17:15 +01:00
|
|
|
|
|
|
|
|
if(Mekanism.configuration.hasChanged())
|
2014-08-05 16:55:55 -04:00
|
|
|
{
|
2014-07-07 21:17:15 +01:00
|
|
|
Mekanism.configuration.save();
|
2014-08-05 16:55:55 -04:00
|
|
|
}
|
2012-11-25 10:45:00 -05:00
|
|
|
}
|
2014-08-05 17:06:29 -04:00
|
|
|
|
2014-08-05 16:55:55 -04:00
|
|
|
private void loadWindConfiguration()
|
|
|
|
|
{
|
2016-01-30 08:46:36 -07:00
|
|
|
generators.windGenerationMin = Mekanism.configuration.get("generation", "WindGenerationMin", 60D).getDouble();
|
|
|
|
|
generators.windGenerationMax = Mekanism.configuration.get("generation", "WindGenerationMax", 480D).getDouble();
|
2014-08-02 12:56:41 -07:00
|
|
|
|
2014-08-05 16:55:55 -04:00
|
|
|
//Ensure max > min to avoid division by zero later
|
2016-01-30 08:46:36 -07:00
|
|
|
final int minY = Mekanism.configuration.get("generation", "WindGenerationMinY", 24).getInt();
|
|
|
|
|
final int maxY = Mekanism.configuration.get("generation", "WindGenerationMaxY", 255).getInt();
|
2014-08-05 17:06:29 -04:00
|
|
|
|
|
|
|
|
generators.windGenerationMinY = minY;
|
|
|
|
|
generators.windGenerationMaxY = Math.max(minY + 1, maxY);
|
2012-11-25 10:45:00 -05:00
|
|
|
}
|
2014-03-07 19:00:25 -06:00
|
|
|
|
2016-01-25 00:13:42 -05:00
|
|
|
@Override
|
2014-03-07 19:00:25 -06:00
|
|
|
public Object getClientGui(int ID, EntityPlayer player, World world, int x, int y, int z)
|
2012-11-25 10:45:00 -05:00
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2014-03-07 19:00:25 -06:00
|
|
|
|
2016-01-25 00:13:42 -05:00
|
|
|
@Override
|
2014-03-07 19:00:25 -06:00
|
|
|
public Container getServerGui(int ID, EntityPlayer player, World world, int x, int y, int z)
|
2012-11-25 10:45:00 -05:00
|
|
|
{
|
2014-04-20 04:34:19 +01:00
|
|
|
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
2014-03-07 19:00:25 -06:00
|
|
|
|
2012-11-25 10:45:00 -05:00
|
|
|
switch(ID)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
return new ContainerHeatGenerator(player.inventory, (TileEntityHeatGenerator)tileEntity);
|
|
|
|
|
case 1:
|
|
|
|
|
return new ContainerSolarGenerator(player.inventory, (TileEntitySolarGenerator)tileEntity);
|
|
|
|
|
case 3:
|
2014-06-10 12:24:44 +02:00
|
|
|
return new ContainerGasGenerator(player.inventory, (TileEntityGasGenerator)tileEntity);
|
2012-11-25 10:45:00 -05:00
|
|
|
case 4:
|
|
|
|
|
return new ContainerBioGenerator(player.inventory, (TileEntityBioGenerator)tileEntity);
|
2013-04-28 15:23:08 -04:00
|
|
|
case 5:
|
2016-01-17 15:59:02 -05:00
|
|
|
return new ContainerWindGenerator(player.inventory, (TileEntityWindGenerator)tileEntity);
|
2016-01-23 00:40:30 -05:00
|
|
|
case 6:
|
2016-05-21 13:58:09 -04:00
|
|
|
return new ContainerFilter(player.inventory, (TileEntityTurbineCasing)tileEntity);
|
2016-05-21 14:01:34 -04:00
|
|
|
case 7:
|
|
|
|
|
return new ContainerNull(player, (TileEntityTurbineCasing)tileEntity);
|
2014-07-19 03:23:11 +01:00
|
|
|
case 10:
|
|
|
|
|
return new ContainerReactorController(player.inventory, (TileEntityReactorController)tileEntity);
|
|
|
|
|
case 11:
|
2014-07-28 04:24:56 +01:00
|
|
|
case 12:
|
|
|
|
|
case 13:
|
2015-03-29 12:50:15 -04:00
|
|
|
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
|
2014-08-05 01:39:17 +01:00
|
|
|
case 14:
|
2014-07-19 03:23:11 +01:00
|
|
|
return new ContainerNeutronCapture(player.inventory, (TileEntityReactorNeutronCapture)tileEntity);
|
2015-03-29 12:50:15 -04:00
|
|
|
case 15:
|
|
|
|
|
return new ContainerNull(player, (TileEntityContainerBlock)tileEntity);
|
2012-11-25 10:45:00 -05:00
|
|
|
}
|
2014-06-21 11:57:08 -04:00
|
|
|
|
2012-11-25 10:45:00 -05:00
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|