From 7b6d5e3a6ba88ac81baac6896a0ab78730aa9a47 Mon Sep 17 00:00:00 2001 From: SoSeDiK Date: Mon, 21 Mar 2022 19:43:52 +0100 Subject: [PATCH] Fix EntityChangeBlockEvent#getBlockData for when sheep eats grass block (#7646) --- ...ta-for-EntityChangeBlockEvent-when-s.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/server/Fix-new-block-data-for-EntityChangeBlockEvent-when-s.patch diff --git a/patches/server/Fix-new-block-data-for-EntityChangeBlockEvent-when-s.patch b/patches/server/Fix-new-block-data-for-EntityChangeBlockEvent-when-s.patch new file mode 100644 index 0000000000..a8aabe56f8 --- /dev/null +++ b/patches/server/Fix-new-block-data-for-EntityChangeBlockEvent-when-s.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SoSeDiK +Date: Mon, 21 Mar 2022 20:00:53 +0200 +Subject: [PATCH] Fix new block data for EntityChangeBlockEvent when sheep eats + grass block + + +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java +@@ -0,0 +0,0 @@ public class EatBlockGoal extends Goal { + + if (this.level.getBlockState(blockposition1).is(Blocks.GRASS_BLOCK)) { + // CraftBukkit +- if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) { ++ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.DIRT.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) { // Paper - Fix wrong block state + this.level.levelEvent(2001, blockposition1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState())); + this.level.setBlock(blockposition1, Blocks.DIRT.defaultBlockState(), 2); + }