Paper/Spigot-API-Patches/0062-Improve-the-Saddle-API-for-Horses.patch

83 Zeilen
2.8 KiB
Diff

2018-02-08 11:07:27 +01:00
From 5b40b7e3f882c44f18249d89dbbeb93298af3535 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 10 Dec 2016 16:12:48 -0500
Subject: [PATCH] Improve the Saddle API for Horses
Not all horses with Saddles have armor. This lets us break up the horses with saddles
and access their saddle state separately from an interface shared with Armor.
diff --git a/src/main/java/org/bukkit/inventory/ArmoredHorseInventory.java b/src/main/java/org/bukkit/inventory/ArmoredHorseInventory.java
new file mode 100644
2018-02-08 11:07:27 +01:00
index 00000000..a39b9544
--- /dev/null
+++ b/src/main/java/org/bukkit/inventory/ArmoredHorseInventory.java
@@ -0,0 +1,18 @@
+package org.bukkit.inventory;
+
2018-02-08 11:07:27 +01:00
+public interface ArmoredHorseInventory extends AbstractHorseInventory {
+
+ /**
+ * Gets the item in the horse's armor slot.
+ *
+ * @return the armor item
+ */
+ ItemStack getArmor();
+
+ /**
+ * Sets the item in the horse's armor slot.
+ *
+ * @param stack the new item
+ */
+ void setArmor(ItemStack stack);
+}
diff --git a/src/main/java/org/bukkit/inventory/HorseInventory.java b/src/main/java/org/bukkit/inventory/HorseInventory.java
2018-02-08 11:07:27 +01:00
index a73c9850..e14c1277 100644
--- a/src/main/java/org/bukkit/inventory/HorseInventory.java
+++ b/src/main/java/org/bukkit/inventory/HorseInventory.java
2018-02-08 11:07:27 +01:00
@@ -3,19 +3,4 @@ package org.bukkit.inventory;
/**
* An interface to the inventory of a Horse.
*/
2018-02-08 11:07:27 +01:00
-public interface HorseInventory extends AbstractHorseInventory {
-
- /**
- * Gets the item in the horse's armor slot.
- *
- * @return the armor item
- */
- ItemStack getArmor();
-
- /**
- * Sets the item in the horse's armor slot.
- *
- * @param stack the new item
- */
- void setArmor(ItemStack stack);
-}
2018-02-08 11:07:27 +01:00
+public interface HorseInventory extends AbstractHorseInventory, ArmoredHorseInventory {}
diff --git a/src/main/java/org/bukkit/inventory/LlamaInventory.java b/src/main/java/org/bukkit/inventory/LlamaInventory.java
index 9b3dcf3f..7856a7f2 100644
--- a/src/main/java/org/bukkit/inventory/LlamaInventory.java
+++ b/src/main/java/org/bukkit/inventory/LlamaInventory.java
@@ -5,7 +5,7 @@ import org.bukkit.entity.Llama;
/**
* An interface to the inventory of a {@link Llama}.
*/
-public interface LlamaInventory extends AbstractHorseInventory {
+public interface LlamaInventory extends SaddledHorseInventory {
/*
* Gets the item in the llama's decor slot.
diff --git a/src/main/java/org/bukkit/inventory/SaddledHorseInventory.java b/src/main/java/org/bukkit/inventory/SaddledHorseInventory.java
new file mode 100644
2018-02-08 11:07:27 +01:00
index 00000000..7944f26a
--- /dev/null
+++ b/src/main/java/org/bukkit/inventory/SaddledHorseInventory.java
2018-02-08 11:07:27 +01:00
@@ -0,0 +1,3 @@
+package org.bukkit.inventory;
+
2018-02-08 11:07:27 +01:00
+public interface SaddledHorseInventory extends AbstractHorseInventory {}
--
2018-02-08 11:07:27 +01:00
2.16.1