Java 类net.minecraft.util.Facing 实例源码

项目:ExtraUtilities    文件:PartWall.java   
@Override
public void reloadShape() {
    final int prevMask = this.connectionMask;
    this.connectionMask = 0;
    for (int i = 2; i < 6; ++i) {
        if (this.shouldConnect(this.x() + Facing.offsetsXForSide[i], this.y() + Facing.offsetsYForSide[i], this.z() + Facing.offsetsZForSide[i], i)) {
            this.connectionMask |= 1 << i;
        }
    }
    if (!this.world().isAirBlock(this.x(), this.y() + 1, this.z()) || (this.connectionMask != 12 && this.connectionMask != 48)) {
        this.connectionMask |= 0x2;
    }
    if (prevMask != this.connectionMask) {
        this.tile().notifyPartChange((TMultiPart)this);
        this.tile().markRender();
    }
}
项目:ExtraUtilities    文件:PartWall.java   
@SideOnly(Side.CLIENT)
@Override
public boolean renderStatic(final Vector3 pos, final int pass) {
    this.reloadShape();
    if (this.mat == null) {
        this.mat = MicroMaterialRegistry.getMaterial(this.material);
    }
    final boolean hasCenter = (this.connectionMask & 0x2) != 0x0;
    if (this.mat != null && this.mat.canRenderInPass(pass)) {
        if (hasCenter) {
            MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, this.getRenderBounds(), 0);
        }
        for (int i = 2; i < 6; ++i) {
            if ((this.connectionMask & 1 << i) != 0x0) {
                MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, hasCenter ? PartWall.renderCuboids1[i] : PartWall.renderCuboids2[i], 1 << Facing.oppositeSide[i] | 1 << i);
            }
        }
        return true;
    }
    return false;
}
项目:ExtraUtilities    文件:PartPipeJacket.java   
@SideOnly(Side.CLIENT)
@Override
public boolean renderStatic(final Vector3 pos, final int pass) {
    this.reloadShape();
    if (this.mat == null) {
        this.mat = MicroMaterialRegistry.getMaterial(this.material);
    }
    if (this.mat != null && this.mat.canRenderInPass(pass)) {
        MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, this.getRenderBounds(), this.connectionMask);
        for (int i = 0; i < 6; ++i) {
            if ((this.connectionMask & 1 << i) != 0x0) {
                MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, new Cuboid6(0.5 - this.pipeSize, 0.5 + this.pipeSize, 0.5 - this.pipeSize, 0.5 + this.pipeSize, 1.0, 0.5 + this.pipeSize).apply(Rotation.sideRotations[Facing.oppositeSide[i]].at(new Vector3(0.5, 0.5, 0.5))), 1 << Facing.oppositeSide[i]);
            }
        }
        return true;
    }
    return false;
}
项目:ExtraUtilities    文件:PartFence.java   
@SideOnly(Side.CLIENT)
@Override
public boolean renderStatic(final Vector3 pos, final int pass) {
    this.reloadShape();
    if (this.mat == null) {
        this.mat = MicroMaterialRegistry.getMaterial(this.material);
    }
    if (this.mat != null && this.mat.canRenderInPass(pass)) {
        MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, this.getRenderBounds(), 0);
        for (int i = 0; i < 6; ++i) {
            if ((this.connectionMask & 1 << i) != 0x0) {
                MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, PartFence.renderCuboids1[i], 1 << Facing.oppositeSide[i] | 1 << i);
                MicroblockRender.renderCuboid(new Vector3((double)this.x(), (double)this.y(), (double)this.z()), this.mat, pass, PartFence.renderCuboids2[i], 1 << Facing.oppositeSide[i] | 1 << i);
            }
        }
        return true;
    }
    return false;
}
项目:ExtraUtilities    文件:FakeRenderBlocks.java   
public byte getType(final Block block, final int side, final int x, final int y, final int z, final int ax, final int ay, final int az, final int bx, final int by, final int bz, final int cx, final int cy, final int cz) {
    final int sidea = this.getSideFromDir(ax, ay, az);
    final int sideb = this.getSideFromDir(bx, by, bz);
    final boolean a = this.matchBlock(side, x + ax, y + ay, z + az) && !this.matchBlock(sidea, x + cx, y + cy, z + cz) && !this.matchBlock(Facing.oppositeSide[sidea], x + ax + cx, y + ay + cy, z + az + cz);
    final boolean b = this.matchBlock(side, x + bx, y + by, z + bz) && !this.matchBlock(sideb, x + cx, y + cy, z + cz) && !this.matchBlock(Facing.oppositeSide[sideb], x + bx + cx, y + by + cy, z + bz + cz);
    if (a) {
        if (!b) {
            return 2;
        }
        if (!this.matchBlock(side, x + ax + bx, y + ay + by, z + az + bz)) {
            return 4;
        }
        if (this.matchBlock(Facing.oppositeSide[sidea], x + ax + bx + cx, y + ay + by + cy, z + az + bz + cz) || this.matchBlock(Facing.oppositeSide[sideb], x + ax + bx + cx, y + ay + by + cy, z + az + bz + cz) || this.matchBlock(sidea, x + bx + cx, y + by + cy, z + bz + cz) || this.matchBlock(sideb, x + ax + cx, y + ay + cy, z + az + cz)) {
            return 4;
        }
        return 3;
    }
    else {
        if (b) {
            return 1;
        }
        return 0;
    }
}
项目:ExtraUtilities    文件:RenderBlockSpike.java   
public int calcRotation(final int side, final int direction) {
    if (side == direction) {
        return 0;
    }
    if (side == Facing.oppositeSide[direction]) {
        return 0;
    }
    if (direction == 1) {
        return 0;
    }
    if (direction == 0) {
        return 2;
    }
    if (side == 0 || side == 1) {
        return (new int[] { 0, 2, 3, 1 })[direction - 2];
    }
    return 1 + (side + direction + direction / 2) % 2 * 2;
}
项目:ExtraUtilities    文件:BlockFilingCabinet.java   
@SideOnly(Side.CLIENT)
public IIcon getIcon(final int par1, final int par2) {
    final int side = par2 % 6;
    final int type = par2 / 6;
    if (type > 1) {
        return null;
    }
    if (par2 < 2) {
        if (par1 == 4) {
            return this.icon[par2 * 3];
        }
        if (par1 == 5) {
            return this.icon[2 + par2 * 3];
        }
        return this.icon[1 + par2 * 3];
    }
    else {
        if (par1 == side) {
            return this.icon[type * 3];
        }
        if (par1 == Facing.oppositeSide[side]) {
            return this.icon[2 + type * 3];
        }
        return this.icon[1 + type * 3];
    }
}
项目:ExtraUtilities    文件:BlockSpike.java   
public void doPostAttack(final World world, final Entity target, final TileEntity tile, final int x, final int y, final int z) {
    if (!(tile instanceof TileEntityEnchantedSpike)) {
        return;
    }
    final ItemStack stack = this.swordStack.copy();
    stack.setTagCompound(((TileEntityEnchantedSpike)tile).getEnchantmentTagList());
    final int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.knockback.effectId, stack);
    if (i > 0) {
        final int m = world.getBlockMetadata(x, y, z) % 6;
        final float dx = Facing.offsetsXForSide[m];
        final float dz = Facing.offsetsZForSide[m];
        target.addVelocity((double)(-dx * i * 0.5f), 0.1, (double)(-dz * i * 0.5f));
    }
    final int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack);
    if (j > 0) {
        target.setFire(j * 4);
    }
}
项目:ExtraUtilities    文件:TileEntityEnderQuarry.java   
public void detectInventories() {
    this.inventoryMask = 0;
    this.fluidMask = 0;
    this.upgrades = new boolean[16];
    for (int i = 0; i < 6; ++i) {
        final int x = this.xCoord + Facing.offsetsXForSide[i];
        final int y = this.yCoord + Facing.offsetsYForSide[i];
        final int z = this.zCoord + Facing.offsetsZForSide[i];
        final TileEntity tile = this.worldObj.getTileEntity(x, y, z);
        if (tile instanceof IInventory) {
            this.inventoryMask |= 1 << i;
        }
        if (tile instanceof IFluidHandler) {
            this.fluidMask |= 1 << i;
        }
        if (this.worldObj.getBlock(x, y, z) == ExtraUtils.enderQuarryUpgrade) {
            this.upgrades[this.worldObj.getBlockMetadata(x, y, z)] = true;
        }
    }
}
项目:CCFactoryManager    文件:UpgradeTool.java   
private TurtleCommandResult dig(ITurtleAccess turtle, int dir) {
    final World world = turtle.getWorld();
    final ChunkCoordinates coordinates = turtle.getPosition();
    int x = coordinates.posX + Facing.offsetsXForSide[dir];
    int y = coordinates.posY + Facing.offsetsYForSide[dir];
    int z = coordinates.posZ + Facing.offsetsZForSide[dir];

    final Block block = world.getBlock(x, y, z);
    if (!world.isAirBlock(x, y, z) && block.getBlockHardness(world, x, y, z) > -1f && canHarvestBlock(world, x, y, z)) {
        try {
            final ArrayList<ItemStack> result = harvestBlock(world, x, y, z);
            if (result != null) {
                store(turtle, result);
                world.setBlockToAir(x, y, z);
                world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + world.getBlockMetadata(x, y, z) * 4096);
                return TurtleCommandResult.success();
            }
        } catch (TurtleFailureDig e) {
            return TurtleCommandResult.failure(e.getMessage());
        }
    }

    return TurtleCommandResult.failure(getDigFailureMessage());
}
项目:Resilience-Client-Source    文件:WorldGenVines.java   
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;
}
项目:Resilience-Client-Source    文件:World.java   
public int getStrongestIndirectPower(int par1, int par2, int par3)
{
    int var4 = 0;

    for (int var5 = 0; var5 < 6; ++var5)
    {
        int var6 = this.getIndirectPowerLevelTo(par1 + Facing.offsetsXForSide[var5], par2 + Facing.offsetsYForSide[var5], par3 + Facing.offsetsZForSide[var5], var5);

        if (var6 >= 15)
        {
            return 15;
        }

        if (var6 > var4)
        {
            var4 = var6;
        }
    }

    return var4;
}
项目:Resilience-Client-Source    文件:BlockPistonExtension.java   
/**
 * Called when the block is attempted to be harvested
 */
public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_)
{
    if (p_149681_6_.capabilities.isCreativeMode)
    {
        int var7 = func_150085_b(p_149681_5_);
        Block var8 = p_149681_1_.getBlock(p_149681_2_ - Facing.offsetsXForSide[var7], p_149681_3_ - Facing.offsetsYForSide[var7], p_149681_4_ - Facing.offsetsZForSide[var7]);

        if (var8 == Blocks.piston || var8 == Blocks.sticky_piston)
        {
            p_149681_1_.setBlockToAir(p_149681_2_ - Facing.offsetsXForSide[var7], p_149681_3_ - Facing.offsetsYForSide[var7], p_149681_4_ - Facing.offsetsZForSide[var7]);
        }
    }

    super.onBlockHarvested(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, p_149681_6_);
}
项目:Resilience-Client-Source    文件:BlockPistonExtension.java   
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
{
    super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
    int var7 = Facing.oppositeSide[func_150085_b(p_149749_6_)];
    p_149749_2_ += Facing.offsetsXForSide[var7];
    p_149749_3_ += Facing.offsetsYForSide[var7];
    p_149749_4_ += Facing.offsetsZForSide[var7];
    Block var8 = p_149749_1_.getBlock(p_149749_2_, p_149749_3_, p_149749_4_);

    if (var8 == Blocks.piston || var8 == Blocks.sticky_piston)
    {
        p_149749_6_ = p_149749_1_.getBlockMetadata(p_149749_2_, p_149749_3_, p_149749_4_);

        if (BlockPistonBase.func_150075_c(p_149749_6_))
        {
            var8.dropBlockAsItem(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_6_, 0);
            p_149749_1_.setBlockToAir(p_149749_2_, p_149749_3_, p_149749_4_);
        }
    }
}
项目:Resilience-Client-Source    文件:BlockBreakable.java   
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
{
    Block var6 = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);

    if (this == Blocks.glass || this == Blocks.stained_glass)
    {
        if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]))
        {
            return true;
        }

        if (var6 == this)
        {
            return false;
        }
    }

    return !this.field_149996_a && var6 == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
}
项目:Resilience-Client-Source    文件:BlockSlab.java   
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
{
    if (this.field_150004_a)
    {
        return super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
    }
    else if (p_149646_5_ != 1 && p_149646_5_ != 0 && !super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_))
    {
        return false;
    }
    else
    {
        int var6 = p_149646_2_ + Facing.offsetsXForSide[Facing.oppositeSide[p_149646_5_]];
        int var7 = p_149646_3_ + Facing.offsetsYForSide[Facing.oppositeSide[p_149646_5_]];
        int var8 = p_149646_4_ + Facing.offsetsZForSide[Facing.oppositeSide[p_149646_5_]];
        boolean var9 = (p_149646_1_.getBlockMetadata(var6, var7, var8) & 8) != 0;
        return var9 ? (p_149646_5_ == 0 ? true : (p_149646_5_ == 1 && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_) ? true : !func_150003_a(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)) || (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) & 8) == 0)) : (p_149646_5_ == 1 ? true : (p_149646_5_ == 0 && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_) ? true : !func_150003_a(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)) || (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) & 8) != 0));
    }
}
项目:RobotPlates    文件:ItemRobot.java   
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float px, float py, float pz) {
    if (world.isRemote) return true;

    x += Facing.offsetsXForSide[side];
    y += Facing.offsetsYForSide[side];
    z += Facing.offsetsZForSide[side];

    x += 0.5f;
    z += 0.5f;

    Entity e = spawnNewRobot(world, itemStack);
    e.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
    world.spawnEntityInWorld(e);
    return true;
}
项目:RuneCraftery    文件:TileEntityPiston.java   
private void func_70335_a(float p_70335_1_, float p_70335_2_) {
   if(this.field_70344_d) {
      p_70335_1_ = 1.0F - p_70335_1_;
   } else {
      --p_70335_1_;
   }

   AxisAlignedBB var3 = Block.field_72095_ac.func_72296_b(this.field_70331_k, this.field_70329_l, this.field_70330_m, this.field_70327_n, this.field_70348_a, p_70335_1_, this.field_70347_c);
   if(var3 != null) {
      List var4 = this.field_70331_k.func_72839_b((Entity)null, var3);
      if(!var4.isEmpty()) {
         this.field_70349_h.addAll(var4);
         Iterator var5 = this.field_70349_h.iterator();

         while(var5.hasNext()) {
            Entity var6 = (Entity)var5.next();
            var6.func_70091_d((double)(p_70335_2_ * (float)Facing.field_71586_b[this.field_70347_c]), (double)(p_70335_2_ * (float)Facing.field_71587_c[this.field_70347_c]), (double)(p_70335_2_ * (float)Facing.field_71585_d[this.field_70347_c]));
         }

         this.field_70349_h.clear();
      }
   }

}
项目:Nuclear-Control    文件:ScreenManager.java   
private Screen tryBuildFromPanel(TileEntityInfoPanel panel) {
    boolean advanced = panel instanceof TileEntityAdvancedInfoPanel;
    Screen screen = new Screen();
    screen.maxX = screen.minX = panel.xCoord;
    screen.maxY = screen.minY = panel.yCoord;
    screen.maxZ = screen.minZ = panel.zCoord;
    screen.setCore(panel);
    int dx = Facing.offsetsXForSide[panel.facing] != 0 ? 0 : -1;
    int dy = Facing.offsetsYForSide[panel.facing] != 0 ? 0 : -1;
    int dz = Facing.offsetsZForSide[panel.facing] != 0 ? 0 : -1;
    updateScreenBound(screen, dx, 0, 0, panel.getWorldObj(), advanced);
    updateScreenBound(screen, -dx, 0, 0, panel.getWorldObj(), advanced);
    updateScreenBound(screen, 0, dy, 0, panel.getWorldObj(), advanced);
    updateScreenBound(screen, 0, -dy, 0, panel.getWorldObj(), advanced);
    updateScreenBound(screen, 0, 0, dz, panel.getWorldObj(), advanced);
    updateScreenBound(screen, 0, 0, -dz, panel.getWorldObj(), advanced);
    screen.init(false, panel.getWorldObj());
    panel.updateData();
    return screen;
}
项目:Nuclear-Control    文件:BlockNuclearControlMain.java   
/**
 * Called whenever the block is added into the world.
 */
