Java 类net.minecraft.block.BlockRedstoneWire 实例源码

项目:BaseClient    文件:CustomColors.java   
private static int getRedstoneLevel(IBlockState p_getRedstoneLevel_0_, int p_getRedstoneLevel_1_)
{
    Block block = p_getRedstoneLevel_0_.getBlock();

    if (!(block instanceof BlockRedstoneWire))
    {
        return p_getRedstoneLevel_1_;
    }
    else
    {
        Object object = p_getRedstoneLevel_0_.getValue(BlockRedstoneWire.POWER);

        if (!(object instanceof Integer))
        {
            return p_getRedstoneLevel_1_;
        }
        else
        {
            Integer integer = (Integer)object;
            return integer.intValue();
        }
    }
}
项目:BaseClient    文件:CustomColorizer.java   
private static int getRedstoneLevel(IBlockState p_getRedstoneLevel_0_, int p_getRedstoneLevel_1_)
{
    Block block = p_getRedstoneLevel_0_.getBlock();

    if (!(block instanceof BlockRedstoneWire))
    {
        return p_getRedstoneLevel_1_;
    }
    else
    {
        Object object = p_getRedstoneLevel_0_.getValue(BlockRedstoneWire.POWER);

        if (!(object instanceof Integer))
        {
            return p_getRedstoneLevel_1_;
        }
        else
        {
            Integer integer = (Integer)object;
            return integer.intValue();
        }
    }
}
项目:BaseClient    文件:RenderChunk.java   
private EnumWorldBlockLayer fixBlockLayer(Block p_fixBlockLayer_1_, EnumWorldBlockLayer p_fixBlockLayer_2_)
{
    if (this.isMipmaps)
    {
        if (p_fixBlockLayer_2_ == EnumWorldBlockLayer.CUTOUT)
        {
            if (p_fixBlockLayer_1_ instanceof BlockRedstoneWire)
            {
                return p_fixBlockLayer_2_;
            }

            if (p_fixBlockLayer_1_ instanceof BlockCactus)
            {
                return p_fixBlockLayer_2_;
            }

            return EnumWorldBlockLayer.CUTOUT_MIPPED;
        }
    }
    else if (p_fixBlockLayer_2_ == EnumWorldBlockLayer.CUTOUT_MIPPED)
    {
        return EnumWorldBlockLayer.CUTOUT;
    }

    return p_fixBlockLayer_2_;
}
项目:BaseClient    文件:CustomColorizer.java   
private static int getRedstoneLevel(IBlockState p_getRedstoneLevel_0_, int p_getRedstoneLevel_1_)
{
    Block block = p_getRedstoneLevel_0_.getBlock();

    if (!(block instanceof BlockRedstoneWire))
    {
        return p_getRedstoneLevel_1_;
    }
    else
    {
        Object object = p_getRedstoneLevel_0_.getValue(BlockRedstoneWire.POWER);

        if (!(object instanceof Integer))
        {
            return p_getRedstoneLevel_1_;
        }
        else
        {
            Integer integer = (Integer)object;
            return integer.intValue();
        }
    }
}
项目:Backmemed    文件:RenderChunk.java   
private BlockRenderLayer fixBlockLayer(Block p_fixBlockLayer_1_, BlockRenderLayer p_fixBlockLayer_2_)
{
    if (this.isMipmaps)
    {
        if (p_fixBlockLayer_2_ == BlockRenderLayer.CUTOUT)
        {
            if (p_fixBlockLayer_1_ instanceof BlockRedstoneWire)
            {
                return p_fixBlockLayer_2_;
            }

            if (p_fixBlockLayer_1_ instanceof BlockCactus)
            {
                return p_fixBlockLayer_2_;
            }

            return BlockRenderLayer.CUTOUT_MIPPED;
        }
    }
    else if (p_fixBlockLayer_2_ == BlockRenderLayer.CUTOUT_MIPPED)
    {
        return BlockRenderLayer.CUTOUT;
    }

    return p_fixBlockLayer_2_;
}
项目:Backmemed    文件:CustomColors.java   
private static int getRedstoneLevel(IBlockState p_getRedstoneLevel_0_, int p_getRedstoneLevel_1_)
{
    Block block = p_getRedstoneLevel_0_.getBlock();

    if (!(block instanceof BlockRedstoneWire))
    {
        return p_getRedstoneLevel_1_;
    }
    else
    {
        Object object = p_getRedstoneLevel_0_.getValue(BlockRedstoneWire.POWER);

        if (!(object instanceof Integer))
        {
            return p_getRedstoneLevel_1_;
        }
        else
        {
            Integer integer = (Integer)object;
            return integer.intValue();
        }
    }
}
项目:BetterWithAddons    文件:BlockWirePCB.java   
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
    int i = ((Integer)state.getValue(BlockRedstoneWire.POWER)).intValue();
    if(i != 0) {
        double d0 = (double)pos.getX() + 0.5D + ((double)rand.nextFloat() - 0.5D) * 0.2D;
        double d1 = (double)((float)pos.getY() + 0.0625F);
        double d2 = (double)pos.getZ() + 0.5D + ((double)rand.nextFloat() - 0.5D) * 0.2D;
        float f = (float)i / 15.0F;
        float f1 = f * 0.6F + 0.4F;
        float f2 = Math.max(0.0F, f * f * 0.7F - 0.5F);
        float f3 = Math.max(0.0F, f * f * 0.6F - 0.7F);
        world.spawnParticle(EnumParticleTypes.REDSTONE, d0, d1, d2, (double)f1, (double)f2, (double)f3, new int[0]);
    }

}
项目:BetterWithAddons    文件:RedstoneBoilHandler.java   
@SubscribeEvent
public void redstoneUpdate(BlockEvent.NeighborNotifyEvent event)
{
    World world = event.getWorld();
    BlockPos pos = event.getPos();
    IBlockState state = event.getState();

    if(state.getBlock() != Blocks.REDSTONE_WIRE)
        return;

    if(!willRedstoneBoil(world,pos))
        return;

    if(state.getValue(BlockRedstoneWire.POWER) > 0)
        return;

    scheduleRedstone(world,pos,9);
}
项目:BetterWithAddons    文件:RedstoneBoilHandler.java   
private void boilRedstone(World world, BlockPos pos) {
    IBlockState state = world.getBlockState(pos);

    if(state.getBlock() != Blocks.REDSTONE_WIRE)
        return;

    if(state.getValue(BlockRedstoneWire.POWER) <= world.rand.nextInt(128))
        return;

    if(!willRedstoneBoil(world,pos))
        return;

    world.playEvent(2001, pos, Block.getStateId(state));

    if(world.rand.nextInt(10) < 1)
    {
        EntityItem result = new EntityItem(world, pos.getX() + 0.5f, pos.getY() + 0.1f, pos.getZ() + 0.5f, new ItemStack(Items.GLOWSTONE_DUST));
        result.setDefaultPickupDelay();
        world.spawnEntity(result);
        world.setBlockToAir(pos);

    }
    else {
        world.notifyNeighborsOfStateChange(pos,state.getBlock(),true);
    }
}
项目:Aura-Cascade    文件:AuraTilePumpRedstone.java   
@Override
public void update() {
    super.update();
    if (pumpPower == 0) {
        for (EnumFacing direction : EnumFacing.VALUES) {
            for (int i = 1; i < 16; i++) {
                BlockPos pos = getPos().offset(direction, i);
                Block block = worldObj.getBlockState(pos).getBlock();
                if (block instanceof BlockRedstoneWire && worldObj.getBlockState(pos).getValue(BlockRedstoneWire.POWER) > 0) {
                    addFuel((int) (Config.pumpRedstoneDuration * Math.pow(1.4, i)), Config.pumpRedstoneSpeed);
                    if (!worldObj.isRemote) {
                        for (int j = 0; j < 5; j++) {
                            AuraCascade.proxy.addBlockDestroyEffects(pos);
                        }
                    }

                    worldObj.setBlockToAir(pos);
                } else {
                    break;
                }
            }
        }

    }
}
项目:carpentersblocks    文件:BlockCoverable.java   
@SideOnly(Side.CLIENT)
@Override
/**
 * Returns the icon on the side given the block metadata.
 * <p>
 * Due to the amount of control needed over this, vanilla calls will always return an invisible icon.
 */
