13
0
geforkt von Mirrors/Paper

SPIGOT-5468: Improve Beehive TileEntity API

By: ShaneBee <shanebolenback@me.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2020-02-09 10:47:09 +11:00
Ursprung 92cb9d0c47
Commit 0455dbf2f7
3 geänderte Dateien mit 79 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -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();
}

Datei anzeigen

@ -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);
}

Datei anzeigen

@ -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);
}