Rewrite to use new RebornCore Power API. Texture fixes.
This commit is contained in:
parent
6f54e3801f
commit
b292fdd352
77 changed files with 1342 additions and 3008 deletions
|
@ -3,15 +3,14 @@ package techreborn.tiles.lesu;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.tile.TilePowerAcceptorProducer;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.power.EnergyUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TileLesu extends TilePowerAcceptor
|
||||
{// TODO wrench
|
||||
public class TileLesu extends TilePowerAcceptorProducer {// TODO wrench
|
||||
|
||||
public int connectedBlocks = 0;
|
||||
public Inventory inventory = new Inventory(2, "TileAesu", 64, this);
|
||||
|
@ -22,14 +21,10 @@ public class TileLesu extends TilePowerAcceptor
|
|||
private int output;
|
||||
private int maxStorage;
|
||||
|
||||
public TileLesu()
|
||||
{
|
||||
super(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
public void update() {
|
||||
super.update();
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
@ -77,53 +72,44 @@ public class TileLesu extends TilePowerAcceptor
|
|||
|
||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
||||
for(EnumFacing facing : EnumFacing.VALUES) {
|
||||
double disposed = emitEnergy(facing, maxOutput);
|
||||
if(disposed != 0) {
|
||||
maxOutput -= disposed;
|
||||
useEnergy(disposed);
|
||||
if (maxOutput == 0) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public double getEuChange()
|
||||
{
|
||||
if (euChange == -1)
|
||||
{
|
||||
//TODO move to RebornCore
|
||||
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||
BlockPos pos = getPos().offset(enumFacing);
|
||||
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||
worldObj, enumFacing.getOpposite(), pos);
|
||||
if(receiver != null) {
|
||||
return receiver.receiveEnergy(amount, false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public double getEuChange() {
|
||||
if (euChange == -1) {
|
||||
return 0;
|
||||
}
|
||||
return (euChange / ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
public double getMaxPower() {
|
||||
return maxStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction)
|
||||
{
|
||||
return direction != getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction)
|
||||
{
|
||||
return direction == getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxInput()
|
||||
{
|
||||
return 8192;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPowerTier getTier()
|
||||
{
|
||||
return EnumPowerTier.EXTREME;
|
||||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.INSANE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue