SPIGOT-2911: Implement AbstractHorseInventory

This commit is contained in:
md_5 2018-01-28 09:55:16 +11:00
parent dac2a4a6ae
commit 015bda4b7d
4 changed files with 28 additions and 14 deletions

View File

@ -5,11 +5,11 @@ import net.minecraft.server.EntityHorse;
import net.minecraft.server.EntityHorseAbstract;
import org.apache.commons.lang.Validate;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryAbstractHorse;
import org.bukkit.entity.AbstractHorse;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Horse;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.AbstractHorseInventory;
public abstract class CraftAbstractHorse extends CraftAnimals implements AbstractHorse {
@ -91,7 +91,7 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
}
@Override
public Inventory getInventory() {
return new CraftInventory(getHandle().inventoryChest);
public AbstractHorseInventory getInventory() {
return new CraftInventoryAbstractHorse(getHandle().inventoryChest);
}
}

View File

@ -0,0 +1,22 @@
package org.bukkit.craftbukkit.inventory;
import net.minecraft.server.IInventory;
import org.bukkit.inventory.AbstractHorseInventory;
import org.bukkit.inventory.ItemStack;
public class CraftInventoryAbstractHorse extends CraftInventory implements AbstractHorseInventory {
public CraftInventoryAbstractHorse(IInventory inventory) {
super(inventory);
}
@Override
public ItemStack getSaddle() {
return getItem(0);
}
@Override
public void setSaddle(ItemStack stack) {
setItem(0, stack);
}
}

View File

@ -4,24 +4,16 @@ import net.minecraft.server.IInventory;
import org.bukkit.inventory.HorseInventory;
import org.bukkit.inventory.ItemStack;
public class CraftInventoryHorse extends CraftInventory implements HorseInventory {
public class CraftInventoryHorse extends CraftInventoryAbstractHorse implements HorseInventory {
public CraftInventoryHorse(IInventory inventory) {
super(inventory);
}
public ItemStack getSaddle() {
return getItem(0);
}
public ItemStack getArmor() {
return getItem(1);
}
public void setSaddle(ItemStack stack) {
setItem(0, stack);
}
public void setArmor(ItemStack stack) {
setItem(1, stack);
}

View File

@ -4,7 +4,7 @@ import net.minecraft.server.IInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.LlamaInventory;
public class CraftInventoryLlama extends CraftInventory implements LlamaInventory {
public class CraftInventoryLlama extends CraftInventoryAbstractHorse implements LlamaInventory {
public CraftInventoryLlama(IInventory inventory) {
super(inventory);