From 556b5da7ff617fe0de9c5f10461b69d493427cf6 Mon Sep 17 00:00:00 2001 From: SirSengir Date: Fri, 20 Jul 2012 20:26:20 +0200 Subject: [PATCH] Changed overlooked hardcoded types to use interfaces. --- .../src/buildcraft/api/BuildCraftAPI.java | 26 ++++++++++--------- .../buildcraft/api/gates/ActionManager.java | 24 ++++++++--------- .../buildcraft/api/gates/IActionProvider.java | 2 +- .../api/gates/IOverrideDefaultTriggers.java | 2 +- .../api/gates/ITriggerProvider.java | 4 +-- .../core/DefaultActionProvider.java | 5 ++-- .../core/DefaultTriggerProvider.java | 7 ++--- .../src/buildcraft/energy/TileEngine.java | 5 ++-- .../transport/CraftingGateInterface.java | 8 +++--- .../src/buildcraft/transport/Gate.java | 3 ++- .../src/buildcraft/transport/GateVanilla.java | 3 ++- .../transport/PipeTriggerProvider.java | 7 ++--- .../buildcraft/transport/TileGenericPipe.java | 5 ++-- 13 files changed, 55 insertions(+), 46 deletions(-) diff --git a/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java b/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java index 7d656d79..7ad75680 100644 --- a/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java +++ b/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java @@ -19,7 +19,9 @@ import net.minecraft.src.ItemStack; import net.minecraft.src.TileEntity; import net.minecraft.src.World; import net.minecraft.src.buildcraft.api.gates.Action; +import net.minecraft.src.buildcraft.api.gates.IAction; import net.minecraft.src.buildcraft.api.gates.IActionProvider; +import net.minecraft.src.buildcraft.api.gates.ITrigger; import net.minecraft.src.buildcraft.api.gates.ITriggerProvider; import net.minecraft.src.buildcraft.api.gates.Trigger; @@ -211,14 +213,14 @@ public class BuildCraftAPI { } @Deprecated - public static LinkedList getNeighborTriggers(Block block, TileEntity entity) { - LinkedList triggers = new LinkedList(); + public static LinkedList getNeighborTriggers(Block block, TileEntity entity) { + LinkedList triggers = new LinkedList(); for (ITriggerProvider provider : triggerProviders) { - LinkedList toAdd = provider.getNeighborTriggers(block, entity); + LinkedList toAdd = provider.getNeighborTriggers(block, entity); if (toAdd != null) { - for (Trigger t : toAdd) { + for (ITrigger t : toAdd) { if (!triggers.contains(t)) { triggers.add(t); } @@ -237,14 +239,14 @@ public class BuildCraftAPI { } @Deprecated - public static LinkedList getNeighborActions(Block block, TileEntity entity) { - LinkedList actions = new LinkedList(); + public static LinkedList getNeighborActions(Block block, TileEntity entity) { + LinkedList actions = new LinkedList(); for (IActionProvider provider : actionProviders) { - LinkedList toAdd = provider.getNeighborActions(block, entity); + LinkedList toAdd = provider.getNeighborActions(block, entity); if (toAdd != null) { - for (Action t : toAdd) { + for (IAction t : toAdd) { if (!actions.contains(t)) { actions.add(t); } @@ -256,14 +258,14 @@ public class BuildCraftAPI { } @Deprecated - public static LinkedList getPipeTriggers(IPipe pipe) { - LinkedList triggers = new LinkedList(); + public static LinkedList getPipeTriggers(IPipe pipe) { + LinkedList triggers = new LinkedList(); for (ITriggerProvider provider : triggerProviders) { - LinkedList toAdd = provider.getPipeTriggers(pipe); + LinkedList toAdd = provider.getPipeTriggers(pipe); if (toAdd != null) { - for (Trigger t : toAdd) { + for (ITrigger t : toAdd) { if (!triggers.contains(t)) { triggers.add(t); } diff --git a/common/net/minecraft/src/buildcraft/api/gates/ActionManager.java b/common/net/minecraft/src/buildcraft/api/gates/ActionManager.java index 7ba07989..f4d3a137 100644 --- a/common/net/minecraft/src/buildcraft/api/gates/ActionManager.java +++ b/common/net/minecraft/src/buildcraft/api/gates/ActionManager.java @@ -20,14 +20,14 @@ public class ActionManager { } } - public static LinkedList getNeighborTriggers(Block block, TileEntity entity) { - LinkedList triggers = new LinkedList(); + public static LinkedList getNeighborTriggers(Block block, TileEntity entity) { + LinkedList triggers = new LinkedList(); for (ITriggerProvider provider : triggerProviders) { - LinkedList toAdd = provider.getNeighborTriggers(block, entity); + LinkedList toAdd = provider.getNeighborTriggers(block, entity); if (toAdd != null) { - for (Trigger t : toAdd) { + for (ITrigger t : toAdd) { if (!triggers.contains(t)) { triggers.add(t); } @@ -44,14 +44,14 @@ public class ActionManager { } } - public static LinkedList getNeighborActions(Block block, TileEntity entity) { - LinkedList actions = new LinkedList(); + public static LinkedList getNeighborActions(Block block, TileEntity entity) { + LinkedList actions = new LinkedList(); for (IActionProvider provider : actionProviders) { - LinkedList toAdd = provider.getNeighborActions(block, entity); + LinkedList toAdd = provider.getNeighborActions(block, entity); if (toAdd != null) { - for (Action t : toAdd) { + for (IAction t : toAdd) { if (!actions.contains(t)) { actions.add(t); } @@ -62,14 +62,14 @@ public class ActionManager { return actions; } - public static LinkedList getPipeTriggers(IPipe pipe) { - LinkedList triggers = new LinkedList(); + public static LinkedList getPipeTriggers(IPipe pipe) { + LinkedList triggers = new LinkedList(); for (ITriggerProvider provider : triggerProviders) { - LinkedList toAdd = provider.getPipeTriggers(pipe); + LinkedList toAdd = provider.getPipeTriggers(pipe); if (toAdd != null) { - for (Trigger t : toAdd) { + for (ITrigger t : toAdd) { if (!triggers.contains(t)) { triggers.add(t); } diff --git a/common/net/minecraft/src/buildcraft/api/gates/IActionProvider.java b/common/net/minecraft/src/buildcraft/api/gates/IActionProvider.java index eed7c400..c39aec98 100644 --- a/common/net/minecraft/src/buildcraft/api/gates/IActionProvider.java +++ b/common/net/minecraft/src/buildcraft/api/gates/IActionProvider.java @@ -19,6 +19,6 @@ public interface IActionProvider { /** * Returns the list of actions available to a gate next to the given block. */ - public abstract LinkedList getNeighborActions(Block block, TileEntity tile); + public abstract LinkedList getNeighborActions(Block block, TileEntity tile); } diff --git a/common/net/minecraft/src/buildcraft/api/gates/IOverrideDefaultTriggers.java b/common/net/minecraft/src/buildcraft/api/gates/IOverrideDefaultTriggers.java index e7c800b1..a7bbe026 100644 --- a/common/net/minecraft/src/buildcraft/api/gates/IOverrideDefaultTriggers.java +++ b/common/net/minecraft/src/buildcraft/api/gates/IOverrideDefaultTriggers.java @@ -19,6 +19,6 @@ import java.util.LinkedList; */ public interface IOverrideDefaultTriggers { - public abstract LinkedList getTriggers(); + LinkedList getTriggers(); } diff --git a/common/net/minecraft/src/buildcraft/api/gates/ITriggerProvider.java b/common/net/minecraft/src/buildcraft/api/gates/ITriggerProvider.java index 925f6850..bd83dc47 100644 --- a/common/net/minecraft/src/buildcraft/api/gates/ITriggerProvider.java +++ b/common/net/minecraft/src/buildcraft/api/gates/ITriggerProvider.java @@ -21,11 +21,11 @@ public interface ITriggerProvider { * Returns the list of triggers that are available from the pipe holding the * gate. */ - public abstract LinkedList getPipeTriggers(IPipe pipe); + public abstract LinkedList getPipeTriggers(IPipe pipe); /** * Returns the list of triggers available to a gate next to the given block. */ - public abstract LinkedList getNeighborTriggers(Block block, TileEntity tile); + public abstract LinkedList getNeighborTriggers(Block block, TileEntity tile); } diff --git a/common/net/minecraft/src/buildcraft/core/DefaultActionProvider.java b/common/net/minecraft/src/buildcraft/core/DefaultActionProvider.java index 510e26cf..7c54f75f 100644 --- a/common/net/minecraft/src/buildcraft/core/DefaultActionProvider.java +++ b/common/net/minecraft/src/buildcraft/core/DefaultActionProvider.java @@ -6,13 +6,14 @@ import net.minecraft.src.Block; import net.minecraft.src.BuildCraftCore; import net.minecraft.src.TileEntity; import net.minecraft.src.buildcraft.api.gates.Action; +import net.minecraft.src.buildcraft.api.gates.IAction; import net.minecraft.src.buildcraft.api.gates.IActionProvider; public class DefaultActionProvider implements IActionProvider { @Override - public LinkedList getNeighborActions(Block block, TileEntity tile) { - LinkedList res = new LinkedList(); + public LinkedList getNeighborActions(Block block, TileEntity tile) { + LinkedList res = new LinkedList(); res.add(BuildCraftCore.actionRedstone); diff --git a/common/net/minecraft/src/buildcraft/core/DefaultTriggerProvider.java b/common/net/minecraft/src/buildcraft/core/DefaultTriggerProvider.java index 71cfb70d..7530044b 100644 --- a/common/net/minecraft/src/buildcraft/core/DefaultTriggerProvider.java +++ b/common/net/minecraft/src/buildcraft/core/DefaultTriggerProvider.java @@ -7,6 +7,7 @@ import net.minecraft.src.BuildCraftCore; import net.minecraft.src.IInventory; import net.minecraft.src.TileEntity; import net.minecraft.src.buildcraft.api.gates.IOverrideDefaultTriggers; +import net.minecraft.src.buildcraft.api.gates.ITrigger; import net.minecraft.src.buildcraft.api.gates.ITriggerProvider; import net.minecraft.src.buildcraft.api.gates.Trigger; import net.minecraft.src.buildcraft.api.liquids.ITankContainer; @@ -15,11 +16,11 @@ import net.minecraft.src.buildcraft.api.IPipe; public class DefaultTriggerProvider implements ITriggerProvider { @Override - public LinkedList getNeighborTriggers(Block block, TileEntity tile) { + public LinkedList getNeighborTriggers(Block block, TileEntity tile) { if (tile instanceof IOverrideDefaultTriggers) return ((IOverrideDefaultTriggers) tile).getTriggers(); - LinkedList res = new LinkedList(); + LinkedList res = new LinkedList(); if (tile instanceof IInventory && ((IInventory) tile).getSizeInventory() > 0) { res.add(BuildCraftCore.triggerEmptyInventory); @@ -49,7 +50,7 @@ public class DefaultTriggerProvider implements ITriggerProvider { } @Override - public LinkedList getPipeTriggers(IPipe pipe) { + public LinkedList getPipeTriggers(IPipe pipe) { return null; } diff --git a/common/net/minecraft/src/buildcraft/energy/TileEngine.java b/common/net/minecraft/src/buildcraft/energy/TileEngine.java index 2fb198f7..77a129ab 100644 --- a/common/net/minecraft/src/buildcraft/energy/TileEngine.java +++ b/common/net/minecraft/src/buildcraft/energy/TileEngine.java @@ -25,6 +25,7 @@ import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.gates.IOverrideDefaultTriggers; +import net.minecraft.src.buildcraft.api.gates.ITrigger; import net.minecraft.src.buildcraft.api.gates.Trigger; import net.minecraft.src.buildcraft.api.liquids.ILiquidTank; import net.minecraft.src.buildcraft.api.liquids.ITankContainer; @@ -401,8 +402,8 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven } @Override - public LinkedList getTriggers() { - LinkedList triggers = new LinkedList(); + public LinkedList getTriggers() { + LinkedList triggers = new LinkedList(); triggers.add(BuildCraftEnergy.triggerBlueEngineHeat); triggers.add(BuildCraftEnergy.triggerGreenEngineHeat); diff --git a/common/net/minecraft/src/buildcraft/transport/CraftingGateInterface.java b/common/net/minecraft/src/buildcraft/transport/CraftingGateInterface.java index 795c7d1a..7739744a 100644 --- a/common/net/minecraft/src/buildcraft/transport/CraftingGateInterface.java +++ b/common/net/minecraft/src/buildcraft/transport/CraftingGateInterface.java @@ -73,15 +73,15 @@ public class CraftingGateInterface extends BuildCraftContainer { int blockID = pipe.worldObj.getBlockId((int) pos.x, (int) pos.y, (int) pos.z); Block block = Block.blocksList[blockID]; - LinkedList nearbyTriggers = ActionManager.getNeighborTriggers(block, tile); + LinkedList nearbyTriggers = ActionManager.getNeighborTriggers(block, tile); - for (Trigger t : nearbyTriggers) + for (ITrigger t : nearbyTriggers) if (!_potentialTriggers.contains(t)) _potentialTriggers.add(t); - LinkedList nearbyActions = ActionManager.getNeighborActions(block, tile); + LinkedList nearbyActions = ActionManager.getNeighborActions(block, tile); - for (Action a : nearbyActions) + for (IAction a : nearbyActions) if (!_potentialActions.contains(a)) _potentialActions.add(a); } diff --git a/common/net/minecraft/src/buildcraft/transport/Gate.java b/common/net/minecraft/src/buildcraft/transport/Gate.java index fefcc29f..c8c5c79c 100644 --- a/common/net/minecraft/src/buildcraft/transport/Gate.java +++ b/common/net/minecraft/src/buildcraft/transport/Gate.java @@ -9,6 +9,7 @@ import net.minecraft.src.NBTTagCompound; import net.minecraft.src.World; import net.minecraft.src.buildcraft.api.gates.Action; import net.minecraft.src.buildcraft.api.gates.IAction; +import net.minecraft.src.buildcraft.api.gates.ITrigger; import net.minecraft.src.buildcraft.api.gates.Trigger; import net.minecraft.src.buildcraft.core.network.IndexInPayload; import net.minecraft.src.buildcraft.core.network.PacketPayload; @@ -99,7 +100,7 @@ public abstract class Gate { public abstract boolean resolveAction(IAction action); // / TRIGGERS - public abstract void addTrigger(LinkedList list); + public abstract void addTrigger(LinkedList list); // / TEXTURES public abstract int getTexture(boolean isSignalActive); diff --git a/common/net/minecraft/src/buildcraft/transport/GateVanilla.java b/common/net/minecraft/src/buildcraft/transport/GateVanilla.java index 309a2f24..c9ef6823 100644 --- a/common/net/minecraft/src/buildcraft/transport/GateVanilla.java +++ b/common/net/minecraft/src/buildcraft/transport/GateVanilla.java @@ -13,6 +13,7 @@ import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.IPipe; import net.minecraft.src.buildcraft.api.gates.Action; import net.minecraft.src.buildcraft.api.gates.IAction; +import net.minecraft.src.buildcraft.api.gates.ITrigger; import net.minecraft.src.buildcraft.api.gates.Trigger; import net.minecraft.src.buildcraft.api.power.IPowerReceptor; import net.minecraft.src.buildcraft.core.DefaultProps; @@ -213,7 +214,7 @@ public class GateVanilla extends Gate { // / TRIGGERS @Override - public void addTrigger(LinkedList list) { + public void addTrigger(LinkedList list) { if (pipe.wireSet[IPipe.WireColor.Red.ordinal()] && kind.ordinal() >= Gate.GateKind.AND_2.ordinal()) { list.add(BuildCraftTransport.triggerRedSignalActive); diff --git a/common/net/minecraft/src/buildcraft/transport/PipeTriggerProvider.java b/common/net/minecraft/src/buildcraft/transport/PipeTriggerProvider.java index ef4e0ee0..964edf8e 100644 --- a/common/net/minecraft/src/buildcraft/transport/PipeTriggerProvider.java +++ b/common/net/minecraft/src/buildcraft/transport/PipeTriggerProvider.java @@ -7,17 +7,18 @@ import net.minecraft.src.BuildCraftTransport; import net.minecraft.src.TileEntity; import net.minecraft.src.buildcraft.api.IPipe; import net.minecraft.src.buildcraft.api.gates.IOverrideDefaultTriggers; +import net.minecraft.src.buildcraft.api.gates.ITrigger; import net.minecraft.src.buildcraft.api.gates.ITriggerProvider; import net.minecraft.src.buildcraft.api.gates.Trigger; public class PipeTriggerProvider implements ITriggerProvider { @Override - public LinkedList getPipeTriggers(IPipe iPipe) { + public LinkedList getPipeTriggers(IPipe iPipe) { if (iPipe instanceof IOverrideDefaultTriggers) return ((IOverrideDefaultTriggers) iPipe).getTriggers(); - LinkedList result = new LinkedList(); + LinkedList result = new LinkedList(); Pipe pipe = (Pipe) iPipe; @@ -39,7 +40,7 @@ public class PipeTriggerProvider implements ITriggerProvider { } @Override - public LinkedList getNeighborTriggers(Block block, TileEntity tile) { + public LinkedList getNeighborTriggers(Block block, TileEntity tile) { return null; } diff --git a/common/net/minecraft/src/buildcraft/transport/TileGenericPipe.java b/common/net/minecraft/src/buildcraft/transport/TileGenericPipe.java index 9d4d0727..11c678c3 100644 --- a/common/net/minecraft/src/buildcraft/transport/TileGenericPipe.java +++ b/common/net/minecraft/src/buildcraft/transport/TileGenericPipe.java @@ -33,6 +33,7 @@ import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.SafeTimeTracker; import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.gates.IOverrideDefaultTriggers; +import net.minecraft.src.buildcraft.api.gates.ITrigger; import net.minecraft.src.buildcraft.api.gates.Trigger; import net.minecraft.src.buildcraft.api.power.IPowerProvider; import net.minecraft.src.buildcraft.api.power.IPowerReceptor; @@ -327,8 +328,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu } @Override - public LinkedList getTriggers() { - LinkedList result = new LinkedList(); + public LinkedList getTriggers() { + LinkedList result = new LinkedList(); if (BlockGenericPipe.isFullyDefined(pipe) && pipe.hasGate()) { result.add(BuildCraftCore.triggerRedstoneActive);