Add Redstone Fader Exp + major cleanup
After Width: | Height: | Size: 577 B |
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"animation": {
|
||||||
|
"frametime": 2
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 663 B |
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"animation": {
|
||||||
|
"frametime": 2
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 331 B |
After Width: | Height: | Size: 325 B |
After Width: | Height: | Size: 325 B |
After Width: | Height: | Size: 332 B |
After Width: | Height: | Size: 331 B |
After Width: | Height: | Size: 319 B |
After Width: | Height: | Size: 341 B |
After Width: | Height: | Size: 329 B |
After Width: | Height: | Size: 341 B |
After Width: | Height: | Size: 315 B |
After Width: | Height: | Size: 345 B |
After Width: | Height: | Size: 343 B |
After Width: | Height: | Size: 330 B |
After Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |
|
@ -30,9 +30,16 @@ fillerpattern.box=Box
|
||||||
fluid.oil=Oil
|
fluid.oil=Oil
|
||||||
fluid.fuel=Fuel
|
fluid.fuel=Fuel
|
||||||
|
|
||||||
gate.action.pipe.item.color=Paint Items %s
|
|
||||||
gate.action.extraction=%s Extraction Preset
|
gate.action.extraction=%s Extraction Preset
|
||||||
|
gate.action.pipe.item.color=Paint Items %s
|
||||||
|
gate.action.machine.on=On
|
||||||
|
gate.action.machine.off=Off
|
||||||
|
gate.action.machine.loop=Loop
|
||||||
|
gate.action.pulsar.constant=Energy Pulsar
|
||||||
|
gate.action.pulsar.single=Single Energy Pulse
|
||||||
|
gate.action.pipe.wire=%s Pipe Signal
|
||||||
|
|
||||||
|
gate.expansion.fader=Redstone Fader
|
||||||
gate.expansion.pulsar=Autarchic Pulsar
|
gate.expansion.pulsar=Autarchic Pulsar
|
||||||
gate.expansion.timer=Clock Timer
|
gate.expansion.timer=Clock Timer
|
||||||
|
|
||||||
|
@ -46,16 +53,32 @@ gate.material.diamond=Diamond
|
||||||
gate.name=%s %s Gate
|
gate.name=%s %s Gate
|
||||||
gate.name.basic=Gate
|
gate.name.basic=Gate
|
||||||
|
|
||||||
|
gate.trigger.engine.blue=Engine Blue
|
||||||
|
gate.trigger.engine.green=Engine Green
|
||||||
|
gate.trigger.engine.yellow=Engine Yellow
|
||||||
|
gate.trigger.engine.red=Engine Red
|
||||||
|
gate.trigger.fluid.emtpy=Tank Empty
|
||||||
|
gate.trigger.fluid.contains=Fluid in Tank
|
||||||
|
gate.trigger.fluid.space=Space for Fluid
|
||||||
|
gate.trigger.fluid.full=Tank Full
|
||||||
|
gate.trigger.inventory.empty=Inventory Empty
|
||||||
|
gate.trigger.inventory.contains=Items in Inventory
|
||||||
|
gate.trigger.inventory.space=Space in Inventory
|
||||||
|
gate.trigger.inventory.full=Inventory Full
|
||||||
|
gate.trigger.inventorylevel.below=Contains < %d%%
|
||||||
|
gate.trigger.machine.done=Work Done
|
||||||
|
gate.trigger.machine.scheduled=Has Work
|
||||||
|
gate.trigger.redstone.input.active=Redstone Signal On
|
||||||
|
gate.trigger.redstone.input.inactive=Redstone Signal Off
|
||||||
|
gate.trigger.redstone.input.level=Redstone Level %d
|
||||||
gate.trigger.pipe.empty=Pipe Empty
|
gate.trigger.pipe.empty=Pipe Empty
|
||||||
gate.trigger.pipe.containsItems=Items Traversing
|
gate.trigger.pipe.containsItems=Items Traversing
|
||||||
gate.trigger.pipe.containsFluids=Fluid Traversing
|
gate.trigger.pipe.containsFluids=Fluid Traversing
|
||||||
gate.trigger.pipe.containsEnergy=Power Traversing
|
gate.trigger.pipe.containsEnergy=Power Traversing
|
||||||
gate.trigger.pipe.requestsEnergy=Power Requested
|
gate.trigger.pipe.requestsEnergy=Power Requested
|
||||||
gate.trigger.pipe.tooMuchEnergy=Power Overloaded
|
gate.trigger.pipe.tooMuchEnergy=Power Overloaded
|
||||||
gate.trigger.engine.blue=Engine Blue
|
gate.trigger.pipe.wire.active=%s Pipe Signal On
|
||||||
gate.trigger.engine.green=Engine Green
|
gate.trigger.pipe.wire.inactive=%s Pipe Signal Off
|
||||||
gate.trigger.engine.yellow=Engine Yellow
|
|
||||||
gate.trigger.engine.red=Engine Red
|
|
||||||
gate.trigger.timer=%s Sec Timer
|
gate.trigger.timer=%s Sec Timer
|
||||||
|
|
||||||
gui.building.resources=Building Resources
|
gui.building.resources=Building Resources
|
||||||
|
|
|
@ -66,7 +66,7 @@ import buildcraft.core.triggers.TriggerMachine;
|
||||||
import buildcraft.core.utils.BCLog;
|
import buildcraft.core.utils.BCLog;
|
||||||
import buildcraft.core.utils.Localization;
|
import buildcraft.core.utils.Localization;
|
||||||
import buildcraft.core.recipes.AssemblyRecipeManager;
|
import buildcraft.core.recipes.AssemblyRecipeManager;
|
||||||
import buildcraft.transport.triggers.TriggerRedstoneInput;
|
import buildcraft.core.triggers.TriggerRedstoneInput;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
|
@ -124,25 +124,25 @@ public class BuildCraftCore {
|
||||||
public static int legacyPipeModel;
|
public static int legacyPipeModel;
|
||||||
public static int markerModel;
|
public static int markerModel;
|
||||||
public static int oilModel;
|
public static int oilModel;
|
||||||
public static BCTrigger triggerMachineActive = new TriggerMachine(DefaultProps.TRIGGER_MACHINE_ACTIVE, true);
|
public static BCTrigger triggerMachineActive = new TriggerMachine(true);
|
||||||
public static BCTrigger triggerMachineInactive = new TriggerMachine(DefaultProps.TRIGGER_MACHINE_INACTIVE, false);
|
public static BCTrigger triggerMachineInactive = new TriggerMachine(false);
|
||||||
public static BCTrigger triggerEmptyInventory = new TriggerInventory(DefaultProps.TRIGGER_EMPTY_INVENTORY, TriggerInventory.State.Empty);
|
public static BCTrigger triggerEmptyInventory = new TriggerInventory(TriggerInventory.State.Empty);
|
||||||
public static BCTrigger triggerContainsInventory = new TriggerInventory(DefaultProps.TRIGGER_CONTAINS_INVENTORY, TriggerInventory.State.Contains);
|
public static BCTrigger triggerContainsInventory = new TriggerInventory(TriggerInventory.State.Contains);
|
||||||
public static BCTrigger triggerSpaceInventory = new TriggerInventory(DefaultProps.TRIGGER_SPACE_INVENTORY, TriggerInventory.State.Space);
|
public static BCTrigger triggerSpaceInventory = new TriggerInventory(TriggerInventory.State.Space);
|
||||||
public static BCTrigger triggerFullInventory = new TriggerInventory(DefaultProps.TRIGGER_FULL_INVENTORY, TriggerInventory.State.Full);
|
public static BCTrigger triggerFullInventory = new TriggerInventory(TriggerInventory.State.Full);
|
||||||
public static BCTrigger triggerEmptyFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_EMPTY_LIQUID, TriggerFluidContainer.State.Empty);
|
public static BCTrigger triggerEmptyFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Empty);
|
||||||
public static BCTrigger triggerContainsFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_CONTAINS_LIQUID, TriggerFluidContainer.State.Contains);
|
public static BCTrigger triggerContainsFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Contains);
|
||||||
public static BCTrigger triggerSpaceFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_SPACE_LIQUID, TriggerFluidContainer.State.Space);
|
public static BCTrigger triggerSpaceFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Space);
|
||||||
public static BCTrigger triggerFullFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_FULL_LIQUID, TriggerFluidContainer.State.Full);
|
public static BCTrigger triggerFullFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Full);
|
||||||
public static BCTrigger triggerRedstoneActive = new TriggerRedstoneInput(DefaultProps.TRIGGER_REDSTONE_ACTIVE, true);
|
public static BCTrigger triggerRedstoneActive = new TriggerRedstoneInput(true);
|
||||||
public static BCTrigger triggerRedstoneInactive = new TriggerRedstoneInput(DefaultProps.TRIGGER_REDSTONE_INACTIVE, false);
|
public static BCTrigger triggerRedstoneInactive = new TriggerRedstoneInput(false);
|
||||||
public static BCTrigger triggerInventoryBelow25 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_25);
|
public static BCTrigger triggerInventoryBelow25 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_25);
|
||||||
public static BCTrigger triggerInventoryBelow50 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_50);
|
public static BCTrigger triggerInventoryBelow50 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_50);
|
||||||
public static BCTrigger triggerInventoryBelow75 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_75);
|
public static BCTrigger triggerInventoryBelow75 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_75);
|
||||||
public static BCAction actionRedstone = new ActionRedstoneOutput(DefaultProps.ACTION_REDSTONE);
|
public static BCAction actionRedstone = new ActionRedstoneOutput();
|
||||||
public static BCAction actionOn = new ActionMachineControl(DefaultProps.ACTION_ON, Mode.On);
|
public static BCAction actionOn = new ActionMachineControl(Mode.On);
|
||||||
public static BCAction actionOff = new ActionMachineControl(DefaultProps.ACTION_OFF, Mode.Off);
|
public static BCAction actionOff = new ActionMachineControl(Mode.Off);
|
||||||
public static BCAction actionLoop = new ActionMachineControl(DefaultProps.ACTION_LOOP, Mode.Loop);
|
public static BCAction actionLoop = new ActionMachineControl(Mode.Loop);
|
||||||
public static boolean loadDefaultRecipes = true;
|
public static boolean loadDefaultRecipes = true;
|
||||||
public static boolean forcePneumaticPower = true;
|
public static boolean forcePneumaticPower = true;
|
||||||
public static boolean consumeWaterSources = false;
|
public static boolean consumeWaterSources = false;
|
||||||
|
|
|
@ -84,10 +84,10 @@ public class BuildCraftEnergy {
|
||||||
public static boolean canOilBurn;
|
public static boolean canOilBurn;
|
||||||
public static double oilWellScalar = 1.0;
|
public static double oilWellScalar = 1.0;
|
||||||
public static TreeMap<BlockIndex, Integer> saturationStored = new TreeMap<BlockIndex, Integer>();
|
public static TreeMap<BlockIndex, Integer> saturationStored = new TreeMap<BlockIndex, Integer>();
|
||||||
public static BCTrigger triggerBlueEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_BLUE_ENGINE_HEAT, EnergyStage.BLUE, "buildcraft.engine.stage.blue");
|
public static BCTrigger triggerBlueEngineHeat = new TriggerEngineHeat(EnergyStage.BLUE);
|
||||||
public static BCTrigger triggerGreenEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_GREEN_ENGINE_HEAT, EnergyStage.GREEN, "buildcraft.engine.stage.green");
|
public static BCTrigger triggerGreenEngineHeat = new TriggerEngineHeat(EnergyStage.GREEN);
|
||||||
public static BCTrigger triggerYellowEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_YELLOW_ENGINE_HEAT, EnergyStage.YELLOW, "buildcraft.engine.stage.yellow");
|
public static BCTrigger triggerYellowEngineHeat = new TriggerEngineHeat(EnergyStage.YELLOW);
|
||||||
public static BCTrigger triggerRedEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_RED_ENGINE_HEAT, EnergyStage.RED, "buildcraft.engine.stage.red");
|
public static BCTrigger triggerRedEngineHeat = new TriggerEngineHeat(EnergyStage.RED);
|
||||||
@Instance("BuildCraft|Energy")
|
@Instance("BuildCraft|Energy")
|
||||||
public static BuildCraftEnergy instance;
|
public static BuildCraftEnergy instance;
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ import buildcraft.transport.blueprints.BptItemPipeWooden;
|
||||||
import buildcraft.transport.gates.GateExpansionPulsar;
|
import buildcraft.transport.gates.GateExpansionPulsar;
|
||||||
import buildcraft.api.gates.GateExpansions;
|
import buildcraft.api.gates.GateExpansions;
|
||||||
import buildcraft.api.transport.PipeWire;
|
import buildcraft.api.transport.PipeWire;
|
||||||
|
import buildcraft.transport.gates.GateExpansionRedstoneFader;
|
||||||
import buildcraft.transport.gates.GateExpansionTimer;
|
import buildcraft.transport.gates.GateExpansionTimer;
|
||||||
import buildcraft.transport.network.PacketHandlerTransport;
|
import buildcraft.transport.network.PacketHandlerTransport;
|
||||||
import buildcraft.transport.network.TransportConnectionHandler;
|
import buildcraft.transport.network.TransportConnectionHandler;
|
||||||
|
@ -75,7 +76,7 @@ import buildcraft.transport.pipes.PipePowerQuartz;
|
||||||
import buildcraft.transport.pipes.PipePowerStone;
|
import buildcraft.transport.pipes.PipePowerStone;
|
||||||
import buildcraft.transport.pipes.PipePowerWood;
|
import buildcraft.transport.pipes.PipePowerWood;
|
||||||
import buildcraft.transport.pipes.PipeStructureCobblestone;
|
import buildcraft.transport.pipes.PipeStructureCobblestone;
|
||||||
import buildcraft.transport.triggers.ActionEnergyPulser;
|
import buildcraft.transport.triggers.ActionEnergyPulsar;
|
||||||
import buildcraft.transport.triggers.ActionExtractionPreset;
|
import buildcraft.transport.triggers.ActionExtractionPreset;
|
||||||
import buildcraft.transport.triggers.ActionPipeColor;
|
import buildcraft.transport.triggers.ActionPipeColor;
|
||||||
import buildcraft.transport.triggers.ActionPipeDirection;
|
import buildcraft.transport.triggers.ActionPipeDirection;
|
||||||
|
@ -85,8 +86,10 @@ import buildcraft.transport.triggers.ActionSingleEnergyPulse;
|
||||||
import buildcraft.transport.triggers.TriggerPipeContents;
|
import buildcraft.transport.triggers.TriggerPipeContents;
|
||||||
import buildcraft.transport.triggers.TriggerClockTimer;
|
import buildcraft.transport.triggers.TriggerClockTimer;
|
||||||
import buildcraft.transport.triggers.TriggerClockTimer.Time;
|
import buildcraft.transport.triggers.TriggerClockTimer.Time;
|
||||||
import buildcraft.transport.triggers.TriggerPipeContents.Kind;
|
import buildcraft.transport.triggers.TriggerPipeContents.PipeContents;
|
||||||
import buildcraft.transport.triggers.TriggerPipeSignal;
|
import buildcraft.transport.triggers.TriggerPipeSignal;
|
||||||
|
import buildcraft.transport.triggers.TriggerRedstoneFaderInput;
|
||||||
|
import buildcraft.transport.triggers.ActionRedstoneFaderOutput;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
|
@ -155,30 +158,18 @@ public class BuildCraftTransport {
|
||||||
// public static Item pipeItemsStipes;
|
// public static Item pipeItemsStipes;
|
||||||
public static Item pipeStructureCobblestone;
|
public static Item pipeStructureCobblestone;
|
||||||
public static int groupItemsTrigger;
|
public static int groupItemsTrigger;
|
||||||
public static BCTrigger triggerPipeEmpty = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_EMPTY, Kind.Empty);
|
public static BCTrigger[] triggerPipe = new BCTrigger[PipeContents.values().length];
|
||||||
public static BCTrigger triggerPipeItems = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_ITEMS, Kind.ContainsItems);
|
public static BCTrigger[] triggerPipeWireActive = new BCTrigger[PipeWire.values().length];
|
||||||
public static BCTrigger triggerPipeFluids = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_LIQUIDS, Kind.ContainsFluids);
|
public static BCTrigger[] triggerPipeWireInactive = new BCTrigger[PipeWire.values().length];
|
||||||
public static BCTrigger triggerPipeContainsEnergy = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_CONTAINS_ENERGY, Kind.ContainsEnergy);
|
public static BCTrigger[] triggerTimer = new BCTrigger[TriggerClockTimer.Time.VALUES.length];
|
||||||
public static BCTrigger triggerPipeRequestsEnergy = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_REQUESTS_ENERGY, Kind.RequestsEnergy);
|
public static BCTrigger[] triggerRedstoneLevel = new BCTrigger[15];
|
||||||
public static BCTrigger triggerPipeTooMuchEnergy = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_TOO_MUCH_ENERGY, Kind.TooMuchEnergy);
|
public static BCAction[] actionPipeWire = new ActionSignalOutput[PipeWire.values().length];
|
||||||
public static BCTrigger triggerRedSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_RED_SIGNAL_ACTIVE, true, PipeWire.Red);
|
public static BCAction actionEnergyPulser = new ActionEnergyPulsar();
|
||||||
public static BCTrigger triggerRedSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_RED_SIGNAL_INACTIVE, false, PipeWire.Red);
|
public static BCAction actionSingleEnergyPulse = new ActionSingleEnergyPulse();
|
||||||
public static BCTrigger triggerBlueSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_BLUE_SIGNAL_ACTIVE, true, PipeWire.Blue);
|
|
||||||
public static BCTrigger triggerBlueSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_BLUE_SIGNAL_INACTIVE, false, PipeWire.Blue);
|
|
||||||
public static BCTrigger triggerGreenSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_GREEN_SIGNAL_ACTIVE, true, PipeWire.Green);
|
|
||||||
public static BCTrigger triggerGreenSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_GREEN_SIGNAL_INACTIVE, false, PipeWire.Green);
|
|
||||||
public static BCTrigger triggerYellowSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_YELLOW_SIGNAL_ACTIVE, true, PipeWire.Yellow);
|
|
||||||
public static BCTrigger triggerYellowSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_YELLOW_SIGNAL_INACTIVE, false, PipeWire.Yellow);
|
|
||||||
public static BCTrigger[] triggerTimer = new TriggerClockTimer[TriggerClockTimer.Time.VALUES.length];
|
|
||||||
public static BCAction actionRedSignal = new ActionSignalOutput(DefaultProps.ACTION_RED_SIGNAL, PipeWire.Red);
|
|
||||||
public static BCAction actionBlueSignal = new ActionSignalOutput(DefaultProps.ACTION_BLUE_SIGNAL, PipeWire.Blue);
|
|
||||||
public static BCAction actionGreenSignal = new ActionSignalOutput(DefaultProps.ACTION_GREEN_SIGNAL, PipeWire.Green);
|
|
||||||
public static BCAction actionYellowSignal = new ActionSignalOutput(DefaultProps.ACTION_YELLOW_SIGNAL, PipeWire.Yellow);
|
|
||||||
public static BCAction actionEnergyPulser = new ActionEnergyPulser(DefaultProps.ACTION_ENERGY_PULSER);
|
|
||||||
public static BCAction actionSingleEnergyPulse = new ActionSingleEnergyPulse(DefaultProps.ACTION_SINGLE_ENERGY_PULSE);
|
|
||||||
public static BCAction[] actionPipeColor = new BCAction[16];
|
public static BCAction[] actionPipeColor = new BCAction[16];
|
||||||
public static BCAction[] actionPipeDirection = new BCAction[16];
|
public static BCAction[] actionPipeDirection = new BCAction[16];
|
||||||
public static BCAction[] actionPowerLimiter = new BCAction[7];
|
public static BCAction[] actionPowerLimiter = new BCAction[7];
|
||||||
|
public static BCAction[] actionRedstoneLevel = new BCAction[15];
|
||||||
public static BCAction actionExtractionPresetRed = new ActionExtractionPreset(EnumColor.RED);
|
public static BCAction actionExtractionPresetRed = new ActionExtractionPreset(EnumColor.RED);
|
||||||
public static BCAction actionExtractionPresetBlue = new ActionExtractionPreset(EnumColor.BLUE);
|
public static BCAction actionExtractionPresetBlue = new ActionExtractionPreset(EnumColor.BLUE);
|
||||||
public static BCAction actionExtractionPresetGreen = new ActionExtractionPreset(EnumColor.GREEN);
|
public static BCAction actionExtractionPresetGreen = new ActionExtractionPreset(EnumColor.GREEN);
|
||||||
|
@ -267,6 +258,7 @@ public class BuildCraftTransport {
|
||||||
|
|
||||||
GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE);
|
GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE);
|
||||||
GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE);
|
GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE);
|
||||||
|
GateExpansions.registerExpansion(GateExpansionRedstoneFader.INSTANCE);
|
||||||
|
|
||||||
Property groupItemsTriggerProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.groupItemsTrigger", 32);
|
Property groupItemsTriggerProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.groupItemsTrigger", 32);
|
||||||
groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
|
groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
|
||||||
|
@ -413,10 +405,25 @@ public class BuildCraftTransport {
|
||||||
public void postInit(FMLPostInitializationEvent evt) {
|
public void postInit(FMLPostInitializationEvent evt) {
|
||||||
ItemFacade.initialize();
|
ItemFacade.initialize();
|
||||||
|
|
||||||
|
for (PipeContents kind : PipeContents.values()) {
|
||||||
|
triggerPipe[kind.ordinal()] = new TriggerPipeContents(kind);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (PipeWire wire : PipeWire.values()) {
|
||||||
|
triggerPipeWireActive[wire.ordinal()] = new TriggerPipeSignal(true, wire);
|
||||||
|
triggerPipeWireInactive[wire.ordinal()] = new TriggerPipeSignal(false, wire);
|
||||||
|
actionPipeWire[wire.ordinal()] = new ActionSignalOutput(wire);
|
||||||
|
}
|
||||||
|
|
||||||
for (Time time : TriggerClockTimer.Time.VALUES) {
|
for (Time time : TriggerClockTimer.Time.VALUES) {
|
||||||
triggerTimer[time.ordinal()] = new TriggerClockTimer(time);
|
triggerTimer[time.ordinal()] = new TriggerClockTimer(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int level = 0; level < triggerRedstoneLevel.length; level++) {
|
||||||
|
triggerRedstoneLevel[level] = new TriggerRedstoneFaderInput(level + 1);
|
||||||
|
actionRedstoneLevel[level] = new ActionRedstoneFaderOutput(level + 1);
|
||||||
|
}
|
||||||
|
|
||||||
for (EnumColor color : EnumColor.VALUES) {
|
for (EnumColor color : EnumColor.VALUES) {
|
||||||
actionPipeColor[color.ordinal()] = new ActionPipeColor(color);
|
actionPipeColor[color.ordinal()] = new ActionPipeColor(color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package buildcraft.api.gates;
|
||||||
import buildcraft.api.transport.IPipeTile;
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -11,8 +12,8 @@ public class ActionManager {
|
||||||
|
|
||||||
public static Map<String, ITrigger> triggers = new HashMap<String, ITrigger>();
|
public static Map<String, ITrigger> triggers = new HashMap<String, ITrigger>();
|
||||||
public static Map<String, IAction> actions = new HashMap<String, IAction>();
|
public static Map<String, IAction> actions = new HashMap<String, IAction>();
|
||||||
private static LinkedList<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
|
private static List<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
|
||||||
private static LinkedList<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
|
private static List<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
|
||||||
|
|
||||||
public static void registerTriggerProvider(ITriggerProvider provider) {
|
public static void registerTriggerProvider(ITriggerProvider provider) {
|
||||||
if (provider != null && !triggerProviders.contains(provider)) {
|
if (provider != null && !triggerProviders.contains(provider)) {
|
||||||
|
@ -28,11 +29,11 @@ public class ActionManager {
|
||||||
actions.put(action.getUniqueTag(), action);
|
actions.put(action.getUniqueTag(), action);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity entity) {
|
public static List<ITrigger> getNeighborTriggers(Block block, TileEntity entity) {
|
||||||
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
|
List<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||||
|
|
||||||
for (ITriggerProvider provider : triggerProviders) {
|
for (ITriggerProvider provider : triggerProviders) {
|
||||||
LinkedList<ITrigger> toAdd = provider.getNeighborTriggers(block, entity);
|
List<ITrigger> toAdd = provider.getNeighborTriggers(block, entity);
|
||||||
|
|
||||||
if (toAdd != null) {
|
if (toAdd != null) {
|
||||||
for (ITrigger t : toAdd) {
|
for (ITrigger t : toAdd) {
|
||||||
|
@ -52,12 +53,11 @@ public class ActionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Use sets not lists
|
public static List<IAction> getNeighborActions(Block block, TileEntity entity) {
|
||||||
public static LinkedList<IAction> getNeighborActions(Block block, TileEntity entity) {
|
List<IAction> actions = new LinkedList<IAction>();
|
||||||
LinkedList<IAction> actions = new LinkedList<IAction>();
|
|
||||||
|
|
||||||
for (IActionProvider provider : actionProviders) {
|
for (IActionProvider provider : actionProviders) {
|
||||||
LinkedList<IAction> toAdd = provider.getNeighborActions(block, entity);
|
List<IAction> toAdd = provider.getNeighborActions(block, entity);
|
||||||
|
|
||||||
if (toAdd != null) {
|
if (toAdd != null) {
|
||||||
for (IAction t : toAdd) {
|
for (IAction t : toAdd) {
|
||||||
|
@ -71,11 +71,11 @@ public class ActionManager {
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LinkedList<ITrigger> getPipeTriggers(IPipeTile pipe) {
|
public static List<ITrigger> getPipeTriggers(IPipeTile pipe) {
|
||||||
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
|
List<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||||
|
|
||||||
for (ITriggerProvider provider : triggerProviders) {
|
for (ITriggerProvider provider : triggerProviders) {
|
||||||
LinkedList<ITrigger> toAdd = provider.getPipeTriggers(pipe);
|
List<ITrigger> toAdd = provider.getPipeTriggers(pipe);
|
||||||
|
|
||||||
if (toAdd != null) {
|
if (toAdd != null) {
|
||||||
for (ITrigger t : toAdd) {
|
for (ITrigger t : toAdd) {
|
||||||
|
@ -88,20 +88,4 @@ public class ActionManager {
|
||||||
|
|
||||||
return triggers;
|
return triggers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ITrigger getTriggerFromLegacyId(int legacyId) {
|
|
||||||
for (ITrigger trigger : triggers.values()) {
|
|
||||||
if (trigger.getLegacyId() == legacyId)
|
|
||||||
return trigger;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IAction getActionFromLegacyId(int legacyId) {
|
|
||||||
for (IAction action : actions.values()) {
|
|
||||||
if (action.getLegacyId() == legacyId)
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,6 @@ import net.minecraft.util.Icon;
|
||||||
|
|
||||||
public interface IAction {
|
public interface IAction {
|
||||||
|
|
||||||
/**
|
|
||||||
* Return your ID from the old API here, this is only used to convert old
|
|
||||||
* saves to the new format.
|
|
||||||
*/
|
|
||||||
int getLegacyId();
|
|
||||||
|
|
||||||
String getUniqueTag();
|
String getUniqueTag();
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
|
|
@ -8,11 +8,11 @@ import net.minecraft.util.Icon;
|
||||||
public interface ITrigger {
|
public interface ITrigger {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return your ID from the old API here, this is only used to convert old
|
* Every trigger needs a unique tag, it should be in the format of
|
||||||
* saves to the new format.
|
* "<modid>:<name>".
|
||||||
|
*
|
||||||
|
* @return the unique id
|
||||||
*/
|
*/
|
||||||
int getLegacyId();
|
|
||||||
|
|
||||||
String getUniqueTag();
|
String getUniqueTag();
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
@API(apiVersion="1.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|gates")
|
@API(apiVersion="2.0",owner="BuildCraftAPI|core",provides="BuildCraftAPI|gates")
|
||||||
package buildcraft.api.gates;
|
package buildcraft.api.gates;
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
|
@ -14,6 +14,7 @@ package buildcraft.api.transport;
|
||||||
*/
|
*/
|
||||||
public enum PipeWire {
|
public enum PipeWire {
|
||||||
Red, Blue, Green, Yellow;
|
Red, Blue, Green, Yellow;
|
||||||
|
public static final PipeWire[] VALUES = values();
|
||||||
|
|
||||||
public PipeWire reverse() {
|
public PipeWire reverse() {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class ActionFiller extends BCAction {
|
||||||
public final IFillerPattern pattern;
|
public final IFillerPattern pattern;
|
||||||
|
|
||||||
public ActionFiller(IFillerPattern pattern) {
|
public ActionFiller(IFillerPattern pattern) {
|
||||||
super(0, "filler:" + pattern.getUniqueTag());
|
super("filler:" + pattern.getUniqueTag());
|
||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,49 +128,6 @@ public class DefaultProps {
|
||||||
public static final int FILLER_LIFESPAN_TOUGH = 20;
|
public static final int FILLER_LIFESPAN_TOUGH = 20;
|
||||||
public static final int FILLER_LIFESPAN_NORMAL = 6000;
|
public static final int FILLER_LIFESPAN_NORMAL = 6000;
|
||||||
|
|
||||||
// These are only till here for Legacy support, new Triggers/Action don't need them
|
|
||||||
public static int TRIGGER_REDSTONE_ACTIVE = 1;
|
|
||||||
public static int TRIGGER_REDSTONE_INACTIVE = 2;
|
|
||||||
public static int TRIGGER_MACHINE_ACTIVE = 3;
|
|
||||||
public static int TRIGGER_MACHINE_INACTIVE = 4;
|
|
||||||
public static int TRIGGER_EMPTY_INVENTORY = 5;
|
|
||||||
public static int TRIGGER_CONTAINS_INVENTORY = 6;
|
|
||||||
public static int TRIGGER_SPACE_INVENTORY = 7;
|
|
||||||
public static int TRIGGER_FULL_INVENTORY = 8;
|
|
||||||
public static int TRIGGER_EMPTY_LIQUID = 9;
|
|
||||||
public static int TRIGGER_CONTAINS_LIQUID = 10;
|
|
||||||
public static int TRIGGER_SPACE_LIQUID = 11;
|
|
||||||
public static int TRIGGER_FULL_LIQUID = 12;
|
|
||||||
public static int TRIGGER_PIPE_EMPTY = 13;
|
|
||||||
public static int TRIGGER_PIPE_ITEMS = 14;
|
|
||||||
public static int TRIGGER_PIPE_LIQUIDS = 15;
|
|
||||||
public static int TRIGGER_PIPE_CONTAINS_ENERGY = 16;
|
|
||||||
public static int TRIGGER_RED_SIGNAL_ACTIVE = 17;
|
|
||||||
public static int TRIGGER_RED_SIGNAL_INACTIVE = 18;
|
|
||||||
public static int TRIGGER_BLUE_SIGNAL_ACTIVE = 19;
|
|
||||||
public static int TRIGGER_BLUE_SIGNAL_INACTIVE = 20;
|
|
||||||
public static int TRIGGER_GREEN_SIGNAL_ACTIVE = 21;
|
|
||||||
public static int TRIGGER_GREEN_SIGNAL_INACTIVE = 22;
|
|
||||||
public static int TRIGGER_YELLOW_SIGNAL_ACTIVE = 23;
|
|
||||||
public static int TRIGGER_YELLOW_SIGNAL_INACTIVE = 24;
|
|
||||||
public static int TRIGGER_BLUE_ENGINE_HEAT = 25;
|
|
||||||
public static int TRIGGER_GREEN_ENGINE_HEAT = 26;
|
|
||||||
public static int TRIGGER_YELLOW_ENGINE_HEAT = 27;
|
|
||||||
public static int TRIGGER_RED_ENGINE_HEAT = 28;
|
|
||||||
public static int TRIGGER_PIPE_REQUESTS_ENERGY = 29;
|
|
||||||
public static int TRIGGER_PIPE_TOO_MUCH_ENERGY = 30;
|
|
||||||
|
|
||||||
public static int ACTION_REDSTONE = 1;
|
|
||||||
public static int ACTION_RED_SIGNAL = 2;
|
|
||||||
public static int ACTION_BLUE_SIGNAL = 3;
|
|
||||||
public static int ACTION_GREEN_SIGNAL = 4;
|
|
||||||
public static int ACTION_YELLOW_SIGNAL = 5;
|
|
||||||
public static int ACTION_ON = 6;
|
|
||||||
public static int ACTION_OFF = 7;
|
|
||||||
public static int ACTION_LOOP = 8;
|
|
||||||
public static int ACTION_ENERGY_PULSER = 9;
|
|
||||||
public static int ACTION_SINGLE_ENERGY_PULSE = 10;
|
|
||||||
|
|
||||||
public static int BIOME_OIL_OCEAN = 160;
|
public static int BIOME_OIL_OCEAN = 160;
|
||||||
public static int BIOME_OIL_DESERT = 161;
|
public static int BIOME_OIL_DESERT = 161;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +1,37 @@
|
||||||
package buildcraft.core.triggers;
|
package buildcraft.core.triggers;
|
||||||
|
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
|
||||||
public class ActionMachineControl extends BCAction {
|
public class ActionMachineControl extends BCAction {
|
||||||
|
|
||||||
public enum Mode {
|
public enum Mode {
|
||||||
|
|
||||||
Unknown, On, Off, Loop
|
Unknown, On, Off, Loop
|
||||||
};
|
};
|
||||||
|
public final Mode mode;
|
||||||
|
|
||||||
Mode mode;
|
public ActionMachineControl(Mode mode) {
|
||||||
|
super("buildcraft:machine." + mode.name().toLowerCase(Locale.ENGLISH), "buildcraft.machine." + mode.name().toLowerCase(Locale.ENGLISH));
|
||||||
public ActionMachineControl(int legacyId, Mode mode) {
|
|
||||||
super(legacyId, "buildcraft.machine." + mode.name().toLowerCase(Locale.ENGLISH));
|
|
||||||
|
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
switch (mode) {
|
return StringUtils.localize("gate.action.machine." + mode.name().toLowerCase(Locale.ENGLISH));
|
||||||
case On:
|
|
||||||
return "On";
|
|
||||||
case Off:
|
|
||||||
return "Off";
|
|
||||||
case Loop:
|
|
||||||
return "Loop";
|
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIconIndex() {
|
public int getIconIndex() {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case On:
|
case On:
|
||||||
return ActionTriggerIconProvider.Action_MachineControl_On;
|
return ActionTriggerIconProvider.Action_MachineControl_On;
|
||||||
case Off:
|
case Off:
|
||||||
return ActionTriggerIconProvider.Action_MachineControl_Off;
|
return ActionTriggerIconProvider.Action_MachineControl_Off;
|
||||||
case Loop:
|
case Loop:
|
||||||
default:
|
default:
|
||||||
return ActionTriggerIconProvider.Action_MachineControl_Loop;
|
return ActionTriggerIconProvider.Action_MachineControl_Loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) SpaceToad, 2011
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
* http://www.mod-buildcraft.com
|
|
||||||
*
|
*
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.core.triggers;
|
package buildcraft.core.triggers;
|
||||||
|
|
||||||
|
|
||||||
public class ActionRedstoneOutput extends BCAction {
|
public class ActionRedstoneOutput extends BCAction {
|
||||||
|
|
||||||
public ActionRedstoneOutput(int legacyId) {
|
public ActionRedstoneOutput() {
|
||||||
super(legacyId, "buildcraft.redstone.output");
|
super("buildcraft:redstone.output", "buildcraft.redstone.output");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
package buildcraft.core.triggers;
|
package buildcraft.core.triggers;
|
||||||
|
|
||||||
import buildcraft.api.gates.ActionManager;
|
import buildcraft.api.gates.ActionManager;
|
||||||
|
import static buildcraft.api.gates.ActionManager.actions;
|
||||||
import buildcraft.api.gates.IAction;
|
import buildcraft.api.gates.IAction;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
@ -16,22 +17,20 @@ import net.minecraft.util.Icon;
|
||||||
|
|
||||||
public abstract class BCAction implements IAction {
|
public abstract class BCAction implements IAction {
|
||||||
|
|
||||||
protected final int legacyId;
|
|
||||||
protected final String uniqueTag;
|
protected final String uniqueTag;
|
||||||
|
|
||||||
public BCAction(String uniqueTag) {
|
|
||||||
this(-1, uniqueTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* UniqueTag accepts multiple possible tags, use this feature to migrate to
|
||||||
|
* more standardized tags if needed, otherwise just pass a single string.
|
||||||
|
* The first passed string will be the one used when saved to disk.
|
||||||
*
|
*
|
||||||
* @param legacyId this should be -1 for new Actions
|
|
||||||
* @param uniqueTag
|
* @param uniqueTag
|
||||||
*/
|
*/
|
||||||
public BCAction(int legacyId, String uniqueTag) {
|
public BCAction(String... uniqueTag) {
|
||||||
this.legacyId = legacyId;
|
this.uniqueTag = uniqueTag[0];
|
||||||
this.uniqueTag = uniqueTag;
|
for (String tag : uniqueTag) {
|
||||||
ActionManager.registerAction(this);
|
ActionManager.actions.put(tag, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,11 +38,6 @@ public abstract class BCAction implements IAction {
|
||||||
return uniqueTag;
|
return uniqueTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLegacyId() {
|
|
||||||
return this.legacyId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getIconIndex() {
|
public int getIconIndex() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,20 @@ import net.minecraft.util.Icon;
|
||||||
*/
|
*/
|
||||||
public abstract class BCTrigger implements ITrigger {
|
public abstract class BCTrigger implements ITrigger {
|
||||||
|
|
||||||
protected final int legacyId;
|
|
||||||
protected final String uniqueTag;
|
protected final String uniqueTag;
|
||||||
|
|
||||||
public BCTrigger(int legacyId, String uniqueTag) {
|
/**
|
||||||
this.legacyId = legacyId;
|
* UniqueTag accepts multiple possible tags, use this feature to migrate to
|
||||||
this.uniqueTag = uniqueTag;
|
* more standardized tags if needed, otherwise just pass a single string.
|
||||||
ActionManager.registerTrigger(this);
|
* The first passed string will be the one used when saved to disk.
|
||||||
|
*
|
||||||
|
* @param uniqueTag
|
||||||
|
*/
|
||||||
|
public BCTrigger(String... uniqueTag) {
|
||||||
|
this.uniqueTag = uniqueTag[0];
|
||||||
|
for (String tag : uniqueTag) {
|
||||||
|
ActionManager.triggers.put(tag, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,11 +44,6 @@ public abstract class BCTrigger implements ITrigger {
|
||||||
return uniqueTag;
|
return uniqueTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLegacyId() {
|
|
||||||
return this.legacyId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getIconIndex() {
|
public int getIconIndex() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ package buildcraft.core.triggers;
|
||||||
|
|
||||||
import buildcraft.api.gates.ITileTrigger;
|
import buildcraft.api.gates.ITileTrigger;
|
||||||
import buildcraft.api.gates.ITriggerParameter;
|
import buildcraft.api.gates.ITriggerParameter;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
@ -25,8 +26,8 @@ public class TriggerFluidContainer extends BCTrigger implements ITileTrigger {
|
||||||
};
|
};
|
||||||
public State state;
|
public State state;
|
||||||
|
|
||||||
public TriggerFluidContainer(int legacyId, State state) {
|
public TriggerFluidContainer(State state) {
|
||||||
super(legacyId, "buildcraft.fluid." + state.name().toLowerCase(Locale.ENGLISH));
|
super("buildcraft:fluid." + state.name().toLowerCase(Locale.ENGLISH), "buildcraft.fluid." + state.name().toLowerCase(Locale.ENGLISH));
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,16 +41,7 @@ public class TriggerFluidContainer extends BCTrigger implements ITileTrigger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
switch (state) {
|
return StringUtils.localize("gate.trigger.fluid." + state.name().toLowerCase(Locale.ENGLISH));
|
||||||
case Empty:
|
|
||||||
return "Tank Empty";
|
|
||||||
case Contains:
|
|
||||||
return "Fluid in Tank";
|
|
||||||
case Space:
|
|
||||||
return "Space for Fluid";
|
|
||||||
default:
|
|
||||||
return "Tank Full";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,6 +13,7 @@ import buildcraft.api.inventory.ISpecialInventory;
|
||||||
import buildcraft.core.inventory.InventoryIterator;
|
import buildcraft.core.inventory.InventoryIterator;
|
||||||
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
|
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
|
||||||
import buildcraft.core.inventory.StackHelper;
|
import buildcraft.core.inventory.StackHelper;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -27,8 +28,8 @@ public class TriggerInventory extends BCTrigger implements ITileTrigger {
|
||||||
};
|
};
|
||||||
public State state;
|
public State state;
|
||||||
|
|
||||||
public TriggerInventory(int legacyId, State state) {
|
public TriggerInventory(State state) {
|
||||||
super(legacyId, "buildcraft.inventory." + state.name().toLowerCase(Locale.ENGLISH));
|
super("buildcraft:inventory." + state.name().toLowerCase(Locale.ENGLISH), "buildcraft.inventory." + state.name().toLowerCase(Locale.ENGLISH));
|
||||||
|
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
@ -43,16 +44,7 @@ public class TriggerInventory extends BCTrigger implements ITileTrigger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
switch (state) {
|
return StringUtils.localize("gate.trigger.inventory." + state.name().toLowerCase(Locale.ENGLISH));
|
||||||
case Empty:
|
|
||||||
return "Inventory Empty";
|
|
||||||
case Contains:
|
|
||||||
return "Items in Inventory";
|
|
||||||
case Space:
|
|
||||||
return "Space in Inventory";
|
|
||||||
default:
|
|
||||||
return "Inventory Full";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,7 +89,7 @@ public class TriggerInventory extends BCTrigger implements ITileTrigger {
|
||||||
&& (searchedStack == null || slot.canPutStackInSlot(searchedStack));
|
&& (searchedStack == null || slot.canPutStackInSlot(searchedStack));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!hasSlots)
|
if (!hasSlots)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
|
|
@ -7,32 +7,36 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.core.triggers;
|
package buildcraft.core.triggers;
|
||||||
|
|
||||||
import buildcraft.api.gates.ActionManager;
|
|
||||||
import buildcraft.api.gates.ITileTrigger;
|
import buildcraft.api.gates.ITileTrigger;
|
||||||
import buildcraft.api.gates.ITriggerParameter;
|
import buildcraft.api.gates.ITriggerParameter;
|
||||||
import buildcraft.core.inventory.InventoryIterator;
|
import buildcraft.core.inventory.InventoryIterator;
|
||||||
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
|
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
|
||||||
import buildcraft.core.inventory.StackHelper;
|
import buildcraft.core.inventory.StackHelper;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public class TriggerInventoryLevel extends BCTrigger implements ITileTrigger{
|
public class TriggerInventoryLevel extends BCTrigger implements ITileTrigger {
|
||||||
|
|
||||||
public enum TriggerType {
|
public enum TriggerType {
|
||||||
|
|
||||||
BELOW_25, BELOW_50, BELOW_75
|
BELOW_25(0.25F), BELOW_50(0.5F), BELOW_75(0.75F);
|
||||||
|
public final float level;
|
||||||
|
|
||||||
|
private TriggerType(float level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
public TriggerType type;
|
public TriggerType type;
|
||||||
|
|
||||||
public TriggerInventoryLevel(TriggerType type) {
|
public TriggerInventoryLevel(TriggerType type) {
|
||||||
super(0, "buildcraft.inventorylevel." + type.name().toLowerCase(Locale.ENGLISH));
|
super("buildcraft:inventorylevel." + type.name().toLowerCase(Locale.ENGLISH),
|
||||||
|
"buildcraft.inventorylevel." + type.name().toLowerCase(Locale.ENGLISH),
|
||||||
|
"buildcraft.filteredBuffer." + type.name().toLowerCase(Locale.ENGLISH));
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
// Legacy migration code
|
|
||||||
ActionManager.triggers.put("buildcraft.filteredBuffer." + type.name().toLowerCase(Locale.ENGLISH), this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,14 +51,7 @@ public class TriggerInventoryLevel extends BCTrigger implements ITileTrigger{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
switch (type) {
|
return String.format(StringUtils.localize("gate.trigger.inventorylevel.below"), (int) (type.level * 100));
|
||||||
case BELOW_25:
|
|
||||||
return "Contains < 25%";
|
|
||||||
case BELOW_50:
|
|
||||||
return "Contains < 50%";
|
|
||||||
default:
|
|
||||||
return "Contains < 75%";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -80,15 +77,7 @@ public class TriggerInventoryLevel extends BCTrigger implements ITileTrigger{
|
||||||
|
|
||||||
if (stackSpace > 0) {
|
if (stackSpace > 0) {
|
||||||
float percentage = (float) foundItems / ((float) stackSpace * (float) searchStack.getMaxStackSize());
|
float percentage = (float) foundItems / ((float) stackSpace * (float) searchStack.getMaxStackSize());
|
||||||
|
return percentage < type.level;
|
||||||
switch (type) {
|
|
||||||
case BELOW_25:
|
|
||||||
return percentage < 0.25f;
|
|
||||||
case BELOW_50:
|
|
||||||
return percentage < 0.5f;
|
|
||||||
default:
|
|
||||||
return percentage < 0.75f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ package buildcraft.core.triggers;
|
||||||
import buildcraft.api.gates.ITileTrigger;
|
import buildcraft.api.gates.ITileTrigger;
|
||||||
import buildcraft.api.gates.ITriggerParameter;
|
import buildcraft.api.gates.ITriggerParameter;
|
||||||
import buildcraft.core.IMachine;
|
import buildcraft.core.IMachine;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
|
@ -17,18 +18,15 @@ public class TriggerMachine extends BCTrigger implements ITileTrigger {
|
||||||
|
|
||||||
boolean active;
|
boolean active;
|
||||||
|
|
||||||
public TriggerMachine(int legacyId, boolean active) {
|
public TriggerMachine(boolean active) {
|
||||||
super(legacyId, "buildcraft.work." + (active ? "scheduled" : "done"));
|
super("buildcraft:work." + (active ? "scheduled" : "done"), "buildcraft.work." + (active ? "scheduled" : "done"));
|
||||||
|
|
||||||
this.active = active;
|
this.active = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
if (active)
|
return StringUtils.localize("gate.trigger.machine." + (active ? "scheduled" : "done"));
|
||||||
return "Work Scheduled";
|
|
||||||
else
|
|
||||||
return "Work Done";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
44
common/buildcraft/core/triggers/TriggerRedstoneInput.java
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/**
|
||||||
|
* 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.core.triggers;
|
||||||
|
|
||||||
|
import buildcraft.api.gates.ITriggerParameter;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
|
import buildcraft.transport.IPipeTrigger;
|
||||||
|
import buildcraft.transport.Pipe;
|
||||||
|
|
||||||
|
public class TriggerRedstoneInput extends BCTrigger implements IPipeTrigger {
|
||||||
|
|
||||||
|
boolean active;
|
||||||
|
|
||||||
|
public TriggerRedstoneInput(boolean active) {
|
||||||
|
super("buildcraft:redstone.input." + (active ? "active" : "inactive"), active ? "buildcraft.redtone.input.active" : "buildcraft.redtone.input.inactive");
|
||||||
|
this.active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return StringUtils.localize("gate.trigger.redstone.input." + (active ? "active" : "inactive"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTriggerActive(Pipe pipe, ITriggerParameter parameter) {
|
||||||
|
if (active)
|
||||||
|
return isBeingPowered(pipe);
|
||||||
|
return !isBeingPowered(pipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isBeingPowered(Pipe pipe) {
|
||||||
|
return pipe.container.redstoneInput > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getIconIndex() {
|
||||||
|
return active ? ActionTriggerIconProvider.Trigger_RedstoneInput_Active : ActionTriggerIconProvider.Trigger_RedstoneInput_Inactive;
|
||||||
|
}
|
||||||
|
}
|
|
@ -43,7 +43,8 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
|
|
||||||
public enum EnergyStage {
|
public enum EnergyStage {
|
||||||
|
|
||||||
BLUE, GREEN, YELLOW, RED, OVERHEAT
|
BLUE, GREEN, YELLOW, RED, OVERHEAT;
|
||||||
|
public static final EnergyStage[] VALUES = values();
|
||||||
}
|
}
|
||||||
public static final float MIN_HEAT = 20;
|
public static final float MIN_HEAT = 20;
|
||||||
public static final float IDEAL_HEAT = 100;
|
public static final float IDEAL_HEAT = 100;
|
||||||
|
|
|
@ -15,6 +15,7 @@ import buildcraft.energy.TileEngine;
|
||||||
import buildcraft.energy.TileEngine.EnergyStage;
|
import buildcraft.energy.TileEngine.EnergyStage;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import java.util.Locale;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
|
@ -24,26 +25,17 @@ public class TriggerEngineHeat extends BCTrigger implements ITileTrigger {
|
||||||
|
|
||||||
public EnergyStage stage;
|
public EnergyStage stage;
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private Icon iconBlue, iconGreen, iconYellow, iconRed;
|
private Icon icon;
|
||||||
|
|
||||||
public TriggerEngineHeat(int id, EnergyStage stage, String uniqueTag) {
|
public TriggerEngineHeat(EnergyStage stage) {
|
||||||
super(id, uniqueTag);
|
super("buildcraft:engine.stage." + stage.name().toLowerCase(Locale.ENGLISH), "buildcraft.engine.stage." + stage.name().toLowerCase(Locale.ENGLISH));
|
||||||
|
|
||||||
this.stage = stage;
|
this.stage = stage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
switch (stage) {
|
return StringUtils.localize("gate.trigger.engine." + stage.name().toLowerCase(Locale.ENGLISH));
|
||||||
case BLUE:
|
|
||||||
return StringUtils.localize("gate.trigger.engine.blue");
|
|
||||||
case GREEN:
|
|
||||||
return StringUtils.localize("gate.trigger.engine.green");
|
|
||||||
case YELLOW:
|
|
||||||
return StringUtils.localize("gate.trigger.engine.yellow");
|
|
||||||
default:
|
|
||||||
return StringUtils.localize("gate.trigger.engine.red");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,24 +52,12 @@ public class TriggerEngineHeat extends BCTrigger implements ITileTrigger {
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public Icon getIcon() {
|
public Icon getIcon() {
|
||||||
switch (stage) {
|
return icon;
|
||||||
case BLUE:
|
|
||||||
return iconBlue;
|
|
||||||
case GREEN:
|
|
||||||
return iconGreen;
|
|
||||||
case YELLOW:
|
|
||||||
return iconYellow;
|
|
||||||
default:
|
|
||||||
return iconRed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(IconRegister iconRegister) {
|
public void registerIcons(IconRegister iconRegister) {
|
||||||
iconBlue = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_blue");
|
icon = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_" + stage.name().toLowerCase(Locale.ENGLISH));
|
||||||
iconGreen = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_green");
|
|
||||||
iconYellow = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_yellow");
|
|
||||||
iconRed = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_red");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -613,7 +613,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
|
|
||||||
if (isValid(pipe)) {
|
if (isValid(pipe)) {
|
||||||
pipe.container.scheduleNeighborChange();
|
pipe.container.scheduleNeighborChange();
|
||||||
pipe.container.redstonePowered = world.isBlockIndirectlyGettingPowered(x, y, z);
|
pipe.container.redstoneInput = world.getBlockPowerInput(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import buildcraft.api.gates.GateExpansionController;
|
||||||
import buildcraft.api.gates.IGateExpansion;
|
import buildcraft.api.gates.IGateExpansion;
|
||||||
import buildcraft.api.gates.ITileTrigger;
|
import buildcraft.api.gates.ITileTrigger;
|
||||||
import buildcraft.transport.gates.ItemGate;
|
import buildcraft.transport.gates.ItemGate;
|
||||||
|
import buildcraft.transport.triggers.ActionRedstoneFaderOutput;
|
||||||
import buildcraft.transport.triggers.ActionSignalOutput;
|
import buildcraft.transport.triggers.ActionSignalOutput;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
|
@ -42,7 +43,7 @@ public final class Gate {
|
||||||
public ITriggerParameter[] triggerParameters = new ITriggerParameter[8];
|
public ITriggerParameter[] triggerParameters = new ITriggerParameter[8];
|
||||||
public IAction[] actions = new IAction[8];
|
public IAction[] actions = new IAction[8];
|
||||||
public boolean broadcastSignal[] = new boolean[4];
|
public boolean broadcastSignal[] = new boolean[4];
|
||||||
public boolean broadcastRedstone = false;
|
public int redstoneOutput = 0;
|
||||||
|
|
||||||
// / CONSTRUCTOR
|
// / CONSTRUCTOR
|
||||||
public Gate(Pipe pipe, GateMaterial material, GateLogic logic) {
|
public Gate(Pipe pipe, GateMaterial material, GateLogic logic) {
|
||||||
|
@ -110,7 +111,7 @@ public final class Gate {
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
data.setBoolean("wireState[" + i + "]", broadcastSignal[i]);
|
data.setBoolean("wireState[" + i + "]", broadcastSignal[i]);
|
||||||
}
|
}
|
||||||
data.setBoolean("redstoneState", broadcastRedstone);
|
data.setByte("redstoneOutput", (byte) redstoneOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound data) {
|
public void readFromNBT(NBTTagCompound data) {
|
||||||
|
@ -128,7 +129,7 @@ public final class Gate {
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
broadcastSignal[i] = data.getBoolean("wireState[" + i + "]");
|
broadcastSignal[i] = data.getBoolean("wireState[" + i + "]");
|
||||||
}
|
}
|
||||||
broadcastRedstone = data.getBoolean("redstoneState");
|
redstoneOutput = data.getByte("redstoneOutput");
|
||||||
}
|
}
|
||||||
|
|
||||||
// GUI
|
// GUI
|
||||||
|
@ -154,8 +155,8 @@ public final class Gate {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetGate() {
|
public void resetGate() {
|
||||||
if (broadcastRedstone) {
|
if (redstoneOutput != 0) {
|
||||||
broadcastRedstone = false;
|
redstoneOutput = 0;
|
||||||
pipe.updateNeighbors(true);
|
pipe.updateNeighbors(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,11 +166,11 @@ public final class Gate {
|
||||||
if (b)
|
if (b)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return broadcastRedstone;
|
return redstoneOutput > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEmittingRedstone() {
|
public int getRedstoneOutput() {
|
||||||
return broadcastRedstone;
|
return redstoneOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startResolution() {
|
public void startResolution() {
|
||||||
|
@ -179,10 +180,10 @@ public final class Gate {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resolveActions() {
|
public void resolveActions() {
|
||||||
boolean oldBroadcastRedstone = broadcastRedstone;
|
int oldRedstoneOutput = redstoneOutput;
|
||||||
boolean[] oldBroadcastSignal = broadcastSignal;
|
boolean[] oldBroadcastSignal = broadcastSignal;
|
||||||
|
|
||||||
broadcastRedstone = false;
|
redstoneOutput = 0;
|
||||||
broadcastSignal = new boolean[4];
|
broadcastSignal = new boolean[4];
|
||||||
|
|
||||||
// Tell the gate to prepare for resolving actions. (Disable pulser)
|
// Tell the gate to prepare for resolving actions. (Disable pulser)
|
||||||
|
@ -220,7 +221,9 @@ public final class Gate {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action instanceof ActionRedstoneOutput) {
|
if (action instanceof ActionRedstoneOutput) {
|
||||||
broadcastRedstone = true;
|
redstoneOutput = 15;
|
||||||
|
} else if (action instanceof ActionRedstoneFaderOutput) {
|
||||||
|
redstoneOutput = ((ActionRedstoneFaderOutput) action).level;
|
||||||
} else if (action instanceof ActionSignalOutput) {
|
} else if (action instanceof ActionSignalOutput) {
|
||||||
broadcastSignal[((ActionSignalOutput) action).color.ordinal()] = true;
|
broadcastSignal[((ActionSignalOutput) action).color.ordinal()] = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -237,8 +240,9 @@ public final class Gate {
|
||||||
|
|
||||||
pipe.actionsActivated(activeActions);
|
pipe.actionsActivated(activeActions);
|
||||||
|
|
||||||
if (oldBroadcastRedstone != broadcastRedstone) {
|
if (oldRedstoneOutput != redstoneOutput) {
|
||||||
pipe.container.scheduleRenderUpdate();
|
if (redstoneOutput == 0 ^ oldRedstoneOutput == 0)
|
||||||
|
pipe.container.scheduleRenderUpdate();
|
||||||
pipe.updateNeighbors(true);
|
pipe.updateNeighbors(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,52 +292,25 @@ public final class Gate {
|
||||||
// / TRIGGERS
|
// / TRIGGERS
|
||||||
public void addTrigger(List<ITrigger> list) {
|
public void addTrigger(List<ITrigger> list) {
|
||||||
|
|
||||||
if (pipe.wireSet[PipeWire.Red.ordinal()] && material == GateMaterial.IRON) {
|
for (PipeWire wire : PipeWire.VALUES) {
|
||||||
list.add(BuildCraftTransport.triggerRedSignalActive);
|
if (pipe.wireSet[wire.ordinal()] && material.ordinal() >= wire.ordinal()) {
|
||||||
list.add(BuildCraftTransport.triggerRedSignalInactive);
|
list.add(BuildCraftTransport.triggerPipeWireActive[wire.ordinal()]);
|
||||||
}
|
list.add(BuildCraftTransport.triggerPipeWireInactive[wire.ordinal()]);
|
||||||
|
}
|
||||||
if (pipe.wireSet[PipeWire.Blue.ordinal()] && material == GateMaterial.IRON) {
|
|
||||||
list.add(BuildCraftTransport.triggerBlueSignalActive);
|
|
||||||
list.add(BuildCraftTransport.triggerBlueSignalInactive);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pipe.wireSet[PipeWire.Green.ordinal()] && material == GateMaterial.GOLD) {
|
|
||||||
list.add(BuildCraftTransport.triggerGreenSignalActive);
|
|
||||||
list.add(BuildCraftTransport.triggerGreenSignalInactive);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pipe.wireSet[PipeWire.Yellow.ordinal()] && material == GateMaterial.DIAMOND) {
|
|
||||||
list.add(BuildCraftTransport.triggerYellowSignalActive);
|
|
||||||
list.add(BuildCraftTransport.triggerYellowSignalInactive);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (GateExpansionController expansion : expansions.values()) {
|
for (GateExpansionController expansion : expansions.values()) {
|
||||||
expansion.addTriggers(list);
|
expansion.addTriggers(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (pipe.gate.kind == GateKind.AND_5 || pipe.gate.kind == GateKind.OR_5) {
|
|
||||||
// list.add(BuildCraftTransport.triggerTimerShort);
|
|
||||||
// list.add(BuildCraftTransport.triggerTimerMedium);
|
|
||||||
// list.add(BuildCraftTransport.triggerTimerLong);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// / ACTIONS
|
// / ACTIONS
|
||||||
public void addActions(List<IAction> list) {
|
public void addActions(List<IAction> list) {
|
||||||
if (pipe.wireSet[PipeWire.Red.ordinal()] && material == GateMaterial.IRON)
|
for (PipeWire wire : PipeWire.VALUES) {
|
||||||
list.add(BuildCraftTransport.actionRedSignal);
|
if (pipe.wireSet[wire.ordinal()] && material.ordinal() >= wire.ordinal()) {
|
||||||
|
list.add(BuildCraftTransport.actionPipeWire[wire.ordinal()]);
|
||||||
if (pipe.wireSet[PipeWire.Blue.ordinal()] && material == GateMaterial.IRON)
|
}
|
||||||
list.add(BuildCraftTransport.actionBlueSignal);
|
}
|
||||||
|
|
||||||
if (pipe.wireSet[PipeWire.Green.ordinal()] && material == GateMaterial.GOLD)
|
|
||||||
list.add(BuildCraftTransport.actionGreenSignal);
|
|
||||||
|
|
||||||
if (pipe.wireSet[PipeWire.Yellow.ordinal()] && material == GateMaterial.DIAMOND)
|
|
||||||
list.add(BuildCraftTransport.actionYellowSignal);
|
|
||||||
|
|
||||||
|
|
||||||
for (GateExpansionController expansion : expansions.values()) {
|
for (GateExpansionController expansion : expansions.values()) {
|
||||||
expansion.addActions(list);
|
expansion.addActions(list);
|
||||||
|
|
|
@ -11,10 +11,8 @@ import buildcraft.api.transport.PipeWire;
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.core.SafeTimeTracker;
|
import buildcraft.api.core.SafeTimeTracker;
|
||||||
import buildcraft.api.gates.ActionManager;
|
|
||||||
import buildcraft.api.gates.IAction;
|
import buildcraft.api.gates.IAction;
|
||||||
import buildcraft.api.gates.ITrigger;
|
import buildcraft.api.gates.ITrigger;
|
||||||
import buildcraft.api.gates.TriggerParameter;
|
|
||||||
import buildcraft.core.IDropControlInventory;
|
import buildcraft.core.IDropControlInventory;
|
||||||
import buildcraft.core.inventory.InvUtils;
|
import buildcraft.core.inventory.InvUtils;
|
||||||
import buildcraft.core.network.TilePacketWrapper;
|
import buildcraft.core.network.TilePacketWrapper;
|
||||||
|
@ -224,20 +222,6 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
wireSet[i] = data.getBoolean("wireSet[" + i + "]");
|
wireSet[i] = data.getBoolean("wireSet[" + i + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Legacy update code
|
|
||||||
if (hasGate()) {
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
|
||||||
if (data.hasKey("trigger[" + i + "]"))
|
|
||||||
gate.triggers[i] = ActionManager.getTriggerFromLegacyId(data.getInteger("trigger[" + i + "]"));
|
|
||||||
if (data.hasKey("action[" + i + "]"))
|
|
||||||
gate.actions[i] = ActionManager.getActionFromLegacyId(data.getInteger("action[" + i + "]"));
|
|
||||||
if (data.hasKey("triggerParameters[" + i + "]")) {
|
|
||||||
gate.triggerParameters[i] = new TriggerParameter();
|
|
||||||
gate.triggerParameters[i].readFromNBT(data.getCompoundTag("triggerParameters[" + i + "]"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private boolean initialized = false;
|
private boolean initialized = false;
|
||||||
|
|
||||||
|
@ -360,14 +344,14 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
}
|
}
|
||||||
|
|
||||||
public int isPoweringTo(int side) {
|
public int isPoweringTo(int side) {
|
||||||
if (gate != null && gate.isEmittingRedstone()) {
|
if (gate != null && gate.getRedstoneOutput() > 0) {
|
||||||
ForgeDirection o = ForgeDirection.getOrientation(side).getOpposite();
|
ForgeDirection o = ForgeDirection.getOrientation(side).getOpposite();
|
||||||
TileEntity tile = container.getTile(o);
|
TileEntity tile = container.getTile(o);
|
||||||
|
|
||||||
if (tile instanceof TileGenericPipe && container.isPipeConnected(o))
|
if (tile instanceof TileGenericPipe && container.isPipeConnected(o))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 15;
|
return gate.getRedstoneOutput();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package buildcraft.transport;
|
package buildcraft.transport;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
|
||||||
import buildcraft.api.gates.IOverrideDefaultTriggers;
|
import buildcraft.api.gates.IOverrideDefaultTriggers;
|
||||||
import buildcraft.api.gates.ITrigger;
|
import buildcraft.api.gates.ITrigger;
|
||||||
import buildcraft.api.gates.ITriggerProvider;
|
import buildcraft.api.gates.ITriggerProvider;
|
||||||
import buildcraft.api.transport.IPipeTile;
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.transport.pipes.PipePowerWood;
|
import buildcraft.transport.pipes.PipePowerWood;
|
||||||
|
import buildcraft.transport.triggers.TriggerPipeContents;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -28,19 +28,19 @@ public class PipeTriggerProvider implements ITriggerProvider {
|
||||||
|
|
||||||
switch (tile.getPipeType()) {
|
switch (tile.getPipeType()) {
|
||||||
case ITEM:
|
case ITEM:
|
||||||
result.add(BuildCraftTransport.triggerPipeEmpty);
|
result.add(TriggerPipeContents.PipeContents.empty.trigger);
|
||||||
result.add(BuildCraftTransport.triggerPipeItems);
|
result.add(TriggerPipeContents.PipeContents.containsItems.trigger);
|
||||||
break;
|
break;
|
||||||
case FLUID:
|
case FLUID:
|
||||||
result.add(BuildCraftTransport.triggerPipeEmpty);
|
result.add(TriggerPipeContents.PipeContents.empty.trigger);
|
||||||
result.add(BuildCraftTransport.triggerPipeFluids);
|
result.add(TriggerPipeContents.PipeContents.containsFluids.trigger);
|
||||||
break;
|
break;
|
||||||
case POWER:
|
case POWER:
|
||||||
result.add(BuildCraftTransport.triggerPipeEmpty);
|
result.add(TriggerPipeContents.PipeContents.empty.trigger);
|
||||||
result.add(BuildCraftTransport.triggerPipeContainsEnergy);
|
result.add(TriggerPipeContents.PipeContents.containsEnergy.trigger);
|
||||||
result.add(BuildCraftTransport.triggerPipeTooMuchEnergy);
|
result.add(TriggerPipeContents.PipeContents.tooMuchEnergy.trigger);
|
||||||
if (pipe instanceof PipePowerWood) {
|
if (pipe instanceof PipePowerWood) {
|
||||||
result.add(BuildCraftTransport.triggerPipeRequestsEnergy);
|
result.add(TriggerPipeContents.PipeContents.requestsEnergy.trigger);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
private boolean refreshRenderState = false;
|
private boolean refreshRenderState = false;
|
||||||
private boolean pipeBound = false;
|
private boolean pipeBound = false;
|
||||||
private boolean resyncGateExpansions = false;
|
private boolean resyncGateExpansions = false;
|
||||||
public boolean redstonePowered = false;
|
public int redstoneInput = 0;
|
||||||
private int[] facadeBlocks = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
private int[] facadeBlocks = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
||||||
private int[] facadeMeta = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
private int[] facadeMeta = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
||||||
private boolean[] plugs = new boolean[ForgeDirection.VALID_DIRECTIONS.length];
|
private boolean[] plugs = new boolean[ForgeDirection.VALID_DIRECTIONS.length];
|
||||||
|
@ -116,7 +116,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound nbt) {
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
super.writeToNBT(nbt);
|
super.writeToNBT(nbt);
|
||||||
nbt.setBoolean("redstonePowered", redstonePowered);
|
nbt.setByte("redstoneInput", (byte)redstoneInput);
|
||||||
|
|
||||||
if (pipe != null) {
|
if (pipe != null) {
|
||||||
nbt.setInteger("pipeId", pipe.itemID);
|
nbt.setInteger("pipeId", pipe.itemID);
|
||||||
|
@ -135,7 +135,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
redstonePowered = nbt.getBoolean("redstonePowered");
|
redstoneInput = nbt.getByte("redstoneInput");
|
||||||
|
|
||||||
coreState.pipeId = nbt.getInteger("pipeId");
|
coreState.pipeId = nbt.getInteger("pipeId");
|
||||||
pipe = BlockGenericPipe.createPipe(coreState.pipeId);
|
pipe = BlockGenericPipe.createPipe(coreState.pipeId);
|
||||||
|
|
|
@ -32,7 +32,7 @@ public final class GateDefinition {
|
||||||
|
|
||||||
public static enum GateMaterial {
|
public static enum GateMaterial {
|
||||||
|
|
||||||
REDSTONE("gate_interface_1.png", 146, 1, false), IRON("gate_interface_2.png", 164, 2, true), GOLD("gate_interface_3.png", 200, 4, true), DIAMOND("gate_interface_4.png", 200, 8, true);
|
REDSTONE("gate_interface_1.png", 146, 1, false), IRON("gate_interface_2.png", 164, 2, false), GOLD("gate_interface_3.png", 200, 4, true), DIAMOND("gate_interface_4.png", 200, 8, true);
|
||||||
public static final GateMaterial[] VALUES = values();
|
public static final GateMaterial[] VALUES = values();
|
||||||
public final ResourceLocation guiFile;
|
public final ResourceLocation guiFile;
|
||||||
public final int guiHeight;
|
public final int guiHeight;
|
||||||
|
|
|
@ -15,7 +15,7 @@ import buildcraft.api.gates.IAction;
|
||||||
import buildcraft.api.power.IPowerReceptor;
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.api.power.PowerHandler;
|
import buildcraft.api.power.PowerHandler;
|
||||||
import buildcraft.api.power.PowerHandler.Type;
|
import buildcraft.api.power.PowerHandler.Type;
|
||||||
import buildcraft.transport.triggers.ActionEnergyPulser;
|
import buildcraft.transport.triggers.ActionEnergyPulsar;
|
||||||
import buildcraft.transport.triggers.ActionSingleEnergyPulse;
|
import buildcraft.transport.triggers.ActionSingleEnergyPulse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -61,7 +61,7 @@ public class GateExpansionPulsar extends GateExpansionBuildcraft implements IGat
|
||||||
@Override
|
@Override
|
||||||
public boolean resolveAction(IAction action, int count) {
|
public boolean resolveAction(IAction action, int count) {
|
||||||
|
|
||||||
if (action instanceof ActionEnergyPulser) {
|
if (action instanceof ActionEnergyPulsar) {
|
||||||
enablePulse(count);
|
enablePulse(count);
|
||||||
return true;
|
return true;
|
||||||
} else if (action instanceof ActionSingleEnergyPulse) {
|
} else if (action instanceof ActionSingleEnergyPulse) {
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) SpaceToad, 2011-2012
|
||||||
|
* 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.transport.gates;
|
||||||
|
|
||||||
|
import buildcraft.api.gates.GateExpansionController;
|
||||||
|
import buildcraft.api.gates.IGateExpansion;
|
||||||
|
import buildcraft.BuildCraftTransport;
|
||||||
|
import buildcraft.api.gates.IAction;
|
||||||
|
import buildcraft.api.gates.ITrigger;
|
||||||
|
import buildcraft.api.gates.ITriggerParameter;
|
||||||
|
import buildcraft.transport.triggers.TriggerClockTimer;
|
||||||
|
import buildcraft.transport.triggers.TriggerClockTimer.Time;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author CovertJaguar <http://www.railcraft.info/>
|
||||||
|
*/
|
||||||
|
public class GateExpansionRedstoneFader extends GateExpansionBuildcraft implements IGateExpansion {
|
||||||
|
|
||||||
|
public static GateExpansionRedstoneFader INSTANCE = new GateExpansionRedstoneFader();
|
||||||
|
|
||||||
|
private GateExpansionRedstoneFader() {
|
||||||
|
super("fader");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GateExpansionController makeController(TileEntity pipeTile) {
|
||||||
|
return new GateExpansionControllerRedstoneFader(pipeTile);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class GateExpansionControllerRedstoneFader extends GateExpansionController {
|
||||||
|
|
||||||
|
public GateExpansionControllerRedstoneFader(TileEntity pipeTile) {
|
||||||
|
super(GateExpansionRedstoneFader.this, pipeTile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTriggers(List<ITrigger> list) {
|
||||||
|
super.addTriggers(list);
|
||||||
|
list.addAll(Arrays.asList(BuildCraftTransport.triggerRedstoneLevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addActions(List<IAction> list) {
|
||||||
|
super.addActions(list);
|
||||||
|
list.addAll(Arrays.asList(BuildCraftTransport.actionRedstoneLevel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -88,6 +88,7 @@ public class GateFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
Gate gate = makeGate(pipe, material, logic);
|
Gate gate = makeGate(pipe, material, logic);
|
||||||
|
gate.readFromNBT(nbt);
|
||||||
|
|
||||||
if (nbt.hasKey("Pulser")) {
|
if (nbt.hasKey("Pulser")) {
|
||||||
NBTTagCompound pulsarTag = nbt.getCompoundTag("Pulser");
|
NBTTagCompound pulsarTag = nbt.getCompoundTag("Pulser");
|
||||||
|
|
|
@ -45,7 +45,6 @@ public abstract class PipeLogicIron {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isValidFacing(ForgeDirection side) {
|
private boolean isValidFacing(ForgeDirection side) {
|
||||||
if (!pipe.container.isPipeConnected(side))
|
if (!pipe.container.isPipeConnected(side))
|
||||||
return false;
|
return false;
|
||||||
|
@ -73,7 +72,7 @@ public abstract class PipeLogicIron {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setFacing(ForgeDirection facing) {
|
public boolean setFacing(ForgeDirection facing) {
|
||||||
if (isValidFacing(facing) && facing.ordinal() != pipe.container.getBlockMetadata()) {
|
if (facing.ordinal() != pipe.container.getBlockMetadata() && isValidFacing(facing)) {
|
||||||
pipe.container.worldObj.setBlockMetadataWithNotify(pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, facing.ordinal(), 3);
|
pipe.container.worldObj.setBlockMetadataWithNotify(pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, facing.ordinal(), 3);
|
||||||
pipe.container.scheduleRenderUpdate();
|
pipe.container.scheduleRenderUpdate();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2,11 +2,12 @@ package buildcraft.transport.triggers;
|
||||||
|
|
||||||
import buildcraft.core.triggers.ActionTriggerIconProvider;
|
import buildcraft.core.triggers.ActionTriggerIconProvider;
|
||||||
import buildcraft.core.triggers.BCAction;
|
import buildcraft.core.triggers.BCAction;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
|
|
||||||
public class ActionEnergyPulser extends BCAction {
|
public class ActionEnergyPulsar extends BCAction {
|
||||||
|
|
||||||
public ActionEnergyPulser(int legacyId) {
|
public ActionEnergyPulsar() {
|
||||||
super(legacyId, "buildcraft.pulser.constant");
|
super("buildcraft:pulsar.constant", "buildcraft.pulser.constant");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,7 +17,7 @@ public class ActionEnergyPulser extends BCAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return "Energy Pulser";
|
return StringUtils.localize("gate.action.pulsar.constant");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -20,7 +20,7 @@ public class ActionExtractionPreset extends BCAction {
|
||||||
public final EnumColor color;
|
public final EnumColor color;
|
||||||
|
|
||||||
public ActionExtractionPreset(EnumColor color) {
|
public ActionExtractionPreset(EnumColor color) {
|
||||||
super("buildcraft.extraction.preset." + color.getTag());
|
super("buildcraft:extraction.preset." + color.getTag(), "buildcraft.extraction.preset." + color.getTag());
|
||||||
|
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class ActionPipeColor extends BCAction {
|
||||||
public final EnumColor color;
|
public final EnumColor color;
|
||||||
|
|
||||||
public ActionPipeColor(EnumColor color) {
|
public ActionPipeColor(EnumColor color) {
|
||||||
super("buildcraft.pipe." + color.getTag());
|
super("buildcraft:pipe.color." + color.getTag(), "buildcraft.pipe." + color.getTag());
|
||||||
|
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class ActionPipeDirection extends BCAction {
|
||||||
public final ForgeDirection direction;
|
public final ForgeDirection direction;
|
||||||
|
|
||||||
public ActionPipeDirection(ForgeDirection direction) {
|
public ActionPipeDirection(ForgeDirection direction) {
|
||||||
super("buildcraft.pipe.dir." + direction.name().toLowerCase(Locale.ENGLISH));
|
super("buildcraft:pipe.dir." + direction.name().toLowerCase(Locale.ENGLISH), "buildcraft.pipe.dir." + direction.name().toLowerCase(Locale.ENGLISH));
|
||||||
|
|
||||||
this.direction = direction;
|
this.direction = direction;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class ActionPowerLimiter extends BCAction {
|
||||||
public final PowerMode limit;
|
public final PowerMode limit;
|
||||||
|
|
||||||
public ActionPowerLimiter(PowerMode limit) {
|
public ActionPowerLimiter(PowerMode limit) {
|
||||||
super("buildcraft.power.limiter." + limit.name().toLowerCase(Locale.ENGLISH));
|
super("buildcraft:power.limiter." + limit.name().toLowerCase(Locale.ENGLISH), "buildcraft.power.limiter." + limit.name().toLowerCase(Locale.ENGLISH));
|
||||||
|
|
||||||
this.limit = limit;
|
this.limit = limit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/**
|
||||||
|
* 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.transport.triggers;
|
||||||
|
|
||||||
|
import buildcraft.core.triggers.BCAction;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
|
import net.minecraft.util.Icon;
|
||||||
|
|
||||||
|
public class ActionRedstoneFaderOutput extends BCAction {
|
||||||
|
|
||||||
|
public final int level;
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private Icon icon;
|
||||||
|
|
||||||
|
public ActionRedstoneFaderOutput(int level) {
|
||||||
|
super(String.format("buildcraft:redstone.output.%02d", level));
|
||||||
|
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return String.format(StringUtils.localize("gate.trigger.redstone.input.level"), level);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public Icon getIcon() {
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerIcons(IconRegister iconRegister) {
|
||||||
|
icon = iconRegister.registerIcon(String.format("buildcraft:triggers/redstone_%02d", level));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,58 +1,45 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) SpaceToad, 2011
|
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||||
* http://www.mod-buildcraft.com
|
|
||||||
*
|
*
|
||||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
* 1.0, or MMPL. Please check the contents of the license located in
|
||||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package buildcraft.transport.triggers;
|
package buildcraft.transport.triggers;
|
||||||
|
|
||||||
import buildcraft.core.triggers.ActionTriggerIconProvider;
|
import buildcraft.core.triggers.ActionTriggerIconProvider;
|
||||||
import buildcraft.core.triggers.BCAction;
|
import buildcraft.core.triggers.BCAction;
|
||||||
import buildcraft.transport.Pipe;
|
|
||||||
import buildcraft.api.transport.PipeWire;
|
import buildcraft.api.transport.PipeWire;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class ActionSignalOutput extends BCAction {
|
public class ActionSignalOutput extends BCAction {
|
||||||
|
|
||||||
public PipeWire color;
|
public PipeWire color;
|
||||||
|
|
||||||
public ActionSignalOutput(int id, PipeWire color) {
|
public ActionSignalOutput(PipeWire color) {
|
||||||
super(id, "buildcraft.pipe.wire.output." + color.name().toLowerCase(Locale.ENGLISH));
|
super("buildcraft:pipe.wire.output." + color.name().toLowerCase(Locale.ENGLISH), "buildcraft.pipe.wire.output." + color.name().toLowerCase(Locale.ENGLISH));
|
||||||
|
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
switch (color) {
|
return String.format(StringUtils.localize("gate.action.pipe.wire"), StringUtils.localize("color." + color.name().toLowerCase(Locale.ENGLISH)));
|
||||||
case Red:
|
|
||||||
return "Red Pipe Signal";
|
|
||||||
case Blue:
|
|
||||||
return "Blue Pipe Signal";
|
|
||||||
case Green:
|
|
||||||
return "Green Pipe Signal";
|
|
||||||
case Yellow:
|
|
||||||
return "Yellow Pipe Signal";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIconIndex() {
|
public int getIconIndex() {
|
||||||
switch (color) {
|
switch (color) {
|
||||||
case Red:
|
case Red:
|
||||||
return ActionTriggerIconProvider.Trigger_PipeSignal_Red_Active;
|
return ActionTriggerIconProvider.Trigger_PipeSignal_Red_Active;
|
||||||
case Blue:
|
case Blue:
|
||||||
return ActionTriggerIconProvider.Trigger_PipeSignal_Blue_Active;
|
return ActionTriggerIconProvider.Trigger_PipeSignal_Blue_Active;
|
||||||
case Green:
|
case Green:
|
||||||
return ActionTriggerIconProvider.Trigger_PipeSignal_Green_Active;
|
return ActionTriggerIconProvider.Trigger_PipeSignal_Green_Active;
|
||||||
case Yellow:
|
case Yellow:
|
||||||
default:
|
default:
|
||||||
return ActionTriggerIconProvider.Trigger_PipeSignal_Yellow_Active;
|
return ActionTriggerIconProvider.Trigger_PipeSignal_Yellow_Active;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,12 @@ package buildcraft.transport.triggers;
|
||||||
|
|
||||||
import buildcraft.core.triggers.ActionTriggerIconProvider;
|
import buildcraft.core.triggers.ActionTriggerIconProvider;
|
||||||
import buildcraft.core.triggers.BCAction;
|
import buildcraft.core.triggers.BCAction;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
|
|
||||||
public class ActionSingleEnergyPulse extends BCAction {
|
public class ActionSingleEnergyPulse extends BCAction {
|
||||||
|
|
||||||
public ActionSingleEnergyPulse(int legacyId) {
|
public ActionSingleEnergyPulse() {
|
||||||
super(legacyId, "buildcraft.pulser.single");
|
super("buildcraft:pulsar.single", "buildcraft.pulser.single");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,6 +17,6 @@ public class ActionSingleEnergyPulse extends BCAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return "Single Energy Pulse";
|
return StringUtils.localize("gate.action.pulsar.single");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,23 +14,23 @@ public class TriggerClockTimer extends BCTrigger {
|
||||||
SHORT(5), MEDIUM(10), LONG(15);
|
SHORT(5), MEDIUM(10), LONG(15);
|
||||||
public static final Time[] VALUES = values();
|
public static final Time[] VALUES = values();
|
||||||
public final int delay;
|
public final int delay;
|
||||||
private Icon icon;
|
|
||||||
|
|
||||||
private Time(int delay) {
|
private Time(int delay) {
|
||||||
this.delay = delay;
|
this.delay = delay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public final Time time;
|
public final Time time;
|
||||||
|
private Icon icon;
|
||||||
|
|
||||||
public TriggerClockTimer(Time time) {
|
public TriggerClockTimer(Time time) {
|
||||||
super(-1, "buildcraft.timer." + time.name().toLowerCase(Locale.ENGLISH));
|
super("buildcraft:timer." + time.name().toLowerCase(Locale.ENGLISH));
|
||||||
|
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Icon getIcon() {
|
public Icon getIcon() {
|
||||||
return time.icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,15 +38,8 @@ public class TriggerClockTimer extends BCTrigger {
|
||||||
return String.format(StringUtils.localize("gate.trigger.timer"), time.delay);
|
return String.format(StringUtils.localize("gate.trigger.timer"), time.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasParameter() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IconRegister iconRegister) {
|
public void registerIcons(IconRegister iconRegister) {
|
||||||
Time.SHORT.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_timer_short");
|
icon = iconRegister.registerIcon("buildcraft:triggers/trigger_timer_" + time.name().toLowerCase(Locale.ENGLISH));
|
||||||
Time.MEDIUM.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_timer_medium");
|
|
||||||
Time.LONG.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_timer_long");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import buildcraft.transport.TravelingItem;
|
||||||
import buildcraft.transport.pipes.PipePowerWood;
|
import buildcraft.transport.pipes.PipePowerWood;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import java.util.Locale;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
@ -28,33 +29,30 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
||||||
|
|
||||||
public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
||||||
|
|
||||||
public enum Kind {
|
public enum PipeContents {
|
||||||
|
|
||||||
Empty("buildcraft.pipe.contents.empty"),
|
empty,
|
||||||
ContainsItems("buildcraft.pipe.contents.containsItems"),
|
containsItems,
|
||||||
ContainsFluids("buildcraft.pipe.contents.containsFluids"),
|
containsFluids,
|
||||||
ContainsEnergy("buildcraft.pipe.contents.containsEnergy"),
|
containsEnergy,
|
||||||
RequestsEnergy("buildcraft.pipe.contents.requestsEnergy"),
|
requestsEnergy,
|
||||||
TooMuchEnergy("buildcraft.pipe.contents.tooMuchEnergy");
|
tooMuchEnergy;
|
||||||
private Icon icon;
|
public BCTrigger trigger;
|
||||||
public final String tag;
|
|
||||||
|
|
||||||
private Kind(String tag) {
|
|
||||||
this.tag = tag;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
Kind kind;
|
private PipeContents kind;
|
||||||
|
private Icon icon;
|
||||||
|
|
||||||
public TriggerPipeContents(int id, Kind kind) {
|
public TriggerPipeContents(PipeContents kind) {
|
||||||
super(id, kind.tag);
|
super("buildcraft:pipe.contents." + kind.name().toLowerCase(Locale.ENGLISH), "buildcraft.pipe.contents." + kind.name());
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
|
kind.trigger = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasParameter() {
|
public boolean hasParameter() {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case ContainsItems:
|
case containsItems:
|
||||||
case ContainsFluids:
|
case containsFluids:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -63,23 +61,7 @@ public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
|
return StringUtils.localize("gate.trigger.pipe." + kind.name());
|
||||||
switch (kind) {
|
|
||||||
case Empty:
|
|
||||||
return StringUtils.localize("gate.trigger.pipe.empty");
|
|
||||||
case ContainsItems:
|
|
||||||
return StringUtils.localize("gate.trigger.pipe.containsItems");
|
|
||||||
case ContainsFluids:
|
|
||||||
return StringUtils.localize("gate.trigger.pipe.containsFluids");
|
|
||||||
case ContainsEnergy:
|
|
||||||
return StringUtils.localize("gate.trigger.pipe.containsEnergy");
|
|
||||||
case RequestsEnergy:
|
|
||||||
return StringUtils.localize("gate.trigger.pipe.requestsEnergy");
|
|
||||||
case TooMuchEnergy:
|
|
||||||
return StringUtils.localize("gate.trigger.pipe.tooMuchEnergy");
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,10 +69,10 @@ public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
||||||
if (pipe.transport instanceof PipeTransportItems) {
|
if (pipe.transport instanceof PipeTransportItems) {
|
||||||
PipeTransportItems transportItems = (PipeTransportItems) pipe.transport;
|
PipeTransportItems transportItems = (PipeTransportItems) pipe.transport;
|
||||||
|
|
||||||
if (kind == Kind.Empty)
|
if (kind == PipeContents.empty)
|
||||||
return transportItems.items.isEmpty();
|
return transportItems.items.isEmpty();
|
||||||
else if (kind == Kind.ContainsItems)
|
else if (kind == PipeContents.containsItems)
|
||||||
if (parameter != null && parameter.getItemStack()!= null) {
|
if (parameter != null && parameter.getItemStack() != null) {
|
||||||
for (TravelingItem item : transportItems.items) {
|
for (TravelingItem item : transportItems.items) {
|
||||||
if (item.getItemStack().itemID == parameter.getItemStack().itemID
|
if (item.getItemStack().itemID == parameter.getItemStack().itemID
|
||||||
&& item.getItemStack().getItemDamage() == parameter.getItemStack().getItemDamage())
|
&& item.getItemStack().getItemDamage() == parameter.getItemStack().getItemDamage())
|
||||||
|
@ -107,7 +89,7 @@ public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
||||||
searchedFluid = FluidContainerRegistry.getFluidForFilledItem(parameter.getItemStack());
|
searchedFluid = FluidContainerRegistry.getFluidForFilledItem(parameter.getItemStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kind == Kind.Empty) {
|
if (kind == PipeContents.empty) {
|
||||||
for (FluidTankInfo b : transportFluids.getTankInfo(ForgeDirection.UNKNOWN)) {
|
for (FluidTankInfo b : transportFluids.getTankInfo(ForgeDirection.UNKNOWN)) {
|
||||||
if (b.fluid != null && b.fluid.amount != 0)
|
if (b.fluid != null && b.fluid.amount != 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -127,25 +109,25 @@ public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
||||||
PipeTransportPower transportPower = (PipeTransportPower) pipe.transport;
|
PipeTransportPower transportPower = (PipeTransportPower) pipe.transport;
|
||||||
|
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case Empty:
|
case empty:
|
||||||
for (double s : transportPower.displayPower) {
|
for (double s : transportPower.displayPower) {
|
||||||
if (s > 1e-4)
|
if (s > 1e-4)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case ContainsEnergy:
|
case containsEnergy:
|
||||||
for (double s : transportPower.displayPower) {
|
for (double s : transportPower.displayPower) {
|
||||||
if (s > 1e-4)
|
if (s > 1e-4)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
case RequestsEnergy:
|
case requestsEnergy:
|
||||||
PipePowerWood wood = (PipePowerWood) pipe;
|
PipePowerWood wood = (PipePowerWood) pipe;
|
||||||
return wood.requestsPower();
|
return wood.requestsPower();
|
||||||
default:
|
default:
|
||||||
case TooMuchEnergy:
|
case tooMuchEnergy:
|
||||||
return transportPower.isOverloaded();
|
return transportPower.isOverloaded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,17 +137,12 @@ public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Icon getIcon() {
|
public Icon getIcon() {
|
||||||
return kind.icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(IconRegister iconRegister) {
|
public void registerIcons(IconRegister iconRegister) {
|
||||||
Kind.Empty.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_pipecontents_empty");
|
icon = iconRegister.registerIcon("buildcraft:triggers/trigger_pipecontents_" + kind.name().toLowerCase(Locale.ENGLISH));
|
||||||
Kind.ContainsItems.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_pipecontents_containsitems");
|
|
||||||
Kind.ContainsFluids.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_pipecontents_containsliquid");
|
|
||||||
Kind.ContainsEnergy.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_pipecontents_containsenergy");
|
|
||||||
Kind.RequestsEnergy.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_pipecontents_requestsenergy");
|
|
||||||
Kind.TooMuchEnergy.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_pipecontents_toomuchenergy");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import buildcraft.core.triggers.BCTrigger;
|
||||||
import buildcraft.transport.IPipeTrigger;
|
import buildcraft.transport.IPipeTrigger;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.api.transport.PipeWire;
|
import buildcraft.api.transport.PipeWire;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class TriggerPipeSignal extends BCTrigger implements IPipeTrigger {
|
public class TriggerPipeSignal extends BCTrigger implements IPipeTrigger {
|
||||||
|
@ -20,8 +21,9 @@ public class TriggerPipeSignal extends BCTrigger implements IPipeTrigger {
|
||||||
boolean active;
|
boolean active;
|
||||||
PipeWire color;
|
PipeWire color;
|
||||||
|
|
||||||
public TriggerPipeSignal(int legacyId, boolean active, PipeWire color) {
|
public TriggerPipeSignal(boolean active, PipeWire color) {
|
||||||
super(legacyId, "buildcraft.pipe.wire.input." + color.name().toLowerCase(Locale.ENGLISH) + (active ? ".active" : ".inactive"));
|
super("buildcraft:pipe.wire.input." + color.name().toLowerCase(Locale.ENGLISH) + (active ? ".active" : ".inactive"),
|
||||||
|
"buildcraft.pipe.wire.input." + color.name().toLowerCase(Locale.ENGLISH) + (active ? ".active" : ".inactive"));
|
||||||
|
|
||||||
this.active = active;
|
this.active = active;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
@ -34,31 +36,7 @@ public class TriggerPipeSignal extends BCTrigger implements IPipeTrigger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
if (active) {
|
return String.format(StringUtils.localize("gate.trigger.pipe.wire." + (active ? "active" : "inactive")), StringUtils.localize("color." + color.name().toLowerCase(Locale.ENGLISH)));
|
||||||
switch (color) {
|
|
||||||
case Red:
|
|
||||||
return "Red Pipe Signal On";
|
|
||||||
case Blue:
|
|
||||||
return "Blue Pipe Signal On";
|
|
||||||
case Green:
|
|
||||||
return "Green Pipe Signal On";
|
|
||||||
case Yellow:
|
|
||||||
return "Yellow Pipe Signal On";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (color) {
|
|
||||||
case Red:
|
|
||||||
return "Red Pipe Signal Off";
|
|
||||||
case Blue:
|
|
||||||
return "Blue Pipe Signal Off";
|
|
||||||
case Green:
|
|
||||||
return "Green Pipe Signal Off";
|
|
||||||
case Yellow:
|
|
||||||
return "Yellow Pipe Signal Off";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,6 +9,7 @@ package buildcraft.transport.triggers;
|
||||||
|
|
||||||
import buildcraft.api.gates.ITriggerParameter;
|
import buildcraft.api.gates.ITriggerParameter;
|
||||||
import buildcraft.core.triggers.BCTrigger;
|
import buildcraft.core.triggers.BCTrigger;
|
||||||
|
import buildcraft.core.utils.StringUtils;
|
||||||
import buildcraft.transport.IPipeTrigger;
|
import buildcraft.transport.IPipeTrigger;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
@ -16,50 +17,37 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
|
|
||||||
public class TriggerRedstoneInput extends BCTrigger implements IPipeTrigger {
|
public class TriggerRedstoneFaderInput extends BCTrigger implements IPipeTrigger {
|
||||||
|
|
||||||
boolean active;
|
public final int level;
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private Icon iconActive, iconInactive;
|
private Icon icon;
|
||||||
|
|
||||||
public TriggerRedstoneInput(int legacyId, boolean active) {
|
public TriggerRedstoneFaderInput(int level) {
|
||||||
super(legacyId, active ? "buildcraft.redtone.input.active" : "buildcraft.redtone.input.inactive");
|
super(String.format("buildcraft:redtone.input.%02d", level));
|
||||||
|
|
||||||
this.active = active;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
if (active)
|
return String.format(StringUtils.localize("gate.trigger.redstone.input.level"), level);
|
||||||
return "Redstone Signal On";
|
|
||||||
else
|
|
||||||
return "Redstone Signal Off";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTriggerActive(Pipe pipe, ITriggerParameter parameter) {
|
public boolean isTriggerActive(Pipe pipe, ITriggerParameter parameter) {
|
||||||
if (active)
|
return pipe.container.redstoneInput == level;
|
||||||
return isBeingPowered(pipe);
|
|
||||||
return !isBeingPowered(pipe);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isBeingPowered(Pipe pipe) {
|
|
||||||
return pipe.container.redstonePowered;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public Icon getIcon() {
|
public Icon getIcon() {
|
||||||
if (active)
|
return icon;
|
||||||
return iconActive;
|
|
||||||
else
|
|
||||||
return iconInactive;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(IconRegister iconRegister) {
|
public void registerIcons(IconRegister iconRegister) {
|
||||||
iconActive = iconRegister.registerIcon("buildcraft:triggers/trigger_redstoneinput_active");
|
icon = iconRegister.registerIcon(String.format("buildcraft:triggers/redstone_%02d", level));
|
||||||
iconInactive = iconRegister.registerIcon("buildcraft:triggers/trigger_redstoneinput_inactive");
|
|
||||||
}
|
}
|
||||||
}
|
}
|