當前位置: 首頁>>代碼示例>>Java>>正文


Java Mirror類代碼示例

本文整理匯總了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;
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:26,代碼來源:HarshenTemplate.java

示例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);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:20,代碼來源:StructureComponent.java

示例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;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:20,代碼來源:Entity.java

示例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;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:26,代碼來源:Template.java

示例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";
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:GuiEditStructure.java

示例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);
            }
        }
    }
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:39,代碼來源:HarshenTemplate.java

示例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;
    }
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:32,代碼來源:HarshenTemplate.java

示例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;
    }
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:32,代碼來源:HarshenTemplate.java

示例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);
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:39,代碼來源:Template.java

示例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));
	}
}
 
開發者ID:orbwoi,項目名稱:UniversalRemote,代碼行數:10,代碼來源:EntityPlayerMPProxy.java

示例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);
	}
}
 
開發者ID:orbwoi,項目名稱:UniversalRemote,代碼行數:9,代碼來源:EntityPlayerProxy.java

示例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;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:18,代碼來源:Entity.java

示例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);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:17,代碼來源:BlockTripWire.java

示例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;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:37,代碼來源:Template.java

示例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;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:29,代碼來源:Template.java


注:本文中的net.minecraft.util.Mirror類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。