SPIGOT-6798: EntityChangeBlockEvent called with incorrect location

This commit is contained in:
md_5 2021-11-21 11:18:06 +11:00
parent 20716710f8
commit f63504952f
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -27,7 +27,7 @@
if (this.level.getType(blockposition1).a(Blocks.GRASS_BLOCK)) { if (this.level.getType(blockposition1).a(Blocks.GRASS_BLOCK)) {
- if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { - if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ // CraftBukkit + // CraftBukkit
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.getBlockData(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) { + if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.getBlockData(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
this.level.triggerEffect(2001, blockposition1, Block.getCombinedId(Blocks.GRASS_BLOCK.getBlockData())); this.level.triggerEffect(2001, blockposition1, Block.getCombinedId(Blocks.GRASS_BLOCK.getBlockData()));
this.level.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2); this.level.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2);
} }