Added thermopile
This commit is contained in:
parent
ee0f2d216d
commit
ab3815bd0a
5 changed files with 135 additions and 12 deletions
|
@ -32,7 +32,6 @@ public class Settings
|
||||||
public static int FURNACE_WATTAGE = 50000;
|
public static int FURNACE_WATTAGE = 50000;
|
||||||
public static boolean SOUND_FXS = true;
|
public static boolean SOUND_FXS = true;
|
||||||
public static boolean SHINY_SILVER = true;
|
public static boolean SHINY_SILVER = true;
|
||||||
public static boolean REPLACE_FURNACE = true;
|
|
||||||
public static int MAX_CONTRACTOR_DISTANCE = 200;
|
public static int MAX_CONTRACTOR_DISTANCE = 200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +46,6 @@ public class Settings
|
||||||
SOUND_FXS = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Tesla Sound FXs", SOUND_FXS).getBoolean(SOUND_FXS);
|
SOUND_FXS = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Tesla Sound FXs", SOUND_FXS).getBoolean(SOUND_FXS);
|
||||||
SHINY_SILVER = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Shiny silver wires", SHINY_SILVER).getBoolean(SHINY_SILVER);
|
SHINY_SILVER = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Shiny silver wires", SHINY_SILVER).getBoolean(SHINY_SILVER);
|
||||||
MAX_CONTRACTOR_DISTANCE = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Max EM Contractor Path", MAX_CONTRACTOR_DISTANCE).getInt(MAX_CONTRACTOR_DISTANCE);
|
MAX_CONTRACTOR_DISTANCE = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Max EM Contractor Path", MAX_CONTRACTOR_DISTANCE).getInt(MAX_CONTRACTOR_DISTANCE);
|
||||||
REPLACE_FURNACE = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Replace vanilla furnace", REPLACE_FURNACE).getBoolean(REPLACE_FURNACE);
|
|
||||||
|
|
||||||
LEVITATOR_ACCELERATION = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Item Acceleration", Settings.LEVITATOR_ACCELERATION).getDouble(Settings.LEVITATOR_ACCELERATION);
|
LEVITATOR_ACCELERATION = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Item Acceleration", Settings.LEVITATOR_ACCELERATION).getDouble(Settings.LEVITATOR_ACCELERATION);
|
||||||
LEVITATOR_MAX_REACH = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Max Item Reach", Settings.LEVITATOR_MAX_REACH).getInt(Settings.LEVITATOR_MAX_REACH);
|
LEVITATOR_MAX_REACH = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Max Item Reach", Settings.LEVITATOR_MAX_REACH).getInt(Settings.LEVITATOR_MAX_REACH);
|
||||||
|
|
|
@ -27,6 +27,8 @@ import resonantinduction.electrical.generator.BlockGenerator;
|
||||||
import resonantinduction.electrical.generator.TileGenerator;
|
import resonantinduction.electrical.generator.TileGenerator;
|
||||||
import resonantinduction.electrical.generator.solar.BlockSolarPanel;
|
import resonantinduction.electrical.generator.solar.BlockSolarPanel;
|
||||||
import resonantinduction.electrical.generator.solar.TileSolarPanel;
|
import resonantinduction.electrical.generator.solar.TileSolarPanel;
|
||||||
|
import resonantinduction.electrical.generator.thermopile.BlockThermopile;
|
||||||
|
import resonantinduction.electrical.generator.thermopile.TileThermopile;
|
||||||
import resonantinduction.electrical.levitator.BlockLevitator;
|
import resonantinduction.electrical.levitator.BlockLevitator;
|
||||||
import resonantinduction.electrical.levitator.TileLevitator;
|
import resonantinduction.electrical.levitator.TileLevitator;
|
||||||
import resonantinduction.electrical.multimeter.ItemMultimeter;
|
import resonantinduction.electrical.multimeter.ItemMultimeter;
|
||||||
|
@ -88,9 +90,9 @@ public class Electrical
|
||||||
// Generators
|
// Generators
|
||||||
public static Block blockSolarPanel;
|
public static Block blockSolarPanel;
|
||||||
public static Block blockGenerator;
|
public static Block blockGenerator;
|
||||||
|
public static Block blockThermopile;
|
||||||
|
|
||||||
// Machines
|
// Machines
|
||||||
public static Block blockAdvancedFurnace;
|
|
||||||
|
|
||||||
// Transport
|
// Transport
|
||||||
public static Block blockEMLevitator;
|
public static Block blockEMLevitator;
|
||||||
|
@ -113,20 +115,14 @@ public class Electrical
|
||||||
|
|
||||||
// Transport
|
// Transport
|
||||||
blockEMLevitator = contentRegistry.createTile(BlockLevitator.class, TileLevitator.class);
|
blockEMLevitator = contentRegistry.createTile(BlockLevitator.class, TileLevitator.class);
|
||||||
//blockArmbot = contentRegistry.createTile(BlockArmbot.class, TileArmbot.class);
|
// blockArmbot = contentRegistry.createTile(BlockArmbot.class, TileArmbot.class);
|
||||||
blockEncoder = contentRegistry.createTile(BlockEncoder.class, TileEncoder.class);
|
blockEncoder = contentRegistry.createTile(BlockEncoder.class, TileEncoder.class);
|
||||||
itemDisk = contentRegistry.createItem(ItemDisk.class);
|
itemDisk = contentRegistry.createItem(ItemDisk.class);
|
||||||
|
|
||||||
// Generator
|
// Generator
|
||||||
blockSolarPanel = contentRegistry.createTile(BlockSolarPanel.class, TileSolarPanel.class);
|
blockSolarPanel = contentRegistry.createTile(BlockSolarPanel.class, TileSolarPanel.class);
|
||||||
blockGenerator = contentRegistry.createTile(BlockGenerator.class, TileGenerator.class);
|
blockGenerator = contentRegistry.createTile(BlockGenerator.class, TileGenerator.class);
|
||||||
|
blockThermopile = contentRegistry.createTile(BlockThermopile.class, TileThermopile.class);
|
||||||
if (Settings.REPLACE_FURNACE)
|
|
||||||
{
|
|
||||||
blockAdvancedFurnace = BlockAdvancedFurnace.createNew(false);
|
|
||||||
GameRegistry.registerBlock(blockAdvancedFurnace, "ri_" + blockAdvancedFurnace.getUnlocalizedName());
|
|
||||||
GameRegistry.registerTileEntity(TileAdvancedFurnace.class, "ri_" + blockAdvancedFurnace.getUnlocalizedName());
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings.save();
|
Settings.save();
|
||||||
|
|
||||||
|
@ -192,8 +188,9 @@ public class Electrical
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy.postInit();
|
proxy.postInit();
|
||||||
|
|
||||||
/** Inject new furnace tile class */
|
/** Inject new furnace tile class */
|
||||||
replaceTileEntity(TileEntityFurnace.class, TileAdvancedFurnace.class);
|
//replaceTileEntity(TileEntityFurnace.class, TileAdvancedFurnace.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void replaceTileEntity(Class<? extends TileEntity> findTile, Class<? extends TileEntity> replaceTile)
|
public static void replaceTileEntity(Class<? extends TileEntity> findTile, Class<? extends TileEntity> replaceTile)
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package resonantinduction.electrical.generator.thermopile;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import resonantinduction.core.Reference;
|
||||||
|
import resonantinduction.core.prefab.block.BlockRI;
|
||||||
|
import resonantinduction.core.render.RIBlockRenderingHandler;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class BlockThermopile extends BlockRI
|
||||||
|
{
|
||||||
|
public BlockThermopile()
|
||||||
|
{
|
||||||
|
super("thermopile");
|
||||||
|
setTextureName(Reference.PREFIX + "material_metal_top");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World world)
|
||||||
|
{
|
||||||
|
return new TileThermopile();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
package resonantinduction.electrical.generator.thermopile;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||||
|
import universalelectricity.api.vector.Vector3;
|
||||||
|
import calclavia.lib.prefab.tile.TileElectrical;
|
||||||
|
|
||||||
|
public class TileThermopile extends TileElectrical
|
||||||
|
{
|
||||||
|
private final int MAX_USE_TICKS = 120 * 20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of ticks the thermopile will use the temperature differences before turning all
|
||||||
|
* adjacent sides to thermal equilibrium.
|
||||||
|
*/
|
||||||
|
private int usingTicks = 0;
|
||||||
|
|
||||||
|
public TileThermopile()
|
||||||
|
{
|
||||||
|
this.energy = new EnergyStorageHandler(300);
|
||||||
|
this.ioMap = 728;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity()
|
||||||
|
{
|
||||||
|
super.updateEntity();
|
||||||
|
|
||||||
|
if (!this.worldObj.isRemote)
|
||||||
|
{
|
||||||
|
int heatSources = 0;
|
||||||
|
int coolingSources = 0;
|
||||||
|
|
||||||
|
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
Vector3 checkPos = new Vector3(this).translate(dir);
|
||||||
|
|
||||||
|
int blockID = checkPos.getBlockID(worldObj);
|
||||||
|
|
||||||
|
if (blockID == Block.waterStill.blockID)
|
||||||
|
{
|
||||||
|
coolingSources++;
|
||||||
|
}
|
||||||
|
else if (blockID == Block.ice.blockID)
|
||||||
|
{
|
||||||
|
coolingSources += 2;
|
||||||
|
}
|
||||||
|
else if (blockID == Block.fire.blockID)
|
||||||
|
{
|
||||||
|
heatSources++;
|
||||||
|
}
|
||||||
|
else if (blockID == Block.lavaStill.blockID)
|
||||||
|
{
|
||||||
|
heatSources += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Max difference would be "3"
|
||||||
|
int multiplier = (3 - Math.abs(heatSources - coolingSources));
|
||||||
|
|
||||||
|
if (multiplier > 0 && coolingSources > 0 && heatSources > 0)
|
||||||
|
{
|
||||||
|
energy.receiveEnergy(15 * multiplier, true);
|
||||||
|
|
||||||
|
if (++usingTicks >= MAX_USE_TICKS)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create Thermal Equilibrium
|
||||||
|
*/
|
||||||
|
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
Vector3 checkPos = new Vector3(this).translate(dir);
|
||||||
|
int blockID = checkPos.getBlockID(worldObj);
|
||||||
|
|
||||||
|
if (blockID == Block.waterStill.blockID)
|
||||||
|
{
|
||||||
|
checkPos.setBlock(worldObj, 0);
|
||||||
|
}
|
||||||
|
else if (blockID == Block.ice.blockID)
|
||||||
|
{
|
||||||
|
checkPos.setBlock(worldObj, Block.waterStill.blockID);
|
||||||
|
}
|
||||||
|
else if (blockID == Block.fire.blockID)
|
||||||
|
{
|
||||||
|
checkPos.setBlock(worldObj, 0);
|
||||||
|
}
|
||||||
|
else if (blockID == Block.lavaStill.blockID)
|
||||||
|
{
|
||||||
|
checkPos.setBlock(worldObj, Block.stone.blockID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
usingTicks = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
produce();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -104,6 +104,8 @@ tile.resonantinduction\:encoder.name=Encoder
|
||||||
## Generators
|
## Generators
|
||||||
tile.resonantinduction\:solarPanel.name=Solar Panel
|
tile.resonantinduction\:solarPanel.name=Solar Panel
|
||||||
tile.resonantinduction\:generator.name=Electric Generator
|
tile.resonantinduction\:generator.name=Electric Generator
|
||||||
|
tile.resonantinduction\:thermopile.name=Thermopile
|
||||||
|
tile.resonantinduction\:thermopile.tooltip=Generates a voltage proportional to local temperature difference.
|
||||||
|
|
||||||
#Transport
|
#Transport
|
||||||
item.resonantinduction\:disk.name=Program Disk
|
item.resonantinduction\:disk.name=Program Disk
|
||||||
|
|
Loading…
Reference in a new issue