geforkt von Mirrors/Paper
Call EntityChangeBlockEvent for cake eating (#10105)
Dieser Commit ist enthalten in:
Ursprung
60beb05297
Commit
8f3f70d786
@ -198,6 +198,47 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
level.setBlock(blockPos, blockState3, 11);
|
||||
level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, blockState3));
|
||||
if (player != null) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CakeBlock.java b/src/main/java/net/minecraft/world/level/block/CakeBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CakeBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CakeBlock.java
|
||||
@@ -0,0 +0,0 @@ public class CakeBlock extends Block {
|
||||
Block block = Block.byItem(item);
|
||||
|
||||
if (block instanceof CandleBlock) {
|
||||
+ // Paper start - call change block event
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, pos, CandleCakeBlock.byCandle(block))) {
|
||||
+ player.containerMenu.sendAllDataToRemote(); // update inv because candle could decrease
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end - call change block event
|
||||
if (!player.isCreative()) {
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class CakeBlock extends Block {
|
||||
if (!player.canEat(false)) {
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
+ // Paper start - call change block event
|
||||
+ int i = state.getValue(CakeBlock.BITES);
|
||||
+ final BlockState newState = i < MAX_BITES ? state.setValue(CakeBlock.BITES, i + 1) : world.getFluidState(pos).createLegacyBlock();
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, pos, newState)) {
|
||||
+ ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity().sendHealthUpdate();
|
||||
+ return InteractionResult.PASS; // return a non-consume result to cake blocks don't drop their candles
|
||||
+ }
|
||||
+ // Paper end - call change block event
|
||||
player.awardStat(Stats.EAT_CAKE_SLICE);
|
||||
// CraftBukkit start
|
||||
// entityhuman.getFoodData().eat(2, 0.1F);
|
||||
@@ -0,0 +0,0 @@ public class CakeBlock extends Block {
|
||||
|
||||
((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity().sendHealthUpdate();
|
||||
// CraftBukkit end
|
||||
- int i = (Integer) state.getValue(CakeBlock.BITES);
|
||||
+ // Paper - move up
|
||||
|
||||
world.gameEvent((Entity) player, GameEvent.EAT, pos);
|
||||
if (i < 6) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren