Moved the lesu to the new system, looks like its stripping every thing ;'(

This commit is contained in:
modmuss50 2015-07-01 20:34:22 +01:00
parent 30ff429b6a
commit a71b399765
3 changed files with 45 additions and 33 deletions

View file

@ -59,11 +59,11 @@ public class ContainerLesu extends TechRebornContainer {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting)this.crafters.get(i);
if(this.euOut != tile.output){
icrafting.sendProgressBarUpdate(this, 0, tile.output);
if(this.euOut != tile.getMaxOutput()){
icrafting.sendProgressBarUpdate(this, 0, (int) tile.getMaxOutput());
}
if(this.storedEu != tile.energy){
icrafting.sendProgressBarUpdate(this, 1, (int) tile.energy);
if(this.storedEu != tile.getEnergy()){
icrafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
}
if(this.euChange != tile.getEuChange() && tile.getEuChange() != -1){
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
@ -77,8 +77,8 @@ public class ContainerLesu extends TechRebornContainer {
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, tile.output);
crafting.sendProgressBarUpdate(this, 1, (int) tile.energy);
crafting.sendProgressBarUpdate(this, 0, (int) tile.getMaxOutput());
crafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
crafting.sendProgressBarUpdate(this, 2 , (int) tile.getEuChange());
crafting.sendProgressBarUpdate(this, 3 , tile.connectedBlocks);
}

View file

@ -20,9 +20,9 @@ import techreborn.tiles.TileMachineBase;
@Optional.InterfaceList(value = {
@Optional.Interface(iface = "ic2.api.energy.tile.IEnergyTile", modid = "IC2", striprefs = true),
@Optional.Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2", striprefs = true),
@Optional.Interface(iface = "ic2.api.energy.tile.IEnergySource", modid = "IC2", striprefs = true)
@Optional.Interface(iface = "ic2.api.energy.tile.IEnergyTile", modid = "IC2"),
@Optional.Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"),
@Optional.Interface(iface = "ic2.api.energy.tile.IEnergySource", modid = "IC2")
})
public abstract class TilePowerAcceptor extends TileMachineBase implements
IEnergyReceiver, IEnergyProvider, //Cofh
@ -31,12 +31,9 @@ public abstract class TilePowerAcceptor extends TileMachineBase implements
{
public int tier;
private double energy;
public final TileEntity parent;
public int maxEnergy;
public TilePowerAcceptor(int tier, TileEntity parent) {
public TilePowerAcceptor(int tier) {
this.tier = tier;
this.parent = parent;
}
//IC2
@ -56,11 +53,6 @@ public abstract class TilePowerAcceptor extends TileMachineBase implements
if (PowerSystem.EUPOWENET && !addedToEnet &&
!FMLCommonHandler.instance().getEffectiveSide().isClient() &&
Info.isIc2Available()) {
worldObj = parent.getWorldObj();
xCoord = parent.xCoord;
yCoord = parent.yCoord;
zCoord = parent.zCoord;
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnet = true;
@ -209,11 +201,6 @@ public abstract class TilePowerAcceptor extends TileMachineBase implements
}
}
@Override
public double getMaxPower() {
return maxEnergy;
}
@Override
public double addEnergy(double energy) {
return addEnergy(energy, true);
@ -253,8 +240,8 @@ public abstract class TilePowerAcceptor extends TileMachineBase implements
public boolean canAddEnergy(double energy) {
return this.energy + energy <= getMaxPower();
}
//TechReborn END
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);

View file

@ -5,11 +5,12 @@ import ic2.api.tile.IWrenchable;
import net.minecraftforge.common.util.ForgeDirection;
import techreborn.blocks.storage.EUStorageTile;
import techreborn.config.ConfigTechReborn;
import techreborn.powerSystem.TilePowerAcceptor;
import techreborn.util.Inventory;
import java.util.ArrayList;
public class TileLesu extends EUStorageTile implements IWrenchable {
public class TileLesu extends TilePowerAcceptor {//TODO wrench
private ArrayList<LesuNetwork> countedNetworks = new ArrayList<LesuNetwork>();
public int connectedBlocks = 0;
@ -18,11 +19,13 @@ public class TileLesu extends EUStorageTile implements IWrenchable {
private double euLastTick = 0;
private double euChange;
private int ticks;
private int output;
private int maxStorage;
public Inventory inventory = new Inventory(2, "TileAesu", 64);
public TileLesu() {
super(5, 0, 0);
super(5);
}
@Override
@ -42,6 +45,7 @@ public class TileLesu extends EUStorageTile implements IWrenchable {
connectedBlocks += network.storages.size();
countedNetworks.add(network);
network.master = this;
break;
}
}
}
@ -60,19 +64,15 @@ public class TileLesu extends EUStorageTile implements IWrenchable {
if(euChange == -1){
euChange = 0;
}
euChange += energy - euLastTick;
if(euLastTick == energy){
euChange += getEnergy() - euLastTick;
if(euLastTick == getEnergy()){
euChange = 0;
}
}
euLastTick = energy;
euLastTick = getEnergy();
}
@Override
public String getInventoryName() {
return "Lesu";
}
public double getEuChange(){
if(euChange == -1){
@ -80,4 +80,29 @@ public class TileLesu extends EUStorageTile implements IWrenchable {
}
return (euChange / ticks);
}
@Override
public double getMaxPower() {
return maxStorage;
}
@Override
public boolean canAcceptEnergy(ForgeDirection direction) {
return direction.ordinal() != blockMetadata;
}
@Override
public boolean canProvideEnergy(ForgeDirection direction) {
return direction.ordinal() == blockMetadata;
}
@Override
public double getMaxOutput() {
return output;
}
@Override
public double getMaxInput() {
return 8192;
}
}