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.
This commit is contained in:
Aikar
2016-12-10 16:24:06 -05:00
parent 760d9e300f
commit 90c776d3aa
3 changed files with 15 additions and 2 deletions
@@ -5,6 +5,7 @@ import java.util.UUID;
import net.minecraft.world.entity.ai.attributes.Attributes;
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;
@@ -107,6 +108,6 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
@Override
public AbstractHorseInventory getInventory() {
return new CraftInventoryAbstractHorse(this.getHandle().inventory);
return new CraftSaddledInventory(getHandle().inventory);
}
}
@@ -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 {
private final Container bodyArmorInventory;
@@ -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);
}
}