2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/item/ItemDye.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemDye.java
|
2023-06-07 17:30:00 +02:00
|
|
|
@@ -13,6 +13,8 @@
|
|
|
|
import net.minecraft.world.level.World;
|
|
|
|
import net.minecraft.world.level.block.entity.TileEntitySign;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.event.entity.SheepDyeWoolEvent; // CraftBukkit
|
|
|
|
+
|
2023-06-07 17:30:00 +02:00
|
|
|
public class ItemDye extends Item implements SignApplicator {
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
private static final Map<EnumColor, ItemDye> ITEM_BY_COLOR = Maps.newEnumMap(EnumColor.class);
|
2024-04-23 17:15:00 +02:00
|
|
|
@@ -30,7 +32,17 @@
|
2021-06-11 07:00:00 +02:00
|
|
|
if (entitysheep.isAlive() && !entitysheep.isSheared() && entitysheep.getColor() != this.dyeColor) {
|
2023-06-07 17:30:00 +02:00
|
|
|
entitysheep.level().playSound(entityhuman, (Entity) entitysheep, SoundEffects.DYE_USE, SoundCategory.PLAYERS, 1.0F, 1.0F);
|
|
|
|
if (!entityhuman.level().isClientSide) {
|
2021-06-11 07:00:00 +02:00
|
|
|
- entitysheep.setColor(this.dyeColor);
|
2020-06-25 02:00:00 +02:00
|
|
|
+ // CraftBukkit start
|
2021-11-21 23:00:00 +01:00
|
|
|
+ byte bColor = (byte) this.dyeColor.getId();
|
2021-07-18 03:08:18 +02:00
|
|
|
+ SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData(bColor), (org.bukkit.entity.Player) entityhuman.getBukkitEntity());
|
2023-06-07 17:30:00 +02:00
|
|
|
+ entitysheep.level().getCraftServer().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
|
|
|
+
|
2021-11-21 23:00:00 +01:00
|
|
|
+ entitysheep.setColor(EnumColor.byId((byte) event.getColor().getWoolData()));
|
2020-06-25 02:00:00 +02:00
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
itemstack.shrink(1);
|
2020-06-25 02:00:00 +02:00
|
|
|
}
|
2018-07-15 02:00:00 +02:00
|
|
|
|