Made the IPowerReceptor direction aware
This commit is contained in:
parent
5703c85549
commit
4438947cab
12 changed files with 15 additions and 12 deletions
|
@ -9,6 +9,8 @@
|
|||
|
||||
package buildcraft.api.power;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface IPowerReceptor {
|
||||
|
||||
public void setPowerProvider(IPowerProvider provider);
|
||||
|
@ -17,6 +19,6 @@ public interface IPowerReceptor {
|
|||
|
||||
public void doWork();
|
||||
|
||||
public int powerRequest();
|
||||
public int powerRequest(ForgeDirection validDirections);
|
||||
|
||||
}
|
||||
|
|
|
@ -561,7 +561,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
}
|
||||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
public int powerRequest(ForgeDirection from) {
|
||||
if ((bluePrintBuilder != null || currentPathIterator != null) && !done)
|
||||
return powerProvider.getMaxEnergyReceived();
|
||||
else
|
||||
|
|
|
@ -356,7 +356,7 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
|
|||
}
|
||||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
public int powerRequest(ForgeDirection from) {
|
||||
if (isActive())
|
||||
return powerProvider.getMaxEnergyReceived();
|
||||
else
|
||||
|
|
|
@ -389,7 +389,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
|||
}
|
||||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
public int powerRequest(ForgeDirection from) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
package buildcraft.factory;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.core.IMachine;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
|
@ -16,7 +17,7 @@ import buildcraft.core.TileBuildCraft;
|
|||
public abstract class TileMachine extends TileBuildCraft implements IMachine, IPowerReceptor {
|
||||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
public int powerRequest(ForgeDirection from) {
|
||||
if (isActive())
|
||||
return (int) Math.ceil(Math.min(getPowerProvider().getMaxEnergyReceived(), getPowerProvider().getMaxEnergyStored()
|
||||
- getPowerProvider().getEnergyStored()));
|
||||
|
|
|
@ -235,7 +235,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
public int powerRequest(ForgeDirection from) {
|
||||
if (powerProvider.getEnergyStored() < 200 || laser != null)
|
||||
return 25;
|
||||
else
|
||||
|
|
|
@ -161,7 +161,7 @@ public class PipeTransportPower extends PipeTransport {
|
|||
for (int i = 0; i < 6; ++i) {
|
||||
if (tiles[i] instanceof IPowerReceptor && !(tiles[i] instanceof TileGenericPipe)) {
|
||||
IPowerReceptor receptor = (IPowerReceptor) tiles[i];
|
||||
int request = receptor.powerRequest();
|
||||
int request = receptor.powerRequest(ForgeDirection.VALID_DIRECTIONS[i]);
|
||||
|
||||
if (request > 0) {
|
||||
requestEnergy(ForgeDirection.VALID_DIRECTIONS[i], request);
|
||||
|
|
|
@ -406,7 +406,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
}
|
||||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
public int powerRequest(ForgeDirection from) {
|
||||
return getPowerProvider().getMaxEnergyReceived();
|
||||
}
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
public int powerRequest(ForgeDirection from) {
|
||||
return getPowerProvider().getMaxEnergyReceived();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
public int powerRequest(ForgeDirection from) {
|
||||
return getPowerProvider().getMaxEnergyReceived();
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
public int powerRequest(ForgeDirection from) {
|
||||
return getPowerProvider().getMaxEnergyReceived();
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ public class PipePowerWood extends Pipe implements IPowerReceptor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
public int powerRequest(ForgeDirection from) {
|
||||
return getPowerProvider().getMaxEnergyReceived();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue