Class UBlockEntity

java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.world.level.block.entity.BlockEntity
info.u_team.u_team_core.blockentity.UBlockEntity
All Implemented Interfaces:
net.minecraftforge.common.capabilities.ICapabilityProvider, net.minecraftforge.common.capabilities.ICapabilityProviderImpl<net.minecraft.world.level.block.entity.BlockEntity>, net.minecraftforge.common.capabilities.ICapabilitySerializable<net.minecraft.nbt.CompoundTag>, net.minecraftforge.common.extensions.IForgeBlockEntity, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>

public abstract class UBlockEntity extends net.minecraft.world.level.block.entity.BlockEntity
Basic implementation of BlockEntity with some extra data synchronization methods.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraftforge.common.capabilities.CapabilityProvider

    net.minecraftforge.common.capabilities.CapabilityProvider.AsField<B extends net.minecraftforge.common.capabilities.ICapabilityProviderImpl<B>>
  • Field Summary

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

    level, remove, worldPosition

    Fields inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity

    INFINITE_EXTENT_AABB
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket
     
    net.minecraft.nbt.CompoundTag
     
    void
    handleChunkLoadData(net.minecraft.nbt.CompoundTag tag)
    The data from the chunk load is received here.
    void
    handleUpdateStateData(net.minecraft.nbt.CompoundTag tag)
    The data from the block update is received here.
    void
    handleUpdateTag(net.minecraft.nbt.CompoundTag tag)
     
    void
    load(net.minecraft.nbt.CompoundTag tag)
     
    void
    loadNBT(net.minecraft.nbt.CompoundTag tag)
    Reads data from disk.
    void
    onDataPacket(net.minecraft.network.Connection connection, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket packet)
     
    void
    saveAdditional(net.minecraft.nbt.CompoundTag tag)
     
    void
    saveNBT(net.minecraft.nbt.CompoundTag tag)
    Save data to disk.
    void
    Calls sendChangesToClient(int) with flag 2 (send changes to client)
    void
    Triggers a block update to send the data from the server to the client.
    void
    sendChunkLoadData(net.minecraft.nbt.CompoundTag tag)
    Data here will be send to the client side when the chunk is loaded.
    void
    sendUpdateStateData(net.minecraft.nbt.CompoundTag tag)
    Data here will be send to the client side when the block is updated.

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

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

    Methods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider

    areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCaps

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider

    getCapability, getCapability

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity

    deserializeNBT, getModelData, getRenderBoundingBox, onLoad, requestModelDataUpdate, serializeNBT
  • Constructor Details

    • UBlockEntity

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

    • saveAdditional

      public void saveAdditional(net.minecraft.nbt.CompoundTag tag)
      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
    • saveNBT

      public void saveNBT(net.minecraft.nbt.CompoundTag tag)
      Save data to disk. To mark the block entity to save data BlockEntity.setChanged() must be called.
      Parameters:
      tag -
    • loadNBT

      public void loadNBT(net.minecraft.nbt.CompoundTag tag)
      Reads data from disk.
      Parameters:
      tag -
    • getUpdateTag

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

      public void handleUpdateTag(net.minecraft.nbt.CompoundTag tag)
    • sendChunkLoadData

      public void sendChunkLoadData(net.minecraft.nbt.CompoundTag tag)
      Data here will be send to the client side when the chunk is loaded. The data is received in handleChunkLoadData(CompoundNBT)
      Parameters:
      tag -
    • handleChunkLoadData

      public void handleChunkLoadData(net.minecraft.nbt.CompoundTag tag)
      The data from the chunk load is received here. The data is send from sendChunkLoadData(CompoundNBT)
      Parameters:
      tag -
    • getUpdatePacket

      public net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket getUpdatePacket()
      Overrides:
      getUpdatePacket in class net.minecraft.world.level.block.entity.BlockEntity
    • onDataPacket

      public void onDataPacket(net.minecraft.network.Connection connection, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket packet)
    • sendUpdateStateData

      public void sendUpdateStateData(net.minecraft.nbt.CompoundTag tag)
      Data here will be send to the client side when the block is updated. The data is received in handleUpdateStateData(CompoundNBT). To trigger an update call Level.sendBlockUpdated(BlockPos, BlockState, BlockState, int) or sendChangesToClient(int)
      Parameters:
      tag -
    • handleUpdateStateData

      public void handleUpdateStateData(net.minecraft.nbt.CompoundTag tag)
      The data from the block update is received here. The data is send from sendUpdateStateData(CompoundNBT)
      Parameters:
      tag -
    • sendChangesToClient

      public void sendChangesToClient()
      Calls sendChangesToClient(int) with flag 2 (send changes to client)
    • sendChangesToClient

      public void sendChangesToClient(int flags)
      Triggers a block update to send the data from the server to the client. For flags see here: Level.setBlock(BlockPos, BlockState, int)
      Parameters:
      flags - Are described above