mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 18:37:35 +01:00
90ac03522a
This reverts commit d6e3dff7d8
.
55 lines
2.1 KiB
Diff
55 lines
2.1 KiB
Diff
--- ../work/decompile-8eb82bde//net/minecraft/server/EntitySheep.java 2014-11-28 17:43:43.153707434 +0000
|
|
+++ src/main/java/net/minecraft/server/EntitySheep.java 2014-11-28 17:38:19.000000000 +0000
|
|
@@ -4,6 +4,11 @@
|
|
import java.util.Map;
|
|
import java.util.Random;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.event.entity.SheepRegrowWoolEvent;
|
|
+import org.bukkit.event.player.PlayerShearEntityEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntitySheep extends EntityAnimal {
|
|
|
|
private final InventoryCrafting bk = new InventoryCrafting(new ContainerSheepBreed(this), 2, 1);
|
|
@@ -30,6 +35,7 @@
|
|
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
|
|
this.bk.setItem(0, new ItemStack(Items.DYE, 1, 0));
|
|
this.bk.setItem(1, new ItemStack(Items.DYE, 1, 0));
|
|
+ this.bk.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
|
|
}
|
|
|
|
protected void E() {
|
|
@@ -82,6 +88,15 @@
|
|
|
|
if (itemstack != null && itemstack.getItem() == Items.SHEARS && !this.isSheared() && !this.isBaby()) {
|
|
if (!this.world.isStatic) {
|
|
+ // 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.setSheared(true);
|
|
int i = 1 + this.random.nextInt(3);
|
|
|
|
@@ -169,7 +184,14 @@
|
|
}
|
|
|
|
public void v() {
|
|
- this.setSheared(false);
|
|
+ // CraftBukkit start
|
|
+ SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
|
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if (!event.isCancelled()) {
|
|
+ this.setSheared(false);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
if (this.isBaby()) {
|
|
this.setAge(60);
|
|
}
|