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>
68 lines
2.1 KiB
Java
68 lines
2.1 KiB
Java
package org.bukkit.entity;
|
|
|
|
/**
|
|
* Represents a Skeleton.
|
|
* <p>
|
|
* This interface only represents the normal skeleton type on the server.
|
|
* Other skeleton-like entities, such as the {@link WitherSkeleton} or the
|
|
* {@link Stray} are not related to this type.
|
|
*/
|
|
public interface Skeleton extends AbstractSkeleton {
|
|
|
|
/**
|
|
* Computes whether or not this skeleton is currently in the process of
|
|
* converting to a {@link Stray} due to it being frozen by powdered snow.
|
|
*
|
|
* @return whether or not the skeleton is converting to a stray.
|
|
*/
|
|
boolean isConverting();
|
|
|
|
/**
|
|
* Gets the amount of ticks until this entity will be converted to a stray
|
|
* as a result of being frozen by a powdered snow block.
|
|
* <p>
|
|
* When this reaches 0, the entity will be converted.
|
|
*
|
|
* @return the conversion time left represented in ticks.
|
|
*
|
|
* @throws IllegalStateException if {@link #isConverting()} is false.
|
|
*/
|
|
int getConversionTime();
|
|
|
|
/**
|
|
* Sets the amount of ticks until this entity will be converted to a stray
|
|
* as a result of being frozen by a powdered snow block.
|
|
* <p>
|
|
* When this reaches 0, the entity will be converted. A value of less than 0
|
|
* will stop the current conversion process without converting the current
|
|
* entity.
|
|
*
|
|
* @param time the new conversion time left before the conversion in ticks.
|
|
*/
|
|
void setConversionTime(int time);
|
|
|
|
/**
|
|
* A legacy enum that defines the different variances of skeleton-like
|
|
* entities on the server.
|
|
*
|
|
* @deprecated classes are different types. This interface only remains in
|
|
* the Skeleton interface to preserve backwards compatibility.
|
|
*/
|
|
@Deprecated
|
|
public enum SkeletonType {
|
|
|
|
/**
|
|
* Standard skeleton type.
|
|
*/
|
|
NORMAL,
|
|
/**
|
|
* Wither skeleton. Generally found in Nether fortresses.
|
|
*/
|
|
WITHER,
|
|
/**
|
|
* Stray skeleton. Generally found in ice biomes. Shoots tipped arrows.
|
|
*/
|
|
STRAY;
|
|
}
|
|
}
|