Class BindableSpecialFlowerBlockEntity<T>

java.lang.Object
net.minecraft.world.level.block.entity.BlockEntity
vazkii.botania.api.block_entity.SpecialFlowerBlockEntity
vazkii.botania.api.block_entity.BindableSpecialFlowerBlockEntity<T>
All Implemented Interfaces:
Bound, FloatingFlowerProvider, WandBindable
Direct Known Subclasses:
FunctionalFlowerBlockEntity, GeneratingFlowerBlockEntity

public abstract class BindableSpecialFlowerBlockEntity<T> extends SpecialFlowerBlockEntity implements WandBindable
Superclass of flowers that can be bound to some kind of target with the Wand of the Forest, such as generating flowers to mana collectors, or functional flowers to pools. Implements the bindability logic common to both types of flower.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     

    Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity

    net.minecraft.world.level.block.entity.BlockEntity.DataComponentInput
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected @Nullable net.minecraft.core.BlockPos
     

    Fields inherited from class vazkii.botania.api.block_entity.SpecialFlowerBlockEntity

    MYCELIUM_DELAY, overgrowth, overgrowthBoost, PODZOL_DELAY, TAG_TICKS_EXISTED, ticksExisted

    Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity

    level, remove, worldPosition

    Fields inherited from interface vazkii.botania.api.block.Bound

    UNBOUND_POS
  • Constructor Summary

    Constructors
    Constructor
    Description
    BindableSpecialFlowerBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, Class<T> bindClass)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    addMana(int mana)
     
    boolean
    bindTo(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack wand, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side)
    Call to bind the TileEntity to where the player clicked.
    boolean
    canSelect(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack wand, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side)
    Return true if the Wand can select this tile.
    findBindCandidateAt(net.minecraft.core.BlockPos pos)
     
     
    abstract @Nullable net.minecraft.core.BlockPos
    Returns the BlockPos of the nearest target within the binding radius, or `null` if there aren't any.
    net.minecraft.core.BlockPos
    Gets where this block is bound to
    @Nullable net.minecraft.core.BlockPos
     
    abstract int
     
    abstract int
     
    abstract net.minecraft.world.item.ItemStack
     
    net.minecraft.world.item.ItemStack
     
    abstract int
     
    abstract int
     
    boolean
     
    void
    readFromPacketNBT(net.minecraft.nbt.CompoundTag cmp, net.minecraft.core.HolderLookup.Provider registries)
    Reads data from a network packet.
    void
    setBindingPos(@Nullable net.minecraft.core.BlockPos bindingPos)
     
    void
    setPlacedBy(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.entity.LivingEntity placer, net.minecraft.world.item.ItemStack stack)
    Called when this sub tile is placed in the world (by an entity).
    protected void
     
    boolean
    wouldBeValidBinding(@Nullable net.minecraft.core.BlockPos pos)
     
    void
    writeToPacketNBT(net.minecraft.nbt.CompoundTag cmp, net.minecraft.core.HolderLookup.Provider registries)
    Writes some extra data to a network packet.

    Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity

    addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPosFromTag, getType, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, onlyOpCanSetNbt, parseCustomNameSafe, removeComponentsFromTag, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setLevel, setRemoved, triggerEvent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • bindingPos

      @Nullable protected @Nullable net.minecraft.core.BlockPos bindingPos
  • Constructor Details

    • BindableSpecialFlowerBlockEntity

      public BindableSpecialFlowerBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, Class<T> bindClass)
  • Method Details

    • getBindingRadius

      public abstract int getBindingRadius()
    • findClosestTarget

      @Nullable public abstract @Nullable net.minecraft.core.BlockPos findClosestTarget()
      Returns the BlockPos of the nearest target within the binding radius, or `null` if there aren't any.
    • tickFlower

      protected void tickFlower()
      Overrides:
      tickFlower in class SpecialFlowerBlockEntity
    • setPlacedBy

      public void setPlacedBy(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable @Nullable net.minecraft.world.entity.LivingEntity placer, net.minecraft.world.item.ItemStack stack)
      Description copied from class: SpecialFlowerBlockEntity
      Called when this sub tile is placed in the world (by an entity).
      Overrides:
      setPlacedBy in class SpecialFlowerBlockEntity
    • getBindingPos

      @Nullable public @Nullable net.minecraft.core.BlockPos getBindingPos()
    • setBindingPos

      public void setBindingPos(@Nullable @Nullable net.minecraft.core.BlockPos bindingPos)
    • findBindCandidateAt

      @Nullable public T findBindCandidateAt(net.minecraft.core.BlockPos pos)
    • findBoundTile

      @Nullable public T findBoundTile()
    • wouldBeValidBinding

      public boolean wouldBeValidBinding(@Nullable @Nullable net.minecraft.core.BlockPos pos)
    • isValidBinding

      public boolean isValidBinding()
    • getBinding

      public net.minecraft.core.BlockPos getBinding()
      Description copied from interface: Bound
      Gets where this block is bound to
      Specified by:
      getBinding in interface Bound
    • canSelect

      public boolean canSelect(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack wand, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side)
      Description copied from interface: WandBindable
      Return true if the Wand can select this tile.
      Specified by:
      canSelect in interface WandBindable
    • bindTo

      public boolean bindTo(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack wand, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side)
      Description copied from interface: WandBindable
      Call to bind the TileEntity to where the player clicked. Return true to deselect the TileEntity for another bind or false case the TileEntity should stay selected.
      Specified by:
      bindTo in interface WandBindable
    • writeToPacketNBT

      public void writeToPacketNBT(net.minecraft.nbt.CompoundTag cmp, net.minecraft.core.HolderLookup.Provider registries)
      Description copied from class: SpecialFlowerBlockEntity
      Writes some extra data to a network packet. This data is read by readFromPacketNBT on the client that receives the packet. Note: This method is also used to write to the world NBT.
      Overrides:
      writeToPacketNBT in class SpecialFlowerBlockEntity
    • readFromPacketNBT

      public void readFromPacketNBT(net.minecraft.nbt.CompoundTag cmp, net.minecraft.core.HolderLookup.Provider registries)
      Description copied from class: SpecialFlowerBlockEntity
      Reads data from a network packet. This data is written by writeToPacketNBT in the server. Note: This method is also used to read from the world NBT.
      Overrides:
      readFromPacketNBT in class SpecialFlowerBlockEntity
    • getMana

      public abstract int getMana()
    • addMana

      public abstract void addMana(int mana)
    • getMaxMana

      public abstract int getMaxMana()
    • getColor

      public abstract int getColor()
    • getDefaultHudIcon

      public abstract net.minecraft.world.item.ItemStack getDefaultHudIcon()
    • getHudIcon

      public net.minecraft.world.item.ItemStack getHudIcon()