Archiviert
13
0
Dieser Commit ist enthalten in:
Bjarne Koll 2024-10-25 00:08:35 +02:00
Ursprung 7616ebccd8
Commit 6a315742d9
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 27F6CCCF55D2EE62
21 geänderte Dateien mit 221 neuen und 263 gelöschten Zeilen

Datei anzeigen

@ -12,10 +12,10 @@ This patch moves the invocation directly before the #actuallyHurt calls,
respective invulnerable timings.
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 3b15995efc65a351da8dac009b9698494771fefb..5079775ce8f86fb061e616190513f56ff086e409 100644
index f75b66c9ec786bc6f4d3f5cd5127c815f11166c4..b4d1848858fae20f81c27b31bc0c280c6705f082 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1459,12 +1459,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1491,12 +1491,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
// CraftBukkit start
@ -29,7 +29,7 @@ index 3b15995efc65a351da8dac009b9698494771fefb..5079775ce8f86fb061e616190513f56f
// CraftBukkit end
this.walkAnimation.setSpeed(1.5F);
@@ -1475,6 +1470,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1511,6 +1506,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
return false;
}
@ -39,9 +39,9 @@ index 3b15995efc65a351da8dac009b9698494771fefb..5079775ce8f86fb061e616190513f56f
+ // Paper end - only call damage event when actuallyHurt will be called - move call logic down
+
// CraftBukkit start
if (!this.actuallyHurt(source, (float) event.getFinalDamage() - this.lastHurt, event)) {
if (!this.actuallyHurt(world, source, (float) event.getFinalDamage() - this.lastHurt, event)) {
return false;
@@ -1484,6 +1484,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1520,6 +1520,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.lastHurt = amount;
flag1 = false;
} else {
@ -50,9 +50,9 @@ index 3b15995efc65a351da8dac009b9698494771fefb..5079775ce8f86fb061e616190513f56f
+ amount = computeAmountFromEntityDamageEvent(event);
+ // Paper end - only call damage event when actuallyHurt will be called - move call logic down
// CraftBukkit start
if (!this.actuallyHurt(source, (float) event.getFinalDamage(), event)) {
if (!this.actuallyHurt(world, source, (float) event.getFinalDamage(), event)) {
return false;
@@ -1615,6 +1619,18 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1655,6 +1659,18 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add ItemType#getItemRarity
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
index bae3dd5fc67e6b3d98a5e63ffbf639c5042f8843..450c63c31d2f5d056d989aa00452231f50c8224d 100644
index 96dfcfa12c63c682edcdec98647ca6a94d9fb4ed..d3f650d040afae8cb962696381c692cd7884bb4d 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
@@ -265,4 +265,12 @@ public class CraftItemType<M extends ItemMeta> implements ItemType.Typed<M>, Han
@@ -262,4 +262,12 @@ public class CraftItemType<M extends ItemMeta> implements ItemType.Typed<M>, Han
return this.item.getDescriptionId();
}
// Paper end - add Translatable

Datei anzeigen

@ -12,15 +12,15 @@ This value however may be too low in high latency environments.
The patch exposes a new configuration option to configure said value.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4c04eb531b6989f7e618d201ecaa84298eab52c4..62d5ca25104e10ca16c2005ef9272bf8329ce145 100644
index 14a8e05420ae4ca2f1d9028e19379d162a3e6971..c9fd2b8cc5a14d4ef4072765d5274d0c470bcfe6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2702,7 +2702,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2722,7 +2722,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
AABB axisalignedbb = entity.getBoundingBox();
- if (this.player.canInteractWithEntity(axisalignedbb, 1.0D)) {
+ if (this.player.canInteractWithEntity(axisalignedbb, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(1.0D))) { // Paper - configurable lenience value for interact range
- if (this.player.canInteractWithEntity(axisalignedbb, 3.0D)) {
+ if (this.player.canInteractWithEntity(axisalignedbb, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0D))) { // Paper - configurable lenience value for interact range
packet.dispatch(new ServerboundInteractPacket.Handler() {
private void performInteraction(InteractionHand enumhand, ServerGamePacketListenerImpl.EntityInteraction playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit
ItemStack itemstack = ServerGamePacketListenerImpl.this.player.getItemInHand(enumhand);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix PickupStatus getting reset
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index ddf47dab1ab92c45e3eea09239d418a9798ed59e..9ca29b3d4bf8bca5f51f3644e12fcbec2cb5d35e 100644
index 14e31ae88e90d8ea1a98800cc6c1c3527bb2ed6b..accc246f441c8bf5e1a755cfc0db8f97c0c01c6b 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -668,7 +668,14 @@ public abstract class AbstractArrow extends Projectile {
@@ -714,7 +714,14 @@ public abstract class AbstractArrow extends Projectile {
@Override
public void setOwner(@Nullable Entity entity) {
@ -24,13 +24,13 @@ index ddf47dab1ab92c45e3eea09239d418a9798ed59e..9ca29b3d4bf8bca5f51f3644e12fcbec
byte b0 = 0;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index f2bdd95a6ae77400742d87bcae35c09fb8b047ba..10ade433c083851d9ea4797c6ec618db122229f9 100644
index 3982b32cf69250ebd138eff225b65313f75286ea..03c1bffd3125bb7a82ac921b0a23dcab55c33c4f 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -240,7 +240,13 @@ public abstract class Projectile extends Entity implements TraceableEntity {
@@ -353,7 +353,13 @@ public abstract class Projectile extends Entity implements TraceableEntity {
public boolean deflect(ProjectileDeflection deflection, @Nullable Entity deflector, @Nullable Entity owner, boolean fromAttack) {
deflection.deflect(this, deflector, this.random);
if (!this.level().isClientSide) {
deflection.deflect(this, deflector, this.random);
- this.setOwner(owner);
+ // Paper start - Fix PickupStatus getting reset
+ if (this instanceof AbstractArrow arrow) {
@ -43,10 +43,10 @@ index f2bdd95a6ae77400742d87bcae35c09fb8b047ba..10ade433c083851d9ea4797c6ec618db
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
index faa08ad912fa43e7a6c5a2359e23c04c059c5edf..501e2aa3a10dae94c4a8d9dfcdc902e434fcca62 100644
index 1f30109abd86b76af343eb5eb75ec3db83ef9417..d0c30fd12aa9866900fe72b97d10c257479cf010 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractArrow.java
@@ -170,4 +170,16 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
@@ -173,4 +173,16 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
this.getHandle().setSoundEvent(org.bukkit.craftbukkit.CraftSound.bukkitToMinecraft(sound));
}
// Paper end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Check for block type in SculkSensorBlock#canActivate
diff --git a/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java b/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java
index b45bc43b5a59a95c50bd756a981368c7fdadbd41..8d57c68d2f20f7c0d5c1be5d5b12e6926aad8c58 100644
index 22d299a19f19ad5dd13262792ae448311d1ea3e4..0ed449a188d98f87dbddd2d76009fed02a29ed25 100644
--- a/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java
@@ -218,7 +218,7 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg
@@ -219,7 +219,7 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg
}
public static boolean canActivate(BlockState state) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add API for CanPlaceOn and CanDestroy NBT values
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 7f6f404f5a2be7876ae239355979e8c8a7a198ce..07f31bce96e3c47bea43b5d6443070ae158430ef 100644
index 450c5aa14b4195eb7123492c7a111ec6f40ce412..7d9f75e680e243ac8c7defdd150e431b47225945 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -2185,4 +2185,117 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -2498,4 +2498,117 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
// Paper end

Datei anzeigen

@ -14,10 +14,10 @@ This allows us to have both the reduced number of item entities a high item-merg
without most of the visual artifacts caused by items merging vertically.
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index cbfb07bdf8d5e2e5a462835184be2d47e59d506c..03cfa29bdb426a9fb6b1b6be6e897da48d4f2f3e 100644
index e83a705f54063a17fc69a22683333aacad5a43ce..246b5649883e4f305afa5a887b9df0f3735f7593 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -282,7 +282,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -285,7 +285,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
if (this.isMergable()) {
// Spigot start
double radius = this.level().spigotConfig.itemMerge;

Datei anzeigen

@ -7,10 +7,10 @@ In worlds that are extremely large (greater than 1TB), it can take an insanely l
This patch adds a system property to disable the symlink scan, which can be used to speed up world loading.
diff --git a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
index 427ee4d6f12a7abd8da0c65e0b9081b25824df40..85ba843ce7e1f62971e736fa2cc028c47b274ce4 100644
index b5abdd1498a3d19559149c30ba959aa2bcf0246c..79397b3c76e4b9d2ee03dfa16c2daf4f71ae8b4d 100644
--- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
+++ b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
@@ -420,7 +420,7 @@ public class LevelStorageSource {
@@ -411,7 +411,7 @@ public class LevelStorageSource {
public LevelStorageSource.LevelStorageAccess validateAndCreateAccess(String s, ResourceKey<LevelStem> dimensionType) throws IOException, ContentValidationException { // CraftBukkit
Path path = this.getLevelPath(s);

Datei anzeigen

@ -61,23 +61,23 @@ index 0000000000000000000000000000000000000000..a9ddf9a4a07cd29833f38d7e5f42b2b1
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
index e33b1b6fd50a4eea57500cc00dba20d6edcab75d..01a9660de65688b7c1a4f9dafcb650774ce1853b 100644
index 412fd9e87ec81cf50cb8bc82fe2dad5dd0029039..9046d6fa36b9f5e5d25835ad8d94c869c0764060 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.CraftServer;
@@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Entity;
-public class CraftBoat extends CraftVehicle implements Boat {
+public class CraftBoat extends CraftVehicle implements Boat, io.papermc.paper.entity.PaperLeashable { // Paper - Leashable API
-public abstract class CraftBoat extends CraftVehicle implements Boat {
+public abstract class CraftBoat extends CraftVehicle implements Boat, io.papermc.paper.entity.PaperLeashable { // Paper - Leashable API
public CraftBoat(CraftServer server, net.minecraft.world.entity.vehicle.Boat entity) {
public CraftBoat(CraftServer server, AbstractBoat entity) {
super(server, entity);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 7e280955067169f63f15162e9cad1e86e824a8e5..4750df7354ccb5afd0910efe0415f3a2eb19a546 100644
index f16067b674118a47735ad22797988d50b4415040..d0c409f4efad289e3e325f44b500fc72589d89d4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -777,43 +777,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -784,43 +784,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean isLeashed() {
@ -125,7 +125,7 @@ index 7e280955067169f63f15162e9cad1e86e824a8e5..4750df7354ccb5afd0910efe0415f3a2
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index deb66c04abefb4a88521483db1612e494bd27164..5f9f7e325e3e0276f7a475c4a4725cc0e1b54afd 100644
index 95d7015a61098d1d22a501124d6bb8fba1516fe3..778a9d3f8bfe5dba59e1e655e4eeb8822678b8cf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -11,7 +11,7 @@ import org.bukkit.entity.LivingEntity;
@ -138,7 +138,7 @@ index deb66c04abefb4a88521483db1612e494bd27164..5f9f7e325e3e0276f7a475c4a4725cc0
super(server, entity);
paperPathfinder = new com.destroystokyo.paper.entity.PaperPathfinder(entity); // Paper - Mob Pathfinding API
@@ -175,4 +175,21 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
return getHandle().getExperienceReward((ServerLevel) this.getHandle().level(), null);
return getHandle().getExperienceReward((net.minecraft.server.level.ServerLevel) this.getHandle().level(), null);
}
// Paper end
+

Datei anzeigen

@ -10,10 +10,10 @@ public net.minecraft.world.inventory.AbstractContainerMenu quickcraftType
public net.minecraft.world.inventory.AbstractContainerMenu resetQuickCraft()V
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index f93edc8a6ed7c51ec6e9335f66ab146d6aeb69a0..589214abe82c2acf6bbfda54b25f9385a6b575c4 100644
index c9fd2b8cc5a14d4ef4072765d5274d0c470bcfe6..1ab3f730301e8ac22702601a04ad8f1521585daa 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3127,6 +3127,25 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3080,6 +3080,25 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
break;
case QUICK_CRAFT:
@ -40,10 +40,10 @@ index f93edc8a6ed7c51ec6e9335f66ab146d6aeb69a0..589214abe82c2acf6bbfda54b25f9385
break;
case PICKUP_ALL:
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 46159a127d910028c62ada90ff2d2dccc3b62fc3..dd4218e108f87f3305b76fbc8d88f488b447c609 100644
index 78d0ff45c016e900d87010e8b26b0bb10e63f445..4680f77a275d8d2b226018db89a571ac25998dd8 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -431,7 +431,7 @@ public abstract class AbstractContainerMenu {
@@ -468,7 +468,7 @@ public abstract class AbstractContainerMenu {
}
} else if (this.quickcraftStatus == 2) {
if (!this.quickcraftSlots.isEmpty()) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SculkBloomEvent firing for block entity loading
diff --git a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
index dbdd9cb76f9e2d0962001d9a1e82896c907d7aea..427e9bcb1fa9436543d7ff974eb8642ccce4a6a3 100644
index b9a1709b79c1f7a21c9d08f986d4ea3b546e4a67..24590d131587c4e1def920333140b1575f9d7471 100644
--- a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
+++ b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
@@ -125,7 +125,7 @@ public class SculkSpreader {
@@ -126,7 +126,7 @@ public class SculkSpreader {
int i = Math.min(list.size(), 32);
for (int j = 0; j < i; ++j) {
@ -17,7 +17,7 @@ index dbdd9cb76f9e2d0962001d9a1e82896c907d7aea..427e9bcb1fa9436543d7ff974eb8642c
}
}
@@ -145,16 +145,16 @@ public class SculkSpreader {
@@ -146,16 +146,16 @@ public class SculkSpreader {
while (charge > 0) {
int j = Math.min(charge, 1000);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add enchantment seed update API
diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
index 1ef014b29645ed09ccffb898f1819428c3dc6259..9bc9b4218ffd966f43097c9e009b2926af58c810 100644
index b7300052f3c3d496ea41b681a2d5d5b554e67c63..50a735dd97daab4fb9579f922a4c63de60204f29 100644
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
@@ -411,4 +411,10 @@ public class EnchantmentMenu extends AbstractContainerMenu {
@@ -399,4 +399,10 @@ public class EnchantmentMenu extends AbstractContainerMenu {
return this.bukkitEntity;
}
// CraftBukkit end
@ -20,7 +20,7 @@ index 1ef014b29645ed09ccffb898f1819428c3dc6259..9bc9b4218ffd966f43097c9e009b2926
+ // Paper end - add enchantment seed update API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java
index 4d28a2e9a4bfd9adee934c3033f32a8cf66286db..3b3d2d6d23d8f3b75ec52df17b86f6639c8c349b 100644
index 17f0ce8fcb6d44579d88cfcf01de40485b0037dc..abe709ab9002b30a996e46779843969c984c9be9 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java
@@ -26,6 +26,13 @@ public class CraftEnchantmentView extends CraftInventoryView<EnchantmentMenu, En

Datei anzeigen

@ -9,10 +9,10 @@ In the case where multiple messages from different players are being processed i
This also applies to the last seen state of the server, which becomes inconsistent in the same way as the message signature cache and would cause any messages sent to be rejected by the server too.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 589214abe82c2acf6bbfda54b25f9385a6b575c4..fcccf989c25f0a259b160c4ff7873f7009e64d14 100644
index 1ab3f730301e8ac22702601a04ad8f1521585daa..1722f11ad070715077f5dcaff008b98f7ee104ab 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2715,8 +2715,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2663,8 +2663,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return;
}
// CraftBukkit end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix InventoryOpenEvent cancellation
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 6c280abdef5f80b668d6090f9d35283a33e21e0c..c396580a9cfd86ff261bed439bb4662ae88010b5 100644
index b0cec2132c21abac64420e0d9a23b5346dfd9ee4..c1870b953e22922762015cb8d7f71a2b7f004299 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1710,6 +1710,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@@ -1942,6 +1942,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
} else if (factory instanceof ChestBlock.DoubleInventory) {
// SPIGOT-5355 - double chests too :(
((ChestBlock.DoubleInventory) factory).inventorylargechest.stopOpen(this);
@ -20,38 +20,41 @@ index 6c280abdef5f80b668d6090f9d35283a33e21e0c..c396580a9cfd86ff261bed439bb4662a
return OptionalInt.empty();
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index cc01ead133cc6859ca5d7a1d0ac3c12955e590da..ee9e4521079137d7b72194e8789810e7a89b8e75 100644
index 5d189ba60d40f5c42b2dacc339594ed067418e95..504c996220b278c194c93e001a3b326d549868ec 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -566,8 +566,7 @@ public class ServerPlayerGameMode {
@@ -572,8 +572,7 @@ public class ServerPlayerGameMode {
} else if (this.gameModeForPlayer == GameType.SPECTATOR) {
MenuProvider itileinventory = iblockdata.getMenuProvider(world, blockposition);
- if (itileinventory != null) {
- player.openMenu(itileinventory);
+ if (itileinventory != null && player.openMenu(itileinventory).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
return InteractionResult.SUCCESS;
return InteractionResult.CONSUME;
} else {
return InteractionResult.PASS;
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
index 4cdf3b54187ebcb1f5ddfa6114386127a2846f01..c14019a131c90c699b8a76bada82592b66f0fa89 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
@@ -127,8 +127,7 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
index 8033abfd77bcc20326b992a9d81e2faa9582fb83..1f4cc08e84a23213bb9786ea09ad77caeec2d336 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
@@ -125,10 +125,10 @@ public abstract class AbstractChestBoat extends AbstractBoat implements HasCusto
@Override
public void openCustomInventoryScreen(Player player) {
- player.openMenu(this);
- if (!player.level().isClientSide) {
+ if (!player.level().isClientSide && player.openMenu(this).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
+ // Paper - fix inventory open cancel - moved into below if
Level world = player.level();
- if (world instanceof ServerLevel worldserver) {
+ if (world instanceof ServerLevel worldserver && player.openMenu(this).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
this.gameEvent(GameEvent.CONTAINER_OPEN, player);
PiglinAi.angerNearbyPiglins(player, true);
PiglinAi.angerNearbyPiglins(worldserver, player, true);
}
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
index 845eff7401b811c179dc9dee70eca0d724be5c80..9fdeaaa67a39b7b4bd2ac8f58dd38b87c6540e3e 100644
index 35f90e06dcf30c2e6a2a63e81215283ffbb3ec05..5e7a5248852319471525019b3efcfdb730a9af46 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
@@ -97,7 +97,11 @@ public interface ContainerEntity extends Container, MenuProvider {
@@ -95,7 +95,11 @@ public interface ContainerEntity extends Container, MenuProvider {
}
default InteractionResult interactWithContainerVehicle(Player player) {
@ -61,54 +64,51 @@ index 845eff7401b811c179dc9dee70eca0d724be5c80..9fdeaaa67a39b7b4bd2ac8f58dd38b87
+ return InteractionResult.PASS;
+ }
+ // Paper end - Fix InventoryOpenEvent cancellation
return !player.level().isClientSide ? InteractionResult.CONSUME : InteractionResult.SUCCESS;
return InteractionResult.SUCCESS;
}
diff --git a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java
index 923357251ad950ec4f893e8771fcfa99de8a60c5..c77d4adbba79ec39ab78c2a6bac1e8f94ba7fd68 100644
index f50135ddd1e3699b0e3390b316d82f3884bab719..50c907c962f936d2035bb7550750cdbd220b29c2 100644
--- a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java
@@ -63,11 +63,10 @@ public class AnvilBlock extends FallingBlock {
@@ -62,8 +62,9 @@ public class AnvilBlock extends FallingBlock {
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (world.isClientSide) {
return InteractionResult.SUCCESS;
- } else {
if (!world.isClientSide) {
- player.openMenu(state.getMenuProvider(world, pos));
+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
+ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_ANVIL);
- return InteractionResult.CONSUME;
+ } // Paper - Fix InventoryOpenEvent cancellation
}
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
}
@Nullable
return InteractionResult.SUCCESS;
diff --git a/src/main/java/net/minecraft/world/level/block/BarrelBlock.java b/src/main/java/net/minecraft/world/level/block/BarrelBlock.java
index de8cc8221fa2214d276385e3301237b40d190d5f..26dbb0c70abb91d20d552ebdd8858408d60f1c69 100644
index 85fbba41ca0b6aded476043d280c746a8f5bacb9..2338b94158e3b685dc1ea8394ff271d85b5f7a7e 100644
--- a/src/main/java/net/minecraft/world/level/block/BarrelBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BarrelBlock.java
@@ -45,8 +45,7 @@ public class BarrelBlock extends BaseEntityBlock {
return InteractionResult.SUCCESS;
} else {
BlockEntity blockEntity = world.getBlockEntity(pos);
- if (blockEntity instanceof BarrelBlockEntity) {
- player.openMenu((BarrelBlockEntity)blockEntity);
+ if (blockEntity instanceof BarrelBlockEntity && player.openMenu((BarrelBlockEntity)blockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.OPEN_BARREL);
PiglinAi.angerNearbyPiglins(player, true);
}
@@ -41,8 +41,7 @@ public class BarrelBlock extends BaseEntityBlock {
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
- if (world instanceof ServerLevel serverLevel && world.getBlockEntity(pos) instanceof BarrelBlockEntity barrelBlockEntity) {
- player.openMenu(barrelBlockEntity);
+ if (world instanceof ServerLevel serverLevel && world.getBlockEntity(pos) instanceof BarrelBlockEntity barrelBlockEntity && player.openMenu(barrelBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.OPEN_BARREL);
PiglinAi.angerNearbyPiglins(serverLevel, player, true);
}
diff --git a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java b/src/main/java/net/minecraft/world/level/block/BeaconBlock.java
index 2b0db1bf3669bab09d8c6881598e8e3156ca22ca..56793f1ce1a4b919b5066966abf1768bf64540c8 100644
index 5e61dfa142dd108dd4b35de47c6ff424b1b28c02..debe8dbf1d5f3e58774903c5fcdcea672274ea61 100644
--- a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BeaconBlock.java
@@ -49,8 +49,7 @@ public class BeaconBlock extends BaseEntityBlock implements BeaconBeamBlock {
if (world.isClientSide) {
return InteractionResult.SUCCESS;
} else {
- if (world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity) {
- player.openMenu(beaconBlockEntity);
+ if (world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity && player.openMenu(beaconBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_BEACON);
}
@@ -46,8 +46,7 @@ public class BeaconBlock extends BaseEntityBlock implements BeaconBeamBlock {
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
- if (!world.isClientSide && world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity) {
- player.openMenu(beaconBlockEntity);
+ if (!world.isClientSide && world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity && player.openMenu(beaconBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_BEACON);
}
diff --git a/src/main/java/net/minecraft/world/level/block/BlastFurnaceBlock.java b/src/main/java/net/minecraft/world/level/block/BlastFurnaceBlock.java
index b491cc959d4ce65a7ba16b64a7e1a56e77d0052c..03fed46291ff2236da619c941f864b8c78408450 100644
@ -125,106 +125,100 @@ index b491cc959d4ce65a7ba16b64a7e1a56e77d0052c..03fed46291ff2236da619c941f864b8c
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java b/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java
index 76a39f16a5668747b686e6a173c0a3479ecfe724..ea83c4b3ba9ad4db28b44331f208881de554ac70 100644
index 4109e4965f65bdd81fa956f9e0882cb7877bd2aa..cbaa6fc04eb8d765e0dd8238f2b82eed196d13c7 100644
--- a/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java
@@ -77,8 +77,7 @@ public class BrewingStandBlock extends BaseEntityBlock {
return InteractionResult.SUCCESS;
} else {
BlockEntity blockEntity = world.getBlockEntity(pos);
- if (blockEntity instanceof BrewingStandBlockEntity) {
- player.openMenu((BrewingStandBlockEntity)blockEntity);
+ if (blockEntity instanceof BrewingStandBlockEntity && player.openMenu((BrewingStandBlockEntity)blockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_BREWINGSTAND);
}
@@ -73,8 +73,7 @@ public class BrewingStandBlock extends BaseEntityBlock {
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
- if (!world.isClientSide && world.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity) {
- player.openMenu(brewingStandBlockEntity);
+ if (!world.isClientSide && world.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity && player.openMenu(brewingStandBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_BREWINGSTAND);
}
diff --git a/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java b/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java
index cdea7084da7adba7851b84a4f7b4baf2708d8083..4d07d24ec2f45a6dfdcd8574565a03b5aa34381e 100644
index 20feecb9c7f5537e00788a30969b002dceda605f..9e7066ec9fa5a0a852f6e38052887a47be98cb55 100644
--- a/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java
@@ -33,11 +33,10 @@ public class CartographyTableBlock extends Block {
@@ -32,8 +32,9 @@ public class CartographyTableBlock extends Block {
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (world.isClientSide) {
return InteractionResult.SUCCESS;
- } else {
if (!world.isClientSide) {
- player.openMenu(state.getMenuProvider(world, pos));
+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
+ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_CARTOGRAPHY_TABLE);
- return InteractionResult.CONSUME;
+ } // Paper - Fix InventoryOpenEvent cancellation
}
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
}
@Nullable
return InteractionResult.SUCCESS;
diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
index 8fbfd18b3caeed769396b3ffb1b1778b2f38edc0..0b27baf10770cb3077c4e75da55209689d614513 100644
index 590837cb242eda62dca3c937a26b8ba26c41850c..edef8fc62f8dba1b57214d8d7d805ff0d83f4114 100644
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
@@ -253,8 +253,7 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
} else {
@@ -252,8 +252,7 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
if (world instanceof ServerLevel worldserver) {
MenuProvider itileinventory = this.getMenuProvider(state, world, pos);
- if (itileinventory != null) {
- player.openMenu(itileinventory);
+ if (itileinventory != null && player.openMenu(itileinventory).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(this.getOpenChestStat());
PiglinAi.angerNearbyPiglins(player, true);
PiglinAi.angerNearbyPiglins(worldserver, player, true);
}
diff --git a/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java b/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java
index 2dedbda759bd5cdc96e1296583cec600bc487464..ace45e3f95940a5770531da0f702dbee51b1032e 100644
index 673a92d383db463b5c4e2ac3a4ecbd7e97c15c6d..6a2123cd808fa79f3cdb1cb56632d29bfe99058d 100644
--- a/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java
@@ -32,11 +32,10 @@ public class CraftingTableBlock extends Block {
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (world.isClientSide) {
return InteractionResult.SUCCESS;
- } else {
- player.openMenu(state.getMenuProvider(world, pos));
+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_CRAFTING_TABLE);
- return InteractionResult.CONSUME;
}
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
}
@@ -31,8 +31,9 @@ public class CraftingTableBlock extends Block {
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (!world.isClientSide) {
- player.openMenu(state.getMenuProvider(world, pos));
+ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_CRAFTING_TABLE);
+ } // Paper - Fix InventoryOpenEvent cancellation
}
return InteractionResult.SUCCESS;
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
index f6edfea463b3725d3a79aca38825e86dbf82175c..e1021d8be840f378568f28639c259182055c78ac 100644
index a02f24448b002824b068278fa427003008c0d0f1..0427d590912561cb4f0354715e4ac513e53b3eb3 100644
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
@@ -78,8 +78,7 @@ public class DispenserBlock extends BaseEntityBlock {
} else {
BlockEntity tileentity = world.getBlockEntity(pos);
@@ -80,8 +80,9 @@ public class DispenserBlock extends BaseEntityBlock {
if (tileentity instanceof DispenserBlockEntity) {
DispenserBlockEntity tileentitydispenser = (DispenserBlockEntity) tileentity;
- player.openMenu(tileentitydispenser);
+ if (player.openMenu(tileentitydispenser).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(tileentitydispenser instanceof DropperBlockEntity ? Stats.INSPECT_DROPPER : Stats.INSPECT_DISPENSER);
+ } // Paper - Fix InventoryOpenEvent cancellation
}
}
- if (tileentity instanceof DispenserBlockEntity) {
- player.openMenu((DispenserBlockEntity) tileentity);
+ if (tileentity instanceof DispenserBlockEntity && player.openMenu((DispenserBlockEntity) tileentity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
if (tileentity instanceof DropperBlockEntity) {
player.awardStat(Stats.INSPECT_DROPPER);
} else {
diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
index ca92d49ef2010ba00c623491671dcde8ebe697c1..491a59336899179c79820cd61541d49f7337c0f6 100644
index ef0d469176ee74b6bb5f9e9cc508735145fda5b8..ebb9baca7a65173f7c9fdf9bf47a8db876719625 100644
--- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
@@ -90,11 +90,14 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
@@ -86,11 +86,13 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) { // Paper - diff on change; make sure that EnderChest#isBlocked uses the same logic
return InteractionResult.SUCCESS;
} else {
EnderChestBlockEntity enderChestBlockEntity = (EnderChestBlockEntity)blockEntity;
playerEnderChestContainer.setActiveChest(enderChestBlockEntity);
- player.openMenu(
+ // Paper start - Fix InventoryOpenEvent cancellation
+ if (player.openMenu(
new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE)
- );
- player.awardStat(Stats.OPEN_ENDERCHEST);
- PiglinAi.angerNearbyPiglins(player, true);
- if (world instanceof ServerLevel serverLevel) {
+ // Paper start - Fix InventoryOpenEvent cancellation - moved up;
+ if (world instanceof ServerLevel serverLevel && player.openMenu(
+ new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE)
+ ).isPresent()) {
+ player.awardStat(Stats.OPEN_ENDERCHEST);
+ PiglinAi.angerNearbyPiglins(player, true);
+ }
+ // Paper end - Fix InventoryOpenEvent cancellation
return InteractionResult.CONSUME;
}
} else {
+ // Paper end - Fix InventoryOpenEvent cancellation - moved up;
playerEnderChestContainer.setActiveChest(enderChestBlockEntity);
- player.openMenu(
- new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE)
- );
+ // Paper - Fix InventoryOpenEvent cancellation - moved up;
player.awardStat(Stats.OPEN_ENDERCHEST);
PiglinAi.angerNearbyPiglins(serverLevel, player, true);
}
diff --git a/src/main/java/net/minecraft/world/level/block/FurnaceBlock.java b/src/main/java/net/minecraft/world/level/block/FurnaceBlock.java
index 72a3002c291181e7d874a149a22b8004ee2a0b18..618b566f067d53f32351e13b692095ebf6402925 100644
--- a/src/main/java/net/minecraft/world/level/block/FurnaceBlock.java
@ -240,42 +234,39 @@ index 72a3002c291181e7d874a149a22b8004ee2a0b18..618b566f067d53f32351e13b692095eb
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/GrindstoneBlock.java b/src/main/java/net/minecraft/world/level/block/GrindstoneBlock.java
index c62c54fce864f3c28cff955f3030ceb7c3d125d9..ca57d3663afd1ebcbd80682c178344feecda3808 100644
index 15fb9e8f63d1db1125680aced7f9b477d4ebf43a..59c000612bbf7beb7208af48001d3b1e5111ebd4 100644
--- a/src/main/java/net/minecraft/world/level/block/GrindstoneBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/GrindstoneBlock.java
@@ -158,11 +158,10 @@ public class GrindstoneBlock extends FaceAttachedHorizontalDirectionalBlock {
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (world.isClientSide) {
return InteractionResult.SUCCESS;
- } else {
- player.openMenu(state.getMenuProvider(world, pos));
+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_GRINDSTONE);
- return InteractionResult.CONSUME;
}
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
}
@@ -157,8 +157,9 @@ public class GrindstoneBlock extends FaceAttachedHorizontalDirectionalBlock {
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (!world.isClientSide) {
- player.openMenu(state.getMenuProvider(world, pos));
+ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_GRINDSTONE);
+ } // Paper - Fix InventoryOpenEvent cancellation
}
return InteractionResult.SUCCESS;
diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
index 86e5617d445ce762aa374e236a0ccdfe5901fce5..3e1c7d62c24dd48a805260d156135dc4f0c3d1fc 100644
index b61324fe162f32817b87e4adb80df57b9433259f..005a2a66a6e8a492acfa7ba91117884cda08562d 100644
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
@@ -128,8 +128,7 @@ public class HopperBlock extends BaseEntityBlock {
return InteractionResult.SUCCESS;
} else {
BlockEntity blockEntity = world.getBlockEntity(pos);
- if (blockEntity instanceof HopperBlockEntity) {
- player.openMenu((HopperBlockEntity)blockEntity);
+ if (blockEntity instanceof HopperBlockEntity && player.openMenu((HopperBlockEntity)blockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INSPECT_HOPPER);
}
@@ -125,8 +125,7 @@ public class HopperBlock extends BaseEntityBlock {
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
- if (!world.isClientSide && world.getBlockEntity(pos) instanceof HopperBlockEntity hopperBlockEntity) {
- player.openMenu(hopperBlockEntity);
+ if (!world.isClientSide && world.getBlockEntity(pos) instanceof HopperBlockEntity hopperBlockEntity && player.openMenu(hopperBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INSPECT_HOPPER);
}
diff --git a/src/main/java/net/minecraft/world/level/block/LecternBlock.java b/src/main/java/net/minecraft/world/level/block/LecternBlock.java
index 0c52e1f8bc233bb66e53f4c69e1d8757382bbe81..ebb79907391fe3128d3d16fbe9d8cb0b22bcc9f7 100644
index 3537795720be76483579fc50715914974c97c9c4..ec6ff0b192ae2f1586095519ad2472e76b2b5589 100644
--- a/src/main/java/net/minecraft/world/level/block/LecternBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LecternBlock.java
@@ -295,8 +295,7 @@ public class LecternBlock extends BaseEntityBlock {
@@ -298,8 +298,7 @@ public class LecternBlock extends BaseEntityBlock {
private void openScreen(Level world, BlockPos pos, Player player) {
BlockEntity tileentity = world.getBlockEntity(pos);
@ -286,54 +277,50 @@ index 0c52e1f8bc233bb66e53f4c69e1d8757382bbe81..ebb79907391fe3128d3d16fbe9d8cb0b
}
diff --git a/src/main/java/net/minecraft/world/level/block/LoomBlock.java b/src/main/java/net/minecraft/world/level/block/LoomBlock.java
index 8dd9d92c4730ec9a1cea197817e28e60f70ae3a9..d2f5228e2b0848ca79a7fe6ea79095c230a5f243 100644
index 2806ca5b0e3c73a3704a514dba2038072947d9ae..1b57f8cf3f4f27f6a76fec82a542ec1c582470c9 100644
--- a/src/main/java/net/minecraft/world/level/block/LoomBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LoomBlock.java
@@ -34,11 +34,10 @@ public class LoomBlock extends HorizontalDirectionalBlock {
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (world.isClientSide) {
return InteractionResult.SUCCESS;
- } else {
- player.openMenu(state.getMenuProvider(world, pos));
+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_LOOM);
- return InteractionResult.CONSUME;
}
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
}
@@ -33,8 +33,9 @@ public class LoomBlock extends HorizontalDirectionalBlock {
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (!world.isClientSide) {
- player.openMenu(state.getMenuProvider(world, pos));
+ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_LOOM);
+ } // Paper - Fix InventoryOpenEvent cancellation
}
return InteractionResult.SUCCESS;
diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
index 6323c96d9b0cd14f89609b38da37d7fcc12d211b..6b2c3afa04a3564e435633b521d918ed795f9f65 100644
index a0607cb6c6f74285363dfbd49033a8bde5ca6ae3..155c7240b1112729333e6968122568c707d8f66b 100644
--- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
@@ -106,8 +106,7 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
} else if (player.isSpectator()) {
return InteractionResult.CONSUME;
} else if (world.getBlockEntity(pos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity) {
- if (canOpen(state, world, pos, shulkerBoxBlockEntity)) {
- player.openMenu(shulkerBoxBlockEntity);
+ if (canOpen(state, world, pos, shulkerBoxBlockEntity) && player.openMenu(shulkerBoxBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.OPEN_SHULKER_BOX);
PiglinAi.angerNearbyPiglins(player, true);
}
@@ -104,8 +104,8 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (world instanceof ServerLevel serverLevel
&& world.getBlockEntity(pos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity
- && canOpen(state, world, pos, shulkerBoxBlockEntity)) {
- player.openMenu(shulkerBoxBlockEntity);
+ && canOpen(state, world, pos, shulkerBoxBlockEntity) // Paper - Fix InventoryOpenEvent cancellation - expand if for belows check
+ && player.openMenu(shulkerBoxBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.OPEN_SHULKER_BOX);
PiglinAi.angerNearbyPiglins(serverLevel, player, true);
}
diff --git a/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java b/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java
index cd93d0f5b2ba2d3162e14ded3db2e64b598e318f..dae5a125e90514d9eb920ff405c78eea43504698 100644
index 6b316b8829f542023c20293d664a2d0716fb6c4c..43dc3d2c419a8b4a76de49a1e625076741a98c73 100644
--- a/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java
@@ -39,10 +39,9 @@ public class SmithingTableBlock extends CraftingTableBlock {
@@ -38,8 +38,9 @@ public class SmithingTableBlock extends CraftingTableBlock {
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (world.isClientSide) {
return InteractionResult.SUCCESS;
- } else {
if (!world.isClientSide) {
- player.openMenu(state.getMenuProvider(world, pos));
+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
+ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_SMITHING_TABLE);
- return InteractionResult.CONSUME;
+ } // Paper - Fix InventoryOpenEvent cancellation
}
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
}
}
return InteractionResult.SUCCESS;
diff --git a/src/main/java/net/minecraft/world/level/block/SmokerBlock.java b/src/main/java/net/minecraft/world/level/block/SmokerBlock.java
index b0929942ca06ee14d2ba4f2ec2ee93743ee6233e..83669dfbfec46d319aec82ea2beaa90c9f6b81c3 100644
--- a/src/main/java/net/minecraft/world/level/block/SmokerBlock.java
@ -349,20 +336,17 @@ index b0929942ca06ee14d2ba4f2ec2ee93743ee6233e..83669dfbfec46d319aec82ea2beaa90c
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java
index c6ecb378d0cb2ac05b8f22f92fb85df060038f77..59fd521cd1e1101e2adce9830c43784e05abccdd 100644
index 3a879d1a469a8f597bfba861d41abd75a5743ab8..e61644241f24b42bb4f702d3eef5b590b4d107c8 100644
--- a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java
@@ -49,11 +49,10 @@ public class StonecutterBlock extends Block {
@@ -48,8 +48,9 @@ public class StonecutterBlock extends Block {
@Override
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (world.isClientSide) {
return InteractionResult.SUCCESS;
- } else {
if (!world.isClientSide) {
- player.openMenu(state.getMenuProvider(world, pos));
+ } else if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
+ if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
player.awardStat(Stats.INTERACT_WITH_STONECUTTER);
- return InteractionResult.CONSUME;
+ } // Paper - Fix InventoryOpenEvent cancellation
}
+ return InteractionResult.CONSUME; // Paper - Fix InventoryOpenEvent cancellation
}
@Nullable
return InteractionResult.SUCCESS;

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Fire BlockExpEvent on grindstone use
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
index 1678f6c8b2c7db761783e53043169bf12bc2cb29..138f77d13dda574def523d74fa55bc71b5bfa01b 100644
index 3b303d41b9facfb2892ff8402ee0de4608db7318..5687f492fc76f699e2a388790ca5380d9b8c8d0a 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -98,7 +98,11 @@ public class GrindstoneMenu extends AbstractContainerMenu {

Datei anzeigen

@ -15,10 +15,10 @@ Also, even if the plugin is responsibly checking !isDead() before modifying heal
I am currently unable to replicate, these "revived" entities can still appear
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 13c93281f6b81e88f2f54befb8e6a3e4bdabf53d..30f4f1254fc295442d72d50479e8af635f2fe983 100644
index b4d1848858fae20f81c27b31bc0c280c6705f082..f57c830a7286eb8cab1061c8ddebe6abab1fcced 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2096,7 +2096,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2147,7 +2147,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
public boolean isAlive() {
@ -26,4 +26,4 @@ index 13c93281f6b81e88f2f54befb8e6a3e4bdabf53d..30f4f1254fc295442d72d50479e8af63
+ return !this.isRemoved() && this.getHealth() > 0.0F && !this.dead; // Paper - Check this.dead
}
@Override
public boolean isLookingAtMe(LivingEntity entity, double d0, boolean flag, boolean visualShape, Predicate<LivingEntity> predicate, DoubleSupplier... entityYChecks) {

Datei anzeigen

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com>
Date: Sun, 18 Aug 2024 13:05:31 +0200
Subject: [PATCH] Properly destroy placed blocks on the end platform
The craftbukkit provided implementation of LevelAccessor,
BlockStateListPopulator, does not support destroyBlock calls, simply
ignoring them.
This causes the destroyBlock calls during the generation of the end
platform to be lost. The patch moves the destroy calls and executes them
on the actual world access.
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
index ff1f151b342a1567605f92a921fc7ab01f1c4807..b92c40352e4f1af05a2f90701b3f74c235ae57cf 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
@@ -44,7 +44,7 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
// CraftBukkit start
if (!blockList.getBlockState(blockposition_mutableblockposition1).is(block)) {
if (flag) {
- blockList.destroyBlock(blockposition_mutableblockposition1, true, (Entity) null);
+ // blockList.destroyBlock(blockposition_mutableblockposition1, true, (Entity) null); // Paper - moved down - cb implementation of LevelAccessor does not support destroyBlock
}
blockList.setBlock(blockposition_mutableblockposition1, block.defaultBlockState(), 3);