Power system re-write, recipe fixes.
Please note that this version breaks all wires placed in worlds before.
This commit is contained in:
parent
25c581e129
commit
d982cc4028
33 changed files with 507 additions and 859 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue