use of net.minecraft.world.server.ChunkHolder in project Arclight by IzzelAliz.
the class ServerChunkProviderMixin method func_217233_c.
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
private CompletableFuture<Either<IChunk, ChunkHolder.IChunkLoadingError>> func_217233_c(int chunkX, int chunkZ, ChunkStatus requiredStatus, boolean load) {
ChunkPos chunkpos = new ChunkPos(chunkX, chunkZ);
long i = chunkpos.asLong();
int j = 33 + ChunkStatus.getDistance(requiredStatus);
ChunkHolder chunkholder = this.func_217213_a(i);
boolean unloading = false;
if (chunkholder != null) {
ChunkHolder.LocationType chunkStatus = ChunkHolder.getLocationTypeFromLevel(((ChunkHolderBridge) chunkholder).bridge$getOldTicketLevel());
ChunkHolder.LocationType currentStatus = ChunkHolder.getLocationTypeFromLevel(chunkholder.getChunkLevel());
unloading = chunkStatus.isAtLeast(ChunkHolder.LocationType.BORDER) && !currentStatus.isAtLeast(ChunkHolder.LocationType.BORDER);
}
if (load && !unloading) {
this.ticketManager.registerWithLevel(TicketType.UNKNOWN, chunkpos, j, chunkpos);
if (this.func_217224_a(chunkholder, j)) {
IProfiler iprofiler = this.world.getProfiler();
iprofiler.startSection("chunkLoad");
this.func_217235_l();
chunkholder = this.func_217213_a(i);
iprofiler.endSection();
if (this.func_217224_a(chunkholder, j)) {
throw new IllegalStateException("No chunk holder after ticket has been added");
}
}
}
return this.func_217224_a(chunkholder, j) ? ChunkHolder.MISSING_CHUNK_FUTURE : chunkholder.func_219276_a(requiredStatus, this.chunkManager);
}
use of net.minecraft.world.server.ChunkHolder in project dynmap by webbukkit.
the class DynmapExpCommand method registerEvents.
private void registerEvents() {
// To trigger rendering.
onblockchange = core.isTrigger("blockupdate");
onchunkpopulate = core.isTrigger("chunkpopulate");
onchunkgenerate = core.isTrigger("chunkgenerate");
onblockchange_with_id = core.isTrigger("blockupdate-with-id");
if (onblockchange_with_id)
onblockchange = true;
if ((worldTracker == null) && (onblockchange || onchunkpopulate || onchunkgenerate)) {
worldTracker = new WorldTracker();
MinecraftForge.EVENT_BUS.register(worldTracker);
}
// Prime the known full chunks
if (onchunkgenerate && (server.getWorlds() != null)) {
for (ServerWorld world : server.getWorlds()) {
ForgeWorld fw = getWorld(world);
if (fw == null)
continue;
Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = world.getChunkProvider().chunkManager.immutableLoadedChunks;
for (Entry<Long, ChunkHolder> k : chunks.long2ObjectEntrySet()) {
long key = k.getKey().longValue();
ChunkHolder ch = k.getValue();
IChunk c = null;
try {
c = ch.func_219302_f().getNow(null);
} catch (Exception x) {
}
if (c == null)
continue;
ChunkStatus cs = c.getStatus();
ChunkPos pos = ch.getPosition();
if (cs == ChunkStatus.FULL) {
// Cooked?
// Add it as known
addKnownChunk(fw, pos);
}
}
}
}
}
use of net.minecraft.world.server.ChunkHolder in project dynmap by webbukkit.
the class DynmapExpCommand method registerEvents.
private void registerEvents() {
// To trigger rendering.
onblockchange = core.isTrigger("blockupdate");
onchunkpopulate = core.isTrigger("chunkpopulate");
onchunkgenerate = core.isTrigger("chunkgenerate");
onblockchange_with_id = core.isTrigger("blockupdate-with-id");
if (onblockchange_with_id)
onblockchange = true;
if ((worldTracker == null) && (onblockchange || onchunkpopulate || onchunkgenerate)) {
worldTracker = new WorldTracker();
MinecraftForge.EVENT_BUS.register(worldTracker);
}
// Prime the known full chunks
if (onchunkgenerate && (server.getWorlds() != null)) {
for (ServerWorld world : server.getWorlds()) {
ForgeWorld fw = getWorld(world);
if (fw == null)
continue;
Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = world.getChunkProvider().chunkManager.field_219252_f.clone();
for (Entry<Long, ChunkHolder> k : chunks.long2ObjectEntrySet()) {
long key = k.getKey().longValue();
ChunkHolder ch = k.getValue();
IChunk c = null;
try {
c = ch.func_219302_f().getNow(null);
} catch (Exception x) {
}
if (c == null)
continue;
ChunkStatus cs = c.getStatus();
ChunkPos pos = ch.getPosition();
if (cs == ChunkStatus.FULL) {
// Cooked?
// Add it as known
addKnownChunk(fw, pos);
}
}
}
}
}
use of net.minecraft.world.server.ChunkHolder in project dynmap by webbukkit.
the class DynmapExpCommand method registerEvents.
private void registerEvents() {
// To trigger rendering.
onblockchange = core.isTrigger("blockupdate");
onchunkpopulate = core.isTrigger("chunkpopulate");
onchunkgenerate = core.isTrigger("chunkgenerate");
onblockchange_with_id = core.isTrigger("blockupdate-with-id");
if (onblockchange_with_id)
onblockchange = true;
if ((worldTracker == null) && (onblockchange || onchunkpopulate || onchunkgenerate)) {
worldTracker = new WorldTracker();
MinecraftForge.EVENT_BUS.register(worldTracker);
}
// Prime the known full chunks
if (onchunkgenerate && (server.getWorlds() != null)) {
for (ServerWorld world : server.getWorlds()) {
ForgeWorld fw = getWorld(world);
if (fw == null)
continue;
Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = world.getChunkProvider().chunkManager.immutableLoadedChunks;
for (Entry<Long, ChunkHolder> k : chunks.long2ObjectEntrySet()) {
long key = k.getKey().longValue();
ChunkHolder ch = k.getValue();
IChunk c = null;
try {
c = ch.func_219302_f().getNow(null);
} catch (Exception x) {
}
if (c == null)
continue;
ChunkStatus cs = c.getStatus();
ChunkPos pos = ch.getPosition();
if (cs == ChunkStatus.FULL) {
// Cooked?
// Add it as known
addKnownChunk(fw, pos);
}
}
}
}
}
Aggregations