[ci skip] Add more identifying patch comments

This commit is contained in:
Nassim Jahnke
2024-01-20 23:13:41 +01:00
parent e34d100c9c
commit dee90322eb
43 changed files with 134 additions and 137 deletions

View File

@@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
state = this.updateDir(world, pos, state, true);
if (this.isStraight) {
world.neighborChanged(state, pos, this, pos, notify);
+ state = world.getBlockState(pos); // Paper - don't desync, update again
+ state = world.getBlockState(pos); // Paper - Fix some rails connecting improperly
}
return state;
@@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private void checkPressed(Level world, BlockPos pos, BlockState state) {
if (this.canSurvive(state, world, pos)) {
+ if (state.getBlock() != this) { return; } // Paper - not our block, don't do anything
+ if (state.getBlock() != this) { return; } // Paper - Fix some rails connecting improperly
boolean flag = (Boolean) state.getValue(DetectorRailBlock.POWERED);
boolean flag1 = false;
List<AbstractMinecart> list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (entity) -> {
@@ -36,11 +36,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final boolean isStraight;
private final List<BlockPos> connections = Lists.newArrayList();
+ // Paper start - prevent desync
+ // Paper start - Fix some rails connecting improperly
+ public boolean isValid() {
+ return this.level.getBlockState(this.pos).getBlock() == this.state.getBlock();
+ }
+ // Paper end - prevent desync
+ // Paper end - Fix some rails connecting improperly
+
public RailState(Level world, BlockPos pos, BlockState state) {
this.level = world;
@@ -49,11 +49,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
private void connectTo(RailState placementHelper) {
+ // Paper start - prevent desync
+ // Paper start - Fix some rails connecting improperly
+ if (!this.isValid() || !placementHelper.isValid()) {
+ return;
+ }
+ // Paper end - prevent desync
+ // Paper end - Fix some rails connecting improperly
this.connections.add(placementHelper.pos);
BlockPos blockPos = this.pos.north();
BlockPos blockPos2 = this.pos.south();
@@ -61,16 +61,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.state = this.state.setValue(this.block.getShapeProperty(), railShape2);
if (forceUpdate || this.level.getBlockState(this.pos) != this.state) {
this.level.setBlock(this.pos, this.state, 3);
+ // Paper start - prevent desync
+ // Paper start - Fix some rails connecting improperly
+ if (!this.isValid()) {
+ return this;
+ }
+ // Paper end - prevent desync
+ // Paper end - Fix some rails connecting improperly
for(int i = 0; i < this.connections.size(); ++i) {
RailState railState = this.getRail(this.connections.get(i));
- if (railState != null) {
+ if (railState != null && railState.isValid()) { // Paper - prevent desync
+ if (railState != null && railState.isValid()) { // Paper - Fix some rails connecting improperly
railState.removeSoftConnections();
if (railState.canConnectTo(this)) {
railState.connectTo(this);
@@ -79,6 +79,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public BlockState getState() {
- return this.state;
+ return this.level.getBlockState(this.pos); // Paper - prevent desync
+ return this.level.getBlockState(this.pos); // Paper - Fix some rails connecting improperly
}
}