Add API to access wolf armor

This commit is contained in:
2008Choco 2024-12-26 14:45:24 -05:00
parent ea073278d2
commit d8e791b3da
No known key found for this signature in database
GPG key ID: 6A35B5CF6ECEA235
4 changed files with 41 additions and 19 deletions

View file

@ -4,12 +4,15 @@ import org.bukkit.DyeColor;
import org.bukkit.Keyed; import org.bukkit.Keyed;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.Registry; import org.bukkit.Registry;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.WolfInventory;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* Represents a Wolf * Represents a Wolf
*/ */
public interface Wolf extends Tameable, Sittable { public interface Wolf extends Tameable, Sittable, InventoryHolder {
/** /**
* Checks if this wolf is angry * Checks if this wolf is angry
@ -86,6 +89,10 @@ public interface Wolf extends Tameable, Sittable {
*/ */
void setVariant(@NotNull Variant variant); void setVariant(@NotNull Variant variant);
@NotNull
@Override
WolfInventory getInventory();
/** /**
* Represents the variant of a wolf. * Represents the variant of a wolf.
*/ */

View file

@ -0,0 +1,25 @@
package org.bukkit.inventory;
import org.jetbrains.annotations.Nullable;
/**
* An interface to the inventory of an entity capable of holding body armor (wolves, horses, etc.).
*/
public interface BodyArmorInventory extends Inventory {
/**
* Gets the item in the entity's body armor slot.
*
* @return the armor item
*/
@Nullable
ItemStack getArmor();
/**
* Sets the item in the entity's body armor slot.
*
* @param stack the new item
*/
void setArmor(@Nullable ItemStack stack);
}

View file

@ -1,24 +1,7 @@
package org.bukkit.inventory; package org.bukkit.inventory;
import org.jetbrains.annotations.Nullable;
/** /**
* An interface to the inventory of a Horse. * An interface to the inventory of a Horse.
*/ */
public interface HorseInventory extends AbstractHorseInventory { public interface HorseInventory extends AbstractHorseInventory, BodyArmorInventory {
/**
* 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);
} }

View file

@ -0,0 +1,7 @@
package org.bukkit.inventory;
/**
* An interface to the inventory of a Wolf.
*/
public interface WolfInventory extends BodyArmorInventory {
}