fix merge
This commit is contained in:
commit
10aa2f2ffb
33 changed files with 507 additions and 859 deletions
|
@ -13,6 +13,7 @@ import reborncore.common.util.ItemUtils;
|
|||
import techreborn.api.reactor.FusionReactorRecipe;
|
||||
import techreborn.api.reactor.FusionReactorRecipeHelper;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
public class TileEntityFusionController extends TilePowerAcceptor implements IInventoryProvider
|
||||
{
|
||||
|
@ -36,8 +37,7 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return 100000000;
|
||||
}
|
||||
|
||||
|
@ -64,10 +64,8 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
if (hasStartedCrafting)
|
||||
{
|
||||
public double getMaxInput() {
|
||||
if (hasStartedCrafting) {
|
||||
return 0;
|
||||
}
|
||||
return 8192;
|
||||
|
@ -275,6 +273,12 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
|||
{
|
||||
inventory.hasChanged = false;
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0 && hasStartedCrafting) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean validateRecipe()
|
||||
|
|
|
@ -18,6 +18,7 @@ import reborncore.common.util.Inventory;
|
|||
import reborncore.common.util.Tank;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider
|
||||
{
|
||||
|
@ -131,35 +132,33 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,6 +12,7 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
|
|||
import reborncore.common.util.Inventory;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
||||
{
|
||||
|
@ -25,18 +26,20 @@ public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrencha
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,6 +17,7 @@ import reborncore.common.util.Inventory;
|
|||
import reborncore.common.util.Tank;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -144,17 +145,14 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
|
|||
}
|
||||
|
||||
@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,20 +161,23 @@ 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);
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,6 +12,7 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
public class TileGenerator extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
||||
{
|
||||
|
@ -37,45 +38,41 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable,IInv
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastTickBurning = isBurning;
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
}
|
||||
|
||||
public void updateState()
|
||||
|
|
|
@ -10,6 +10,7 @@ import reborncore.api.power.EnumPowerTier;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
|
||||
{
|
||||
|
@ -22,35 +23,33 @@ public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,6 +10,7 @@ import reborncore.api.power.EnumPowerTier;
|
|||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
public class TileLightningRod extends TilePowerAcceptor {
|
||||
|
||||
|
@ -23,17 +24,17 @@ public class TileLightningRod extends TilePowerAcceptor {
|
|||
public void update() {
|
||||
super.update();
|
||||
|
||||
if(onStatusHoldTicks > 0)
|
||||
if (onStatusHoldTicks > 0)
|
||||
--onStatusHoldTicks;
|
||||
|
||||
if(onStatusHoldTicks == 0 || getEnergy() <= 0) {
|
||||
if(getBlockType() instanceof BlockMachineBase)
|
||||
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) {
|
||||
if (weatherStrength > 0.2F) {
|
||||
//lightStrikeChance = (MAX - (CHANCE * WEATHER_STRENGTH)
|
||||
float lightStrikeChance = ((100F - ConfigTechReborn.LightningRodChance) * 20F);
|
||||
float totalChance = lightStrikeChance * getLightningStrikeMultiplier() * ((1.1F - weatherStrength));
|
||||
|
@ -50,6 +51,10 @@ public class TileLightningRod extends TilePowerAcceptor {
|
|||
}
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
}
|
||||
|
||||
public float getLightningStrikeMultiplier() {
|
||||
|
|
|
@ -17,6 +17,7 @@ import reborncore.common.util.Inventory;
|
|||
import reborncore.common.util.Tank;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -150,14 +151,12 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
|||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
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
|
||||
|
@ -166,20 +165,23 @@ 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);
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.util.ITickable;
|
|||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import techreborn.blocks.generator.BlockSolarPanel;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -25,27 +26,26 @@ public class TileSolarPanel extends TilePowerAcceptor implements ITickable
|
|||
}
|
||||
|
||||
@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.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
|
||||
}
|
||||
|
||||
worldObj.setBlockState(getPos(),
|
||||
worldObj.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
|
||||
}
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@ import reborncore.common.util.Inventory;
|
|||
import reborncore.common.util.Tank;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler,IInventoryProvider
|
||||
{
|
||||
|
@ -137,51 +138,46 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
|||
|
||||
@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)
|
||||
{
|
||||
.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().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);
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 25/02/2016.
|
||||
|
@ -19,17 +20,19 @@ public class TileWaterMill extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
}
|
||||
|
||||
public void checkForWater()
|
||||
|
|
|
@ -3,6 +3,7 @@ package techreborn.tiles.generator;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 25/02/2016.
|
||||
|
@ -18,19 +19,16 @@ public class TileWindMill extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (pos.getY() > 64)
|
||||
{
|
||||
int actualPower = basePower;
|
||||
if (worldObj.isThundering())
|
||||
{
|
||||
actualPower *= 1.25;
|
||||
}
|
||||
addEnergy(actualPower); // Value taken from
|
||||
// http://wiki.industrial-craft.net/?title=Wind_Mill
|
||||
// Not worth making more complicated
|
||||
if (pos.getY() > 64) {
|
||||
double actualPower = basePower + basePower * worldObj.getThunderStrength(1.0F);
|
||||
addEnergy(actualPower);
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import reborncore.api.power.EnumPowerTier;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
public class TileIDSU extends TilePowerAcceptor implements IWrenchable
|
||||
{
|
||||
|
@ -125,32 +126,26 @@ public class TileIDSU extends TilePowerAcceptor implements IWrenchable
|
|||
return nbttagcompound;
|
||||
}
|
||||
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (ticks == ConfigTechReborn.AverageEuOutTickTime)
|
||||
{
|
||||
if (ticks == ConfigTechReborn.AverageEuOutTickTime) {
|
||||
euChange = -1;
|
||||
ticks = 0;
|
||||
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
ticks++;
|
||||
euChange += getEnergy() - euLastTick;
|
||||
if (euLastTick == getEnergy())
|
||||
{
|
||||
if (euLastTick == getEnergy()) {
|
||||
euChange = 0;
|
||||
}
|
||||
}
|
||||
|
||||
euLastTick = getEnergy();
|
||||
|
||||
boolean needsInvUpdate = false;
|
||||
|
||||
if (needsInvUpdate)
|
||||
{
|
||||
this.markDirty();
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import reborncore.api.power.EnumPowerTier;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -27,32 +28,25 @@ public class TileLesu extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (worldObj.isRemote)
|
||||
{
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
countedNetworks.clear();
|
||||
connectedBlocks = 0;
|
||||
for (EnumFacing dir : EnumFacing.values())
|
||||
{
|
||||
for (EnumFacing dir : EnumFacing.values()) {
|
||||
if (worldObj.getTileEntity(
|
||||
new BlockPos(getPos().getX() + dir.getFrontOffsetX(), getPos().getY() + dir.getFrontOffsetY(),
|
||||
getPos().getZ() + dir.getFrontOffsetZ())) instanceof TileLesuStorage)
|
||||
{
|
||||
getPos().getZ() + dir.getFrontOffsetZ())) instanceof TileLesuStorage) {
|
||||
if (((TileLesuStorage) worldObj.getTileEntity(
|
||||
new BlockPos(getPos().getX() + dir.getFrontOffsetX(), getPos().getY() + dir.getFrontOffsetY(),
|
||||
getPos().getZ() + dir.getFrontOffsetZ()))).network != null)
|
||||
{
|
||||
getPos().getZ() + dir.getFrontOffsetZ()))).network != null) {
|
||||
LesuNetwork network = ((TileLesuStorage) worldObj.getTileEntity(new BlockPos(
|
||||
getPos().getX() + dir.getFrontOffsetX(), getPos().getY() + dir.getFrontOffsetY(),
|
||||
getPos().getZ() + dir.getFrontOffsetZ()))).network;
|
||||
if (!countedNetworks.contains(network))
|
||||
{
|
||||
if (network.master == null || network.master == this)
|
||||
{
|
||||
if (!countedNetworks.contains(network)) {
|
||||
if (network.master == null || network.master == this) {
|
||||
connectedBlocks += network.storages.size();
|
||||
countedNetworks.add(network);
|
||||
network.master = this;
|
||||
|
@ -65,25 +59,27 @@ public class TileLesu extends TilePowerAcceptor
|
|||
maxStorage = ((connectedBlocks + 1) * ConfigTechReborn.LesuStoragePerBlock);
|
||||
output = (connectedBlocks * ConfigTechReborn.ExtraOutputPerLesuBlock) + ConfigTechReborn.BaseLesuOutput;
|
||||
|
||||
if (ticks == ConfigTechReborn.AverageEuOutTickTime)
|
||||
{
|
||||
if (ticks == ConfigTechReborn.AverageEuOutTickTime) {
|
||||
euChange = -1;
|
||||
ticks = 0;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
ticks++;
|
||||
if (euChange == -1)
|
||||
{
|
||||
if (euChange == -1) {
|
||||
euChange = 0;
|
||||
}
|
||||
euChange += getEnergy() - euLastTick;
|
||||
if (euLastTick == getEnergy())
|
||||
{
|
||||
if (euLastTick == getEnergy()) {
|
||||
euChange = 0;
|
||||
}
|
||||
}
|
||||
|
||||
euLastTick = getEnergy();
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public double getEuChange()
|
||||
|
|
|
@ -13,6 +13,7 @@ import reborncore.common.powerSystem.PoweredItem;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.blocks.storage.BlockEnergyStorage;
|
||||
import techreborn.power.PowerNet;
|
||||
|
||||
/**
|
||||
* Created by Rushmead
|
||||
|
@ -54,40 +55,39 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable,
|
|||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override public void updateEntity()
|
||||
{
|
||||
if (inventory.getStackInSlot(0) != null)
|
||||
{
|
||||
@Override public void updateEntity() {
|
||||
if (inventory.getStackInSlot(0) != null) {
|
||||
ItemStack stack = inventory.getStackInSlot(0);
|
||||
if(!(stack.getItem() instanceof IEnergyItemInfo)){
|
||||
if (!(stack.getItem() instanceof IEnergyItemInfo)) {
|
||||
return;
|
||||
}
|
||||
IEnergyItemInfo item = (IEnergyItemInfo) inventory.getStackInSlot(0).getItem();
|
||||
if (PoweredItem.getEnergy(stack) != PoweredItem.getMaxPower(stack))
|
||||
{
|
||||
if (canUseEnergy(item.getMaxTransfer(stack)))
|
||||
{
|
||||
if (PoweredItem.getEnergy(stack) != PoweredItem.getMaxPower(stack)) {
|
||||
if (canUseEnergy(item.getMaxTransfer(stack))) {
|
||||
useEnergy(item.getMaxTransfer(stack));
|
||||
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) + item.getMaxTransfer(stack), stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inventory.getStackInSlot(1) != null)
|
||||
{
|
||||
if (inventory.getStackInSlot(1) != null) {
|
||||
ItemStack stack = inventory.getStackInSlot(1);
|
||||
if(!(stack.getItem() instanceof IEnergyItemInfo)){
|
||||
if (!(stack.getItem() instanceof IEnergyItemInfo)) {
|
||||
return;
|
||||
}
|
||||
IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
|
||||
if (item.canProvideEnergy(stack))
|
||||
{
|
||||
if (getEnergy() != getMaxPower())
|
||||
{
|
||||
if (item.canProvideEnergy(stack)) {
|
||||
if (getEnergy() != getMaxPower()) {
|
||||
addEnergy(item.getMaxTransfer(stack));
|
||||
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) - item.getMaxTransfer(stack), stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(PowerNet.dispatchEnergyPacket(worldObj, getPos(), maxOutput));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue