Package forestry.api.apiculture
Interface IBeekeepingLogic
- All Superinterfaces:
INbtReadable,INbtWritable
Stores beekeeping logic for bee housings.
Get one with BeeManager.beeRoot.createBeekeepingLogic(IBeeHousing housing)
Save and load it to NBT using the INbtWritable methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default number of ticks per queen work cycle. -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether bee fx should be active.booleancanWork()Checks that the bees can work, setting error conditions on the housing where neededvoidForce the logic to refresh any cached values and error states.voiddoBeeFX()Display bee fx.voiddoWork()Performs actual work, breeding, production, etc.intGet the progress bar for breeding and production.List<net.minecraft.core.BlockPos>Used by bee fx to direct bees to nearby flowers.default voidreadData(net.minecraft.network.FriendlyByteBuf data) default voidsetWorkThrottle(int workThrottle) Changes the number of ticks per work cycle for this beekeeping logic.voidSync to client by usingINbtWritable.write(net.minecraft.nbt.CompoundTag)in yourBlockEntity.getUpdateTag()voidsyncToClient(net.minecraft.server.level.ServerPlayer player) default voidwriteData(net.minecraft.network.FriendlyByteBuf data) Methods inherited from interface forestry.api.core.INbtReadable
readMethods inherited from interface forestry.api.core.INbtWritable
write
-
Field Details
-
DEFAULT_WORK_THROTTLE
static final int DEFAULT_WORK_THROTTLEThe default number of ticks per queen work cycle.- See Also:
-
-
Method Details
-
canWork
boolean canWork()Checks that the bees can work, setting error conditions on the housing where needed- Returns:
- true if no errors are present and doWork should be called
-
doWork
void doWork()Performs actual work, breeding, production, etc. -
clearCachedValues
void clearCachedValues()Force the logic to refresh any cached values and error states. Call this when a player opens the gui so that all errors are up to date. -
setWorkThrottle
default void setWorkThrottle(int workThrottle) Changes the number of ticks per work cycle for this beekeeping logic. The default work throttle is 550 ticks per work cycle, which is 27.5 seconds per work cycle.- Parameters:
workThrottle- The number of ticks per work cycle.- Since:
- 2.2.4
-
syncToClient
void syncToClient()Sync to client by usingINbtWritable.write(net.minecraft.nbt.CompoundTag)in yourBlockEntity.getUpdateTag() -
syncToClient
void syncToClient(net.minecraft.server.level.ServerPlayer player) -
getBeeProgressPercent
int getBeeProgressPercent()Get the progress bar for breeding and production. To avoid network spam, this is only available server-side, and must be synced manually to the client when a GUI is open. -
canDoBeeFX
boolean canDoBeeFX()Whether bee fx should be active. Internally, this is automatically synced to the client. -
doBeeFX
void doBeeFX()Display bee fx. Calls IBee.doFX(IEffectData[] storedData, IBeeHousing housing) on the queen. Internally, the queen is automatically synced to the client for the fx. -
getFlowerPositions
List<net.minecraft.core.BlockPos> getFlowerPositions()Used by bee fx to direct bees to nearby flowers. These positions are synced to the client from the server. -
readData
default void readData(net.minecraft.network.FriendlyByteBuf data) -
writeData
default void writeData(net.minecraft.network.FriendlyByteBuf data)
-