geforkt von Mirrors/Paper
43 Zeilen
2.8 KiB
Diff
43 Zeilen
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Fri, 18 Mar 2022 21:15:55 -0700
|
|
Subject: [PATCH] Add EntityDyeEvent and CollarColorable interface
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
|
index 366f32b11f39a79210532c614fdbb2230b87d88f..a0dd4a58937a4e49e430d8c1470fe84b709e8044 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
|
|
@@ -404,6 +404,13 @@ public class Cat extends TamableAnimal implements VariantHolder<CatVariant> {
|
|
DyeColor enumcolor = ((DyeItem) item).getDyeColor();
|
|
|
|
if (enumcolor != this.getCollarColor()) {
|
|
+ // Paper start
|
|
+ final io.papermc.paper.event.entity.EntityDyeEvent event = new io.papermc.paper.event.entity.EntityDyeEvent(this.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData((byte) enumcolor.getId()), ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity());
|
|
+ if (!event.callEvent()) {
|
|
+ return InteractionResult.FAIL;
|
|
+ }
|
|
+ enumcolor = DyeColor.byId(event.getColor().getWoolData());
|
|
+ // Paper end
|
|
this.setCollarColor(enumcolor);
|
|
if (!player.getAbilities().instabuild) {
|
|
itemstack.shrink(1);
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
|
index c44bbdea03856ac3a7652674263d1ec78ed02473..a6a50eb4f4ac85751071571876ac804d44ee1ee6 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
|
|
@@ -392,6 +392,13 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
|
DyeColor enumcolor = ((DyeItem) item).getDyeColor();
|
|
|
|
if (enumcolor != this.getCollarColor()) {
|
|
+ // Paper start
|
|
+ final io.papermc.paper.event.entity.EntityDyeEvent event = new io.papermc.paper.event.entity.EntityDyeEvent(this.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData((byte) enumcolor.getId()), ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity());
|
|
+ if (!event.callEvent()) {
|
|
+ return InteractionResult.FAIL;
|
|
+ }
|
|
+ enumcolor = DyeColor.byId(event.getColor().getWoolData());
|
|
+ // Paper end
|
|
this.setCollarColor(enumcolor);
|
|
if (!player.getAbilities().instabuild) {
|
|
itemstack.shrink(1);
|