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