Some changes to the way rf is handled.

This commit is contained in:
modmuss50 2015-07-25 17:55:03 +01:00
parent 26f63e04f7
commit e8bbbcc7c3
2 changed files with 11 additions and 4 deletions

View file

@ -144,7 +144,7 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
public boolean canConnectEnergy(ForgeDirection from) {
if (!PowerSystem.RFPOWENET)
return false;
return canAcceptEnergy(from);
return canAcceptEnergy(from) || canProvideEnergy(from);
}
@Override
@ -154,7 +154,12 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
if (!canAcceptEnergy(from)) {
return 0;
}
return (int) ((int) addEnergy(maxReceive, simulate) / PowerSystem.euPerRF);
int energyReceived = Math.min(getMaxEnergyStored(ForgeDirection.UNKNOWN) - getEnergyStored(ForgeDirection.UNKNOWN), Math.min((int)this.getMaxInput(), maxReceive));
if (!simulate) {
energy += energyReceived;
}
return energyReceived;
}
@Override
@ -178,6 +183,7 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
if (!canAcceptEnergy(from)) {
return 0;
}
maxExtract *= PowerSystem.euPerRF;
return (int) ((int) useEnergy(maxExtract, simulate) / PowerSystem.euPerRF);
}
//END COFH

View file

@ -7,6 +7,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.lib.Functions;
import techreborn.powerSystem.TilePowerAcceptor;
import techreborn.util.Inventory;
@ -153,12 +154,12 @@ public class TileAesu extends TilePowerAcceptor implements IWrenchable {
@Override
public boolean canAcceptEnergy(ForgeDirection direction) {
return true;
return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) != Functions.getIntDirFromDirection(direction);
}
@Override
public boolean canProvideEnergy(ForgeDirection direction) {
return true;
return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == Functions.getIntDirFromDirection(direction);
}
@Override