本文整理匯總了Java中net.minecraft.util.Rotation.CLOCKWISE_90屬性的典型用法代碼示例。如果您正苦於以下問題:Java Rotation.CLOCKWISE_90屬性的具體用法?Java Rotation.CLOCKWISE_90怎麽用?Java Rotation.CLOCKWISE_90使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類net.minecraft.util.Rotation
的用法示例。
在下文中一共展示了Rotation.CLOCKWISE_90屬性的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: rotationFromInt
public static Rotation rotationFromInt(int rotation)
{
switch (((rotation % 4) + 4) % 4)
{
case 0:
return Rotation.NONE;
case 1:
return Rotation.CLOCKWISE_90;
case 2:
return Rotation.CLOCKWISE_180;
case 3:
return Rotation.COUNTERCLOCKWISE_90;
default:
throw new IllegalStateException();
}
}
示例2: translateWallPos
public static BlockPos translateWallPos(Template template, BlockPos wallPos, Rotation wallRotation)
{
int x = wallPos.getX();
int z = wallPos.getZ();
if (wallRotation == Rotation.NONE) x += template.getSize().getX() / 2;
else if (wallRotation == Rotation.CLOCKWISE_90) z += template.getSize().getZ() / 2;
else if (wallRotation == Rotation.CLOCKWISE_180) x -= template.getSize().getX() / 2;
else if (wallRotation == Rotation.COUNTERCLOCKWISE_90) z -= template.getSize().getZ() / 2;
return new BlockPos(x, wallPos.getY(), z);
}
示例3: fromFacingForUp
private Rotation fromFacingForUp(FstPlayer player) {
EnumFacing facing = player.getAdjustedHorizontalFacing();
if(facing == EnumFacing.EAST) {
return Rotation.CLOCKWISE_90;
}
else if(facing == EnumFacing.WEST) {
return Rotation.COUNTERCLOCKWISE_90;
}
else if(facing == EnumFacing.SOUTH) {
return Rotation.CLOCKWISE_180;
}
else {
return Rotation.NONE;
}
}
示例4: fromFacingForDown
private Rotation fromFacingForDown(FstPlayer player) {
EnumFacing facing = player.getAdjustedHorizontalFacing();
if(facing == EnumFacing.EAST) {
return Rotation.COUNTERCLOCKWISE_90;
}
else if(facing == EnumFacing.WEST) {
return Rotation.CLOCKWISE_90;
}
else if(facing == EnumFacing.NORTH) {
return Rotation.CLOCKWISE_180;
}
else {
return Rotation.NONE;
}
}
示例5: getHorizontalRotation
public static Rotation getHorizontalRotation(EnumFacing from, EnumFacing to) {
if(from.getAxis().isVertical() || to.getAxis().isVertical()) return Rotation.NONE;
if(from.getOpposite() == to) {
return Rotation.CLOCKWISE_180;
} else if(from != to) {
int indexFrom = from.getHorizontalIndex();
int indexTo = to.getHorizontalIndex();
if(indexFrom < indexTo || (indexFrom == 3 && indexTo == 0)) {
return Rotation.CLOCKWISE_90;
} else {
return Rotation.COUNTERCLOCKWISE_90;
}
}
return Rotation.NONE;
}
示例6: setCoordBaseMode
public void setCoordBaseMode(@Nullable EnumFacing facing)
{
this.coordBaseMode = facing;
if (facing == null)
{
this.rotation = Rotation.NONE;
this.mirror = Mirror.NONE;
}
else
{
switch (facing)
{
case SOUTH:
this.mirror = Mirror.LEFT_RIGHT;
this.rotation = Rotation.NONE;
break;
case WEST:
this.mirror = Mirror.LEFT_RIGHT;
this.rotation = Rotation.CLOCKWISE_90;
break;
case EAST:
this.mirror = Mirror.NONE;
this.rotation = Rotation.CLOCKWISE_90;
break;
default:
this.mirror = Mirror.NONE;
this.rotation = Rotation.NONE;
}
}
}
示例7: func_191070_b
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;
}
示例8: setCoordBaseMode
public void setCoordBaseMode(@Nullable EnumFacing facing)
{
this.coordBaseMode = facing;
if (facing == null)
{
this.rotation = Rotation.NONE;
this.mirror = Mirror.NONE;
}
else
{
switch (facing)
{
case SOUTH:
this.mirror = Mirror.LEFT_RIGHT;
this.rotation = Rotation.NONE;
break;
case WEST:
this.mirror = Mirror.LEFT_RIGHT;
this.rotation = Rotation.CLOCKWISE_90;
break;
case EAST:
this.mirror = Mirror.NONE;
this.rotation = Rotation.CLOCKWISE_90;
break;
default:
this.mirror = Mirror.NONE;
this.rotation = Rotation.NONE;
}
}
}
示例9: create
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;
}
}
示例10: translateToNextRoom
/** Translates the given BlockPos to the next possible room position based on rotation and the size of the current and next template. */
public static BlockPos translateToNextRoom(Template currentTemplate, Template nextTemplate, BlockPos currentCenter, Rotation side, Rotation currentTemplateRotation, Rotation nextTemplateRotation)
{
int x = currentCenter.getX();
int z = currentCenter.getZ();
int currentX = currentTemplate.getSize().getX() / 2;
int currentZ = currentTemplate.getSize().getZ() / 2;
int nextX = nextTemplate.getSize().getX() / 2;
int nextZ = nextTemplate.getSize().getZ() / 2;
if (side == Rotation.NONE)
{
if (currentTemplateRotation == Rotation.NONE || currentTemplateRotation == Rotation.CLOCKWISE_180)
{
if (nextTemplateRotation == Rotation.NONE || nextTemplateRotation == Rotation.CLOCKWISE_180) x += currentX + nextX;
else x += currentX + nextZ;
}
else
{
if (nextTemplateRotation == Rotation.NONE || nextTemplateRotation == Rotation.CLOCKWISE_180) x += currentZ + nextX;
else x += currentZ + nextZ;
}
}
else if (side == Rotation.CLOCKWISE_90)
{
if (currentTemplateRotation == Rotation.NONE || currentTemplateRotation == Rotation.CLOCKWISE_180)
{
if (nextTemplateRotation == Rotation.NONE || nextTemplateRotation == Rotation.CLOCKWISE_180) z += currentZ + nextZ;
else z += currentZ + nextX;
}
else
{
if (nextTemplateRotation == Rotation.NONE || nextTemplateRotation == Rotation.CLOCKWISE_180) z += currentX + nextZ;
else z += currentX + nextX;
}
}
else if (side == Rotation.CLOCKWISE_180)
{
if (currentTemplateRotation == Rotation.NONE || currentTemplateRotation == Rotation.CLOCKWISE_180)
{
if (nextTemplateRotation == Rotation.NONE || nextTemplateRotation == Rotation.CLOCKWISE_180) x -= currentX + nextX;
else x -= currentX + nextZ;
}
else
{
if (nextTemplateRotation == Rotation.NONE || nextTemplateRotation == Rotation.CLOCKWISE_180) x -= currentZ + nextX;
else x -= currentZ + nextZ;
}
}
else if (side == Rotation.COUNTERCLOCKWISE_90)
{
if (currentTemplateRotation == Rotation.NONE || currentTemplateRotation == Rotation.CLOCKWISE_180)
{
if (nextTemplateRotation == Rotation.NONE || nextTemplateRotation == Rotation.CLOCKWISE_180) z -= currentZ + nextZ;
else z -= currentZ + nextX;
}
else
{
if (nextTemplateRotation == Rotation.NONE || nextTemplateRotation == Rotation.CLOCKWISE_180) z -= currentX + nextZ;
else z -= currentX + nextX;
}
}
return new BlockPos(x, currentCenter.getY(), z);
}
示例11: func_191092_a
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;
}
}
示例12: setBoundingBoxFromTemplate
private void setBoundingBoxFromTemplate()
{
Rotation rotation = this.placeSettings.getRotation();
BlockPos blockpos = this.template.transformedSize(rotation);
Mirror mirror = this.placeSettings.getMirror();
this.boundingBox = new StructureBoundingBox(0, 0, 0, blockpos.getX(), blockpos.getY() - 1, blockpos.getZ());
switch (rotation)
{
case NONE:
default:
break;
case CLOCKWISE_90:
this.boundingBox.offset(-blockpos.getX(), 0, 0);
break;
case COUNTERCLOCKWISE_90:
this.boundingBox.offset(0, 0, -blockpos.getZ());
break;
case CLOCKWISE_180:
this.boundingBox.offset(-blockpos.getX(), 0, -blockpos.getZ());
}
switch (mirror)
{
case NONE:
default:
break;
case FRONT_BACK:
BlockPos blockpos2 = BlockPos.ORIGIN;
if (rotation != Rotation.CLOCKWISE_90 && rotation != Rotation.COUNTERCLOCKWISE_90)
{
if (rotation == Rotation.CLOCKWISE_180)
{
blockpos2 = blockpos2.offset(EnumFacing.EAST, blockpos.getX());
}
else
{
blockpos2 = blockpos2.offset(EnumFacing.WEST, blockpos.getX());
}
}
else
{
blockpos2 = blockpos2.offset(rotation.rotate(EnumFacing.WEST), blockpos.getZ());
}
this.boundingBox.offset(blockpos2.getX(), 0, blockpos2.getZ());
break;
case LEFT_RIGHT:
BlockPos blockpos1 = BlockPos.ORIGIN;
if (rotation != Rotation.CLOCKWISE_90 && rotation != Rotation.COUNTERCLOCKWISE_90)
{
if (rotation == Rotation.CLOCKWISE_180)
{
blockpos1 = blockpos1.offset(EnumFacing.SOUTH, blockpos.getZ());
}
else
{
blockpos1 = blockpos1.offset(EnumFacing.NORTH, blockpos.getZ());
}
}
else
{
blockpos1 = blockpos1.offset(rotation.rotate(EnumFacing.NORTH), blockpos.getX());
}
this.boundingBox.offset(blockpos1.getX(), 0, blockpos1.getZ());
}
this.boundingBox.offset(this.templatePosition.getX(), this.templatePosition.getY(), this.templatePosition.getZ());
}