Java Code Examples for net.minecraftforge.common.ForgeChunkManager#unforceChunk()
The following examples show how to use
net.minecraftforge.common.ForgeChunkManager#unforceChunk() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TicketMap.java From MyTown2 with The Unlicense | 6 votes |
public void chunkUnload(TownBlock block) { ForgeChunkManager.Ticket ticket = get(block.getDim()); ForgeChunkManager.unforceChunk(ticket, block.toChunkCoords()); NBTTagList list = ticket.getModData().getTagList("chunkCoords", Constants.NBT.TAG_COMPOUND); for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound chunkNBT = list.getCompoundTagAt(i); int x = chunkNBT.getInteger("x"); int z = chunkNBT.getInteger("z"); if (x == block.getX() && z == block.getZ()) { list.removeTag(i); break; } } }
Example 2
Source File: ChunkLoaderManager.java From ChickenChunks with MIT License | 5 votes |
protected void remChunk(DimChunkCoord coord) { Ticket ticket = heldChunks.remove(coord); if (ticket == null) return; ForgeChunkManager.unforceChunk(ticket, coord.getChunkCoord()); if (ticket.getChunkList().size() == ticket.getChunkListDepth() - 1) { Stack<Ticket> freeTickets = ticketsWithSpace.get(coord.dimension); if (freeTickets == null) ticketsWithSpace.put(coord.dimension, freeTickets = new Stack<Ticket>()); freeTickets.push(ticket); } }
Example 3
Source File: ChunkLoading.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
public void tickChunkTimeouts() { DimChunkCoordTimeout dcct; Iterator<Map.Entry<String, DimChunkCoordTimeout>> iterator = this.timeOuts.entrySet().iterator(); //int j = 0; // FIXME debug while (iterator.hasNext()) { dcct = iterator.next().getValue(); //System.out.printf("tickChunkTimeouts(): loop %d, timeout: %d\n", j++, dcct.timeout); if (dcct != null && (this.playerTickets.containsValue(dcct.ticket) || this.modTickets.containsValue(dcct.ticket))) { if (dcct.tick() == 0) { //System.out.printf("tickChunkTimeouts(): unforcing, dim: %d, %s\n", dcct.dimension, dcct.chunkCoords.toString()); ForgeChunkManager.unforceChunk(dcct.ticket, dcct.chunkCoords); if (dcct.ticket != null && dcct.ticket.getChunkList().size() == 0) { this.removeTicket(dcct.ticket); ForgeChunkManager.releaseTicket(dcct.ticket); } iterator.remove(); } } // If this chunk doesn't have a valid ticket anymore, just remove the entry else { //System.out.println("tickChunkTimeouts(): invalid ticket, removing timeout entry"); iterator.remove(); } } }