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


Java Rotation.NONE屬性代碼示例

本文整理匯總了Java中net.minecraft.util.Rotation.NONE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Rotation.NONE屬性的具體用法?Java Rotation.NONE怎麽用?Java Rotation.NONE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.util.Rotation的用法示例。


在下文中一共展示了Rotation.NONE屬性的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setBlockState

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,代碼行數:19,代碼來源:StructureComponent.java

示例2: 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();
    }
}
 
開發者ID:Ivorforce,項目名稱:MCOpts,代碼行數:16,代碼來源:MCP.java

示例3: 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);
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:12,代碼來源:DungeonHelper.java

示例4: getStructureBoundingBox

/** Returns the bounding box of the specific template. Used to make sure it doesn't intersect with other rooms. */
public static StructureBoundingBox getStructureBoundingBox(Template template, Rotation rotation, BlockPos center)
{
	int minX = 0;
	int maxX = 0; 
	int minY = 0;
	int maxY = 0;
	int minZ = 0;
	int maxZ = 0;
	
	// we offset everything by one to get the inner room with walls, ceilings, or floors. Rooms can connect through walls so we want those checks to pass.
	if (rotation == Rotation.NONE || rotation == Rotation.CLOCKWISE_180)
	{
		minX = center.getX() - (template.getSize().getX() / 2) - 1;
		maxX = center.getX() + (template.getSize().getX() / 2) - 1;
		minY = center.getY() + 1;
		maxY = center.getY() + template.getSize().getY() - 1;
		minZ = center.getZ() - (template.getSize().getZ() / 2) - 1;
		maxZ = center.getZ() + (template.getSize().getZ() / 2) - 1;
	}
	else
	{
		minX = center.getX() - (template.getSize().getZ() / 2) - 1;
		maxX = center.getX() + (template.getSize().getZ() / 2) - 1;
		minY = center.getY() + 1;
		maxY = center.getY() + template.getSize().getY() - 1;
		minZ = center.getZ() - (template.getSize().getX() / 2) - 1;
		maxZ = center.getZ() + (template.getSize().getX() / 2) - 1;
	}
	
	return new StructureBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:32,代碼來源:DungeonHelper.java

示例5: 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;
    }
}
 
開發者ID:JustinSDK,項目名稱:craftsman,代碼行數:15,代碼來源:Stairs.java

示例6: 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;
    }
}
 
開發者ID:JustinSDK,項目名稱:craftsman,代碼行數:15,代碼來源:Stairs.java

示例7: 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;
}
 
開發者ID:ArekkuusuJerii,項目名稱:Solar,代碼行數:15,代碼來源:FacingHelper.java

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

示例9: func_191129_a

private void func_191129_a(List<WoodlandMansionPieces.MansionTemplate> p_191129_1_, BlockPos p_191129_2_, Rotation p_191129_3_, EnumFacing p_191129_4_, WoodlandMansionPieces.RoomCollection p_191129_5_)
{
    Rotation rotation = Rotation.NONE;
    String s = p_191129_5_.func_191104_a(this.field_191135_b);

    if (p_191129_4_ != EnumFacing.EAST)
    {
        if (p_191129_4_ == EnumFacing.NORTH)
        {
            rotation = rotation.add(Rotation.COUNTERCLOCKWISE_90);
        }
        else if (p_191129_4_ == EnumFacing.WEST)
        {
            rotation = rotation.add(Rotation.CLOCKWISE_180);
        }
        else if (p_191129_4_ == EnumFacing.SOUTH)
        {
            rotation = rotation.add(Rotation.CLOCKWISE_90);
        }
        else
        {
            s = p_191129_5_.func_191099_b(this.field_191135_b);
        }
    }

    BlockPos blockpos = Template.func_191157_a(new BlockPos(1, 0, 0), Mirror.NONE, rotation, 7, 7);
    rotation = rotation.add(p_191129_3_);
    blockpos = blockpos.func_190942_a(p_191129_3_);
    BlockPos blockpos1 = p_191129_2_.add(blockpos.getX(), 0, blockpos.getZ());
    p_191129_1_.add(new WoodlandMansionPieces.MansionTemplate(this.field_191134_a, s, blockpos1, rotation));
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:31,代碼來源:WoodlandMansionPieces.java

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

示例11: 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); 
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:65,代碼來源:DungeonHelper.java

