Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
1cfd363d32
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: fc460d1b PR-735: Add Villager#zombify c8c8331e PR-690: Add method to read ItemStack input 62845f2f SPIGOT-6829: Add per-player world border API CraftBukkit Changes: a459f4d4 PR-1033: Add Villager#zombify d65d1430 PR-975: Add method to read ItemStack input b5559f8c SPIGOT-6990: Fix setRepairCost(0) in Anvil 6c308e1b SPIGOT-6829: Add per-player world border API Spigot Changes: 42b61526 SPIGOT-7000: Generation and /locate issues when using custom structure seeds
39 Zeilen
2.5 KiB
Diff
39 Zeilen
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Nassim Jahnke <jahnke.nassim@gmail.com>
|
|
Date: Fri, 7 Jan 2022 11:45:15 +0100
|
|
Subject: [PATCH] Reset placed block on exception
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
index 8175bb6331727440da2232998bdad068a1c47ae8..893d5bf448ddbccb30db0ee751c7f4a4e83634b9 100644
|
|
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
@@ -78,6 +78,7 @@ public class BlockItem extends Item {
|
|
if (this instanceof WaterLilyBlockItem || this instanceof SolidBucketItem) {
|
|
blockstate = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos());
|
|
}
|
|
+ final org.bukkit.block.BlockState oldBlockstate = blockstate != null ? blockstate : org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos()); // Paper
|
|
// CraftBukkit end
|
|
|
|
if (iblockdata == null) {
|
|
@@ -93,7 +94,19 @@ public class BlockItem extends Item {
|
|
|
|
if (iblockdata1.is(iblockdata.getBlock())) {
|
|
iblockdata1 = this.updateBlockStateFromTag(blockposition, world, itemstack, iblockdata1);
|
|
+ // Paper start - reset block on exception
|
|
+ try {
|
|
this.updateCustomBlockEntityTag(blockposition, world, entityhuman, itemstack, iblockdata1);
|
|
+ } catch (Exception e) {
|
|
+ oldBlockstate.update(true, false);
|
|
+ if (entityhuman instanceof ServerPlayer player) {
|
|
+ org.apache.logging.log4j.LogManager.getLogger().error("Player {} tried placing invalid block", player.getScoreboardName(), e);
|
|
+ player.getBukkitEntity().kickPlayer("Packet processing error");
|
|
+ return InteractionResult.FAIL;
|
|
+ }
|
|
+ throw e; // Rethrow exception if not placed by a player
|
|
+ }
|
|
+ // Paper end
|
|
iblockdata1.getBlock().setPlacedBy(world, blockposition, iblockdata1, entityhuman, itemstack);
|
|
// CraftBukkit start
|
|
if (blockstate != null) {
|