public IIcon getIcon(int side, int metadata)
{
    if (BlockProperties.isMetadataDefaultIcon(metadata)) {
        return getIcon();
    }

    /*
     * This icon is a mask (or something) for redstone wire.
     * We use it here because it renders an invisible icon.
     *
     * Using an invisible icon is important because sprint particles are
     * hard-coded and will always grab particle icons using this method.
     * We'll throw our own sprint particles in EventHandler.class.
     */

    return BlockRedstoneWire.getRedstoneWireIcon("cross_overlay");
}
项目:EnderIO    文件:InsulatedRedstoneConduit.java   
protected int getExternalPowerLevel(@Nonnull EnumFacing dir) {
  World world = getBundle().getEntity().getWorld();
  BlockPos loc = getBundle().getLocation().offset(dir);
  int res = 0;

  if (world.isBlockLoaded(loc)) {
    int strong = world.getStrongPower(loc, dir);
    if (strong > 0) {
      return strong;
    }

    res = world.getRedstonePower(loc, dir);
    IBlockState bs = world.getBlockState(loc);
    Block block = bs.getBlock();
    if (res < 15 && block == Blocks.REDSTONE_WIRE) {
      int wireIn = bs.getValue(BlockRedstoneWire.POWER);
      res = Math.max(res, wireIn);
    }
  }

  return res;
}
项目:Uranium    文件:CraftBlock.java   
public int getBlockPower(BlockFace face) {
    int power = 0;
    BlockRedstoneWire wire = Blocks.redstone_wire;
    net.minecraft.world.World world = chunk.getHandle().worldObj;
    if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y - 1, z, 0)) power = wire.func_150178_a(world, x, y - 1, z, power);
    if ((face == BlockFace.UP || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y + 1, z, 1)) power = wire.func_150178_a(world, x, y + 1, z, power);
    if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x + 1, y, z, 2)) power = wire.func_150178_a(world, x + 1, y, z, power);
    if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x - 1, y, z, 3)) power = wire.func_150178_a(world, x - 1, y, z, power);
    if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z - 1, 4)) power = wire.func_150178_a(world, x, y, z - 1, power);
    if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z + 1, 5)) power = wire.func_150178_a(world, x, y, z - 1, power);
    return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
