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


Java World.notifyNeighborsOfStateChange方法代码示例

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


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

示例1: onBlockAdded

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
	if (!worldIn.isRemote) {
		this.updateSurroundingSalt(worldIn, state);

		for (EnumFacing enumfacing : EnumFacing.Plane.VERTICAL) {
			worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this, true);
		}

		for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL) {
			this.notifyBarrierNeighborsOfStateChange(worldIn, pos.offset(enumfacing1));
		}

		for (EnumFacing enumfacing2 : EnumFacing.Plane.HORIZONTAL) {
			final BlockPos blockpos = pos.offset(enumfacing2);

			if (worldIn.getBlockState(blockpos).isNormalCube()) {
				this.notifyBarrierNeighborsOfStateChange(worldIn, blockpos.up());
			} else {
				this.notifyBarrierNeighborsOfStateChange(worldIn, blockpos.down());
			}
		}
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:25,代码来源:BlockSaltBarrier.java

示例2: onBlockActivated

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        state = state.cycleProperty(POWERED);
        worldIn.setBlockState(pos, state, 3);
        worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, ((Boolean)state.getValue(POWERED)).booleanValue() ? 0.6F : 0.5F);
        worldIn.notifyNeighborsOfStateChange(pos, this);
        EnumFacing enumfacing = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing();
        worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing.getOpposite()), this);
        return true;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:BlockLever.java

示例3: updateState

