Class MugBlockEntity

java.lang.Object
net.minecraft.world.level.block.entity.BlockEntity
ml.pluto7073.pdapi.block.entity.MugBlockEntity
All Implemented Interfaces:
net.fabricmc.fabric.api.attachment.v1.AttachmentTarget, net.fabricmc.fabric.api.blockview.v2.RenderDataBlockEntity

public abstract class MugBlockEntity extends net.minecraft.world.level.block.entity.BlockEntity
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final List<DrinkAddition>
     
    protected double
     

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

    level, remove, worldPosition

    Fields inherited from interface net.fabricmc.fabric.api.attachment.v1.AttachmentTarget

    NBT_ATTACHMENT_KEY
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    @Nullable net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener>
     
    net.minecraft.nbt.CompoundTag
     
    void
    load(net.minecraft.nbt.CompoundTag tag)
     
    void
    loadFromItem(net.minecraft.world.item.ItemStack stack)
     
    protected void
    saveAdditional(net.minecraft.nbt.CompoundTag nbt)
     
    void
    saveAdditionalToItemTag(net.minecraft.nbt.CompoundTag itemTag)
    Adds nbt data to the item version of this Mug Block

    Note: Always call super.saveAdditionalToItemTag() or else Drink Additions won't be saved
    final net.minecraft.world.item.ItemStack
    Note: override saveAdditionalToItemTag(CompoundTag) to add data to the saved item

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

    addEntityType, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPosFromTag, getType, hasLevel, isRemoved, loadStatic, onlyOpCanSetNbt, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setLevel, setRemoved, triggerEvent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.fabricmc.fabric.api.attachment.v1.AttachmentTarget

    getAttached, getAttachedOrCreate, getAttachedOrCreate, getAttachedOrElse, getAttachedOrGet, getAttachedOrSet, getAttachedOrThrow, hasAttached, modifyAttached, removeAttached, setAttached

    Methods inherited from interface net.fabricmc.fabric.api.blockview.v2.RenderDataBlockEntity

    getRenderData
  • Field Details

    • additions

      protected final List<DrinkAddition> additions
    • sips

      protected double sips
  • Constructor Details

    • MugBlockEntity

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

    • getUpdatePacket

      @Nullable public @Nullable net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> getUpdatePacket()
      Overrides:
      getUpdatePacket in class net.minecraft.world.level.block.entity.BlockEntity
    • getUpdateTag

      public net.minecraft.nbt.CompoundTag getUpdateTag()
      Overrides:
      getUpdateTag in class net.minecraft.world.level.block.entity.BlockEntity
    • saveAdditional

      protected void saveAdditional(net.minecraft.nbt.CompoundTag nbt)
      Overrides:
      saveAdditional in class net.minecraft.world.level.block.entity.BlockEntity
    • load

      public void load(net.minecraft.nbt.CompoundTag tag)
      Overrides:
      load in class net.minecraft.world.level.block.entity.BlockEntity
    • loadFromItem

      public void loadFromItem(net.minecraft.world.item.ItemStack stack)
    • saveToItem

      public final net.minecraft.world.item.ItemStack saveToItem()
      Note: override saveAdditionalToItemTag(CompoundTag) to add data to the saved item
      Returns:
      A new instance of the corresponding itemStack
    • saveAdditionalToItemTag

      public void saveAdditionalToItemTag(net.minecraft.nbt.CompoundTag itemTag)
      Adds nbt data to the item version of this Mug Block

      Note: Always call super.saveAdditionalToItemTag() or else Drink Additions won't be saved
      Parameters:
      itemTag - The base tag of the item for any extra info, including the DrinkData tag