PaperMC/patches/server/0941-Add-Shearable-API.patch
Nassim Jahnke 275173e538
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
0c5d8709 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends
255c4fdb SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot

CraftBukkit Changes:
b6b514b7e SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends
fcff84de9 SPIGOT-7399: Revert null check in CraftMetaItem#safelyAdd
44a4b5649 SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot
676969d01 SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory
2023-06-18 13:18:11 +02:00

72 lines
3.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Sun, 17 Oct 2021 15:39:48 -0400
Subject: [PATCH] Add Shearable API
diff --git a/src/main/java/io/papermc/paper/entity/PaperShearable.java b/src/main/java/io/papermc/paper/entity/PaperShearable.java
new file mode 100644
index 0000000000000000000000000000000000000000..bcf254e3c81cf1e401bddc850fb24ad29dcc127c
--- /dev/null
+++ b/src/main/java/io/papermc/paper/entity/PaperShearable.java
@@ -0,0 +1,21 @@
+package io.papermc.paper.entity;
+
+import io.papermc.paper.adventure.PaperAdventure;
+import net.kyori.adventure.sound.Sound;
+import net.minecraft.world.entity.Shearable;
+import org.jetbrains.annotations.NotNull;
+
+public interface PaperShearable extends io.papermc.paper.entity.Shearable {
+
+ Shearable getHandle();
+
+ @Override
+ default boolean readyToBeSheared() {
+ return this.getHandle().readyForShearing();
+ }
+
+ @Override
+ default void shear(@NotNull Sound.Source source) {
+ this.getHandle().shear(PaperAdventure.asVanilla(source));
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
index 20eaa3424428b8b30fd15591b660983cb7fc4375..4a6aae106de5eeeb80c078c5a167ef0484b13929 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
@@ -6,7 +6,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.MushroomCow.Variant;
-public class CraftMushroomCow extends CraftCow implements MushroomCow {
+public class CraftMushroomCow extends CraftCow implements MushroomCow, io.papermc.paper.entity.PaperShearable { // Paper
public CraftMushroomCow(CraftServer server, net.minecraft.world.entity.animal.MushroomCow entity) {
super(server, entity);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java
index ca8e35fbf04a54d60c3612f74be0b5fbf2ab7a56..81ccb4bde315c42409a0c04883f5cb4551398308 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java
@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Sheep;
-public class CraftSheep extends CraftAnimals implements Sheep {
+public class CraftSheep extends CraftAnimals implements Sheep, io.papermc.paper.entity.PaperShearable { // Paper
public CraftSheep(CraftServer server, net.minecraft.world.entity.animal.Sheep entity) {
super(server, entity);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
index 659e2959c5330e4764ea1edc7f8de9f464f9ff52..42b7058d93fab8cbee49dba130734e1df9910096 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Snowman;
-public class CraftSnowman extends CraftGolem implements Snowman, com.destroystokyo.paper.entity.CraftRangedEntity<SnowGolem> { // Paper
+public class CraftSnowman extends CraftGolem implements Snowman, com.destroystokyo.paper.entity.CraftRangedEntity<SnowGolem>, io.papermc.paper.entity.PaperShearable { // Paper
public CraftSnowman(CraftServer server, SnowGolem entity) {
super(server, entity);
}