add quartz gates, scrollwheel support in gate and zone planner interfaces, add proper pipe wire bounds checking to wire parameters
This commit is contained in:
parent
5befa8537b
commit
368eda1251
12 changed files with 103 additions and 26 deletions
|
@ -105,6 +105,7 @@ gate.material.iron=Iron
|
|||
gate.material.gold=Gold
|
||||
gate.material.diamond=Diamond
|
||||
gate.material.emerald=Emerald
|
||||
gate.material.quartz=Quartz
|
||||
|
||||
gate.name=%s %s Gate
|
||||
gate.name.basic=Basic Gate
|
||||
|
@ -304,6 +305,7 @@ tip.gate.wires=§9§oCompatible Wires:
|
|||
tip.gate.wires.redstone=Red
|
||||
tip.gate.wires.iron=Red, Blue
|
||||
tip.gate.wires.gold=Red, Blue, Green
|
||||
tip.gate.wires.quartz=Red, Blue, Green
|
||||
tip.gate.wires.diamond=Red, Blue, Green, Yellow
|
||||
tip.gate.wires.emerald=Red, Blue, Green, Yellow
|
||||
tip.gate.expansions=§9§oInstalled Expansions:
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 141 B |
Binary file not shown.
After Width: | Height: | Size: 761 B |
Binary file not shown.
After Width: | Height: | Size: 141 B |
|
@ -551,12 +551,12 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
|
||||
addGateRecipe("Iron", (int) Math.round(200000 * gateCostMultiplier), GateMaterial.IRON, Chipset.IRON, PipeWire.RED, PipeWire.BLUE);
|
||||
addGateRecipe("Gold", (int) Math.round(400000 * gateCostMultiplier), GateMaterial.GOLD, Chipset.GOLD, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN);
|
||||
addGateRecipe("Quartz", (int) Math.round(600000 * gateCostMultiplier), GateMaterial.QUARTZ, Chipset.QUARTZ, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN);
|
||||
addGateRecipe("Diamond", (int) Math.round(800000 * gateCostMultiplier), GateMaterial.DIAMOND, Chipset.DIAMOND, PipeWire.RED, PipeWire.BLUE,
|
||||
PipeWire.GREEN, PipeWire.YELLOW);
|
||||
addGateRecipe("Emerald", (int) Math.round(1200000 * gateCostMultiplier), GateMaterial.EMERALD, Chipset.EMERALD, PipeWire.RED, PipeWire.BLUE,
|
||||
PipeWire.GREEN, PipeWire.YELLOW);
|
||||
|
||||
|
||||
// REVERSAL RECIPE
|
||||
BuildcraftRecipeRegistry.integrationTable.addRecipe(new GateLogicSwapRecipe("buildcraft:gateSwap"));
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ package buildcraft.commander;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
@ -396,4 +397,28 @@ public class GuiZonePlan extends GuiAdvancedInterface {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
super.handleMouseInput();
|
||||
|
||||
int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||
int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
|
||||
|
||||
if (mouseX >= mapXMin && mouseX <= mapXMin + getContainer().mapTexture.width
|
||||
&& mouseY >= mapYMin && mouseY <= mapYMin + getContainer().mapTexture.height) {
|
||||
int wheel = Mouse.getEventDWheel();
|
||||
if (wheel != 0) {
|
||||
if (zoomLevel < 6 && wheel > 0) {
|
||||
zoomLevel++;
|
||||
uploadMap();
|
||||
refreshSelectedArea();
|
||||
} else if (zoomLevel > 1 && wheel < 0) {
|
||||
zoomLevel--;
|
||||
uploadMap();
|
||||
refreshSelectedArea();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -70,7 +70,7 @@ public class TileMiningWell extends TileBuildCraft implements IHasWork, IPipeCon
|
|||
return;
|
||||
}
|
||||
|
||||
if (world.isAirBlock(xCoord, depth, zCoord)) {
|
||||
if (world.isAirBlock(xCoord, depth, zCoord) || world.getBlock(xCoord, depth, zCoord).isReplaceable(world, xCoord, depth, zCoord)) {
|
||||
if (getBattery().getEnergyStored() >= BuilderAPI.BUILD_ENERGY) {
|
||||
getBattery().useEnergy(BuilderAPI.BUILD_ENERGY, BuilderAPI.BUILD_ENERGY, false);
|
||||
world.setBlock(xCoord, depth, zCoord, BuildCraftFactory.plainPipeBlock);
|
||||
|
|
|
@ -551,7 +551,7 @@ public final class Gate implements IGate, IStatementContainer {
|
|||
// TRIGGERS
|
||||
public void addTriggers(List<ITriggerInternal> list) {
|
||||
for (PipeWire wire : PipeWire.VALUES) {
|
||||
if (pipe.wireSet[wire.ordinal()] && material.ordinal() >= wire.ordinal()) {
|
||||
if (pipe.wireSet[wire.ordinal()] && wire.ordinal() < material.maxWireColor) {
|
||||
list.add(BuildCraftTransport.triggerPipeWireActive[wire.ordinal()]);
|
||||
list.add(BuildCraftTransport.triggerPipeWireInactive[wire.ordinal()]);
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ public final class Gate implements IGate, IStatementContainer {
|
|||
// ACTIONS
|
||||
public void addActions(List<IActionInternal> list) {
|
||||
for (PipeWire wire : PipeWire.VALUES) {
|
||||
if (pipe.wireSet[wire.ordinal()] && material.ordinal() >= wire.ordinal()) {
|
||||
if (pipe.wireSet[wire.ordinal()] && wire.ordinal() < material.maxWireColor) {
|
||||
list.add(BuildCraftTransport.actionPipeWire[wire.ordinal()]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,29 +36,33 @@ public final class GateDefinition {
|
|||
|
||||
public static enum GateMaterial {
|
||||
|
||||
REDSTONE("gate_interface_1.png", 146, 1, 0, 0),
|
||||
IRON("gate_interface_2.png", 164, 2, 0, 0),
|
||||
GOLD("gate_interface_3.png", 200, 4, 1, 0),
|
||||
DIAMOND("gate_interface_4.png", 200, 8, 1, 0),
|
||||
EMERALD("gate_interface_5.png", 200, 4, 3, 3);
|
||||
REDSTONE("gate_interface_1.png", 146, 1, 0, 0, 1),
|
||||
IRON("gate_interface_2.png", 164, 2, 0, 0, 2),
|
||||
GOLD("gate_interface_3.png", 200, 4, 1, 0, 3),
|
||||
DIAMOND("gate_interface_4.png", 200, 8, 1, 0, 4),
|
||||
EMERALD("gate_interface_5.png", 200, 4, 3, 3, 4),
|
||||
QUARTZ("gate_interface_6.png", 164, 2, 1, 1, 3);
|
||||
|
||||
public static final GateMaterial[] VALUES = values();
|
||||
public final ResourceLocation guiFile;
|
||||
public final int guiHeight;
|
||||
public final int numSlots;
|
||||
public final int numTriggerParameters;
|
||||
public final int numActionParameters;
|
||||
public final int maxWireColor;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBlock;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconItem;
|
||||
|
||||
private GateMaterial(String guiFile, int guiHeight, int numSlots, int triggerParameterSlots,
|
||||
int actionParameterSlots) {
|
||||
int actionParameterSlots, int maxWireColor) {
|
||||
this.guiFile = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/" + guiFile);
|
||||
this.guiHeight = guiHeight;
|
||||
this.numSlots = numSlots;
|
||||
this.numTriggerParameters = triggerParameterSlots;
|
||||
this.numActionParameters = actionParameterSlots;
|
||||
this.maxWireColor = maxWireColor;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -11,6 +11,7 @@ package buildcraft.transport.gui;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
@ -233,6 +234,15 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
|||
slots.add(new TriggerSlot(62, 44, pipe, 1));
|
||||
slots.add(new ActionSlot(98, 26, pipe, 0));
|
||||
slots.add(new ActionSlot(98, 44, pipe, 1));
|
||||
} else if (gate.material == GateMaterial.QUARTZ) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
TriggerSlot ts = new TriggerSlot(44, 26 + (i * 18), pipe, i);
|
||||
ActionSlot as = new ActionSlot(98, 26 + (i * 18), pipe, i);
|
||||
slots.add(ts);
|
||||
slots.add(as);
|
||||
slots.add(new TriggerParameterSlot(62, 26 + (i * 18), pipe, 0, ts));
|
||||
slots.add(new ActionParameterSlot(116, 26 + (i * 18), pipe, 0, as));
|
||||
}
|
||||
} else if (gate.material == GateMaterial.GOLD) {
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
slots.add(new TriggerSlot(53, 26 + 18 * k, pipe, position));
|
||||
|
@ -368,15 +378,7 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
|||
drawBackgroundSlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int i, int j, int k) {
|
||||
if (gate == null) {
|
||||
return;
|
||||
}
|
||||
super.mouseClicked(i, j, k);
|
||||
|
||||
AdvancedSlot slot = getSlotAtLocation(i, j);
|
||||
|
||||
private void doSlotClick(AdvancedSlot slot, int k) {
|
||||
if (slot instanceof TriggerSlot && container.hasTriggers()) {
|
||||
TriggerSlot triggerSlot = (TriggerSlot) slot;
|
||||
|
||||
|
@ -485,4 +487,30 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
|||
|
||||
container.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int i, int j, int k) {
|
||||
if (gate == null) {
|
||||
return;
|
||||
}
|
||||
super.mouseClicked(i, j, k);
|
||||
|
||||
AdvancedSlot slot = getSlotAtLocation(i, j);
|
||||
|
||||
if (slot != null) {
|
||||
doSlotClick(slot, k);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
super.handleMouseInput();
|
||||
|
||||
int wheel = Mouse.getEventDWheel();
|
||||
if (wheel != 0) {
|
||||
int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||
int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
|
||||
doSlotClick(getSlotAtLocation(i, j), wheel > 0 ? 0 : 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import buildcraft.api.statements.IStatementParameter;
|
|||
import buildcraft.api.statements.StatementMouseClick;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.Gate;
|
||||
|
||||
public class ActionParameterSignal implements IStatementParameter {
|
||||
|
||||
|
@ -43,12 +44,19 @@ public class ActionParameterSignal implements IStatementParameter {
|
|||
|
||||
@Override
|
||||
public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) {
|
||||
int maxColor = 4;
|
||||
if (source instanceof Gate) {
|
||||
maxColor = ((Gate) source).material.maxWireColor;
|
||||
}
|
||||
|
||||
if (color == null) {
|
||||
color = mouse.getButton() == 0 ? PipeWire.RED : PipeWire.YELLOW;
|
||||
} else if (color == (mouse.getButton() == 0 ? PipeWire.YELLOW : PipeWire.RED)) {
|
||||
color = mouse.getButton() == 0 ? PipeWire.RED : PipeWire.values()[maxColor - 1];
|
||||
} else if (color == (mouse.getButton() == 0 ? PipeWire.values()[maxColor - 1] : PipeWire.RED)) {
|
||||
color = null;
|
||||
} else {
|
||||
color = PipeWire.values()[mouse.getButton() == 0 ? color.ordinal() + 1 : color.ordinal() - 1];
|
||||
do {
|
||||
color = PipeWire.values()[(mouse.getButton() == 0 ? color.ordinal() + 1 : color.ordinal() - 1) & 3];
|
||||
} while (color.ordinal() >= maxColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import buildcraft.api.statements.IStatementParameter;
|
|||
import buildcraft.api.statements.StatementMouseClick;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.Gate;
|
||||
|
||||
public class TriggerParameterSignal implements IStatementParameter {
|
||||
|
||||
|
@ -49,28 +50,37 @@ public class TriggerParameterSignal implements IStatementParameter {
|
|||
|
||||
@Override
|
||||
public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) {
|
||||
int maxColor = 4;
|
||||
if (source instanceof Gate) {
|
||||
maxColor = ((Gate) source).material.maxWireColor;
|
||||
}
|
||||
|
||||
if (mouse.getButton() == 0) {
|
||||
if (color == null) {
|
||||
active = true;
|
||||
color = PipeWire.RED;
|
||||
} else if (active) {
|
||||
active = false;
|
||||
} else if (color == PipeWire.YELLOW) {
|
||||
} else if (color == PipeWire.values()[maxColor - 1]) {
|
||||
color = null;
|
||||
} else {
|
||||
color = PipeWire.values()[color.ordinal() + 1];
|
||||
do {
|
||||
color = PipeWire.values()[(color.ordinal() + 1) & 3];
|
||||
} while (color.ordinal() >= maxColor);
|
||||
active = true;
|
||||
}
|
||||
} else {
|
||||
if (color == null) {
|
||||
active = false;
|
||||
color = PipeWire.YELLOW;
|
||||
color = PipeWire.values()[maxColor - 1];
|
||||
} else if (!active) {
|
||||
active = true;
|
||||
} else if (color == PipeWire.RED) {
|
||||
color = null;
|
||||
} else {
|
||||
color = PipeWire.values()[color.ordinal() - 1];
|
||||
do {
|
||||
color = PipeWire.values()[(color.ordinal() - 1) & 3];
|
||||
} while (color.ordinal() >= maxColor);
|
||||
active = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue