use of org.dynmap.fabric_1_15_2.mixin.ThreadedAnvilChunkStorageAccessor in project dynmap by webbukkit.
the class DynmapPlugin 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();
ServerWorldEvents.LOAD.register((server, world) -> worldTracker.handleWorldLoad(server, world));
ServerWorldEvents.UNLOAD.register((server, world) -> worldTracker.handleWorldUnload(server, world));
ServerChunkEvents.CHUNK_LOAD.register((world, chunk) -> worldTracker.handleChunkLoad(world, chunk));
ServerChunkEvents.CHUNK_UNLOAD.register((world, chunk) -> worldTracker.handleChunkUnload(world, chunk));
ChunkDataEvents.SAVE.register((world, chunk) -> worldTracker.handleChunkDataSave(world, chunk));
BlockEvents.EVENT.register((world, pos) -> worldTracker.handleBlockEvent(world, pos));
}
// Prime the known full chunks
if (onchunkgenerate && (server.getWorlds() != null)) {
for (ServerWorld world : server.getWorlds()) {
FabricWorld fw = getWorld(world);
if (fw == null)
continue;
Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = ((ThreadedAnvilChunkStorageAccessor) world.getChunkManager().threadedAnvilChunkStorage).getChunkHolders();
for (Map.Entry<Long, ChunkHolder> k : chunks.long2ObjectEntrySet()) {
long key = k.getKey();
ChunkHolder ch = k.getValue();
Chunk c = null;
try {
c = ch.getSavingFuture().getNow(null);
} catch (Exception x) {
}
if (c == null)
continue;
ChunkStatus cs = c.getStatus();
ChunkPos pos = ch.getPos();
if (cs == ChunkStatus.FULL) {
// Cooked?
// Add it as known
addKnownChunk(fw, pos);
}
}
}
}
}
use of org.dynmap.fabric_1_15_2.mixin.ThreadedAnvilChunkStorageAccessor in project dynmap by webbukkit.
the class DynmapPlugin 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();
ServerWorldEvents.LOAD.register((server, world) -> worldTracker.handleWorldLoad(server, world));
ServerWorldEvents.UNLOAD.register((server, world) -> worldTracker.handleWorldUnload(server, world));
ServerChunkEvents.CHUNK_LOAD.register((world, chunk) -> worldTracker.handleChunkLoad(world, chunk));
ServerChunkEvents.CHUNK_UNLOAD.register((world, chunk) -> worldTracker.handleChunkUnload(world, chunk));
ChunkDataEvents.SAVE.register((world, chunk) -> worldTracker.handleChunkDataSave(world, chunk));
BlockEvents.EVENT.register((world, pos) -> worldTracker.handleBlockEvent(world, pos));
}
// Prime the known full chunks
if (onchunkgenerate && (server.getWorlds() != null)) {
for (ServerWorld world : server.getWorlds()) {
FabricWorld fw = getWorld(world);
if (fw == null)
continue;
Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = ((ThreadedAnvilChunkStorageAccessor) world.getChunkManager().threadedAnvilChunkStorage).getChunkHolders();
for (Map.Entry<Long, ChunkHolder> k : chunks.long2ObjectEntrySet()) {
long key = k.getKey();
ChunkHolder ch = k.getValue();
Chunk c = null;
try {
c = ch.getFuture().getNow(null);
} catch (Exception x) {
}
if (c == null)
continue;
ChunkStatus cs = c.getStatus();
ChunkPos pos = ch.getPos();
if (cs == ChunkStatus.FULL) {
// Cooked?
// Add it as known
addKnownChunk(fw, pos);
}
}
}
}
}
use of org.dynmap.fabric_1_15_2.mixin.ThreadedAnvilChunkStorageAccessor in project dynmap by webbukkit.
the class DynmapPlugin 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();
ServerWorldEvents.LOAD.register((server, world) -> worldTracker.handleWorldLoad(server, world));
ServerWorldEvents.UNLOAD.register((server, world) -> worldTracker.handleWorldUnload(server, world));
ServerChunkEvents.CHUNK_LOAD.register((world, chunk) -> worldTracker.handleChunkLoad(world, chunk));
ServerChunkEvents.CHUNK_UNLOAD.register((world, chunk) -> worldTracker.handleChunkUnload(world, chunk));
ChunkDataEvents.SAVE.register((world, chunk) -> worldTracker.handleChunkDataSave(world, chunk));
BlockEvents.EVENT.register((world, pos) -> worldTracker.handleBlockEvent(world, pos));
}
// Prime the known full chunks
if (onchunkgenerate && (server.getWorlds() != null)) {
for (ServerWorld world : server.getWorlds()) {
FabricWorld fw = getWorld(world);
if (fw == null)
continue;
Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = ((ThreadedAnvilChunkStorageAccessor) world.getChunkManager().threadedAnvilChunkStorage).getChunkHolders();
for (Map.Entry<Long, ChunkHolder> k : chunks.long2ObjectEntrySet()) {
long key = k.getKey();
ChunkHolder ch = k.getValue();
Chunk c = null;
try {
c = ch.getFuture().getNow(null);
} catch (Exception x) {
}
if (c == null)
continue;
ChunkStatus cs = c.getStatus();
ChunkPos pos = ch.getPos();
if (cs == ChunkStatus.FULL) {
// Cooked?
// Add it as known
addKnownChunk(fw, pos);
}
}
}
}
}
use of org.dynmap.fabric_1_15_2.mixin.ThreadedAnvilChunkStorageAccessor in project dynmap by webbukkit.
the class DynmapPlugin 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();
ServerWorldEvents.LOAD.register((server, world) -> worldTracker.handleWorldLoad(server, world));
ServerWorldEvents.UNLOAD.register((server, world) -> worldTracker.handleWorldUnload(server, world));
ServerChunkEvents.CHUNK_LOAD.register((world, chunk) -> worldTracker.handleChunkLoad(world, chunk));
ServerChunkEvents.CHUNK_UNLOAD.register((world, chunk) -> worldTracker.handleChunkUnload(world, chunk));
ChunkDataEvents.SAVE.register((world, chunk) -> worldTracker.handleChunkDataSave(world, chunk));
BlockEvents.EVENT.register((world, pos) -> worldTracker.handleBlockEvent(world, pos));
}
// Prime the known full chunks
if (onchunkgenerate && (server.getWorlds() != null)) {
for (ServerWorld world : server.getWorlds()) {
FabricWorld fw = getWorld(world);
if (fw == null)
continue;
Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = ((ThreadedAnvilChunkStorageAccessor) world.getChunkManager().threadedAnvilChunkStorage).getChunkHolders();
for (Map.Entry<Long, ChunkHolder> k : chunks.long2ObjectEntrySet()) {
long key = k.getKey();
ChunkHolder ch = k.getValue();
Chunk c = null;
try {
c = ch.getSavingFuture().getNow(null);
} catch (Exception x) {
}
if (c == null)
continue;
ChunkStatus cs = c.getStatus();
ChunkPos pos = ch.getPos();
if (cs == ChunkStatus.FULL) {
// Cooked?
// Add it as known
addKnownChunk(fw, pos);
}
}
}
}
}
Aggregations