77 Zeilen
6.4 KiB
Diff
77 Zeilen
6.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: SoSeDiK <mrsosedik@gmail.com>
|
|
Date: Mon, 21 Mar 2022 20:00:53 +0200
|
|
Subject: [PATCH] Fix new block data for EntityChangeBlockEvent
|
|
|
|
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
|
|
|
|
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 cc44e975aef8e9dabfbc740dd5a0db3a55c5831e..80aa539f7c6a6ee44338de084cdcdf5fb4ef996a 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
|
|
@@ -79,7 +79,7 @@ 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);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
index b781c849737225c00f1dd8d45a6d08cebc000263..08a432f76a72ad628b8febe393196286182fbe07 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
@@ -372,7 +372,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
|
|
|
if (WitherBoss.canDestroy(iblockdata)) {
|
|
// CraftBukkit start
|
|
- if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
|
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.getFluidState().createLegacyBlock()).isCancelled()) { // Paper
|
|
continue;
|
|
}
|
|
// CraftBukkit end
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
|
|
index 6a0b4f86e5157494a917cf5efecb730081bae628..40443f7d0c9f5697f529bfbbd16695c00bbd7322 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
|
|
@@ -171,7 +171,7 @@ public class Ravager extends Raider {
|
|
BlockState iblockdata = this.level.getBlockState(blockposition);
|
|
Block block = iblockdata.getBlock();
|
|
|
|
- if (block instanceof LeavesBlock && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) { // CraftBukkit
|
|
+ if (block instanceof LeavesBlock && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.getFluidState().createLegacyBlock()).isCancelled()) { // CraftBukkit // Paper
|
|
flag = this.level.destroyBlock(blockposition, true, this) || flag;
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
|
|
index 2dcda3b03796655da443e1b3dd68c6f6bca20d21..37d3b670a93c26b87ffc5c93ad7828f45b4b0217 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
|
|
@@ -176,7 +176,11 @@ public class Silverfish extends Monster {
|
|
|
|
if (block instanceof InfestedBlock) {
|
|
// CraftBukkit start
|
|
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) {
|
|
+ // Paper start
|
|
+ BlockState afterState = world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? net.minecraft.world.level.block.Blocks.AIR.defaultBlockState() : ((InfestedBlock) block).hostStateByInfested(world.getBlockState(blockposition1));
|
|
+ org.bukkit.event.entity.EntityChangeBlockEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, afterState);
|
|
+ if (event.isCancelled()) {
|
|
+ // Paper end
|
|
continue;
|
|
}
|
|
// CraftBukkit end
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
|
index 24524b673f78da1ce138b72d6d879c2e690f19ea..01da5a5684692b3ed2e06834d6f926706925f643 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
|
@@ -131,7 +131,7 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate
|
|
|
|
if (!world.isClientSide && projectile.mayInteract(world, blockposition) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6D) {
|
|
// CraftBukkit start
|
|
- if (CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
|
+ if (CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, state.getFluidState().createLegacyBlock()).isCancelled()) { // Paper
|
|
return;
|
|
}
|
|
// CraftBukkit end
|