mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
de04cbced5
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: f29cb801 Separate checkstyle-suppressions file is not required 86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack 9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode() 994a6163 Attempt upgrade of resolver libraries CraftBukkit Changes: b3b43a6ad Add Checkstyle check for unused imports 13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names 3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API 2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor 1dbdbbed4 PR-1238: Remove unnecessary sign ticking 659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper e37e29ce0 Increase outdated build delay c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack 492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode() e11fbb9d7 Upgrade MySQL driver 9f3a0bd2a Attempt upgrade of resolver libraries 60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion Spigot Changes: 06d602e7 Rebuild patches
81 lines
5.2 KiB
Diff
81 lines
5.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Thu, 11 Jun 2020 17:29:42 -0700
|
|
Subject: [PATCH] Fix piston physics inconsistency - MC-188840
|
|
|
|
Pistons invoke physics when they move blocks. The physics can cause
|
|
tnt blocks to ignite. However, pistons (when storing the blocks they "moved")
|
|
don't actually go back to the world state sometimes to check if something
|
|
like that happened. As a result they end up moving the tnt like it was
|
|
never ignited. This resulted in the ability to create machines
|
|
that can duplicate tnt, called "world eaters".
|
|
This patch makes the piston logic retrieve the block state from the world
|
|
prevent this from occuring.
|
|
|
|
This patch also sets the moved pos to air immediately after creating
|
|
the moving piston TE. This prevents the block from being updated from
|
|
other physics calls by the piston.
|
|
|
|
Tested against the following tnt duper design:
|
|
https://www.youtube.com/watch?v=mS7xxNGhjxs
|
|
|
|
This patch also affects every type of machine that utilises
|
|
this mechanic. For example, dead coral is removed by a physics
|
|
update when being moved while it is attached to slimeblocks.
|
|
|
|
Standard piston machines that don't destroy or modify the
|
|
blocks they move by physics updates should be entirely
|
|
unaffected.
|
|
|
|
This patch fixes https://bugs.mojang.com/browse/MC-188840
|
|
|
|
This patch also fixes rail duping and carpet duping.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
|
index bb6c38bb7a054b94a63690f6fd6036d6f376dae4..565da027ca7c395f9b965505cbe9e85e62367834 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
|
@@ -426,14 +426,26 @@ public class PistonBaseBlock extends DirectionalBlock {
|
|
}
|
|
|
|
for (j = list.size() - 1; j >= 0; --j) {
|
|
- blockposition3 = (BlockPos) list.get(j);
|
|
- iblockdata1 = world.getBlockState(blockposition3);
|
|
+ // Paper start - fix a variety of piston desync dupes
|
|
+ boolean allowDesync = io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication;
|
|
+ BlockPos oldPos = blockposition3 = (BlockPos) list.get(j);
|
|
+ iblockdata1 = allowDesync ? world.getBlockState(oldPos) : null;
|
|
+ // Paper end - fix a variety of piston desync dupes
|
|
blockposition3 = blockposition3.relative(enumdirection1);
|
|
map.remove(blockposition3);
|
|
BlockState iblockdata2 = (BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(PistonBaseBlock.FACING, dir);
|
|
|
|
world.setBlock(blockposition3, iblockdata2, 68);
|
|
- world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockposition3, iblockdata2, (BlockState) list1.get(j), dir, retract, false));
|
|
+ // Paper start - fix a variety of piston desync dupes
|
|
+ if (!allowDesync) {
|
|
+ iblockdata1 = world.getBlockState(oldPos);
|
|
+ map.replace(oldPos, iblockdata1);
|
|
+ }
|
|
+ world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockposition3, iblockdata2, allowDesync ? list1.get(j) : iblockdata1, dir, retract, false));
|
|
+ if (!allowDesync) {
|
|
+ world.setBlock(oldPos, Blocks.AIR.defaultBlockState(), Block.UPDATE_CLIENTS | Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_MOVE_BY_PISTON | 1024); // set air to prevent later physics updates from seeing this block
|
|
+ }
|
|
+ // Paper end - fix a variety of piston desync dupes
|
|
aiblockdata[i++] = iblockdata1;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
|
index 17a6327ab7b26dfab38881bbc0689b0b25f8f025..1ef87580574919796dbba707f44a413ee5c5781b 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
|
@@ -288,7 +288,7 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
|
if (world.getBlockState(pos).is(Blocks.MOVING_PISTON)) {
|
|
BlockState blockState = Block.updateFromNeighbourShapes(blockEntity.movedState, world, pos);
|
|
if (blockState.isAir()) {
|
|
- world.setBlock(pos, blockEntity.movedState, 84);
|
|
+ world.setBlock(pos, blockEntity.movedState, io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication ? 84 : (84 | Block.UPDATE_CLIENTS)); // Paper - force notify (flag 2), it's possible the set type by the piston block (which doesn't notify) set this block to air
|
|
Block.updateOrDestroy(blockEntity.movedState, blockState, world, pos, 3);
|
|
} else {
|
|
if (blockState.hasProperty(BlockStateProperties.WATERLOGGED) && blockState.getValue(BlockStateProperties.WATERLOGGED)) {
|