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


Java World.isBlockPowered方法代码示例

本文整理汇总了Java中net.minecraft.world.World.isBlockPowered方法的典型用法代码示例。如果您正苦于以下问题:Java World.isBlockPowered方法的具体用法?Java World.isBlockPowered怎么用?Java World.isBlockPowered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.World的用法示例。


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

示例1: neighborChanged

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
{
    if(!worldIn.isRemote)
    {
        boolean flag = worldIn.isBlockPowered(pos);
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if(tileentity instanceof TileEntityInstrumentPlayer)
        {
            TileEntityInstrumentPlayer player = (TileEntityInstrumentPlayer)tileentity;

            if(player.previousRedstoneState != flag)
            {
                player.changeRedstoneState(flag);
                player.previousRedstoneState = flag;
            }
        }
    }
}
 
开发者ID:iChun,项目名称:Clef,代码行数:21,代码来源:BlockInstrumentPlayer.java

示例2: onNeighborChangedInternal

import net.minecraft.world.World; //导入方法依赖的package包/类
protected void onNeighborChangedInternal(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    boolean flag = ((Boolean)state.getValue(POWERED)).booleanValue();
    boolean flag1 = worldIn.isBlockPowered(pos) || this.func_176566_a(worldIn, pos, state, true, 0) || this.func_176566_a(worldIn, pos, state, false, 0);

    if (flag1 != flag)
    {
        worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(flag1)), 3);
        worldIn.notifyNeighborsOfStateChange(pos.down(), this);

        if (((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).isAscending())
        {
            worldIn.notifyNeighborsOfStateChange(pos.up(), this);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:17,代码来源:BlockRailPowered.java

示例3: neighborChanged

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {

	if (!world.isRemote) {
		TileEntity tile = world.getTileEntity(pos);

		if (tile == null)
			return;

		if (tile instanceof TileDisplacer) {

			if (world.isBlockPowered(pos)) {
				if (!state.getValue(POWERED)) {
					state = state.withProperty(POWERED, true);
				}
			} else {
				if (state.getValue(POWERED)) {
					state = state.withProperty(POWERED, false);
				}
			}

			world.setBlockState(pos, state);
		}
	}
}
 
开发者ID:oMilkyy,项目名称:SimpleTubes,代码行数:26,代码来源:BlockDisplacer.java

示例4: neighborChanged

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
 * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
 * block, etc.
 */
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
{
    if (!worldIn.isRemote)
    {
        boolean flag = worldIn.isBlockPowered(pos);

        if (flag || blockIn.getDefaultState().canProvidePower())
        {
            boolean flag1 = ((Boolean)state.getValue(OPEN)).booleanValue();

            if (flag1 != flag)
            {
                worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(flag)), 2);
                this.playSound((EntityPlayer)null, worldIn, pos, flag);
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:BlockTrapDoor.java

示例5: neighborChanged

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
 * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
 * block, etc.
 */
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_)
{
    if (!worldIn.isRemote)
    {
        boolean flag = worldIn.isBlockPowered(pos);

        if (flag || blockIn.getDefaultState().canProvidePower())
        {
            boolean flag1 = ((Boolean)state.getValue(OPEN)).booleanValue();

            if (flag1 != flag)
            {
                worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(flag)), 2);
                this.playSound((EntityPlayer)null, worldIn, pos, flag);
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:BlockTrapDoor.java

示例6: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(pos.up());
    boolean flag1 = ((Boolean)state.getValue(TRIGGERED)).booleanValue();

    if (flag && !flag1)
    {
        worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
        worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(true)), 4);
    }
    else if (!flag && flag1)
    {
        worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(false)), 4);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:19,代码来源:BlockDispenser.java

示例7: neighborChanged

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
 * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
 * block, etc.
 */
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_)
{
    if (!worldIn.isRemote)
    {
        boolean flag = worldIn.isBlockPowered(pos);

        if (((Boolean)state.getValue(POWERED)).booleanValue() != flag)
        {
            worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(flag)).withProperty(OPEN, Boolean.valueOf(flag)), 2);

            if (((Boolean)state.getValue(OPEN)).booleanValue() != flag)
            {
                worldIn.playEvent((EntityPlayer)null, flag ? 1008 : 1014, pos, 0);
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:BlockFenceGate.java

示例8: onBlockPlaced

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
 * IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
    IBlockState iblockstate = this.getDefaultState();

    if (facing.getAxis().isHorizontal())
    {
        iblockstate = iblockstate.withProperty(FACING, facing).withProperty(OPEN, Boolean.valueOf(false));
        iblockstate = iblockstate.withProperty(HALF, hitY > 0.5F ? BlockTrapDoor.DoorHalf.TOP : BlockTrapDoor.DoorHalf.BOTTOM);
    }
    else
    {
        iblockstate = iblockstate.withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(OPEN, Boolean.valueOf(false));
        iblockstate = iblockstate.withProperty(HALF, facing == EnumFacing.UP ? BlockTrapDoor.DoorHalf.BOTTOM : BlockTrapDoor.DoorHalf.TOP);
    }

    if (worldIn.isBlockPowered(pos))
    {
        iblockstate = iblockstate.withProperty(OPEN, Boolean.valueOf(true));
    }

    return iblockstate;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:BlockTrapDoor.java

示例9: neighborChanged

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
 * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
 * block, etc.
 */
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
{
    if (!worldIn.isRemote)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityCommandBlock)
        {
            TileEntityCommandBlock tileentitycommandblock = (TileEntityCommandBlock)tileentity;
            boolean flag = worldIn.isBlockPowered(pos);
            boolean flag1 = tileentitycommandblock.isPowered();
            boolean flag2 = tileentitycommandblock.isAuto();

            if (flag && !flag1)
            {
                tileentitycommandblock.setPowered(true);

                if (tileentitycommandblock.getMode() != TileEntityCommandBlock.Mode.SEQUENCE && !flag2)
                {
                    boolean flag3 = !tileentitycommandblock.isConditional() || this.isNextToSuccessfulCommandBlock(worldIn, pos, state);
                    tileentitycommandblock.setConditionMet(flag3);
                    worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));

                    if (flag3)
                    {
                        this.propagateUpdate(worldIn, pos);
                    }
                }
            }
            else if (!flag && flag1)
            {
                tileentitycommandblock.setPowered(false);
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:42,代码来源:BlockCommandBlock.java

示例10: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    if (!worldIn.isRemote)
    {
        if (this.isOn && !worldIn.isBlockPowered(pos))
        {
            worldIn.scheduleUpdate(pos, this, 4);
        }
        else if (!this.isOn && worldIn.isBlockPowered(pos))
        {
            worldIn.setBlockState(pos, Blocks.lit_redstone_lamp.getDefaultState(), 2);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:BlockRedstoneLight.java

示例11: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!worldIn.isRemote)
    {
        if (this.isOn && !worldIn.isBlockPowered(pos))
        {
            worldIn.setBlockState(pos, Blocks.REDSTONE_LAMP.getDefaultState(), 2);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:BlockRedstoneLight.java

示例12: onBlockAdded

import net.minecraft.world.World; //导入方法依赖的package包/类
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    super.onBlockAdded(worldIn, pos, state);

    if (worldIn.isBlockPowered(pos))
    {
        this.onBlockDestroyedByPlayer(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)));
        worldIn.setBlockToAir(pos);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:BlockTNT.java

示例13: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!worldIn.isRemote)
    {
        if (this.isOn && !worldIn.isBlockPowered(pos))
        {
            worldIn.setBlockState(pos, Blocks.redstone_lamp.getDefaultState(), 2);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:11,代码来源:BlockRedstoneLight.java

示例14: onBlockAdded

import net.minecraft.world.World; //导入方法依赖的package包/类
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
        if (this.isOn && !worldIn.isBlockPowered(pos))
        {
            worldIn.setBlockState(pos, Blocks.redstone_lamp.getDefaultState(), 2);
        }
        else if (!this.isOn && worldIn.isBlockPowered(pos))
        {
            worldIn.setBlockState(pos, Blocks.lit_redstone_lamp.getDefaultState(), 2);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:BlockRedstoneLight.java

示例15: onBlockPlaced

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
 * IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
    boolean flag = worldIn.isBlockPowered(pos);
    return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()).withProperty(OPEN, Boolean.valueOf(flag)).withProperty(POWERED, Boolean.valueOf(flag)).withProperty(IN_WALL, Boolean.valueOf(false));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:10,代码来源:BlockFenceGate.java


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