项目:BetterWithAddons    文件:BlockWirePCB.java   
public BlockWirePCB() {
    super(Material.CIRCUITS);
    this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, EnumAttachPosition.NONE).withProperty(EAST, EnumAttachPosition.NONE).withProperty(SOUTH, EnumAttachPosition.NONE).withProperty(WEST, EnumAttachPosition.NONE).withProperty(BlockRedstoneWire.POWER, Integer.valueOf(0)));

    this.setUnlocalizedName("pcb_wire");
    this.setRegistryName(new ResourceLocation(Reference.MOD_ID, "pcb_wire"));
    //this.setCreativeTab(BetterWithAddons.instance.creativeTab);
}
项目:BetterWithAddons    文件:BlockWirePCB.java   
private int getMaxCurrentStrength(World world, BlockPos pos, int strength) {
    IBlockState state = world.getBlockState(pos);

    if(isRedstoneWire(state)) {
        int i = state.getValue(BlockRedstoneWire.POWER);
        return i > strength?i:strength;
    } else {
        return strength;
    }
}
项目:BetterWithAddons    文件:BlockWirePCB.java   
@Override
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing facing) {
    if(!this.canProvidePower) {
        return 0;
    } else {
        int power = state.getValue(BlockRedstoneWire.POWER);
        if(power == 0 || facing.getHorizontalIndex() < 0) {
            return 0;
        } else if(pcbAllowsConnection(world,pos,facing.getOpposite())) {
            return power-1;
        } else {
            return 0;
        }
    }
}
项目:BetterWithAddons    文件:ColorHandlers.java   
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex)
{
    if(state != null && state.getBlock() instanceof BlockWirePCB)
    {
        return BlockWirePCB.colorMultiplier(state.getValue(BlockRedstoneWire.POWER));
    }

    return 0;
}
项目:ThermosRebased    文件:CraftBlock.java   
public int getBlockPower(BlockFace face) {
    int power = 0;
    BlockRedstoneWire wire = Blocks.redstone_wire;
    net.minecraft.world.World world = chunk.getHandle().worldObj;
    if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y - 1, z, 0)) power = wire.func_150178_a(world, x, y - 1, z, power);
    if ((face == BlockFace.UP || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y + 1, z, 1)) power = wire.func_150178_a(world, x, y + 1, z, power);
    if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x + 1, y, z, 2)) power = wire.func_150178_a(world, x + 1, y, z, power);
    if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x - 1, y, z, 3)) power = wire.func_150178_a(world, x - 1, y, z, power);
    if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z - 1, 4)) power = wire.func_150178_a(world, x, y, z - 1, power);
    if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z + 1, 5)) power = wire.func_150178_a(world, x, y, z - 1, power);
    return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
