Module gomint.api

Interface Chunk


  • public interface Chunk
    Version:
    1.0
    Author:
    geNAZt, BlackyPaw
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Biome getBiome​(int x, int z)
      Gets a block column's biome.
      <T extends Block>
      T
      getBlockAt​(int x, int y, int z)
      Gets the block at the specified position.
      <T extends Block>
      T
      getBlockAt​(int x, int y, int z, WorldLayer layer)
      Gets the block at the specified position.
      int getX()
      X coordinate of the chunk
      int getZ()
      Z coordinate of the chunk
      <T extends Entity>
      void
      iterateEntities​(Class<T> entityClass, Consumer<T> entityConsumer)
      Iterate over all entities in this chunk and run entityConsumer on every correct one.
      void setBiome​(int x, int z, Biome biome)
      Sets a block column's biome.
      void setBlock​(int x, int y, int z, Block block)
      Set the block at the position to the one given in this method call.
      void setBlock​(int x, int y, int z, WorldLayer layer, Block block)
      Set the block at the position to the one given in this method call.
    • Method Detail

      • getX

        int getX()
        X coordinate of the chunk
        Returns:
        x coordinate of the chunk
      • getZ

        int getZ()
        Z coordinate of the chunk
        Returns:
        z coordinate of the chunk
      • getBlockAt

        <T extends Block> T getBlockAt​(int x,
                                       int y,
                                       int z)
        Gets the block at the specified position.
        Parameters:
        x - The x-coordinate of the block
        y - The y-coordinate of the block
        z - The z-coordinate of the block
        Returns:
        The block itself or null if the given coordinates lie not within this chunk
      • getBlockAt

        <T extends Block> T getBlockAt​(int x,
                                       int y,
                                       int z,
                                       WorldLayer layer)
        Gets the block at the specified position.
        Parameters:
        x - The x-coordinate of the block
        y - The y-coordinate of the block
        z - The z-coordinate of the block
        layer - on which the block is
        Returns:
        The block itself or null if the given coordinates lie not within this chunk
      • iterateEntities

        <T extends Entity> void iterateEntities​(Class<T> entityClass,
                                                Consumer<T> entityConsumer)
        Iterate over all entities in this chunk and run entityConsumer on every correct one.
        Type Parameters:
        T - type of entity
        Parameters:
        entityClass - for which we search
        entityConsumer - which gets called for every found entity
      • setBlock

        void setBlock​(int x,
                      int y,
                      int z,
                      Block block)
        Set the block at the position to the one given in this method call. Please only use this in ChunkGenerator instances.
        Parameters:
        x - coordinate in the chunk (0-15) of the block to replace
        y - coordinate in the chunk (0-255) of the block to replace
        z - coordinate in the chunk (0-15) of the block to replace
        block - which should be used to replace selected block
      • setBlock

        void setBlock​(int x,
                      int y,
                      int z,
                      WorldLayer layer,
                      Block block)
        Set the block at the position to the one given in this method call. Please only use this in ChunkGenerator instances.
        Parameters:
        x - coordinate in the chunk (0-15) of the block to replace
        y - coordinate in the chunk (0-255) of the block to replace
        z - coordinate in the chunk (0-15) of the block to replace
        layer - on which the block should be placed
        block - which should be used to replace selected block
      • setBiome

        void setBiome​(int x,
                      int z,
                      Biome biome)
        Sets a block column's biome.
        Parameters:
        x - The x-coordinate of the block column
        z - The z-coordinate of the block column
        biome - The biome to set
      • getBiome

        Biome getBiome​(int x,
                       int z)
        Gets a block column's biome.
        Parameters:
        x - The x-coordinate of the block column
        z - The z-coordinate of the block column
        Returns:
        The block column's biome