@Override
public void onBlockAdded(World world, int x, int y, int z) {
    super.onBlockAdded(world, x, y, z);
    int metadata = world.getBlockMetadata(x, y, z);
    if (metadata > BlockDamages.DAMAGE_MAX) {
        metadata = 0;
    }

    if (isSolidBlockRequired(metadata))
        for (int face = 0; face < 6; face++) {
            int side = Facing.oppositeSide[face];
            if (world.isSideSolid(x + Facing.offsetsXForSide[side], y
                    + Facing.offsetsYForSide[side], z
                    + Facing.offsetsZForSide[side],
                    ForgeDirection.getOrientation(face))) {
                TileEntity tileentity = world.getTileEntity(x, y, z);
                if (tileentity instanceof IWrenchable) {
                    ((IWrenchable) tileentity).setFacing((short) face);
                }
                break;
            }
        }
    dropBlockIfCantStay(world, x, y, z);
}
项目:RuneCraftery    文件:BlockPistonMoving.java   
public void func_71902_a(IBlockAccess p_71902_1_, int p_71902_2_, int p_71902_3_, int p_71902_4_) {
   TileEntityPiston var5 = this.func_72295_d(p_71902_1_, p_71902_2_, p_71902_3_, p_71902_4_);
   if(var5 != null) {
      Block var6 = Block.field_71973_m[var5.func_70340_a()];
      if(var6 == null || var6 == this) {
         return;
      }

      var6.func_71902_a(p_71902_1_, p_71902_2_, p_71902_3_, p_71902_4_);
      float var7 = var5.func_70333_a(0.0F);
      if(var5.func_70341_b()) {
         var7 = 1.0F - var7;
      }

      int var8 = var5.func_70336_c();
      this.field_72026_ch = var6.func_83009_v() - (double)((float)Facing.field_71586_b[var8] * var7);
      this.field_72023_ci = var6.func_83008_x() - (double)((float)Facing.field_71587_c[var8] * var7);
      this.field_72024_cj = var6.func_83005_z() - (double)((float)Facing.field_71585_d[var8] * var7);
      this.field_72021_ck = var6.func_83007_w() - (double)((float)Facing.field_71586_b[var8] * var7);
      this.field_72022_cl = var6.func_83010_y() - (double)((float)Facing.field_71587_c[var8] * var7);
      this.field_72019_cm = var6.func_83006_A() - (double)((float)Facing.field_71585_d[var8] * var7);
   }

}
项目:RuneCraftery    文件:WorldGenVines.java   
public boolean func_76484_a(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) {
   int var6 = p_76484_3_;

   for(int var7 = p_76484_5_; p_76484_4_ < 128; ++p_76484_4_) {
      if(p_76484_1_.func_72799_c(p_76484_3_, p_76484_4_, p_76484_5_)) {
         for(int var8 = 2; var8 <= 5; ++var8) {
            if(Block.field_71998_bu.func_71850_a_(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_, var8)) {
               p_76484_1_.func_72832_d(p_76484_3_, p_76484_4_, p_76484_5_, Block.field_71998_bu.field_71990_ca, 1 << Direction.field_71579_d[Facing.field_71588_a[var8]], 2);
               break;
            }
         }
      } else {
         p_76484_3_ = var6 + p_76484_2_.nextInt(4) - p_76484_2_.nextInt(4);
         p_76484_5_ = var7 + p_76484_2_.nextInt(4) - p_76484_2_.nextInt(4);
      }
   }

   return true;
}
项目:Realms-of-Chaos    文件:BlockIcePortal.java   
@Override
@SideOnly(Side.CLIENT)
   public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
   {
       Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
           if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]))
           {
               return true;
           }

           if (block == this)
           {
               return false;
           }

       return block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
   }
