本文整理汇总了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();
}
}
}
示例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_;
}
示例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_;
}
示例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]);
}
}
示例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);
}
示例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);
}
}
示例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;
}
}
}
}
}
示例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");
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}
}
}
示例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;
}
示例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);
}