mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
536256d6ff
By: md_5 <git@md-5.net>
30 lines
1.5 KiB
Diff
30 lines
1.5 KiB
Diff
--- a/net/minecraft/world/item/ItemDye.java
|
|
+++ b/net/minecraft/world/item/ItemDye.java
|
|
@@ -11,6 +11,8 @@
|
|
import net.minecraft.world.entity.animal.EntitySheep;
|
|
import net.minecraft.world.entity.player.EntityHuman;
|
|
|
|
+import org.bukkit.event.entity.SheepDyeWoolEvent; // CraftBukkit
|
|
+
|
|
public class ItemDye extends Item {
|
|
|
|
private static final Map<EnumColor, ItemDye> ITEM_BY_COLOR = Maps.newEnumMap(EnumColor.class);
|
|
@@ -30,7 +32,17 @@
|
|
if (entitysheep.isAlive() && !entitysheep.isSheared() && entitysheep.getColor() != this.dyeColor) {
|
|
entitysheep.level.playSound(entityhuman, (Entity) entitysheep, SoundEffects.DYE_USE, SoundCategory.PLAYERS, 1.0F, 1.0F);
|
|
if (!entityhuman.level.isClientSide) {
|
|
- entitysheep.setColor(this.dyeColor);
|
|
+ // CraftBukkit start
|
|
+ byte bColor = (byte) this.dyeColor.getColorIndex();
|
|
+ SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData(bColor));
|
|
+ entitysheep.level.getCraftServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ return EnumInteractionResult.PASS;
|
|
+ }
|
|
+
|
|
+ entitysheep.setColor(EnumColor.fromColorIndex((byte) event.getColor().getWoolData()));
|
|
+ // CraftBukkit end
|
|
itemstack.subtract(1);
|
|
}
|
|
|