项目:Factorization    文件:ReadRedstone.java   
@Override
public void motorHit(ServoMotor motor) {
    Coord at = motor.getCurrentPos().add(motor.getOrientation().top);
    int power;
    IBlockState bs = at.getState();
    if (bs.getBlock() instanceof BlockRedstoneWire) {
        power = bs.getValue(BlockRedstoneWire.POWER);
    } else {
        power = at.w.isBlockIndirectlyGettingPowered(at.toBlockPos());
        //power = at.w.getBlockPowerInput(at.x, at.y, at.z);
        //power = at.w.getIndirectPowerLevelTo(at.x, at.y, at.z, motor.getOrientation().top.ordinal());
    }
    motor.getArgStack().push(power);
}
项目:Thermos    文件:CraftBlock.java   
public int getBlockPower(BlockFace face) {
    int power = 0;
    BlockRedstoneWire wire = Blocks.redstone_wire;
    net.minecraft.world.World world = chunk.getHandle().worldObj;
    if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y - 1, z, 0)) power = wire.func_150178_a(world, x, y - 1, z, power);
    if ((face == BlockFace.UP || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y + 1, z, 1)) power = wire.func_150178_a(world, x, y + 1, z, power);
    if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x + 1, y, z, 2)) power = wire.func_150178_a(world, x + 1, y, z, power);
    if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x - 1, y, z, 3)) power = wire.func_150178_a(world, x - 1, y, z, power);
    if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z - 1, 4)) power = wire.func_150178_a(world, x, y, z - 1, power);
    if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z + 1, 5)) power = wire.func_150178_a(world, x, y, z - 1, power);
    return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
项目:KCauldron    文件:CraftBlock.java   
public int getBlockPower(BlockFace face) {
    int power = 0;
    BlockRedstoneWire wire = Blocks.redstone_wire;
    net.minecraft.world.World world = chunk.getHandle().worldObj;
    if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y - 1, z, 0)) power = wire.func_150178_a(world, x, y - 1, z, power);
    if ((face == BlockFace.UP || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y + 1, z, 1)) power = wire.func_150178_a(world, x, y + 1, z, power);
    if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x + 1, y, z, 2)) power = wire.func_150178_a(world, x + 1, y, z, power);
    if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x - 1, y, z, 3)) power = wire.func_150178_a(world, x - 1, y, z, power);
    if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z - 1, 4)) power = wire.func_150178_a(world, x, y, z - 1, power);
    if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z + 1, 5)) power = wire.func_150178_a(world, x, y, z - 1, power);
    return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
