diff options
Diffstat (limited to 'src/main/java/makamys/lodmod/renderer')
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/LODChunk.java | 7 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/LODRegion.java | 3 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/LODRenderer.java | 29 |
3 files changed, 8 insertions, 31 deletions
diff --git a/src/main/java/makamys/lodmod/renderer/LODChunk.java b/src/main/java/makamys/lodmod/renderer/LODChunk.java index c9bdd5e..46467e5 100644 --- a/src/main/java/makamys/lodmod/renderer/LODChunk.java +++ b/src/main/java/makamys/lodmod/renderer/LODChunk.java @@ -12,8 +12,7 @@ import net.minecraft.world.chunk.Chunk; public class LODChunk { int x, z; - Chunk chunk; - public boolean waitingForData = false; + public boolean needsChunk = true; int lod = 0; boolean visible; @@ -127,4 +126,8 @@ public class LODChunk { LODMod.renderer.setVisible(this, false); } + public void receiveChunk(Chunk chunk) { + putSimpleMeshes(SimpleChunkMesh.generateSimpleMeshes(chunk)); + } + } diff --git a/src/main/java/makamys/lodmod/renderer/LODRegion.java b/src/main/java/makamys/lodmod/renderer/LODRegion.java index df79ede..0d91e22 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRegion.java +++ b/src/main/java/makamys/lodmod/renderer/LODRegion.java @@ -115,8 +115,7 @@ public class LODRegion { int relZ = chunk.zPosition - regionZ * 32; if(relX >= 0 && relX < 32 && relZ >= 0 && relZ < 32) { - data[relX][relZ].chunk = chunk; - data[relX][relZ].waitingForData = false; + data[relX][relZ].receiveChunk(chunk); return data[relX][relZ]; } return null; diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java index 3385c39..9fdaa06 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java +++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java @@ -149,8 +149,9 @@ public class LODRenderer { int chunkX = centerX + x; int chunkZ = centerZ + z; - if(getLODChunk(chunkX, chunkZ).chunk == null) { + if(getLODChunk(chunkX, chunkZ).needsChunk) { newServerChunkLoadQueue.add(new ChunkCoordIntPair(chunkX, chunkZ)); + getLODChunk(chunkX, chunkZ).needsChunk = false; } } } @@ -445,7 +446,6 @@ public class LODRenderer { private LODChunk receiveFarChunk(Chunk chunk) { LODRegion region = getRegionContaining(chunk.xPosition, chunk.zPosition); - myChunks.add(chunk); return region.putChunk(chunk); } @@ -477,32 +477,7 @@ public class LODRenderer { return region; } - private void loadChunk(int chunkX, int chunkZ) { - LODRegion region = getRegionContaining(chunkX, chunkZ); - LODChunk lodChunk = region.getChunkAbsolute(chunkX, chunkZ); - if(lodChunk == null) { - ChunkProviderServer chunkProviderServer = Minecraft.getMinecraft().getIntegratedServer().worldServers[0].theChunkProviderServer; - //Chunk chunk = chunkProviderServer.loadChunk(chunkX, chunkZ); - Chunk chunk = chunkProviderServer.currentChunkProvider.provideChunk(chunkX, chunkZ); - /*Chunk chunk = chunkProviderServer.safeLoadChunk(chunkX, chunkZ); - if(chunk == null) { - chunk = chunkProviderServer.currentChunkProvider.provideChunk(chunkX, chunkZ); - } - if(chunk != null) { - chunk.populateChunk(chunkProviderServer, chunkProviderServer, chunkX, chunkZ); - myChunks.add(chunk); - }*/ - if(chunk != null) { - myChunks.add(chunk); - } - //lodChunk = region.putChunk(new LODChunk(chunk)); - } - sendChunkToGPU(lodChunk); - } - private void sendChunkToGPU(LODChunk lodChunk) { - lodChunk.putSimpleMeshes(SimpleChunkMesh.generateSimpleMeshes(lodChunk.chunk)); - Entity player = (Entity) Minecraft.getMinecraft().getIntegratedServer().getConfigurationManager().playerEntityList.get(0); lodChunk.tick(player); |