2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/item/ItemDye.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemDye.java
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -11,6 +11,8 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
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 {
|
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
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);
|
2020-06-25 02:00:00 +02:00
|
|
|
+ // CraftBukkit start
|
2021-06-11 07:00:00 +02:00
|
|
|
+ byte bColor = (byte) this.dyeColor.getColorIndex();
|
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());
|
2021-06-11 13:33:49 +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
|
|
|
+
|
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
|
|
|
|