diff --git a/common/net/minecraft/src/BuildCraftCore.java b/common/net/minecraft/src/BuildCraftCore.java index 83b1b82b..b14ea669 100644 --- a/common/net/minecraft/src/BuildCraftCore.java +++ b/common/net/minecraft/src/BuildCraftCore.java @@ -13,11 +13,11 @@ import java.util.TreeMap; import net.minecraft.src.buildcraft.api.Action; 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.liquids.LiquidData; import net.minecraft.src.buildcraft.api.liquids.LiquidManager; 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.Mode; import net.minecraft.src.buildcraft.core.ActionRedstoneOutput; diff --git a/common/net/minecraft/src/buildcraft/api/IPowerReceptor.java b/common/net/minecraft/src/buildcraft/api/IPowerReceptor.java index 1c2bfb71..98c5c51b 100644 --- a/common/net/minecraft/src/buildcraft/api/IPowerReceptor.java +++ b/common/net/minecraft/src/buildcraft/api/IPowerReceptor.java @@ -9,6 +9,7 @@ package net.minecraft.src.buildcraft.api; +@Deprecated public interface IPowerReceptor { public void setPowerProvider(PowerProvider provider); diff --git a/common/net/minecraft/src/buildcraft/api/PowerFramework.java b/common/net/minecraft/src/buildcraft/api/PowerFramework.java index 68b51d1e..44c448f1 100644 --- a/common/net/minecraft/src/buildcraft/api/PowerFramework.java +++ b/common/net/minecraft/src/buildcraft/api/PowerFramework.java @@ -11,6 +11,7 @@ package net.minecraft.src.buildcraft.api; import net.minecraft.src.NBTTagCompound; +@Deprecated public abstract class PowerFramework { static private String baseNBTName = "net.minecraft.src.buildcarft.Power"; diff --git a/common/net/minecraft/src/buildcraft/api/PowerProvider.java b/common/net/minecraft/src/buildcraft/api/PowerProvider.java index fa1686ef..5f089d31 100644 --- a/common/net/minecraft/src/buildcraft/api/PowerProvider.java +++ b/common/net/minecraft/src/buildcraft/api/PowerProvider.java @@ -11,7 +11,11 @@ package net.minecraft.src.buildcraft.api; import net.minecraft.src.NBTTagCompound; 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 int latency; diff --git a/common/net/minecraft/src/buildcraft/api/power/IPowerProvider.java b/common/net/minecraft/src/buildcraft/api/power/IPowerProvider.java new file mode 100644 index 00000000..642b48b0 --- /dev/null +++ b/common/net/minecraft/src/buildcraft/api/power/IPowerProvider.java @@ -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(); + +} diff --git a/common/net/minecraft/src/buildcraft/api/power/IPowerReceptor.java b/common/net/minecraft/src/buildcraft/api/power/IPowerReceptor.java new file mode 100644 index 00000000..397b4703 --- /dev/null +++ b/common/net/minecraft/src/buildcraft/api/power/IPowerReceptor.java @@ -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(); + +} diff --git a/common/net/minecraft/src/buildcraft/api/power/PowerFramework.java b/common/net/minecraft/src/buildcraft/api/power/PowerFramework.java new file mode 100644 index 00000000..d7475fef --- /dev/null +++ b/common/net/minecraft/src/buildcraft/api/power/PowerFramework.java @@ -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); + } + +} diff --git a/common/net/minecraft/src/buildcraft/api/power/PowerProvider.java b/common/net/minecraft/src/buildcraft/api/power/PowerProvider.java new file mode 100644 index 00000000..e98fa357 --- /dev/null +++ b/common/net/minecraft/src/buildcraft/api/power/PowerProvider.java @@ -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; + } +} diff --git a/common/net/minecraft/src/buildcraft/builders/TileBuilder.java b/common/net/minecraft/src/buildcraft/builders/TileBuilder.java index c7123d54..a27e9d2a 100644 --- a/common/net/minecraft/src/buildcraft/builders/TileBuilder.java +++ b/common/net/minecraft/src/buildcraft/builders/TileBuilder.java @@ -21,13 +21,14 @@ import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagList; import net.minecraft.src.TileEntity; 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.Orientations; 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.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.Box; import net.minecraft.src.buildcraft.core.BptBase; @@ -55,7 +56,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP public @TileNetworkData Box box = new Box(); - private PowerProvider powerProvider; + private IPowerProvider powerProvider; private LinkedList path; @@ -526,12 +527,12 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { powerProvider = provider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } @@ -570,7 +571,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP @Override public int powerRequest() { if ((bluePrintBuilder != null || currentPathIterator != null) && !done) { - return powerProvider.maxEnergyReceived; + return powerProvider.getMaxEnergyReceived(); } else { return 0; } diff --git a/common/net/minecraft/src/buildcraft/builders/TileFiller.java b/common/net/minecraft/src/buildcraft/builders/TileFiller.java index 0023b694..a8189138 100644 --- a/common/net/minecraft/src/buildcraft/builders/TileFiller.java +++ b/common/net/minecraft/src/buildcraft/builders/TileFiller.java @@ -17,15 +17,16 @@ import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.Action; import net.minecraft.src.buildcraft.api.IActionReceptor; 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.LaserKind; 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.filler.FillerManager; 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.Mode; import net.minecraft.src.buildcraft.core.Box; @@ -48,7 +49,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo boolean forceDone = false; private ItemStack contents[]; - PowerProvider powerProvider; + IPowerProvider powerProvider; 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(); } } @@ -140,7 +141,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo } } - if (powerProvider.energyStored > 25) { + if (powerProvider.getEnergyStored() > 25) { doWork(); } } @@ -394,12 +395,12 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { powerProvider = provider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } @@ -431,7 +432,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo @Override public int powerRequest() { if (isActive()) { - return powerProvider.maxEnergyReceived; + return powerProvider.getMaxEnergyReceived(); } else { return 0; } diff --git a/common/net/minecraft/src/buildcraft/core/RedstonePowerFramework.java b/common/net/minecraft/src/buildcraft/core/RedstonePowerFramework.java index 64bd74e5..117de6e8 100644 --- a/common/net/minecraft/src/buildcraft/core/RedstonePowerFramework.java +++ b/common/net/minecraft/src/buildcraft/core/RedstonePowerFramework.java @@ -9,13 +9,14 @@ package net.minecraft.src.buildcraft.core; -import net.minecraft.src.buildcraft.api.PowerFramework; -import net.minecraft.src.buildcraft.api.PowerProvider; +import net.minecraft.src.buildcraft.api.power.IPowerProvider; +import net.minecraft.src.buildcraft.api.power.PowerFramework; +import net.minecraft.src.buildcraft.api.power.PowerProvider; public class RedstonePowerFramework extends PowerFramework { @Override - public PowerProvider createPowerProvider() { + public IPowerProvider createPowerProvider() { return new RedstonePowerProvider(); } diff --git a/common/net/minecraft/src/buildcraft/core/RedstonePowerProvider.java b/common/net/minecraft/src/buildcraft/core/RedstonePowerProvider.java index 9aae69a4..d6c8e87c 100644 --- a/common/net/minecraft/src/buildcraft/core/RedstonePowerProvider.java +++ b/common/net/minecraft/src/buildcraft/core/RedstonePowerProvider.java @@ -12,8 +12,8 @@ package net.minecraft.src.buildcraft.core; import net.minecraft.src.BuildCraftCore; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.TileEntity; -import net.minecraft.src.buildcraft.api.IPowerReceptor; -import net.minecraft.src.buildcraft.api.PowerProvider; +import net.minecraft.src.buildcraft.api.power.IPowerReceptor; +import net.minecraft.src.buildcraft.api.power.PowerProvider; public class RedstonePowerProvider extends PowerProvider { diff --git a/common/net/minecraft/src/buildcraft/core/TileBuildCraft.java b/common/net/minecraft/src/buildcraft/core/TileBuildCraft.java index 387abbe0..1716ae9a 100644 --- a/common/net/minecraft/src/buildcraft/core/TileBuildCraft.java +++ b/common/net/minecraft/src/buildcraft/core/TileBuildCraft.java @@ -15,7 +15,7 @@ import java.util.Map; import net.minecraft.src.Packet; import net.minecraft.src.TileEntity; 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.PacketPayload; import net.minecraft.src.buildcraft.core.network.PacketTileUpdate; diff --git a/common/net/minecraft/src/buildcraft/energy/PneumaticPowerFramework.java b/common/net/minecraft/src/buildcraft/energy/PneumaticPowerFramework.java index f5fde3ab..9fdb20c1 100644 --- a/common/net/minecraft/src/buildcraft/energy/PneumaticPowerFramework.java +++ b/common/net/minecraft/src/buildcraft/energy/PneumaticPowerFramework.java @@ -9,8 +9,8 @@ package net.minecraft.src.buildcraft.energy; -import net.minecraft.src.buildcraft.api.PowerFramework; -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 PneumaticPowerFramework extends PowerFramework { diff --git a/common/net/minecraft/src/buildcraft/energy/PneumaticPowerProvider.java b/common/net/minecraft/src/buildcraft/energy/PneumaticPowerProvider.java index bab8fead..d9d4b5a2 100644 --- a/common/net/minecraft/src/buildcraft/energy/PneumaticPowerProvider.java +++ b/common/net/minecraft/src/buildcraft/energy/PneumaticPowerProvider.java @@ -9,7 +9,7 @@ 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 { diff --git a/common/net/minecraft/src/buildcraft/energy/TileEngine.java b/common/net/minecraft/src/buildcraft/energy/TileEngine.java index ff378d61..ec179383 100644 --- a/common/net/minecraft/src/buildcraft/energy/TileEngine.java +++ b/common/net/minecraft/src/buildcraft/energy/TileEngine.java @@ -23,14 +23,15 @@ import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.ILiquidContainer; import net.minecraft.src.buildcraft.api.IOverrideDefaultTriggers; 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.Orientations; 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.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.TileBuildCraft; import net.minecraft.src.buildcraft.core.network.PacketUpdate; @@ -53,7 +54,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven public int orientation; - PowerProvider provider; + IPowerProvider provider; public boolean isRedstonePowered = false; @@ -117,8 +118,8 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven if (isPoweredTile(tile)) { IPowerReceptor receptor = (IPowerReceptor) tile; - int extracted = engine.extractEnergy(receptor.getPowerProvider().minEnergyReceived, - receptor.getPowerProvider().maxEnergyReceived, true); + int extracted = engine.extractEnergy(receptor.getPowerProvider().getMinEnergyReceived(), + receptor.getPowerProvider().getMaxEnergyReceived(), true); if (extracted > 0) { receptor.getPowerProvider().receiveEnergy(extracted, engine.orientation.reverse()); @@ -137,8 +138,8 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven if (isPoweredTile(tile)) { IPowerReceptor receptor = (IPowerReceptor) tile; - if (engine.extractEnergy(receptor.getPowerProvider().minEnergyReceived, - receptor.getPowerProvider().maxEnergyReceived, false) > 0) { + if (engine.extractEnergy(receptor.getPowerProvider().getMinEnergyReceived(), + receptor.getPowerProvider().getMaxEnergyReceived(), false) > 0) { progressPart = 1; setActive(true); } else @@ -348,12 +349,12 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { this.provider = provider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return provider; } @@ -369,7 +370,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven public boolean isPoweredTile(TileEntity tile) { if (tile instanceof IPowerReceptor) { IPowerReceptor receptor = (IPowerReceptor) tile; - PowerProvider provider = receptor.getPowerProvider(); + IPowerProvider provider = receptor.getPowerProvider(); return provider != null && provider.getClass().equals(PneumaticPowerProvider.class); } diff --git a/common/net/minecraft/src/buildcraft/factory/TileMachine.java b/common/net/minecraft/src/buildcraft/factory/TileMachine.java index 8ec2c64b..e85d8452 100644 --- a/common/net/minecraft/src/buildcraft/factory/TileMachine.java +++ b/common/net/minecraft/src/buildcraft/factory/TileMachine.java @@ -9,7 +9,7 @@ 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.TileBuildCraft; @@ -18,7 +18,7 @@ public abstract class TileMachine extends TileBuildCraft implements IMachine, IP @Override public int powerRequest() { if (isActive()) { - return getPowerProvider().maxEnergyReceived; + return getPowerProvider().getMaxEnergyReceived(); } else { return 0; } diff --git a/common/net/minecraft/src/buildcraft/factory/TileMiningWell.java b/common/net/minecraft/src/buildcraft/factory/TileMiningWell.java index 57a57b53..4169c0e3 100644 --- a/common/net/minecraft/src/buildcraft/factory/TileMiningWell.java +++ b/common/net/minecraft/src/buildcraft/factory/TileMiningWell.java @@ -18,10 +18,11 @@ import net.minecraft.src.EntityItem; import net.minecraft.src.ItemStack; import net.minecraft.src.World; 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.PowerFramework; -import net.minecraft.src.buildcraft.api.PowerProvider; +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.IMachine; import net.minecraft.src.buildcraft.core.StackUtil; import net.minecraft.src.buildcraft.core.Utils; @@ -30,7 +31,7 @@ public class TileMiningWell extends TileMachine implements IMachine, IPowerRecep boolean isDigging = true; - PowerProvider powerProvider; + IPowerProvider powerProvider; public TileMiningWell() { powerProvider = PowerFramework.currentFramework.createPowerProvider(); @@ -115,12 +116,12 @@ public class TileMiningWell extends TileMachine implements IMachine, IPowerRecep } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { powerProvider = provider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } diff --git a/common/net/minecraft/src/buildcraft/factory/TilePump.java b/common/net/minecraft/src/buildcraft/factory/TilePump.java index c5a9da4b..9525cde3 100644 --- a/common/net/minecraft/src/buildcraft/factory/TilePump.java +++ b/common/net/minecraft/src/buildcraft/factory/TilePump.java @@ -20,14 +20,15 @@ import net.minecraft.src.TileEntity; import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.BuildCraftAPI; 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.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.liquids.ITankContainer; 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.EntityBlock; import net.minecraft.src.buildcraft.core.IMachine; @@ -49,7 +50,7 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor { public @TileNetworkData int liquidId = 0; - private PowerProvider powerProvider; + private IPowerProvider powerProvider; public TilePump() { powerProvider = PowerFramework.currentFramework.createPowerProvider(); @@ -310,12 +311,12 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor { } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { powerProvider = provider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } diff --git a/common/net/minecraft/src/buildcraft/factory/TileQuarry.java b/common/net/minecraft/src/buildcraft/factory/TileQuarry.java index 4e934f05..16c8bd44 100644 --- a/common/net/minecraft/src/buildcraft/factory/TileQuarry.java +++ b/common/net/minecraft/src/buildcraft/factory/TileQuarry.java @@ -24,12 +24,13 @@ import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.BuildCraftAPI; import net.minecraft.src.buildcraft.api.IAreaProvider; 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.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.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.BptBlueprint; import net.minecraft.src.buildcraft.core.BptBuilderBase; @@ -67,7 +68,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I BptBuilderBase bluePrintBuilder; - public @TileNetworkData PowerProvider powerProvider; + public IPowerProvider powerProvider; public static int MAX_ENERGY = 7000; @@ -149,7 +150,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I if (inProcess && arm != null) { arm.speed = 0; - float energyToUse = 2 + powerProvider.energyStored / 1000; + float energyToUse = 2 + powerProvider.getEnergyStored() / 1000; float energy = powerProvider.useEnergy(energyToUse, energyToUse, true); @@ -214,7 +215,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I return; } - powerProvider.timeTracker.markTime(worldObj); + powerProvider.getTimeTracker().markTime(worldObj); if (builder == null) { 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); if (canDig(blockId)) { - powerProvider.timeTracker.markTime(worldObj); + powerProvider.getTimeTracker().markTime(worldObj); // Share this with mining well! @@ -615,13 +616,13 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { provider = powerProvider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } diff --git a/common/net/minecraft/src/buildcraft/factory/TileRefinery.java b/common/net/minecraft/src/buildcraft/factory/TileRefinery.java index b59becfa..7bd58603 100644 --- a/common/net/minecraft/src/buildcraft/factory/TileRefinery.java +++ b/common/net/minecraft/src/buildcraft/factory/TileRefinery.java @@ -19,17 +19,18 @@ import net.minecraft.src.NBTTagCompound; import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.BuildCraftAPI; 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.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.TileNetworkData; import net.minecraft.src.buildcraft.api.liquids.ILiquidTank; import net.minecraft.src.buildcraft.api.liquids.ITankContainer; import net.minecraft.src.buildcraft.api.liquids.LiquidStack; 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.core.IMachine; @@ -98,7 +99,7 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, ITank SafeTimeTracker updateNetworkTime = new SafeTimeTracker(); - PowerProvider powerProvider; + IPowerProvider powerProvider; private boolean isActive; @@ -151,12 +152,12 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, ITank } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { powerProvider = provider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } @@ -196,7 +197,7 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, ITank isActive = true; - if (powerProvider.energyStored >= currentRecipe.energy) { + if (powerProvider.getEnergyStored() >= currentRecipe.energy) { increaseAnimation(); } else { decreaseAnimation(); diff --git a/common/net/minecraft/src/buildcraft/silicon/TileLaser.java b/common/net/minecraft/src/buildcraft/silicon/TileLaser.java index 3a24d8ee..1074719e 100644 --- a/common/net/minecraft/src/buildcraft/silicon/TileLaser.java +++ b/common/net/minecraft/src/buildcraft/silicon/TileLaser.java @@ -14,13 +14,14 @@ import java.util.LinkedList; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.TileEntity; 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.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.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.EntityEnergyLaser; import net.minecraft.src.buildcraft.core.TileBuildCraft; @@ -36,8 +37,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor { private TileAssemblyTable assemblyTable; - @TileNetworkData - public PowerProvider powerProvider; + public IPowerProvider powerProvider; private int nextNetworkUpdate = 3; private int nextLaserUpdate = 10; @@ -51,7 +51,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor { @Override public void updateEntity() { - if (powerProvider.energyStored == 0) { + if (powerProvider.getEnergyStored() == 0) { removeLaser(); return; } @@ -217,13 +217,13 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor { } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { powerProvider = provider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } @@ -232,7 +232,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor { @Override public int powerRequest() { - if (powerProvider.energyStored < 200 || laser != null) { + if (powerProvider.getEnergyStored() < 200 || laser != null) { return 25; } else { return 0; diff --git a/common/net/minecraft/src/buildcraft/transport/EnergyPulser.java b/common/net/minecraft/src/buildcraft/transport/EnergyPulser.java index a2265166..e1ab5ae0 100644 --- a/common/net/minecraft/src/buildcraft/transport/EnergyPulser.java +++ b/common/net/minecraft/src/buildcraft/transport/EnergyPulser.java @@ -1,8 +1,8 @@ package net.minecraft.src.buildcraft.transport; 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.power.IPowerReceptor; public class EnergyPulser { diff --git a/common/net/minecraft/src/buildcraft/transport/GateVanilla.java b/common/net/minecraft/src/buildcraft/transport/GateVanilla.java index 79f794e2..f28a962f 100644 --- a/common/net/minecraft/src/buildcraft/transport/GateVanilla.java +++ b/common/net/minecraft/src/buildcraft/transport/GateVanilla.java @@ -12,8 +12,8 @@ import net.minecraft.src.mod_BuildCraftTransport; import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.Action; 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.power.IPowerReceptor; import net.minecraft.src.buildcraft.core.DefaultProps; import net.minecraft.src.buildcraft.core.GuiIds; import net.minecraft.src.buildcraft.core.Utils; diff --git a/common/net/minecraft/src/buildcraft/transport/PipeTransportPower.java b/common/net/minecraft/src/buildcraft/transport/PipeTransportPower.java index 3b290093..44e3d102 100644 --- a/common/net/minecraft/src/buildcraft/transport/PipeTransportPower.java +++ b/common/net/minecraft/src/buildcraft/transport/PipeTransportPower.java @@ -14,11 +14,11 @@ import net.minecraft.src.NBTTagCompound; import net.minecraft.src.TileEntity; import net.minecraft.src.mod_BuildCraftCore; 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.SafeTimeTracker; import net.minecraft.src.buildcraft.api.TileNetworkData; 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.DefaultProps; import net.minecraft.src.buildcraft.core.IMachine; diff --git a/common/net/minecraft/src/buildcraft/transport/TileGenericPipe.java b/common/net/minecraft/src/buildcraft/transport/TileGenericPipe.java index 2ade64d0..1e785e65 100644 --- a/common/net/minecraft/src/buildcraft/transport/TileGenericPipe.java +++ b/common/net/minecraft/src/buildcraft/transport/TileGenericPipe.java @@ -27,15 +27,16 @@ import net.minecraft.src.buildcraft.api.IPipe; import net.minecraft.src.buildcraft.api.IPipeConnection; import net.minecraft.src.buildcraft.api.IPipeEntry; 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.LiquidSlot; import net.minecraft.src.buildcraft.api.Orientations; 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.TileNetworkData; 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.DefaultProps; import net.minecraft.src.buildcraft.core.IDropControlInventory; @@ -137,7 +138,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu blockNeighborChange = false; } - PowerProvider provider = getPowerProvider(); + IPowerProvider provider = getPowerProvider(); if (provider != null) provider.update(this); @@ -199,14 +200,14 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { if (BlockGenericPipe.isValid(pipe) && pipe instanceof IPowerReceptor) ((IPowerReceptor) pipe).setPowerProvider(provider); } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { if (BlockGenericPipe.isValid(pipe) && pipe instanceof IPowerReceptor) return ((IPowerReceptor) pipe).getPowerProvider(); else @@ -322,7 +323,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu @Override public int powerRequest() { - return getPowerProvider().maxEnergyReceived; + return getPowerProvider().getMaxEnergyReceived(); } @Override diff --git a/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsObsidian.java b/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsObsidian.java index e545d2ec..76fa8ea7 100644 --- a/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsObsidian.java +++ b/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsObsidian.java @@ -20,11 +20,12 @@ import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraft.src.buildcraft.api.APIProxy; 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.Position; -import net.minecraft.src.buildcraft.api.PowerFramework; -import net.minecraft.src.buildcraft.api.PowerProvider; +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.Utils; import net.minecraft.src.buildcraft.transport.Pipe; 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 { - private PowerProvider powerProvider; + private IPowerProvider powerProvider; private int[] entitiesDropped; private int entitiesDroppedIndex = 0; @@ -268,17 +269,17 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor { } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { powerProvider = provider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } @Override public int powerRequest() { - return getPowerProvider().maxEnergyReceived; + return getPowerProvider().getMaxEnergyReceived(); } } diff --git a/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsStripes.java b/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsStripes.java index 1a72e376..e4c791c5 100644 --- a/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsStripes.java +++ b/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsStripes.java @@ -17,11 +17,12 @@ import net.minecraft.src.ItemStack; import net.minecraft.src.TileEntity; import net.minecraft.src.buildcraft.api.BuildCraftAPI; 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.Position; -import net.minecraft.src.buildcraft.api.PowerFramework; -import net.minecraft.src.buildcraft.api.PowerProvider; +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.Utils; import net.minecraft.src.buildcraft.transport.BlockGenericPipe; 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 { - private PowerProvider powerProvider; + private IPowerProvider powerProvider; public PipeItemsStripes(int itemID) { super(new PipeTransportItems(), new PipeLogicStripes(), itemID); @@ -125,18 +126,18 @@ public class PipeItemsStripes extends Pipe implements IItemTravelingHook, IPower } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { powerProvider = provider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } @Override public int powerRequest() { - return getPowerProvider().maxEnergyReceived; + return getPowerProvider().getMaxEnergyReceived(); } @Override diff --git a/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java b/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java index fe9928ca..080c9700 100644 --- a/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java +++ b/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java @@ -15,12 +15,13 @@ import net.minecraft.src.TileEntity; import net.minecraft.src.World; import net.minecraft.src.buildcraft.api.EntityPassiveItem; 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.Orientations; 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.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.Utils; import net.minecraft.src.buildcraft.transport.Pipe; import net.minecraft.src.buildcraft.transport.PipeLogicWood; @@ -29,7 +30,7 @@ import net.minecraft.src.forge.ISidedInventory; public class PipeItemsWood extends Pipe implements IPowerReceptor { - private PowerProvider powerProvider; + private IPowerProvider powerProvider; private int baseTexture = 1 * 16 + 0; private int plainTexture = 1 * 16 + 15; @@ -68,18 +69,18 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { provider = powerProvider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } @Override public void doWork() { - if (powerProvider.energyStored <= 0) + if (powerProvider.getEnergyStored() <= 0) return; World w = worldObj; @@ -208,7 +209,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { @Override public int powerRequest() { - return getPowerProvider().maxEnergyReceived; + return getPowerProvider().getMaxEnergyReceived(); } } diff --git a/common/net/minecraft/src/buildcraft/transport/pipes/PipeLiquidsWood.java b/common/net/minecraft/src/buildcraft/transport/pipes/PipeLiquidsWood.java index 7a72b266..778f5f7b 100644 --- a/common/net/minecraft/src/buildcraft/transport/pipes/PipeLiquidsWood.java +++ b/common/net/minecraft/src/buildcraft/transport/pipes/PipeLiquidsWood.java @@ -13,12 +13,13 @@ import net.minecraft.src.TileEntity; import net.minecraft.src.World; import net.minecraft.src.buildcraft.api.BuildCraftAPI; 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.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.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.PipeLogicWood; import net.minecraft.src.buildcraft.transport.PipeTransportLiquids; @@ -28,7 +29,7 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor { public @TileNetworkData int liquidToExtract; - private PowerProvider powerProvider; + private IPowerProvider powerProvider; private int baseTexture = 7 * 16 + 0; private int plainTexture = 1 * 16 + 15; private int nextTexture = baseTexture; @@ -49,7 +50,7 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor { */ @Override public void doWork() { - if (powerProvider.energyStored <= 0) + if (powerProvider.getEnergyStored() <= 0) return; World w = worldObj; @@ -74,12 +75,12 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor { } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { powerProvider = provider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } @@ -132,6 +133,6 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor { @Override public int powerRequest() { - return getPowerProvider().maxEnergyReceived; + return getPowerProvider().getMaxEnergyReceived(); } } diff --git a/common/net/minecraft/src/buildcraft/transport/pipes/PipePowerWood.java b/common/net/minecraft/src/buildcraft/transport/pipes/PipePowerWood.java index 3dfe059a..d333f7ee 100644 --- a/common/net/minecraft/src/buildcraft/transport/pipes/PipePowerWood.java +++ b/common/net/minecraft/src/buildcraft/transport/pipes/PipePowerWood.java @@ -9,10 +9,11 @@ package net.minecraft.src.buildcraft.transport.pipes; 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.PowerFramework; -import net.minecraft.src.buildcraft.api.PowerProvider; +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.Utils; import net.minecraft.src.buildcraft.transport.Pipe; 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 { - private PowerProvider powerProvider; + private IPowerProvider powerProvider; private int baseTexture = 7 * 16 + 6; private int plainTexture = 1 * 16 + 15; @@ -41,12 +42,12 @@ public class PipePowerWood extends Pipe implements IPowerReceptor { } @Override - public void setPowerProvider(PowerProvider provider) { + public void setPowerProvider(IPowerProvider provider) { provider = powerProvider; } @Override - public PowerProvider getPowerProvider() { + public IPowerProvider getPowerProvider() { return powerProvider; } @@ -74,10 +75,10 @@ public class PipePowerWood extends Pipe implements IPowerReceptor { float energyToRemove = 0; - if (powerProvider.energyStored > 40) - energyToRemove = powerProvider.energyStored / 40 + 4; - else if (powerProvider.energyStored > 10) - energyToRemove = powerProvider.energyStored / 10; + if (powerProvider.getEnergyStored() > 40) + energyToRemove = powerProvider.getEnergyStored() / 40 + 4; + else if (powerProvider.getEnergyStored() > 10) + energyToRemove = powerProvider.getEnergyStored() / 10; else energyToRemove = 1; @@ -107,7 +108,7 @@ public class PipePowerWood extends Pipe implements IPowerReceptor { @Override public int powerRequest() { - return getPowerProvider().maxEnergyReceived; + return getPowerProvider().getMaxEnergyReceived(); } }