Class ChunkUtils

java.lang.Object
software.bluelib.utils.minecraft.ChunkUtils

public class ChunkUtils extends Object
A class providing methods to interact with Minecraft chunks, specifically for retrieving biome and tile entity information.

Key Methods:

Since:
1.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.world.level.biome.Biome
    getBiomeOfChunk(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
    A Biome that retrieves the Biome of the specified chunk.
    static String
    getBiomeRegistryNameOfChunk(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
    A String that retrieves the biome registry name of the specified chunk.
    static String
    getBiomeSimpleNameOfChunk(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
    A String that retrieves the simple name of the biome in the specified chunk.
    static int
    getChunkBlockCount(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
    A Integer that counts the number of non-air blocks in the specified chunk.
    static Collection<net.minecraft.world.level.block.entity.BlockEntity>
    getChunkTileEntities(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
    A Collection<net.minecraft.world.level.block.entity.BlockEntity> that retrieves the tile entities within the specified chunk.
    static String
    getChunkTileEntitiesRegistryNames(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
    A String that retrieves the registry names of tile entities in the specified chunk.
    static String
    getChunkTileEntitiesSimpleNames(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
    A String that retrieves the simple names of tile entities in the specified chunk.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getBiomeOfChunk

      public static net.minecraft.world.level.biome.Biome getBiomeOfChunk(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
      A Biome that retrieves the Biome of the specified chunk.

      Logs a success message if the biome is retrieved successfully, and an error message if an exception occurs.

      Parameters:
      pLevel - Level - The game world level.
      pChunkPos - ChunkPos - The position of the chunk.
      Returns:
      The Biome associated with the specified chunk.
      Throws:
      RuntimeException - if there is an error retrieving the biome.
      Since:
      1.0.0
    • getBiomeRegistryNameOfChunk

      public static String getBiomeRegistryNameOfChunk(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
      A String that retrieves the biome registry name of the specified chunk.

      Example: "minecraft:plains", "minecraft:desert"

      Parameters:
      pLevel - Level - The game world level.
      pChunkPos - ChunkPos - The position of the chunk.
      Returns:
      The registry name of the chunk's biome as a String.
      Throws:
      RuntimeException - if there is an error retrieving the biome registry name.
      Since:
      1.0.0
    • getBiomeSimpleNameOfChunk

      public static String getBiomeSimpleNameOfChunk(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
      A String that retrieves the simple name of the biome in the specified chunk.

      Example: "plains", "desert"

      Parameters:
      pLevel - Level - The game world level.
      pChunkPos - ChunkPos - The position of the chunk.
      Returns:
      The simple name of the chunk's biome.
      Since:
      1.0.0
    • getChunkTileEntities

      public static Collection<net.minecraft.world.level.block.entity.BlockEntity> getChunkTileEntities(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
      A Collection<net.minecraft.world.level.block.entity.BlockEntity> that retrieves the tile entities within the specified chunk.

      Logs a success message with the number of tile entities retrieved, and an error message if an exception occurs.

      Parameters:
      pLevel - Level - The game world level.
      pChunkPos - ChunkPos - The position of the chunk.
      Returns:
      A collection of tile entities present in the specified chunk.
      Throws:
      RuntimeException - if there is an error retrieving tile entities.
      Since:
      1.0.0
    • getChunkTileEntitiesRegistryNames

      public static String getChunkTileEntitiesRegistryNames(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
      A String that retrieves the registry names of tile entities in the specified chunk.

      Example: "minecraft:chest, minecraft:furnace"

      Parameters:
      pLevel - Level - The game world level.
      pChunkPos - ChunkPos - The position of the chunk.
      Returns:
      A comma-separated string of tile entity registry names in the chunk.
      Throws:
      RuntimeException - if there is an error retrieving tile entity registry names.
      Since:
      1.0.0
    • getChunkTileEntitiesSimpleNames

      public static String getChunkTileEntitiesSimpleNames(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
      A String that retrieves the simple names of tile entities in the specified chunk.

      Example: "chest, furnace"

      Parameters:
      pLevel - Level - The game world level.
      pChunkPos - ChunkPos - The position of the chunk.
      Returns:
      A comma-separated string of tile entity simple names in the chunk.
      Since:
      1.0.0
    • getChunkBlockCount

      public static int getChunkBlockCount(net.minecraft.world.level.Level pLevel, net.minecraft.world.level.ChunkPos pChunkPos)
      A Integer that counts the number of non-air blocks in the specified chunk.

      Logs a success message with the block count, and an error message if an exception occurs.

      Parameters:
      pLevel - Level - The game world level.
      pChunkPos - ChunkPos - The position of the chunk.
      Returns:
      The number of non-air blocks in the specified chunk.
      Throws:
      RuntimeException - if there is an error counting blocks.
      Since:
      1.0.0