mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-25 06:56:14 +00:00
58 lines
2.9 KiB
Diff
58 lines
2.9 KiB
Diff
--- a/net/minecraft/world/entity/animal/EntitySnowman.java
|
|
+++ b/net/minecraft/world/entity/animal/EntitySnowman.java
|
|
@@ -43,6 +43,10 @@
|
|
import net.minecraft.world.level.storage.loot.LootTables;
|
|
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);
|
|
@@ -100,7 +104,7 @@
|
|
|
|
if (world instanceof WorldServer worldserver) {
|
|
if (this.level().getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
|
|
- this.hurtServer(worldserver, this.damageSources().onFire(), 1.0F);
|
|
+ this.hurtServer(worldserver, this.damageSources().melting(), 1.0F); // CraftBukkit - DamageSources.ON_FIRE -> CraftEventFactory.MELTING
|
|
}
|
|
|
|
if (!worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
|
@@ -116,7 +120,11 @@
|
|
BlockPosition blockposition = new BlockPosition(j, k, l);
|
|
|
|
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
|
- this.level().setBlockAndUpdate(blockposition, iblockdata);
|
|
+ // CraftBukkit start
|
|
+ if (!CraftEventFactory.handleBlockFormEvent(this.level(), blockposition, iblockdata, this)) {
|
|
+ continue;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
this.level().gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
|
|
}
|
|
}
|
|
@@ -153,6 +161,11 @@
|
|
if (world instanceof WorldServer) {
|
|
WorldServer worldserver = (WorldServer) world;
|
|
|
|
+ // CraftBukkit start
|
|
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
|
+ return EnumInteractionResult.PASS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
this.shear(worldserver, SoundCategory.PLAYERS, itemstack);
|
|
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
|
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
|
|
@@ -169,7 +182,9 @@
|
|
worldserver.playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
|
|
this.setPumpkin(false);
|
|
this.dropFromShearingLootTable(worldserver, LootTables.SHEAR_SNOW_GOLEM, itemstack, (worldserver1, itemstack1) -> {
|
|
+ this.forceDrops = true; // CraftBukkit
|
|
this.spawnAtLocation(worldserver1, itemstack1, this.getEyeHeight());
|
|
+ this.forceDrops = false; // CraftBukkit
|
|
});
|
|
}
|
|
|