项目:CauldronGit    文件:CraftBlock.java   
public int getBlockPower(BlockFace face) {
    int power = 0;
    BlockRedstoneWire wire = Blocks.redstone_wire;
    net.minecraft.world.World world = chunk.getHandle().worldObj;
    if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y - 1, z, 0)) power = wire.func_150178_a(world, x, y - 1, z, power);
    if ((face == BlockFace.UP || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y + 1, z, 1)) power = wire.func_150178_a(world, x, y + 1, z, power);
    if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x + 1, y, z, 2)) power = wire.func_150178_a(world, x + 1, y, z, power);
    if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x - 1, y, z, 3)) power = wire.func_150178_a(world, x - 1, y, z, power);
    if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z - 1, 4)) power = wire.func_150178_a(world, x, y, z - 1, power);
    if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z + 1, 5)) power = wire.func_150178_a(world, x, y, z - 1, power);
    return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
项目:Cauldron-Old    文件:CraftBlock.java   
public int getBlockPower(BlockFace face) {
    int power = 0;
    BlockRedstoneWire wire = Blocks.redstone_wire;
    net.minecraft.world.World world = chunk.getHandle().worldObj;
    if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y - 1, z, 0)) power = wire.func_150178_a(world, x, y - 1, z, power);
    if ((face == BlockFace.UP || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y + 1, z, 1)) power = wire.func_150178_a(world, x, y + 1, z, power);
    if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x + 1, y, z, 2)) power = wire.func_150178_a(world, x + 1, y, z, power);
    if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x - 1, y, z, 3)) power = wire.func_150178_a(world, x - 1, y, z, power);
    if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z - 1, 4)) power = wire.func_150178_a(world, x, y, z - 1, power);
    if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z + 1, 5)) power = wire.func_150178_a(world, x, y, z - 1, power);
    return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
项目:Structures    文件:StructureComponentNBT.java   
private boolean isDefered(StructureBlock sb) {
  Block block = GameRegistry.findBlock(sb.getModId(), sb.getBlockName());
  if(block == null) {
    return false;
  }

  return block instanceof BlockTorch || block instanceof BlockSand || block instanceof BlockGravel || block instanceof BlockAnvil 
      || block instanceof BlockTripWireHook || block instanceof  BlockTripWire|| block instanceof BlockRedstoneWire;
}
项目:Cauldron-Reloaded    文件:CraftBlock.java   
public int getBlockPower(BlockFace face) {
    int power = 0;
    BlockRedstoneWire wire = Blocks.redstone_wire;
    net.minecraft.world.World world = chunk.getHandle().worldObj;
    if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y - 1, z, 0)) power = wire.func_150178_a(world, x, y - 1, z, power);
    if ((face == BlockFace.UP || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y + 1, z, 1)) power = wire.func_150178_a(world, x, y + 1, z, power);
    if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x + 1, y, z, 2)) power = wire.func_150178_a(world, x + 1, y, z, power);
    if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x - 1, y, z, 3)) power = wire.func_150178_a(world, x - 1, y, z, power);
    if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z - 1, 4)) power = wire.func_150178_a(world, x, y, z - 1, power);
    if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z + 1, 5)) power = wire.func_150178_a(world, x, y, z - 1, power);
    return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
项目:FFoKC    文件:CraftBlock.java   
public int getBlockPower(BlockFace face) {
    int power = 0;
    BlockRedstoneWire wire = Blocks.redstone_wire;
    net.minecraft.world.World world = chunk.getHandle().worldObj;
    if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y - 1, z, 0)) power = wire.func_150178_a(world, x, y - 1, z, power);
    if ((face == BlockFace.UP || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y + 1, z, 1)) power = wire.func_150178_a(world, x, y + 1, z, power);
    if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x + 1, y, z, 2)) power = wire.func_150178_a(world, x + 1, y, z, power);
    if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x - 1, y, z, 3)) power = wire.func_150178_a(world, x - 1, y, z, power);
    if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z - 1, 4)) power = wire.func_150178_a(world, x, y, z - 1, power);
    if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z + 1, 5)) power = wire.func_150178_a(world, x, y, z - 1, power);
    return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
