本文整理汇总了Java中net.minecraft.util.Mirror类的典型用法代码示例。如果您正苦于以下问题:Java Mirror类的具体用法?Java Mirror怎么用?Java Mirror使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Mirror类属于net.minecraft.util包,在下文中一共展示了Mirror类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getZeroPositionWithTransform
import net.minecraft.util.Mirror; //导入依赖的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;
}
示例2: setBlockState
import net.minecraft.util.Mirror; //导入依赖的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);
}
}
示例3: getMirroredYaw
import net.minecraft.util.Mirror; //导入依赖的package包/类
/**
* Transforms the entity's current yaw with the given Mirror and returns it. This does not have a side-effect.
*/
public float getMirroredYaw(Mirror transformMirror)
{
float f = MathHelper.wrapDegrees(this.rotationYaw);
switch (transformMirror)
{
case LEFT_RIGHT:
return -f;
case FRONT_BACK:
return 180.0F - f;
default:
return f;
}
}
示例4: getZeroPositionWithTransform
import net.minecraft.util.Mirror; //导入依赖的package包/类
public BlockPos getZeroPositionWithTransform(BlockPos p_189961_1_, Mirror p_189961_2_, Rotation p_189961_3_)
{
int i = this.getSize().getX() - 1;
int j = this.getSize().getZ() - 1;
int k = p_189961_2_ == Mirror.FRONT_BACK ? i : 0;
int l = p_189961_2_ == Mirror.LEFT_RIGHT ? j : 0;
BlockPos blockpos = p_189961_1_;
switch (p_189961_3_)
{
case COUNTERCLOCKWISE_90:
blockpos = p_189961_1_.add(l, 0, i - k);
break;
case CLOCKWISE_90:
blockpos = p_189961_1_.add(j - l, 0, k);
break;
case CLOCKWISE_180:
blockpos = p_189961_1_.add(i - k, 0, j - l);
break;
case NONE:
blockpos = p_189961_1_.add(k, 0, l);
}
return blockpos;
}
示例5: updateMirrorButton
import net.minecraft.util.Mirror; //导入依赖的package包/类
private void updateMirrorButton()
{
Mirror mirror = this.tileStructure.getMirror();
switch (mirror)
{
case NONE:
this.mirrorButton.displayString = "|";
break;
case LEFT_RIGHT:
this.mirrorButton.displayString = "< >";
break;
case FRONT_BACK:
this.mirrorButton.displayString = "^ v";
}
}
示例6: addEntitiesToWorld
import net.minecraft.util.Mirror; //导入依赖的package包/类
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
for (Template.EntityInfo template$entityinfo : this.entities)
{
BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);
if (aabb == null || aabb.isVecInside(blockpos))
{
NBTTagCompound nbttagcompound = template$entityinfo.entityData;
Vec3d vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
Vec3d vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
NBTTagList nbttaglist = new NBTTagList();
nbttaglist.appendTag(new NBTTagDouble(vec3d1.x));
nbttaglist.appendTag(new NBTTagDouble(vec3d1.y));
nbttaglist.appendTag(new NBTTagDouble(vec3d1.z));
nbttagcompound.setTag("Pos", nbttaglist);
nbttagcompound.setUniqueId("UUID", UUID.randomUUID());
Entity entity;
try
{
entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
}
catch (Exception var15)
{
entity = null;
}
if (entity != null)
{
float f = entity.getMirroredYaw(mirrorIn);
f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
entity.setLocationAndAngles(vec3d1.x, vec3d1.y, vec3d1.z, f, entity.rotationPitch);
worldIn.spawnEntity(entity);
}
}
}
}
示例7: transformedBlockPos
import net.minecraft.util.Mirror; //导入依赖的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;
}
}
示例8: transformedVec3d
import net.minecraft.util.Mirror; //导入依赖的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;
}
}
示例9: addEntitiesToWorld
import net.minecraft.util.Mirror; //导入依赖的package包/类
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
for (Template.EntityInfo template$entityinfo : this.entities)
{
BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);
if (aabb == null || aabb.isVecInside(blockpos))
{
NBTTagCompound nbttagcompound = template$entityinfo.entityData;
Vec3d vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
Vec3d vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
NBTTagList nbttaglist = new NBTTagList();
nbttaglist.appendTag(new NBTTagDouble(vec3d1.xCoord));
nbttaglist.appendTag(new NBTTagDouble(vec3d1.yCoord));
nbttaglist.appendTag(new NBTTagDouble(vec3d1.zCoord));
nbttagcompound.setTag("Pos", nbttaglist);
nbttagcompound.setUniqueId("UUID", UUID.randomUUID());
Entity entity;
try
{
entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
}
catch (Exception var15)
{
entity = null;
}
if (entity != null)
{
float f = entity.getMirroredYaw(mirrorIn);
f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
entity.setLocationAndAngles(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, f, entity.rotationPitch);
worldIn.spawnEntityInWorld(entity);
}
}
}
}
示例10: getMirroredYaw
import net.minecraft.util.Mirror; //导入依赖的package包/类
@Override
public float getMirroredYaw(Mirror transformMirror) {
if (m_realPlayer == null) {
return super.getMirroredYaw(transformMirror);
} else {
syncToRealPlayer();
return syncPublicFieldsFromRealAndReturn(m_realPlayer.getMirroredYaw(transformMirror));
}
}
示例11: getMirroredYaw
import net.minecraft.util.Mirror; //导入依赖的package包/类
@Override
public float getMirroredYaw(Mirror transformMirror) {
if (m_realPlayer == null) {
return super.getMirroredYaw(transformMirror);
} else {
return m_realPlayer.getMirroredYaw(transformMirror);
}
}
示例12: getMirroredYaw
import net.minecraft.util.Mirror; //导入依赖的package包/类
/**
* Transforms the entity's current yaw with the given Mirror and returns it. This does not have a side-effect.
*/
public float getMirroredYaw(Mirror transformMirror)
{
float f = MathHelper.wrapDegrees(this.rotationYaw);
switch (transformMirror)
{
case LEFT_RIGHT:
return -f;
case FRONT_BACK:
return 180.0F - f;
default:
return f;
}
}
示例13: withMirror
import net.minecraft.util.Mirror; //导入依赖的package包/类
/**
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
* blockstate.
*/
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
switch (mirrorIn)
{
case LEFT_RIGHT:
return state.withProperty(NORTH, state.getValue(SOUTH)).withProperty(SOUTH, state.getValue(NORTH));
case FRONT_BACK:
return state.withProperty(EAST, state.getValue(WEST)).withProperty(WEST, state.getValue(EAST));
default:
return super.withMirror(state, mirrorIn);
}
}
示例14: transformedVec3d
import net.minecraft.util.Mirror; //导入依赖的package包/类
private static Vec3d transformedVec3d(Vec3d vec, Mirror mirrorIn, Rotation rotationIn)
{
double d0 = vec.xCoord;
double d1 = vec.yCoord;
double d2 = vec.zCoord;
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;
}
}
示例15: func_191157_a
import net.minecraft.util.Mirror; //导入依赖的package包/类
public static BlockPos func_191157_a(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;
}