Auto Format code
This commit is contained in:
parent
112b1657cf
commit
796df6c055
503 changed files with 12260 additions and 16291 deletions
|
@ -1,17 +1,16 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import reborncore.common.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import reborncore.api.fuel.FluidPowerManager;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
@ -19,61 +18,51 @@ import reborncore.common.util.Tank;
|
|||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider
|
||||
{
|
||||
public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider {
|
||||
|
||||
public static final int euTick = ConfigTechReborn.ThermalGeneratorOutput;
|
||||
public Tank tank = new Tank("TileDieselGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
||||
public Inventory inventory = new Inventory(3, "TileDieselGenerator", 64, this);
|
||||
|
||||
public TileDieselGenerator()
|
||||
{
|
||||
public TileDieselGenerator() {
|
||||
super(ConfigTechReborn.ThermalGeneratorTier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
||||
{
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing()
|
||||
{
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.DieselGenerator, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
int filled = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return filled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if (resource == null || !resource.isFluidEqual(tank.getFluid()))
|
||||
{
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
if (resource == null || !resource.isFluidEqual(tank.getFluid())) {
|
||||
return null;
|
||||
}
|
||||
FluidStack fluidStack = tank.drain(resource.amount, doDrain);
|
||||
|
@ -82,78 +71,65 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drained = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
||||
{
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return FluidPowerManager.fluidPowerValues.containsKey(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
||||
{
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
||||
{
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
tank.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
tank.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
if (!worldObj.isRemote) {
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
|
||||
if (tank.getFluidType() != null && getStackInSlot(2) == null)
|
||||
{
|
||||
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
|
||||
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
||||
syncWithAll();
|
||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null)
|
||||
{
|
||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
||||
setInventorySlotContents(2, null);
|
||||
syncWithAll();
|
||||
}
|
||||
|
||||
if (!tank.isEmpty() && tank.getFluidType() != null
|
||||
&& FluidPowerManager.fluidPowerValues.containsKey(tank.getFluidType()))
|
||||
{
|
||||
&& FluidPowerManager.fluidPowerValues.containsKey(tank.getFluidType())) {
|
||||
double powerIn = FluidPowerManager.fluidPowerValues.get(tank.getFluidType());
|
||||
if (getFreeSpace() >= powerIn)
|
||||
{
|
||||
if (getFreeSpace() >= powerIn) {
|
||||
addEnergy(powerIn, false);
|
||||
tank.drain(1, true);
|
||||
}
|
||||
|
@ -163,38 +139,32 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return ConfigTechReborn.ThermalGeneratorCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import reborncore.common.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -8,105 +7,89 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
||||
{
|
||||
public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
|
||||
|
||||
public static final int euTick = ConfigTechReborn.DragonEggSiphonerOutput;
|
||||
public Inventory inventory = new Inventory(3, "TileAlloySmelter", 64, this);
|
||||
|
||||
public TileDragonEggSiphoner()
|
||||
{
|
||||
public TileDragonEggSiphoner() {
|
||||
super(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
if (!worldObj.isRemote) {
|
||||
if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY() + 1, getPos().getZ()))
|
||||
.getBlock() == Blocks.DRAGON_EGG)
|
||||
{
|
||||
.getBlock() == Blocks.DRAGON_EGG) {
|
||||
addEnergy(euTick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
||||
{
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing()
|
||||
{
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.Dragoneggenergysiphoner, 1);
|
||||
}
|
||||
|
||||
public boolean isComplete()
|
||||
{
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return euTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.HIGH;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import reborncore.common.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
@ -21,8 +20,7 @@ import techreborn.init.ModBlocks;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IFluidHandler,IInventoryProvider
|
||||
{
|
||||
public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider {
|
||||
|
||||
// TODO: run this off config
|
||||
public static final int euTick = 16;
|
||||
|
@ -35,8 +33,7 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
|
|||
// amounts.
|
||||
double pendingWithdraw = 0.0;
|
||||
|
||||
public TileGasTurbine()
|
||||
{
|
||||
public TileGasTurbine() {
|
||||
super(ConfigTechReborn.ThermalGeneratorTier);
|
||||
// TODO: fix this to have Gas Turbine generator values
|
||||
|
||||
|
@ -45,116 +42,98 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
||||
{
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing()
|
||||
{
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.Gasturbine, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
int fill = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return fill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
||||
{
|
||||
if (fluid != null)
|
||||
{
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
if (fluid != null) {
|
||||
return fluids.containsKey(FluidRegistry.getFluidName(fluid));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
||||
{
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
||||
{
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
tank.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
tank.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
if (!worldObj.isRemote) {
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
tank.compareAndUpdate();
|
||||
}
|
||||
|
||||
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick)
|
||||
{
|
||||
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick) {
|
||||
Integer euPerBucket = fluids.get(tank.getFluidType().getName());
|
||||
// float totalTicks = (float)euPerBucket / 8f; //x eu per bucket / 8
|
||||
// eu per tick
|
||||
|
@ -163,55 +142,47 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
|
|||
pendingWithdraw += millibucketsPerTick;
|
||||
|
||||
int currentWithdraw = (int) pendingWithdraw; // float --> int
|
||||
// conversion floors
|
||||
// the float
|
||||
// conversion floors
|
||||
// the float
|
||||
pendingWithdraw -= currentWithdraw;
|
||||
|
||||
tank.drain(currentWithdraw, true);
|
||||
addEnergy(euTick);
|
||||
}
|
||||
if (tank.getFluidType() != null && getStackInSlot(2) == null)
|
||||
{
|
||||
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
|
||||
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null)
|
||||
{
|
||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
||||
setInventorySlotContents(2, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return ConfigTechReborn.ThermalGeneratorCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return euTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.MEDIUM;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import reborncore.common.IWrenchable;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -8,68 +7,57 @@ import net.minecraft.tileentity.TileEntityFurnace;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileGenerator extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
||||
{
|
||||
public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
|
||||
public static int outputAmount = 10; // This is in line with BC engines rf,
|
||||
public Inventory inventory = new Inventory(2, "TileGenerator", 64, this);
|
||||
public int fuelSlot = 0;
|
||||
public int burnTime;
|
||||
public int totalBurnTime = 0;
|
||||
// sould properly use the conversion
|
||||
// ratio here.
|
||||
// sould properly use the conversion
|
||||
// ratio here.
|
||||
public boolean isBurning;
|
||||
public boolean lastTickBurning;
|
||||
ItemStack burnItem;
|
||||
|
||||
public TileGenerator()
|
||||
{
|
||||
public TileGenerator() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
public static int getItemBurnTime(ItemStack stack)
|
||||
{
|
||||
public static int getItemBurnTime(ItemStack stack) {
|
||||
return TileEntityFurnace.getItemBurnTime(stack) / 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (worldObj.isRemote)
|
||||
{
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
if (getEnergy() < getMaxPower())
|
||||
{
|
||||
if (burnTime > 0)
|
||||
{
|
||||
if (getEnergy() < getMaxPower()) {
|
||||
if (burnTime > 0) {
|
||||
burnTime--;
|
||||
addEnergy(outputAmount);
|
||||
isBurning = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
isBurning = false;
|
||||
}
|
||||
|
||||
if (burnTime == 0)
|
||||
{
|
||||
if (burnTime == 0) {
|
||||
updateState();
|
||||
burnTime = totalBurnTime = getItemBurnTime(getStackInSlot(fuelSlot));
|
||||
if (burnTime > 0)
|
||||
{
|
||||
if (burnTime > 0) {
|
||||
updateState();
|
||||
burnItem = getStackInSlot(fuelSlot);
|
||||
if (getStackInSlot(fuelSlot).stackSize == 1)
|
||||
{
|
||||
if (getStackInSlot(fuelSlot).stackSize == 1) {
|
||||
setInventorySlotContents(fuelSlot, null);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
decrStackSize(fuelSlot, 1);
|
||||
}
|
||||
}
|
||||
|
@ -78,11 +66,9 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable,IInv
|
|||
lastTickBurning = isBurning;
|
||||
}
|
||||
|
||||
public void updateState()
|
||||
{
|
||||
public void updateState() {
|
||||
IBlockState BlockStateContainer = worldObj.getBlockState(pos);
|
||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase)
|
||||
{
|
||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||
BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != burnTime > 0)
|
||||
blockMachineBase.setActive(burnTime > 0, worldObj, pos);
|
||||
|
@ -90,68 +76,57 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable,IInv
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
||||
{
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing()
|
||||
{
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer p0)
|
||||
{
|
||||
public ItemStack getWrenchDrop(EntityPlayer p0) {
|
||||
return new ItemStack(ModBlocks.Generator);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,52 +1,43 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import reborncore.common.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
|
||||
{
|
||||
public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable {
|
||||
|
||||
public static final int euTick = ConfigTechReborn.HeatGeneratorOutput;
|
||||
|
||||
public TileHeatGenerator()
|
||||
{
|
||||
public TileHeatGenerator() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
if (!worldObj.isRemote) {
|
||||
if (worldObj.getBlockState(new BlockPos(getPos().getX() + 1, getPos().getY(), getPos().getZ()))
|
||||
.getBlock() == Blocks.LAVA)
|
||||
{
|
||||
.getBlock() == Blocks.LAVA) {
|
||||
addEnergy(euTick);
|
||||
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY(), getPos().getZ() + 1))
|
||||
.getBlock() == Blocks.LAVA)
|
||||
{
|
||||
.getBlock() == Blocks.LAVA) {
|
||||
addEnergy(euTick);
|
||||
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY(), getPos().getZ() - 1))
|
||||
.getBlock() == Blocks.LAVA)
|
||||
{
|
||||
.getBlock() == Blocks.LAVA) {
|
||||
addEnergy(euTick);
|
||||
} else if (worldObj.getBlockState(new BlockPos(getPos().getX() - 1, getPos().getY(), getPos().getZ()))
|
||||
.getBlock() == Blocks.LAVA)
|
||||
{
|
||||
.getBlock() == Blocks.LAVA) {
|
||||
addEnergy(euTick);
|
||||
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY() - 1, getPos().getZ()))
|
||||
.getBlock() == Blocks.LAVA)
|
||||
{
|
||||
.getBlock() == Blocks.LAVA) {
|
||||
addEnergy(euTick);
|
||||
}
|
||||
|
||||
|
@ -54,73 +45,61 @@ public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
||||
{
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing()
|
||||
{
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.heatGenerator, 1);
|
||||
}
|
||||
|
||||
public boolean isComplete()
|
||||
{
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,96 +13,97 @@ import techreborn.config.ConfigTechReborn;
|
|||
|
||||
public class TileLightningRod extends TilePowerAcceptor {
|
||||
|
||||
private int onStatusHoldTicks = -1;
|
||||
private int onStatusHoldTicks = -1;
|
||||
|
||||
public TileLightningRod() {
|
||||
super(2);
|
||||
}
|
||||
public TileLightningRod() {
|
||||
super(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if(onStatusHoldTicks > 0)
|
||||
--onStatusHoldTicks;
|
||||
if (onStatusHoldTicks > 0)
|
||||
--onStatusHoldTicks;
|
||||
|
||||
if(onStatusHoldTicks == 0 || getEnergy() <= 0) {
|
||||
if(getBlockType() instanceof BlockMachineBase)
|
||||
((BlockMachineBase) getBlockType()).setActive(false, worldObj, pos);
|
||||
onStatusHoldTicks = -1;
|
||||
}
|
||||
if (onStatusHoldTicks == 0 || getEnergy() <= 0) {
|
||||
if (getBlockType() instanceof BlockMachineBase)
|
||||
((BlockMachineBase) getBlockType()).setActive(false, worldObj, pos);
|
||||
onStatusHoldTicks = -1;
|
||||
}
|
||||
|
||||
float weatherStrength = worldObj.getThunderStrength(1.0F);
|
||||
if(weatherStrength > 0.2F) {
|
||||
//lightStrikeChance = (MAX - (CHANCE * WEATHER_STRENGTH)
|
||||
float lightStrikeChance = ((100F - ConfigTechReborn.LightningRodChance) * 20F);
|
||||
float totalChance = lightStrikeChance * getLightningStrikeMultiplier() * ((1.1F - weatherStrength));
|
||||
if (worldObj.rand.nextInt((int) Math.floor(totalChance)) == 0) {
|
||||
EntityLightningBolt lightningBolt = new EntityLightningBolt(worldObj,
|
||||
pos.getX() + 0.5F,
|
||||
worldObj.provider.getAverageGroundLevel(),
|
||||
pos.getZ() + 0.5F, false);
|
||||
worldObj.addWeatherEffect(lightningBolt);
|
||||
worldObj.spawnEntityInWorld(lightningBolt);
|
||||
addEnergy(32768 * (0.3F + weatherStrength));
|
||||
((BlockMachineBase) getBlockType()).setActive(true, worldObj, pos);
|
||||
onStatusHoldTicks = 400;
|
||||
}
|
||||
}
|
||||
float weatherStrength = worldObj.getThunderStrength(1.0F);
|
||||
if (weatherStrength > 0.2F) {
|
||||
//lightStrikeChance = (MAX - (CHANCE * WEATHER_STRENGTH)
|
||||
float lightStrikeChance = ((100F - ConfigTechReborn.LightningRodChance) * 20F);
|
||||
float totalChance = lightStrikeChance * getLightningStrikeMultiplier() * ((1.1F - weatherStrength));
|
||||
if (worldObj.rand.nextInt((int) Math.floor(totalChance)) == 0) {
|
||||
EntityLightningBolt lightningBolt = new EntityLightningBolt(worldObj,
|
||||
pos.getX() + 0.5F,
|
||||
worldObj.provider.getAverageGroundLevel(),
|
||||
pos.getZ() + 0.5F, false);
|
||||
worldObj.addWeatherEffect(lightningBolt);
|
||||
worldObj.spawnEntityInWorld(lightningBolt);
|
||||
addEnergy(32768 * (0.3F + weatherStrength));
|
||||
((BlockMachineBase) getBlockType()).setActive(true, worldObj, pos);
|
||||
onStatusHoldTicks = 400;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public float getLightningStrikeMultiplier() {
|
||||
float actualHeight = worldObj.provider.getActualHeight();
|
||||
float groundLevel = worldObj.provider.getAverageGroundLevel();
|
||||
for(int i = pos.getY() + 1; i < actualHeight; i++) {
|
||||
if(!isValidIronFence(i)) {
|
||||
if(groundLevel >= i)
|
||||
return 4.3F;
|
||||
float max = actualHeight - groundLevel;
|
||||
float got = i - groundLevel;
|
||||
return 1.2F - got / max;
|
||||
}
|
||||
}
|
||||
return 4F;
|
||||
}
|
||||
public float getLightningStrikeMultiplier() {
|
||||
float actualHeight = worldObj.provider.getActualHeight();
|
||||
float groundLevel = worldObj.provider.getAverageGroundLevel();
|
||||
for (int i = pos.getY() + 1; i < actualHeight; i++) {
|
||||
if (!isValidIronFence(i)) {
|
||||
if (groundLevel >= i)
|
||||
return 4.3F;
|
||||
float max = actualHeight - groundLevel;
|
||||
float got = i - groundLevel;
|
||||
return 1.2F - got / max;
|
||||
}
|
||||
}
|
||||
return 4F;
|
||||
}
|
||||
|
||||
public boolean isValidIronFence(int y) {
|
||||
Item itemBlock = Item.getItemFromBlock(worldObj.getBlockState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock());
|
||||
for(ItemStack fence : OreDictionary.getOres("fenceIron")) {
|
||||
if(fence.getItem() == itemBlock) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean isValidIronFence(int y) {
|
||||
Item itemBlock = Item.getItemFromBlock(worldObj.getBlockState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock());
|
||||
for (ItemStack fence : OreDictionary.getOres("fenceIron")) {
|
||||
if (fence.getItem() == itemBlock)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return 327680;
|
||||
}
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return 327680;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return direction == getFacingEnum();
|
||||
}
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return direction == getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput() {
|
||||
return 2048;
|
||||
}
|
||||
@Override
|
||||
public double getMaxOutput() {
|
||||
return 2048;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.HIGH;
|
||||
}
|
||||
@Override
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.HIGH;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import reborncore.common.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
@ -21,8 +20,7 @@ import techreborn.init.ModBlocks;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler,IInventoryProvider
|
||||
{
|
||||
public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider {
|
||||
|
||||
// TODO: run this off config
|
||||
public static final int euTick = 8;
|
||||
|
@ -35,8 +33,7 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
|||
// amounts.
|
||||
double pendingWithdraw = 0.0;
|
||||
|
||||
public TileSemifluidGenerator()
|
||||
{
|
||||
public TileSemifluidGenerator() {
|
||||
super(ConfigTechReborn.ThermalGeneratorTier);
|
||||
// TODO: fix this to have SemiFluid generator values
|
||||
|
||||
|
@ -51,113 +48,96 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
||||
{
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing()
|
||||
{
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.Semifluidgenerator, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
int fill = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return fill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
||||
{
|
||||
if (fluid != null)
|
||||
{
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
if (fluid != null) {
|
||||
return fluids.containsKey(FluidRegistry.getFluidName(fluid));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
||||
{
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
||||
{
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
tank.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
tank.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!worldObj.isRemote)
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
|
||||
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick && tank.getFluidType() != null && fluids.containsKey(tank.getFluidType().getName()))
|
||||
{
|
||||
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick && tank.getFluidType() != null && fluids.containsKey(tank.getFluidType().getName())) {
|
||||
Integer euPerBucket = fluids.get(tank.getFluidType().getName());
|
||||
// float totalTicks = (float)euPerBucket / 8f; //x eu per bucket / 8
|
||||
// eu per tick
|
||||
|
@ -166,55 +146,47 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
|||
pendingWithdraw += millibucketsPerTick;
|
||||
|
||||
int currentWithdraw = (int) pendingWithdraw; // float --> int
|
||||
// conversion floors
|
||||
// the float
|
||||
// conversion floors
|
||||
// the float
|
||||
pendingWithdraw -= currentWithdraw;
|
||||
|
||||
tank.drain(currentWithdraw, true);
|
||||
addEnergy(euTick);
|
||||
}
|
||||
if (tank.getFluidType() != null && getStackInSlot(2) == null)
|
||||
{
|
||||
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
|
||||
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null)
|
||||
{
|
||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
||||
setInventorySlotContents(2, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return ConfigTechReborn.ThermalGeneratorCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return euTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,49 +11,41 @@ import java.util.List;
|
|||
/**
|
||||
* Created by modmuss50 on 25/02/2016.
|
||||
*/
|
||||
public class TileSolarPanel extends TilePowerAcceptor implements ITickable
|
||||
{
|
||||
public class TileSolarPanel extends TilePowerAcceptor implements ITickable {
|
||||
|
||||
boolean shouldMakePower = false;
|
||||
boolean lastTickSate = false;
|
||||
|
||||
int powerToAdd;
|
||||
|
||||
public TileSolarPanel()
|
||||
{
|
||||
public TileSolarPanel() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if(!worldObj.isRemote){
|
||||
if (worldObj.getTotalWorldTime() % 60 == 0)
|
||||
{
|
||||
shouldMakePower = isSunOut();
|
||||
if (!worldObj.isRemote) {
|
||||
if (worldObj.getTotalWorldTime() % 60 == 0) {
|
||||
shouldMakePower = isSunOut();
|
||||
|
||||
}
|
||||
if (shouldMakePower)
|
||||
{
|
||||
powerToAdd = 10;
|
||||
addEnergy(powerToAdd);
|
||||
} else
|
||||
{
|
||||
powerToAdd = 0;
|
||||
}
|
||||
}
|
||||
if (shouldMakePower) {
|
||||
powerToAdd = 10;
|
||||
addEnergy(powerToAdd);
|
||||
} else {
|
||||
powerToAdd = 0;
|
||||
}
|
||||
|
||||
worldObj.setBlockState(getPos(),
|
||||
worldObj.setBlockState(getPos(),
|
||||
worldObj.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInfo(List<String> info, boolean isRealTile)
|
||||
{
|
||||
public void addInfo(List<String> info, boolean isRealTile) {
|
||||
super.addInfo(info, isRealTile);
|
||||
if (isRealTile)
|
||||
{
|
||||
if (isRealTile) {
|
||||
// FIXME: 25/02/2016
|
||||
// info.add(TextFormatting.LIGHT_PURPLE + "Power gen/tick " +
|
||||
// TextFormatting.GREEN + PowerSystem.getLocaliszedPower(
|
||||
|
@ -61,45 +53,38 @@ public class TileSolarPanel extends TilePowerAcceptor implements ITickable
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isSunOut()
|
||||
{
|
||||
return worldObj.canBlockSeeSky(pos.up()) && !worldObj.isRaining() && !worldObj.isThundering()
|
||||
&& worldObj.isDaytime();
|
||||
public boolean isSunOut() {
|
||||
return worldObj.canBlockSeeSky(pos.up()) && !worldObj.isRaining() && !worldObj.isThundering()
|
||||
&& worldObj.isDaytime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
package techreborn.tiles.generator;
|
||||
|
||||
import reborncore.common.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
|
@ -21,79 +20,66 @@ import reborncore.common.util.Tank;
|
|||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler,IInventoryProvider
|
||||
{
|
||||
public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider {
|
||||
|
||||
public static final int euTick = ConfigTechReborn.ThermalGeneratorOutput;
|
||||
public Tank tank = new Tank("TileThermalGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
||||
public Inventory inventory = new Inventory(3, "TileThermalGenerator", 64, this);
|
||||
|
||||
public TileThermalGenerator()
|
||||
{
|
||||
public TileThermalGenerator() {
|
||||
super(ConfigTechReborn.ThermalGeneratorTier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
||||
{
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing()
|
||||
{
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate()
|
||||
{
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
||||
{
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.thermalGenerator, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
int fill = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return fill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
||||
{
|
||||
if (fluid != null)
|
||||
{
|
||||
if (fluid == FluidRegistry.LAVA)
|
||||
{
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
if (fluid != null) {
|
||||
if (fluid == FluidRegistry.LAVA) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -101,122 +87,101 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
||||
{
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
||||
{
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
tank.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
tank.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
// TODO optimise this code
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
if (!worldObj.isRemote) {
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
for (EnumFacing direction : EnumFacing.values())
|
||||
{
|
||||
for (EnumFacing direction : EnumFacing.values()) {
|
||||
if (worldObj.getBlockState(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()))
|
||||
.getBlock() == Blocks.LAVA)
|
||||
{
|
||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()))
|
||||
.getBlock() == Blocks.LAVA) {
|
||||
addEnergy(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (worldObj.getTotalWorldTime() % 40 == 0)
|
||||
{
|
||||
if (worldObj.getTotalWorldTime() % 40 == 0) {
|
||||
BlockMachineBase bmb = (BlockMachineBase) worldObj.getBlockState(pos).getBlock();
|
||||
boolean didFindLava = false;
|
||||
for (EnumFacing direction : EnumFacing.values())
|
||||
{
|
||||
for (EnumFacing direction : EnumFacing.values()) {
|
||||
if (worldObj.getBlockState(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
||||
getPos().getY() + direction.getFrontOffsetY(),
|
||||
getPos().getZ() + direction.getFrontOffsetZ())).getBlock() == Blocks.LAVA)
|
||||
{
|
||||
getPos().getY() + direction.getFrontOffsetY(),
|
||||
getPos().getZ() + direction.getFrontOffsetZ())).getBlock() == Blocks.LAVA) {
|
||||
didFindLava = true;
|
||||
}
|
||||
}
|
||||
bmb.setActive(didFindLava, worldObj, pos);
|
||||
}
|
||||
}
|
||||
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick)
|
||||
{
|
||||
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick) {
|
||||
tank.drain(1, true);
|
||||
addEnergy(euTick);
|
||||
}
|
||||
if (tank.getFluidType() != null && getStackInSlot(2) == null)
|
||||
{
|
||||
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
|
||||
// inventory.setInventorySlotContents(2, new ItemStack(tank
|
||||
// .getFluidType().getBlock()));
|
||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null)
|
||||
{
|
||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
||||
setInventorySlotContents(2, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return ConfigTechReborn.ThermalGeneratorCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,75 +8,61 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
|
|||
/**
|
||||
* Created by modmuss50 on 25/02/2016.
|
||||
*/
|
||||
public class TileWaterMill extends TilePowerAcceptor
|
||||
{
|
||||
public class TileWaterMill extends TilePowerAcceptor {
|
||||
|
||||
int waterblocks = 0;
|
||||
|
||||
public TileWaterMill()
|
||||
{
|
||||
public TileWaterMill() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (worldObj.getTotalWorldTime() % 20 == 0)
|
||||
{
|
||||
if (worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
checkForWater();
|
||||
}
|
||||
if (waterblocks > 0)
|
||||
{
|
||||
if (waterblocks > 0) {
|
||||
addEnergy(waterblocks);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkForWater()
|
||||
{
|
||||
public void checkForWater() {
|
||||
waterblocks = 0;
|
||||
for (EnumFacing facing : EnumFacing.HORIZONTALS)
|
||||
{
|
||||
if (worldObj.getBlockState(getPos().offset(facing)).getBlock() == Blocks.WATER)
|
||||
{
|
||||
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
|
||||
if (worldObj.getBlockState(getPos().offset(facing)).getBlock() == Blocks.WATER) {
|
||||
waterblocks++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,66 +7,55 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
|
|||
/**
|
||||
* Created by modmuss50 on 25/02/2016.
|
||||
*/
|
||||
public class TileWindMill extends TilePowerAcceptor
|
||||
{
|
||||
public class TileWindMill extends TilePowerAcceptor {
|
||||
|
||||
int basePower = 16;
|
||||
|
||||
public TileWindMill()
|
||||
{
|
||||
public TileWindMill() {
|
||||
super(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (pos.getY() > 64)
|
||||
{
|
||||
if (pos.getY() > 64) {
|
||||
int actualPower = basePower;
|
||||
if (worldObj.isThundering())
|
||||
{
|
||||
if (worldObj.isThundering()) {
|
||||
actualPower *= 1.25;
|
||||
}
|
||||
addEnergy(actualPower); // Value taken from
|
||||
// http://wiki.industrial-craft.net/?title=Wind_Mill
|
||||
// Not worth making more complicated
|
||||
// http://wiki.industrial-craft.net/?title=Wind_Mill
|
||||
// Not worth making more complicated
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
public double getMaxOutput() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
public double getMaxInput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue