mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 13:45:36 +01:00
Fix chunk loading for sponge
This commit is contained in:
parent
ba2f9159b6
commit
cf3dd6eb31
@ -45,7 +45,6 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import net.minecraft.world.gen.ChunkProviderServer;
|
||||
import org.spongepowered.api.Sponge;
|
||||
import org.spongepowered.api.entity.living.player.Player;
|
||||
import org.spongepowered.api.world.Chunk;
|
||||
import org.spongepowered.api.world.Location;
|
||||
import org.spongepowered.api.world.World;
|
||||
|
||||
@ -136,8 +135,9 @@ public class SpongeQueue_1_8 extends NMSMappedFaweQueue<World, net.minecraft.wor
|
||||
|
||||
@Override
|
||||
public boolean isChunkLoaded(World world, int x, int z) {
|
||||
Chunk chunk = world.getChunk(x << 4, 0, z << 4).orElse(null);
|
||||
return chunk != null && chunk.isLoaded();
|
||||
net.minecraft.world.World nmsWorld = (net.minecraft.world.World) world;
|
||||
IChunkProvider provider = nmsWorld.getChunkProvider();
|
||||
return provider.chunkExists(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -603,8 +603,16 @@ public class SpongeQueue_1_8 extends NMSMappedFaweQueue<World, net.minecraft.wor
|
||||
|
||||
@Override
|
||||
public ExtendedBlockStorage[] getCachedSections(World world, int cx, int cz) {
|
||||
Chunk chunk = world.loadChunk(cx, 0, cz, true).orElse(null);
|
||||
return ((net.minecraft.world.chunk.Chunk) chunk).getBlockStorageArray();
|
||||
net.minecraft.world.World nmsWorld = (net.minecraft.world.World) world;
|
||||
IChunkProvider provider = nmsWorld.getChunkProvider();
|
||||
net.minecraft.world.chunk.Chunk chunk = provider.provideChunk(cx, cz);
|
||||
if (chunk == null) {
|
||||
return null;
|
||||
}
|
||||
if (!chunk.isLoaded()) {
|
||||
chunk.onChunkLoad();
|
||||
}
|
||||
return chunk.getBlockStorageArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,10 +126,12 @@ public class SpongeQueue_ALL extends NMSMappedFaweQueue<World, net.minecraft.wor
|
||||
|
||||
@Override
|
||||
public boolean isChunkLoaded(World world, int x, int z) {
|
||||
Chunk chunk = world.getChunk(x << 4, 0, z << 4).orElse(null);
|
||||
return chunk != null && chunk.isLoaded();
|
||||
net.minecraft.world.World nmsWorld = (net.minecraft.world.World) world;
|
||||
IChunkProvider provider = nmsWorld.getChunkProvider();
|
||||
return provider.chunkExists(x, z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean regenerateChunk(World world, int x, int z) {
|
||||
try {
|
||||
@ -377,9 +379,18 @@ public class SpongeQueue_ALL extends NMSMappedFaweQueue<World, net.minecraft.wor
|
||||
|
||||
@Override
|
||||
public ExtendedBlockStorage[] getCachedSections(World world, int cx, int cz) {
|
||||
Chunk chunk = world.loadChunk(cx, 0, cz, true).orElse(null);
|
||||
return ((net.minecraft.world.chunk.Chunk) chunk).getBlockStorageArray();
|
||||
net.minecraft.world.World nmsWorld = (net.minecraft.world.World) world;
|
||||
IChunkProvider provider = nmsWorld.getChunkProvider();
|
||||
net.minecraft.world.chunk.Chunk chunk = provider.provideChunk(cx, cz);
|
||||
if (chunk == null) {
|
||||
return null;
|
||||
}
|
||||
if (!chunk.isLoaded()) {
|
||||
chunk.onChunkLoad();
|
||||
}
|
||||
return chunk.getBlockStorageArray();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCombinedId4Data(char[] chars, int x, int y, int z) {
|
||||
|
Loading…
Reference in New Issue
Block a user