3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-27 00:22:46 +01:00
Paper/nms-patches/EntitySnowman.patch

48 Zeilen
2.0 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/EntitySnowman.java
+++ b/net/minecraft/server/EntitySnowman.java
@@ -1,6 +1,10 @@
package net.minecraft.server;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.player.PlayerShearEntityEvent;
+// CraftBukkit end
2016-05-10 13:47:39 +02:00
public class EntitySnowman extends EntityGolem implements IRangedEntity {
2018-07-15 02:00:00 +02:00
@@ -55,7 +59,7 @@
}
2018-07-15 02:00:00 +02:00
if (this.world.getBiome(new BlockPosition(i, 0, k)).c(new BlockPosition(i, j, k)) > 1.0F) {
- this.damageEntity(DamageSource.BURN, 1.0F);
+ this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
2016-02-29 22:32:46 +01:00
if (!this.world.getGameRules().getBoolean("mobGriefing")) {
2018-07-15 02:00:00 +02:00
@@ -71,7 +75,7 @@
2015-02-26 23:41:06 +01:00
BlockPosition blockposition = new BlockPosition(i, j, k);
2018-07-15 02:00:00 +02:00
if (this.world.getType(blockposition).isAir() && this.world.getBiome(blockposition).c(blockposition) < 0.8F && iblockdata.canPlace(this.world, blockposition)) {
- this.world.setTypeUpdate(blockposition, iblockdata);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.world, blockposition, iblockdata, this); // CraftBukkit
}
}
}
2018-07-15 02:00:00 +02:00
@@ -104,6 +108,15 @@
ItemStack itemstack = entityhuman.b(enumhand);
if (itemstack.getItem() == Items.SHEARS && this.hasPumpkin() && !this.world.isClientSide) {
+ // CraftBukkit start
+ PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity());
+ this.world.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
+ }
+ // CraftBukkit end
+
this.setHasPumpkin(false);
itemstack.damage(1, entityhuman);
}