From fc0df8e84f8d4eb2e63cb1d93bf4698da3f2590e Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Fri, 21 Jun 2013 16:42:51 -0700 Subject: [PATCH] Removed a bit of unneeded code in the Wood PPipe @King_Lemming this will break compat with RS Cells because you're doing it wrong. Don't use powerRequest() like that and don't ignore the return of receiveEnergy(). PS. It was already broken because the cell was just throwing power away because it was ignoring the return of receiveEnergy(). --- .../buildcraft/api/power/IPowerReceptor.java | 22 ++++++++++++------- .../transport/pipes/PipeItemsWood.java | 17 +++++++------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/common/buildcraft/api/power/IPowerReceptor.java b/common/buildcraft/api/power/IPowerReceptor.java index 661145e0..405f108d 100644 --- a/common/buildcraft/api/power/IPowerReceptor.java +++ b/common/buildcraft/api/power/IPowerReceptor.java @@ -1,12 +1,10 @@ -/** - * 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 +/** + * 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 buildcraft.api.power; import net.minecraftforge.common.ForgeDirection; @@ -19,6 +17,14 @@ public interface IPowerReceptor { public void doWork(); + /** + * Used to request power from pipes. The return cannot be relied on to be + * anything more than a approximate guide to the power needed. When + * transferring power, you much check the return value of + * PowerProvider.receiverEnergy(). + * + * @param from + * @return + */ public int powerRequest(ForgeDirection from); - } diff --git a/common/buildcraft/transport/pipes/PipeItemsWood.java b/common/buildcraft/transport/pipes/PipeItemsWood.java index 04e735b3..3ec685fd 100644 --- a/common/buildcraft/transport/pipes/PipeItemsWood.java +++ b/common/buildcraft/transport/pipes/PipeItemsWood.java @@ -1,11 +1,10 @@ /** * BuildCraft is open-source. It is distributed under the terms of the - * BuildCraft Open Source License. It grants rights to read, modify, compile - * or run the code. It does *NOT* grant the right to redistribute this software - * or its modifications in any form, binary or source, except if expressively + * BuildCraft Open Source License. It grants rights to read, modify, compile or + * run the code. It does *NOT* grant the right to redistribute this software or + * its modifications in any form, binary or source, except if expressively * granted by the copyright holder. */ - package buildcraft.transport.pipes; import net.minecraft.inventory.IInventory; @@ -36,7 +35,6 @@ import cpw.mods.fml.relauncher.SideOnly; public class PipeItemsWood extends Pipe implements IPowerReceptor { private IPowerProvider powerProvider; - protected int standardIconIndex = PipeIconProvider.PipeItemsWood_Standard; protected int solidIconIndex = PipeIconProvider.PipeAllWood_Solid; @@ -130,8 +128,9 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { } /** - * Return the itemstack that can be if something can be extracted from this inventory, null if none. On certain cases, the extractable slot depends on the - * position of the pipe. + * Return the itemstack that can be if something can be extracted from this + * inventory, null if none. On certain cases, the extractable slot depends + * on the position of the pipe. */ public ItemStack[] checkExtract(IInventory inventory, boolean doRemove, ForgeDirection from) { @@ -152,7 +151,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { ItemStack result = checkExtractGeneric(inv, doRemove, from); if (result != null) - return new ItemStack[] { result }; + return new ItemStack[]{result}; } return null; @@ -181,7 +180,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { @Override public int powerRequest(ForgeDirection from) { - return getPowerProvider().getMaxEnergyReceived(); + return 0; } @Override