craftbukkit/nms-patches/EntitySnowman.patch

44 lines
2 KiB
Diff
Raw Normal View History

2015-05-25 20:37:24 +10:00
--- a/net/minecraft/server/EntitySnowman.java
+++ b/net/minecraft/server/EntitySnowman.java
2021-03-09 08:47:33 +11:00
@@ -2,6 +2,10 @@
2016-05-10 21:47:39 +10:00
import javax.annotation.Nullable;
2021-03-09 08:47:33 +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 {
2021-03-09 08:47:33 +11:00
private static final DataWatcherObject<Byte> b = DataWatcher.a(EntitySnowman.class, DataWatcherRegistry.a);
@@ -60,7 +64,7 @@
2020-06-25 10:00:00 +10:00
int k = MathHelper.floor(this.locZ());
2018-12-26 08:00:00 +11:00
if (this.world.getBiome(new BlockPosition(i, 0, k)).getAdjustedTemperature(new BlockPosition(i, j, k)) > 1.0F) {
- this.damageEntity(DamageSource.BURN, 1.0F);
+ this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
2019-06-21 20:00:00 +10:00
if (!this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
2021-03-09 08:47:33 +11:00
@@ -76,7 +80,7 @@
2015-02-26 22:41:06 +00:00
BlockPosition blockposition = new BlockPosition(i, j, k);
2018-12-26 08:00:00 +11:00
if (this.world.getType(blockposition).isAir() && this.world.getBiome(blockposition).getAdjustedTemperature(blockposition) < 0.8F && iblockdata.canPlace(this.world, blockposition)) {
2018-07-15 10:00:00 +10:00
- this.world.setTypeUpdate(blockposition, iblockdata);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.world, blockposition, iblockdata, this); // CraftBukkit
}
}
}
2021-03-09 08:47:33 +11:00
@@ -107,6 +111,11 @@
2020-06-25 10:00:00 +10:00
ItemStack itemstack = entityhuman.b(enumhand);
2020-06-25 10:00:00 +10:00
if (itemstack.getItem() == Items.SHEARS && this.canShear()) {
+ // CraftBukkit start
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.shear(SoundCategory.PLAYERS);
2019-12-11 09:00:00 +11:00
if (!this.world.isClientSide) {
itemstack.damage(1, entityhuman, (entityhuman1) -> {