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;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
|
@ -32,11 +30,11 @@ public class TriggerRedstoneInput extends BCTrigger {
|
|||
|
||||
@Override
|
||||
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) {
|
||||
return direction != ForgeDirection.UNKNOWN && pipe.container.redstoneInput[direction.ordinal()] > 0;
|
||||
private boolean isBeingPowered(Pipe<?> pipe) {
|
||||
return pipe.container.redstoneInput > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -694,9 +694,14 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
|
||||
if (isValid(pipe)) {
|
||||
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++) {
|
||||
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;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -78,7 +77,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
|
||||
@MjBattery
|
||||
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 TileBuffer[] tileBuffer;
|
||||
|
@ -245,10 +245,12 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
super.writeToNBT(nbt);
|
||||
|
||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||
final String key = "redstoneInput[" + i + "]";
|
||||
nbt.setInteger(key, redstoneInput[i]);
|
||||
final String key = "redstoneInputSide[" + i + "]";
|
||||
nbt.setInteger(key, redstoneInputSide[i]);
|
||||
}
|
||||
|
||||
nbt.setInteger("redstoneInput", redstoneInput);
|
||||
|
||||
if (pipe != null) {
|
||||
nbt.setInteger("pipeId", Item.itemRegistry.getIDForObject(pipe.item));
|
||||
pipe.writeToNBT(nbt);
|
||||
|
@ -263,14 +265,11 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
// Legacy
|
||||
if (nbt.hasKey("redstoneInput")) {
|
||||
Arrays.fill(redstoneInput, nbt.getByte("redstoneInput"));
|
||||
}
|
||||
redstoneInput = nbt.getInteger("redstoneInput");
|
||||
|
||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||
final String key = "redstoneInput[" + i + "]";
|
||||
redstoneInput[i] = nbt.hasKey(key) ? nbt.getInteger(key) : 0;
|
||||
final String key = "redstoneInputSide[" + i + "]";
|
||||
redstoneInputSide[i] = nbt.hasKey(key) ? nbt.getInteger(key) : 0;
|
||||
}
|
||||
|
||||
coreState.pipeId = nbt.getInteger("pipeId");
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TriggerRedstoneFaderInput extends BCTrigger {
|
|||
|
||||
@Override
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue