本文整理了Java中net.minecraft.world.World.notifyNeighborsOfStateChange()
方法的一些代码示例,展示了World.notifyNeighborsOfStateChange()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.notifyNeighborsOfStateChange()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:notifyNeighborsOfStateChange
暂无
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public Boolean call( final World world ) throws Exception
{
if( world.isBlockLoaded( this.pos ) )
{
world.notifyNeighborsOfStateChange( this.pos, Platform.AIR_BLOCK, true );
}
return true;
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void onPlayerDestroy(World world, BlockPos pos, IBlockState state) {
// TE is already gone so best we can do is just notify everyone
for(EnumFacing side : EnumFacing.VALUES) {
world.notifyNeighborsOfStateChange(pos.offset(side), this, false);
}
super.onPlayerDestroy(world, pos, state);
}
代码示例来源:origin: Vazkii/Botania
private void rotateTo(int side) {
if(rotating)
return;
currentRandomRotation = nextRandomRotation;
int finalRotation = side * 90;
double diff = (finalRotation - rotation % 360) % 360;
if(diff < 0)
diff = 360 + diff;
rotationTicks = 4;
anglePerTick = diff / rotationTicks;
this.side = side;
rotating = true;
// tell neighbors that signal is off because we are rotating
world.notifyNeighborsOfStateChange(getPos(), getBlockType(), false);
for(EnumFacing e : EnumFacing.VALUES) {
world.notifyNeighborsOfStateChange(getPos().offset(e), getBlockType(), false);
}
}
代码示例来源:origin: Vazkii/Botania
public void onPlace(EntityLivingBase entity) {
if(entity != null) {
side = Arrays.asList(SIDES).indexOf(entity.getHorizontalFacing().getOpposite());
}
world.notifyNeighborsOfStateChange(getPos().offset(SIDES[side].getOpposite()), getBlockType(), false);
}
代码示例来源:origin: Vazkii/Botania
@Override
public void update() {
if(rotating) {
lastTickRotation = rotation;
rotation = (rotation + anglePerTick) % 360;
rotationTicks--;
if(rotationTicks <= 0) {
rotating = false;
// done rotating, tell neighbors
world.notifyNeighborsOfStateChange(getPos(), getBlockType(), false);
for(EnumFacing e : EnumFacing.VALUES) {
world.notifyNeighborsOfStateChange(getPos().offset(e), getBlockType(), false);
}
}
} else rotation = side * 90;
if(world.isRemote) {
int amt = rotating ? 3 : Math.random() < 0.1 ? 1 : 0;
double x = getPos().getX() + 0.5 + Math.cos((rotation + 90) / 180.0 * Math.PI) * 0.35;
double y = getPos().getY() + 0.2;
double z = getPos().getZ() + 0.5 + Math.sin((rotation + 90) / 180.0 * Math.PI) * 0.35;
for(int i = 0; i < amt; i++)
world.spawnParticle(EnumParticleTypes.REDSTONE, x, y, z, 0.0D, 0.0D, 0.0D);
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
public void openInventory( final EntityPlayer player )
{
if( !player.isSpectator() )
{
this.setPlayerOpen( this.getPlayerOpen() + 1 );
this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
if( this.getPlayerOpen() == 1 )
{
this.getWorld()
.playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_OPEN,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
}
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
super.onBlockAdded(world, pos, state);
if(!world.isRemote && world.getBlockState(pos.down()).getBlock() == Blocks.IRON_BARS && world.getBlockState(pos.down(2)).getBlock() == Blocks.IRON_BARS) {
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(pos.down(), Blocks.AIR.getDefaultState(), 2);
world.setBlockState(pos.down(2), Blocks.AIR.getDefaultState(), 2);
EntityBlaze blaze = new EntityBlaze(world);
blaze.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() - 1.95D, pos.getZ() + 0.5D, 0.0F, 0.0F);
blaze.deathLootTable = LOOT_TABLE;
blaze.onInitialSpawn(world.getDifficultyForLocation(pos), null);
world.spawnEntity(blaze);
world.notifyNeighborsOfStateChange(pos, Blocks.AIR, false);
world.notifyNeighborsOfStateChange(pos.down(), Blocks.AIR, false);
world.notifyNeighborsOfStateChange(pos.down(2), Blocks.AIR, false);
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
public void closeInventory( final EntityPlayer player )
{
if( !player.isSpectator() )
{
this.setPlayerOpen( this.getPlayerOpen() - 1 );
this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
if( this.getPlayerOpen() < 0 )
{
this.setPlayerOpen( 0 );
}
if( this.getPlayerOpen() == 0 )
{
this.getWorld()
.playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_CLOSE,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
}
}
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public void notifyNeighborsOfStateChange(@Nonnull BlockPos pos, @Nonnull Block blockType, boolean updateObservers) {
wrapped.notifyNeighborsOfStateChange(pos, blockType, updateObservers);
}
代码示例来源:origin: TheGreyGhost/MinecraftByExample
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
final boolean CASCADE_UPDATE = false; // I'm not sure what this flag does, but vanilla always sets it to false
// except for calls by World.setBlockState()
worldIn.notifyNeighborsOfStateChange(pos, this, CASCADE_UPDATE);
super.breakBlock(worldIn, pos, state);
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
cSrc.getWorld().notifyNeighborsOfStateChange( wc.getPos(), Platform.AIR_BLOCK, true );
cSrc.getWorld().notifyNeighborsOfStateChange( wc.getPos(), Platform.AIR_BLOCK, true );
代码示例来源:origin: TheGreyGhost/MinecraftByExample
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
super.breakBlock(worldIn, pos, state);
worldIn.removeTileEntity(pos);
final boolean CASCADE_UPDATE = false; // I'm not sure what this flag does, but vanilla always sets it to false
// except for calls by World.setBlockState()
worldIn.notifyNeighborsOfStateChange(pos, this, CASCADE_UPDATE);
}
代码示例来源:origin: SleepyTrousers/EnderIO
private void broadcastSignal() {
initialized = true;
world.notifyNeighborsOfStateChange(getPos(), getBlockType(), true);
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public void onMachineBroken() {
world.notifyNeighborsOfStateChange(getPos(), world.getBlockState(pos).getBlock(), false);
markDirty();
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public void onMachineAssembled(IMultiblockController multiblockController, BlockPos minCoord, BlockPos maxCoord) {
world.notifyNeighborsOfStateChange(getPos(), world.getBlockState(pos).getBlock(), false);
markDirty();
}
代码示例来源:origin: McJtyMods/DeepResonance
protected void notifyAndMarkDirty(){
if (WorldHelper.chunkLoaded(getWorld(), pos)){
this.markDirty();
this.getWorld().notifyNeighborsOfStateChange(pos, blockType, false);
}
}
代码示例来源:origin: Vazkii/Quark
@Override
public void openInventory(EntityPlayer player) {
super.openInventory(player);
if(!player.isSpectator() && getChestType() == VariedChests.CUSTOM_TYPE_QUARK_TRAP)
world.notifyNeighborsOfStateChange(pos.down(), getBlockType(), false);
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public void onMachineBroken() {
// Re-render this block on the client
if (world.isRemote) {
this.world.markBlockRangeForRenderUpdate(getPos(), getPos());
}
world.notifyNeighborsOfStateChange(getPos(), getBlockType(), false);
markDirty();
}
代码示例来源:origin: Ellpeck/ActuallyAdditions
protected void onUpdateSent(){
this.rangeBefore = this.range;
this.boundPosBefore = this.boundPosition;
this.boundBlockBefore = this.boundPosition == null ? null : this.world.getBlockState(this.boundPosition).getBlock();
if(this.boundPosition != null){
this.world.notifyNeighborsOfStateChange(this.pos, this.world.getBlockState(this.boundPosition).getBlock(), false);
}
this.sendUpdate();
this.markDirty();
}
代码示例来源:origin: CyclopsMC/IntegratedDynamics
public void updateRedstoneInfo(EnumFacing side, boolean strongPower) {
this.markDirty();
if (getWorld().isBlockLoaded(getPos().offset(side))) {
getWorld().neighborChanged(getPos().offset(side), getBlockType(), getPos());
if (strongPower) {
// When we are emitting a strong power, also update all neighbours of the target
getWorld().notifyNeighborsOfStateChange(getPos().offset(side), getBlockType(), true);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!