Fusion reactor fixes & rewrite, energy fixes.
This commit is contained in:
parent
fe64b8ccf7
commit
06fad2264f
13 changed files with 279 additions and 386 deletions
|
@ -9,7 +9,7 @@ import techreborn.init.ModBlocks;
|
|||
public class TileBatBox extends TileEnergyStorage {
|
||||
|
||||
public TileBatBox() {
|
||||
super("BatBox", 2, ModBlocks.batBox, EnumPowerTier.LOW, 32, 32, 40000);
|
||||
super("BatBox", 2, ModBlocks.batBox, EnumPowerTier.LOW, 40000);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,9 +9,11 @@ import net.minecraft.util.math.BlockPos;
|
|||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.power.tile.IEnergyProducerTile;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.tile.TilePowerAcceptor;
|
||||
import reborncore.common.tile.TilePowerAcceptorProducer;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.blocks.storage.BlockEnergyStorage;
|
||||
|
@ -22,23 +24,19 @@ import java.util.List;
|
|||
/**
|
||||
* Created by Rushmead
|
||||
*/
|
||||
public class TileEnergyStorage extends TilePowerAcceptorProducer implements IWrenchable, ITickable, IInventoryProvider, IListInfoProvider {
|
||||
public class TileEnergyStorage extends TilePowerAcceptor implements IEnergyProducerTile, IWrenchable, ITickable, IInventoryProvider, IListInfoProvider {
|
||||
|
||||
public Inventory inventory;
|
||||
public String name;
|
||||
public Block wrenchDrop;
|
||||
public EnumPowerTier tier;
|
||||
public int maxInput;
|
||||
public int maxOutput;
|
||||
public int maxStorage;
|
||||
|
||||
public TileEnergyStorage(String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) {
|
||||
public TileEnergyStorage(String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxStorage) {
|
||||
inventory = new Inventory(invSize, "Tile" + name, 64, this);
|
||||
this.wrenchDrop = wrenchDrop;
|
||||
this.tier = tier;
|
||||
this.name = name;
|
||||
this.maxInput = maxInput;
|
||||
this.maxOutput = maxOuput;
|
||||
this.maxStorage = maxStorage;
|
||||
}
|
||||
|
||||
|
@ -93,23 +91,13 @@ public class TileEnergyStorage extends TilePowerAcceptorProducer implements IWre
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
for(EnumFacing facing : EnumFacing.VALUES) {
|
||||
double disposed = emitEnergy(facing, maxOutput);
|
||||
if(disposed != 0) {
|
||||
maxOutput -= disposed;
|
||||
useEnergy(disposed);
|
||||
if (maxOutput == 0) return;
|
||||
}
|
||||
}
|
||||
double disposed = emitEnergy(getFacingEnum(), maxOutput);
|
||||
if (maxOutput != 0 && disposed != 0) useEnergy(disposed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//TODO move to RebornCore
|
||||
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||
BlockPos pos = getPos().offset(enumFacing);
|
||||
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||
|
@ -120,6 +108,16 @@ public class TileEnergyStorage extends TilePowerAcceptorProducer implements IWre
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return getFacingEnum() != direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return getFacingEnum() == direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFacing(EnumFacing enumFacing) {
|
||||
worldObj.setBlockState(pos, worldObj.getBlockState(pos).withProperty(BlockEnergyStorage.FACING, enumFacing));
|
||||
|
|
|
@ -9,7 +9,7 @@ import techreborn.init.ModBlocks;
|
|||
public class TileMFE extends TileEnergyStorage {
|
||||
|
||||
public TileMFE() {
|
||||
super("MFE", 2, ModBlocks.mfe, EnumPowerTier.MEDIUM, 512, 512, 4000000);
|
||||
super("MFE", 2, ModBlocks.mfe, EnumPowerTier.HIGH, 4000000);
|
||||
}
|
||||
|
||||
}
|
|
@ -9,7 +9,7 @@ import techreborn.init.ModBlocks;
|
|||
public class TileMFSU extends TileEnergyStorage {
|
||||
|
||||
public TileMFSU() {
|
||||
super("MFSU", 2, ModBlocks.mfsu, EnumPowerTier.HIGH, 2048, 2048, 40000000);
|
||||
super("MFSU", 2, ModBlocks.mfsu, EnumPowerTier.EXTREME, 40000000);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue