mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-25 20:22:23 +00:00
Emit block update immediately for redstone p2p (#1696)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Martin Robertz <dream-master@gmx.net>
This commit is contained in:
4 files changed
+21
-20
No files matched your search
@@ -145,13 +145,8 @@ public class P2PTests {
|
||||
.thenExecute("power the redstone P2P input", () -> {
|
||||
unpoweredOutputStaysLow.disable();
|
||||
setRedstoneInput(helper, 15);
|
||||
}).thenWaitUntil("wait for the redstone P2P output to become powered", 40, () -> {
|
||||
assertLinkedPair(helper, input, output, REDSTONE_FREQUENCY);
|
||||
assertRedstonePower(helper, 15);
|
||||
}).thenExecute("remove power from the redstone P2P input", () -> setRedstoneInput(helper, 0))
|
||||
.thenWaitUntil("wait for the redstone P2P output to return to zero", 40, () -> {
|
||||
assertCarrierActive(helper, controller);
|
||||
assertLinkedPair(helper, input, output, REDSTONE_FREQUENCY);
|
||||
setRedstoneInput(helper, 0);
|
||||
assertRedstonePower(helper, 0);
|
||||
}).thenExecute("begin restored-low invariant", unpoweredOutputStaysLow::enable).thenIdle(5)
|
||||
.thenExecute("finish restored-low observation", unpoweredOutputStaysLow::disable).thenSucceed();
|
||||
@@ -475,7 +470,7 @@ public class P2PTests {
|
||||
|
||||
private static void assertRedstonePower(GameTestHelper helper, int expectedPower) {
|
||||
TestPos probe = helper.absolute(REDSTONE_PROBE_LABEL);
|
||||
int actualPower = helper.getWorld().getStrongestIndirectPower(probe.x(), probe.y(), probe.z());
|
||||
int actualPower = helper.getWorld().getBlockMetadata(probe.x(), probe.y(), probe.z());
|
||||
helper.assertEquals(
|
||||
expectedPower,
|
||||
actualPower,
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
|
||||
package appeng.parts.p2p;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRedstoneWire;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -23,7 +26,6 @@ import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -73,15 +75,15 @@ public class PartP2PRedstone extends PartP2PTunnelNormal<PartP2PRedstone> {
|
||||
final int yCoord = this.getTile().yCoord;
|
||||
final int zCoord = this.getTile().zCoord;
|
||||
|
||||
Platform.notifyBlocksOfNeighbors(worldObj, xCoord, yCoord, zCoord);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, Blocks.air);
|
||||
|
||||
// and this cause sometimes it can go thought walls.
|
||||
Platform.notifyBlocksOfNeighbors(worldObj, xCoord - 1, yCoord, zCoord);
|
||||
Platform.notifyBlocksOfNeighbors(worldObj, xCoord, yCoord - 1, zCoord);
|
||||
Platform.notifyBlocksOfNeighbors(worldObj, xCoord, yCoord, zCoord - 1);
|
||||
Platform.notifyBlocksOfNeighbors(worldObj, xCoord, yCoord, zCoord + 1);
|
||||
Platform.notifyBlocksOfNeighbors(worldObj, xCoord, yCoord + 1, zCoord);
|
||||
Platform.notifyBlocksOfNeighbors(worldObj, xCoord + 1, yCoord, zCoord);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord - 1, yCoord, zCoord, Blocks.air);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord - 1, zCoord, Blocks.air);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord - 1, Blocks.air);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord + 1, Blocks.air);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord + 1, zCoord, Blocks.air);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord + 1, yCoord, zCoord, Blocks.air);
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
@@ -161,7 +163,9 @@ public class PartP2PRedstone extends PartP2PTunnelNormal<PartP2PRedstone> {
|
||||
|
||||
private void sendToOutput(final int power) {
|
||||
try {
|
||||
for (final PartP2PRedstone rs : this.getOutputs()) {
|
||||
List<PartP2PRedstone> outputs = new ArrayList<>();
|
||||
this.getOutputs().forEach(outputs::add);
|
||||
for (final PartP2PRedstone rs : outputs) {
|
||||
rs.putInput(power);
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
|
||||
@@ -7,16 +7,18 @@
|
||||
"C": {"name": "appliedenergistics2:tile.BlockCreativeEnergyController", "meta": 1, "label": "ME Self-Powered Controller"},
|
||||
"D": {"name": "appliedenergistics2:tile.BlockDrive", "meta": 0, "label": "ME Drive"},
|
||||
"E": {"name": "minecraft:chest", "meta": 3, "label": "Chest"},
|
||||
"F": {"name": "minecraft:hopper", "meta": 5, "label": "Hopper"}
|
||||
"F": {"name": "minecraft:hopper", "meta": 5, "label": "Hopper"},
|
||||
"G": {"name": "minecraft:redstone_wire", "meta": 0},
|
||||
"H": {"name": "minecraft:stone", "meta": 0, "label": "Stone"}
|
||||
},
|
||||
"layers": [
|
||||
[
|
||||
".......",
|
||||
".....H.",
|
||||
"FAACAAE",
|
||||
"......."
|
||||
],
|
||||
[
|
||||
".......",
|
||||
".....G.",
|
||||
"EB...D.",
|
||||
"......."
|
||||
]
|
||||
@@ -28,7 +30,7 @@
|
||||
"input_tunnel_host": [1, 0, 1],
|
||||
"main_network_power": [1, 1, 1],
|
||||
"output_tunnel_host": [5, 0, 1],
|
||||
"redstone_probe": [5, 0, 0],
|
||||
"redstone_probe": [5, 1, 0],
|
||||
"redstone_source": [1, 0, 0],
|
||||
"remote_storage": [5, 1, 1],
|
||||
"source_chest": [0, 1, 1],
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user