geforkt von Mirrors/Paper
01a13871de
Patch documentation to come Issues with the old system that are fixed now: - World generation does not scale with cpu cores effectively. - Relies on the main thread for scheduling and maintaining chunk state, dropping chunk load/generate rates at lower tps. - Unreliable prioritisation of chunk gen/load calls that block the main thread. - Shutdown logic is utterly unreliable, as it has to wait for all chunks to unload - is it guaranteed that the chunk system is in a state on shutdown that it can reliably do this? Watchdog shutdown also typically failed due to thread checks, which is now resolved. - Saving of data is not unified (i.e can save chunk data without saving entity data, poses problems for desync if shutdown is really abnormal. - Entities are not loaded with chunks. This caused quite a bit of headache for Chunk#getEntities API, but now the new chunk system loads entities with chunks so that they are ready whenever the chunk loads in. Effectively brings the behavior back to 1.16 era, but still storing entities in their own separate regionfiles. The above list is not complete. The patch documentation will complete it. New chunk system hard relies on starlight and dataconverter, and most importantly the new concurrent utilities in ConcurrentUtil. Some of the old async chunk i/o interface (i.e the old file io thread reroutes _some_ calls to the new file io thread) is kept for plugin compat reasons. It will be removed in the next major version of minecraft. The old legacy chunk system patches have been moved to the removed folder in case we need them again.
81 Zeilen
5.1 KiB
Diff
81 Zeilen
5.1 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 29755807fdb6c30e31c0ec2bbf33bed9afd5d478..8d73893100884c08aa552ff41c2a07a3e714df47 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
|
|
@@ -411,14 +411,26 @@ public class PistonBaseBlock extends DirectionalBlock {
|
|
}
|
|
|
|
for (k = list.size() - 1; k >= 0; --k) {
|
|
- blockposition3 = (BlockPos) list.get(k);
|
|
- 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(k);
|
|
+ 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(k), 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(k) : iblockdata1, dir, retract, false));
|
|
+ if (!allowDesync) {
|
|
+ world.setBlock(oldPos, Blocks.AIR.defaultBlockState(), 2 | 4 | 16 | 1024); // set air to prevent later physics updates from seeing this block
|
|
+ }
|
|
+ // Paper end - fix a variety of piston desync dupes
|
|
aiblockdata[j++] = 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 dda0b32a4989bbead35a2219a969a30ba0e975b0..7c59d44a3bafdc65f453d77ff3e25cffb742ad6c 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
|
|
@@ -285,7 +285,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 | 2)); // 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)) {
|