PaperMC/paper-server/nms-patches/net/minecraft/world/entity/animal/EntitySnowman.patch

58 lines
2.7 KiB
Diff
Raw Normal View History

2021-03-15 23:00:00 +01:00
--- a/net/minecraft/world/entity/animal/EntitySnowman.java
+++ b/net/minecraft/world/entity/animal/EntitySnowman.java
@@ -41,6 +41,10 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
public class EntitySnowman extends EntityGolem implements IShearable, IRangedEntity {
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
@@ -103,7 +107,7 @@
BiomeBase biomebase = (BiomeBase) this.level.getBiome(blockposition).value();
if (biomebase.shouldSnowGolemBurn(blockposition)) {
- this.hurt(DamageSource.ON_FIRE, 1.0F);
+ this.hurt(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
@@ -119,7 +123,11 @@
BlockPosition blockposition1 = new BlockPosition(i, j, k);
if (this.level.getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level, blockposition1)) {
- this.level.setBlockAndUpdate(blockposition1, iblockdata);
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition1, iblockdata, this)) {
+ continue;
+ }
+ // CraftBukkit end
this.level.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.a.of(this, iblockdata));
}
}
@@ -151,6 +159,11 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
+ // CraftBukkit start
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, entityhuman);
if (!this.level.isClientSide) {
@@ -170,7 +183,9 @@
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
if (!this.level.isClientSide()) {
this.setPumpkin(false);
+ this.forceDrops = true; // CraftBukkit
this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), 1.7F);
+ this.forceDrops = false; // CraftBukkit
}
}