项目:RuneCraftery    文件:BlockPistonExtension.java   
/**
 * Called when the block is attempted to be harvested
 */
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer)
{
    if (par6EntityPlayer.capabilities.isCreativeMode)
    {
        int i1 = getDirectionMeta(par5);
        int j1 = par1World.getBlockId(par2 - Facing.offsetsXForSide[i1], par3 - Facing.offsetsYForSide[i1], par4 - Facing.offsetsZForSide[i1]);

        if (j1 == Block.pistonBase.blockID || j1 == Block.pistonStickyBase.blockID)
        {
            par1World.setBlockToAir(par2 - Facing.offsetsXForSide[i1], par3 - Facing.offsetsYForSide[i1], par4 - Facing.offsetsZForSide[i1]);
        }
    }

    super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer);
}
项目:peripheral-framework    文件:UpgradeTool.java   
private TurtleCommandResult dig(ITurtleAccess turtle, int dir) {
    final World world = turtle.getWorld();
    final ChunkCoordinates coordinates = turtle.getPosition();
    int x = coordinates.posX + Facing.offsetsXForSide[dir];
    int y = coordinates.posY + Facing.offsetsYForSide[dir];
    int z = coordinates.posZ + Facing.offsetsZForSide[dir];

    final Block block = world.getBlock(x, y, z);
    if (!world.isAirBlock(x, y, z) && block.getBlockHardness(world, x, y, z) > -1f && canHarvestBlock(world, x, y, z)) {
        try {
            final ArrayList<ItemStack> result = harvestBlock(world, x, y, z);
            if (result != null) {
                store(turtle, result);
                world.setBlockToAir(x, y, z);
                world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + world.getBlockMetadata(x, y, z) * 4096);
                return TurtleCommandResult.success();
            }
        } catch (TurtleDigException e) {
            return TurtleCommandResult.failure(e.getMessage());
        }
    }

    return TurtleCommandResult.failure(getDigFailureMessage());
}
项目:MyMod    文件:BlockZero.java   
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y,
                                    int z, int side) {

    Block block = world.getBlock(x, y, z);

    if (world.getBlockMetadata(x, y, z) != world.getBlockMetadata(x
            - Facing.offsetsXForSide[side], y
            - Facing.offsetsYForSide[side], z
            - Facing.offsetsZForSide[side])) {
        return true;
    }

    if (block == this) {
        return false;
    }

    return block == this ? false : super.shouldSideBeRendered(world, x, y,
            z, side);
}
项目:RuneCraftery    文件:BlockHalfSlab.java   
@SideOnly(Side.CLIENT)

    /**
     * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
     * coordinates.  Args: blockAccess, x, y, z, side
     */
    public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
    {
        if (this.isDoubleSlab)
        {
            return super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
        }
        else if (par5 != 1 && par5 != 0 && !super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5))
        {
            return false;
        }
        else
        {
            int i1 = par2 + Facing.offsetsXForSide[Facing.oppositeSide[par5]];
            int j1 = par3 + Facing.offsetsYForSide[Facing.oppositeSide[par5]];
            int k1 = par4 + Facing.offsetsZForSide[Facing.oppositeSide[par5]];
            boolean flag = (par1IBlockAccess.getBlockMetadata(i1, j1, k1) & 8) != 0;
            return flag ? (par5 == 0 ? true : (par5 == 1 && super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5) ? true : !isBlockSingleSlab(par1IBlockAccess.getBlockId(par2, par3, par4)) || (par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 8) == 0)) : (par5 == 1 ? true : (par5 == 0 && super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5) ? true : !isBlockSingleSlab(par1IBlockAccess.getBlockId(par2, par3, par4)) || (par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 8) != 0));
        }
    }
