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


Java BlockRedstoneWire类代码示例

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


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

示例1: getRedstoneLevel

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
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();
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:CustomColors.java

示例2: fixBlockLayer

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
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_;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:27,代码来源:RenderChunk.java

示例3: fixBlockLayer

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
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_;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:RenderChunk.java

示例4: randomDisplayTick

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
@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]);
    }

}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:17,代码来源:BlockWirePCB.java

示例5: redstoneUpdate

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
@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);
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:19,代码来源:RedstoneBoilHandler.java

示例6: boilRedstone

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
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);
    }
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:27,代码来源:RedstoneBoilHandler.java

示例7: update

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
@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;
                }
            }
        }

    }
}
 
开发者ID:AdlyTempleton,项目名称:Aura-Cascade,代码行数:26,代码来源:AuraTilePumpRedstone.java

示例8: getIcon

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
@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");
}
 
开发者ID:Mineshopper,项目名称:carpentersblocks,代码行数:25,代码来源:BlockCoverable.java

示例9: getExternalPowerLevel

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
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;
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:23,代码来源:InsulatedRedstoneConduit.java

示例10: getBlockPower

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
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;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:13,代码来源:CraftBlock.java

示例11: BlockWirePCB

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
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);
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:9,代码来源:BlockWirePCB.java

示例12: getMaxCurrentStrength

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
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;
    }
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:11,代码来源:BlockWirePCB.java

示例13: getWeakPower

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
@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;
        }
    }
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:16,代码来源:BlockWirePCB.java

示例14: colorMultiplier

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
@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;
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:12,代码来源:ColorHandlers.java

示例15: motorHit

import net.minecraft.block.BlockRedstoneWire; //导入依赖的package包/类
@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);
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:15,代码来源:ReadRedstone.java


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