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.fuel=Fuel
|
||||
|
||||
gate.action.pipe.item.color=Paint Items %s
|
||||
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.timer=Clock Timer
|
||||
|
||||
|
@ -46,16 +53,32 @@ gate.material.diamond=Diamond
|
|||
gate.name=%s %s 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.containsItems=Items Traversing
|
||||
gate.trigger.pipe.containsFluids=Fluid Traversing
|
||||
gate.trigger.pipe.containsEnergy=Power Traversing
|
||||
gate.trigger.pipe.requestsEnergy=Power Requested
|
||||
gate.trigger.pipe.tooMuchEnergy=Power Overloaded
|
||||
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.pipe.wire.active=%s Pipe Signal On
|
||||
gate.trigger.pipe.wire.inactive=%s Pipe Signal Off
|
||||
gate.trigger.timer=%s Sec Timer
|
||||
|
||||
gui.building.resources=Building Resources
|
||||
|
|
|
@ -66,7 +66,7 @@ import buildcraft.core.triggers.TriggerMachine;
|
|||
import buildcraft.core.utils.BCLog;
|
||||
import buildcraft.core.utils.Localization;
|
||||
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.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
|
@ -124,25 +124,25 @@ public class BuildCraftCore {
|
|||
public static int legacyPipeModel;
|
||||
public static int markerModel;
|
||||
public static int oilModel;
|
||||
public static BCTrigger triggerMachineActive = new TriggerMachine(DefaultProps.TRIGGER_MACHINE_ACTIVE, true);
|
||||
public static BCTrigger triggerMachineInactive = new TriggerMachine(DefaultProps.TRIGGER_MACHINE_INACTIVE, false);
|
||||
public static BCTrigger triggerEmptyInventory = new TriggerInventory(DefaultProps.TRIGGER_EMPTY_INVENTORY, TriggerInventory.State.Empty);
|
||||
public static BCTrigger triggerContainsInventory = new TriggerInventory(DefaultProps.TRIGGER_CONTAINS_INVENTORY, TriggerInventory.State.Contains);
|
||||
public static BCTrigger triggerSpaceInventory = new TriggerInventory(DefaultProps.TRIGGER_SPACE_INVENTORY, TriggerInventory.State.Space);
|
||||
public static BCTrigger triggerFullInventory = new TriggerInventory(DefaultProps.TRIGGER_FULL_INVENTORY, TriggerInventory.State.Full);
|
||||
public static BCTrigger triggerEmptyFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_EMPTY_LIQUID, TriggerFluidContainer.State.Empty);
|
||||
public static BCTrigger triggerContainsFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_CONTAINS_LIQUID, TriggerFluidContainer.State.Contains);
|
||||
public static BCTrigger triggerSpaceFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_SPACE_LIQUID, TriggerFluidContainer.State.Space);
|
||||
public static BCTrigger triggerFullFluid = new TriggerFluidContainer(DefaultProps.TRIGGER_FULL_LIQUID, TriggerFluidContainer.State.Full);
|
||||
public static BCTrigger triggerRedstoneActive = new TriggerRedstoneInput(DefaultProps.TRIGGER_REDSTONE_ACTIVE, true);
|
||||
public static BCTrigger triggerRedstoneInactive = new TriggerRedstoneInput(DefaultProps.TRIGGER_REDSTONE_INACTIVE, false);
|
||||
public static BCTrigger triggerMachineActive = new TriggerMachine(true);
|
||||
public static BCTrigger triggerMachineInactive = new TriggerMachine(false);
|
||||
public static BCTrigger triggerEmptyInventory = new TriggerInventory(TriggerInventory.State.Empty);
|
||||
public static BCTrigger triggerContainsInventory = new TriggerInventory(TriggerInventory.State.Contains);
|
||||
public static BCTrigger triggerSpaceInventory = new TriggerInventory(TriggerInventory.State.Space);
|
||||
public static BCTrigger triggerFullInventory = new TriggerInventory(TriggerInventory.State.Full);
|
||||
public static BCTrigger triggerEmptyFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Empty);
|
||||
public static BCTrigger triggerContainsFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Contains);
|
||||
public static BCTrigger triggerSpaceFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Space);
|
||||
public static BCTrigger triggerFullFluid = new TriggerFluidContainer(TriggerFluidContainer.State.Full);
|
||||
public static BCTrigger triggerRedstoneActive = new TriggerRedstoneInput(true);
|
||||
public static BCTrigger triggerRedstoneInactive = new TriggerRedstoneInput(false);
|
||||
public static BCTrigger triggerInventoryBelow25 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_25);
|
||||
public static BCTrigger triggerInventoryBelow50 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_50);
|
||||
public static BCTrigger triggerInventoryBelow75 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_75);
|
||||
public static BCAction actionRedstone = new ActionRedstoneOutput(DefaultProps.ACTION_REDSTONE);
|
||||
public static BCAction actionOn = new ActionMachineControl(DefaultProps.ACTION_ON, Mode.On);
|
||||
public static BCAction actionOff = new ActionMachineControl(DefaultProps.ACTION_OFF, Mode.Off);
|
||||
public static BCAction actionLoop = new ActionMachineControl(DefaultProps.ACTION_LOOP, Mode.Loop);
|
||||
public static BCAction actionRedstone = new ActionRedstoneOutput();
|
||||
public static BCAction actionOn = new ActionMachineControl(Mode.On);
|
||||
public static BCAction actionOff = new ActionMachineControl(Mode.Off);
|
||||
public static BCAction actionLoop = new ActionMachineControl(Mode.Loop);
|
||||
public static boolean loadDefaultRecipes = true;
|
||||
public static boolean forcePneumaticPower = true;
|
||||
public static boolean consumeWaterSources = false;
|
||||
|
|
|
@ -84,10 +84,10 @@ public class BuildCraftEnergy {
|
|||
public static boolean canOilBurn;
|
||||
public static double oilWellScalar = 1.0;
|
||||
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 triggerGreenEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_GREEN_ENGINE_HEAT, EnergyStage.GREEN, "buildcraft.engine.stage.green");
|
||||
public static BCTrigger triggerYellowEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_YELLOW_ENGINE_HEAT, EnergyStage.YELLOW, "buildcraft.engine.stage.yellow");
|
||||
public static BCTrigger triggerRedEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_RED_ENGINE_HEAT, EnergyStage.RED, "buildcraft.engine.stage.red");
|
||||
public static BCTrigger triggerBlueEngineHeat = new TriggerEngineHeat(EnergyStage.BLUE);
|
||||
public static BCTrigger triggerGreenEngineHeat = new TriggerEngineHeat(EnergyStage.GREEN);
|
||||
public static BCTrigger triggerYellowEngineHeat = new TriggerEngineHeat(EnergyStage.YELLOW);
|
||||
public static BCTrigger triggerRedEngineHeat = new TriggerEngineHeat(EnergyStage.RED);
|
||||
@Instance("BuildCraft|Energy")
|
||||
public static BuildCraftEnergy instance;
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ import buildcraft.transport.blueprints.BptItemPipeWooden;
|
|||
import buildcraft.transport.gates.GateExpansionPulsar;
|
||||
import buildcraft.api.gates.GateExpansions;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.transport.gates.GateExpansionRedstoneFader;
|
||||
import buildcraft.transport.gates.GateExpansionTimer;
|
||||
import buildcraft.transport.network.PacketHandlerTransport;
|
||||
import buildcraft.transport.network.TransportConnectionHandler;
|
||||
|
@ -75,7 +76,7 @@ import buildcraft.transport.pipes.PipePowerQuartz;
|
|||
import buildcraft.transport.pipes.PipePowerStone;
|
||||
import buildcraft.transport.pipes.PipePowerWood;
|
||||
import buildcraft.transport.pipes.PipeStructureCobblestone;
|
||||
import buildcraft.transport.triggers.ActionEnergyPulser;
|
||||
import buildcraft.transport.triggers.ActionEnergyPulsar;
|
||||
import buildcraft.transport.triggers.ActionExtractionPreset;
|
||||
import buildcraft.transport.triggers.ActionPipeColor;
|
||||
import buildcraft.transport.triggers.ActionPipeDirection;
|
||||
|
@ -85,8 +86,10 @@ import buildcraft.transport.triggers.ActionSingleEnergyPulse;
|
|||
import buildcraft.transport.triggers.TriggerPipeContents;
|
||||
import buildcraft.transport.triggers.TriggerClockTimer;
|
||||
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.TriggerRedstoneFaderInput;
|
||||
import buildcraft.transport.triggers.ActionRedstoneFaderOutput;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
|
@ -155,30 +158,18 @@ public class BuildCraftTransport {
|
|||
// public static Item pipeItemsStipes;
|
||||
public static Item pipeStructureCobblestone;
|
||||
public static int groupItemsTrigger;
|
||||
public static BCTrigger triggerPipeEmpty = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_EMPTY, Kind.Empty);
|
||||
public static BCTrigger triggerPipeItems = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_ITEMS, Kind.ContainsItems);
|
||||
public static BCTrigger triggerPipeFluids = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_LIQUIDS, Kind.ContainsFluids);
|
||||
public static BCTrigger triggerPipeContainsEnergy = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_CONTAINS_ENERGY, Kind.ContainsEnergy);
|
||||
public static BCTrigger triggerPipeRequestsEnergy = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_REQUESTS_ENERGY, Kind.RequestsEnergy);
|
||||
public static BCTrigger triggerPipeTooMuchEnergy = new TriggerPipeContents(DefaultProps.TRIGGER_PIPE_TOO_MUCH_ENERGY, Kind.TooMuchEnergy);
|
||||
public static BCTrigger triggerRedSignalActive = new TriggerPipeSignal(DefaultProps.TRIGGER_RED_SIGNAL_ACTIVE, true, PipeWire.Red);
|
||||
public static BCTrigger triggerRedSignalInactive = new TriggerPipeSignal(DefaultProps.TRIGGER_RED_SIGNAL_INACTIVE, false, PipeWire.Red);
|
||||
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 BCTrigger[] triggerPipe = new BCTrigger[PipeContents.values().length];
|
||||
public static BCTrigger[] triggerPipeWireActive = new BCTrigger[PipeWire.values().length];
|
||||
public static BCTrigger[] triggerPipeWireInactive = new BCTrigger[PipeWire.values().length];
|
||||
public static BCTrigger[] triggerTimer = new BCTrigger[TriggerClockTimer.Time.VALUES.length];
|
||||
public static BCTrigger[] triggerRedstoneLevel = new BCTrigger[15];
|
||||
public static BCAction[] actionPipeWire = new ActionSignalOutput[PipeWire.values().length];
|
||||
public static BCAction actionEnergyPulser = new ActionEnergyPulsar();
|
||||
public static BCAction actionSingleEnergyPulse = new ActionSingleEnergyPulse();
|
||||
public static BCAction[] actionPipeColor = new BCAction[16];
|
||||
public static BCAction[] actionPipeDirection = new BCAction[16];
|
||||
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 actionExtractionPresetBlue = new ActionExtractionPreset(EnumColor.BLUE);
|
||||
public static BCAction actionExtractionPresetGreen = new ActionExtractionPreset(EnumColor.GREEN);
|
||||
|
@ -267,6 +258,7 @@ public class BuildCraftTransport {
|
|||
|
||||
GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE);
|
||||
GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE);
|
||||
GateExpansions.registerExpansion(GateExpansionRedstoneFader.INSTANCE);
|
||||
|
||||
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";
|
||||
|
@ -413,10 +405,25 @@ public class BuildCraftTransport {
|
|||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
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) {
|
||||
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) {
|
||||
actionPipeColor[color.ordinal()] = new ActionPipeColor(color);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package buildcraft.api.gates;
|
|||
import buildcraft.api.transport.IPipeTile;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.block.Block;
|
||||
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, IAction> actions = new HashMap<String, IAction>();
|
||||
private static LinkedList<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
|
||||
private static LinkedList<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
|
||||
private static List<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
|
||||
private static List<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
|
||||
|
||||
public static void registerTriggerProvider(ITriggerProvider provider) {
|
||||
if (provider != null && !triggerProviders.contains(provider)) {
|
||||
|
@ -28,11 +29,11 @@ public class ActionManager {
|
|||
actions.put(action.getUniqueTag(), action);
|
||||
}
|
||||
|
||||
public static LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity entity) {
|
||||
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
public static List<ITrigger> getNeighborTriggers(Block block, TileEntity entity) {
|
||||
List<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
LinkedList<ITrigger> toAdd = provider.getNeighborTriggers(block, entity);
|
||||
List<ITrigger> toAdd = provider.getNeighborTriggers(block, entity);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (ITrigger t : toAdd) {
|
||||
|
@ -52,12 +53,11 @@ public class ActionManager {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: Use sets not lists
|
||||
public static LinkedList<IAction> getNeighborActions(Block block, TileEntity entity) {
|
||||
LinkedList<IAction> actions = new LinkedList<IAction>();
|
||||
public static List<IAction> getNeighborActions(Block block, TileEntity entity) {
|
||||
List<IAction> actions = new LinkedList<IAction>();
|
||||
|
||||
for (IActionProvider provider : actionProviders) {
|
||||
LinkedList<IAction> toAdd = provider.getNeighborActions(block, entity);
|
||||
List<IAction> toAdd = provider.getNeighborActions(block, entity);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (IAction t : toAdd) {
|
||||
|
@ -71,11 +71,11 @@ public class ActionManager {
|
|||
return actions;
|
||||
}
|
||||
|
||||
public static LinkedList<ITrigger> getPipeTriggers(IPipeTile pipe) {
|
||||
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
public static List<ITrigger> getPipeTriggers(IPipeTile pipe) {
|
||||
List<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
LinkedList<ITrigger> toAdd = provider.getPipeTriggers(pipe);
|
||||
List<ITrigger> toAdd = provider.getPipeTriggers(pipe);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (ITrigger t : toAdd) {
|
||||
|
@ -88,20 +88,4 @@ public class ActionManager {
|
|||
|
||||
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 {
|
||||
|
||||
/**
|
||||
* Return your ID from the old API here, this is only used to convert old
|
||||
* saves to the new format.
|
||||
*/
|
||||
int getLegacyId();
|
||||
|
||||
String getUniqueTag();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -8,11 +8,11 @@ import net.minecraft.util.Icon;
|
|||
public interface ITrigger {
|
||||
|
||||
/**
|
||||
* Return your ID from the old API here, this is only used to convert old
|
||||
* saves to the new format.
|
||||
* Every trigger needs a unique tag, it should be in the format of
|
||||
* "<modid>:<name>".
|
||||
*
|
||||
* @return the unique id
|
||||
*/
|
||||
int getLegacyId();
|
||||
|
||||
String getUniqueTag();
|
||||
|
||||
@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;
|
||||
import cpw.mods.fml.common.API;
|
|
@ -14,6 +14,7 @@ package buildcraft.api.transport;
|
|||
*/
|
||||
public enum PipeWire {
|
||||
Red, Blue, Green, Yellow;
|
||||
public static final PipeWire[] VALUES = values();
|
||||
|
||||
public PipeWire reverse() {
|
||||
switch (this) {
|
||||
|
|
|
@ -16,7 +16,7 @@ public class ActionFiller extends BCAction {
|
|||
public final IFillerPattern pattern;
|
||||
|
||||
public ActionFiller(IFillerPattern pattern) {
|
||||
super(0, "filler:" + pattern.getUniqueTag());
|
||||
super("filler:" + pattern.getUniqueTag());
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,49 +128,6 @@ public class DefaultProps {
|
|||
public static final int FILLER_LIFESPAN_TOUGH = 20;
|
||||
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_DESERT = 161;
|
||||
}
|
||||
|
|
|
@ -1,34 +1,25 @@
|
|||
package buildcraft.core.triggers;
|
||||
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
public class ActionMachineControl extends BCAction {
|
||||
|
||||
public enum Mode {
|
||||
|
||||
Unknown, On, Off, Loop
|
||||
};
|
||||
public final Mode mode;
|
||||
|
||||
Mode mode;
|
||||
|
||||
public ActionMachineControl(int legacyId, Mode mode) {
|
||||
super(legacyId, "buildcraft.machine." + mode.name().toLowerCase(Locale.ENGLISH));
|
||||
public ActionMachineControl(Mode mode) {
|
||||
super("buildcraft:machine." + mode.name().toLowerCase(Locale.ENGLISH), "buildcraft.machine." + mode.name().toLowerCase(Locale.ENGLISH));
|
||||
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
switch (mode) {
|
||||
case On:
|
||||
return "On";
|
||||
case Off:
|
||||
return "Off";
|
||||
case Loop:
|
||||
return "Loop";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
return StringUtils.localize("gate.action.machine." + mode.name().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
public class ActionRedstoneOutput extends BCAction {
|
||||
|
||||
public ActionRedstoneOutput(int legacyId) {
|
||||
super(legacyId, "buildcraft.redstone.output");
|
||||
public ActionRedstoneOutput() {
|
||||
super("buildcraft:redstone.output", "buildcraft.redstone.output");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
package buildcraft.core.triggers;
|
||||
|
||||
import buildcraft.api.gates.ActionManager;
|
||||
import static buildcraft.api.gates.ActionManager.actions;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -16,22 +17,20 @@ import net.minecraft.util.Icon;
|
|||
|
||||
public abstract class BCAction implements IAction {
|
||||
|
||||
protected final int legacyId;
|
||||
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
|
||||
*/
|
||||
public BCAction(int legacyId, String uniqueTag) {
|
||||
this.legacyId = legacyId;
|
||||
this.uniqueTag = uniqueTag;
|
||||
ActionManager.registerAction(this);
|
||||
public BCAction(String... uniqueTag) {
|
||||
this.uniqueTag = uniqueTag[0];
|
||||
for (String tag : uniqueTag) {
|
||||
ActionManager.actions.put(tag, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,11 +38,6 @@ public abstract class BCAction implements IAction {
|
|||
return uniqueTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLegacyId() {
|
||||
return this.legacyId;
|
||||
}
|
||||
|
||||
public int getIconIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,13 +23,20 @@ import net.minecraft.util.Icon;
|
|||
*/
|
||||
public abstract class BCTrigger implements ITrigger {
|
||||
|
||||
protected final int legacyId;
|
||||
protected final String uniqueTag;
|
||||
|
||||
public BCTrigger(int legacyId, String uniqueTag) {
|
||||
this.legacyId = legacyId;
|
||||
this.uniqueTag = uniqueTag;
|
||||
ActionManager.registerTrigger(this);
|
||||
/**
|
||||
* 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 uniqueTag
|
||||
*/
|
||||
public BCTrigger(String... uniqueTag) {
|
||||
this.uniqueTag = uniqueTag[0];
|
||||
for (String tag : uniqueTag) {
|
||||
ActionManager.triggers.put(tag, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,11 +44,6 @@ public abstract class BCTrigger implements ITrigger {
|
|||
return uniqueTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLegacyId() {
|
||||
return this.legacyId;
|
||||
}
|
||||
|
||||
public int getIconIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ package buildcraft.core.triggers;
|
|||
|
||||
import buildcraft.api.gates.ITileTrigger;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
@ -25,8 +26,8 @@ public class TriggerFluidContainer extends BCTrigger implements ITileTrigger {
|
|||
};
|
||||
public State state;
|
||||
|
||||
public TriggerFluidContainer(int legacyId, State state) {
|
||||
super(legacyId, "buildcraft.fluid." + state.name().toLowerCase(Locale.ENGLISH));
|
||||
public TriggerFluidContainer(State state) {
|
||||
super("buildcraft:fluid." + state.name().toLowerCase(Locale.ENGLISH), "buildcraft.fluid." + state.name().toLowerCase(Locale.ENGLISH));
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
|
@ -40,16 +41,7 @@ public class TriggerFluidContainer extends BCTrigger implements ITileTrigger {
|
|||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
switch (state) {
|
||||
case Empty:
|
||||
return "Tank Empty";
|
||||
case Contains:
|
||||
return "Fluid in Tank";
|
||||
case Space:
|
||||
return "Space for Fluid";
|
||||
default:
|
||||
return "Tank Full";
|
||||
}
|
||||
return StringUtils.localize("gate.trigger.fluid." + state.name().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,6 +13,7 @@ import buildcraft.api.inventory.ISpecialInventory;
|
|||
import buildcraft.core.inventory.InventoryIterator;
|
||||
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
|
||||
import buildcraft.core.inventory.StackHelper;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -27,8 +28,8 @@ public class TriggerInventory extends BCTrigger implements ITileTrigger {
|
|||
};
|
||||
public State state;
|
||||
|
||||
public TriggerInventory(int legacyId, State state) {
|
||||
super(legacyId, "buildcraft.inventory." + state.name().toLowerCase(Locale.ENGLISH));
|
||||
public TriggerInventory(State state) {
|
||||
super("buildcraft:inventory." + state.name().toLowerCase(Locale.ENGLISH), "buildcraft.inventory." + state.name().toLowerCase(Locale.ENGLISH));
|
||||
|
||||
this.state = state;
|
||||
}
|
||||
|
@ -43,16 +44,7 @@ public class TriggerInventory extends BCTrigger implements ITileTrigger {
|
|||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
switch (state) {
|
||||
case Empty:
|
||||
return "Inventory Empty";
|
||||
case Contains:
|
||||
return "Items in Inventory";
|
||||
case Space:
|
||||
return "Space in Inventory";
|
||||
default:
|
||||
return "Inventory Full";
|
||||
}
|
||||
return StringUtils.localize("gate.trigger.inventory." + state.name().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
*/
|
||||
package buildcraft.core.triggers;
|
||||
|
||||
import buildcraft.api.gates.ActionManager;
|
||||
import buildcraft.api.gates.ITileTrigger;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.core.inventory.InventoryIterator;
|
||||
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
|
||||
import buildcraft.core.inventory.StackHelper;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -23,16 +23,20 @@ public class TriggerInventoryLevel extends BCTrigger implements ITileTrigger{
|
|||
|
||||
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 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;
|
||||
|
||||
// Legacy migration code
|
||||
ActionManager.triggers.put("buildcraft.filteredBuffer." + type.name().toLowerCase(Locale.ENGLISH), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,14 +51,7 @@ public class TriggerInventoryLevel extends BCTrigger implements ITileTrigger{
|
|||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
switch (type) {
|
||||
case BELOW_25:
|
||||
return "Contains < 25%";
|
||||
case BELOW_50:
|
||||
return "Contains < 50%";
|
||||
default:
|
||||
return "Contains < 75%";
|
||||
}
|
||||
return String.format(StringUtils.localize("gate.trigger.inventorylevel.below"), (int) (type.level * 100));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,15 +77,7 @@ public class TriggerInventoryLevel extends BCTrigger implements ITileTrigger{
|
|||
|
||||
if (stackSpace > 0) {
|
||||
float percentage = (float) foundItems / ((float) stackSpace * (float) searchStack.getMaxStackSize());
|
||||
|
||||
switch (type) {
|
||||
case BELOW_25:
|
||||
return percentage < 0.25f;
|
||||
case BELOW_50:
|
||||
return percentage < 0.5f;
|
||||
default:
|
||||
return percentage < 0.75f;
|
||||
}
|
||||
return percentage < type.level;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ package buildcraft.core.triggers;
|
|||
import buildcraft.api.gates.ITileTrigger;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.core.IMachine;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
|
@ -17,18 +18,15 @@ public class TriggerMachine extends BCTrigger implements ITileTrigger {
|
|||
|
||||
boolean active;
|
||||
|
||||
public TriggerMachine(int legacyId, boolean active) {
|
||||
super(legacyId, "buildcraft.work." + (active ? "scheduled" : "done"));
|
||||
public TriggerMachine(boolean active) {
|
||||
super("buildcraft:work." + (active ? "scheduled" : "done"), "buildcraft.work." + (active ? "scheduled" : "done"));
|
||||
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if (active)
|
||||
return "Work Scheduled";
|
||||
else
|
||||
return "Work Done";
|
||||
return StringUtils.localize("gate.trigger.machine." + (active ? "scheduled" : "done"));
|
||||
}
|
||||
|
||||
@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 {
|
||||
|
||||
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 IDEAL_HEAT = 100;
|
||||
|
|
|
@ -15,6 +15,7 @@ import buildcraft.energy.TileEngine;
|
|||
import buildcraft.energy.TileEngine.EnergyStage;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
|
@ -24,26 +25,17 @@ public class TriggerEngineHeat extends BCTrigger implements ITileTrigger {
|
|||
|
||||
public EnergyStage stage;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon iconBlue, iconGreen, iconYellow, iconRed;
|
||||
private Icon icon;
|
||||
|
||||
public TriggerEngineHeat(int id, EnergyStage stage, String uniqueTag) {
|
||||
super(id, uniqueTag);
|
||||
public TriggerEngineHeat(EnergyStage stage) {
|
||||
super("buildcraft:engine.stage." + stage.name().toLowerCase(Locale.ENGLISH), "buildcraft.engine.stage." + stage.name().toLowerCase(Locale.ENGLISH));
|
||||
|
||||
this.stage = stage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
switch (stage) {
|
||||
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");
|
||||
}
|
||||
return StringUtils.localize("gate.trigger.engine." + stage.name().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,24 +52,12 @@ public class TriggerEngineHeat extends BCTrigger implements ITileTrigger {
|
|||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon() {
|
||||
switch (stage) {
|
||||
case BLUE:
|
||||
return iconBlue;
|
||||
case GREEN:
|
||||
return iconGreen;
|
||||
case YELLOW:
|
||||
return iconYellow;
|
||||
default:
|
||||
return iconRed;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
iconBlue = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_blue");
|
||||
iconGreen = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_green");
|
||||
iconYellow = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_yellow");
|
||||
iconRed = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_red");
|
||||
icon = iconRegister.registerIcon("buildcraft:triggers/trigger_engineheat_" + stage.name().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -613,7 +613,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
|
||||
if (isValid(pipe)) {
|
||||
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.ITileTrigger;
|
||||
import buildcraft.transport.gates.ItemGate;
|
||||
import buildcraft.transport.triggers.ActionRedstoneFaderOutput;
|
||||
import buildcraft.transport.triggers.ActionSignalOutput;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
@ -42,7 +43,7 @@ public final class Gate {
|
|||
public ITriggerParameter[] triggerParameters = new ITriggerParameter[8];
|
||||
public IAction[] actions = new IAction[8];
|
||||
public boolean broadcastSignal[] = new boolean[4];
|
||||
public boolean broadcastRedstone = false;
|
||||
public int redstoneOutput = 0;
|
||||
|
||||
// / CONSTRUCTOR
|
||||
public Gate(Pipe pipe, GateMaterial material, GateLogic logic) {
|
||||
|
@ -110,7 +111,7 @@ public final class Gate {
|
|||
for (int i = 0; i < 4; ++i) {
|
||||
data.setBoolean("wireState[" + i + "]", broadcastSignal[i]);
|
||||
}
|
||||
data.setBoolean("redstoneState", broadcastRedstone);
|
||||
data.setByte("redstoneOutput", (byte) redstoneOutput);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
|
@ -128,7 +129,7 @@ public final class Gate {
|
|||
for (int i = 0; i < 4; ++i) {
|
||||
broadcastSignal[i] = data.getBoolean("wireState[" + i + "]");
|
||||
}
|
||||
broadcastRedstone = data.getBoolean("redstoneState");
|
||||
redstoneOutput = data.getByte("redstoneOutput");
|
||||
}
|
||||
|
||||
// GUI
|
||||
|
@ -154,8 +155,8 @@ public final class Gate {
|
|||
}
|
||||
|
||||
public void resetGate() {
|
||||
if (broadcastRedstone) {
|
||||
broadcastRedstone = false;
|
||||
if (redstoneOutput != 0) {
|
||||
redstoneOutput = 0;
|
||||
pipe.updateNeighbors(true);
|
||||
}
|
||||
}
|
||||
|
@ -165,11 +166,11 @@ public final class Gate {
|
|||
if (b)
|
||||
return true;
|
||||
}
|
||||
return broadcastRedstone;
|
||||
return redstoneOutput > 0;
|
||||
}
|
||||
|
||||
public boolean isEmittingRedstone() {
|
||||
return broadcastRedstone;
|
||||
public int getRedstoneOutput() {
|
||||
return redstoneOutput;
|
||||
}
|
||||
|
||||
public void startResolution() {
|
||||
|
@ -179,10 +180,10 @@ public final class Gate {
|
|||
}
|
||||
|
||||
public void resolveActions() {
|
||||
boolean oldBroadcastRedstone = broadcastRedstone;
|
||||
int oldRedstoneOutput = redstoneOutput;
|
||||
boolean[] oldBroadcastSignal = broadcastSignal;
|
||||
|
||||
broadcastRedstone = false;
|
||||
redstoneOutput = 0;
|
||||
broadcastSignal = new boolean[4];
|
||||
|
||||
// Tell the gate to prepare for resolving actions. (Disable pulser)
|
||||
|
@ -220,7 +221,9 @@ public final class Gate {
|
|||
}
|
||||
|
||||
if (action instanceof ActionRedstoneOutput) {
|
||||
broadcastRedstone = true;
|
||||
redstoneOutput = 15;
|
||||
} else if (action instanceof ActionRedstoneFaderOutput) {
|
||||
redstoneOutput = ((ActionRedstoneFaderOutput) action).level;
|
||||
} else if (action instanceof ActionSignalOutput) {
|
||||
broadcastSignal[((ActionSignalOutput) action).color.ordinal()] = true;
|
||||
} else {
|
||||
|
@ -237,7 +240,8 @@ public final class Gate {
|
|||
|
||||
pipe.actionsActivated(activeActions);
|
||||
|
||||
if (oldBroadcastRedstone != broadcastRedstone) {
|
||||
if (oldRedstoneOutput != redstoneOutput) {
|
||||
if (redstoneOutput == 0 ^ oldRedstoneOutput == 0)
|
||||
pipe.container.scheduleRenderUpdate();
|
||||
pipe.updateNeighbors(true);
|
||||
}
|
||||
|
@ -288,52 +292,25 @@ public final class Gate {
|
|||
// / TRIGGERS
|
||||
public void addTrigger(List<ITrigger> list) {
|
||||
|
||||
if (pipe.wireSet[PipeWire.Red.ordinal()] && material == GateMaterial.IRON) {
|
||||
list.add(BuildCraftTransport.triggerRedSignalActive);
|
||||
list.add(BuildCraftTransport.triggerRedSignalInactive);
|
||||
for (PipeWire wire : PipeWire.VALUES) {
|
||||
if (pipe.wireSet[wire.ordinal()] && material.ordinal() >= wire.ordinal()) {
|
||||
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()) {
|
||||
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
|
||||
public void addActions(List<IAction> list) {
|
||||
if (pipe.wireSet[PipeWire.Red.ordinal()] && material == GateMaterial.IRON)
|
||||
list.add(BuildCraftTransport.actionRedSignal);
|
||||
|
||||
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 (PipeWire wire : PipeWire.VALUES) {
|
||||
if (pipe.wireSet[wire.ordinal()] && material.ordinal() >= wire.ordinal()) {
|
||||
list.add(BuildCraftTransport.actionPipeWire[wire.ordinal()]);
|
||||
}
|
||||
}
|
||||
|
||||
for (GateExpansionController expansion : expansions.values()) {
|
||||
expansion.addActions(list);
|
||||
|
|
|
@ -11,10 +11,8 @@ import buildcraft.api.transport.PipeWire;
|
|||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.IIconProvider;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import buildcraft.api.gates.ActionManager;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.gates.TriggerParameter;
|
||||
import buildcraft.core.IDropControlInventory;
|
||||
import buildcraft.core.inventory.InvUtils;
|
||||
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) {
|
||||
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;
|
||||
|
||||
|
@ -360,14 +344,14 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
}
|
||||
|
||||
public int isPoweringTo(int side) {
|
||||
if (gate != null && gate.isEmittingRedstone()) {
|
||||
if (gate != null && gate.getRedstoneOutput() > 0) {
|
||||
ForgeDirection o = ForgeDirection.getOrientation(side).getOpposite();
|
||||
TileEntity tile = container.getTile(o);
|
||||
|
||||
if (tile instanceof TileGenericPipe && container.isPipeConnected(o))
|
||||
return 0;
|
||||
|
||||
return 15;
|
||||
return gate.getRedstoneOutput();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package buildcraft.transport;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.gates.IOverrideDefaultTriggers;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.gates.ITriggerProvider;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.transport.pipes.PipePowerWood;
|
||||
import buildcraft.transport.triggers.TriggerPipeContents;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -28,19 +28,19 @@ public class PipeTriggerProvider implements ITriggerProvider {
|
|||
|
||||
switch (tile.getPipeType()) {
|
||||
case ITEM:
|
||||
result.add(BuildCraftTransport.triggerPipeEmpty);
|
||||
result.add(BuildCraftTransport.triggerPipeItems);
|
||||
result.add(TriggerPipeContents.PipeContents.empty.trigger);
|
||||
result.add(TriggerPipeContents.PipeContents.containsItems.trigger);
|
||||
break;
|
||||
case FLUID:
|
||||
result.add(BuildCraftTransport.triggerPipeEmpty);
|
||||
result.add(BuildCraftTransport.triggerPipeFluids);
|
||||
result.add(TriggerPipeContents.PipeContents.empty.trigger);
|
||||
result.add(TriggerPipeContents.PipeContents.containsFluids.trigger);
|
||||
break;
|
||||
case POWER:
|
||||
result.add(BuildCraftTransport.triggerPipeEmpty);
|
||||
result.add(BuildCraftTransport.triggerPipeContainsEnergy);
|
||||
result.add(BuildCraftTransport.triggerPipeTooMuchEnergy);
|
||||
result.add(TriggerPipeContents.PipeContents.empty.trigger);
|
||||
result.add(TriggerPipeContents.PipeContents.containsEnergy.trigger);
|
||||
result.add(TriggerPipeContents.PipeContents.tooMuchEnergy.trigger);
|
||||
if (pipe instanceof PipePowerWood) {
|
||||
result.add(BuildCraftTransport.triggerPipeRequestsEnergy);
|
||||
result.add(TriggerPipeContents.PipeContents.requestsEnergy.trigger);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
private boolean refreshRenderState = false;
|
||||
private boolean pipeBound = false;
|
||||
private boolean resyncGateExpansions = false;
|
||||
public boolean redstonePowered = false;
|
||||
public int redstoneInput = 0;
|
||||
private int[] facadeBlocks = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
private int[] facadeMeta = new int[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
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setBoolean("redstonePowered", redstonePowered);
|
||||
nbt.setByte("redstoneInput", (byte)redstoneInput);
|
||||
|
||||
if (pipe != null) {
|
||||
nbt.setInteger("pipeId", pipe.itemID);
|
||||
|
@ -135,7 +135,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
redstonePowered = nbt.getBoolean("redstonePowered");
|
||||
redstoneInput = nbt.getByte("redstoneInput");
|
||||
|
||||
coreState.pipeId = nbt.getInteger("pipeId");
|
||||
pipe = BlockGenericPipe.createPipe(coreState.pipeId);
|
||||
|
|
|
@ -32,7 +32,7 @@ public final class GateDefinition {
|
|||
|
||||
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 final ResourceLocation guiFile;
|
||||
public final int guiHeight;
|
||||
|
|
|
@ -15,7 +15,7 @@ import buildcraft.api.gates.IAction;
|
|||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
import buildcraft.transport.triggers.ActionEnergyPulser;
|
||||
import buildcraft.transport.triggers.ActionEnergyPulsar;
|
||||
import buildcraft.transport.triggers.ActionSingleEnergyPulse;
|
||||
import java.util.List;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -61,7 +61,7 @@ public class GateExpansionPulsar extends GateExpansionBuildcraft implements IGat
|
|||
@Override
|
||||
public boolean resolveAction(IAction action, int count) {
|
||||
|
||||
if (action instanceof ActionEnergyPulser) {
|
||||
if (action instanceof ActionEnergyPulsar) {
|
||||
enablePulse(count);
|
||||
return true;
|
||||
} 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.readFromNBT(nbt);
|
||||
|
||||
if (nbt.hasKey("Pulser")) {
|
||||
NBTTagCompound pulsarTag = nbt.getCompoundTag("Pulser");
|
||||
|
|
|
@ -45,7 +45,6 @@ public abstract class PipeLogicIron {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isValidFacing(ForgeDirection side) {
|
||||
if (!pipe.container.isPipeConnected(side))
|
||||
return false;
|
||||
|
@ -73,7 +72,7 @@ public abstract class PipeLogicIron {
|
|||
}
|
||||
|
||||
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.scheduleRenderUpdate();
|
||||
return true;
|
||||
|
|
|
@ -2,11 +2,12 @@ package buildcraft.transport.triggers;
|
|||
|
||||
import buildcraft.core.triggers.ActionTriggerIconProvider;
|
||||
import buildcraft.core.triggers.BCAction;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public class ActionEnergyPulser extends BCAction {
|
||||
public class ActionEnergyPulsar extends BCAction {
|
||||
|
||||
public ActionEnergyPulser(int legacyId) {
|
||||
super(legacyId, "buildcraft.pulser.constant");
|
||||
public ActionEnergyPulsar() {
|
||||
super("buildcraft:pulsar.constant", "buildcraft.pulser.constant");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +17,7 @@ public class ActionEnergyPulser extends BCAction {
|
|||
|
||||
@Override
|
||||
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 ActionExtractionPreset(EnumColor color) {
|
||||
super("buildcraft.extraction.preset." + color.getTag());
|
||||
super("buildcraft:extraction.preset." + color.getTag(), "buildcraft.extraction.preset." + color.getTag());
|
||||
|
||||
this.color = color;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class ActionPipeColor extends BCAction {
|
|||
public final EnumColor color;
|
||||
|
||||
public ActionPipeColor(EnumColor color) {
|
||||
super("buildcraft.pipe." + color.getTag());
|
||||
super("buildcraft:pipe.color." + color.getTag(), "buildcraft.pipe." + color.getTag());
|
||||
|
||||
this.color = color;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ActionPipeDirection extends BCAction {
|
|||
public final 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;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ActionPowerLimiter extends BCAction {
|
|||
public final 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;
|
||||
}
|
||||
|
|
|
@ -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,44 +1,31 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
* 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
|
||||
* 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.ActionTriggerIconProvider;
|
||||
import buildcraft.core.triggers.BCAction;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ActionSignalOutput extends BCAction {
|
||||
|
||||
public PipeWire color;
|
||||
|
||||
public ActionSignalOutput(int id, PipeWire color) {
|
||||
super(id, "buildcraft.pipe.wire.output." + color.name().toLowerCase(Locale.ENGLISH));
|
||||
public ActionSignalOutput(PipeWire color) {
|
||||
super("buildcraft:pipe.wire.output." + color.name().toLowerCase(Locale.ENGLISH), "buildcraft.pipe.wire.output." + color.name().toLowerCase(Locale.ENGLISH));
|
||||
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
switch (color) {
|
||||
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 "";
|
||||
return String.format(StringUtils.localize("gate.action.pipe.wire"), StringUtils.localize("color." + color.name().toLowerCase(Locale.ENGLISH)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,11 +2,12 @@ package buildcraft.transport.triggers;
|
|||
|
||||
import buildcraft.core.triggers.ActionTriggerIconProvider;
|
||||
import buildcraft.core.triggers.BCAction;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public class ActionSingleEnergyPulse extends BCAction {
|
||||
|
||||
public ActionSingleEnergyPulse(int legacyId) {
|
||||
super(legacyId, "buildcraft.pulser.single");
|
||||
public ActionSingleEnergyPulse() {
|
||||
super("buildcraft:pulsar.single", "buildcraft.pulser.single");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +17,6 @@ public class ActionSingleEnergyPulse extends BCAction {
|
|||
|
||||
@Override
|
||||
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);
|
||||
public static final Time[] VALUES = values();
|
||||
public final int delay;
|
||||
private Icon icon;
|
||||
|
||||
private Time(int delay) {
|
||||
this.delay = delay;
|
||||
}
|
||||
}
|
||||
public final Time time;
|
||||
private Icon icon;
|
||||
|
||||
public TriggerClockTimer(Time time) {
|
||||
super(-1, "buildcraft.timer." + time.name().toLowerCase(Locale.ENGLISH));
|
||||
super("buildcraft:timer." + time.name().toLowerCase(Locale.ENGLISH));
|
||||
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return time.icon;
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,15 +38,8 @@ public class TriggerClockTimer extends BCTrigger {
|
|||
return String.format(StringUtils.localize("gate.trigger.timer"), time.delay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasParameter() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
Time.SHORT.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_timer_short");
|
||||
Time.MEDIUM.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_timer_medium");
|
||||
Time.LONG.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_timer_long");
|
||||
icon = iconRegister.registerIcon("buildcraft:triggers/trigger_timer_" + time.name().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import buildcraft.transport.TravelingItem;
|
|||
import buildcraft.transport.pipes.PipePowerWood;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
@ -28,33 +29,30 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
|||
|
||||
public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
||||
|
||||
public enum Kind {
|
||||
public enum PipeContents {
|
||||
|
||||
Empty("buildcraft.pipe.contents.empty"),
|
||||
ContainsItems("buildcraft.pipe.contents.containsItems"),
|
||||
ContainsFluids("buildcraft.pipe.contents.containsFluids"),
|
||||
ContainsEnergy("buildcraft.pipe.contents.containsEnergy"),
|
||||
RequestsEnergy("buildcraft.pipe.contents.requestsEnergy"),
|
||||
TooMuchEnergy("buildcraft.pipe.contents.tooMuchEnergy");
|
||||
private Icon icon;
|
||||
public final String tag;
|
||||
|
||||
private Kind(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
empty,
|
||||
containsItems,
|
||||
containsFluids,
|
||||
containsEnergy,
|
||||
requestsEnergy,
|
||||
tooMuchEnergy;
|
||||
public BCTrigger trigger;
|
||||
};
|
||||
Kind kind;
|
||||
private PipeContents kind;
|
||||
private Icon icon;
|
||||
|
||||
public TriggerPipeContents(int id, Kind kind) {
|
||||
super(id, kind.tag);
|
||||
public TriggerPipeContents(PipeContents kind) {
|
||||
super("buildcraft:pipe.contents." + kind.name().toLowerCase(Locale.ENGLISH), "buildcraft.pipe.contents." + kind.name());
|
||||
this.kind = kind;
|
||||
kind.trigger = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasParameter() {
|
||||
switch (kind) {
|
||||
case ContainsItems:
|
||||
case ContainsFluids:
|
||||
case containsItems:
|
||||
case containsFluids:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -63,23 +61,7 @@ public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
|||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
|
||||
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 "";
|
||||
return StringUtils.localize("gate.trigger.pipe." + kind.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -87,9 +69,9 @@ public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
|||
if (pipe.transport instanceof PipeTransportItems) {
|
||||
PipeTransportItems transportItems = (PipeTransportItems) pipe.transport;
|
||||
|
||||
if (kind == Kind.Empty)
|
||||
if (kind == PipeContents.empty)
|
||||
return transportItems.items.isEmpty();
|
||||
else if (kind == Kind.ContainsItems)
|
||||
else if (kind == PipeContents.containsItems)
|
||||
if (parameter != null && parameter.getItemStack() != null) {
|
||||
for (TravelingItem item : transportItems.items) {
|
||||
if (item.getItemStack().itemID == parameter.getItemStack().itemID
|
||||
|
@ -107,7 +89,7 @@ public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
|||
searchedFluid = FluidContainerRegistry.getFluidForFilledItem(parameter.getItemStack());
|
||||
}
|
||||
|
||||
if (kind == Kind.Empty) {
|
||||
if (kind == PipeContents.empty) {
|
||||
for (FluidTankInfo b : transportFluids.getTankInfo(ForgeDirection.UNKNOWN)) {
|
||||
if (b.fluid != null && b.fluid.amount != 0)
|
||||
return false;
|
||||
|
@ -127,25 +109,25 @@ public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
|||
PipeTransportPower transportPower = (PipeTransportPower) pipe.transport;
|
||||
|
||||
switch (kind) {
|
||||
case Empty:
|
||||
case empty:
|
||||
for (double s : transportPower.displayPower) {
|
||||
if (s > 1e-4)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
case ContainsEnergy:
|
||||
case containsEnergy:
|
||||
for (double s : transportPower.displayPower) {
|
||||
if (s > 1e-4)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
case RequestsEnergy:
|
||||
case requestsEnergy:
|
||||
PipePowerWood wood = (PipePowerWood) pipe;
|
||||
return wood.requestsPower();
|
||||
default:
|
||||
case TooMuchEnergy:
|
||||
case tooMuchEnergy:
|
||||
return transportPower.isOverloaded();
|
||||
}
|
||||
}
|
||||
|
@ -155,17 +137,12 @@ public class TriggerPipeContents extends BCTrigger implements IPipeTrigger {
|
|||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return kind.icon;
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
Kind.Empty.icon = iconRegister.registerIcon("buildcraft:triggers/trigger_pipecontents_empty");
|
||||
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");
|
||||
icon = iconRegister.registerIcon("buildcraft:triggers/trigger_pipecontents_" + kind.name().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import buildcraft.core.triggers.BCTrigger;
|
|||
import buildcraft.transport.IPipeTrigger;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import java.util.Locale;
|
||||
|
||||
public class TriggerPipeSignal extends BCTrigger implements IPipeTrigger {
|
||||
|
@ -20,8 +21,9 @@ public class TriggerPipeSignal extends BCTrigger implements IPipeTrigger {
|
|||
boolean active;
|
||||
PipeWire color;
|
||||
|
||||
public TriggerPipeSignal(int legacyId, boolean active, PipeWire color) {
|
||||
super(legacyId, "buildcraft.pipe.wire.input." + color.name().toLowerCase(Locale.ENGLISH) + (active ? ".active" : ".inactive"));
|
||||
public TriggerPipeSignal(boolean active, PipeWire color) {
|
||||
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.color = color;
|
||||
|
@ -34,31 +36,7 @@ public class TriggerPipeSignal extends BCTrigger implements IPipeTrigger {
|
|||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if (active) {
|
||||
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 "";
|
||||
return String.format(StringUtils.localize("gate.trigger.pipe.wire." + (active ? "active" : "inactive")), StringUtils.localize("color." + color.name().toLowerCase(Locale.ENGLISH)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,7 @@ package buildcraft.transport.triggers;
|
|||
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.core.triggers.BCTrigger;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.IPipeTrigger;
|
||||
import buildcraft.transport.Pipe;
|
||||
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.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)
|
||||
private Icon iconActive, iconInactive;
|
||||
private Icon icon;
|
||||
|
||||
public TriggerRedstoneInput(int legacyId, boolean active) {
|
||||
super(legacyId, active ? "buildcraft.redtone.input.active" : "buildcraft.redtone.input.inactive");
|
||||
public TriggerRedstoneFaderInput(int level) {
|
||||
super(String.format("buildcraft:redtone.input.%02d", level));
|
||||
|
||||
this.active = active;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if (active)
|
||||
return "Redstone Signal On";
|
||||
else
|
||||
return "Redstone Signal Off";
|
||||
return String.format(StringUtils.localize("gate.trigger.redstone.input.level"), level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(Pipe pipe, ITriggerParameter parameter) {
|
||||
if (active)
|
||||
return isBeingPowered(pipe);
|
||||
return !isBeingPowered(pipe);
|
||||
}
|
||||
|
||||
private boolean isBeingPowered(Pipe pipe) {
|
||||
return pipe.container.redstonePowered;
|
||||
return pipe.container.redstoneInput == level;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon() {
|
||||
if (active)
|
||||
return iconActive;
|
||||
else
|
||||
return iconInactive;
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister) {
|
||||
iconActive = iconRegister.registerIcon("buildcraft:triggers/trigger_redstoneinput_active");
|
||||
iconInactive = iconRegister.registerIcon("buildcraft:triggers/trigger_redstoneinput_inactive");
|
||||
icon = iconRegister.registerIcon(String.format("buildcraft:triggers/redstone_%02d", level));
|
||||
}
|
||||
}
|