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

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

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

World.neighborChanged介绍

暂无

代码示例

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

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

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

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

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

  1. private void doConduitsDirty() {
  2. IBlockState bs = world.getBlockState(pos);
  3. world.notifyBlockUpdate(pos, bs, bs, 3);
  4. world.neighborChanged(pos, getBlockType(), pos);
  5. markDirty();
  6. forceUpdatePlayers();
  7. conduitsDirty = false;
  8. }

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

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

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

  1. public void setPowerOut(EnumFacing side, int powerOut) {
  2. if (powerOut > 15) {
  3. powerOut = 15;
  4. }
  5. if (this.powerOut[side.ordinal()] == powerOut) {
  6. return;
  7. }
  8. this.powerOut[side.ordinal()] = powerOut;
  9. markDirty();
  10. world.neighborChanged(pos.offset(side), this.getBlockType(), this.pos);
  11. }

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

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

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

  1. public void setConnections(int connections, boolean notify) {
  2. this.connections = connections;
  3. if (notify) {
  4. UPDATING_POS.add(getPos());
  5. world.markBlockRangeForRenderUpdate(pos, pos);
  6. for (EnumFacing facing : EnumFacing.VALUES) {
  7. if (isConnectedFromSide(facing)) {
  8. if (!UPDATING_POS.contains(getPos().offset(facing)))
  9. world.neighborChanged(getPos().offset(facing), getBlockType(), getPos());
  10. }
  11. }
  12. markDirty();
  13. }
  14. }

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

  1. public void setPowerLevel(int powerLevel) {
  2. if (this.powerLevel != powerLevel) {
  3. this.powerLevel = powerLevel;
  4. GridStructural grid = structureUnit.getGrid();
  5. if (grid != null) {
  6. grid.signalsUpToDate = false;
  7. }
  8. if (isOutput()) {
  9. BlockPos offsetPos = baseTile.getPos().offset(EnumFacing.VALUES[side]);
  10. baseTile.world().neighborChanged(offsetPos, baseTile.getBlockType(), baseTile.getPos());
  11. for (int i = 0; i < 6; i++) {
  12. if (side == (i ^ 1)) {
  13. continue;
  14. }
  15. offsetPos = baseTile.getPos().offset(EnumFacing.VALUES[side]);
  16. baseTile.world().neighborChanged(offsetPos, baseTile.getBlockType(), baseTile.getPos());
  17. }
  18. }
  19. }
  20. }

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

  1. private void notifyConduitNeighbours(@Nonnull IRedstoneConduit con) {
  2. TileEntity te = con.getBundle().getEntity();
  3. World world = te.getWorld();
  4. BlockPos bc1 = te.getPos();
  5. if (!world.isBlockLoaded(bc1)) {
  6. return;
  7. }
  8. // Done manually to avoid orphaning chunks
  9. EnumSet<EnumFacing> cons = EnumSet.copyOf(con.getExternalConnections());
  10. if (!neighborNotifyEvent(world, bc1, null, cons)) {
  11. for (EnumFacing dir : con.getExternalConnections()) {
  12. BlockPos bc2 = bc1.offset(NullHelper.notnull(dir, "Conduit external connections contains null"));
  13. if (world.isBlockLoaded(bc2)) {
  14. world.neighborChanged(bc2, ConduitRegistry.getConduitModObjectNN().getBlockNN(), bc1);
  15. IBlockState bs = world.getBlockState(bc2);
  16. if (bs.isBlockNormalCube() && !neighborNotifyEvent(world, bc2, bs, EnumSet.allOf(EnumFacing.class))) {
  17. for (NNIterator<EnumFacing> itr = NNList.FACING.fastIterator(); itr.hasNext();) {
  18. EnumFacing dir2 = itr.next();
  19. BlockPos bc3 = bc2.offset(dir2);
  20. if (!bc3.equals(bc1) && world.isBlockLoaded(bc3)) {
  21. world.neighborChanged(bc3, ConduitRegistry.getConduitModObjectNN().getBlockNN(), bc1);
  22. }
  23. }
  24. }
  25. }
  26. }
  27. }
  28. }

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

  1. @Override
  2. public void setPowerOut(@Nonnull BlockSide side, int level) {
  3. EnumFacing facing = side.getSide();
  4. BlockPos p = getAdjacentPosition(side);
  5. if (p == null) {
  6. return;
  7. }
  8. if (level < 0) {
  9. level = 0;
  10. } else if (level > 15) {
  11. level = 15;
  12. }
  13. if (p.equals(pos)) {
  14. powerOut[facing.ordinal()] = level;
  15. markDirty();
  16. getWorld().neighborChanged(this.pos.offset(facing), this.getBlockType(), this.pos);
  17. } else {
  18. NodeTileEntity te = (NodeTileEntity) getWorld().getTileEntity(p);
  19. te.setPowerOut(facing, level);
  20. }
  21. }

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

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

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

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

代码示例来源:origin: CyclopsMC/IntegratedDynamics

  1. public void updateRedstoneInfo(EnumFacing side, boolean strongPower) {
  2. this.markDirty();
  3. if (getWorld().isBlockLoaded(getPos().offset(side))) {
  4. getWorld().neighborChanged(getPos().offset(side), getBlockType(), getPos());
  5. if (strongPower) {
  6. // When we are emitting a strong power, also update all neighbours of the target
  7. getWorld().notifyNeighborsOfStateChange(getPos().offset(side), getBlockType(), true);
  8. }
  9. }
  10. }

相关文章

World类方法