Class StructureBuilder
java.lang.Object
net.glowstone.generator.structures.util.StructureBuilder
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionStructureBuilder
(org.bukkit.World world, GlowStructurePiece structure, StructureBoundingBox boundingBox, BlockStateDelegate delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRandomMaterial
(Map<StructureBuilder.StructureMaterial, Integer> materials, int weight, org.bukkit.Material type, int data) void
createMobSpawner
(org.bukkit.util.Vector pos, org.bukkit.entity.EntityType entityType) Sets the given block to a spawner for the given entity type.boolean
createRandomItemsContainer
(org.bukkit.util.Vector pos, Random random, RandomItemsContent content, org.bukkit.block.data.Directional container, int maxStacks) Sets the given block to a container and fills it with random items.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material type) Fills a box with the given block.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material type, int data) Fills a box with the given block.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, int outerData, org.bukkit.Material innerType) Builds a box from one block, and fills it with another.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, int outerData, org.bukkit.Material innerType, int innerData) Builds a box from one block, and fills it with another.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, int outerData, org.bukkit.Material innerType, org.bukkit.material.MaterialData innerData) Builds a box from one block, and fills it with another.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.Material innerType) Builds a box from one block, and fills it with another.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material type, org.bukkit.material.MaterialData data) Fills a box with the given block.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.material.MaterialData outerData, org.bukkit.Material innerType) Builds a box from one block, and fills it with another.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.material.MaterialData outerData, org.bukkit.Material innerType, int innerData) Builds a box from one block, and fills it with another.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.material.MaterialData outerData, org.bukkit.Material innerType, org.bukkit.material.MaterialData innerData) Builds a box from one block, and fills it with another.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.Material innerType, int innerData) Builds a box from one block, and fills it with another.void
fill
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.Material innerType, org.bukkit.material.MaterialData innerData) Builds a box from one block, and fills it with another.void
fillWithRandomMaterial
(org.bukkit.util.Vector min, org.bukkit.util.Vector max, Random random, Map<StructureBuilder.StructureMaterial, Integer> materials) Sets a box of blocks to have random types, chosen independently.org.bukkit.block.BlockState
getBlockState
(org.bukkit.util.Vector pos) getRandomMaterial
(Random random, Map<StructureBuilder.StructureMaterial, Integer> materials) Chooses a randomStructureBuilder.StructureMaterial
from a weighted list.void
setBlock
(org.bukkit.util.Vector pos, org.bukkit.Material type) Sets the block at a given point, if it is inside this structure's bounding box.void
setBlock
(org.bukkit.util.Vector pos, org.bukkit.Material type, int data) Sets the block at a given point, if it is inside this builder's bounding box.void
setBlock
(org.bukkit.util.Vector pos, org.bukkit.Material type, org.bukkit.material.MaterialData data) Sets the block at a given point, if it is inside this structure's bounding box.void
setBlockDownward
(org.bukkit.util.Vector pos, org.bukkit.Material type) Builds a 1x1 column out of the given block, replacing non-solid blocks starting at a given location and proceeding downward until a solid block is reached.void
setBlockDownward
(org.bukkit.util.Vector pos, org.bukkit.Material type, int data) Builds a 1x1 column out of the given block, replacing non-solid blocks starting at a given location and proceeding downward until a solid block is reached.void
setBlockDownward
(org.bukkit.util.Vector pos, org.bukkit.Material type, org.bukkit.material.MaterialData data) Builds a 1x1 column out of the given block, replacing non-solid blocks starting at a given location and proceeding downward until a solid block is reached.void
setBlockWithRandomMaterial
(org.bukkit.util.Vector pos, Random random, Map<StructureBuilder.StructureMaterial, Integer> materials) boolean
spawnMob
(org.bukkit.util.Vector pos, org.bukkit.entity.EntityType entityType) Spawns an entity if the given position is within this structure's bounding box.
-
Constructor Details
-
StructureBuilder
public StructureBuilder(org.bukkit.World world, GlowStructurePiece structure, StructureBoundingBox boundingBox, BlockStateDelegate delegate)
-
-
Method Details
-
addRandomMaterial
public void addRandomMaterial(Map<StructureBuilder.StructureMaterial, Integer> materials, int weight, org.bukkit.Material type, int data) -
getRandomMaterial
public StructureBuilder.StructureMaterial getRandomMaterial(Random random, Map<StructureBuilder.StructureMaterial, Integer> materials) Chooses a randomStructureBuilder.StructureMaterial
from a weighted list.- Parameters:
random
- the PRNG to usematerials
- a map of materials to integer weights- Returns:
- a random material
-
getBlockState
public org.bukkit.block.BlockState getBlockState(org.bukkit.util.Vector pos) -
setBlock
public void setBlock(org.bukkit.util.Vector pos, org.bukkit.Material type) Sets the block at a given point, if it is inside this structure's bounding box.- Parameters:
pos
- a point relative to this structure's root pointtype
- the new block type
-
setBlock
public void setBlock(org.bukkit.util.Vector pos, org.bukkit.Material type, int data) Sets the block at a given point, if it is inside this builder's bounding box.- Parameters:
pos
- a point relative to this structure's root pointtype
- the new block typedata
- the new block data
-
setBlock
public void setBlock(org.bukkit.util.Vector pos, org.bukkit.Material type, org.bukkit.material.MaterialData data) Sets the block at a given point, if it is inside this structure's bounding box.- Parameters:
pos
- a point relative to this structure's root pointtype
- the new block typedata
- the new block data
-
setBlockDownward
public void setBlockDownward(org.bukkit.util.Vector pos, org.bukkit.Material type) Builds a 1x1 column out of the given block, replacing non-solid blocks starting at a given location and proceeding downward until a solid block is reached.- Parameters:
pos
- the highest point to possibly replace, relative to this structure's root pointtype
- the block type to fill
-
setBlockDownward
public void setBlockDownward(org.bukkit.util.Vector pos, org.bukkit.Material type, int data) Builds a 1x1 column out of the given block, replacing non-solid blocks starting at a given location and proceeding downward until a solid block is reached.- Parameters:
pos
- the highest point to possibly replace, relative to this structure's root pointtype
- the block type to filldata
- the block data
-
setBlockDownward
public void setBlockDownward(org.bukkit.util.Vector pos, org.bukkit.Material type, org.bukkit.material.MaterialData data) Builds a 1x1 column out of the given block, replacing non-solid blocks starting at a given location and proceeding downward until a solid block is reached.- Parameters:
pos
- the highest point to possibly replace, relative to this structure's root pointtype
- the block type to filldata
- the block data
-
setBlockWithRandomMaterial
public void setBlockWithRandomMaterial(org.bukkit.util.Vector pos, Random random, Map<StructureBuilder.StructureMaterial, Integer> materials) -
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material type) Fills a box with the given block.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointtype
- the block type
-
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material type, int data) Fills a box with the given block.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointtype
- the block typedata
- the block data
-
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material type, org.bukkit.material.MaterialData data) Fills a box with the given block.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointtype
- the block typedata
- the block data
-
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.Material innerType) Builds a box from one block, and fills it with another.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointouterType
- the block type for the facesinnerType
- the block type for the interior
-
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.Material innerType, int innerData) Builds a box from one block, and fills it with another.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointouterType
- the block type for the facesinnerType
- the block type for the interiorinnerData
- the block data for the interior
-
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.Material innerType, org.bukkit.material.MaterialData innerData) Builds a box from one block, and fills it with another.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointouterType
- the block type for the facesinnerType
- the block type for the interiorinnerData
- the block data for the interior
-
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, int outerData, org.bukkit.Material innerType, org.bukkit.material.MaterialData innerData) Builds a box from one block, and fills it with another.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointouterType
- the block type for the facesouterData
- the block data for the facesinnerType
- the block type for the interiorinnerData
- the block data for the interior
-
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, int outerData, org.bukkit.Material innerType) Builds a box from one block, and fills it with another.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointouterType
- the block type for the facesouterData
- the block data for the facesinnerType
- the block type for the interior
-
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.material.MaterialData outerData, org.bukkit.Material innerType) Builds a box from one block, and fills it with another.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointouterType
- the block type for the facesouterData
- the block data for the facesinnerType
- the block type for the interior
-
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.material.MaterialData outerData, org.bukkit.Material innerType, int innerData) Builds a box from one block, and fills it with another.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointouterType
- the block type for the facesouterData
- the block data for the facesinnerType
- the block type for the interiorinnerData
- the block data for the interior
-
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, int outerData, org.bukkit.Material innerType, int innerData) Builds a box from one block, and fills it with another.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointouterType
- the block type for the facesouterData
- the block data for the facesinnerType
- the block type for the interiorinnerData
- the block data for the interior
-
fill
public void fill(org.bukkit.util.Vector min, org.bukkit.util.Vector max, org.bukkit.Material outerType, org.bukkit.material.MaterialData outerData, org.bukkit.Material innerType, org.bukkit.material.MaterialData innerData) Builds a box from one block, and fills it with another.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointouterType
- the block type for the facesouterData
- the block data for the facesinnerType
- the block type for the interiorinnerData
- the block data for the interior
-
fillWithRandomMaterial
public void fillWithRandomMaterial(org.bukkit.util.Vector min, org.bukkit.util.Vector max, Random random, Map<StructureBuilder.StructureMaterial, Integer> materials) Sets a box of blocks to have random types, chosen independently.- Parameters:
min
- the minimum coordinates, relative to this structure's root pointmax
- the maximum coordinates, relative to this structure's root pointrandom
- the PRNG to usematerials
- a map of possible blocks to integer weights
-
createRandomItemsContainer
public boolean createRandomItemsContainer(org.bukkit.util.Vector pos, Random random, RandomItemsContent content, org.bukkit.block.data.Directional container, int maxStacks) Sets the given block to a container and fills it with random items.- Parameters:
pos
- a point relative to this structure's root pointrandom
- the PRNG to usecontent
- the distribution to draw items fromcontainer
- the container to placemaxStacks
- the maximum number of slots to fill- Returns:
- true if the container was placed and filled; false if
pos
is outside the builder's bounding box orRandomItemsContent.fillContainer(Random, BlockState, int)
fails
-
createMobSpawner
public void createMobSpawner(org.bukkit.util.Vector pos, org.bukkit.entity.EntityType entityType) Sets the given block to a spawner for the given entity type.- Parameters:
pos
- a point relative to this structure's root pointentityType
- the type of entity the spawner will spawn
-
spawnMob
public boolean spawnMob(org.bukkit.util.Vector pos, org.bukkit.entity.EntityType entityType) Spawns an entity if the given position is within this structure's bounding box.- Parameters:
pos
- a point relative to this structure's root pointentityType
- the type of entity to spawn- Returns:
- true if the entity was spawned; false if
pos
is outside the builder's bounding box orWorld.spawnEntity(Location, EntityType)
fails
-