mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-30 04:01:55 +01:00
Add missing EntityChangeBlockEvent (#8696)
* Add missing EntityChangeBlockEvent * Fix duplicate empty bottle when canceled for creative player * Use native update impl instead of craftbukkit -> nms
This commit is contained in:
parent
3394f6b808
commit
03dad8f20a
@ -94,6 +94,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (player instanceof ServerPlayer) {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
||||
@@ -0,0 +0,0 @@ public class EnderEyeItem extends Item {
|
||||
return InteractionResult.SUCCESS;
|
||||
} else {
|
||||
BlockState iblockdata1 = (BlockState) iblockdata.setValue(EndPortalFrameBlock.HAS_EYE, true);
|
||||
+ // Paper start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(context.getPlayer(), blockposition, iblockdata1).isCancelled()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
Block.pushEntitiesUp(iblockdata, iblockdata1, world, blockposition);
|
||||
world.setBlock(blockposition, iblockdata1, 2);
|
||||
diff --git a/src/main/java/net/minecraft/world/item/HoneycombItem.java b/src/main/java/net/minecraft/world/item/HoneycombItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/HoneycombItem.java
|
||||
@ -110,6 +126,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (player instanceof ServerPlayer) {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/PotionItem.java b/src/main/java/net/minecraft/world/item/PotionItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/PotionItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/PotionItem.java
|
||||
@@ -0,0 +0,0 @@ public class PotionItem extends Item {
|
||||
BlockState iblockdata = world.getBlockState(blockposition);
|
||||
|
||||
if (context.getClickedFace() != Direction.DOWN && iblockdata.is(BlockTags.CONVERTABLE_TO_MUD) && PotionUtils.getPotion(itemstack) == Potions.WATER) {
|
||||
+ // Paper start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityhuman, blockposition, Blocks.MUD.defaultBlockState()).isCancelled()) {
|
||||
+ entityhuman.containerMenu.sendAllDataToRemote();
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end
|
||||
world.playSound((Player) null, blockposition, SoundEvents.GENERIC_SPLASH, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
entityhuman.setItemInHand(context.getHand(), ItemUtils.createFilledResult(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
|
||||
entityhuman.awardStat(Stats.ITEM_USED.get(itemstack.getItem()));
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ShovelItem.java
|
||||
|
Loading…
Reference in New Issue
Block a user