geforkt von Mirrors/Paper
SPIGOT-5468: Improve Beehive TileEntity API
By: ShaneBee <shanebolenback@me.com>
Dieser Commit ist enthalten in:
Ursprung
92cb9d0c47
Commit
0455dbf2f7
@ -1,12 +1,13 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Bee;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a captured state of a bee hive.
|
||||
*/
|
||||
public interface Beehive extends TileState {
|
||||
public interface Beehive extends EntityBlockStorage<Bee> {
|
||||
|
||||
/**
|
||||
* Get the hive's flower location.
|
||||
@ -22,4 +23,11 @@ public interface Beehive extends TileState {
|
||||
* @param location or null
|
||||
*/
|
||||
void setFlower(@Nullable Location location);
|
||||
|
||||
/**
|
||||
* Check if the hive is sedated due to smoke from a nearby campfire.
|
||||
*
|
||||
* @return True if hive is sedated
|
||||
*/
|
||||
boolean isSedated();
|
||||
}
|
||||
|
56
paper-api/src/main/java/org/bukkit/block/EntityBlockStorage.java
Normale Datei
56
paper-api/src/main/java/org/bukkit/block/EntityBlockStorage.java
Normale Datei
@ -0,0 +1,56 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents a captured state of a block which stores entities.
|
||||
*
|
||||
* @param <T> Entity this block can store
|
||||
*/
|
||||
public interface EntityBlockStorage<T extends Entity> extends TileState {
|
||||
|
||||
/**
|
||||
* Check if the block is completely full of entities.
|
||||
*
|
||||
* @return True if block is full
|
||||
*/
|
||||
boolean isFull();
|
||||
|
||||
/**
|
||||
* Get the amount of entities currently in this block.
|
||||
*
|
||||
* @return Amount of entities currently in this block
|
||||
*/
|
||||
int getEntityCount();
|
||||
|
||||
/**
|
||||
* Get the maximum amount of entities this block can hold.
|
||||
*
|
||||
* @return Maximum amount of entities this block can hold
|
||||
*/
|
||||
int getMaxEntities();
|
||||
|
||||
/**
|
||||
* Set the maximum amount of entities this block can hold.
|
||||
*
|
||||
* @param max Maximum amount of entities this block can hold
|
||||
*/
|
||||
void setMaxEntities(int max);
|
||||
|
||||
/**
|
||||
* Release all the entities currently stored in the block.
|
||||
*
|
||||
* @return List of all entities which were released
|
||||
*/
|
||||
@NotNull
|
||||
List<T> releaseEntities();
|
||||
|
||||
/**
|
||||
* Add an entity to the block.
|
||||
*
|
||||
* @param entity Entity to add to the block
|
||||
*/
|
||||
void addEntity(@NotNull T entity);
|
||||
}
|
@ -79,4 +79,18 @@ public interface Bee extends Animals {
|
||||
* @param anger new anger
|
||||
*/
|
||||
void setAnger(int anger);
|
||||
|
||||
/**
|
||||
* Get the amount of ticks the bee cannot enter the hive for.
|
||||
*
|
||||
* @return Ticks the bee cannot enter a hive for
|
||||
*/
|
||||
int getCannotEnterHiveTicks();
|
||||
|
||||
/**
|
||||
* Set the amount of ticks the bee cannot enter a hive for.
|
||||
*
|
||||
* @param ticks Ticks the bee cannot enter a hive for
|
||||
*/
|
||||
void setCannotEnterHiveTicks(int ticks);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren