2021-03-16 09:00:00 +11:00
|
|
|
--- a/net/minecraft/world/entity/animal/EntitySnowman.java
|
|
|
|
+++ b/net/minecraft/world/entity/animal/EntitySnowman.java
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -40,6 +40,10 @@
|
2021-06-11 15:00:00 +10:00
|
|
|
import net.minecraft.world.level.gameevent.GameEvent;
|
|
|
|
import net.minecraft.world.phys.Vec3D;
|
2021-03-09 08:47:33 +11:00
|
|
|
|
2014-11-26 08:32:16 +11:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+// CraftBukkit end
|
2021-03-09 08:47:33 +11:00
|
|
|
+
|
2020-06-25 10:00:00 +10:00
|
|
|
public class EntitySnowman extends EntityGolem implements IShearable, IRangedEntity {
|
2014-11-26 08:32:16 +11:00
|
|
|
|
2021-11-22 09:00:00 +11:00
|
|
|
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -95,7 +99,7 @@
|
2023-03-15 03:30:00 +11:00
|
|
|
super.aiStep();
|
2023-06-08 01:30:00 +10:00
|
|
|
if (!this.level().isClientSide) {
|
|
|
|
if (this.level().getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
|
2023-03-15 03:30:00 +11:00
|
|
|
- this.hurt(this.damageSources().onFire(), 1.0F);
|
2024-02-11 09:54:25 +11:00
|
|
|
+ this.hurt(this.damageSources().melting(), 1.0F); // CraftBukkit - DamageSources.ON_FIRE -> CraftEventFactory.MELTING
|
2014-11-26 08:32:16 +11:00
|
|
|
}
|
|
|
|
|
2023-06-08 01:30:00 +10:00
|
|
|
if (!this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -111,7 +115,11 @@
|
2023-03-15 03:30:00 +11:00
|
|
|
BlockPosition blockposition = new BlockPosition(j, k, l);
|
2015-02-26 22:41:06 +00:00
|
|
|
|
2023-06-08 01:30:00 +10:00
|
|
|
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
|
|
|
- this.level().setBlockAndUpdate(blockposition, iblockdata);
|
2022-06-08 02:00:00 +10:00
|
|
|
+ // CraftBukkit start
|
2023-06-24 17:15:05 +10:00
|
|
|
+ if (!CraftEventFactory.handleBlockFormEvent(this.level(), blockposition, iblockdata, this)) {
|
2022-06-08 02:00:00 +10:00
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2024-04-24 01:15:00 +10:00
|
|
|
this.level().gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
|
2014-11-26 08:32:16 +11:00
|
|
|
}
|
|
|
|
}
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -138,6 +146,11 @@
|
2021-11-22 09:00:00 +11:00
|
|
|
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
2017-07-15 09:53:22 +10:00
|
|
|
|
2021-11-22 09:00:00 +11:00
|
|
|
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
|
2020-06-25 10:00:00 +10:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
|
|
|
+ return EnumInteractionResult.PASS;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
this.shear(SoundCategory.PLAYERS);
|
2022-06-08 02:00:00 +10:00
|
|
|
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
2023-06-08 01:30:00 +10:00
|
|
|
if (!this.level().isClientSide) {
|
2024-04-24 01:15:00 +10:00
|
|
|
@@ -155,7 +168,9 @@
|
2023-06-08 01:30:00 +10:00
|
|
|
this.level().playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
|
|
|
|
if (!this.level().isClientSide()) {
|
2021-11-22 09:00:00 +11:00
|
|
|
this.setPumpkin(false);
|
2021-07-22 17:51:53 +10:00
|
|
|
+ this.forceDrops = true; // CraftBukkit
|
2024-04-24 01:15:00 +10:00
|
|
|
this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), this.getEyeHeight());
|
2021-07-22 17:51:53 +10:00
|
|
|
+ this.forceDrops = false; // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|