示例12: readFromNBT

public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    this.setName(compound.getString("name"));
    this.author = compound.getString("author");
    this.metadata = compound.getString("metadata");
    int i = MathHelper.clamp(compound.getInteger("posX"), -32, 32);
    int j = MathHelper.clamp(compound.getInteger("posY"), -32, 32);
    int k = MathHelper.clamp(compound.getInteger("posZ"), -32, 32);
    this.position = new BlockPos(i, j, k);
    int l = MathHelper.clamp(compound.getInteger("sizeX"), 0, 32);
    int i1 = MathHelper.clamp(compound.getInteger("sizeY"), 0, 32);
    int j1 = MathHelper.clamp(compound.getInteger("sizeZ"), 0, 32);
    this.size = new BlockPos(l, i1, j1);

    try
    {
        this.rotation = Rotation.valueOf(compound.getString("rotation"));
    }
    catch (IllegalArgumentException var11)
    {
        this.rotation = Rotation.NONE;
    }

    try
    {
        this.mirror = Mirror.valueOf(compound.getString("mirror"));
    }
    catch (IllegalArgumentException var10)
    {
        this.mirror = Mirror.NONE;
    }

    try
    {
        this.mode = TileEntityStructure.Mode.valueOf(compound.getString("mode"));
    }
    catch (IllegalArgumentException var9)
    {
        this.mode = TileEntityStructure.Mode.DATA;
    }

    this.ignoreEntities = compound.getBoolean("ignoreEntities");
    this.powered = compound.getBoolean("powered");
    this.showAir = compound.getBoolean("showair");
    this.showBoundingBox = compound.getBoolean("showboundingbox");

    if (compound.hasKey("integrity"))
    {
        this.integrity = compound.getFloat("integrity");
    }
    else
    {
        this.integrity = 1.0F;
    }

    this.seed = compound.getLong("seed");
    this.updateBlockState();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:59,代碼來源:TileEntityStructure.java

示例13: readFromNBT

public void readFromNBT(NBTTagCompound compound)
{
    super.readFromNBT(compound);
    this.setName(compound.getString("name"));
    this.author = compound.getString("author");
    this.metadata = compound.getString("metadata");
    int i = MathHelper.clamp_int(compound.getInteger("posX"), -32, 32);
    int j = MathHelper.clamp_int(compound.getInteger("posY"), -32, 32);
    int k = MathHelper.clamp_int(compound.getInteger("posZ"), -32, 32);
    this.position = new BlockPos(i, j, k);
    int l = MathHelper.clamp_int(compound.getInteger("sizeX"), 0, 32);
    int i1 = MathHelper.clamp_int(compound.getInteger("sizeY"), 0, 32);
    int j1 = MathHelper.clamp_int(compound.getInteger("sizeZ"), 0, 32);
    this.size = new BlockPos(l, i1, j1);

    try
    {
        this.rotation = Rotation.valueOf(compound.getString("rotation"));
    }
    catch (IllegalArgumentException var11)
    {
        this.rotation = Rotation.NONE;
    }

    try
    {
        this.mirror = Mirror.valueOf(compound.getString("mirror"));
    }
    catch (IllegalArgumentException var10)
    {
        this.mirror = Mirror.NONE;
    }

    try
    {
        this.mode = TileEntityStructure.Mode.valueOf(compound.getString("mode"));
    }
    catch (IllegalArgumentException var9)
    {
        this.mode = TileEntityStructure.Mode.DATA;
    }

    this.ignoreEntities = compound.getBoolean("ignoreEntities");
    this.powered = compound.getBoolean("powered");
    this.showAir = compound.getBoolean("showair");
    this.showBoundingBox = compound.getBoolean("showboundingbox");

    if (compound.hasKey("integrity"))
    {
        this.integrity = compound.getFloat("integrity");
    }
    else
    {
        this.integrity = 1.0F;
    }

    this.seed = compound.getLong("seed");
    this.updateBlockState();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:59,代碼來源:TileEntityStructure.java


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