Moved power framework API to new format.

This commit is contained in:
SirSengir 2012-07-18 17:17:10 +02:00
parent 4078a8367c
commit a617ef9ef9
31 changed files with 428 additions and 126 deletions

View file

@ -13,11 +13,11 @@ import java.util.TreeMap;
import net.minecraft.src.buildcraft.api.Action; import net.minecraft.src.buildcraft.api.Action;
import net.minecraft.src.buildcraft.api.BuildCraftAPI; import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.PowerFramework;
import net.minecraft.src.buildcraft.api.Trigger; import net.minecraft.src.buildcraft.api.Trigger;
import net.minecraft.src.buildcraft.api.liquids.LiquidData; import net.minecraft.src.buildcraft.api.liquids.LiquidData;
import net.minecraft.src.buildcraft.api.liquids.LiquidManager; import net.minecraft.src.buildcraft.api.liquids.LiquidManager;
import net.minecraft.src.buildcraft.api.liquids.LiquidStack; import net.minecraft.src.buildcraft.api.liquids.LiquidStack;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.core.ActionMachineControl; import net.minecraft.src.buildcraft.core.ActionMachineControl;
import net.minecraft.src.buildcraft.core.ActionMachineControl.Mode; import net.minecraft.src.buildcraft.core.ActionMachineControl.Mode;
import net.minecraft.src.buildcraft.core.ActionRedstoneOutput; import net.minecraft.src.buildcraft.core.ActionRedstoneOutput;

View file

