Class StructurePlacerAPI

java.lang.Object
me.emafire003.dev.structureplacerapi.StructurePlacerAPI

public class StructurePlacerAPI extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos)
    With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
    StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, float integrity)
    With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
    StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, net.minecraft.util.BlockMirror mirror)
    With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
    StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, net.minecraft.util.BlockMirror mirror, net.minecraft.util.BlockRotation rotation)
    With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
    StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, net.minecraft.util.BlockMirror mirror, net.minecraft.util.BlockRotation rotation, boolean ignoreEntities, float integrity, net.minecraft.util.math.BlockPos offset)
    With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
    StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, net.minecraft.util.BlockRotation rotation)
    With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
    StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, net.minecraft.util.math.BlockPos offset)
    With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.util.math.random.Random
    createRandom(long seed)
    This method creates a random seed for the integrity run-down effect.
    boolean
    loadAndRestoreStructure(int restore_ticks)
    Use this method to load the structure into the world and spawn it.
    boolean
    loadAndRestoreStructureAnimated(int restore_ticks, int blocks_per_tick, boolean random)
    Use this method to load the structure into the world and spawn it.
    boolean
    Use this method to load the structure into the world and place it.

    Methods inherited from class java.lang.Object

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

    • StructurePlacerAPI

      public StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, net.minecraft.util.BlockMirror mirror, net.minecraft.util.BlockRotation rotation, boolean ignoreEntities, float integrity, net.minecraft.util.math.BlockPos offset)
      With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
      Parameters:
      world - The StructureWorldAccess in which to place the structure
      templateName - The identifier of the structure to place, like new Identifier(MOD_ID, structure_name)
      blockPos - The position of the structure
      mirror - Use this to mirror the structure using BlockMirror.#
      rotation - Use this to rotate the structure using BlockRotation.#
      ignoreEntities - Set to true to block the spawning of entities saved in the structure file
      integrity - Set this to a value between 0f and 1f to remove some blocks from the placed structure. (All blocks = 1f)
      offset - Use this to offset the placing of the structure.
    • StructurePlacerAPI

      public StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos)
      With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
      Parameters:
      world - The StructureWorldAccess in which to place the structure
      templateName - The identifier of the structure to place, like new Identifier(MOD_ID, structure_name)
      blockPos - The position of the structure
    • StructurePlacerAPI

      public StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, net.minecraft.util.math.BlockPos offset)
      With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
      Parameters:
      world - The StructureWorldAccess in which to place the structure
      templateName - The identifier of the structure to place, like new Identifier(MOD_ID, structure_name)
      blockPos - The position of the structure
      offset - Use this to offset the placing of the structure.
    • StructurePlacerAPI

      public StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, net.minecraft.util.BlockMirror mirror)
      With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
      Parameters:
      world - The StructureWorldAccess in which to place the structure
      templateName - The identifier of the structure to place, like new Identifier(MOD_ID, structure_name)
      blockPos - The position of the structure
      mirror - Use this to mirror the structure using BlockMirror.#
    • StructurePlacerAPI

      public StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, net.minecraft.util.BlockRotation rotation)
      With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
      Parameters:
      world - The StructureWorldAccess in which to place the structure
      templateName - The identifier of the structure to place, like new Identifier(MOD_ID, structure_name)
      blockPos - The position of the structure
      rotation - Use this to rotate the structure using BlockRotation.#
    • StructurePlacerAPI

      public StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, net.minecraft.util.BlockMirror mirror, net.minecraft.util.BlockRotation rotation)
      With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
      Parameters:
      world - The StructureWorldAccess in which to place the structure
      templateName - The identifier of the structure to place, like new Identifier(MOD_ID, structure_name)
      blockPos - The position of the structure
      mirror - Use this to mirror the structure using BlockMirror.#
      rotation - Use this to rotate the structure using BlockRotation.#
    • StructurePlacerAPI

      public StructurePlacerAPI(net.minecraft.world.StructureWorldAccess world, net.minecraft.util.Identifier templateName, net.minecraft.util.math.BlockPos blockPos, float integrity)
      With this you can create placer object which will spawn a new structure from an nbt file located in /data/modid/structures
      Parameters:
      world - The StructureWorldAccess in which to place the structure
      templateName - The identifier of the structure to place, like new Identifier(MOD_ID, structure_name)
      blockPos - The position of the structure
      integrity - Set this to a value between 0f and 1f to remove some blocks from the placed structure. (All blocks = 1f)
  • Method Details

    • loadStructure

      public boolean loadStructure()
      Use this method to load the structure into the world and place it. You can check to see if the placing was successful.

      This method DOES NOT support regenerating the old terrain, use loadAndRestore() instead if you want to do it. This method however consumes less resources.

    • createRandom

      public static net.minecraft.util.math.random.Random createRandom(long seed)
      This method creates a random seed for the integrity run-down effect. No need to use it on your own, included during placement
    • loadAndRestoreStructure

      public boolean loadAndRestoreStructure(int restore_ticks)
      Use this method to load the structure into the world and spawn it. You can check to see if the placing was successful.

      It will also restore the blocks it replaced after restore_ticks Calling this function from the client only, will not regenerate the old terrain. And will probably cause other issues.

      Notice: Using this could lead to performance issues, especially with very large structures!

      Parameters:
      restore_ticks - Number of ticks (1 second = 20 ticks) after which the world would be restored.
    • loadAndRestoreStructureAnimated

      public boolean loadAndRestoreStructureAnimated(int restore_ticks, int blocks_per_tick, boolean random)
      Use this method to load the structure into the world and spawn it. You can check to see if the placing was successful.

      It will also restore the blocks it replaced after restore_ticks with an animation

      Calling this function from the client only will not regenerate the old terrain. And will probably cause other issues.

      Notice: Using this could lead to performance issues, especially with very large structures!

      Parameters:
      restore_ticks - Number of ticks (1 second = 20 ticks) after which the blocks will begin to be restored
      blocks_per_tick - How many blocks to restore per tick, the more, the faster the animation will go.
      random - Weather or not the blocks will be removed at random. If false, they will be removed from one corner to the other in sequence