本文整理匯總了Java中net.minecraft.util.Rotation.values方法的典型用法代碼示例。如果您正苦於以下問題:Java Rotation.values方法的具體用法?Java Rotation.values怎麽用?Java Rotation.values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.Rotation
的用法示例。
在下文中一共展示了Rotation.values方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generatePotentialRooms
import net.minecraft.util.Rotation; //導入方法依賴的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: create
import net.minecraft.util.Rotation; //導入方法依賴的package包/類
private void create(World worldIn, ChunkProviderEnd chunkProvider, Random rnd, int chunkX, int chunkZ)
{
Random random = new Random((long)(chunkX + chunkZ * 10387313));
Rotation rotation = Rotation.values()[random.nextInt(Rotation.values().length)];
int i = MapGenEndCity.func_191070_b(chunkX, chunkZ, chunkProvider);
if (i < 60)
{
this.isSizeable = false;
}
else
{
BlockPos blockpos = new BlockPos(chunkX * 16 + 8, i, chunkZ * 16 + 8);
StructureEndCityPieces.func_191087_a(worldIn.getSaveHandler().getStructureTemplateManager(), blockpos, rotation, this.components, rnd);
this.updateBoundingBox();
this.isSizeable = true;
}
}
示例3: fromBytes
import net.minecraft.util.Rotation; //導入方法依賴的package包/類
@Override
public void fromBytes(ByteBuf buf)
{
pos = ByteBufTools.readBlockPos(buf);
multiblockId = new ResourceLocation(ByteBufUtils.readUTF8String(buf));
rot = Rotation.values()[buf.readInt()];
}
示例4: gen
import net.minecraft.util.Rotation; //導入方法依賴的package包/類
@Override
void gen(World world, int x, int z, IChunkGenerator generator, IChunkProvider provider) {
random.setSeed(world.getSeed());
long good = random.nextLong();
long succ = random.nextLong();
good *= x >> 3;
succ *= z >> 3;
random.setSeed(good * succ * world.getSeed());
//Generate
if(GEN_CONFIG.MONOLITH_CONFIG.OBELISK_DECORATOR.rarity > 0D
&& GEN_CONFIG.MONOLITH_CONFIG.OBELISK_DECORATOR.rarity / 100D > random.nextDouble()) {
List<AxisAlignedBB> occupied = Lists.newArrayList();
for(int i = 0; i < GEN_CONFIG.MONOLITH_CONFIG.OBELISK_DECORATOR.size; i++) {
BlockPos top = world.getTopSolidOrLiquidBlock(randomVector().add(x, 0, z).toBlockPos());
int below = random.nextInt(7);
if(top.getY() > below) {
top = top.add(0, -below, 0);
}
Template obelisk = obelisks.next().load(world);
Rotation rotation = Rotation.values()[random.nextInt(4)];
Vector3 vec = Vector3.create(obelisk.getSize()).rotate(rotation);
AxisAlignedBB obeliskBB = new AxisAlignedBB(top, vec.add(top).toBlockPos()).grow(1);
if(occupied.stream().noneMatch(bb -> bb.intersects(obeliskBB))) {
PlacementSettings settings = new PlacementSettings();
settings.setRotation(rotation);
settings.setRandom(random);
obelisk.addBlocksToWorld(world, top, settings);
occupied.add(obeliskBB);
}
}
}
}
示例5: genCubes
import net.minecraft.util.Rotation; //導入方法依賴的package包/類
private void genCubes(World world, BlockPos pos) {
//Gen Cube
BlockPos origin = pos.add(5, 0, 5);
Template template = Structure.ASHEN_CUBE.load(world);
boolean loot = GEN_CONFIG.ASHEN_CUBE_STRUCTURE.loot / 100D > random.nextDouble();
PlacementSettings integrity = new PlacementSettings();
integrity.setIntegrity(loot ? 1F : 0.35F + 0.45F * random.nextFloat());
template.addBlocksToWorld(world, origin, integrity);
integrity.setIntegrity(!loot && random.nextFloat() > 0.45F ? 1F : random.nextFloat());
Structure.ASHEN_CUBE_.generate(world, origin, integrity);
//Add loot
for (int i = 0; i < 6 + random.nextInt(6); i++) {
loot = GEN_CONFIG.MONOLITH_CONFIG.MONOLITH_STRUCTURE.loot / 100D > random.nextDouble();
if (loot) {
BlockPos inside = origin.add(1 + random.nextInt(4), 1, 1 + random.nextInt(4));
IBlockState pot = ModBlocks.LARGE_POT.getDefaultState().withProperty(State.POT_VARIANT, random.nextInt(3));
world.setBlockState(inside, pot);
}
}
//Gen Cubes
AxisAlignedBB cubeBB = new AxisAlignedBB(origin, origin.add(template.getSize()));
for(int i = 0; i < GEN_CONFIG.ASHEN_CUBE_STRUCTURE.size; i++) {
Template cube = nuggets.next().load(world);
Rotation rotation = Rotation.values()[random.nextInt(4)];
Vector3 vec = Vector3.create(cube.getSize()).rotate(rotation);
BlockPos offset = randomVector().add(pos).toBlockPos();
if(offset.getY() < 1 || (world.canSeeSky(offset) && GEN_CONFIG.ASHEN_CUBE_STRUCTURE.underground)) continue;
AxisAlignedBB nuggetBB = new AxisAlignedBB(offset, vec.add(offset).toBlockPos());
if(!nuggetBB.intersects(cubeBB)) {
PlacementSettings settings = new PlacementSettings();
settings.setIntegrity(random.nextFloat() > 0.85F ? 0.9F : 0.35F + 0.45F * random.nextFloat());
settings.setRotation(rotation);
settings.setRandom(random);
cube.addBlocksToWorld(world, offset, settings);
}
}
}
示例6: func_191070_b
import net.minecraft.util.Rotation; //導入方法依賴的package包/類
private static int func_191070_b(int p_191070_0_, int p_191070_1_, ChunkProviderEnd p_191070_2_)
{
Random random = new Random((long)(p_191070_0_ + p_191070_1_ * 10387313));
Rotation rotation = Rotation.values()[random.nextInt(Rotation.values().length)];
ChunkPrimer chunkprimer = new ChunkPrimer();
p_191070_2_.setBlocksInChunk(p_191070_0_, p_191070_1_, chunkprimer);
int i = 5;
int j = 5;
if (rotation == Rotation.CLOCKWISE_90)
{
i = -5;
}
else if (rotation == Rotation.CLOCKWISE_180)
{
i = -5;
j = -5;
}
else if (rotation == Rotation.COUNTERCLOCKWISE_90)
{
j = -5;
}
int k = chunkprimer.findGroundBlockIdx(7, 7);
int l = chunkprimer.findGroundBlockIdx(7, 7 + j);
int i1 = chunkprimer.findGroundBlockIdx(7 + i, 7);
int j1 = chunkprimer.findGroundBlockIdx(7 + i, 7 + j);
int k1 = Math.min(Math.min(k, l), Math.min(i1, j1));
return k1;
}
示例7: generate
import net.minecraft.util.Rotation; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
Random random = worldIn.getChunkFromBlockCoords(position).getRandomWithSeed(987234911L);
MinecraftServer minecraftserver = worldIn.getMinecraftServer();
Rotation[] arotation = Rotation.values();
Rotation rotation = arotation[random.nextInt(arotation.length)];
int i = random.nextInt(FOSSILS.length);
TemplateManager templatemanager = worldIn.getSaveHandler().getStructureTemplateManager();
Template template = templatemanager.getTemplate(minecraftserver, FOSSILS[i]);
Template template1 = templatemanager.getTemplate(minecraftserver, FOSSILS_COAL[i]);
ChunkPos chunkpos = new ChunkPos(position);
StructureBoundingBox structureboundingbox = new StructureBoundingBox(chunkpos.getXStart(), 0, chunkpos.getZStart(), chunkpos.getXEnd(), 256, chunkpos.getZEnd());
PlacementSettings placementsettings = (new PlacementSettings()).setRotation(rotation).setBoundingBox(structureboundingbox).setRandom(random);
BlockPos blockpos = template.transformedSize(rotation);
int j = random.nextInt(16 - blockpos.getX());
int k = random.nextInt(16 - blockpos.getZ());
int l = 256;
for (int i1 = 0; i1 < blockpos.getX(); ++i1)
{
for (int j1 = 0; j1 < blockpos.getX(); ++j1)
{
l = Math.min(l, worldIn.getHeight(position.getX() + i1 + j, position.getZ() + j1 + k));
}
}
int k1 = Math.max(l - 15 - random.nextInt(10), 10);
BlockPos blockpos1 = template.getZeroPositionWithTransform(position.add(j, k1, k), Mirror.NONE, rotation);
placementsettings.setIntegrity(0.9F);
template.addBlocksToWorld(worldIn, blockpos1, placementsettings, 20);
placementsettings.setIntegrity(0.1F);
template1.addBlocksToWorld(worldIn, blockpos1, placementsettings, 20);
return true;
}
示例8: create
import net.minecraft.util.Rotation; //導入方法依賴的package包/類
private void create(World worldIn, ChunkProviderEnd chunkProvider, Random rnd, int chunkX, int chunkZ)
{
Rotation rotation = Rotation.values()[rnd.nextInt(Rotation.values().length)];
ChunkPrimer chunkprimer = new ChunkPrimer();
chunkProvider.setBlocksInChunk(chunkX, chunkZ, chunkprimer);
int i = 5;
int j = 5;
if (rotation == Rotation.CLOCKWISE_90)
{
i = -5;
}
else if (rotation == Rotation.CLOCKWISE_180)
{
i = -5;
j = -5;
}
else if (rotation == Rotation.COUNTERCLOCKWISE_90)
{
j = -5;
}
int k = chunkprimer.findGroundBlockIdx(7, 7);
int l = chunkprimer.findGroundBlockIdx(7, 7 + j);
int i1 = chunkprimer.findGroundBlockIdx(7 + i, 7);
int j1 = chunkprimer.findGroundBlockIdx(7 + i, 7 + j);
int k1 = Math.min(Math.min(k, l), Math.min(i1, j1));
if (k1 < 60)
{
this.isSizeable = false;
}
else
{
BlockPos blockpos = new BlockPos(chunkX * 16 + 8, k1, chunkZ * 16 + 8);
StructureEndCityPieces.beginHouseTower(blockpos, rotation, this.components, rnd);
this.updateBoundingBox();
this.isSizeable = true;
}
}
示例9: generate
import net.minecraft.util.Rotation; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
Random random = worldIn.getChunkFromChunkCoords(position.getX(), position.getZ()).getRandomWithSeed(987234911L);
MinecraftServer minecraftserver = worldIn.getMinecraftServer();
Rotation[] arotation = Rotation.values();
Rotation rotation = arotation[random.nextInt(arotation.length)];
int i = random.nextInt(FOSSILS.length);
TemplateManager templatemanager = worldIn.getSaveHandler().getStructureTemplateManager();
Template template = templatemanager.getTemplate(minecraftserver, FOSSILS[i]);
Template template1 = templatemanager.getTemplate(minecraftserver, FOSSILS_COAL[i]);
ChunkPos chunkpos = new ChunkPos(position);
StructureBoundingBox structureboundingbox = new StructureBoundingBox(chunkpos.getXStart(), 0, chunkpos.getZStart(), chunkpos.getXEnd(), 256, chunkpos.getZEnd());
PlacementSettings placementsettings = (new PlacementSettings()).setRotation(rotation).setBoundingBox(structureboundingbox).setRandom(random);
BlockPos blockpos = template.transformedSize(rotation);
int j = random.nextInt(16 - blockpos.getX());
int k = random.nextInt(16 - blockpos.getZ());
int l = 256;
for (int i1 = 0; i1 < blockpos.getX(); ++i1)
{
for (int j1 = 0; j1 < blockpos.getX(); ++j1)
{
l = Math.min(l, worldIn.getHeightmapHeight(position.getX() + i1 + j, position.getZ() + j1 + k));
}
}
int k1 = Math.max(l - 15 - random.nextInt(10), 10);
BlockPos blockpos1 = template.getZeroPositionWithTransform(position.add(j, k1, k), Mirror.NONE, rotation);
placementsettings.setIntegrity(0.9F);
template.addBlocksToWorld(worldIn, blockpos1, placementsettings, 4);
placementsettings.setIntegrity(0.1F);
template1.addBlocksToWorld(worldIn, blockpos1, placementsettings, 4);
return true;
}
示例10: func_191092_a
import net.minecraft.util.Rotation; //導入方法依賴的package包/類
private void func_191092_a(World p_191092_1_, ChunkProviderOverworld p_191092_2_, Random p_191092_3_, int p_191092_4_, int p_191092_5_)
{
Rotation rotation = Rotation.values()[p_191092_3_.nextInt(Rotation.values().length)];
ChunkPrimer chunkprimer = new ChunkPrimer();
p_191092_2_.setBlocksInChunk(p_191092_4_, p_191092_5_, chunkprimer);
int i = 5;
int j = 5;
if (rotation == Rotation.CLOCKWISE_90)
{
i = -5;
}
else if (rotation == Rotation.CLOCKWISE_180)
{
i = -5;
j = -5;
}
else if (rotation == Rotation.COUNTERCLOCKWISE_90)
{
j = -5;
}
int k = chunkprimer.findGroundBlockIdx(7, 7);
int l = chunkprimer.findGroundBlockIdx(7, 7 + j);
int i1 = chunkprimer.findGroundBlockIdx(7 + i, 7);
int j1 = chunkprimer.findGroundBlockIdx(7 + i, 7 + j);
int k1 = Math.min(Math.min(k, l), Math.min(i1, j1));
if (k1 < 60)
{
this.field_191093_c = false;
}
else
{
BlockPos blockpos = new BlockPos(p_191092_4_ * 16 + 8, k1 + 1, p_191092_5_ * 16 + 8);
List<WoodlandMansionPieces.MansionTemplate> list = Lists.<WoodlandMansionPieces.MansionTemplate>newLinkedList();
WoodlandMansionPieces.func_191152_a(p_191092_1_.getSaveHandler().getStructureTemplateManager(), blockpos, rotation, list, p_191092_3_);
this.components.addAll(list);
this.updateBoundingBox();
this.field_191093_c = true;
}
}
示例11: addComponentParts
import net.minecraft.util.Rotation; //導入方法依賴的package包/類
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
if (!this.offsetToAverageGroundLevel(worldIn, structureBoundingBoxIn, -1))
{
return false;
}
else
{
StructureBoundingBox structureboundingbox = this.getBoundingBox();
BlockPos blockpos = new BlockPos(structureboundingbox.minX, structureboundingbox.minY, structureboundingbox.minZ);
Rotation[] arotation = Rotation.values();
MinecraftServer minecraftserver = worldIn.getMinecraftServer();
TemplateManager templatemanager = worldIn.getSaveHandler().getStructureTemplateManager();
PlacementSettings placementsettings = (new PlacementSettings()).setRotation(arotation[randomIn.nextInt(arotation.length)]).setReplacedBlock(Blocks.STRUCTURE_VOID).setBoundingBox(structureboundingbox);
Template template = templatemanager.getTemplate(minecraftserver, IGLOO_TOP_ID);
template.addBlocksToWorldChunk(worldIn, blockpos, placementsettings);
if (randomIn.nextDouble() < 0.5D)
{
Template template1 = templatemanager.getTemplate(minecraftserver, IGLOO_MIDDLE_ID);
Template template2 = templatemanager.getTemplate(minecraftserver, IGLOO_BOTTOM_ID);
int i = randomIn.nextInt(8) + 4;
for (int j = 0; j < i; ++j)
{
BlockPos blockpos1 = template.calculateConnectedPos(placementsettings, new BlockPos(3, -1 - j * 3, 5), placementsettings, new BlockPos(1, 2, 1));
template1.addBlocksToWorldChunk(worldIn, blockpos.add(blockpos1), placementsettings);
}
BlockPos blockpos4 = blockpos.add(template.calculateConnectedPos(placementsettings, new BlockPos(3, -1 - i * 3, 5), placementsettings, new BlockPos(3, 5, 7)));
template2.addBlocksToWorldChunk(worldIn, blockpos4, placementsettings);
Map<BlockPos, String> map = template2.getDataBlocks(blockpos4, placementsettings);
for (Entry<BlockPos, String> entry : map.entrySet())
{
if ("chest".equals(entry.getValue()))
{
BlockPos blockpos2 = (BlockPos)entry.getKey();
worldIn.setBlockState(blockpos2, Blocks.AIR.getDefaultState(), 3);
TileEntity tileentity = worldIn.getTileEntity(blockpos2.down());
if (tileentity instanceof TileEntityChest)
{
((TileEntityChest)tileentity).setLootTable(LootTableList.CHESTS_IGLOO_CHEST, randomIn.nextLong());
}
}
}
}
else
{
BlockPos blockpos3 = Template.transformedBlockPos(placementsettings, new BlockPos(3, 0, 5));
worldIn.setBlockState(blockpos.add(blockpos3), Blocks.SNOW.getDefaultState(), 3);
}
return true;
}
}
示例12: addComponentParts
import net.minecraft.util.Rotation; //導入方法依賴的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 worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
if (!this.offsetToAverageGroundLevel(worldIn, structureBoundingBoxIn, -1))
{
return false;
}
else
{
StructureBoundingBox structureboundingbox = this.getBoundingBox();
BlockPos blockpos = new BlockPos(structureboundingbox.minX, structureboundingbox.minY, structureboundingbox.minZ);
Rotation[] arotation = Rotation.values();
MinecraftServer minecraftserver = worldIn.getMinecraftServer();
TemplateManager templatemanager = worldIn.getSaveHandler().getStructureTemplateManager();
PlacementSettings placementsettings = (new PlacementSettings()).setRotation(arotation[randomIn.nextInt(arotation.length)]).setReplacedBlock(Blocks.STRUCTURE_VOID).setBoundingBox(structureboundingbox);
Template template = templatemanager.getTemplate(minecraftserver, IGLOO_TOP_ID);
template.addBlocksToWorldChunk(worldIn, blockpos, placementsettings);
if (randomIn.nextDouble() < 0.5D)
{
Template template1 = templatemanager.getTemplate(minecraftserver, IGLOO_MIDDLE_ID);
Template template2 = templatemanager.getTemplate(minecraftserver, IGLOO_BOTTOM_ID);
int i = randomIn.nextInt(8) + 4;
for (int j = 0; j < i; ++j)
{
BlockPos blockpos1 = template.calculateConnectedPos(placementsettings, new BlockPos(3, -1 - j * 3, 5), placementsettings, new BlockPos(1, 2, 1));
template1.addBlocksToWorldChunk(worldIn, blockpos.add(blockpos1), placementsettings);
}
BlockPos blockpos4 = blockpos.add(template.calculateConnectedPos(placementsettings, new BlockPos(3, -1 - i * 3, 5), placementsettings, new BlockPos(3, 5, 7)));
template2.addBlocksToWorldChunk(worldIn, blockpos4, placementsettings);
Map<BlockPos, String> map = template2.getDataBlocks(blockpos4, placementsettings);
for (Entry<BlockPos, String> entry : map.entrySet())
{
if ("chest".equals(entry.getValue()))
{
BlockPos blockpos2 = (BlockPos)entry.getKey();
worldIn.setBlockState(blockpos2, Blocks.AIR.getDefaultState(), 3);
TileEntity tileentity = worldIn.getTileEntity(blockpos2.down());
if (tileentity instanceof TileEntityChest)
{
((TileEntityChest)tileentity).setLootTable(LootTableList.CHESTS_IGLOO_CHEST, randomIn.nextLong());
}
}
}
}
else
{
BlockPos blockpos3 = Template.transformedBlockPos(placementsettings, new BlockPos(3, 0, 5));
worldIn.setBlockState(blockpos.add(blockpos3), Blocks.SNOW.getDefaultState(), 3);
}
return true;
}
}