项目:BluePower    文件:RedstoneHelper.java   
public static final int getInput(World w, int x, int y, int z, ForgeDirection side, ForgeDirection face) {

    if(w == null) return 0;

    int power = 0;

    Block b = w.getBlock(x + side.offsetX, y + side.offsetY, z + side.offsetZ);
    if (b != null) {
        boolean shouldCheck = true;

        if (b instanceof BlockRedstoneWire && (face != ForgeDirection.DOWN && face != null)) shouldCheck = false;

        if (shouldCheck) {
            power = Math.max(power,
                    b.isProvidingStrongPower(w, x + side.offsetX, y + side.offsetY, z + side.offsetZ, ForgeDirectionUtils.getSide(side)));
            power = Math.max(power,
                    b.isProvidingWeakPower(w, x + side.offsetX, y + side.offsetY, z + side.offsetZ, ForgeDirectionUtils.getSide(side)));
            power = Math.max(power,
                    w.getIndirectPowerLevelTo(x + side.offsetX, y + side.offsetY, z + side.offsetZ, ForgeDirectionUtils.getSide(side)));
            power = Math
                    .max(power, b instanceof BlockRedstoneWire ? w.getBlockMetadata(x + side.offsetX, y + side.offsetY, z + side.offsetZ) : 0);
        }
    }

    power = Math.max(power, ((IMultipartCompat) CompatibilityUtils.getModule(Dependencies.FMP)).getInput(w, x, y, z, side, face));

    return power;
}
项目:Cauldron    文件:CraftBlock.java   
public int getBlockPower(BlockFace face) {
    int power = 0;
    BlockRedstoneWire wire = Blocks.redstone_wire;
    net.minecraft.world.World world = chunk.getHandle().worldObj;
    if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y - 1, z, 0)) power = wire.func_150178_a(world, x, y - 1, z, power);
    if ((face == BlockFace.UP || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y + 1, z, 1)) power = wire.func_150178_a(world, x, y + 1, z, power);
    if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x + 1, y, z, 2)) power = wire.func_150178_a(world, x + 1, y, z, power);
    if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x - 1, y, z, 3)) power = wire.func_150178_a(world, x - 1, y, z, power);
    if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z - 1, 4)) power = wire.func_150178_a(world, x, y, z - 1, power);
    if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z + 1, 5)) power = wire.func_150178_a(world, x, y, z - 1, power);
    return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
项目:QmunityLib    文件:RedstoneHelper.java   
public static boolean canConnectVanilla(World world, BlockPos pos, ForgeDirection side, ForgeDirection face) {

        if (side == ForgeDirection.UNKNOWN)
            return false;

        Block block = world.getBlock(pos.getX(), pos.getY(), pos.getZ());
        int meta = world.getBlockMetadata(pos.getX(), pos.getY(), pos.getZ());
        int d = Direction.getMovementDirection(side.offsetX, side.offsetZ);

        if ((block == Blocks.unpowered_repeater || block == Blocks.powered_repeater)
                && (face == ForgeDirection.DOWN || face == ForgeDirection.UNKNOWN))
            if (d % 2 == meta % 2)
                return true;

        if (block instanceof BlockLever) {
            meta = meta % 8;
            ForgeDirection leverFace = ((meta == 0 || meta == 7) ? ForgeDirection.UP : ((meta == 5 || meta == 6) ? ForgeDirection.DOWN
                    : (meta == 1 ? ForgeDirection.WEST : (meta == 2 ? ForgeDirection.EAST : (meta == 3 ? ForgeDirection.NORTH
                            : (meta == 4 ? ForgeDirection.SOUTH : ForgeDirection.UNKNOWN))))));
            if (face != ForgeDirection.UNKNOWN && face != leverFace)
                return false;
            return side != leverFace.getOpposite();
        }

        if (block instanceof BlockRedstoneComparator && (face == ForgeDirection.DOWN || face == ForgeDirection.UNKNOWN))
            return side != ForgeDirection.UP;

        if (block instanceof BlockRedstoneWire)
            return face == ForgeDirection.UNKNOWN || face == ForgeDirection.DOWN;

        return block instanceof BlockDoor || block instanceof BlockRedstoneLight || block instanceof BlockTNT
                || block instanceof BlockDispenser || block instanceof BlockNote
                || block instanceof BlockPistonBase;// true;
    }
