Skip to content

Commit 384d639

Browse files
Fix missing redstone event call with Eigencraft redstone (#8148)
1 parent 90836d0 commit 384d639

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

patches/server/0486-Eigencraft-redstone-implementation.patch

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -982,10 +982,10 @@ index 0000000000000000000000000000000000000000..22a2547810d0c029f29685faddf7ac21
982982
+ }
983983
+}
984984
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
985-
index 74241146a034c5817cddc608c095d829d765f06a..fdee6b7ba4e5e2ab7c4eec8ee0d402f76e7e9a41 100644
985+
index 74241146a034c5817cddc608c095d829d765f06a..3cba4921daad4b346a3f964f0fa48e1bb4d634a3 100644
986986
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
987987
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
988-
@@ -253,6 +253,124 @@ public class RedStoneWireBlock extends Block {
988+
@@ -253,6 +253,116 @@ public class RedStoneWireBlock extends Block {
989989
return floor.isFaceSturdy(world, pos, Direction.UP) || floor.is(Blocks.HOPPER);
990990
}
991991

@@ -1081,6 +1081,10 @@ index 74241146a034c5817cddc608c095d829d765f06a..fdee6b7ba4e5e2ab7c4eec8ee0d402f7
10811081
+ }
10821082
+
10831083
+ if (i != j) {
1084+
+ org.bukkit.event.block.BlockRedstoneEvent event = new org.bukkit.event.block.BlockRedstoneEvent(worldIn.getWorld().getBlockAt(pos1.getX(), pos1.getY(), pos1.getZ()), i, j);
1085+
+ worldIn.getCraftServer().getPluginManager().callEvent(event);
1086+
+
1087+
+ j = event.getNewCurrent();
10841088
+ state = state.setValue(POWER, j);
10851089
+
10861090
+ if (worldIn.getBlockState(pos1) == iblockstate) {
@@ -1089,18 +1093,6 @@ index 74241146a034c5817cddc608c095d829d765f06a..fdee6b7ba4e5e2ab7c4eec8ee0d402f7
10891093
+ if (worldIn.setBlock(pos1, state, Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_CLIENTS))
10901094
+ turbo.updateNeighborShapes(worldIn, pos1, state);
10911095
+ }
1092-
+
1093-
+ // 1.16(.1?) dropped the need for blocks needing updates.
1094-
+ // Whether this is necessary after all is to be seen.
1095-
+// if (!worldIn.paperConfig.useEigencraftRedstone) {
1096-
+// // The new search algorithm keeps track of blocks needing updates in its own data structures,
1097-
+// // so only add anything to blocksNeedingUpdate if we're using the vanilla update algorithm.
1098-
+// this.getBlocksNeedingUpdate().add(pos1);
1099-
+//
1100-
+// for (EnumDirection enumfacing1 : EnumDirection.values()) {
1101-
+// this.getBlocksNeedingUpdate().add(pos1.shift(enumfacing1));
1102-
+// }
1103-
+// }
11041096
+ }
11051097
+
11061098
+ return state;
@@ -1110,15 +1102,15 @@ index 74241146a034c5817cddc608c095d829d765f06a..fdee6b7ba4e5e2ab7c4eec8ee0d402f7
11101102
private void updatePowerStrength(Level world, BlockPos pos, BlockState state) {
11111103
int i = this.calculateTargetStrength(world, pos);
11121104

1113-
@@ -322,6 +440,7 @@ public class RedStoneWireBlock extends Block {
1105+
@@ -322,6 +432,7 @@ public class RedStoneWireBlock extends Block {
11141106
return Math.max(i, j - 1);
11151107
}
11161108

11171109
+ private int getPower(int min, BlockState iblockdata) { return Math.max(min, getWireSignal(iblockdata)); } // Paper - Optimize redstone
11181110
private int getWireSignal(BlockState state) {
11191111
return state.is((Block) this) ? (Integer) state.getValue(RedStoneWireBlock.POWER) : 0;
11201112
}
1121-
@@ -344,7 +463,7 @@ public class RedStoneWireBlock extends Block {
1113+
@@ -344,7 +455,7 @@ public class RedStoneWireBlock extends Block {
11221114
@Override
11231115
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
11241116
if (!oldState.is(state.getBlock()) && !world.isClientSide) {
@@ -1127,7 +1119,7 @@ index 74241146a034c5817cddc608c095d829d765f06a..fdee6b7ba4e5e2ab7c4eec8ee0d402f7
11271119
Iterator iterator = Direction.Plane.VERTICAL.iterator();
11281120

11291121
while (iterator.hasNext()) {
1130-
@@ -371,7 +490,7 @@ public class RedStoneWireBlock extends Block {
1122+
@@ -371,7 +482,7 @@ public class RedStoneWireBlock extends Block {
11311123
world.updateNeighborsAt(pos.relative(enumdirection), this);
11321124
}
11331125

@@ -1136,7 +1128,7 @@ index 74241146a034c5817cddc608c095d829d765f06a..fdee6b7ba4e5e2ab7c4eec8ee0d402f7
11361128
this.updateNeighborsOfNeighboringWires(world, pos);
11371129
}
11381130
}
1139-
@@ -406,7 +525,7 @@ public class RedStoneWireBlock extends Block {
1131+
@@ -406,7 +517,7 @@ public class RedStoneWireBlock extends Block {
11401132
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
11411133
if (!world.isClientSide) {
11421134
if (state.canSurvive(world, pos)) {

patches/server/0904-Add-Alternate-Current-redstone-implementation.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,7 +2054,7 @@ index c118efaadd0e3e29f9adcd65c11ecabfc6d76216..9467ccaa1d73e1913495a46919aee530
20542054
+ // Paper end
20552055
}
20562056
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
2057-
index fdee6b7ba4e5e2ab7c4eec8ee0d402f76e7e9a41..ee6e15aa3c8cc1c0f663c104af4b4b984dcb881f 100644
2057+
index 3cba4921daad4b346a3f964f0fa48e1bb4d634a3..2bc21e3373f6fc6fbbaa7202ba82e7da86045b6a 100644
20582058
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
20592059
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
20602060
@@ -253,7 +253,7 @@ public class RedStoneWireBlock extends Block {
@@ -2066,7 +2066,7 @@ index fdee6b7ba4e5e2ab7c4eec8ee0d402f76e7e9a41..ee6e15aa3c8cc1c0f663c104af4b4b98
20662066
// The bulk of the new functionality is found in RedstoneWireTurbo.java
20672067
com.destroystokyo.paper.util.RedstoneWireTurbo turbo = new com.destroystokyo.paper.util.RedstoneWireTurbo(this);
20682068

2069-
@@ -463,7 +463,13 @@ public class RedStoneWireBlock extends Block {
2069+
@@ -455,7 +455,13 @@ public class RedStoneWireBlock extends Block {
20702070
@Override
20712071
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
20722072
if (!oldState.is(state.getBlock()) && !world.isClientSide) {
@@ -2081,7 +2081,7 @@ index fdee6b7ba4e5e2ab7c4eec8ee0d402f76e7e9a41..ee6e15aa3c8cc1c0f663c104af4b4b98
20812081
Iterator iterator = Direction.Plane.VERTICAL.iterator();
20822082

20832083
while (iterator.hasNext()) {
2084-
@@ -490,7 +496,13 @@ public class RedStoneWireBlock extends Block {
2084+
@@ -482,7 +488,13 @@ public class RedStoneWireBlock extends Block {
20852085
world.updateNeighborsAt(pos.relative(enumdirection), this);
20862086
}
20872087

@@ -2096,7 +2096,7 @@ index fdee6b7ba4e5e2ab7c4eec8ee0d402f76e7e9a41..ee6e15aa3c8cc1c0f663c104af4b4b98
20962096
this.updateNeighborsOfNeighboringWires(world, pos);
20972097
}
20982098
}
2099-
@@ -524,8 +536,14 @@ public class RedStoneWireBlock extends Block {
2099+
@@ -516,8 +528,14 @@ public class RedStoneWireBlock extends Block {
21002100
@Override
21012101
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
21022102
if (!world.isClientSide) {

0 commit comments

Comments
 (0)