当前位置: 首页>>代码示例>>Java>>正文


Java Direction类代码示例

本文整理汇总了Java中net.minecraft.util.Direction的典型用法代码示例。如果您正苦于以下问题:Java Direction类的具体用法?Java Direction怎么用?Java Direction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Direction类属于net.minecraft.util包,在下文中一共展示了Direction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setInPortal

import net.minecraft.util.Direction; //导入依赖的package包/类
/**
 * Called by portal blocks when an entity is within it.
 */
public void setInPortal()
{
    if (this.timeUntilPortal > 0)
    {
        this.timeUntilPortal = this.getPortalCooldown();
    }
    else
    {
        double d0 = this.prevPosX - this.posX;
        double d1 = this.prevPosZ - this.posZ;

        if (!this.worldObj.isRemote && !this.inPortal)
        {
            this.teleportDirection = Direction.getMovementDirection(d0, d1);
        }

        this.inPortal = true;
    }
}
 
开发者ID:wildex999,项目名称:TickDynamic,代码行数:23,代码来源:Entity.java

示例2: getIcon

import net.minecraft.util.Direction; //导入依赖的package包/类
/**
 * Gets the block's texture. Args: side, meta
 */
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
	if (side == 0)
	{
		return Blocks.planks.getBlockTextureFromSide(side);
	}
	else
	{
		int k = getDirection(meta);
		int l = Direction.bedDirection[k][side];
		int i1 = isBlockHeadOfBed(meta) ? 1 : 0;
		return (i1 != 1 || l != 2) && (i1 != 0 || l != 3) ? (l != 5 && l != 4 ? this.topTexture[i1] : this.sideTexture[i1]) : this.endTexture[i1];
	}
}
 
开发者ID:Tamfoolery,项目名称:HitchhikersGuideToMinecraft,代码行数:19,代码来源:BlockTowel.java

示例3: getIcon

import net.minecraft.util.Direction; //导入依赖的package包/类
@Override
public IIcon getIcon( IBlockAccess world, int i, int j, int k, int side )
{
    if( side == 0 || side == 1 )
    {
        return Icons.Top;
    }

    int metadata = world.getBlockMetadata( i, j, k );
    int direction = Direction.directionToFacing[ getDirection( metadata ) ];
    if( side == direction )
    {
        return Icons.Front;
    }

    return Icons.Side;
}
 
开发者ID:TeacherGaming,项目名称:qcraft-mod,代码行数:18,代码来源:BlockQuantumComputer.java

示例4: generate

import net.minecraft.util.Direction; //导入依赖的package包/类
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
    int var6 = par3;

    for (int var7 = par5; par4 < 128; ++par4)
    {
        if (par1World.isAirBlock(par3, par4, par5))
        {
            for (int var8 = 2; var8 <= 5; ++var8)
            {
                if (Blocks.vine.canPlaceBlockOnSide(par1World, par3, par4, par5, var8))
                {
                    par1World.setBlock(par3, par4, par5, Blocks.vine, 1 << Direction.facingToDirection[Facing.oppositeSide[var8]], 2);
                    break;
                }
            }
        }
        else
        {
            par3 = var6 + par2Random.nextInt(4) - par2Random.nextInt(4);
            par5 = var7 + par2Random.nextInt(4) - par2Random.nextInt(4);
        }
    }

    return true;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:27,代码来源:WorldGenVines.java

示例5: func_147453_f

