Class TileEntityColonyBuilding

java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
All Implemented Interfaces:
com.ldtteam.domumornamentum.entity.block.IMateriallyTexturedBlockEntity, com.ldtteam.structurize.blockentities.interfaces.IBlueprintDataProviderBE, ITickable, IItemHandlerCapProvider, net.minecraft.world.Clearable, net.minecraft.world.inventory.MenuConstructor, net.minecraft.world.MenuProvider, net.neoforged.neoforge.attachment.IAttachmentHolder, net.neoforged.neoforge.client.extensions.IMenuProviderExtension, net.neoforged.neoforge.common.extensions.IBlockEntityExtension
Direct Known Subclasses:
AbstractTileEntityWareHouse, TileEntityEnchanter, TileEntityStash

public class TileEntityColonyBuilding extends AbstractTileEntityColonyBuilding implements ITickable
Class which handles the tileEntity of our colonyBuildings.
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.minecolonies.api.tileentities.AbstractTileEntityRack

    AbstractTileEntityRack.RackInventory

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

    net.minecraft.world.level.block.entity.BlockEntity.DataComponentInput

    Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    net.neoforged.neoforge.attachment.AttachmentHolder.AsField
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    net.minecraft.resources.ResourceLocation
    The name of the building location.

    Fields inherited from class com.minecolonies.api.tileentities.AbstractTileEntityRack

    buildingPos, inventory, inWarehouse

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

    level, remove, worldPosition

    Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    ATTACHMENTS_NBT_KEY

    Fields inherited from interface com.ldtteam.structurize.blockentities.interfaces.IBlueprintDataProviderBE

    TAG_BLUEPRINTDATA, TAG_CORNER_ONE, TAG_CORNER_TWO, TAG_POS_TAG_MAP, TAG_SCHEMATIC_NAME, TAG_TAG_NAME, TAG_TAG_NAME_LIST, TAG_TAG_POS
  • Constructor Summary

    Constructors
    Constructor
    Description
    TileEntityColonyBuilding(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    Default constructor used to create a new TileEntity via reflection.
    TileEntityColonyBuilding(net.minecraft.world.level.block.entity.BlockEntityType<? extends AbstractTileEntityColonyBuilding> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    Alternative overriden constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable net.minecraft.world.inventory.AbstractContainerMenu
    createMenu(int id, @NotNull net.minecraft.world.entity.player.Inventory inv, @NotNull net.minecraft.world.entity.player.Player player)
     
    Get the blueprint path of the tileEntity.
    Returns the building associated with the tile entity.
    net.minecraft.resources.ResourceLocation
    Get the building name that this AbstractTileEntityColonyBuilding belongs to.
    Returns the view of the building associated with the tile entity.
    Returns the colony of the tile entity.
    int
    Returns the colony ID.
    @NotNull net.minecraft.network.chat.Component
     
    net.neoforged.neoforge.items.IItemHandler
    getItemHandlerCap(net.minecraft.core.Direction side)
     
     
    net.minecraft.core.BlockPos
    Returns the position of the tile entity.
    @Nullable net.minecraft.core.BlockPos
    getPositionOfChestWithItemStack(@NotNull Predicate<net.minecraft.world.item.ItemStack> itemStackSelectionPredicate)
    Check for a certain item and return the position of the chest containing it.
    com.ldtteam.structurize.api.RotationMirror
     
    com.ldtteam.structurize.storage.StructurePackMeta
    Getter for the style.
    net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket
     
    @NotNull net.minecraft.nbt.CompoundTag
    getUpdateTag(net.minecraft.core.HolderLookup.Provider provider)
     
    void
    handleUpdateTag(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider)
     
    boolean
    hasAccessPermission(net.minecraft.world.entity.player.Player player)
    Checks if the player has permission to access the hut.
    boolean
    isUsableByPlayer(@NotNull net.minecraft.world.entity.player.Player player)
     
    void
    loadAdditional(@NotNull net.minecraft.nbt.CompoundTag compound, net.minecraft.core.HolderLookup.Provider provider)
     
    void
    onDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket packet, net.minecraft.core.HolderLookup.Provider provider)
     
    void
     
    void
    Reactivate the hut of this tileEntity.
    void
    saveAdditional(@NotNull net.minecraft.nbt.CompoundTag compound, net.minecraft.core.HolderLookup.Provider provider)
     
    void
    Set the blueprint path of the tileEntity.
    void
    Sets the building associated with the tile entity.
    void
     
    void
    Sets the colony of the tile entity.
    void
    setPackName(String packName)
     
    void
    setRotationMirror(com.ldtteam.structurize.api.RotationMirror rotationMirror)
     
    void
    setStructurePack(com.ldtteam.structurize.storage.StructurePackMeta style)
    Set the style of the tileEntity.
    void
    Default parameterless ticking implementation.
    void
    Update the blockState of the rack.
    void
    writeColonyToItemStack(net.minecraft.world.item.ItemStack stack)
    Write the colony id to the itemstack.

    Methods inherited from class com.minecolonies.api.tileentities.AbstractTileEntityRack

    getInventory, setBuildingPos, updateWarehouseIfAvailable

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

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

    Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    deserializeAttachments, getData, getExistingData, hasAttachments, hasData, serializeAttachments

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder

    getData, getExistingData, hasData, removeData, setData

    Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension

    hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, requestModelDataUpdate

    Methods inherited from interface com.ldtteam.structurize.blockentities.interfaces.IBlueprintDataProviderBE

    addTag, getInWorldCorners, getRealWorldPos, getWorldTagPosMap, removeTag, writeSchematicDataToNBT

    Methods inherited from interface com.minecolonies.api.util.IItemHandlerCapProvider

    getItemHandlerCap, getItemHandlerCap

    Methods inherited from interface net.neoforged.neoforge.client.extensions.IMenuProviderExtension

    shouldTriggerClientSideContainerClosingOnOpen

    Methods inherited from interface com.minecolonies.api.tileentities.ITickable

    tick
  • Field Details

    • registryName

      public net.minecraft.resources.ResourceLocation registryName
      The name of the building location.
  • Constructor Details

    • TileEntityColonyBuilding

      public TileEntityColonyBuilding(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
      Default constructor used to create a new TileEntity via reflection. Do not use.
    • TileEntityColonyBuilding

      public TileEntityColonyBuilding(net.minecraft.world.level.block.entity.BlockEntityType<? extends AbstractTileEntityColonyBuilding> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
      Alternative overriden constructor.
      Parameters:
      type - the entity type.
  • Method Details

    • getColonyId

      public int getColonyId()
      Returns the colony ID.
      Specified by:
      getColonyId in class AbstractTileEntityColonyBuilding
      Returns:
      ID of the colony.
    • getColony

      public IColony getColony()
      Returns the colony of the tile entity.
      Specified by:
      getColony in class AbstractTileEntityColonyBuilding
      Returns:
      Colony of the tile entity.
    • getPosition

      public net.minecraft.core.BlockPos getPosition()
      Returns the position of the tile entity.
      Specified by:
      getPosition in class AbstractTileEntityColonyBuilding
      Returns:
      Block Coordinates of the tile entity.
    • getPositionOfChestWithItemStack

      @Nullable public @Nullable net.minecraft.core.BlockPos getPositionOfChestWithItemStack(@NotNull @NotNull Predicate<net.minecraft.world.item.ItemStack> itemStackSelectionPredicate)
      Check for a certain item and return the position of the chest containing it.
      Specified by:
      getPositionOfChestWithItemStack in class AbstractTileEntityColonyBuilding
      Parameters:
      itemStackSelectionPredicate - the stack to search for.
      Returns:
      the position or null.
    • setColony

      public void setColony(IColony c)
      Sets the colony of the tile entity.
      Specified by:
      setColony in class AbstractTileEntityColonyBuilding
      Parameters:
      c - Colony to set in references.
    • setChanged

      public void setChanged()
      Overrides:
      setChanged in class TileEntityRack
    • getUpdatePacket

      public net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket getUpdatePacket()
      Specified by:
      getUpdatePacket in interface com.ldtteam.structurize.blockentities.interfaces.IBlueprintDataProviderBE
      Overrides:
      getUpdatePacket in class TileEntityRack
    • getUpdateTag

      @NotNull public @NotNull net.minecraft.nbt.CompoundTag getUpdateTag(@NotNull net.minecraft.core.HolderLookup.Provider provider)
      Overrides:
      getUpdateTag in class TileEntityRack
    • handleUpdateTag

      public void handleUpdateTag(net.minecraft.nbt.CompoundTag tag, @NotNull net.minecraft.core.HolderLookup.Provider provider)
      Specified by:
      handleUpdateTag in interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
      Overrides:
      handleUpdateTag in class TileEntityRack
    • onDataPacket

      public void onDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket packet, @NotNull net.minecraft.core.HolderLookup.Provider provider)
      Specified by:
      onDataPacket in interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
      Overrides:
      onDataPacket in class TileEntityRack
    • onLoad

      public void onLoad()
      Specified by:
      onLoad in interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
    • getBuilding

      public IBuilding getBuilding()
      Returns the building associated with the tile entity.
      Specified by:
      getBuilding in class AbstractTileEntityColonyBuilding
      Returns:
      IBuildingContainer associated with the tile entity.
    • setBuilding

      public void setBuilding(IBuilding b)
      Sets the building associated with the tile entity.
      Specified by:
      setBuilding in class AbstractTileEntityColonyBuilding
      Parameters:
      b - IBuilding to associate with the tile entity.
    • getDisplayName

      @NotNull public @NotNull net.minecraft.network.chat.Component getDisplayName()
      Specified by:
      getDisplayName in interface net.minecraft.world.MenuProvider
      Overrides:
      getDisplayName in class TileEntityRack
    • getBuildingView

      public IBuildingView getBuildingView()
      Returns the view of the building associated with the tile entity.
      Specified by:
      getBuildingView in class AbstractTileEntityColonyBuilding
      Returns:
      IBuildingView the tile entity is associated with.
    • loadAdditional

      public void loadAdditional(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound, @NotNull net.minecraft.core.HolderLookup.Provider provider)
      Overrides:
      loadAdditional in class AbstractTileEntityColonyBuilding
    • saveAdditional

      public void saveAdditional(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound, @NotNull net.minecraft.core.HolderLookup.Provider provider)
      Overrides:
      saveAdditional in class AbstractTileEntityColonyBuilding
    • tick

      public void tick()
      Description copied from interface: ITickable
      Default parameterless ticking implementation.
      Specified by:
      tick in interface ITickable
    • isUsableByPlayer

      public boolean isUsableByPlayer(@NotNull @NotNull net.minecraft.world.entity.player.Player player)
    • hasAccessPermission

      public boolean hasAccessPermission(net.minecraft.world.entity.player.Player player)
      Checks if the player has permission to access the hut.
      Specified by:
      hasAccessPermission in class AbstractTileEntityColonyBuilding
      Parameters:
      player - Player to check permission of.
      Returns:
      True when player has access, or building doesn't exist, otherwise false.
    • setRotationMirror

      public void setRotationMirror(com.ldtteam.structurize.api.RotationMirror rotationMirror)
      Specified by:
      setRotationMirror in class AbstractTileEntityColonyBuilding
      Parameters:
      rotationMirror - rotation and mirror of the entity.
    • getRotationMirror

      public com.ldtteam.structurize.api.RotationMirror getRotationMirror()
      Specified by:
      getRotationMirror in class AbstractTileEntityColonyBuilding
      Returns:
      rotation and mirror of the entity.
    • getStructurePack

      public com.ldtteam.structurize.storage.StructurePackMeta getStructurePack()
      Getter for the style.
      Specified by:
      getStructurePack in class AbstractTileEntityColonyBuilding
      Returns:
      the string of it.
    • setStructurePack

      public void setStructurePack(com.ldtteam.structurize.storage.StructurePackMeta style)
      Set the style of the tileEntity.
      Specified by:
      setStructurePack in class AbstractTileEntityColonyBuilding
      Parameters:
      style - the style to set.
    • setBlueprintPath

      public void setBlueprintPath(String path)
      Description copied from class: AbstractTileEntityColonyBuilding
      Set the blueprint path of the tileEntity.
      Specified by:
      setBlueprintPath in interface com.ldtteam.structurize.blockentities.interfaces.IBlueprintDataProviderBE
      Specified by:
      setBlueprintPath in class AbstractTileEntityColonyBuilding
      Parameters:
      path - the path to set.
    • setPackName

      public void setPackName(String packName)
      Specified by:
      setPackName in interface com.ldtteam.structurize.blockentities.interfaces.IBlueprintDataProviderBE
    • getPackName

      public String getPackName()
      Specified by:
      getPackName in interface com.ldtteam.structurize.blockentities.interfaces.IBlueprintDataProviderBE
    • getBlueprintPath

      public String getBlueprintPath()
      Description copied from class: AbstractTileEntityColonyBuilding
      Get the blueprint path of the tileEntity.
      Specified by:
      getBlueprintPath in interface com.ldtteam.structurize.blockentities.interfaces.IBlueprintDataProviderBE
      Specified by:
      getBlueprintPath in class AbstractTileEntityColonyBuilding
      Returns:
      path the path to get.
    • getBuildingName

      public net.minecraft.resources.ResourceLocation getBuildingName()
      Description copied from class: AbstractTileEntityColonyBuilding
      Get the building name that this AbstractTileEntityColonyBuilding belongs to.
      Specified by:
      getBuildingName in class AbstractTileEntityColonyBuilding
      Returns:
      The buildings name.
    • updateBlockState

      public void updateBlockState()
      Description copied from class: AbstractTileEntityRack
      Update the blockState of the rack. Switch between connected, single, full and empty texture.
      Overrides:
      updateBlockState in class TileEntityRack
    • getItemHandlerCap

      public net.neoforged.neoforge.items.IItemHandler getItemHandlerCap(net.minecraft.core.Direction side)
      Specified by:
      getItemHandlerCap in interface IItemHandlerCapProvider
      Overrides:
      getItemHandlerCap in class TileEntityRack
      Returns:
      direction-aware itemHandler
    • createMenu

      @Nullable public @Nullable net.minecraft.world.inventory.AbstractContainerMenu createMenu(int id, @NotNull @NotNull net.minecraft.world.entity.player.Inventory inv, @NotNull @NotNull net.minecraft.world.entity.player.Player player)
      Specified by:
      createMenu in interface net.minecraft.world.inventory.MenuConstructor
      Overrides:
      createMenu in class TileEntityRack
    • reactivate

      public void reactivate()
      Reactivate the hut of this tileEntity. Load the schematic data and set the style correctly.
    • writeColonyToItemStack

      public void writeColonyToItemStack(net.minecraft.world.item.ItemStack stack)
      Write the colony id to the itemstack.
      Parameters:
      stack - the stack to write it to.