From 5922e6334b8f95eb563ae0ab62f2ec6cf8d95032 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Wed, 18 Dec 2024 23:35:47 +0100 Subject: [PATCH] fix allowPermanentBlockBreakExploits config --- .../bukkit/event/entity/EntityDeathEvent.java | 2 +- .../bukkit/inventory/EquipmentSlotGroup.java | 2 +- .../0006-Entity-Activation-Range-2.0.patch | 8 ++++---- ...17-Optimize-Bit-Operations-by-inlining.patch | 4 ++-- .../critereon/SimpleCriterionTrigger.java.patch | 2 +- .../ClientboundBlockEntityDataPacket.java.patch | 2 +- .../server/level/ServerPlayer.java.patch | 8 ++++---- .../world/entity/item/PrimedTnt.java.patch | 2 +- .../minecraft/world/entity/raid/Raid.java.patch | 2 +- .../world/item/FireworkRocketItem.java.patch | 2 +- .../block/piston/PistonBaseBlock.java.patch | 2 +- .../level/block/state/BlockBehaviour.java.patch | 2 +- .../world/level/chunk/ChunkGenerator.java.patch | 4 ++-- .../world/level/chunk/LevelChunk.java.patch | 8 +++----- .../structures/MineshaftPieces.java.patch | 8 -------- .../templatesystem/StructureTemplate.java.patch | 17 ++++------------- .../bukkit/craftbukkit/entity/CraftEntity.java | 4 ++-- .../craftbukkit/scheduler/CraftAsyncTask.java | 2 +- 18 files changed, 31 insertions(+), 50 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java index 086bec9daa..42ffb81708 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java @@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable; /** * Thrown whenever a LivingEntity dies */ -public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Cancellable { // Paper - make cancellable +public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Cancellable { // Paper - make cancellable private static final HandlerList handlers = new HandlerList(); private final DamageSource damageSource; private final List drops; diff --git a/paper-api/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java b/paper-api/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java index 2c4353e8fa..83b5128f91 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java +++ b/paper-api/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java @@ -25,7 +25,7 @@ public final class EquipmentSlotGroup implements Predicate { public static final EquipmentSlotGroup LEGS = get("legs", EquipmentSlot.LEGS); public static final EquipmentSlotGroup CHEST = get("chest", EquipmentSlot.CHEST); public static final EquipmentSlotGroup HEAD = get("head", EquipmentSlot.HEAD); - public static final EquipmentSlotGroup ARMOR = get("armor", (test) -> test == EquipmentSlot.FEET || test == EquipmentSlot.LEGS || test == EquipmentSlot.CHEST || test == EquipmentSlot.HEAD || test == EquipmentSlot.BODY, EquipmentSlot.CHEST); // Paper - add missing slot type + public static final EquipmentSlotGroup ARMOR = get("armor", (test) -> test == EquipmentSlot.FEET || test == EquipmentSlot.LEGS || test == EquipmentSlot.CHEST || test == EquipmentSlot.HEAD || test == EquipmentSlot.BODY, EquipmentSlot.CHEST); // Paper - add missing slot type public static final EquipmentSlotGroup BODY = get("body", EquipmentSlot.BODY); // Paper - add missing slot group // private final String key; diff --git a/paper-server/patches/features/0006-Entity-Activation-Range-2.0.patch b/paper-server/patches/features/0006-Entity-Activation-Range-2.0.patch index 811fc15914..a949aa3137 100644 --- a/paper-server/patches/features/0006-Entity-Activation-Range-2.0.patch +++ b/paper-server/patches/features/0006-Entity-Activation-Range-2.0.patch @@ -786,14 +786,14 @@ index 7c0862c50b44555fb27ce7dc46f4ec95a3eb0022..774ca9e0b56fd175ae246051de762d0c public void tick() { super.tick(); diff --git a/net/minecraft/world/entity/vehicle/MinecartHopper.java b/net/minecraft/world/entity/vehicle/MinecartHopper.java -index c553cf0592dfa606dbbb1e6854d3377b9feb5efb..dec705ec57e4f63ef2ccaa87c5400c116aee9b35 100644 +index c553cf0592dfa606dbbb1e6854d3377b9feb5efb..8341e7f01606fca90e69384c16fc19bb9e20d1b7 100644 --- a/net/minecraft/world/entity/vehicle/MinecartHopper.java +++ b/net/minecraft/world/entity/vehicle/MinecartHopper.java @@ -47,6 +47,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper if (flag != this.isEnabled()) { this.setEnabled(flag); } -+ this.immunize(); // Paper ++ this.immunize(); // Paper } public boolean isEnabled() { @@ -801,13 +801,13 @@ index c553cf0592dfa606dbbb1e6854d3377b9feb5efb..dec705ec57e4f63ef2ccaa87c5400c11 public boolean suckInItems() { if (HopperBlockEntity.suckInItems(this.level(), this)) { -+ this.immunize(); // Paper ++ this.immunize(); // Paper return true; } else { for (ItemEntity itemEntity : this.level() .getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25, 0.0, 0.25), EntitySelector.ENTITY_STILL_ALIVE)) { if (HopperBlockEntity.addItem(this, itemEntity)) { -+ this.immunize(); // Paper ++ this.immunize(); // Paper return true; } } diff --git a/paper-server/patches/features/0017-Optimize-Bit-Operations-by-inlining.patch b/paper-server/patches/features/0017-Optimize-Bit-Operations-by-inlining.patch index 2958bae139..688e72d605 100644 --- a/paper-server/patches/features/0017-Optimize-Bit-Operations-by-inlining.patch +++ b/paper-server/patches/features/0017-Optimize-Bit-Operations-by-inlining.patch @@ -7,7 +7,7 @@ Inline bit operations and reduce instruction count to make these hot operations faster diff --git a/net/minecraft/core/BlockPos.java b/net/minecraft/core/BlockPos.java -index 98f0b1cf19d7a035849a9a2fa25e2be3a4c5a980..0822a0faf7af9e746e7936ac17597b1f51e40a92 100644 +index 98f0b1cf19d7a035849a9a2fa25e2be3a4c5a980..a81694a22e94cca6f7110f7d5b205d1303f4e071 100644 --- a/net/minecraft/core/BlockPos.java +++ b/net/minecraft/core/BlockPos.java @@ -51,15 +51,17 @@ public class BlockPos extends Vec3i { @@ -62,7 +62,7 @@ index 98f0b1cf19d7a035849a9a2fa25e2be3a4c5a980..0822a0faf7af9e746e7936ac17597b1f public static int getZ(long packedPos) { - return (int)(packedPos << 64 - Z_OFFSET - PACKED_HORIZONTAL_LENGTH >> 64 - PACKED_HORIZONTAL_LENGTH); -+ return (int) ((packedPos << 26) >> 38); // Paper - simplify/inline ++ return (int) ((packedPos << 26) >> 38); // Paper - simplify/inline } public static BlockPos of(long packedPos) { diff --git a/paper-server/patches/sources/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java.patch b/paper-server/patches/sources/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java.patch index 1817a4cb37..c4d7639889 100644 --- a/paper-server/patches/sources/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java.patch +++ b/paper-server/patches/sources/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java.patch @@ -10,7 +10,7 @@ @Override public final void addPlayerListener(PlayerAdvancements playerAdvancements, CriterionTrigger.Listener listener) { - this.players.computeIfAbsent(playerAdvancements, advancements -> Sets.newHashSet()).add(listener); -+ playerAdvancements.criterionData.computeIfAbsent(this, managerx -> Sets.newHashSet()).add(listener); // Paper - fix PlayerAdvancements leak ++ playerAdvancements.criterionData.computeIfAbsent(this, managerx -> Sets.newHashSet()).add(listener); // Paper - fix PlayerAdvancements leak } @Override diff --git a/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java.patch b/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java.patch index dad6ace870..92492a6835 100644 --- a/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java.patch +++ b/paper-server/patches/sources/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java.patch @@ -5,7 +5,7 @@ public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity, BiFunction dataGetter) { RegistryAccess registryAccess = blockEntity.getLevel().registryAccess(); - return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), dataGetter.apply(blockEntity, registryAccess)); -+ return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), blockEntity.sanitizeSentNbt(dataGetter.apply(blockEntity, registryAccess))); // Paper - Sanitize sent data ++ return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), blockEntity.sanitizeSentNbt(dataGetter.apply(blockEntity, registryAccess))); // Paper - Sanitize sent data } public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity) { diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch index b6c60e488c..eae0ca32da 100644 --- a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch @@ -511,7 +511,7 @@ private boolean isPvpAllowed() { - return this.server.isPvpAllowed(); -+ return this.level().pvpMode; // CraftBukkit - this.server.isPvpAllowed() -> this.world.pvpMode ++ return this.level().pvpMode; // CraftBukkit - this.server.isPvpAllowed() -> this.world.pvpMode } - public TeleportTransition findRespawnPositionAndUseSpawnBlock(boolean useCharge, TeleportTransition.PostTeleportTransition postTeleportTransition) { @@ -541,7 +541,7 @@ } else { - return new TeleportTransition(this.server.overworld(), this, postTeleportTransition); - } -+ teleportTransition = new TeleportTransition(this.server.overworld(), this, postTeleportTransition); // CraftBukkit ++ teleportTransition = new TeleportTransition(this.server.overworld(), this, postTeleportTransition); // CraftBukkit + } + // CraftBukkit start + if (respawnReason == null) { @@ -1123,7 +1123,7 @@ for (MobEffectInstance mobEffectInstance : that.getActiveEffects()) { - this.addEffect(new MobEffectInstance(mobEffectInstance)); -+ // this.addEffect(new MobEffectInstance(mobEffectInstance)); // CraftBukkit ++ // this.addEffect(new MobEffectInstance(mobEffectInstance)); // CraftBukkit } this.getInventory().replaceWith(that.getInventory()); @@ -1203,7 +1203,7 @@ + // Paper end if (this.acceptsChatMessages()) { - message.sendToPlayer(this, filtered, boundType); -+ message.sendToPlayer(this, filtered, boundType, unsigned); // Paper ++ message.sendToPlayer(this, filtered, boundType, unsigned); // Paper } } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch index 1bbdb4c9b6..45ed0bc03d 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch @@ -26,7 +26,7 @@ this(EntityType.TNT, level); this.setPos(x, y, z); - double d = level.random.nextDouble() * (float) (Math.PI * 2); -+ double d = this.random.nextDouble() * (float) (Math.PI * 2); // Paper - Don't use level random in entity constructors ++ double d = this.random.nextDouble() * (float) (Math.PI * 2); // Paper - Don't use level random in entity constructors this.setDeltaMovement(-Math.sin(d) * 0.02, 0.2F, -Math.cos(d) * 0.02); this.setFuse(80); this.xo = x; diff --git a/paper-server/patches/sources/net/minecraft/world/entity/raid/Raid.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/raid/Raid.java.patch index 34ed85451b..f5c2c2d983 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/raid/Raid.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/raid/Raid.java.patch @@ -66,7 +66,7 @@ } if (i > 5) { -+ org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.UNSPAWNABLE); // CraftBukkit ++ org.bukkit.craftbukkit.event.CraftEventFactory.callRaidStopEvent(this, org.bukkit.event.raid.RaidStopEvent.Reason.UNSPAWNABLE); // CraftBukkit this.stop(); break; } diff --git a/paper-server/patches/sources/net/minecraft/world/item/FireworkRocketItem.java.patch b/paper-server/patches/sources/net/minecraft/world/item/FireworkRocketItem.java.patch index 8ab255c440..00153390e9 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/FireworkRocketItem.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/FireworkRocketItem.java.patch @@ -34,7 +34,7 @@ - itemInHand.consume(1, player); - player.awardStat(Stats.ITEM_USED.get(this)); + // Paper start - PlayerElytraBoostEvent -+ final Projectile.Delayed delayed = Projectile.spawnProjectileDelayed(new FireworkRocketEntity(level, itemInHand, player), serverLevel, itemInHand, f -> f.spawningEntity = player.getUUID()); // Paper - firework api - assign spawning entity uuid ++ final Projectile.Delayed delayed = Projectile.spawnProjectileDelayed(new FireworkRocketEntity(level, itemInHand, player), serverLevel, itemInHand, f -> f.spawningEntity = player.getUUID()); // Paper - firework api - assign spawning entity uuid + com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Firework) delayed.projectile().getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand)); + if (event.callEvent() && delayed.attemptSpawn()) { + player.awardStat(Stats.ITEM_USED.get(this)); // Moved up from below diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch index 239a88e07e..680447ba4e 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch @@ -25,7 +25,7 @@ Direction direction = state.getValue(FACING); + // Paper start - Protect Bedrock and End Portal/Frames from being destroyed; prevent retracting when we're facing the wrong way (we were replaced before retraction could occur) + Direction directionQueuedAs = Direction.from3DDataValue(param & 7); // Paper - copied from below -+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPermanentBlockBreakExploits && directionQueuedAs != directionQueuedAs) { ++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPermanentBlockBreakExploits && direction != directionQueuedAs) { + return false; + } + // Paper end - Protect Bedrock and End Portal/Frames from being destroyed diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/state/BlockBehaviour.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/state/BlockBehaviour.java.patch index f0c398822e..4f4759e0c9 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/state/BlockBehaviour.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/state/BlockBehaviour.java.patch @@ -53,7 +53,7 @@ protected boolean canBeReplaced(BlockState state, BlockPlaceContext useContext) { - return state.canBeReplaced() && (useContext.getItemInHand().isEmpty() || !useContext.getItemInHand().is(this.asItem())); -+ return state.canBeReplaced() && (useContext.getItemInHand().isEmpty() || !useContext.getItemInHand().is(this.asItem()))&& (state.isDestroyable() || (useContext.getPlayer() != null && useContext.getPlayer().getAbilities().instabuild)); // Paper - Protect Bedrock and End Portal/Frames from being destroyed ++ return state.canBeReplaced() && (useContext.getItemInHand().isEmpty() || !useContext.getItemInHand().is(this.asItem())) && (state.isDestroyable() || (useContext.getPlayer() != null && useContext.getPlayer().getAbilities().instabuild)); // Paper - Protect Bedrock and End Portal/Frames from being destroyed } protected boolean canBeReplaced(BlockState state, Fluid fluid) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkGenerator.java.patch b/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkGenerator.java.patch index 32ce3a4e7d..5fa4572bc5 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkGenerator.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/chunk/ChunkGenerator.java.patch @@ -51,7 +51,7 @@ - boolean flag = i == -z || i == z; + // Paper start - Perf: iterate over border chunks instead of entire square chunk area + final int radius = z; -+ boolean flag = i == -z || i == z; final boolean onBorderAlongZAxis = flag; // Paper - OBFHELPER ++ boolean flag = i == -z || i == z; final boolean onBorderAlongZAxis = flag; // Paper - OBFHELPER - for (int i1 = -z; i1 <= z; i1++) { - boolean flag1 = i1 == -z || i1 == z; @@ -82,7 +82,7 @@ + long featurePopulationSeed = l; + final long configFeatureSeed = level.getMinecraftWorld().paperConfig().featureSeeds.features.getLong(placedFeature.feature()); + if (configFeatureSeed != -1) { -+ featurePopulationSeed = worldgenRandom.setDecorationSeed(configFeatureSeed, blockPos.getX(), blockPos.getZ()); // See seededrandom.setDecorationSeed from above ++ featurePopulationSeed = worldgenRandom.setDecorationSeed(configFeatureSeed, blockPos.getX(), blockPos.getZ()); // See WorldgenRandom.setDecorationSeed from above + } + worldgenRandom.setFeatureSeed(featurePopulationSeed, i3, i); + // Paper end - Configurable feature seeds diff --git a/paper-server/patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch b/paper-server/patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch index 0adecb3d87..dcd413b184 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch @@ -265,7 +265,7 @@ public boolean isEmpty() { return false; } -@@ -711,23 +_,25 @@ +@@ -711,23 +_,24 @@ if (this.blockEntity.getType().isValid(blockState)) { this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity); this.loggedInvalidBlockState = false; @@ -278,17 +278,15 @@ - LogUtils.defer(this::getPos), - blockState - ); -- } + // Paper start - Remove the Block Entity if it's invalid + } else { + LevelChunk.this.removeBlockEntity(this.getPos()); + if (!this.loggedInvalidBlockState) { + this.loggedInvalidBlockState = true; -+ LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), blockState}); ++ LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", LogUtils.defer(this::getType), LogUtils.defer(this::getPos), blockState); + } + // Paper end - Remove the Block Entity if it's invalid -+ } -+ + } profilerFiller.pop(); } catch (Throwable var5) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java.patch b/paper-server/patches/sources/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java.patch index 50b84588ce..be468da02b 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java.patch @@ -1,13 +1,5 @@ --- a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java -@@ -8,6 +_,7 @@ - import net.minecraft.core.Direction; - import net.minecraft.nbt.CompoundTag; - import net.minecraft.nbt.NbtOps; -+import net.minecraft.nbt.Tag; - import net.minecraft.resources.ResourceKey; - import net.minecraft.tags.BiomeTags; - import net.minecraft.util.RandomSource; @@ -401,10 +_,13 @@ BlockPos worldPos = this.getWorldPos(1, 0, i8); if (box.isInside(worldPos) && this.isInterior(level, 1, 0, i8, box)) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch b/paper-server/patches/sources/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch index 7839e3322c..c88b4e61e3 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch @@ -1,13 +1,5 @@ --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -25,6 +_,7 @@ - import net.minecraft.nbt.IntTag; - import net.minecraft.nbt.ListTag; - import net.minecraft.nbt.NbtUtils; -+import net.minecraft.nbt.Tag; - import net.minecraft.resources.ResourceLocation; - import net.minecraft.util.RandomSource; - import net.minecraft.world.Clearable; @@ -54,6 +_,10 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.BitSetDiscreteVoxelShape; @@ -108,7 +100,7 @@ if (!settings.isIgnoreEntities()) { this.placeEntities( - serverLevel, -+ wrappedAccess, // CraftBukkit ++ wrappedAccess, // CraftBukkit offset, settings.getMirror(), settings.getRotation(), @@ -143,15 +135,14 @@ return NbtUtils.addCurrentDataVersion(tag); } -@@ -720,6 +_,13 @@ +@@ -720,6 +_,12 @@ this.entityInfoList.add(new StructureTemplate.StructureEntityInfo(vec3, blockPos, compound1)); } } + + // CraftBukkit start - PDC -+ Tag base = tag.get("BukkitValues"); -+ if (base instanceof CompoundTag) { -+ this.persistentDataContainer.putAll((CompoundTag) base); ++ if (tag.get("BukkitValues") instanceof CompoundTag compoundTag) { ++ this.persistentDataContainer.putAll(compoundTag); + } + // CraftBukkit end } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 8c3a6a15dd..91b78711ec 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1252,12 +1252,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { // Paper start - missing entity api @Override - public boolean isInvisible() { // Paper - moved up from LivingEntity + public boolean isInvisible() { // Paper - moved up from LivingEntity return this.getHandle().isInvisible(); } @Override - public void setInvisible(boolean invisible) { // Paper - moved up from LivingEntity + public void setInvisible(boolean invisible) { // Paper - moved up from LivingEntity this.getHandle().persistentInvisibility = invisible; this.getHandle().setSharedFlag(Entity.FLAG_INVISIBLE, invisible); } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java b/paper-server/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java index e97f6b76ef..e4e2e42d0c 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java @@ -28,7 +28,7 @@ class CraftAsyncTask extends CraftTask { // Paper start - name threads according to running plugin final String nameBefore = thread.getName(); thread.setName(nameBefore + " - " + this.getOwner().getName()); - try { synchronized (this.workers) { // Paper end - name threads according to running plugin + try { synchronized (this.workers) { // Paper end - name threads according to running plugin if (this.getPeriod() == CraftTask.CANCEL) { // Never continue running after cancelled. // Checking this with the lock is important!