Solved Beehive class

Discussion in 'Spigot Plugin Development' started by armandozetaxx, Jan 14, 2020.

  1. Hello guys,

    I'm trying to get the number of bees that a beehive contains, but the "Beehive" class doesn't have a function for that. Is there a way to do this?

    Thank you for your help.
    • Useful Useful x 2
  2. Probably using the block data
    • Agree Agree x 1
  3. Found the answer, bees are stored in the hive's NBT data. Thank you guys.
  4. If you don't want to go the NBT route you can do a couple casts into NMS and try something like this:
    Code (Java):
    ((TileEntityBeehive) ((CraftBeehive) beehive).getHandle()).j();
    for reference j = getOccupantCount()
    also in my example `beehive` would be a blockState from a beehive block
    #5 ShaneBee, Jan 15, 2020
    Last edited: Jan 15, 2020