本文整理匯總了Java中net.minecraft.util.Rotation類的典型用法代碼示例。如果您正苦於以下問題:Java Rotation類的具體用法?Java Rotation怎麽用?Java Rotation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Rotation類屬於net.minecraft.util包,在下文中一共展示了Rotation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: withRotation
import net.minecraft.util.Rotation; //導入依賴的package包/類
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case COUNTERCLOCKWISE_90:
case CLOCKWISE_90:
switch ((EnumFacing.Axis)state.getValue(AXIS))
{
case X:
return state.withProperty(AXIS, EnumFacing.Axis.Z);
case Z:
return state.withProperty(AXIS, EnumFacing.Axis.X);
default:
return state;
}
default:
return state;
}
}
示例2: withRotation
import net.minecraft.util.Rotation; //導入依賴的package包/類
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case COUNTERCLOCKWISE_90:
case CLOCKWISE_90:
switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS))
{
case X:
return state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
case Z:
return state.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
default:
return state;
}
default:
return state;
}
}
示例3: getZeroPositionWithTransform
import net.minecraft.util.Rotation; //導入依賴的package包/類
public static BlockPos getZeroPositionWithTransform(BlockPos p_191157_0_, Mirror p_191157_1_, Rotation p_191157_2_, int p_191157_3_, int p_191157_4_)
{
--p_191157_3_;
--p_191157_4_;
int i = p_191157_1_ == Mirror.FRONT_BACK ? p_191157_3_ : 0;
int j = p_191157_1_ == Mirror.LEFT_RIGHT ? p_191157_4_ : 0;
BlockPos blockpos = p_191157_0_;
switch (p_191157_2_)
{
case COUNTERCLOCKWISE_90:
blockpos = p_191157_0_.add(j, 0, p_191157_3_ - i);
break;
case CLOCKWISE_90:
blockpos = p_191157_0_.add(p_191157_4_ - j, 0, i);
break;
case CLOCKWISE_180:
blockpos = p_191157_0_.add(p_191157_3_ - i, 0, p_191157_4_ - j);
break;
case NONE:
blockpos = p_191157_0_.add(i, 0, j);
}
return blockpos;
}
示例4: setBlockState
import net.minecraft.util.Rotation; //導入依賴的package包/類
protected void setBlockState(World worldIn, IBlockState blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn)
{
BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
if (boundingboxIn.isVecInside(blockpos))
{
if (this.mirror != Mirror.NONE)
{
blockstateIn = blockstateIn.withMirror(this.mirror);
}
if (this.rotation != Rotation.NONE)
{
blockstateIn = blockstateIn.withRotation(this.rotation);
}
worldIn.setBlockState(blockpos, blockstateIn, 2);
}
}
示例5: withRotation
import net.minecraft.util.Rotation; //導入依賴的package包/類
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(EAST, state.getValue(WEST)).withProperty(SOUTH, state.getValue(NORTH)).withProperty(WEST, state.getValue(EAST));
case COUNTERCLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(EAST)).withProperty(EAST, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(WEST)).withProperty(WEST, state.getValue(NORTH));
case CLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(WEST)).withProperty(EAST, state.getValue(NORTH)).withProperty(SOUTH, state.getValue(EAST)).withProperty(WEST, state.getValue(SOUTH));
default:
return state;
}
}
示例6: DungeonRoomPosition
import net.minecraft.util.Rotation; //導入依賴的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;
}
示例7: generateStaircase
import net.minecraft.util.Rotation; //導入依賴的package包/類
/** Generates the staircase underneath the entrance. */
// WORKING
private List<DungeonRoomPosition> generateStaircase(TemplateManager manager, World world, BlockPos entranceCenter)
{
Template encasedStaircase = manager.getTemplate(world.getMinecraftServer(), new ResourceLocation(Reference.MODID, "dungeons/encased_staircase"));
Template bottomStaircase = manager.getTemplate(world.getMinecraftServer(), new ResourceLocation(Reference.MODID, "dungeons/bottom_staircase"));
PlacementSettings settings = new PlacementSettings();
int depth = 4; // how many staircases are generated?
List<DungeonRoomPosition> list = null;
for (int i = 0; i < depth; i++)
{
if (i < depth - 1) // make sure we aren't at the last staircase
{
BlockPos encasedStaircasePos = DungeonHelper.translateToCorner(encasedStaircase, entranceCenter.add(0, -4 * (i + 1), 0), Rotation.NONE); // get the staircase position; offset by height and multiply by depth.
encasedStaircase.addBlocksToWorld(world, encasedStaircasePos, new DungeonBlockProcessor(encasedStaircasePos, settings, Blocks.NETHER_BRICK, Blocks.NETHERRACK), settings, 2);
}
else // we know this is the bottom staircase, so spawn bottom staircase and store potential rooms.
{
BlockPos bottomStaircaseCenteredPos = entranceCenter.add(0, -4 * (depth - 1) + -5, 0);
BlockPos bottomStaircasePos = DungeonHelper.translateToCorner(bottomStaircase, bottomStaircaseCenteredPos, Rotation.NONE);
bottomStaircase.addBlocksToWorld(world, bottomStaircasePos, new DungeonBlockProcessor(bottomStaircasePos, settings, Blocks.NETHER_BRICK, Blocks.NETHERRACK), settings, 2);
roomList.add(DungeonHelper.getStructureBoundingBox(bottomStaircase, Rotation.NONE, bottomStaircaseCenteredPos)); // add StructureBoundingBox to room list. Used to make sure we don't generate rooms inside of other bounding boxes.
list = this.generatePotentialRooms(manager, world, bottomStaircase, Rotation.NONE, bottomStaircaseCenteredPos, null);
}
}
return list;
}
示例8: translateWallPos
import net.minecraft.util.Rotation; //導入依賴的package包/類
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);
}
示例9: withRotation
import net.minecraft.util.Rotation; //導入依賴的package包/類
/**
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withRotation(IBlockState state, Rotation rot)
{
switch (rot)
{
case CLOCKWISE_180:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(EAST, state.getValue(WEST)).withProperty(SOUTH, state.getValue(NORTH)).withProperty(WEST, state.getValue(EAST));
case COUNTERCLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(EAST)).withProperty(EAST, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(WEST)).withProperty(WEST, state.getValue(NORTH));
case CLOCKWISE_90:
return state.withProperty(NORTH, state.getValue(WEST)).withProperty(EAST, state.getValue(NORTH)).withProperty(SOUTH, state.getValue(EAST)).withProperty(WEST, state.getValue(SOUTH));
default:
return state;
}
}
示例10: generate
import net.minecraft.util.Rotation; //導入依賴的package包/類
public boolean generate(int p_186185_1_, StructureEndCityPieces.CityTemplate p_186185_2_, BlockPos p_186185_3_, List<StructureComponent> p_186185_4_, Random rand)
{
if (p_186185_1_ > 8)
{
return false;
}
else
{
Rotation rotation = p_186185_2_.placeSettings.getRotation();
StructureEndCityPieces.CityTemplate structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(p_186185_2_, p_186185_3_, "base_floor", rotation, true));
int i = rand.nextInt(3);
if (i == 0)
{
StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 4, -1), "base_roof", rotation, true));
}
else if (i == 1)
{
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 0, -1), "second_floor_2", rotation, false));
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 8, -1), "second_roof", rotation, false));
StructureEndCityPieces.recursiveChildren(StructureEndCityPieces.TOWER_GENERATOR, p_186185_1_ + 1, structureendcitypieces$citytemplate, (BlockPos)null, p_186185_4_, rand);
}
else if (i == 2)
{
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 0, -1), "second_floor_2", rotation, false));
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 4, -1), "third_floor_c", rotation, false));
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 8, -1), "third_roof", rotation, true));
StructureEndCityPieces.recursiveChildren(StructureEndCityPieces.TOWER_GENERATOR, p_186185_1_ + 1, structureendcitypieces$citytemplate, (BlockPos)null, p_186185_4_, rand);
}
return true;
}
}
示例11: transformedBlockPos
import net.minecraft.util.Rotation; //導入依賴的package包/類
private static BlockPos transformedBlockPos(BlockPos pos, Mirror mirrorIn, Rotation rotationIn)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
boolean flag = true;
switch (mirrorIn)
{
case LEFT_RIGHT:
k = -k;
break;
case FRONT_BACK:
i = -i;
break;
default:
flag = false;
}
switch (rotationIn)
{
case COUNTERCLOCKWISE_90:
return new BlockPos(k, j, -i);
case CLOCKWISE_90:
return new BlockPos(-k, j, i);
case CLOCKWISE_180:
return new BlockPos(-i, j, -k);
default:
return flag ? new BlockPos(i, j, k) : pos;
}
}
示例12: transformedVec3d
import net.minecraft.util.Rotation; //導入依賴的package包/類
private static Vec3d transformedVec3d(Vec3d vec, Mirror mirrorIn, Rotation rotationIn)
{
double d0 = vec.x;
double d1 = vec.y;
double d2 = vec.z;
boolean flag = true;
switch (mirrorIn)
{
case LEFT_RIGHT:
d2 = 1.0D - d2;
break;
case FRONT_BACK:
d0 = 1.0D - d0;
break;
default:
flag = false;
}
switch (rotationIn)
{
case COUNTERCLOCKWISE_90:
return new Vec3d(d2, d1, 1.0D - d0);
case CLOCKWISE_90:
return new Vec3d(1.0D - d2, d1, d0);
case CLOCKWISE_180:
return new Vec3d(1.0D - d0, d1, 1.0D - d2);
default:
return flag ? new Vec3d(d0, d1, d2) : vec;
}
}
示例13: rotate
import net.minecraft.util.Rotation; //導入依賴的package包/類
public void rotate(Rotation p_189667_1_)
{
if (this.world != null && this.world.getBlockState(this.getPos()).getValue(BlockSkull.FACING) == EnumFacing.UP)
{
this.skullRotation = p_189667_1_.rotate(this.skullRotation, 16);
}
}
示例14: fromFacingForDown
import net.minecraft.util.Rotation; //導入依賴的package包/類
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;
}
}
示例15: 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()];
}