#662: Expose ItemStack and hand used in PlayerShearEntityEvent
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
@@ -1,26 +1,22 @@
|
||||
--- a/net/minecraft/server/EntityMushroomCow.java
|
||||
+++ b/net/minecraft/server/EntityMushroomCow.java
|
||||
@@ -3,6 +3,11 @@
|
||||
@@ -3,6 +3,10 @@
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class EntityMushroomCow extends EntityCow {
|
||||
|
||||
@@ -81,9 +86,17 @@
|
||||
@@ -81,9 +85,14 @@
|
||||
int i;
|
||||
|
||||
if (itemstack.getItem() == Items.SHEARS && !this.isBaby()) {
|
||||
+ // 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
|
||||
@@ -31,7 +27,7 @@
|
||||
EntityCow entitycow = (EntityCow) EntityTypes.COW.a(this.world);
|
||||
|
||||
entitycow.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch);
|
||||
@@ -99,7 +112,14 @@
|
||||
@@ -99,7 +108,14 @@
|
||||
}
|
||||
|
||||
entitycow.setInvulnerable(this.isInvulnerable());
|
||||
|
||||
Reference in New Issue
Block a user