Paper/Spigot-API-Patches/0060-Improve-the-Saddle-API-for-Horses.patch
Spottedleaf 5c7081fecc Update upstream & fix some chunk related issues (#2177)
* Updated Upstream (Bukkit/CraftBukkit)

Upstream has released updates that appears 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:
45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories

CraftBukkit Changes:
4090d01f SPIGOT-5047: Correct slot types for 1.14 inventories
e8c08362 SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.
d445af3b SPIGOT-5067: Add item meta for 1.14 spawn eggs

* Bring Chunk load checks in-line with spigot

As of the last upstream merge spigot now checks ticket level status
when returning loaded chunks for a world from api. Now our checks
will respect that decision.

* Fix spawn ticket levels

Vanilla would keep the inner chunks of spawn available for ticking,
however my changes made all chunks non-ticking. Resolve by changing
ticket levels for spawn chunks inside the border to respect this
behavior.


* Make World#getChunkIfLoadedImmediately return only entity ticking chunks

Mojang appears to be using chunks with level > 33 (non-ticking chunks)
as cached chunks and not actually loaded chunks.

* Bring all loaded checks in line with spigot

Loaded chunks must be at least border  chunks, or level <= 33
2019-06-14 03:27:40 +01:00

87 Zeilen
2.9 KiB
Diff

From 2eda3cf357cb4091bea1a72f982602e9104ce211 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
index 000000000..163ffe8ff
--- /dev/null
+++ b/src/main/java/org/bukkit/inventory/ArmoredHorseInventory.java
@@ -0,0 +1,21 @@
+package org.bukkit.inventory;
+
+import org.jetbrains.annotations.Nullable;
+
+public interface ArmoredHorseInventory extends AbstractHorseInventory {
+
+ /**
+ * Gets the item in the horse's armor slot.
+ *
+ * @return the armor item
+ */
+ @Nullable
+ ItemStack getArmor();
+
+ /**
+ * Sets the item in the horse's armor slot.
+ *
+ * @param stack the new item
+ */
+ void setArmor(@Nullable ItemStack stack);
+}
diff --git a/src/main/java/org/bukkit/inventory/HorseInventory.java b/src/main/java/org/bukkit/inventory/HorseInventory.java
index 608e99c42..53498debe 100644
--- a/src/main/java/org/bukkit/inventory/HorseInventory.java
+++ b/src/main/java/org/bukkit/inventory/HorseInventory.java
@@ -5,20 +5,4 @@ import org.jetbrains.annotations.Nullable;
/**
* An interface to the inventory of a Horse.
*/
-public interface HorseInventory extends AbstractHorseInventory {
-
- /**
- * Gets the item in the horse's armor slot.
- *
- * @return the armor item
- */
- @Nullable
- ItemStack getArmor();
-
- /**
- * Sets the item in the horse's armor slot.
- *
- * @param stack the new item
- */
- void setArmor(@Nullable ItemStack stack);
-}
+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 2fa2c9d07..5ac1afb8a 100644
--- a/src/main/java/org/bukkit/inventory/LlamaInventory.java
+++ b/src/main/java/org/bukkit/inventory/LlamaInventory.java
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable;
/**
* 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
index 000000000..7944f26a3
--- /dev/null
+++ b/src/main/java/org/bukkit/inventory/SaddledHorseInventory.java
@@ -0,0 +1,3 @@
+package org.bukkit.inventory;
+
+public interface SaddledHorseInventory extends AbstractHorseInventory {}
--
2.21.0