mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-25 03:26:14 +00:00
31 lines
1.6 KiB
Diff
31 lines
1.6 KiB
Diff
--- a/net/minecraft/world/item/ItemDye.java
|
|
+++ b/net/minecraft/world/item/ItemDye.java
|
|
@@ -13,6 +13,8 @@
|
|
import net.minecraft.world.level.World;
|
|
import net.minecraft.world.level.block.entity.TileEntitySign;
|
|
|
|
+import org.bukkit.event.entity.SheepDyeWoolEvent; // CraftBukkit
|
|
+
|
|
public class ItemDye extends Item implements SignApplicator {
|
|
|
|
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.getId();
|
|
+ SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData(bColor), (org.bukkit.entity.Player) entityhuman.getBukkitEntity());
|
|
+ entitysheep.level().getCraftServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ return EnumInteractionResult.PASS;
|
|
+ }
|
|
+
|
|
+ entitysheep.setColor(EnumColor.byId((byte) event.getColor().getWoolData()));
|
|
+ // CraftBukkit end
|
|
itemstack.shrink(1);
|
|
}
|
|
|