项目:PeripheralsPlusPlus    文件:TileInteractiveSorter.java   
public static void outputItem(TileEntity tile, ItemStack stack, int direction) {
    for (IInteractiveSorterOutput output : IInteractiveSorterOutput.handlers) {
        output.output(stack, tile.worldObj, tile.xCoord,tile. yCoord, tile.zCoord, direction);
        if (stack.stackSize <= 0) break;
    }

    if (stack.stackSize > 0) { // drop
        float xoff = tile.worldObj.rand.nextFloat() * 0.8F + 0.1F + (0.5F * Facing.offsetsXForSide[direction]);
        float yoff = tile.worldObj.rand.nextFloat() * 0.8F + 0.1F + (0.5F * Facing.offsetsYForSide[direction]);
        float zoff = tile.worldObj.rand.nextFloat() * 0.8F + 0.1F + (0.5F * Facing.offsetsZForSide[direction]);

        EntityItem item = new EntityItem(tile.worldObj, tile.xCoord + xoff, tile.yCoord + yoff, tile.zCoord + zoff, stack.copy());
        item.delayBeforeCanPickup = 10;
        item.motionX = (float)tile.worldObj.rand.nextGaussian() * 0.05F + Facing.offsetsXForSide[direction];
        item.motionY = (float)tile.worldObj.rand.nextGaussian() * 0.05F + Facing.offsetsYForSide[direction];
        item.motionZ = (float)tile.worldObj.rand.nextGaussian() * 0.05F + Facing.offsetsZForSide[direction];

        tile.worldObj.spawnEntityInWorld(item);
        stack.stackSize = 0;
    }
}
项目:RuneCraftery    文件:TileEntityHopper.java   
private boolean func_94116_j() {
   IInventory var1 = this.func_94119_v();
   if(var1 == null) {
      return false;
   } else {
      for(int var2 = 0; var2 < this.func_70302_i_(); ++var2) {
         if(this.func_70301_a(var2) != null) {
            ItemStack var3 = this.func_70301_a(var2).func_77946_l();
            ItemStack var4 = func_94117_a(var1, this.func_70298_a(var2, 1), Facing.field_71588_a[BlockHopper.func_94451_c(this.func_70322_n())]);
            if(var4 == null || var4.field_77994_a == 0) {
               var1.func_70296_d();
               return true;
            }

            this.func_70299_a(var2, var3);
         }
      }

      return false;
   }
}
项目:BackWoodsMod    文件:BlockTBWSlab.java   
/**
 * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
 * coordinates.  Args: blockAccess, x, y, z, side
 */
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
{
    if (this.field_150004_a)
    {
        return super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
    }
    else if (p_149646_5_ != 1 && p_149646_5_ != 0 && !super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_))
    {
        return false;
    }
    else
    {
        int i1 = p_149646_2_ + Facing.offsetsXForSide[Facing.oppositeSide[p_149646_5_]];
        int j1 = p_149646_3_ + Facing.offsetsYForSide[Facing.oppositeSide[p_149646_5_]];
        int k1 = p_149646_4_ + Facing.offsetsZForSide[Facing.oppositeSide[p_149646_5_]];
        boolean flag = (p_149646_1_.getBlockMetadata(i1, j1, k1) & 8) != 0;
        return flag ? (p_149646_5_ == 0 ? true : (p_149646_5_ == 1 && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_) ? true : !func_150003_a(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)) || (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) & 8) == 0)) : (p_149646_5_ == 1 ? true : (p_149646_5_ == 0 && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_) ? true : !func_150003_a(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)) || (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) & 8) != 0));
    }
}
项目:Realms-of-Chaos    文件:BlockFakeIce.java   
@Override
@SideOnly(Side.CLIENT)
   public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
   {
       Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
           if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]))
           {
               return true;
           }

           if (block == this)
           {
               return false;
           }

       return block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
   }
