Package vazkii.botania.api.block_entity
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>
- Type Parameters:
T- Type of block entity this special flower cna bind to.
- 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 ClassesModifier and TypeClassDescriptionstatic classBindableSpecialFlowerBlockEntity.BindableFlowerWandHud<F extends BindableSpecialFlowerBlockEntity<?>>Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.BlockEntity.DataComponentInput -
Field Summary
FieldsFields inherited from class vazkii.botania.api.block_entity.SpecialFlowerBlockEntity
MYCELIUM_DELAY, overgrowth, overgrowthBoost, PODZOL_DELAY, TAG_TICKS_EXISTED, ticksExistedFields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from interface vazkii.botania.api.block.Bound
UNBOUND_POS -
Constructor Summary
ConstructorsConstructorDescriptionBindableSpecialFlowerBlockEntity(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 TypeMethodDescriptionabstract voidaddMana(int mana) booleanbindTo(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.booleancanSelect(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.BlockPosReturns the BlockPos of the nearest target within the binding radius, or `null` if there aren't any.net.minecraft.core.BlockPosGets where this block is bound to@Nullable net.minecraft.core.BlockPosabstract intabstract intgetColor()abstract net.minecraft.world.item.ItemStacknet.minecraft.world.item.ItemStackabstract intgetMana()abstract intbooleanvoidreadFromPacketNBT(net.minecraft.nbt.CompoundTag cmp, net.minecraft.core.HolderLookup.Provider registries) Reads data from a network packet.voidsetBindingPos(@Nullable net.minecraft.core.BlockPos bindingPos) voidsetPlacedBy(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 voidbooleanwouldBeValidBinding(@Nullable net.minecraft.core.BlockPos pos) voidwriteToPacketNBT(net.minecraft.nbt.CompoundTag cmp, net.minecraft.core.HolderLookup.Provider registries) Writes some extra data to a network packet.Methods inherited from class vazkii.botania.api.block_entity.SpecialFlowerBlockEntity
commonTick, emitParticle, getComparatorSignal, getEffectivePos, getFloatingData, getModulatedDelay, getRadius, getRenderData, getSecondaryRadius, getUpdatePacket, getUpdateTag, isFloating, isOnSpecialSoil, isOvergrowthAffected, loadAdditional, saveAdditional, setFloating, syncMethods 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
-
Field Details
-
bindingPos
@Nullable protected @Nullable net.minecraft.core.BlockPos bindingPos
-
-
Constructor Details
-
BindableSpecialFlowerBlockEntity
-
-
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:
tickFlowerin classSpecialFlowerBlockEntity
-
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:SpecialFlowerBlockEntityCalled when this sub tile is placed in the world (by an entity).- Overrides:
setPlacedByin classSpecialFlowerBlockEntity
-
getBindingPos
@Nullable public @Nullable net.minecraft.core.BlockPos getBindingPos() -
setBindingPos
public void setBindingPos(@Nullable @Nullable net.minecraft.core.BlockPos bindingPos) -
findBindCandidateAt
-
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:BoundGets where this block is bound to- Specified by:
getBindingin interfaceBound
-
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:WandBindableReturn true if the Wand can select this tile.- Specified by:
canSelectin interfaceWandBindable
-
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:WandBindableCall 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:
bindToin interfaceWandBindable
-
writeToPacketNBT
public void writeToPacketNBT(net.minecraft.nbt.CompoundTag cmp, net.minecraft.core.HolderLookup.Provider registries) Description copied from class:SpecialFlowerBlockEntityWrites 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:
writeToPacketNBTin classSpecialFlowerBlockEntity
-
readFromPacketNBT
public void readFromPacketNBT(net.minecraft.nbt.CompoundTag cmp, net.minecraft.core.HolderLookup.Provider registries) Description copied from class:SpecialFlowerBlockEntityReads 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:
readFromPacketNBTin classSpecialFlowerBlockEntity
-
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()
-