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) { public boolean canConnectEnergy(ForgeDirection from) {
if (!PowerSystem.RFPOWENET) if (!PowerSystem.RFPOWENET)
return false; return false;
return canAcceptEnergy(from); return canAcceptEnergy(from) || canProvideEnergy(from);
} }
@Override @Override
@ -154,7 +154,12 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
if (!canAcceptEnergy(from)) { if (!canAcceptEnergy(from)) {
return 0; 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 @Override
@ -178,6 +183,7 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
if (!canAcceptEnergy(from)) { if (!canAcceptEnergy(from)) {
return 0; return 0;
} }
maxExtract *= PowerSystem.euPerRF;
return (int) ((int) useEnergy(maxExtract, simulate) / PowerSystem.euPerRF); return (int) ((int) useEnergy(maxExtract, simulate) / PowerSystem.euPerRF);
} }
//END COFH //END COFH

View file

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