Replaced protected fields access with methods calls, now code more safe.
This commit is contained in:
parent
ded594c86c
commit
c6d39f12fd
2 changed files with 10 additions and 13 deletions
|
@ -1,7 +1,6 @@
|
||||||
package gregtech.loaders.postload;
|
package gregtech.loaders.postload;
|
||||||
|
|
||||||
import appeng.items.parts.PartType;
|
import appeng.items.parts.PartType;
|
||||||
import appeng.parts.p2p.PartP2PGTPower;
|
|
||||||
import gregtech.GT_Mod;
|
import gregtech.GT_Mod;
|
||||||
import gregtech.api.util.GT_Log;
|
import gregtech.api.util.GT_Log;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package appeng.parts.p2p;
|
package gregtech.loaders.postload;
|
||||||
|
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.networking.ticking.IGridTickable;
|
import appeng.api.networking.ticking.IGridTickable;
|
||||||
import appeng.api.networking.ticking.TickRateModulation;
|
import appeng.api.networking.ticking.TickRateModulation;
|
||||||
import appeng.api.networking.ticking.TickingRequest;
|
import appeng.api.networking.ticking.TickingRequest;
|
||||||
|
import appeng.parts.p2p.PartP2PIC2Power;
|
||||||
import gregtech.api.interfaces.tileentity.IEnergyConnected;
|
import gregtech.api.interfaces.tileentity.IEnergyConnected;
|
||||||
import gregtech.api.util.GT_Utility;
|
import gregtech.api.util.GT_Utility;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -54,20 +55,17 @@ public class PartP2PGTPower extends PartP2PIC2Power implements IGridTickable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean outputEnergy() {
|
public boolean outputEnergy() {
|
||||||
if (OutputEnergyA == 0) {
|
if (getOfferedEnergy() == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TileEntity t = getTileEntityAtSide((byte) side.ordinal());
|
TileEntity t = getTileEntityAtSide((byte) side.ordinal());
|
||||||
if (t instanceof IEnergyConnected) {
|
if (t instanceof IEnergyConnected) {
|
||||||
long l = ((IEnergyConnected) t).injectEnergyUnits(GT_Utility.getOppositeSide(side.ordinal()), (long) OutputVoltageA, ((long) OutputEnergyA) / ((long) OutputVoltageA));
|
long voltage = 8 << (getSourceTier() * 2);
|
||||||
if (l > 0) {
|
if (voltage > getOfferedEnergy()) {
|
||||||
OutputEnergyA -= ((long) OutputVoltageA) * l;
|
voltage = (long) getOfferedEnergy();
|
||||||
if (OutputEnergyA < 1) {
|
|
||||||
OutputEnergyA = OutputEnergyB;
|
|
||||||
OutputVoltageA = OutputVoltageB;
|
|
||||||
OutputEnergyB = 0;
|
|
||||||
OutputVoltageB = 0;
|
|
||||||
}
|
}
|
||||||
|
if (((IEnergyConnected) t).injectEnergyUnits(GT_Utility.getOppositeSide(side.ordinal()), voltage, 1) > 0) {
|
||||||
|
drawEnergy(voltage);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +74,7 @@ public class PartP2PGTPower extends PartP2PIC2Power implements IGridTickable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TickingRequest getTickingRequest(IGridNode iGridNode) {
|
public TickingRequest getTickingRequest(IGridNode iGridNode) {
|
||||||
return new TickingRequest(1, 10, false, false);
|
return new TickingRequest(1, 20, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
Loading…
Reference in a new issue