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

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

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

World.markChunkDirty介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. @Override
  2. public void saveChanges( final ICellInventory<?> cellInventory )
  3. {
  4. this.world.markChunkDirty( this.pos, this );
  5. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. public void saveChanges()
  2. {
  3. if( this.world != null )
  4. {
  5. this.world.markChunkDirty( this.pos, this );
  6. if( !this.markDirtyQueued )
  7. {
  8. TickHandler.INSTANCE.addCallable( null, this::markDirtyAtEndOfTick );
  9. this.markDirtyQueued = true;
  10. }
  11. }
  12. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. @Override
  2. public void saveChanges( final ICellInventory<?> cellInventory )
  3. {
  4. if( cellInventory != null )
  5. {
  6. cellInventory.persist();
  7. }
  8. this.world.markChunkDirty( this.pos, this );
  9. }

代码示例来源:origin: raoulvdberge/refinedstorage

  1. @Override
  2. public void markDirty() {
  3. if (world != null) {
  4. world.markChunkDirty(pos, this);
  5. }
  6. }
  7. }

代码示例来源:origin: ExtraCells/ExtraCells2

  1. @Override
  2. public void saveChanges(ICellInventory<?> imeInventory) {
  3. this.world.markChunkDirty( this.pos, this );
  4. }

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

  1. public void markChunkDirty() {
  2. world.markChunkDirty(pos, this);
  3. }

代码示例来源:origin: OpenMods/OpenModsLib

  1. public void markUpdated() {
  2. world.markChunkDirty(pos, this);
  3. }

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

  1. @Override
  2. public void markChunkDirty(@Nonnull BlockPos pos, @Nonnull TileEntity unusedTileEntity) {
  3. wrapped.markChunkDirty(pos, unusedTileEntity);
  4. }

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

  1. @Override
  2. public void markChunkDirty(BlockPos pos, TileEntity unusedTileEntity) {
  3. getActualWorld().markChunkDirty(pos, unusedTileEntity);
  4. }

代码示例来源:origin: WayofTime/BloodMagic

  1. @SubscribeEvent
  2. public static void onServerWorldTick(TickEvent.WorldTickEvent event) {
  3. if (event.world.isRemote)
  4. return;
  5. int dim = event.world.provider.getDimension();
  6. if (event.phase == TickEvent.Phase.END) {
  7. if (!SERVER_TICKS.containsKey(dim))
  8. SERVER_TICKS.put(dim, 0);
  9. int ticks = (SERVER_TICKS.get(dim));
  10. if (ticks % 20 == 0) {
  11. CopyOnWriteArrayList<PosXY> dirtyChunks = WorldDemonWillHandler.dirtyChunks.get(dim);
  12. if ((dirtyChunks != null) && (dirtyChunks.size() > 0)) {
  13. for (PosXY pos : dirtyChunks)
  14. event.world.markChunkDirty(new BlockPos(pos.x * 16, 5, pos.y * 16), null);
  15. dirtyChunks.clear();
  16. }
  17. }
  18. SERVER_TICKS.put(dim, ticks + 1);
  19. }
  20. }

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

  1. @SuppressWarnings("null") // gah, Eclipse thinks a final field can go null from one side of the comma to the next
  2. @Override
  3. public IMessage doSetLabel(@Nullable String label) {
  4. ta.setLabel(label);
  5. if (te != null) { // TODO what's this? overkill?
  6. IBlockState bs = te.getWorld().getBlockState(te.getPos());
  7. te.getWorld().notifyBlockUpdate(te.getPos(), bs, bs, 3);
  8. te.getWorld().markChunkDirty(te.getPos(), te);
  9. }
  10. return null;
  11. }

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

  1. @SuppressWarnings("null") // gah, Eclipse thinks a final field can go null from one side of the comma to the next
  2. @Override
  3. public IMessage doSetAccessMode(@Nonnull AccessMode accesmode) {
  4. ta.setAccessMode(accesmode);
  5. if (te != null) { // TODO what's this? overkill?
  6. IBlockState bs = te.getWorld().getBlockState(te.getPos());
  7. te.getWorld().notifyBlockUpdate(te.getPos(), bs, bs, 3);
  8. te.getWorld().markChunkDirty(te.getPos(), te);
  9. }
  10. return null;
  11. }

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

  1. @Override
  2. public void markDirty() {
  3. if (hasWorld() && world.isBlockLoaded(getPos())) { // we need the loaded check to make sure we don't trigger a chunk load while the chunk is loaded
  4. world.markChunkDirty(pos, this);
  5. IBlockState state = world.getBlockState(pos);
  6. if (state.hasComparatorInputOverride()) {
  7. world.updateComparatorOutputLevel(pos, state.getBlock());
  8. }
  9. }
  10. }

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

  1. @SuppressWarnings("null") // gah, Eclipse thinks a final field can go null from one side of the comma to the next
  2. @Override
  3. public IMessage doSetVisible(boolean visible) {
  4. ta.setVisible(visible);
  5. if (te != null) { // TODO what's this? overkill?
  6. IBlockState bs = te.getWorld().getBlockState(te.getPos());
  7. te.getWorld().notifyBlockUpdate(te.getPos(), bs, bs, 3);
  8. te.getWorld().markChunkDirty(te.getPos(), te);
  9. }
  10. return null;
  11. }

代码示例来源:origin: PrinceOfAmber/Cyclic

  1. public static boolean destroyBlock(World world, BlockPos pos) {
  2. if (world.getTileEntity(pos) != null) {
  3. world.removeTileEntity(pos);
  4. }
  5. try {
  6. boolean setToAirSuccess = world.setBlockToAir(pos);
  7. if (setToAirSuccess == false) {
  8. setToAirSuccess = world.destroyBlock(pos, false);//destroy with no drops if setToAir failed
  9. }
  10. }
  11. catch (Exception e) {
  12. ModCyclic.logger.error("Error thrown by a tile entity when removing the block: " + e.getMessage());
  13. e.printStackTrace();
  14. return false;
  15. }
  16. world.markChunkDirty(pos, null);//dont forget to update the old pos as well as the new position for server sync
  17. // IN CASE OF DOUBLE CHESTS
  18. tryUpdateNeighbour(world, pos.north());
  19. tryUpdateNeighbour(world, pos.south());
  20. tryUpdateNeighbour(world, pos.east());
  21. tryUpdateNeighbour(world, pos.west());
  22. return true;
  23. }

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

  1. private void setConduitVolumes() {
  2. if (tank.containsValidLiquid() && !getConduits().isEmpty()) {
  3. FluidStack fluidPerConduit = tank.getFluid().copy();
  4. int numCons = getConduits().size();
  5. int leftOvers = fluidPerConduit.amount % numCons;
  6. fluidPerConduit.amount = fluidPerConduit.amount / numCons;
  7. for (AdvancedLiquidConduit con : getConduits()) {
  8. FluidStack f = fluidPerConduit.copy();
  9. if (leftOvers > 0) {
  10. f.amount += 1;
  11. leftOvers--;
  12. }
  13. con.getTank().setLiquid(f);
  14. BlockPos pos = con.getBundle().getLocation();
  15. con.getBundle().getEntity().getWorld().markChunkDirty(pos, con.getBundle().getEntity());
  16. }
  17. }
  18. }

代码示例来源:origin: ForestryMC/Binnie

  1. public void onUpdate() {
  2. if (!this.getWorld().isRemote) {
  3. for (final MachineComponent component : this.getComponents()) {
  4. component.onUpdate();
  5. }
  6. } else {
  7. //noinspection MethodCallSideOnly
  8. updateClient();
  9. }
  10. if (this.queuedInventoryUpdate) {
  11. for (final MachineComponent component : this.getComponents()) {
  12. component.onInventoryUpdate();
  13. }
  14. TileEntity tileEntity = getTileEntity();
  15. getWorld().markChunkDirty(tileEntity.getPos(), tileEntity);
  16. this.queuedInventoryUpdate = false;
  17. }
  18. }

代码示例来源:origin: PrinceOfAmber/Cyclic

  1. public void run() {
  2. EntityPlayerMP player = ctx.getServerHandler().player;
  3. World world = player.getEntityWorld();
  4. TileEntityPassword tile = (TileEntityPassword) world.getTileEntity(message.pos);
  5. if (tile != null) {
  6. switch (message.type) {
  7. case ACTIVETYPE:
  8. tile.toggleActiveType();
  9. break;
  10. case PASSTEXT:
  11. tile.setMyPassword(message.password);
  12. break;
  13. case USERSALLOWED:
  14. tile.toggleUserType();
  15. break;
  16. case USERCLAIM:
  17. tile.toggleClaimedHash(player);
  18. break;
  19. }
  20. tile.markDirty();
  21. player.getEntityWorld().markChunkDirty(message.pos, tile);
  22. final IBlockState oldState = world.getBlockState(message.pos);
  23. //http://www.minecraftforge.net/forum/index.php?topic=38710.0
  24. world.notifyBlockUpdate(message.pos, oldState, oldState, 3);
  25. }
  26. }
  27. });

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

  1. public void cleanItem() {
  2. if (this.canClean()) {
  3. for (int i = 2; i < 8; i++) {
  4. ItemStack slot = this.slots.get(i);
  5. if (isStackable(slot, this.cleanedItemResult)) {
  6. if (slot.isEmpty()) {
  7. this.slots.set(i, this.cleanedItemResult.copy());
  8. } else {
  9. slot.grow(this.cleanedItemResult.getCount());
  10. }
  11. ItemStack shrinked = this.slots.get(0).copy();
  12. shrinked.shrink(1);
  13. this.setInventorySlotContents(0, shrinked);
  14. this.cleanedItemResult = ItemStack.EMPTY;
  15. if (this.slots.get(0).getCount() <= 0) {
  16. this.setInventorySlotContents(0, ItemStack.EMPTY);
  17. }
  18. this.world.markChunkDirty(this.pos, this);
  19. break;
  20. }
  21. }
  22. }
  23. }

代码示例来源:origin: PrinceOfAmber/Cyclic

  1. newTile.markDirty();
  2. world.markChunkDirty(posMoveToHere, newTile);

相关文章

World类方法