#662: Expose ItemStack and hand used in PlayerShearEntityEvent
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
--- a/net/minecraft/server/EntitySnowman.java
|
||||
+++ b/net/minecraft/server/EntitySnowman.java
|
||||
@@ -1,6 +1,10 @@
|
||||
@@ -1,6 +1,9 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
||||
|
||||
@@ -62,7 +66,7 @@
|
||||
@@ -62,7 +65,7 @@
|
||||
}
|
||||
|
||||
if (this.world.getBiome(new BlockPosition(i, 0, k)).getAdjustedTemperature(new BlockPosition(i, j, k)) > 1.0F) {
|
||||
@@ -20,7 +19,7 @@
|
||||
}
|
||||
|
||||
if (!this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
@@ -78,7 +82,7 @@
|
||||
@@ -78,7 +81,7 @@
|
||||
BlockPosition blockposition = new BlockPosition(i, j, k);
|
||||
|
||||
if (this.world.getType(blockposition).isAir() && this.world.getBiome(blockposition).getAdjustedTemperature(blockposition) < 0.8F && iblockdata.canPlace(this.world, blockposition)) {
|
||||
@@ -29,15 +28,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,6 +114,14 @@
|
||||
@@ -110,6 +113,11 @@
|
||||
|
||||
if (itemstack.getItem() == Items.SHEARS && this.hasPumpkin()) {
|
||||
if (!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()) {
|
||||
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
Reference in New Issue
Block a user