项目:QmunityLib    文件:RedstoneHelper.java   
private static boolean isVanillaBlock(World world, BlockPos pos) {

        Block b = world.getBlock(pos.getX(), pos.getY(), pos.getZ());
        return b instanceof BlockRedstoneRepeater || b instanceof BlockLever || b instanceof BlockRedstoneWire
                || b instanceof BlockRedstoneComparator || b instanceof BlockDoor || b instanceof BlockRedstoneLight
                || b instanceof BlockTNT || b instanceof BlockDispenser || b instanceof BlockNote
                || b instanceof BlockPistonBase;
    }
项目:N-API    文件:BlockRedstoneWireBase.java   
@Override
public boolean canTransferToBlock(Block block, int direction)
{
    if ((!(direction == UP) && !(direction == DOWN) && direction < 6) || block instanceof IRedstoneWire || block instanceof BlockRedstoneWire)
    {
        return true;
    }
    else
    {
        return false;
    }
}
项目:Minecoprocessors    文件:BlockMinecoprocessor.java   
protected static int calculateInputStrength(World worldIn, BlockPos pos, EnumFacing enumfacing) {
  IBlockState adjacentState = worldIn.getBlockState(pos);
  Block block = adjacentState.getBlock();

  int i = worldIn.getRedstonePower(pos, enumfacing);

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

  int redstoneWirePower = 0;

  if (block == Blocks.REDSTONE_WIRE) {
    redstoneWirePower = adjacentState.getValue(BlockRedstoneWire.POWER);
  }

  return Math.max(i, redstoneWirePower);

}
项目:BaseClient    文件:RenderChunk.java   
private EnumWorldBlockLayer fixBlockLayer(Block p_fixBlockLayer_1_, EnumWorldBlockLayer p_fixBlockLayer_2_)
{
    return p_fixBlockLayer_2_ == EnumWorldBlockLayer.CUTOUT ? (p_fixBlockLayer_1_ instanceof BlockRedstoneWire ? p_fixBlockLayer_2_ : (p_fixBlockLayer_1_ instanceof BlockCactus ? p_fixBlockLayer_2_ : EnumWorldBlockLayer.CUTOUT_MIPPED)) : p_fixBlockLayer_2_;
}
项目:BetterWithAddons    文件:BlockWirePCB.java   
private boolean isRedstoneWire(IBlockState state)
{
    return state.getBlock() == this || state.getBlock() instanceof BlockRedstoneWire;
}
项目:BetterWithAddons    文件:BlockWirePCB.java   
@Override
public IBlockState getStateFromMeta(int p_getStateFromMeta_1_) {
    return this.getDefaultState().withProperty(BlockRedstoneWire.POWER, Integer.valueOf(p_getStateFromMeta_1_));
}
项目:BetterWithAddons    文件:BlockWirePCB.java   
@Override
public int getMetaFromState(IBlockState p_getMetaFromState_1_) {
    return ((Integer)p_getMetaFromState_1_.getValue(BlockRedstoneWire.POWER)).intValue();
}
项目:BetterWithAddons    文件:BlockWirePCB.java   
@Override
protected BlockStateContainer createBlockState() {
    return new BlockStateContainer(this, new IProperty[]{NORTH, EAST, SOUTH, WEST, BlockRedstoneWire.POWER});
}
项目:RandomToolKit    文件:BlockFourierTransformer.java   
public boolean isWire(World world, BlockPos pos){
    return world.getBlockState(pos).getBlock() instanceof BlockRedstoneWire;
}
项目:BluePower    文件:RedstoneHelper.java   
public static final int setOutput(World w, int x, int y, int z, ForgeDirection side, ForgeDirection face, int p) {

    if(w == null) return 0;

    int power = 0;

    Block b = w.getBlock(x + side.offsetX, y + side.offsetY, z + side.offsetZ);
    if (b != null) {
        boolean shouldOutput = true;

        if (b instanceof BlockRedstoneWire && (face != ForgeDirection.DOWN && face != null)) shouldOutput = false;

        if(shouldOutput)
            power = p;
    }

    return power;
}