SPIGOT-6507: Introduce abstract skeleton and stray conversion
The previous layout and class hierarchy of the skeleton API defined variances of the skeleton, such as the wither skeleton or the stray, as child types of the normal skeleton variance, which is technically incorrect, yet did not produce any specific issue as the normal skeleton variance did not have any unique logic. With the introduction of powdered snow in the 1.17 update, the normal skeleton variance now has unique logic, specifically the conversion to a stay when stuck inside powdered snow, which cannot be represented in the current API layout due to the prior mentioned hierarchy. This commit introduces the AbstractSkeleton interface, which follows the concept of other abstract interfaces like AbstractArrow and serves as a common parent to the existing skeleton variances. Furthermore this commit introduces the previously mentioned stray conversion to the normal skeleton variance. This commit does not break ABI yet breaks backwards compatibility due to the mentioned hierarchy changes. Plugins that previously used the Skelton interface to compute whether or not an entity is skeleton-like through instanceOf checks will now only match the normal skeleton variance instead of any skeleton-like entity. By: Bjarne Koll <lynxplay101@gmail.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This interface defines or represents the abstract concept of skeleton-like
|
||||
* entities on the server. The interface is hence not a direct representation
|
||||
* of an entity but rather serves as a parent to interfaces/entity types like
|
||||
* {@link Skeleton}, {@link WitherSkeleton} or {@link Stray}.
|
||||
*
|
||||
* To compute what specific type of skeleton is present in a variable/field
|
||||
* of this type, instanceOf checks against the specific subtypes listed prior
|
||||
* are recommended.
|
||||
*/
|
||||
public interface AbstractSkeleton extends Monster {
|
||||
|
||||
/**
|
||||
* Gets the current type of this skeleton.
|
||||
*
|
||||
* @return Current type
|
||||
* @deprecated should check what class instance this is.
|
||||
*/
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public Skeleton.SkeletonType getSkeletonType();
|
||||
|
||||
/**
|
||||
* @param type type
|
||||
* @deprecated Must spawn a new subtype variant
|
||||
*/
|
||||
@Deprecated
|
||||
@Contract("_ -> fail")
|
||||
public void setSkeletonType(Skeleton.SkeletonType type);
|
||||
}
|
||||
Reference in New Issue
Block a user