Class StructurePlacerAPI
java.lang.Object
me.emafire003.dev.structureplacerapi.StructurePlacerAPI
-
Constructor Summary
ConstructorsConstructorDescriptionStructurePlacerAPI(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/structuresStructurePlacerAPI(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/structuresStructurePlacerAPI(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/structuresStructurePlacerAPI(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/structuresStructurePlacerAPI(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/structuresStructurePlacerAPI(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/structuresStructurePlacerAPI(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 TypeMethodDescriptionstatic net.minecraft.util.math.random.RandomcreateRandom(long seed) This method creates a random seed for the integrity run-down effect.booleanloadAndRestoreStructure(int restore_ticks) Use this method to load the structure into the world and spawn it.booleanloadAndRestoreStructureAnimated(int restore_ticks, int blocks_per_tick, boolean random) Use this method to load the structure into the world and spawn it.booleanUse this method to load the structure into the world and place it.
-
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 structuretemplateName- The identifier of the structure to place, likenew Identifier(MOD_ID, structure_name)blockPos- The position of the structuremirror- Use this to mirror the structure usingBlockMirror.#rotation- Use this to rotate the structure usingBlockRotation.#ignoreEntities- Set to true to block the spawning of entities saved in the structure fileintegrity- 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 structuretemplateName- The identifier of the structure to place, likenew 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 structuretemplateName- The identifier of the structure to place, likenew Identifier(MOD_ID, structure_name)blockPos- The position of the structureoffset- 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 structuretemplateName- The identifier of the structure to place, likenew Identifier(MOD_ID, structure_name)blockPos- The position of the structuremirror- Use this to mirror the structure usingBlockMirror.#
-
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 structuretemplateName- The identifier of the structure to place, likenew Identifier(MOD_ID, structure_name)blockPos- The position of the structurerotation- Use this to rotate the structure usingBlockRotation.#
-
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 structuretemplateName- The identifier of the structure to place, likenew Identifier(MOD_ID, structure_name)blockPos- The position of the structuremirror- Use this to mirror the structure usingBlockMirror.#rotation- Use this to rotate the structure usingBlockRotation.#
-
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 structuretemplateName- The identifier of the structure to place, likenew Identifier(MOD_ID, structure_name)blockPos- The position of the structureintegrity- 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 restoredblocks_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
-