本文整理匯總了Java中net.minecraft.world.gen.structure.StructureBoundingBox類的典型用法代碼示例。如果您正苦於以下問題:Java StructureBoundingBox類的具體用法?Java StructureBoundingBox怎麽用?Java StructureBoundingBox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StructureBoundingBox類屬於net.minecraft.world.gen.structure包,在下文中一共展示了StructureBoundingBox類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generatePotentialRooms
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
/**
* Generates a stores potential room positions off of the current template. Note: this does not take into account existing rooms. Check for existing rooms when spawning each specific room position.
* @param currentTemplate
*/
private List<DungeonRoomPosition> generatePotentialRooms(TemplateManager manager, World world, Template currentTemplate, Rotation currentTemplateRotation, BlockPos currentCenter, Rotation currentSide)
{
List<DungeonRoomPosition> list = Lists.newArrayList();
//Rotation side = Rotation.values()[(int) (Math.random() * 4)];
for (Rotation side : Rotation.values())
{
Template nextTemplate = DungeonHelper.getRandomizedDungeonTemplate(manager, world);
Rotation nextTemplateRotation = Rotation.values()[(int) (Math.random() * 4)];
BlockPos centeredPosition = DungeonHelper.translateToNextRoom(currentTemplate, nextTemplate, currentCenter, side, currentTemplateRotation, nextTemplateRotation);
StructureBoundingBox boundingBox = DungeonHelper.getStructureBoundingBox(nextTemplate, nextTemplateRotation, centeredPosition);
if (currentSide == null || (currentSide != null && currentSide.add(Rotation.CLOCKWISE_180) != side)) // check to make sure we aren't spawning a room on the side we just spawned from.
{
list.add(new DungeonRoomPosition(centeredPosition, nextTemplate, nextTemplateRotation, side, boundingBox));
}
}
return list;
}
示例2: addComponentParts
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
/**
* second Part of Structure generating, this for example places Spiderwebs,
* Mob Spawners, it closes Mineshafts at the end, it adds Fences...
*/
@Override
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
final Block var4 = this.getBiomeSpecificBlock(Blocks.planks, 0);
for (int var5 = this.boundingBox.minX; var5 <= this.boundingBox.maxX; ++var5)
{
for (int var6 = this.boundingBox.minZ; var6 <= this.boundingBox.maxZ; ++var6)
{
if (par3StructureBoundingBox.isVecInside(var5, 64, var6) && (par1World.getBlock(var5, par1World.getTopSolidOrLiquidBlock(var5, var6) - 1, var6) == GCBlocks.blockMoon && par1World.getBlockMetadata(var5, par1World.getTopSolidOrLiquidBlock(var5, var6) - 1, var6) == 5 || Blocks.air == par1World.getBlock(var5, par1World.getTopSolidOrLiquidBlock(var5, var6) - 1, var6)))
{
final int var7 = par1World.getTopSolidOrLiquidBlock(var5, var6) - 1;
par1World.setBlock(var5, var7, var6, var4, 1, 3);
}
}
}
return true;
}
示例3: getComponentToAddBoundingBox
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
public static StructureBoundingBox getComponentToAddBoundingBox(int x, int y, int z, int lengthOffset, int heightOffset, int widthOffset, int length, int height, int width, int coordBaseMode)
{
switch (coordBaseMode)
{
case 0:
return new StructureBoundingBox(x + lengthOffset, y + heightOffset, z + widthOffset, x + length + lengthOffset, y + height + heightOffset, z + width + widthOffset);
case 1:
return new StructureBoundingBox(x - width + widthOffset, y + heightOffset, z + lengthOffset, x + widthOffset, y + height + heightOffset, z + length + lengthOffset);
case 2:
return new StructureBoundingBox(x - length - lengthOffset, y + heightOffset, z - width - widthOffset, x - lengthOffset, y + height + heightOffset, z - widthOffset);
case 3:
return new StructureBoundingBox(x + widthOffset, y + heightOffset, z - length, x + width + widthOffset, y + height + heightOffset, z + lengthOffset);
default:
return new StructureBoundingBox(x + lengthOffset, y + heightOffset, z + widthOffset, x + length + lengthOffset, y + height + heightOffset, z + width + widthOffset);
}
}
示例4: placeSpawnerAtCurrentPosition
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
protected void placeSpawnerAtCurrentPosition(World var1, Random var2, int var3, int var4, int var5, String var6, StructureBoundingBox var7)
{
final int var8 = this.getXWithOffset(var3, var5);
final int var9 = this.getYWithOffset(var4);
final int var10 = this.getZWithOffset(var3, var5);
if (var7.isVecInside(var8, var9, var10) && var1.getBlock(var8, var9, var10) != Blocks.mob_spawner)
{
var1.setBlock(var8, var9, var10, Blocks.mob_spawner, 0, 3);
final TileEntityMobSpawner var11 = (TileEntityMobSpawner) var1.getTileEntity(var8, var9, var10);
if (var11 != null)
{
var11.func_145881_a().setEntityName(var6);
}
}
}
示例5: getComponentToAddBoundingBox
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
public static StructureBoundingBox getComponentToAddBoundingBox(int var0, int var1, int var2, int var3, int var4, int var5, int var6, int var7, int var8, int var9)
{
switch (var9)
{
case 0:
return new StructureBoundingBox(var0 + var3, var1 + var4, var2 + var5, var0 + var6 + var3, var1 + var7 + var4, var2 + var8 + var5);
case 1:
return new StructureBoundingBox(var0 - var8 + var5, var1 + var4, var2 + var3, var0 + var5, var1 + var7 + var4, var2 + var6 + var3);
case 2:
return new StructureBoundingBox(var0 - var6 - var3, var1 + var4, var2 - var8 - var5, var0 - var3, var1 + var7 + var4, var2 - var5);
case 3:
return new StructureBoundingBox(var0 + var5, var1 + var4, var2 - var6, var0 + var8 + var5, var1 + var7 + var4, var2 + var3);
default:
return new StructureBoundingBox(var0 + var3, var1 + var4, var2 + var5, var0 + var6 + var3, var1 + var7 + var4, var2 + var8 + var5);
}
}
示例6: addComponentParts
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
@Override
public boolean addComponentParts(World world, Random random, StructureBoundingBox boundingBox) {
this.fillWithAir(world, boundingBox, 0, 0, 0, 15, 150, 15);
world.setBlock(0, 0, 0, AntiMatterModRegistry.explosionTestBlock);
int X = 0, Y = 2 << 4, Z = 0, R = 5 << 4;
Y:for (int y = Y - R; y <= Y; y++) {
for (int x = X - R; x <= X + R; x++) {
for (int z = Z - R; z <= Z + R; z++) {
if (y <= 0) break Y;
double dis = ((X - x) * (X - x) + ((Z - z) * (Z - z)) + ((Y - y) * (Y - y)));
if (dis < R * R && y > 0) {
world.setBlock(x, y, z, Blocks.air, 0, 2);
}
}
}
}
return true;
}
示例7: getNextComponentVillagePath
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
private static StructureComponent getNextComponentVillagePath(VillageStructureComponentStartPiece par0ComponentVillageStartPiece, List<StructureComponent> par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) {
if (par7 > 3 + par0ComponentVillageStartPiece.terrainType) {
return null;
} else if (Math.abs(par3 - par0ComponentVillageStartPiece.getBoundingBox().minX) <= 112 && Math.abs(par5 - par0ComponentVillageStartPiece.getBoundingBox().minZ) <= 112) {
final StructureBoundingBox var8 = VillageStructureComponentPathGen.func_74933_a(par0ComponentVillageStartPiece, par1List, par2Random, par3, par4, par5, par6);
if (var8 != null && var8.minY > 10) {
final VillageStructureComponentPathGen var9 = new VillageStructureComponentPathGen(par0ComponentVillageStartPiece, par7, par2Random, var8, par6);
par1List.add(var9);
par0ComponentVillageStartPiece.field_74930_j.add(var9);
return var9;
}
return null;
} else {
return null;
}
}
示例8: spawnVillagers
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
/**
* Spawns a number of villagers in this component. Parameters: world, component bounding box, x offset, y
* offset, z offset, number of villagers
*/
protected void spawnVillagers(World p_74893_1_, StructureBoundingBox p_74893_2_, int p_74893_3_, int p_74893_4_, int p_74893_5_, int p_74893_6_)
{
if (this.villagersSpawned < p_74893_6_)
{
for (int i1 = this.villagersSpawned; i1 < p_74893_6_; ++i1)
{
int j1 = this.getXWithOffset(p_74893_3_ + i1, p_74893_5_);
int k1 = this.getYWithOffset(p_74893_4_);
int l1 = this.getZWithOffset(p_74893_3_ + i1, p_74893_5_);
if (!p_74893_2_.isVecInside(j1, k1, l1))
{
break;
}
++this.villagersSpawned;
EntityVillager entityvillager = new EntityVillager(p_74893_1_, this.getVillagerType(i1));
entityvillager.setLocationAndAngles((double)j1 + 0.5D, (double)k1, (double)l1 + 0.5D, 0.0F, 0.0F);
p_74893_1_.spawnEntityInWorld(entityvillager);
}
}
}
示例9: addComponentParts
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
/**
* second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at the end, it adds Fences...
*/
@Override
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) {
if (this.averageGroundLevel < 0) {
this.averageGroundLevel = this.getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (this.averageGroundLevel < 0) {
return true;
}
this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 4 - 1, 0);
}
this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 3, 1, Blocks.air, Blocks.air, false);
this.placeBlockAtCurrentPosition(par1World, Blocks.fence, 0, 1, 0, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Blocks.fence, 0, 1, 1, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Blocks.fence, 0, 1, 2, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Blocks.wool, 15, 1, 3, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, GCBlocks.glowstoneTorch, 0, 0, 3, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, GCBlocks.glowstoneTorch, 0, 1, 3, 1, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, GCBlocks.glowstoneTorch, 0, 2, 3, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, GCBlocks.glowstoneTorch, 0, 1, 3, -1, par3StructureBoundingBox);
return true;
}
示例10: addComponentParts
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
@Override
public boolean addComponentParts(World p_74875_1_, Random p_74875_2_, StructureBoundingBox p_74875_3_) {
if(this.isLiquidInStructureBoundingBox(p_74875_1_, p_74875_3_)) {
return false;
}
// 指定の色の羊毛ブロックで範囲を埋める
this.fillWithMetadataBlocks(p_74875_1_, p_74875_3_, 0, 0, 0, 4, 10, 4, Blocks.wool, this.color, Blocks.air, 0, false);
this.fillWithAir(p_74875_1_, p_74875_3_, 1, 1, 1, 3, 9, 3);
this.placeBlockAtCurrentPosition(p_74875_1_, Blocks.air, 0, 0, 1, 2, p_74875_3_);
this.placeBlockAtCurrentPosition(p_74875_1_, Blocks.air, 0, 0, 2, 2, p_74875_3_);
this.placeBlockAtCurrentPosition(p_74875_1_, Blocks.air, 0, 0, 3, 2, p_74875_3_);
return true;
}
示例11: biasBoundingBox
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
public static StructureBoundingBox biasBoundingBox(StructureBoundingBox bb, EnumFacing facing, int distance) {
if (facing != null) {
switch (facing) {
case NORTH:
return new StructureBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ + distance);
case SOUTH:
return new StructureBoundingBox(bb.minX, bb.minY, bb.minZ - distance, bb.maxX, bb.maxY, bb.maxZ);
case WEST:
return new StructureBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX + distance, bb.maxY, bb.maxZ);
case EAST:
return new StructureBoundingBox(bb.minX - distance, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
case UP:
return new StructureBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY + distance, bb.maxZ);
case DOWN:
return new StructureBoundingBox(bb.minX, bb.minY - distance, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
}
}
return new StructureBoundingBox(bb.minX - distance, bb.minY - distance, bb.minZ - distance, bb.maxX + distance, bb.maxY + distance, bb.maxZ + distance);
}
示例12: addComponentParts
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
/**
* second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes
* Mineshafts at the end, it adds Fences...
*/
public boolean addComponentParts(World p_74875_1_, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
Block block = this.func_151558_b(Blocks.gravel, 0);
for (int i = this.boundingBox.minX; i <= this.boundingBox.maxX; ++i)
{
for (int j = this.boundingBox.minZ; j <= this.boundingBox.maxZ; ++j)
{
if (p_74875_3_.isVecInside(i, 64, j))
{
int k = p_74875_1_.getTopSolidOrLiquidBlock(i, j) - 1;
p_74875_1_.setBlock(i, k, j, block, 0, 2);
}
}
}
return true;
}
示例13: fillEmpty
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
void fillEmpty(StructureBoundingBox bb, int value) {
if (bb.minX > mapbb.maxX || mapbb.minX > bb.maxX || bb.minZ > mapbb.maxZ || mapbb.minZ > bb.maxZ) {
return;
}
StructureBoundingBox ibb = MuonUtils.intersectionBoundingBox(bb, mapbb);
for (int xoffs = ibb.minX - mapbb.minX; xoffs <= ibb.maxX - mapbb.minX; ++xoffs) {
for (int zoffs = ibb.minZ - mapbb.minZ; zoffs <= ibb.maxZ - mapbb.minZ; ++zoffs) {
if (heightmap[xoffs][zoffs] == -1) {
heightmap[xoffs][zoffs] = value;
if (value != -1) {
isBlank = false;
}
}
}
}
}
示例14: DungeonRoomPosition
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
public DungeonRoomPosition(BlockPos pos, Template template, Rotation templateRotation, Rotation side, StructureBoundingBox boundingBox)
{
this.pos = pos;
this.template = template;
this.templateRotation = templateRotation;
this.side = side;
this.boundingBox = boundingBox;
}
示例15: procedurallyGenerate
import net.minecraft.world.gen.structure.StructureBoundingBox; //導入依賴的package包/類
/**
* Procedurally generate a dungeon through recursion using a simple 'Procedurally Build' algorithm.
* @param manager
* @param world
* @param startingPos - this position will ALWAYS be the position of the entrance.
*/
public void procedurallyGenerate(TemplateManager manager, World world, BlockPos startingPos, List<DungeonRoomPosition> nextPos)
{
List<DungeonRoomPosition> nextPos2 = Lists.newArrayList(); // list which will hold the positions to be tried in the NEXT recursion of the method.
if (roomCount > roomTries) return;
else
{
ArrayList<StructureBoundingBox> roomListCopy = Lists.newArrayList(roomList);
for (DungeonRoomPosition room : nextPos)
{
// check to make sure rooms don't overlap
for (StructureBoundingBox existingBB : roomListCopy)
{
// if structures don't overlap
if (!DungeonHelper.checkOverlap(existingBB, room.getBoundingBox()))
{
LootSlashConquer.LOGGER.info("Room generated successfully.");
List<DungeonRoomPosition> nextRooms = this.generateRoom(manager, world, room);
// copy new generated rooms into bigger list
for (DungeonRoomPosition nextRoom : nextRooms)
{
nextPos2.add(nextRoom);
}
}
else
{
LootSlashConquer.LOGGER.info("Room failed to generate.");
}
}
}
}
roomCount++;
procedurallyGenerate(manager, world, startingPos, nextPos2);
}