Interface IBeekeepingLogic

All Superinterfaces:
INbtReadable, INbtWritable

public interface IBeekeepingLogic extends INbtWritable, INbtReadable
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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The default number of ticks per queen work cycle.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether bee fx should be active.
    boolean
    Checks that the bees can work, setting error conditions on the housing where needed
    void
    Force the logic to refresh any cached values and error states.
    void
    Display bee fx.
    void
    Performs actual work, breeding, production, etc.
    int
    Get the progress bar for breeding and production.
    List<net.minecraft.core.BlockPos>
    Used by bee fx to direct bees to nearby flowers.
    default void
    readData(net.minecraft.network.RegistryFriendlyByteBuf data)
    Called on the clientside to receive data from the server.
    default void
    setWorkThrottle(int workThrottle)
    Changes the number of ticks per work cycle for this beekeeping logic.
    void
    Sync to client by using
    invalid reference
    #write(net.minecraft.nbt.CompoundTag)
    in your
    invalid reference
    net.minecraft.world.level.block.entity.BlockEntity#getUpdateTag()
    void
    syncToClient(net.minecraft.server.level.ServerPlayer player)
     
    default void
    writeData(net.minecraft.network.RegistryFriendlyByteBuf data)
    Called on the serverside to sync additional information about this logic to the client.

    Methods inherited from interface forestry.api.core.INbtReadable

    read

    Methods inherited from interface forestry.api.core.INbtWritable

    write
  • Field Details

    • DEFAULT_WORK_THROTTLE

      static final int DEFAULT_WORK_THROTTLE
      The 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 using
      invalid reference
      #write(net.minecraft.nbt.CompoundTag)
      in your
      invalid reference
      net.minecraft.world.level.block.entity.BlockEntity#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.
    • writeData

      default void writeData(net.minecraft.network.RegistryFriendlyByteBuf data)
      Called on the serverside to sync additional information about this logic to the client.
      Parameters:
      data - The stream of data about this object to send to the client
    • readData

      default void readData(net.minecraft.network.RegistryFriendlyByteBuf data)
      Called on the clientside to receive data from the server.
      Parameters:
      data - The stream of data about this object sent by the server