Merge branch 'IPowerReceptorChange' into mc1.5

Conflicts:
	common/buildcraft/transport/TileGenericPipe.java
This commit is contained in:
Krapht 2013-03-28 16:41:17 +01:00
commit aecc8f0d3a
12 changed files with 15 additions and 12 deletions

View file

@ -9,6 +9,8 @@
package buildcraft.api.power; package buildcraft.api.power;
import net.minecraftforge.common.ForgeDirection;
public interface IPowerReceptor { public interface IPowerReceptor {
public void setPowerProvider(IPowerProvider provider); public void setPowerProvider(IPowerProvider provider);
@ -17,6 +19,6 @@ public interface IPowerReceptor {
public void doWork(); public void doWork();
public int powerRequest(); public int powerRequest(ForgeDirection from);
} }

View file

@ -561,7 +561,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
} }
@Override @Override
public int powerRequest() { public int powerRequest(ForgeDirection from) {
if ((bluePrintBuilder != null || currentPathIterator != null) && !done) if ((bluePrintBuilder != null || currentPathIterator != null) && !done)
return powerProvider.getMaxEnergyReceived(); return powerProvider.getMaxEnergyReceived();
else else

View file

@ -356,7 +356,7 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
} }
@Override @Override
public int powerRequest() { public int powerRequest(ForgeDirection from) {
if (isActive()) if (isActive())
return powerProvider.getMaxEnergyReceived(); return powerProvider.getMaxEnergyReceived();
else else

View file

@ -389,7 +389,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
} }
@Override @Override
public int powerRequest() { public int powerRequest(ForgeDirection from) {
return 0; return 0;
} }

View file

@ -9,6 +9,7 @@
package buildcraft.factory; package buildcraft.factory;
import net.minecraftforge.common.ForgeDirection;
import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.IPowerReceptor;
import buildcraft.core.IMachine; import buildcraft.core.IMachine;
import buildcraft.core.TileBuildCraft; import buildcraft.core.TileBuildCraft;
@ -16,7 +17,7 @@ import buildcraft.core.TileBuildCraft;
public abstract class TileMachine extends TileBuildCraft implements IMachine, IPowerReceptor { public abstract class TileMachine extends TileBuildCraft implements IMachine, IPowerReceptor {
@Override @Override
public int powerRequest() { public int powerRequest(ForgeDirection from) {
if (isActive()) if (isActive())
return (int) Math.ceil(Math.min(getPowerProvider().getMaxEnergyReceived(), getPowerProvider().getMaxEnergyStored() return (int) Math.ceil(Math.min(getPowerProvider().getMaxEnergyReceived(), getPowerProvider().getMaxEnergyStored()
- getPowerProvider().getEnergyStored())); - getPowerProvider().getEnergyStored()));

View file

@ -235,7 +235,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
} }
@Override @Override
public int powerRequest() { public int powerRequest(ForgeDirection from) {
if (powerProvider.getEnergyStored() < 200 || laser != null) if (powerProvider.getEnergyStored() < 200 || laser != null)
return 25; return 25;
else else

View file

@ -161,7 +161,7 @@ public class PipeTransportPower extends PipeTransport {
for (int i = 0; i < 6; ++i) { for (int i = 0; i < 6; ++i) {
if (tiles[i] instanceof IPowerReceptor && !(tiles[i] instanceof TileGenericPipe)) { if (tiles[i] instanceof IPowerReceptor && !(tiles[i] instanceof TileGenericPipe)) {
IPowerReceptor receptor = (IPowerReceptor) tiles[i]; IPowerReceptor receptor = (IPowerReceptor) tiles[i];
int request = receptor.powerRequest(); int request = receptor.powerRequest(ForgeDirection.VALID_DIRECTIONS[i].getOpposite());
if (request > 0) { if (request > 0) {
requestEnergy(ForgeDirection.VALID_DIRECTIONS[i], request); requestEnergy(ForgeDirection.VALID_DIRECTIONS[i], request);

View file

@ -406,7 +406,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
} }
@Override @Override
public int powerRequest() { public int powerRequest(ForgeDirection from) {
if (BlockGenericPipe.isValid(pipe) && pipe instanceof IPowerReceptor) if (BlockGenericPipe.isValid(pipe) && pipe instanceof IPowerReceptor)
return ((IPowerReceptor) pipe).powerRequest(); return ((IPowerReceptor) pipe).powerRequest();
return 0; return 0;

View file

@ -295,7 +295,7 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
} }
@Override @Override
public int powerRequest() { public int powerRequest(ForgeDirection from) {
return getPowerProvider().getMaxEnergyReceived(); return getPowerProvider().getMaxEnergyReceived();
} }
} }

View file

@ -229,7 +229,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
} }
@Override @Override
public int powerRequest() { public int powerRequest(ForgeDirection from) {
return getPowerProvider().getMaxEnergyReceived(); return getPowerProvider().getMaxEnergyReceived();
} }

View file

@ -145,7 +145,7 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
} }
@Override @Override
public int powerRequest() { public int powerRequest(ForgeDirection from) {
return getPowerProvider().getMaxEnergyReceived(); return getPowerProvider().getMaxEnergyReceived();
} }

View file

@ -128,7 +128,7 @@ public class PipePowerWood extends Pipe implements IPowerReceptor {
} }
@Override @Override
public int powerRequest() { public int powerRequest(ForgeDirection from) {
return getPowerProvider().getMaxEnergyReceived(); return getPowerProvider().getMaxEnergyReceived();
} }