2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/item/ItemDye.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemDye.java
|
|
|
|
@@ -8,6 +8,8 @@
|
|
|
|
import net.minecraft.world.entity.animal.EntitySheep;
|
|
|
|
import net.minecraft.world.entity.player.EntityHuman;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.event.entity.SheepDyeWoolEvent; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class ItemDye extends Item {
|
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
private static final Map<EnumColor, ItemDye> a = Maps.newEnumMap(EnumColor.class);
|
2021-03-15 23:00:00 +01:00
|
|
|
@@ -26,7 +28,17 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
if (entitysheep.isAlive() && !entitysheep.isSheared() && entitysheep.getColor() != this.b) {
|
2020-06-25 02:00:00 +02:00
|
|
|
if (!entityhuman.world.isClientSide) {
|
|
|
|
- entitysheep.setColor(this.b);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ byte bColor = (byte) this.b.getColorIndex();
|
|
|
|
+ SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData(bColor));
|
|
|
|
+ entitysheep.world.getServer().getPluginManager().callEvent(event);
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
2020-06-25 02:00:00 +02:00
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return EnumInteractionResult.PASS;
|
|
|
|
+ }
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
2020-06-25 02:00:00 +02:00
|
|
|
+ entitysheep.setColor(EnumColor.fromColorIndex((byte) event.getColor().getWoolData()));
|
|
|
|
+ // CraftBukkit end
|
|
|
|
itemstack.subtract(1);
|
|
|
|
}
|
2018-07-15 02:00:00 +02:00
|
|
|
|