import net.minecraft.world.World; //导入方法依赖的package包/类
protected void updateState(IBlockState p_189541_1_, World p_189541_2_, BlockPos p_189541_3_, Block p_189541_4_)
{
    boolean flag = ((Boolean)p_189541_1_.getValue(POWERED)).booleanValue();
    boolean flag1 = p_189541_2_.isBlockPowered(p_189541_3_) || this.findPoweredRailSignal(p_189541_2_, p_189541_3_, p_189541_1_, true, 0) || this.findPoweredRailSignal(p_189541_2_, p_189541_3_, p_189541_1_, false, 0);

    if (flag1 != flag)
    {
        p_189541_2_.setBlockState(p_189541_3_, p_189541_1_.withProperty(POWERED, Boolean.valueOf(flag1)), 3);
        p_189541_2_.notifyNeighborsOfStateChange(p_189541_3_.down(), this);

        if (((BlockRailBase.EnumRailDirection)p_189541_1_.getValue(SHAPE)).isAscending())
        {
            p_189541_2_.notifyNeighborsOfStateChange(p_189541_3_.up(), this);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:BlockRailPowered.java

示例4: onBlockDestroyedByPlayer

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a player destroys this Block
 */
public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state)
{
    if (this.isRepeaterPowered)
    {
        for (EnumFacing enumfacing : EnumFacing.values())
        {
            worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
        }
    }

    super.onBlockDestroyedByPlayer(worldIn, pos, state);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:BlockRedstoneDiode.java

示例5: breakBlock

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
 */
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    super.breakBlock(worldIn, pos, state);

    if (!worldIn.isRemote)
    {
        for (EnumFacing enumfacing : EnumFacing.values())
        {
            worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
        }

        this.updateSurroundingRedstone(worldIn, pos, state);

        for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL)
        {
            this.notifyWireNeighborsOfStateChange(worldIn, pos.offset(enumfacing1));
        }

        for (EnumFacing enumfacing2 : EnumFacing.Plane.HORIZONTAL)
        {
            BlockPos blockpos = pos.offset(enumfacing2);

            if (worldIn.getBlockState(blockpos).isNormalCube())
            {
                this.notifyWireNeighborsOfStateChange(worldIn, blockpos.up());
            }
            else
            {
                this.notifyWireNeighborsOfStateChange(worldIn, blockpos.down());
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:37,代码来源:BlockRedstoneWire.java

示例6: breakBlock

import net.minecraft.world.World; //导入方法依赖的package包/类
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (this.isOn)
    {
        for (EnumFacing enumfacing : EnumFacing.values())
        {
            worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:11,代码来源:BlockRedstoneTorch.java

示例7: onBlockActivated

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
		EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	for(EnumFacing face : EnumFacing.VALUES)
		worldIn.notifyNeighborsOfStateChange(pos.offset(facing), this, false);
	return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:8,代码来源:HarshenHiddenPlateActive.java

示例8: breakBlock

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

	if (((BlockRailBase.EnumRailDirection) state.getValue(this.getShapeProperty())).isAscending()) {
		worldIn.notifyNeighborsOfStateChange(pos.up(), this);
	}

	if (this.isPowered) {
		worldIn.notifyNeighborsOfStateChange(pos, this);
		worldIn.notifyNeighborsOfStateChange(pos.down(), this);
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:13,代码来源:BlockRailBase.java

示例9: breakBlock

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
 */
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (this.isOn)
    {
        for (EnumFacing enumfacing : EnumFacing.values())
        {
            worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:14,代码来源:BlockRedstoneTorch.java

示例10: breakBlock

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

    if (((BlockRailBase.EnumRailDirection)state.getValue(this.getShapeProperty())).isAscending())
    {
        worldIn.notifyNeighborsOfStateChange(pos.up(), this);
    }

    if (this.isPowered)
    {
        worldIn.notifyNeighborsOfStateChange(pos, this);
        worldIn.notifyNeighborsOfStateChange(pos.down(), this);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:BlockRailBase.java

示例11: updateSurroundingRedstone

import net.minecraft.world.World; //导入方法依赖的package包/类
private IBlockState updateSurroundingRedstone(World worldIn, BlockPos pos, IBlockState state)
{
    state = this.calculateCurrentChanges(worldIn, pos, pos, state);
    List<BlockPos> list = Lists.newArrayList(this.blocksNeedingUpdate);
    this.blocksNeedingUpdate.clear();

    for (BlockPos blockpos : list)
    {
        worldIn.notifyNeighborsOfStateChange(blockpos, this, false);
    }

    return state;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:14,代码来源:BlockRedstoneWire.java

示例12: onBlockAdded

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called after the block is set in the Chunk data, but before the Tile Entity is set
 */
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
        this.updateSurroundingRedstone(worldIn, pos, state);

        for (EnumFacing enumfacing : EnumFacing.Plane.VERTICAL)
        {
            worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this, false);
        }

        for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL)
        {
            this.notifyWireNeighborsOfStateChange(worldIn, pos.offset(enumfacing1));
        }

        for (EnumFacing enumfacing2 : EnumFacing.Plane.HORIZONTAL)
        {
            BlockPos blockpos = pos.offset(enumfacing2);

            if (worldIn.getBlockState(blockpos).isNormalCube())
            {
                this.notifyWireNeighborsOfStateChange(worldIn, blockpos.up());
            }
            else
            {
                this.notifyWireNeighborsOfStateChange(worldIn, blockpos.down());
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:35,代码来源:BlockRedstoneWire.java

示例13: breakBlock

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
 */
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (((Boolean)state.getValue(POWERED)).booleanValue())
    {
        worldIn.notifyNeighborsOfStateChange(pos, this);
        EnumFacing enumfacing = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing();
        worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing.getOpposite()), this);
    }

    super.breakBlock(worldIn, pos, state);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:BlockLever.java

示例14: breakBlock

import net.minecraft.world.World; //导入方法依赖的package包/类
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
	boolean flag = ((Boolean) state.getValue(ATTACHED)).booleanValue();
	boolean flag1 = ((Boolean) state.getValue(POWERED)).booleanValue();

	if (flag || flag1) {
		this.func_176260_a(worldIn, pos, state, true, false, -1, (IBlockState) null);
	}

	if (flag1) {
		worldIn.notifyNeighborsOfStateChange(pos, this);
		worldIn.notifyNeighborsOfStateChange(pos.offset(((EnumFacing) state.getValue(FACING)).getOpposite()), this);
	}

	super.breakBlock(worldIn, pos, state);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:BlockTripWireHook.java

示例15: updatePoweredState

import net.minecraft.world.World; //导入方法依赖的package包/类
private void updatePoweredState(World worldIn, BlockPos pos, IBlockState state)
{
    boolean flag = ((Boolean)state.getValue(POWERED)).booleanValue();
    boolean flag1 = false;
    List<EntityMinecart> list = this.<EntityMinecart>findMinecarts(worldIn, pos, EntityMinecart.class, new Predicate[0]);

    if (!list.isEmpty())
    {
        flag1 = true;
    }

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

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

    if (flag1)
    {
        worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
    }

    worldIn.updateComparatorOutputLevel(pos, this);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:35,代码来源:BlockRailDetector.java


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