Changed overlooked hardcoded types to use interfaces.
This commit is contained in:
parent
52c807b8fd
commit
556b5da7ff
13 changed files with 55 additions and 46 deletions
|
@ -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<Trigger> getNeighborTriggers(Block block, TileEntity entity) {
|
||||
LinkedList<Trigger> triggers = new LinkedList<Trigger>();
|
||||
public static LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity entity) {
|
||||
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
LinkedList<Trigger> toAdd = provider.getNeighborTriggers(block, entity);
|
||||
LinkedList<ITrigger> 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<Action> getNeighborActions(Block block, TileEntity entity) {
|
||||
LinkedList<Action> actions = new LinkedList<Action>();
|
||||
public static LinkedList<IAction> getNeighborActions(Block block, TileEntity entity) {
|
||||
LinkedList<IAction> actions = new LinkedList<IAction>();
|
||||
|
||||
for (IActionProvider provider : actionProviders) {
|
||||
LinkedList<Action> toAdd = provider.getNeighborActions(block, entity);
|
||||
LinkedList<IAction> 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<Trigger> getPipeTriggers(IPipe pipe) {
|
||||
LinkedList<Trigger> triggers = new LinkedList<Trigger>();
|
||||
public static LinkedList<ITrigger> getPipeTriggers(IPipe pipe) {
|
||||
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
LinkedList<Trigger> toAdd = provider.getPipeTriggers(pipe);
|
||||
LinkedList<ITrigger> toAdd = provider.getPipeTriggers(pipe);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (Trigger t : toAdd) {
|
||||
for (ITrigger t : toAdd) {
|
||||
if (!triggers.contains(t)) {
|
||||
triggers.add(t);
|
||||
}
|
||||
|
|
|
@ -20,14 +20,14 @@ public class ActionManager {
|
|||
}
|
||||
}
|
||||
|
||||
public static LinkedList<Trigger> getNeighborTriggers(Block block, TileEntity entity) {
|
||||
LinkedList<Trigger> triggers = new LinkedList<Trigger>();
|
||||
public static LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity entity) {
|
||||
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
LinkedList<Trigger> toAdd = provider.getNeighborTriggers(block, entity);
|
||||
LinkedList<ITrigger> 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<Action> getNeighborActions(Block block, TileEntity entity) {
|
||||
LinkedList<Action> actions = new LinkedList<Action>();
|
||||
public static LinkedList<IAction> getNeighborActions(Block block, TileEntity entity) {
|
||||
LinkedList<IAction> actions = new LinkedList<IAction>();
|
||||
|
||||
for (IActionProvider provider : actionProviders) {
|
||||
LinkedList<Action> toAdd = provider.getNeighborActions(block, entity);
|
||||
LinkedList<IAction> 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<Trigger> getPipeTriggers(IPipe pipe) {
|
||||
LinkedList<Trigger> triggers = new LinkedList<Trigger>();
|
||||
public static LinkedList<ITrigger> getPipeTriggers(IPipe pipe) {
|
||||
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
LinkedList<Trigger> toAdd = provider.getPipeTriggers(pipe);
|
||||
LinkedList<ITrigger> toAdd = provider.getPipeTriggers(pipe);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (Trigger t : toAdd) {
|
||||
for (ITrigger t : toAdd) {
|
||||
if (!triggers.contains(t)) {
|
||||
triggers.add(t);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,6 @@ public interface IActionProvider {
|
|||
/**
|
||||
* Returns the list of actions available to a gate next to the given block.
|
||||
*/
|
||||
public abstract LinkedList<Action> getNeighborActions(Block block, TileEntity tile);
|
||||
public abstract LinkedList<IAction> getNeighborActions(Block block, TileEntity tile);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,6 @@ import java.util.LinkedList;
|
|||
*/
|
||||
public interface IOverrideDefaultTriggers {
|
||||
|
||||
public abstract LinkedList<Trigger> getTriggers();
|
||||
LinkedList<ITrigger> getTriggers();
|
||||
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ public interface ITriggerProvider {
|
|||
* Returns the list of triggers that are available from the pipe holding the
|
||||
* gate.
|
||||
*/
|
||||
public abstract LinkedList<Trigger> getPipeTriggers(IPipe pipe);
|
||||
public abstract LinkedList<ITrigger> getPipeTriggers(IPipe pipe);
|
||||
|
||||
/**
|
||||
* Returns the list of triggers available to a gate next to the given block.
|
||||
*/
|
||||
public abstract LinkedList<Trigger> getNeighborTriggers(Block block, TileEntity tile);
|
||||
public abstract LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity tile);
|
||||
|
||||
}
|
||||
|
|
|
@ -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<Action> getNeighborActions(Block block, TileEntity tile) {
|
||||
LinkedList<Action> res = new LinkedList<Action>();
|
||||
public LinkedList<IAction> getNeighborActions(Block block, TileEntity tile) {
|
||||
LinkedList<IAction> res = new LinkedList<IAction>();
|
||||
|
||||
res.add(BuildCraftCore.actionRedstone);
|
||||
|
||||
|
|
|
@ -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<Trigger> getNeighborTriggers(Block block, TileEntity tile) {
|
||||
public LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity tile) {
|
||||
if (tile instanceof IOverrideDefaultTriggers)
|
||||
return ((IOverrideDefaultTriggers) tile).getTriggers();
|
||||
|
||||
LinkedList<Trigger> res = new LinkedList<Trigger>();
|
||||
LinkedList<ITrigger> res = new LinkedList<ITrigger>();
|
||||
|
||||
if (tile instanceof IInventory && ((IInventory) tile).getSizeInventory() > 0) {
|
||||
res.add(BuildCraftCore.triggerEmptyInventory);
|
||||
|
@ -49,7 +50,7 @@ public class DefaultTriggerProvider implements ITriggerProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<Trigger> getPipeTriggers(IPipe pipe) {
|
||||
public LinkedList<ITrigger> getPipeTriggers(IPipe pipe) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Trigger> getTriggers() {
|
||||
LinkedList<Trigger> triggers = new LinkedList<Trigger>();
|
||||
public LinkedList<ITrigger> getTriggers() {
|
||||
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
|
||||
triggers.add(BuildCraftEnergy.triggerBlueEngineHeat);
|
||||
triggers.add(BuildCraftEnergy.triggerGreenEngineHeat);
|
||||
|
|
|
@ -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<Trigger> nearbyTriggers = ActionManager.getNeighborTriggers(block, tile);
|
||||
LinkedList<ITrigger> nearbyTriggers = ActionManager.getNeighborTriggers(block, tile);
|
||||
|
||||
for (Trigger t : nearbyTriggers)
|
||||
for (ITrigger t : nearbyTriggers)
|
||||
if (!_potentialTriggers.contains(t))
|
||||
_potentialTriggers.add(t);
|
||||
|
||||
LinkedList<Action> nearbyActions = ActionManager.getNeighborActions(block, tile);
|
||||
LinkedList<IAction> nearbyActions = ActionManager.getNeighborActions(block, tile);
|
||||
|
||||
for (Action a : nearbyActions)
|
||||
for (IAction a : nearbyActions)
|
||||
if (!_potentialActions.contains(a))
|
||||
_potentialActions.add(a);
|
||||
}
|
||||
|
|
|
@ -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<Trigger> list);
|
||||
public abstract void addTrigger(LinkedList<ITrigger> list);
|
||||
|
||||
// / TEXTURES
|
||||
public abstract int getTexture(boolean isSignalActive);
|
||||
|
|
|
@ -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<Trigger> list) {
|
||||
public void addTrigger(LinkedList<ITrigger> list) {
|
||||
|
||||
if (pipe.wireSet[IPipe.WireColor.Red.ordinal()] && kind.ordinal() >= Gate.GateKind.AND_2.ordinal()) {
|
||||
list.add(BuildCraftTransport.triggerRedSignalActive);
|
||||
|
|
|
@ -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<Trigger> getPipeTriggers(IPipe iPipe) {
|
||||
public LinkedList<ITrigger> getPipeTriggers(IPipe iPipe) {
|
||||
if (iPipe instanceof IOverrideDefaultTriggers)
|
||||
return ((IOverrideDefaultTriggers) iPipe).getTriggers();
|
||||
|
||||
LinkedList<Trigger> result = new LinkedList<Trigger>();
|
||||
LinkedList<ITrigger> result = new LinkedList<ITrigger>();
|
||||
|
||||
Pipe pipe = (Pipe) iPipe;
|
||||
|
||||
|
@ -39,7 +40,7 @@ public class PipeTriggerProvider implements ITriggerProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<Trigger> getNeighborTriggers(Block block, TileEntity tile) {
|
||||
public LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity tile) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Trigger> getTriggers() {
|
||||
LinkedList<Trigger> result = new LinkedList<Trigger>();
|
||||
public LinkedList<ITrigger> getTriggers() {
|
||||
LinkedList<ITrigger> result = new LinkedList<ITrigger>();
|
||||
|
||||
if (BlockGenericPipe.isFullyDefined(pipe) && pipe.hasGate()) {
|
||||
result.add(BuildCraftCore.triggerRedstoneActive);
|
||||
|
|
Loading…
Reference in a new issue