项目:IceAndShadow2    文件:GenThornyVines.java   
@Override
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) {
    final int l = par3;

    for (final int i1 = par5; par4 < 256; ++par4)
        if (par1World.isAirBlock(par3, par4, par5)) {
            for (int j1 = 2; j1 <= 5; ++j1)
                if (Blocks.vine.canPlaceBlockOnSide(par1World, par3, par4, par5, j1)) {
                    par1World.setBlock(par3, par4, par5, NyxBlocks.thornyVines,
                            1 << Direction.facingToDirection[Facing.oppositeSide[j1]], 2);
                    break;
                }
        } else {
            par3 = l + par2Random.nextInt(4) - par2Random.nextInt(4);
            par5 = i1 + par2Random.nextInt(4) - par2Random.nextInt(4);
        }

    return true;
}
项目:Cauldron    文件:WorldGenVines.java   
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;
}
项目:Cauldron    文件:BlockPistonExtension.java   
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
{
    super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);

    if ((p_149749_6_ & 7) >= Facing.oppositeSide.length)
    {
        return;    // CraftBukkit - fix a piston AIOOBE issue
    }

    int i1 = Facing.oppositeSide[getDirectionMeta(p_149749_6_)];
    p_149749_2_ += Facing.offsetsXForSide[i1];
    p_149749_3_ += Facing.offsetsYForSide[i1];
    p_149749_4_ += Facing.offsetsZForSide[i1];
    Block block1 = p_149749_1_.getBlock(p_149749_2_, p_149749_3_, p_149749_4_);

    if (block1 == Blocks.piston || block1 == Blocks.sticky_piston)
    {
        p_149749_6_ = p_149749_1_.getBlockMetadata(p_149749_2_, p_149749_3_, p_149749_4_);

        if (BlockPistonBase.isExtended(p_149749_6_))
        {
            block1.dropBlockAsItem(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_6_, 0);
            p_149749_1_.setBlockToAir(p_149749_2_, p_149749_3_, p_149749_4_);
        }
    }
}
项目:Cauldron    文件:BlockPistonExtension.java   
public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
{
    int l = getDirectionMeta(p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_));

    if ((l & 7) >= Facing.oppositeSide.length)
    {
        return;    // CraftBukkit - fix a piston AIOOBE issue
    }

    Block block1 = p_149695_1_.getBlock(p_149695_2_ - Facing.offsetsXForSide[l], p_149695_3_ - Facing.offsetsYForSide[l], p_149695_4_ - Facing.offsetsZForSide[l]);

    if (block1 != Blocks.piston && block1 != Blocks.sticky_piston)
    {
        p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
    }
    else
    {
        block1.onNeighborBlockChange(p_149695_1_, p_149695_2_ - Facing.offsetsXForSide[l], p_149695_3_ - Facing.offsetsYForSide[l], p_149695_4_ - Facing.offsetsZForSide[l], p_149695_5_);
    }
}
项目:MysticalTrinkets    文件:BlockShardGlass.java   
/**
 * Returns true if the given side of this block type should be rendered, if
 * the adjacent block is at the given coordinates. Args: blockAccess, x, y,
 * z, side
 */
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
    Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);

    if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_])) {
        return true;
    }

    if (block == this) {
        return false;
    }

    return !false && block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
}
项目:Cauldron    文件:BlockSlab.java   
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
{
    if (this.field_150004_a)
    {
        return super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
    }
    else if (p_149646_5_ != 1 && p_149646_5_ != 0 && !super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_))
    {
        return false;
    }
    else
    {
        int i1 = p_149646_2_ + Facing.offsetsXForSide[Facing.oppositeSide[p_149646_5_]];
        int j1 = p_149646_3_ + Facing.offsetsYForSide[Facing.oppositeSide[p_149646_5_]];
        int k1 = p_149646_4_ + Facing.offsetsZForSide[Facing.oppositeSide[p_149646_5_]];
        boolean flag = (p_149646_1_.getBlockMetadata(i1, j1, k1) & 8) != 0;
        return flag ? (p_149646_5_ == 0 ? true : (p_149646_5_ == 1 && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_) ? true : !func_150003_a(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)) || (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) & 8) == 0)) : (p_149646_5_ == 1 ? true : (p_149646_5_ == 0 && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_) ? true : !func_150003_a(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)) || (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) & 8) != 0));
    }
}
项目:RuneCraftery    文件:BlockPistonExtension.java   
public void func_71852_a(World p_71852_1_, int p_71852_2_, int p_71852_3_, int p_71852_4_, int p_71852_5_, int p_71852_6_) {
   super.func_71852_a(p_71852_1_, p_71852_2_, p_71852_3_, p_71852_4_, p_71852_5_, p_71852_6_);
   int var7 = Facing.field_71588_a[func_72121_f(p_71852_6_)];
   p_71852_2_ += Facing.field_71586_b[var7];
   p_71852_3_ += Facing.field_71587_c[var7];
   p_71852_4_ += Facing.field_71585_d[var7];
   int var8 = p_71852_1_.func_72798_a(p_71852_2_, p_71852_3_, p_71852_4_);
   if(var8 == Block.field_71963_Z.field_71990_ca || var8 == Block.field_71956_V.field_71990_ca) {
      p_71852_6_ = p_71852_1_.func_72805_g(p_71852_2_, p_71852_3_, p_71852_4_);
      if(BlockPistonBase.func_72114_f(p_71852_6_)) {
         Block.field_71973_m[var8].func_71897_c(p_71852_1_, p_71852_2_, p_71852_3_, p_71852_4_, p_71852_6_, 0);
         p_71852_1_.func_94571_i(p_71852_2_, p_71852_3_, p_71852_4_);
      }
   }

}
项目:Cauldron    文件:World.java   
public int getStrongestIndirectPower(int p_94572_1_, int p_94572_2_, int p_94572_3_)
{
    int l = 0;

    for (int i1 = 0; i1 < 6; ++i1)
    {
        int j1 = this.getIndirectPowerLevelTo(p_94572_1_ + Facing.offsetsXForSide[i1], p_94572_2_ + Facing.offsetsYForSide[i1], p_94572_3_ + Facing.offsetsZForSide[i1], i1);

        if (j1 >= 15)
        {
            return 15;
        }

        if (j1 > l)
        {
            l = j1;
        }
    }

    return l;
}
项目:RuneCraftery    文件:World.java   
public int getStrongestIndirectPower(int par1, int par2, int par3)
{
    int l = 0;

    for (int i1 = 0; i1 < 6; ++i1)
    {
        int j1 = this.getIndirectPowerLevelTo(par1 + Facing.offsetsXForSide[i1], par2 + Facing.offsetsYForSide[i1], par3 + Facing.offsetsZForSide[i1], i1);

        if (j1 >= 15)
        {
            return 15;
        }

        if (j1 > l)
        {
            l = j1;
        }
    }

    return l;
}