mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 12:09:39 +00:00
Fix #237 Engines connected to cables don't animate
This commit is contained in:
1 parent
14afcf6c63
commit
afc3efbc61
2 files changed
+10
-5
No files matched your search
@@ -77,6 +77,9 @@ public abstract class Engine extends TileBase implements IEnergyHandler {
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.maxEnergyExtracted = maxEnergyExtracted;
|
||||
energyManager = new EnergyManager(100, 2000, 100, 1000000);
|
||||
|
||||
// allow engines to chain, but not have energy sucked out of them
|
||||
energyManager.setReceiveOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,7 +155,7 @@ public abstract class Engine extends TileBase implements IEnergyHandler {
|
||||
}
|
||||
|
||||
} else if (canPowerTo(tile)) { // If we are not already running, check if
|
||||
if (extractEnergy(getOrientation(), 1, true) > 0) {
|
||||
if (getEnergyStored(getOrientation()) > 0) {
|
||||
stagePiston = 1; // If we can transfer energy, start running
|
||||
setActive(true);
|
||||
} else
|
||||
|
||||
@@ -143,7 +143,8 @@ public class EnergyManager implements IEnergyHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends as much energy as it can to the tile at orientation
|
||||
* Sends as much energy as it can to the tile at orientation.
|
||||
* For power sources. Ignores canExtract()
|
||||
* @param orientation
|
||||
* @param tile
|
||||
* @return amount sent
|
||||
@@ -153,7 +154,8 @@ public class EnergyManager implements IEnergyHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends amount of energy to the tile at orientation
|
||||
* Sends amount of energy to the tile at orientation.
|
||||
* For power sources. Ignores canExtract()
|
||||
* @param orientation
|
||||
* @param tile
|
||||
* @param amount
|
||||
@@ -164,10 +166,10 @@ public class EnergyManager implements IEnergyHandler {
|
||||
if (BlockUtil.isRFTile(orientation.getOpposite(), tile)) {
|
||||
IEnergyHandler receptor = (IEnergyHandler) tile;
|
||||
|
||||
int extractable = extractEnergy(orientation, amount, true);
|
||||
int extractable = energyStorage.extractEnergy(amount, true);
|
||||
if (extractable > 0) {
|
||||
sent = receptor.receiveEnergy(orientation.getOpposite(), extractable, false);
|
||||
extractEnergy(orientation, sent, false);
|
||||
energyStorage.extractEnergy(sent, false);
|
||||
}
|
||||
}
|
||||
return sent;
|
||||
|
||||
Reference in new issue
Block a user