fix macro data checks breaking on macro-less realm
This commit is contained in:
parent
26355baec4
commit
6ac45b47a2
@ -815,7 +815,9 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
ServerEntityUtils.destroyEntity(blockEntity);
|
||||
}
|
||||
|
||||
if(parent.getMacroData() != null){
|
||||
MacroDataUpdater.update(parent, parent.getMacroData(), realPos);
|
||||
}
|
||||
this.generationService.submit(() -> {
|
||||
try {
|
||||
BlockChunkData blockChunkData = realm.getServerWorldData().getServerBlockManager().getChunk(worldPos.x, worldPos.y, worldPos.z);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package electrosphere.server.entity;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -75,9 +76,10 @@ public class ServerContentManager {
|
||||
//Block for macro data generation if relevant
|
||||
//
|
||||
List<MacroObject> objects = null;
|
||||
if(macroData != null){
|
||||
if(macroData == null){
|
||||
objects = new LinkedList<MacroObject>();
|
||||
} else {
|
||||
objects = macroData.getNearbyObjects(ServerWorldData.convertChunkToRealSpace(worldPos.x, worldPos.y, worldPos.z));
|
||||
}
|
||||
//if any of this macro data isn't ready, return a null chunk
|
||||
long notFullResCount = objects.stream().filter((MacroObject macroObj) -> macroObj instanceof MacroLODObject).map((MacroObject oldView) -> (MacroLODObject)oldView).filter((MacroLODObject lodObj) -> !lodObj.isFullRes()).count();
|
||||
int waitCount = 0;
|
||||
@ -94,6 +96,7 @@ public class ServerContentManager {
|
||||
if(notFullResCount > 0){
|
||||
throw new Error("Failed to generate content " + notFullResCount + " " + waitCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package electrosphere.server.physics.block.manager;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
@ -150,14 +151,16 @@ public class ServerBlockChunkGenerationThread implements Runnable {
|
||||
){
|
||||
//get the macro data that affects this chunk
|
||||
List<MacroObject> objects = null;
|
||||
if(macroData != null){
|
||||
if(macroData == null){
|
||||
objects = new LinkedList<MacroObject>();
|
||||
} else {
|
||||
objects = macroData.getNearbyObjects(ServerWorldData.convertChunkToRealSpace(worldX, worldY, worldZ));
|
||||
}
|
||||
//if any of this macro data isn't ready, return a null chunk
|
||||
long notFullResCount = objects.stream().filter((MacroObject macroObj) -> macroObj instanceof MacroLODObject).map((MacroObject oldView) -> (MacroLODObject)oldView).filter((MacroLODObject lodObj) -> !lodObj.isFullRes()).count();
|
||||
if(notFullResCount > 0){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
BlockChunkData chunk = null;
|
||||
if(chunkCache.containsChunk(worldX, worldY, worldZ, stride)){
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package electrosphere.server.physics.terrain.manager;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
@ -158,6 +159,9 @@ public class ChunkGenerationThread implements Runnable {
|
||||
|
||||
//get the macro data that affects this chunk
|
||||
List<MacroObject> objects = null;
|
||||
if(macroData == null){
|
||||
objects = new LinkedList<MacroObject>();
|
||||
} else {
|
||||
if(macroData != null){
|
||||
objects = macroData.getNearbyObjects(ServerWorldData.convertChunkToRealSpace(worldX, worldY, worldZ));
|
||||
}
|
||||
@ -172,6 +176,7 @@ public class ChunkGenerationThread implements Runnable {
|
||||
List<VirtualStructure> structs = town.getStructures(macroData);
|
||||
objects.addAll(structs);
|
||||
}
|
||||
}
|
||||
|
||||
if(chunkCache.containsChunk(worldX, worldY, worldZ, stride)){
|
||||
rVal = chunkCache.get(worldX, worldY, worldZ, stride);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user