Paper/Remapped-Spigot-Server-Patches/0157-Improve-the-Saddle-API-for-Horses.patch
2021-06-11 13:56:17 +02:00

60 Zeilen
3.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 10 Dec 2016 16:24:06 -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/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
index 116553ea587ab5ff3bc8a1530f51cd6efb7ae8ca..6136b3322a340d506ce744bcd15f71a158e46ad1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
@@ -5,6 +5,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes;
import org.apache.commons.lang.Validate;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.inventory.CraftInventoryAbstractHorse;
+import org.bukkit.craftbukkit.inventory.CraftSaddledInventory;
import org.bukkit.entity.AbstractHorse;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Horse;
@@ -98,6 +99,6 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
@Override
public AbstractHorseInventory getInventory() {
- return new CraftInventoryAbstractHorse(getHandle().inventory);
+ return new CraftSaddledInventory(getHandle().inventory);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java
index 7013059856c2471dc34112a1a2068b96b809dd96..b72b4260fc1c0e9928d70f97589d8db00849b9e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java
@@ -4,7 +4,7 @@ import net.minecraft.world.Container;
import org.bukkit.inventory.HorseInventory;
import org.bukkit.inventory.ItemStack;
-public class CraftInventoryHorse extends CraftInventoryAbstractHorse implements HorseInventory {
+public class CraftInventoryHorse extends CraftSaddledInventory implements HorseInventory {
public CraftInventoryHorse(Container inventory) {
super(inventory);
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSaddledInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSaddledInventory.java
new file mode 100644
index 0000000000000000000000000000000000000000..3a617c07d445bacf5a13e0e3ff6481823cfc8477
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSaddledInventory.java
@@ -0,0 +1,12 @@
+package org.bukkit.craftbukkit.inventory;
+
+import net.minecraft.world.Container;
+import org.bukkit.inventory.SaddledHorseInventory;
+
+public class CraftSaddledInventory extends CraftInventoryAbstractHorse implements SaddledHorseInventory {
+
+ public CraftSaddledInventory(Container inventory) {
+ super(inventory);
+ }
+
+}