net.minecraft.world.World.neighborChanged()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中net.minecraft.world.World.neighborChanged()方法的一些代码示例,展示了World.neighborChanged()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.neighborChanged()方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:neighborChanged

World.neighborChanged介绍

暂无

代码示例

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public void neighborChanged(@Nonnull BlockPos pos, @Nonnull Block p_190524_2_, @Nonnull BlockPos p_190524_3_) {
 wrapped.neighborChanged(pos, p_190524_2_, p_190524_3_);
}

代码示例来源:origin: amadornes/MCMultiPart

@Override
public void neighborChanged(BlockPos p_190524_1_, Block p_190524_2_, BlockPos p_190524_3_) {
  getActualWorld().neighborChanged(p_190524_1_, p_190524_2_, p_190524_3_);
}

代码示例来源:origin: SleepyTrousers/EnderIO

private void doConduitsDirty() {
 IBlockState bs = world.getBlockState(pos);
 world.notifyBlockUpdate(pos, bs, bs, 3);
 world.neighborChanged(pos, getBlockType(), pos);
 markDirty();
 forceUpdatePlayers();
 conduitsDirty = false;
}

代码示例来源:origin: McJtyMods/RFToolsControl

public void setPowerOut(EnumFacing side, int powerOut) {
  this.powerOut[side.ordinal()] = powerOut;
  markDirty();
  getWorld().neighborChanged(this.pos.offset(side), this.getBlockType(), this.pos);
}

代码示例来源:origin: McJtyMods/XNet

public void setPowerOut(EnumFacing side, int powerOut) {
  if (powerOut > 15) {
    powerOut = 15;
  }
  if (this.powerOut[side.ordinal()] == powerOut) {
    return;
  }
  this.powerOut[side.ordinal()] = powerOut;
  markDirty();
  world.neighborChanged(pos.offset(side), this.getBlockType(), this.pos);
}

代码示例来源:origin: Vazkii/Quark

protected void notifyNeighbors(World worldIn, BlockPos pos, IBlockState state) {
  EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
  BlockPos blockpos = pos.offset(enumfacing.getOpposite());
  if(ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), EnumSet.of(enumfacing.getOpposite()), false).isCanceled())
    return;
  worldIn.neighborChanged(blockpos, this, pos);
  worldIn.notifyNeighborsOfStateExcept(blockpos, this, enumfacing);
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

public void setConnections(int connections, boolean notify) {
  this.connections = connections;
  if (notify) {
    UPDATING_POS.add(getPos());
    world.markBlockRangeForRenderUpdate(pos, pos);
    for (EnumFacing facing : EnumFacing.VALUES) {
      if (isConnectedFromSide(facing)) {
        if (!UPDATING_POS.contains(getPos().offset(facing)))
          world.neighborChanged(getPos().offset(facing), getBlockType(), getPos());
      }
    }
    markDirty();
  }
}

代码示例来源:origin: CoFH/ThermalDynamics

public void setPowerLevel(int powerLevel) {
  if (this.powerLevel != powerLevel) {
    this.powerLevel = powerLevel;
    GridStructural grid = structureUnit.getGrid();
    if (grid != null) {
      grid.signalsUpToDate = false;
    }
    if (isOutput()) {
      BlockPos offsetPos = baseTile.getPos().offset(EnumFacing.VALUES[side]);
      baseTile.world().neighborChanged(offsetPos, baseTile.getBlockType(), baseTile.getPos());
      for (int i = 0; i < 6; i++) {
        if (side == (i ^ 1)) {
          continue;
        }
        offsetPos = baseTile.getPos().offset(EnumFacing.VALUES[side]);
        baseTile.world().neighborChanged(offsetPos, baseTile.getBlockType(), baseTile.getPos());
      }
    }
  }
}

代码示例来源:origin: SleepyTrousers/EnderIO

private void notifyConduitNeighbours(@Nonnull IRedstoneConduit con) {
 TileEntity te = con.getBundle().getEntity();
 World world = te.getWorld();
 BlockPos bc1 = te.getPos();
 if (!world.isBlockLoaded(bc1)) {
  return;
 }
 // Done manually to avoid orphaning chunks
 EnumSet<EnumFacing> cons = EnumSet.copyOf(con.getExternalConnections());
 if (!neighborNotifyEvent(world, bc1, null, cons)) {
  for (EnumFacing dir : con.getExternalConnections()) {
   BlockPos bc2 = bc1.offset(NullHelper.notnull(dir, "Conduit external connections contains null"));
   if (world.isBlockLoaded(bc2)) {
    world.neighborChanged(bc2, ConduitRegistry.getConduitModObjectNN().getBlockNN(), bc1);
    IBlockState bs = world.getBlockState(bc2);
    if (bs.isBlockNormalCube() && !neighborNotifyEvent(world, bc2, bs, EnumSet.allOf(EnumFacing.class))) {
     for (NNIterator<EnumFacing> itr = NNList.FACING.fastIterator(); itr.hasNext();) {
      EnumFacing dir2 = itr.next();
      BlockPos bc3 = bc2.offset(dir2);
      if (!bc3.equals(bc1) && world.isBlockLoaded(bc3)) {
       world.neighborChanged(bc3, ConduitRegistry.getConduitModObjectNN().getBlockNN(), bc1);
      }
     }
    }
   }
  }
 }
}

代码示例来源:origin: McJtyMods/RFToolsControl

@Override
  public void setPowerOut(@Nonnull BlockSide side, int level) {
    EnumFacing facing = side.getSide();
    BlockPos p = getAdjacentPosition(side);
    if (p == null) {
      return;
    }

    if (level < 0) {
      level = 0;
    } else if (level > 15) {
      level = 15;
    }

    if (p.equals(pos)) {
      powerOut[facing.ordinal()] = level;
      markDirty();
      getWorld().neighborChanged(this.pos.offset(facing), this.getBlockType(), this.pos);
    } else {
      NodeTileEntity te = (NodeTileEntity) getWorld().getTileEntity(p);
      te.setPowerOut(facing, level);
}
  }

代码示例来源:origin: GregTechCE/GregTech

/**
 * Sets this holder's current meta tile entity to copy of given one
 * Note that this method copies given meta tile entity and returns actual instance
 * so it is safe to call it on sample meta tile entities
 */
public MetaTileEntity setMetaTileEntity(MetaTileEntity sampleMetaTileEntity) {
  Preconditions.checkNotNull(sampleMetaTileEntity, "metaTileEntity");
  this.metaTileEntity = sampleMetaTileEntity.createMetaTileEntity(this);
  this.metaTileEntity.holder = this;
  if(hasWorld() && !getWorld().isRemote) {
    updateBlockOpacity();
    writeCustomData(-1, buffer -> {
      buffer.writeVarInt(GregTechAPI.META_TILE_ENTITY_REGISTRY.getIdByObjectName(metaTileEntity.metaTileEntityId));
      metaTileEntity.writeInitialSyncData(buffer);
    });
    //just to update neighbours so cables and other things will work properly
    this.needToUpdateLightning = true;
    world.neighborChanged(getPos(), getBlockType(), getPos());
    markDirty();
  }
  return metaTileEntity;
}

代码示例来源:origin: SleepyTrousers/EnderIO

final BlockPos offset = pos.offset(side);
tracker.start("World.notifyNeighborsOfStateChange() from " + pos + " to " + offset + " (" + world.getBlockState(offset) + ")");
world.neighborChanged(offset, blockType, pos);
tracker.stop();

代码示例来源: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);
    }
  }
}

相关文章

微信公众号

最新文章

更多

World类方法