import net.minecraft.util.Direction; //导入依赖的package包/类
public void func_147453_f(int p_147453_1_, int p_147453_2_, int p_147453_3_, Block p_147453_4_)
{
    for (int var5 = 0; var5 < 4; ++var5)
    {
        int var6 = p_147453_1_ + Direction.offsetX[var5];
        int var7 = p_147453_3_ + Direction.offsetZ[var5];
        Block var8 = this.getBlock(var6, p_147453_2_, var7);

        if (Blocks.unpowered_comparator.func_149907_e(var8))
        {
            var8.onNeighborBlockChange(this, var6, p_147453_2_, var7, p_147453_4_);
        }
        else if (var8.isNormalCube())
        {
            var6 += Direction.offsetX[var5];
            var7 += Direction.offsetZ[var5];
            Block var9 = this.getBlock(var6, p_147453_2_, var7);

            if (Blocks.unpowered_comparator.func_149907_e(var9))
            {
                var9.onNeighborBlockChange(this, var6, p_147453_2_, var7, p_147453_4_);
            }
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:26,代码来源:World.java

示例6: setInPortal

import net.minecraft.util.Direction; //导入依赖的package包/类
/**
 * Called by portal blocks when an entity is within it.
 */
public void setInPortal()
{
    if (this.timeUntilPortal > 0)
    {
        this.timeUntilPortal = this.getPortalCooldown();
    }
    else
    {
        double var1 = this.prevPosX - this.posX;
        double var3 = this.prevPosZ - this.posZ;

        if (!this.worldObj.isClient && !this.inPortal)
        {
            this.teleportDirection = Direction.getMovementDirection(var1, var3);
        }

        this.inPortal = true;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:23,代码来源:Entity.java

示例7: func_150174_f

import net.minecraft.util.Direction; //导入依赖的package包/类
public static boolean func_150174_f(IBlockAccess p_150174_0_, int p_150174_1_, int p_150174_2_, int p_150174_3_, int p_150174_4_)
{
    Block var5 = p_150174_0_.getBlock(p_150174_1_, p_150174_2_, p_150174_3_);

    if (var5 == Blocks.redstone_wire)
    {
        return true;
    }
    else if (!Blocks.unpowered_repeater.func_149907_e(var5))
    {
        return var5.canProvidePower() && p_150174_4_ != -1;
    }
    else
    {
        int var6 = p_150174_0_.getBlockMetadata(p_150174_1_, p_150174_2_, p_150174_3_);
        return p_150174_4_ == (var6 & 3) || p_150174_4_ == Direction.rotateOpposite[var6 & 3];
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:19,代码来源:BlockRedstoneWire.java

示例8: func_150139_a

import net.minecraft.util.Direction; //导入依赖的package包/类
public static boolean func_150139_a(IBlockAccess p_150139_0_, int p_150139_1_, int p_150139_2_, int p_150139_3_, int p_150139_4_, int p_150139_5_)
{
    int var6 = p_150139_1_ + Direction.offsetX[p_150139_5_];
    int var8 = p_150139_3_ + Direction.offsetZ[p_150139_5_];
    Block var9 = p_150139_0_.getBlock(var6, p_150139_2_, var8);
    boolean var10 = (p_150139_4_ & 2) == 2;
    int var11;

    if (var9 == Blocks.tripwire_hook)
    {
        var11 = p_150139_0_.getBlockMetadata(var6, p_150139_2_, var8);
        int var13 = var11 & 3;
        return var13 == Direction.rotateOpposite[p_150139_5_];
    }
    else if (var9 == Blocks.tripwire)
    {
        var11 = p_150139_0_.getBlockMetadata(var6, p_150139_2_, var8);
        boolean var12 = (var11 & 2) == 2;
        return var10 == var12;
    }
    else
    {
        return false;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:26,代码来源:BlockTripWire.java

示例9: func_149903_h

import net.minecraft.util.Direction; //导入依赖的package包/类
protected int func_149903_h(World p_149903_1_, int p_149903_2_, int p_149903_3_, int p_149903_4_, int p_149903_5_)
{
    int var6 = super.func_149903_h(p_149903_1_, p_149903_2_, p_149903_3_, p_149903_4_, p_149903_5_);
    int var7 = func_149895_l(p_149903_5_);
    int var8 = p_149903_2_ + Direction.offsetX[var7];
    int var9 = p_149903_4_ + Direction.offsetZ[var7];
    Block var10 = p_149903_1_.getBlock(var8, p_149903_3_, var9);

    if (var10.hasComparatorInputOverride())
    {
        var6 = var10.getComparatorInputOverride(p_149903_1_, var8, p_149903_3_, var9, Direction.rotateOpposite[var7]);
    }
    else if (var6 < 15 && var10.isNormalCube())
    {
        var8 += Direction.offsetX[var7];
        var9 += Direction.offsetZ[var7];
        var10 = p_149903_1_.getBlock(var8, p_149903_3_, var9);

        if (var10.hasComparatorInputOverride())
        {
            var6 = var10.getComparatorInputOverride(p_149903_1_, var8, p_149903_3_, var9, Direction.rotateOpposite[var7]);
        }
    }

    return var6;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:27,代码来源:BlockRedstoneComparator.java

示例10: doRender

import net.minecraft.util.Direction; //导入依赖的package包/类
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 */
public void doRender(EntityItemFrame par1EntityItemFrame, double par2, double par4, double par6, float par8, float par9)
{
    GL11.glPushMatrix();
    double var10 = par1EntityItemFrame.posX - par2 - 0.5D;
    double var12 = par1EntityItemFrame.posY - par4 - 0.5D;
    double var14 = par1EntityItemFrame.posZ - par6 - 0.5D;
    int var16 = par1EntityItemFrame.field_146063_b + Direction.offsetX[par1EntityItemFrame.hangingDirection];
    int var17 = par1EntityItemFrame.field_146064_c;
    int var18 = par1EntityItemFrame.field_146062_d + Direction.offsetZ[par1EntityItemFrame.hangingDirection];
    GL11.glTranslated((double)var16 - var10, (double)var17 - var12, (double)var18 - var14);

    if (par1EntityItemFrame.getDisplayedItem() != null && par1EntityItemFrame.getDisplayedItem().getItem() == Items.filled_map)
    {
        this.func_147915_b(par1EntityItemFrame);
    }
    else
    {
        this.renderFrameItemAsBlock(par1EntityItemFrame);
    }

    this.func_82402_b(par1EntityItemFrame);
    GL11.glPopMatrix();
    this.func_147914_a(par1EntityItemFrame, par2 + (double)((float)Direction.offsetX[par1EntityItemFrame.hangingDirection] * 0.3F), par4 - 0.25D, par6 + (double)((float)Direction.offsetZ[par1EntityItemFrame.hangingDirection] * 0.3F));
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:31,代码来源:RenderItemFrame.java

示例11: getIcon

import net.minecraft.util.Direction; //导入依赖的package包/类
@SideOnly(Side.CLIENT)

	/**
	 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
	 */
	public Icon getIcon(int par1, int par2) {
		if (par1 == 0) {
			return Block.planks.getBlockTextureFromSide(par1);
		}
		else {
			int k = getDirection(par2);
			int l = Direction.bedDirection[k][par1];
			int i1 = isBlockHeadOfBed(par2) ? 1 : 0;
			return (i1 != 1 || l != 2) && (i1 != 0 || l != 3) ? (l != 5 && l != 4 ? this.bedTopIcons[i1] : this.bedSideIcons[i1]) : this.bedEndIcons[i1];
		}
	}
 
开发者ID:Cojomax99,项目名称:GuestBeds,代码行数:17,代码来源:BlockGuestBed.java

示例12: isPowerProviderOrWire

import net.minecraft.util.Direction; //导入依赖的package包/类
/**
 * Returns true if redstone wire can connect to the specified block. Params: World, X, Y, Z, side (not a normal
 * notch-side, this can be 0, 1, 2, 3 or -1)
 */
public static boolean isPowerProviderOrWire(IBlockAccess p_150174_0_, int p_150174_1_, int p_150174_2_, int p_150174_3_, int p_150174_4_)
{
    Block block = p_150174_0_.getBlock(p_150174_1_, p_150174_2_, p_150174_3_);

    if (block == Blocks.redstone_wire)
    {
        return true;
    }
    else if (!Blocks.unpowered_repeater.func_149907_e(block))
    {
        return block.canConnectRedstone(p_150174_0_, p_150174_1_, p_150174_2_, p_150174_3_, p_150174_4_);
    }
    else
    {
        int i1 = p_150174_0_.getBlockMetadata(p_150174_1_, p_150174_2_, p_150174_3_);
        return p_150174_4_ == (i1 & 3) || p_150174_4_ == Direction.rotateOpposite[i1 & 3];
    }
}
 
开发者ID:static7s,项目名称:RTM,代码行数:23,代码来源:BlockRedstoneWireBlockWIP.java

示例13: isPowerProviderOrWire

import net.minecraft.util.Direction; //导入依赖的package包/类
/**
 * Returns true if redstone wire can connect to the specified block. Params: World, X, Y, Z, side (not a normal
 * notch-side, this can be 0, 1, 2, 3 or -1)
 */
public static boolean isPowerProviderOrWire(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
	Block block = par1IBlockAccess.getBlock(par2, par3, par4);

    if (block == Blocks.redstone_wire)
    {
        return true;
    }
    else if (!Blocks.unpowered_repeater.func_149907_e(block))
    {
        return block.canConnectRedstone(par1IBlockAccess, par2, par3, par4, par5);
    }
    else
    {
        int i1 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
        return par5 == (i1 & 3) || par5 == Direction.rotateOpposite[i1 & 3];
    }
}
 
开发者ID:Geforce132,项目名称:SecurityCraft,代码行数:23,代码来源:BlockEMPedWire.java

示例14: isBlockStateValid

import net.minecraft.util.Direction; //导入依赖的package包/类
private boolean isBlockStateValid (World world, int x, int y, int z) {
    int meta = world.getBlockMetadata(x, y, z);
    int mask = meta;

    if (meta > 0) {
        for (int i = 0; i <= 3; i++) {
            int bit = 1 << i;
            int opSide = Direction.directionToFacing[Direction.rotateOpposite[i]];
            if ((meta & bit) != 0 && !canPlaceOnBlock(world, x + Direction.offsetX[i], y, z + Direction.offsetZ[i], opSide)
                && (world.getBlock(x, y + 1, z) != this || (world.getBlockMetadata(x, y + 1, z) & bit) == 0))
                mask &= ~bit;
        }
    }

    if (mask == 0)
        return false;

    if (mask != meta)
        world.setBlockMetadataWithNotify(x, y, z, mask, 2);

    return true;
}
 
开发者ID:jaquadro,项目名称:GardenCollection,代码行数:23,代码来源:BlockIvy.java

示例15: generate

import net.minecraft.util.Direction; //导入依赖的package包/类
public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_)
{
    int l = p_76484_3_;

    for (int i1 = p_76484_5_; p_76484_4_ < 128; ++p_76484_4_)
    {
        if (p_76484_1_.isAirBlock(p_76484_3_, p_76484_4_, p_76484_5_))
        {
            for (int j1 = 2; j1 <= 5; ++j1)
            {
                if (Blocks.vine.canPlaceBlockOnSide(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_, j1))
                {
                    p_76484_1_.setBlock(p_76484_3_, p_76484_4_, p_76484_5_, Blocks.vine, 1 << Direction.facingToDirection[Facing.oppositeSide[j1]], 2);
                    break;
                }
            }
        }
        else
        {
            p_76484_3_ = l + p_76484_2_.nextInt(4) - p_76484_2_.nextInt(4);
            p_76484_5_ = i1 + p_76484_2_.nextInt(4) - p_76484_2_.nextInt(4);
        }
    }

    return true;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:27,代码来源:WorldGenVines.java


注:本文中的net.minecraft.util.Direction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。