Made redstone input back to non-side specific behavior. This follows behavior
of other blocks, although side-sensitive parameter could be added. Following up on #1886.
This commit is contained in:
parent
cd10225538
commit
3630875761
4 changed files with 19 additions and 17 deletions
|
@ -8,8 +8,6 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.core.triggers;
|
package buildcraft.core.triggers;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
import buildcraft.api.gates.IGate;
|
import buildcraft.api.gates.IGate;
|
||||||
import buildcraft.api.gates.ITrigger;
|
import buildcraft.api.gates.ITrigger;
|
||||||
import buildcraft.api.gates.ITriggerParameter;
|
import buildcraft.api.gates.ITriggerParameter;
|
||||||
|
@ -32,11 +30,11 @@ public class TriggerRedstoneInput extends BCTrigger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameters) {
|
public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameters) {
|
||||||
return !(active ^ isBeingPowered((Pipe<?>) gate.getPipe(), gate.getSide()));
|
return !(active ^ isBeingPowered((Pipe<?>) gate.getPipe()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBeingPowered(Pipe<?> pipe, ForgeDirection direction) {
|
private boolean isBeingPowered(Pipe<?> pipe) {
|
||||||
return direction != ForgeDirection.UNKNOWN && pipe.container.redstoneInput[direction.ordinal()] > 0;
|
return pipe.container.redstoneInput > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -694,9 +694,14 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
|
|
||||||
if (isValid(pipe)) {
|
if (isValid(pipe)) {
|
||||||
pipe.container.scheduleNeighborChange();
|
pipe.container.scheduleNeighborChange();
|
||||||
|
|
||||||
|
pipe.container.redstoneInput = world.isBlockIndirectlyGettingPowered(x, y, z) ? 15 : world
|
||||||
|
.getBlockPowerInput(x, y, z);
|
||||||
|
|
||||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||||
ForgeDirection d = ForgeDirection.getOrientation(i);
|
ForgeDirection d = ForgeDirection.getOrientation(i);
|
||||||
pipe.container.redstoneInput[i] = world.isBlockProvidingPowerTo(x + d.offsetY, y + d.offsetY, z + d.offsetZ, i);
|
pipe.container.redstoneInputSide[i] = world.isBlockProvidingPowerTo(x + d.offsetY, y + d.offsetY, z
|
||||||
|
+ d.offsetZ, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.transport;
|
package buildcraft.transport;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
@ -78,7 +77,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
|
|
||||||
@MjBattery
|
@MjBattery
|
||||||
public Pipe pipe;
|
public Pipe pipe;
|
||||||
public int[] redstoneInput = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
public int redstoneInput;
|
||||||
|
public int[] redstoneInputSide = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
||||||
|
|
||||||
private boolean deletePipe = false;
|
private boolean deletePipe = false;
|
||||||
private TileBuffer[] tileBuffer;
|
private TileBuffer[] tileBuffer;
|
||||||
|
@ -245,10 +245,12 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
super.writeToNBT(nbt);
|
super.writeToNBT(nbt);
|
||||||
|
|
||||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||||
final String key = "redstoneInput[" + i + "]";
|
final String key = "redstoneInputSide[" + i + "]";
|
||||||
nbt.setInteger(key, redstoneInput[i]);
|
nbt.setInteger(key, redstoneInputSide[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nbt.setInteger("redstoneInput", redstoneInput);
|
||||||
|
|
||||||
if (pipe != null) {
|
if (pipe != null) {
|
||||||
nbt.setInteger("pipeId", Item.itemRegistry.getIDForObject(pipe.item));
|
nbt.setInteger("pipeId", Item.itemRegistry.getIDForObject(pipe.item));
|
||||||
pipe.writeToNBT(nbt);
|
pipe.writeToNBT(nbt);
|
||||||
|
@ -263,14 +265,11 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
|
|
||||||
// Legacy
|
redstoneInput = nbt.getInteger("redstoneInput");
|
||||||
if (nbt.hasKey("redstoneInput")) {
|
|
||||||
Arrays.fill(redstoneInput, nbt.getByte("redstoneInput"));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||||
final String key = "redstoneInput[" + i + "]";
|
final String key = "redstoneInputSide[" + i + "]";
|
||||||
redstoneInput[i] = nbt.hasKey(key) ? nbt.getInteger(key) : 0;
|
redstoneInputSide[i] = nbt.hasKey(key) ? nbt.getInteger(key) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
coreState.pipeId = nbt.getInteger("pipeId");
|
coreState.pipeId = nbt.getInteger("pipeId");
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class TriggerRedstoneFaderInput extends BCTrigger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameter) {
|
public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameter) {
|
||||||
return ((TileGenericPipe) gate.getPipe().getTile()).redstoneInput[gate.getSide().ordinal()] == level;
|
return ((TileGenericPipe) gate.getPipe().getTile()).redstoneInput == level;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue