Class DeathChest


  • public final class DeathChest
    extends Object
    Represents a death chest.
    • Constructor Summary

      Constructors 
      Constructor Description
      DeathChest​(UUID identifier, net.minecraft.server.world.ServerWorld world, UUID playerUUID, List<net.minecraft.entity.ItemEntity> items, net.minecraft.entity.player.PlayerInventory inventory, long creationTime, net.minecraft.util.math.BlockPos pos, boolean isDoubleChest, boolean locked)
      Constructs a DeathChest with the specified properties.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      List<net.minecraft.entity.ItemEntity> cloneItems()
      Returns a cloned mutable list containing this death chest's items.
      boolean exists()
      Returns whether this death chest exists in the world.
      static DeathChest fromTag​(net.minecraft.server.world.ServerWorld world, net.minecraft.nbt.CompoundTag tag)
      Deserializes a death chest from a CompoundTag.
      long getCreationTime()
      Returns this death chest's creation time.
      UUID getIdentifier()
      Returns this death chest's identifier.
      net.minecraft.entity.player.PlayerInventory getInventory()
      Returns the player inventory at the time of death.
      List<net.minecraft.entity.ItemEntity> getItems()
      Returns a mutable list containing this death chest's items.
      UUID getPlayerUUID()
      Returns this death chest's player UUID.
      net.minecraft.util.math.BlockPos getPos()
      Returns this death chest's position.
      net.minecraft.server.world.ServerWorld getWorld()
      Returns this death chest's world.
      boolean isDoubleChest()
      Returns whether this death chest is a double chest.
      boolean isLocked()
      Returns whether this death chest is locked.
      boolean isProtectedFrom​(net.minecraft.entity.player.PlayerEntity player)
      Returns whether death chest protection prevents the specified player from opening this death chest.
      void setLocked​(boolean flag)
      Sets whether this death chest is locked.
      net.minecraft.nbt.CompoundTag toTag​(net.minecraft.nbt.CompoundTag tag)
      Serializes this death chest to a CompoundTag.
    • Constructor Detail

      • DeathChest

        public DeathChest​(UUID identifier,
                          net.minecraft.server.world.ServerWorld world,
                          UUID playerUUID,
                          List<net.minecraft.entity.ItemEntity> items,
                          net.minecraft.entity.player.PlayerInventory inventory,
                          long creationTime,
                          net.minecraft.util.math.BlockPos pos,
                          boolean isDoubleChest,
                          boolean locked)
        Constructs a DeathChest with the specified properties.
        Parameters:
        identifier - a UUID.
        world - a ServerWorld.
        playerUUID - a player UUID.
        items - the items.
        inventory - the player inventory at the time of death.
        creationTime - a creation time.
        pos - a position. If this is a double chest, this is the position of the west block.
        isDoubleChest - whether the chest is a double chest.
        locked - whether the chest is locked.
    • Method Detail

      • getIdentifier

        public UUID getIdentifier()
        Returns this death chest's identifier.
        Returns:
        a UUID.
      • getWorld

        public net.minecraft.server.world.ServerWorld getWorld()
        Returns this death chest's world.
        Returns:
        this death chest's world.
      • getPlayerUUID

        public UUID getPlayerUUID()
        Returns this death chest's player UUID.
        Returns:
        this death chest's player UUID.
      • getItems

        public List<net.minecraft.entity.ItemEntity> getItems()
        Returns a mutable list containing this death chest's items.
        Returns:
        a mutable list containing this death chest's items.
      • cloneItems

        public List<net.minecraft.entity.ItemEntity> cloneItems()
        Returns a cloned mutable list containing this death chest's items.
        Returns:
        a cloned mutable list containing this death chest's items.
      • getInventory

        public net.minecraft.entity.player.PlayerInventory getInventory()
        Returns the player inventory at the time of death.
        Returns:
        the PlayerInventory at the time of death.
      • getCreationTime

        public long getCreationTime()
        Returns this death chest's creation time.
        Returns:
        this death chest's creation time.
      • getPos

        public net.minecraft.util.math.BlockPos getPos()
        Returns this death chest's position. If this is a double chest, this is the position of the west block.
        Returns:
        this death chest's position.
      • isDoubleChest

        public boolean isDoubleChest()
        Returns whether this death chest is a double chest. This may be true even if one half of the double chest has been destroyed.
        Returns:
        true if this death chest is a double chest, or otherwise false.
      • isLocked

        public boolean isLocked()
        Returns whether this death chest is locked.
        Returns:
        true if this death chest is locked, or otherwise false.
      • setLocked

        public void setLocked​(boolean flag)
        Sets whether this death chest is locked.
        Parameters:
        flag - true if this death chest should be locked, or false if this death chest should be unlocked.
      • exists

        public boolean exists()
        Returns whether this death chest exists in the world.
        Returns:
        true if this death chest exists, or otherwise false.
      • isProtectedFrom

        public boolean isProtectedFrom​(net.minecraft.entity.player.PlayerEntity player)
        Returns whether death chest protection prevents the specified player from opening this death chest.
        Parameters:
        player - a player.
        Returns:
        true if this death chest is protected from the specified player, or otherwise false.
      • toTag

        public net.minecraft.nbt.CompoundTag toTag​(net.minecraft.nbt.CompoundTag tag)
        Serializes this death chest to a CompoundTag.
        Parameters:
        tag - a CompoundTag.
        Returns:
        the CompoundTag.
      • fromTag

        public static DeathChest fromTag​(net.minecraft.server.world.ServerWorld world,
                                         net.minecraft.nbt.CompoundTag tag)
        Deserializes a death chest from a CompoundTag.
        Parameters:
        world - a ServerWorld.
        tag - a CompoundTag.
        Returns:
        the deserialized DeathChest.