diff --git a/TODO b/TODO index 6ba1413b..a40ffc27 100644 --- a/TODO +++ b/TODO @@ -3,13 +3,10 @@ TODO bugs/features: -netherzones are lost if the server ends while its restoring add in build range limit set where you started, cannot ever move - all players can build within each others limits -adjust [semiFrozenChunks.add(originPos);] to reduce lag in first-person cam - don't show nether blocks in fog on minimap @@ -22,9 +19,13 @@ spiderProd after poison spider upgrade - cancel button icon/name - spider produces poison spider if upgraded in progress -(server) fog chunks updated when exploring outside of frustum -(server) fake blocks are updated correctly once explored and looked at again -(server) buildings in fog should disappear on minimap once built +fog changes and optimisations (test in server!) + - fog chunks updated when exploring outside of frustum + - fake blocks are updated correctly once explored and looked at again + - buildings in fog should disappear on minimap once built + - lag in first-person mode + - semifrozen chunks in first-person mode + Misc additions diff --git a/src/main/java/com/solegendary/reignofnether/building/BuildingServerEvents.java b/src/main/java/com/solegendary/reignofnether/building/BuildingServerEvents.java index 89ffa814..eae0479f 100644 --- a/src/main/java/com/solegendary/reignofnether/building/BuildingServerEvents.java +++ b/src/main/java/com/solegendary/reignofnether/building/BuildingServerEvents.java @@ -111,6 +111,7 @@ public static void loadBuildingsAndNetherZones(ServerStartedEvent evt) { if (level != null) { BuildingSaveData buildingData = BuildingSaveData.getInstance(level); NetherZoneSaveData netherData = NetherZoneSaveData.getInstance(level); + ArrayList placedNZs = new ArrayList<>(); buildingData.buildings.forEach(b -> { Building building = BuildingUtils.getNewBuilding(b.name, level, b.originPos, b.rotation, b.ownerName, b.isDiagonalBridge); @@ -135,9 +136,17 @@ else if (building instanceof Portal portal) for (NetherZone nz : netherData.netherZones) if (building.isPosInsideBuilding(nz.getOrigin())) { ncb.setNetherZone(nz); + placedNZs.add(nz.getOrigin()); + System.out.println("loaded netherzone for: " + b.name + "|" + b.originPos); break; } - System.out.println("loaded building/nether in serverevents: " + b.originPos); + System.out.println("loaded building in serverevents: " + b.name + "|" + b.originPos); + } + }); + netherData.netherZones.forEach(nz -> { + if (!placedNZs.contains(nz.getOrigin())) { + BuildingServerEvents.netherZones.add(nz); + System.out.println("loaded orphaned netherzone: " + nz.getOrigin()); } }); } diff --git a/src/main/java/com/solegendary/reignofnether/building/NetherZone.java b/src/main/java/com/solegendary/reignofnether/building/NetherZone.java index 4b42b7c2..2ccfcff7 100644 --- a/src/main/java/com/solegendary/reignofnether/building/NetherZone.java +++ b/src/main/java/com/solegendary/reignofnether/building/NetherZone.java @@ -14,7 +14,6 @@ public class NetherZone { private final int MAX_TICKS = 5; private final int MAX_CONVERTS_AFTER_CONSTANT_RANGE = 60; // to prevent continuously processing - private final BlockPos origin; private final Random random = new Random(); diff --git a/src/main/java/com/solegendary/reignofnether/building/NetherZoneSaveData.java b/src/main/java/com/solegendary/reignofnether/building/NetherZoneSaveData.java index 04ca9d1c..ccb31e80 100644 --- a/src/main/java/com/solegendary/reignofnether/building/NetherZoneSaveData.java +++ b/src/main/java/com/solegendary/reignofnether/building/NetherZoneSaveData.java @@ -73,7 +73,7 @@ public CompoundTag save(CompoundTag tag) { cTag.putInt("converts", nz.getConvertsAfterConstantRange()); list.add(cTag); - System.out.println("NetherZoneSaveData.save: " + nz.getOrigin() + "|" + nz.getRange() + "/" + nz.getMaxRange() + "|" + nz.isRestoring()); + System.out.println("NetherZoneSaveData.save: " + nz.getOrigin() + "|" + (int) nz.getRange() + "/" + (int) nz.getMaxRange() + "|" + nz.isRestoring()); }); tag.put("netherzones", list); return tag; diff --git a/src/main/java/com/solegendary/reignofnether/mixin/fogofwar/LevelRendererMixin.java b/src/main/java/com/solegendary/reignofnether/mixin/fogofwar/LevelRendererMixin.java index b49c1429..ab9afc2c 100644 --- a/src/main/java/com/solegendary/reignofnether/mixin/fogofwar/LevelRendererMixin.java +++ b/src/main/java/com/solegendary/reignofnether/mixin/fogofwar/LevelRendererMixin.java @@ -229,7 +229,7 @@ else if (!isInBrightChunk(originPos)) { .map(fc -> fc.origin) .toList().contains(originPos)) continue; - else if (enemyOccupiedChunks.contains(chunkPos)) + else if (OrthoviewClientEvents.isEnabled() || enemyOccupiedChunks.contains(chunkPos)) semiFrozenChunks.add(originPos); } ChunkRenderDispatcher.RenderChunk renderChunk = chunkInfo.chunk;