@ -9,6 +9,7 @@
package net.minecraft.src.buildcraft.api; package net.minecraft.src.buildcraft.api;
@Deprecated
public interface IPowerReceptor { public interface IPowerReceptor {
public void setPowerProvider(PowerProvider provider); public void setPowerProvider(PowerProvider provider);

View file

@ -11,6 +11,7 @@ package net.minecraft.src.buildcraft.api;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
@Deprecated
public abstract class PowerFramework { public abstract class PowerFramework {
static private String baseNBTName = "net.minecraft.src.buildcarft.Power"; static private String baseNBTName = "net.minecraft.src.buildcarft.Power";

View file

@ -11,7 +11,11 @@ package net.minecraft.src.buildcraft.api;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntity;
import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.SafeTimeTracker;
import net.minecraft.src.buildcraft.api.TileNetworkData;
@Deprecated
public abstract class PowerProvider { public abstract class PowerProvider {
public int latency; public int latency;

View file

@ -0,0 +1,41 @@
package net.minecraft.src.buildcraft.api.power;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.SafeTimeTracker;
public interface IPowerProvider {
int getLatency();
int getMinEnergyReceived();
int getMaxEnergyReceived();
int getMaxEnergyStored();
int getActivationEnergy();
float getEnergyStored();
void configure(int latency, int minEnergyReceived, int maxEnergyReceived, int minActivationEnergy, int maxStoredEnergy);
void configurePowerPerdition(int powerLoss, int powerLossRegularity);
boolean update(IPowerReceptor receptor);
boolean preConditions(IPowerReceptor receptor);
float useEnergy(float min, float max, boolean doUse);
void readFromNBT(NBTTagCompound nbttagcompound);
void writeToNBT(NBTTagCompound nbttagcompound);
void receiveEnergy(float quantity, Orientations from);
boolean isPowerSource(Orientations from);
SafeTimeTracker getTimeTracker();
}

View file

@ -0,0 +1,23 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api.power;
public interface IPowerReceptor {
public void setPowerProvider(IPowerProvider provider);
public IPowerProvider getPowerProvider();
public void doWork();
public int powerRequest();
}

View file

@ -0,0 +1,56 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api.power;
import net.minecraft.src.NBTTagCompound;
public abstract class PowerFramework {
static private String baseNBTName = "net.minecraft.src.buildcarft.Power";
public static PowerFramework currentFramework;
public abstract IPowerProvider createPowerProvider();
public void loadPowerProvider(IPowerReceptor receptor, NBTTagCompound compound) {
IPowerProvider provider = createPowerProvider();
if (compound.hasKey(baseNBTName)) {
NBTTagCompound cpt = compound.getCompoundTag(baseNBTName);
if (cpt.getString("class").equals(this.getClass().getName())) {
provider.readFromNBT(cpt.getCompoundTag("contents"));
}
}
receptor.setPowerProvider(provider);
}
public void savePowerProvider(IPowerReceptor receptor, NBTTagCompound compound) {
IPowerProvider provider = receptor.getPowerProvider();
if (provider == null) {
return;
}
NBTTagCompound cpt = new NBTTagCompound();
cpt.setString("class", this.getClass().getName());
NBTTagCompound contents = new NBTTagCompound();
provider.writeToNBT(contents);
cpt.setTag("contents", contents);
compound.setTag(baseNBTName, cpt);
}
}

View file

@ -0,0 +1,162 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraft.src.buildcraft.api.power;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity;
import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.SafeTimeTracker;
public abstract class PowerProvider implements IPowerProvider {
protected int latency;
protected int minEnergyReceived;
protected int maxEnergyReceived;
protected int maxEnergyStored;
protected int minActivationEnergy;
protected float energyStored = 0;
protected int powerLoss = 1;
protected int powerLossRegularity = 100;
public SafeTimeTracker timeTracker = new SafeTimeTracker();
public SafeTimeTracker energyLossTracker = new SafeTimeTracker();
public int[] powerSources = { 0, 0, 0, 0, 0, 0 };
@Override public SafeTimeTracker getTimeTracker() { return this.timeTracker; }
@Override public int getLatency() { return this.latency; }
@Override public int getMinEnergyReceived() { return this.minEnergyReceived; }
@Override public int getMaxEnergyReceived() { return this.maxEnergyReceived; }
@Override public int getMaxEnergyStored() { return this.maxEnergyStored; }
@Override public int getActivationEnergy() { return this.minActivationEnergy; }
@Override public float getEnergyStored() { return this.energyStored; }
@Override
public void configure(int latency, int minEnergyReceived, int maxEnergyReceived, int minActivationEnergy, int maxStoredEnergy) {
this.latency = latency;
this.minEnergyReceived = minEnergyReceived;
this.maxEnergyReceived = maxEnergyReceived;
this.maxEnergyStored = maxStoredEnergy;
this.minActivationEnergy = minActivationEnergy;
}
@Override
public void configurePowerPerdition(int powerLoss, int powerLossRegularity) {
this.powerLoss = powerLoss;
this.powerLossRegularity = powerLossRegularity;
}
@Override
public boolean update(IPowerReceptor receptor) {
if (!preConditions(receptor)) {
return false;
}
TileEntity tile = (TileEntity) receptor;
boolean result = false;
if (energyStored >= minActivationEnergy) {
if (latency == 0) {
receptor.doWork();
result = true;
} else {
if (timeTracker.markTimeIfDelay(tile.worldObj, latency)) {
receptor.doWork();
result = true;
}
}
}
if (powerLoss > 0 && energyLossTracker.markTimeIfDelay(tile.worldObj, powerLossRegularity)) {
energyStored -= powerLoss;
if (energyStored < 0) {
energyStored = 0;
}
}
for (int i = 0; i < 6; ++i) {
if (powerSources[i] > 0) {
powerSources[i]--;
}
}
return result;
}
@Override
public boolean preConditions(IPowerReceptor receptor) {
return true;
}
@Override
public float useEnergy(float min, float max, boolean doUse) {
float result = 0;
if (energyStored >= min) {
if (energyStored <= max) {
result = energyStored;
if (doUse) {
energyStored = 0;
}
} else {
result = max;
if (doUse) {
energyStored -= max;
}
}
}
return result;
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
latency = nbttagcompound.getInteger("latency");
minEnergyReceived = nbttagcompound.getInteger("minEnergyReceived");
maxEnergyReceived = nbttagcompound.getInteger("maxEnergyReceived");
maxEnergyStored = nbttagcompound.getInteger("maxStoreEnergy");
minActivationEnergy = nbttagcompound.getInteger("minActivationEnergy");
try {
energyStored = nbttagcompound.getFloat("storedEnergy");
} catch (Throwable c) {
energyStored = 0;
}
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("latency", latency);
nbttagcompound.setInteger("minEnergyReceived", minEnergyReceived);
nbttagcompound.setInteger("maxEnergyReceived", maxEnergyReceived);
nbttagcompound.setInteger("maxStoreEnergy", maxEnergyStored);
nbttagcompound.setInteger("minActivationEnergy", minActivationEnergy);
nbttagcompound.setFloat("storedEnergy", energyStored);
}
@Override
public void receiveEnergy(float quantity, Orientations from) {
powerSources[from.ordinal()] = 2;
energyStored += quantity;
if (energyStored > maxEnergyStored) {
energyStored = maxEnergyStored;
}
}
@Override
public boolean isPowerSource(Orientations from) {
return powerSources[from.ordinal()] != 0;
}
}

View file

@ -21,13 +21,14 @@ import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NBTTagList; import net.minecraft.src.NBTTagList;
import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntity;
import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.LaserKind; import net.minecraft.src.buildcraft.api.LaserKind;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.Position;
import net.minecraft.src.buildcraft.api.PowerFramework;
import net.minecraft.src.buildcraft.api.PowerProvider;
import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.TileNetworkData;
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.BlockIndex; import net.minecraft.src.buildcraft.core.BlockIndex;
import net.minecraft.src.buildcraft.core.Box; import net.minecraft.src.buildcraft.core.Box;
import net.minecraft.src.buildcraft.core.BptBase; import net.minecraft.src.buildcraft.core.BptBase;
@ -55,7 +56,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
public @TileNetworkData public @TileNetworkData
Box box = new Box(); Box box = new Box();
private PowerProvider powerProvider; private IPowerProvider powerProvider;
private LinkedList<BlockIndex> path; private LinkedList<BlockIndex> path;
@ -526,12 +527,12 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
powerProvider = provider; powerProvider = provider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }
@ -570,7 +571,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
@Override @Override
public int powerRequest() { public int powerRequest() {
if ((bluePrintBuilder != null || currentPathIterator != null) && !done) { if ((bluePrintBuilder != null || currentPathIterator != null) && !done) {
return powerProvider.maxEnergyReceived; return powerProvider.getMaxEnergyReceived();
} else { } else {
return 0; return 0;
} }

View file

@ -17,15 +17,16 @@ import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.Action; import net.minecraft.src.buildcraft.api.Action;
import net.minecraft.src.buildcraft.api.IActionReceptor; import net.minecraft.src.buildcraft.api.IActionReceptor;
import net.minecraft.src.buildcraft.api.IAreaProvider; import net.minecraft.src.buildcraft.api.IAreaProvider;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.ISpecialInventory; import net.minecraft.src.buildcraft.api.ISpecialInventory;
import net.minecraft.src.buildcraft.api.LaserKind; import net.minecraft.src.buildcraft.api.LaserKind;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.PowerFramework;
import net.minecraft.src.buildcraft.api.PowerProvider;
import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.TileNetworkData;
import net.minecraft.src.buildcraft.api.filler.FillerManager; import net.minecraft.src.buildcraft.api.filler.FillerManager;
import net.minecraft.src.buildcraft.api.filler.IFillerPattern; import net.minecraft.src.buildcraft.api.filler.IFillerPattern;
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.ActionMachineControl; import net.minecraft.src.buildcraft.core.ActionMachineControl;
import net.minecraft.src.buildcraft.core.ActionMachineControl.Mode; import net.minecraft.src.buildcraft.core.ActionMachineControl.Mode;
import net.minecraft.src.buildcraft.core.Box; import net.minecraft.src.buildcraft.core.Box;
@ -48,7 +49,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
boolean forceDone = false; boolean forceDone = false;
private ItemStack contents[]; private ItemStack contents[];
PowerProvider powerProvider; IPowerProvider powerProvider;
private ActionMachineControl.Mode lastMode = ActionMachineControl.Mode.Unknown; private ActionMachineControl.Mode lastMode = ActionMachineControl.Mode.Unknown;
@ -95,7 +96,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
} }
} }
if (powerProvider.energyStored > 25) { if (powerProvider.getEnergyStored() > 25) {
doWork(); doWork();
} }
} }
@ -140,7 +141,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
} }
} }
if (powerProvider.energyStored > 25) { if (powerProvider.getEnergyStored() > 25) {
doWork(); doWork();
} }
} }
@ -394,12 +395,12 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
powerProvider = provider; powerProvider = provider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }
@ -431,7 +432,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
@Override @Override
public int powerRequest() { public int powerRequest() {
if (isActive()) { if (isActive()) {
return powerProvider.maxEnergyReceived; return powerProvider.getMaxEnergyReceived();
} else { } else {
return 0; return 0;
} }

View file

@ -9,13 +9,14 @@
package net.minecraft.src.buildcraft.core; package net.minecraft.src.buildcraft.core;
import net.minecraft.src.buildcraft.api.PowerFramework; import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.PowerProvider; import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
public class RedstonePowerFramework extends PowerFramework { public class RedstonePowerFramework extends PowerFramework {
@Override @Override
public PowerProvider createPowerProvider() { public IPowerProvider createPowerProvider() {
return new RedstonePowerProvider(); return new RedstonePowerProvider();
} }

View file

@ -12,8 +12,8 @@ package net.minecraft.src.buildcraft.core;
import net.minecraft.src.BuildCraftCore; import net.minecraft.src.BuildCraftCore;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntity;
import net.minecraft.src.buildcraft.api.IPowerReceptor; import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.PowerProvider; import net.minecraft.src.buildcraft.api.power.PowerProvider;
public class RedstonePowerProvider extends PowerProvider { public class RedstonePowerProvider extends PowerProvider {

View file

@ -15,7 +15,7 @@ import java.util.Map;
import net.minecraft.src.Packet; import net.minecraft.src.Packet;
import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntity;
import net.minecraft.src.mod_BuildCraftCore; import net.minecraft.src.mod_BuildCraftCore;
import net.minecraft.src.buildcraft.api.IPowerReceptor; import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.core.network.ISynchronizedTile; import net.minecraft.src.buildcraft.core.network.ISynchronizedTile;
import net.minecraft.src.buildcraft.core.network.PacketPayload; import net.minecraft.src.buildcraft.core.network.PacketPayload;
import net.minecraft.src.buildcraft.core.network.PacketTileUpdate; import net.minecraft.src.buildcraft.core.network.PacketTileUpdate;

View file

@ -9,8 +9,8 @@
package net.minecraft.src.buildcraft.energy; package net.minecraft.src.buildcraft.energy;
import net.minecraft.src.buildcraft.api.PowerFramework; import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.PowerProvider; import net.minecraft.src.buildcraft.api.power.PowerProvider;
public class PneumaticPowerFramework extends PowerFramework { public class PneumaticPowerFramework extends PowerFramework {

View file

@ -9,7 +9,7 @@
package net.minecraft.src.buildcraft.energy; package net.minecraft.src.buildcraft.energy;
import net.minecraft.src.buildcraft.api.PowerProvider; import net.minecraft.src.buildcraft.api.power.PowerProvider;
public class PneumaticPowerProvider extends PowerProvider { public class PneumaticPowerProvider extends PowerProvider {

View file

@ -23,14 +23,15 @@ import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.ILiquidContainer; import net.minecraft.src.buildcraft.api.ILiquidContainer;
import net.minecraft.src.buildcraft.api.IOverrideDefaultTriggers; import net.minecraft.src.buildcraft.api.IOverrideDefaultTriggers;
import net.minecraft.src.buildcraft.api.IPipeConnection; import net.minecraft.src.buildcraft.api.IPipeConnection;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.LiquidSlot; import net.minecraft.src.buildcraft.api.LiquidSlot;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.Position;
import net.minecraft.src.buildcraft.api.PowerFramework;
import net.minecraft.src.buildcraft.api.PowerProvider;
import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.TileNetworkData;
import net.minecraft.src.buildcraft.api.Trigger; import net.minecraft.src.buildcraft.api.Trigger;
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.IBuilderInventory; import net.minecraft.src.buildcraft.core.IBuilderInventory;
import net.minecraft.src.buildcraft.core.TileBuildCraft; import net.minecraft.src.buildcraft.core.TileBuildCraft;
import net.minecraft.src.buildcraft.core.network.PacketUpdate; import net.minecraft.src.buildcraft.core.network.PacketUpdate;
@ -53,7 +54,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
public int orientation; public int orientation;
PowerProvider provider; IPowerProvider provider;
public boolean isRedstonePowered = false; public boolean isRedstonePowered = false;
@ -117,8 +118,8 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
if (isPoweredTile(tile)) { if (isPoweredTile(tile)) {
IPowerReceptor receptor = (IPowerReceptor) tile; IPowerReceptor receptor = (IPowerReceptor) tile;
int extracted = engine.extractEnergy(receptor.getPowerProvider().minEnergyReceived, int extracted = engine.extractEnergy(receptor.getPowerProvider().getMinEnergyReceived(),
receptor.getPowerProvider().maxEnergyReceived, true); receptor.getPowerProvider().getMaxEnergyReceived(), true);
if (extracted > 0) { if (extracted > 0) {
receptor.getPowerProvider().receiveEnergy(extracted, engine.orientation.reverse()); receptor.getPowerProvider().receiveEnergy(extracted, engine.orientation.reverse());
@ -137,8 +138,8 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
if (isPoweredTile(tile)) { if (isPoweredTile(tile)) {
IPowerReceptor receptor = (IPowerReceptor) tile; IPowerReceptor receptor = (IPowerReceptor) tile;
if (engine.extractEnergy(receptor.getPowerProvider().minEnergyReceived, if (engine.extractEnergy(receptor.getPowerProvider().getMinEnergyReceived(),
receptor.getPowerProvider().maxEnergyReceived, false) > 0) { receptor.getPowerProvider().getMaxEnergyReceived(), false) > 0) {
progressPart = 1; progressPart = 1;
setActive(true); setActive(true);
} else } else
@ -348,12 +349,12 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
this.provider = provider; this.provider = provider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return provider; return provider;
} }
@ -369,7 +370,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
public boolean isPoweredTile(TileEntity tile) { public boolean isPoweredTile(TileEntity tile) {
if (tile instanceof IPowerReceptor) { if (tile instanceof IPowerReceptor) {
IPowerReceptor receptor = (IPowerReceptor) tile; IPowerReceptor receptor = (IPowerReceptor) tile;
PowerProvider provider = receptor.getPowerProvider(); IPowerProvider provider = receptor.getPowerProvider();
return provider != null && provider.getClass().equals(PneumaticPowerProvider.class); return provider != null && provider.getClass().equals(PneumaticPowerProvider.class);
} }

View file

@ -9,7 +9,7 @@
package net.minecraft.src.buildcraft.factory; package net.minecraft.src.buildcraft.factory;
import net.minecraft.src.buildcraft.api.IPowerReceptor; import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.core.IMachine; import net.minecraft.src.buildcraft.core.IMachine;
import net.minecraft.src.buildcraft.core.TileBuildCraft; import net.minecraft.src.buildcraft.core.TileBuildCraft;
@ -18,7 +18,7 @@ public abstract class TileMachine extends TileBuildCraft implements IMachine, IP
@Override @Override
public int powerRequest() { public int powerRequest() {
if (isActive()) { if (isActive()) {
return getPowerProvider().maxEnergyReceived; return getPowerProvider().getMaxEnergyReceived();
} else { } else {
return 0; return 0;
} }

View file

@ -18,10 +18,11 @@ import net.minecraft.src.EntityItem;
import net.minecraft.src.ItemStack; import net.minecraft.src.ItemStack;
import net.minecraft.src.World; import net.minecraft.src.World;
import net.minecraft.src.buildcraft.api.IPipeConnection; import net.minecraft.src.buildcraft.api.IPipeConnection;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.PowerFramework; import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.PowerProvider; import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.IMachine; import net.minecraft.src.buildcraft.core.IMachine;
import net.minecraft.src.buildcraft.core.StackUtil; import net.minecraft.src.buildcraft.core.StackUtil;
import net.minecraft.src.buildcraft.core.Utils; import net.minecraft.src.buildcraft.core.Utils;
@ -30,7 +31,7 @@ public class TileMiningWell extends TileMachine implements IMachine, IPowerRecep
boolean isDigging = true; boolean isDigging = true;
PowerProvider powerProvider; IPowerProvider powerProvider;
public TileMiningWell() { public TileMiningWell() {
powerProvider = PowerFramework.currentFramework.createPowerProvider(); powerProvider = PowerFramework.currentFramework.createPowerProvider();
@ -115,12 +116,12 @@ public class TileMiningWell extends TileMachine implements IMachine, IPowerRecep
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
powerProvider = provider; powerProvider = provider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }

View file

@ -20,14 +20,15 @@ import net.minecraft.src.TileEntity;
import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.BuildCraftAPI; import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.ILiquidContainer; import net.minecraft.src.buildcraft.api.ILiquidContainer;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.Position;
import net.minecraft.src.buildcraft.api.PowerFramework;
import net.minecraft.src.buildcraft.api.PowerProvider;
import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.TileNetworkData;
import net.minecraft.src.buildcraft.api.liquids.ITankContainer; import net.minecraft.src.buildcraft.api.liquids.ITankContainer;
import net.minecraft.src.buildcraft.api.liquids.LiquidStack; import net.minecraft.src.buildcraft.api.liquids.LiquidStack;
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.BlockIndex; import net.minecraft.src.buildcraft.core.BlockIndex;
import net.minecraft.src.buildcraft.core.EntityBlock; import net.minecraft.src.buildcraft.core.EntityBlock;
import net.minecraft.src.buildcraft.core.IMachine; import net.minecraft.src.buildcraft.core.IMachine;
@ -49,7 +50,7 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor {
public @TileNetworkData public @TileNetworkData
int liquidId = 0; int liquidId = 0;
private PowerProvider powerProvider; private IPowerProvider powerProvider;
public TilePump() { public TilePump() {
powerProvider = PowerFramework.currentFramework.createPowerProvider(); powerProvider = PowerFramework.currentFramework.createPowerProvider();
@ -310,12 +311,12 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor {
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
powerProvider = provider; powerProvider = provider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }

View file

@ -24,12 +24,13 @@ import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.BuildCraftAPI; import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.IAreaProvider; import net.minecraft.src.buildcraft.api.IAreaProvider;
import net.minecraft.src.buildcraft.api.IPipeConnection; import net.minecraft.src.buildcraft.api.IPipeConnection;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.LaserKind; import net.minecraft.src.buildcraft.api.LaserKind;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.PowerFramework;
import net.minecraft.src.buildcraft.api.PowerProvider;
import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.TileNetworkData;
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.Box; import net.minecraft.src.buildcraft.core.Box;
import net.minecraft.src.buildcraft.core.BptBlueprint; import net.minecraft.src.buildcraft.core.BptBlueprint;
import net.minecraft.src.buildcraft.core.BptBuilderBase; import net.minecraft.src.buildcraft.core.BptBuilderBase;
@ -67,7 +68,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
BptBuilderBase bluePrintBuilder; BptBuilderBase bluePrintBuilder;
public @TileNetworkData PowerProvider powerProvider; public IPowerProvider powerProvider;
public static int MAX_ENERGY = 7000; public static int MAX_ENERGY = 7000;
@ -149,7 +150,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
if (inProcess && arm != null) { if (inProcess && arm != null) {
arm.speed = 0; arm.speed = 0;
float energyToUse = 2 + powerProvider.energyStored / 1000; float energyToUse = 2 + powerProvider.getEnergyStored() / 1000;
float energy = powerProvider.useEnergy(energyToUse, energyToUse, true); float energy = powerProvider.useEnergy(energyToUse, energyToUse, true);
@ -214,7 +215,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
return; return;
} }
powerProvider.timeTracker.markTime(worldObj); powerProvider.getTimeTracker().markTime(worldObj);
if (builder == null) { if (builder == null) {
builder = new EntityRobot(worldObj, box); builder = new EntityRobot(worldObj, box);
@ -385,7 +386,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
int blockId = worldObj.getBlockId(i, j, k); int blockId = worldObj.getBlockId(i, j, k);
if (canDig(blockId)) { if (canDig(blockId)) {
powerProvider.timeTracker.markTime(worldObj); powerProvider.getTimeTracker().markTime(worldObj);
// Share this with mining well! // Share this with mining well!
@ -615,13 +616,13 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
provider = powerProvider; provider = powerProvider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }

View file

@ -19,17 +19,18 @@ import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.BuildCraftAPI; import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.ILiquidContainer; import net.minecraft.src.buildcraft.api.ILiquidContainer;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.LiquidSlot; import net.minecraft.src.buildcraft.api.LiquidSlot;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.PowerFramework;
import net.minecraft.src.buildcraft.api.PowerProvider;
import net.minecraft.src.buildcraft.api.SafeTimeTracker; import net.minecraft.src.buildcraft.api.SafeTimeTracker;
import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.TileNetworkData;
import net.minecraft.src.buildcraft.api.liquids.ILiquidTank; import net.minecraft.src.buildcraft.api.liquids.ILiquidTank;
import net.minecraft.src.buildcraft.api.liquids.ITankContainer; import net.minecraft.src.buildcraft.api.liquids.ITankContainer;
import net.minecraft.src.buildcraft.api.liquids.LiquidStack; import net.minecraft.src.buildcraft.api.liquids.LiquidStack;
import net.minecraft.src.buildcraft.api.liquids.LiquidTank; import net.minecraft.src.buildcraft.api.liquids.LiquidTank;
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.api.recipes.RefineryRecipe; import net.minecraft.src.buildcraft.api.recipes.RefineryRecipe;
import net.minecraft.src.buildcraft.core.IMachine; import net.minecraft.src.buildcraft.core.IMachine;
@ -98,7 +99,7 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, ITank
SafeTimeTracker updateNetworkTime = new SafeTimeTracker(); SafeTimeTracker updateNetworkTime = new SafeTimeTracker();
PowerProvider powerProvider; IPowerProvider powerProvider;
private boolean isActive; private boolean isActive;
@ -151,12 +152,12 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, ITank
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
powerProvider = provider; powerProvider = provider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }
@ -196,7 +197,7 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, ITank
isActive = true; isActive = true;
if (powerProvider.energyStored >= currentRecipe.energy) { if (powerProvider.getEnergyStored() >= currentRecipe.energy) {
increaseAnimation(); increaseAnimation();
} else { } else {
decreaseAnimation(); decreaseAnimation();

View file

@ -14,13 +14,14 @@ import java.util.LinkedList;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntity;
import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.Position;
import net.minecraft.src.buildcraft.api.PowerFramework;
import net.minecraft.src.buildcraft.api.PowerProvider;
import net.minecraft.src.buildcraft.api.SafeTimeTracker; import net.minecraft.src.buildcraft.api.SafeTimeTracker;
import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.TileNetworkData;
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.BlockIndex; import net.minecraft.src.buildcraft.core.BlockIndex;
import net.minecraft.src.buildcraft.core.EntityEnergyLaser; import net.minecraft.src.buildcraft.core.EntityEnergyLaser;
import net.minecraft.src.buildcraft.core.TileBuildCraft; import net.minecraft.src.buildcraft.core.TileBuildCraft;
@ -36,8 +37,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
private TileAssemblyTable assemblyTable; private TileAssemblyTable assemblyTable;
@TileNetworkData public IPowerProvider powerProvider;
public PowerProvider powerProvider;
private int nextNetworkUpdate = 3; private int nextNetworkUpdate = 3;
private int nextLaserUpdate = 10; private int nextLaserUpdate = 10;
@ -51,7 +51,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
@Override @Override
public void updateEntity() { public void updateEntity() {
if (powerProvider.energyStored == 0) { if (powerProvider.getEnergyStored() == 0) {
removeLaser(); removeLaser();
return; return;
} }
@ -217,13 +217,13 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
powerProvider = provider; powerProvider = provider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }
@ -232,7 +232,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
@Override @Override
public int powerRequest() { public int powerRequest() {
if (powerProvider.energyStored < 200 || laser != null) { if (powerProvider.getEnergyStored() < 200 || laser != null) {
return 25; return 25;
} else { } else {
return 0; return 0;

View file

@ -1,8 +1,8 @@
package net.minecraft.src.buildcraft.transport; package net.minecraft.src.buildcraft.transport;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
public class EnergyPulser { public class EnergyPulser {

View file

@ -12,8 +12,8 @@ import net.minecraft.src.mod_BuildCraftTransport;
import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.Action; import net.minecraft.src.buildcraft.api.Action;
import net.minecraft.src.buildcraft.api.IPipe; import net.minecraft.src.buildcraft.api.IPipe;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.Trigger; import net.minecraft.src.buildcraft.api.Trigger;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.core.DefaultProps; import net.minecraft.src.buildcraft.core.DefaultProps;
import net.minecraft.src.buildcraft.core.GuiIds; import net.minecraft.src.buildcraft.core.GuiIds;
import net.minecraft.src.buildcraft.core.Utils; import net.minecraft.src.buildcraft.core.Utils;

View file

@ -14,11 +14,11 @@ import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntity;
import net.minecraft.src.mod_BuildCraftCore; import net.minecraft.src.mod_BuildCraftCore;
import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.SafeTimeTracker; import net.minecraft.src.buildcraft.api.SafeTimeTracker;
import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.TileNetworkData;
import net.minecraft.src.buildcraft.api.Trigger; import net.minecraft.src.buildcraft.api.Trigger;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.core.CoreProxy; import net.minecraft.src.buildcraft.core.CoreProxy;
import net.minecraft.src.buildcraft.core.DefaultProps; import net.minecraft.src.buildcraft.core.DefaultProps;
import net.minecraft.src.buildcraft.core.IMachine; import net.minecraft.src.buildcraft.core.IMachine;

View file

@ -27,15 +27,16 @@ import net.minecraft.src.buildcraft.api.IPipe;
import net.minecraft.src.buildcraft.api.IPipeConnection; import net.minecraft.src.buildcraft.api.IPipeConnection;
import net.minecraft.src.buildcraft.api.IPipeEntry; import net.minecraft.src.buildcraft.api.IPipeEntry;
import net.minecraft.src.buildcraft.api.IPipeTile; import net.minecraft.src.buildcraft.api.IPipeTile;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.ISpecialInventory; import net.minecraft.src.buildcraft.api.ISpecialInventory;
import net.minecraft.src.buildcraft.api.LiquidSlot; import net.minecraft.src.buildcraft.api.LiquidSlot;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.Position;
import net.minecraft.src.buildcraft.api.PowerProvider;
import net.minecraft.src.buildcraft.api.SafeTimeTracker; import net.minecraft.src.buildcraft.api.SafeTimeTracker;
import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.TileNetworkData;
import net.minecraft.src.buildcraft.api.Trigger; import net.minecraft.src.buildcraft.api.Trigger;
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.CoreProxy; import net.minecraft.src.buildcraft.core.CoreProxy;
import net.minecraft.src.buildcraft.core.DefaultProps; import net.minecraft.src.buildcraft.core.DefaultProps;
import net.minecraft.src.buildcraft.core.IDropControlInventory; import net.minecraft.src.buildcraft.core.IDropControlInventory;
@ -137,7 +138,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
blockNeighborChange = false; blockNeighborChange = false;
} }
PowerProvider provider = getPowerProvider(); IPowerProvider provider = getPowerProvider();
if (provider != null) if (provider != null)
provider.update(this); provider.update(this);
@ -199,14 +200,14 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
if (BlockGenericPipe.isValid(pipe) && pipe instanceof IPowerReceptor) if (BlockGenericPipe.isValid(pipe) && pipe instanceof IPowerReceptor)
((IPowerReceptor) pipe).setPowerProvider(provider); ((IPowerReceptor) pipe).setPowerProvider(provider);
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
if (BlockGenericPipe.isValid(pipe) && pipe instanceof IPowerReceptor) if (BlockGenericPipe.isValid(pipe) && pipe instanceof IPowerReceptor)
return ((IPowerReceptor) pipe).getPowerProvider(); return ((IPowerReceptor) pipe).getPowerProvider();
else else
@ -322,7 +323,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
@Override @Override
public int powerRequest() { public int powerRequest() {
return getPowerProvider().maxEnergyReceived; return getPowerProvider().getMaxEnergyReceived();
} }
@Override @Override

View file

@ -20,11 +20,12 @@ import net.minecraft.src.Item;
import net.minecraft.src.ItemStack; import net.minecraft.src.ItemStack;
import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.APIProxy;
import net.minecraft.src.buildcraft.api.EntityPassiveItem; import net.minecraft.src.buildcraft.api.EntityPassiveItem;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.Position;
import net.minecraft.src.buildcraft.api.PowerFramework; import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.PowerProvider; import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.Utils; import net.minecraft.src.buildcraft.core.Utils;
import net.minecraft.src.buildcraft.transport.Pipe; import net.minecraft.src.buildcraft.transport.Pipe;
import net.minecraft.src.buildcraft.transport.PipeLogicObsidian; import net.minecraft.src.buildcraft.transport.PipeLogicObsidian;
@ -33,7 +34,7 @@ import net.minecraft.src.buildcraft.transport.TransportProxy;
public class PipeItemsObsidian extends Pipe implements IPowerReceptor { public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
private PowerProvider powerProvider; private IPowerProvider powerProvider;
private int[] entitiesDropped; private int[] entitiesDropped;
private int entitiesDroppedIndex = 0; private int entitiesDroppedIndex = 0;
@ -268,17 +269,17 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
powerProvider = provider; powerProvider = provider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }
@Override @Override
public int powerRequest() { public int powerRequest() {
return getPowerProvider().maxEnergyReceived; return getPowerProvider().getMaxEnergyReceived();
} }
} }

View file

@ -17,11 +17,12 @@ import net.minecraft.src.ItemStack;
import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntity;
import net.minecraft.src.buildcraft.api.BuildCraftAPI; import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.EntityPassiveItem; import net.minecraft.src.buildcraft.api.EntityPassiveItem;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.Position;
import net.minecraft.src.buildcraft.api.PowerFramework; import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.PowerProvider; import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.Utils; import net.minecraft.src.buildcraft.core.Utils;
import net.minecraft.src.buildcraft.transport.BlockGenericPipe; import net.minecraft.src.buildcraft.transport.BlockGenericPipe;
import net.minecraft.src.buildcraft.transport.EntityData; import net.minecraft.src.buildcraft.transport.EntityData;
@ -33,7 +34,7 @@ import net.minecraft.src.buildcraft.transport.PipeTransportItems;
public class PipeItemsStripes extends Pipe implements IItemTravelingHook, IPowerReceptor { public class PipeItemsStripes extends Pipe implements IItemTravelingHook, IPowerReceptor {
private PowerProvider powerProvider; private IPowerProvider powerProvider;
public PipeItemsStripes(int itemID) { public PipeItemsStripes(int itemID) {
super(new PipeTransportItems(), new PipeLogicStripes(), itemID); super(new PipeTransportItems(), new PipeLogicStripes(), itemID);
@ -125,18 +126,18 @@ public class PipeItemsStripes extends Pipe implements IItemTravelingHook, IPower
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
powerProvider = provider; powerProvider = provider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }
@Override @Override
public int powerRequest() { public int powerRequest() {
return getPowerProvider().maxEnergyReceived; return getPowerProvider().getMaxEnergyReceived();
} }
@Override @Override

View file

@ -15,12 +15,13 @@ import net.minecraft.src.TileEntity;
import net.minecraft.src.World; import net.minecraft.src.World;
import net.minecraft.src.buildcraft.api.EntityPassiveItem; import net.minecraft.src.buildcraft.api.EntityPassiveItem;
import net.minecraft.src.buildcraft.api.ILiquidContainer; import net.minecraft.src.buildcraft.api.ILiquidContainer;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.ISpecialInventory; import net.minecraft.src.buildcraft.api.ISpecialInventory;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.Position;
import net.minecraft.src.buildcraft.api.PowerFramework; import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.PowerProvider; import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.Utils; import net.minecraft.src.buildcraft.core.Utils;
import net.minecraft.src.buildcraft.transport.Pipe; import net.minecraft.src.buildcraft.transport.Pipe;
import net.minecraft.src.buildcraft.transport.PipeLogicWood; import net.minecraft.src.buildcraft.transport.PipeLogicWood;
@ -29,7 +30,7 @@ import net.minecraft.src.forge.ISidedInventory;
public class PipeItemsWood extends Pipe implements IPowerReceptor { public class PipeItemsWood extends Pipe implements IPowerReceptor {
private PowerProvider powerProvider; private IPowerProvider powerProvider;
private int baseTexture = 1 * 16 + 0; private int baseTexture = 1 * 16 + 0;
private int plainTexture = 1 * 16 + 15; private int plainTexture = 1 * 16 + 15;
@ -68,18 +69,18 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
provider = powerProvider; provider = powerProvider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }
@Override @Override
public void doWork() { public void doWork() {
if (powerProvider.energyStored <= 0) if (powerProvider.getEnergyStored() <= 0)
return; return;
World w = worldObj; World w = worldObj;
@ -208,7 +209,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
@Override @Override
public int powerRequest() { public int powerRequest() {
return getPowerProvider().maxEnergyReceived; return getPowerProvider().getMaxEnergyReceived();
} }
} }

View file

@ -13,12 +13,13 @@ import net.minecraft.src.TileEntity;
import net.minecraft.src.World; import net.minecraft.src.World;
import net.minecraft.src.buildcraft.api.BuildCraftAPI; import net.minecraft.src.buildcraft.api.BuildCraftAPI;
import net.minecraft.src.buildcraft.api.ILiquidContainer; import net.minecraft.src.buildcraft.api.ILiquidContainer;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.Position;
import net.minecraft.src.buildcraft.api.PowerFramework;
import net.minecraft.src.buildcraft.api.PowerProvider;
import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.TileNetworkData;
import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.transport.Pipe; import net.minecraft.src.buildcraft.transport.Pipe;
import net.minecraft.src.buildcraft.transport.PipeLogicWood; import net.minecraft.src.buildcraft.transport.PipeLogicWood;
import net.minecraft.src.buildcraft.transport.PipeTransportLiquids; import net.minecraft.src.buildcraft.transport.PipeTransportLiquids;
@ -28,7 +29,7 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
public @TileNetworkData public @TileNetworkData
int liquidToExtract; int liquidToExtract;
private PowerProvider powerProvider; private IPowerProvider powerProvider;
private int baseTexture = 7 * 16 + 0; private int baseTexture = 7 * 16 + 0;
private int plainTexture = 1 * 16 + 15; private int plainTexture = 1 * 16 + 15;
private int nextTexture = baseTexture; private int nextTexture = baseTexture;
@ -49,7 +50,7 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
*/ */
@Override @Override
public void doWork() { public void doWork() {
if (powerProvider.energyStored <= 0) if (powerProvider.getEnergyStored() <= 0)
return; return;
World w = worldObj; World w = worldObj;
@ -74,12 +75,12 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
powerProvider = provider; powerProvider = provider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }
@ -132,6 +133,6 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
@Override @Override
public int powerRequest() { public int powerRequest() {
return getPowerProvider().maxEnergyReceived; return getPowerProvider().getMaxEnergyReceived();
} }
} }

View file

@ -9,10 +9,11 @@
package net.minecraft.src.buildcraft.transport.pipes; package net.minecraft.src.buildcraft.transport.pipes;
import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntity;
import net.minecraft.src.buildcraft.api.IPowerReceptor;
import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Orientations;
import net.minecraft.src.buildcraft.api.PowerFramework; import net.minecraft.src.buildcraft.api.power.IPowerProvider;
import net.minecraft.src.buildcraft.api.PowerProvider; import net.minecraft.src.buildcraft.api.power.IPowerReceptor;
import net.minecraft.src.buildcraft.api.power.PowerFramework;
import net.minecraft.src.buildcraft.api.power.PowerProvider;
import net.minecraft.src.buildcraft.core.Utils; import net.minecraft.src.buildcraft.core.Utils;
import net.minecraft.src.buildcraft.transport.Pipe; import net.minecraft.src.buildcraft.transport.Pipe;
import net.minecraft.src.buildcraft.transport.PipeLogicWood; import net.minecraft.src.buildcraft.transport.PipeLogicWood;
@ -21,7 +22,7 @@ import net.minecraft.src.buildcraft.transport.TileGenericPipe;
public class PipePowerWood extends Pipe implements IPowerReceptor { public class PipePowerWood extends Pipe implements IPowerReceptor {
private PowerProvider powerProvider; private IPowerProvider powerProvider;
private int baseTexture = 7 * 16 + 6; private int baseTexture = 7 * 16 + 6;
private int plainTexture = 1 * 16 + 15; private int plainTexture = 1 * 16 + 15;
@ -41,12 +42,12 @@ public class PipePowerWood extends Pipe implements IPowerReceptor {
} }
@Override @Override
public void setPowerProvider(PowerProvider provider) { public void setPowerProvider(IPowerProvider provider) {
provider = powerProvider; provider = powerProvider;
} }
@Override @Override
public PowerProvider getPowerProvider() { public IPowerProvider getPowerProvider() {
return powerProvider; return powerProvider;
} }
@ -74,10 +75,10 @@ public class PipePowerWood extends Pipe implements IPowerReceptor {
float energyToRemove = 0; float energyToRemove = 0;
if (powerProvider.energyStored > 40) if (powerProvider.getEnergyStored() > 40)
energyToRemove = powerProvider.energyStored / 40 + 4; energyToRemove = powerProvider.getEnergyStored() / 40 + 4;
else if (powerProvider.energyStored > 10) else if (powerProvider.getEnergyStored() > 10)
energyToRemove = powerProvider.energyStored / 10; energyToRemove = powerProvider.getEnergyStored() / 10;
else else
energyToRemove = 1; energyToRemove = 1;
@ -107,7 +108,7 @@ public class PipePowerWood extends Pipe implements IPowerReceptor {
@Override @Override
public int powerRequest() { public int powerRequest() {
return getPowerProvider().maxEnergyReceived; return getPowerProvider().getMaxEnergyReceived();
} }
} }