Replace hint by query

Why would you call this hint???
This commit is contained in:
CocoTheOwner 2021-02-11 11:25:16 +01:00
parent 5180d1a17a
commit 8ea7b09482

View File

@ -34,7 +34,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class EngineCompositeGenerator extends ChunkGenerator implements IrisAccess { public class EngineCompositeGenerator extends ChunkGenerator implements IrisAccess {
private EngineCompound compound; private EngineCompound compound;
private final AtomicBoolean initialized; private final AtomicBoolean initialized;
private final String dimensionHint; private final String dimensionQuery;
private final boolean production; private final boolean production;
private final KList<BlockPopulator> populators; private final KList<BlockPopulator> populators;
private long mst = 0; private long mst = 0;
@ -51,13 +51,13 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
this(null, true); this(null, true);
} }
public EngineCompositeGenerator(String hint, boolean production) { public EngineCompositeGenerator(String query, boolean production) {
super(); super();
chunkCache = new KMap<>(); chunkCache = new KMap<>();
hotloadcd = new ChronoLatch(3500); hotloadcd = new ChronoLatch(3500);
mst = M.ms(); mst = M.ms();
this.production = production; this.production = production;
this.dimensionHint = hint; this.dimensionQuery = query;
initialized = new AtomicBoolean(false); initialized = new AtomicBoolean(false);
art = J.ar(this::tick, 100); art = J.ar(this::tick, 100);
populators = new KList<BlockPopulator>().qadd(new BlockPopulator() { populators = new KList<BlockPopulator>().qadd(new BlockPopulator() {
@ -131,12 +131,12 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
} }
private synchronized IrisDimension getDimension(World world) { private synchronized IrisDimension getDimension(World world) {
String hint = dimensionHint; String query = dimensionQuery;
hint = Iris.linkMultiverseCore.getWorldNameType(world.getName(), hint); query = Iris.linkMultiverseCore.getWorldNameType(world.getName(), query);
IrisDimension dim = null; IrisDimension dim = null;
if (hint == null) { if (query == null) {
File iris = new File(world.getWorldFolder(), "iris"); File iris = new File(world.getWorldFolder(), "iris");
if(iris.exists() && iris.isDirectory()) if(iris.exists() && iris.isDirectory())
@ -147,7 +147,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
if (i.isDirectory() && i.getName().equals("dimensions")) { if (i.isDirectory() && i.getName().equals("dimensions")) {
for (File j : i.listFiles()) { for (File j : i.listFiles()) {
if (j.isFile() && j.getName().endsWith(".json")) { if (j.isFile() && j.getName().endsWith(".json")) {
hint = j.getName().replaceAll("\\Q.json\\E", ""); query = j.getName().replaceAll("\\Q.json\\E", "");
Iris.error("Found v1 install. Please create a new world, this will cause chunks to change in your existing iris worlds!"); Iris.error("Found v1 install. Please create a new world, this will cause chunks to change in your existing iris worlds!");
throw new RuntimeException(); throw new RuntimeException();
} }
@ -157,32 +157,32 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
// Look for v2 location // Look for v2 location
else if (i.isFile() && i.getName().equals("engine-metadata.json")) { else if (i.isFile() && i.getName().equals("engine-metadata.json")) {
EngineData metadata = EngineData.load(i); EngineData metadata = EngineData.load(i);
hint = metadata.getDimension(); query = metadata.getDimension();
break; break;
} }
} }
} }
} }
if (hint == null) { if (query == null) {
Iris.error("Cannot find iris dimension data for world: " + world.getName() + "! Assuming " + IrisSettings.get().getGenerator().getDefaultWorldType() + "!"); Iris.error("Cannot find iris dimension data for world: " + world.getName() + "! Assuming " + IrisSettings.get().getGenerator().getDefaultWorldType() + "!");
hint = IrisSettings.get().getGenerator().getDefaultWorldType(); query = IrisSettings.get().getGenerator().getDefaultWorldType();
} }
dim = IrisDataManager.loadAnyDimension(hint); dim = IrisDataManager.loadAnyDimension(query);
if (dim == null) { if (dim == null) {
Iris.proj.downloadSearch(new MortarSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), hint, false); Iris.proj.downloadSearch(new MortarSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), query, false);
dim = IrisDataManager.loadAnyDimension(hint); dim = IrisDataManager.loadAnyDimension(query);
if(dim == null) if(dim == null)
{ {
throw new RuntimeException("Cannot find dimension: " + hint); throw new RuntimeException("Cannot find dimension: " + query);
} }
else else
{ {
Iris.info("Download pack: " + hint); Iris.info("Download pack: " + query);
} }
} }
@ -197,7 +197,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
if(dim == null) if(dim == null)
{ {
throw new RuntimeException("Cannot find dimension: " + hint); throw new RuntimeException("Cannot find dimension: " + query);
} }
} }
} }
@ -208,10 +208,10 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
} }
private synchronized IrisDimension getDimension(String world) { private synchronized IrisDimension getDimension(String world) {
String hint = dimensionHint; String query = dimensionQuery;
IrisDimension dim = null; IrisDimension dim = null;
if (hint == null) { if (query == null) {
File iris = new File(world +"/iris"); File iris = new File(world +"/iris");
if(iris.exists() && iris.isDirectory()) if(iris.exists() && iris.isDirectory())
@ -222,7 +222,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
if (i.isDirectory() && i.getName().equals("dimensions")) { if (i.isDirectory() && i.getName().equals("dimensions")) {
for (File j : i.listFiles()) { for (File j : i.listFiles()) {
if (j.isFile() && j.getName().endsWith(".json")) { if (j.isFile() && j.getName().endsWith(".json")) {
hint = j.getName().replaceAll("\\Q.json\\E", ""); query = j.getName().replaceAll("\\Q.json\\E", "");
Iris.error("Found v1 install. Please create a new world, this will cause chunks to change in your existing iris worlds!"); Iris.error("Found v1 install. Please create a new world, this will cause chunks to change in your existing iris worlds!");
throw new RuntimeException(); throw new RuntimeException();
} }
@ -232,32 +232,32 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
// Look for v2 location // Look for v2 location
else if (i.isFile() && i.getName().equals("engine-metadata.json")) { else if (i.isFile() && i.getName().equals("engine-metadata.json")) {
EngineData metadata = EngineData.load(i); EngineData metadata = EngineData.load(i);
hint = metadata.getDimension(); query = metadata.getDimension();
break; break;
} }
} }
} }
} }
if (hint == null) { if (query == null) {
Iris.error("Cannot find iris dimension data for world: " + world + "! Assuming " + IrisSettings.get().getGenerator().getDefaultWorldType() + "!"); Iris.error("Cannot find iris dimension data for world: " + world + "! Assuming " + IrisSettings.get().getGenerator().getDefaultWorldType() + "!");
hint = IrisSettings.get().getGenerator().getDefaultWorldType(); query = IrisSettings.get().getGenerator().getDefaultWorldType();
} }
dim = IrisDataManager.loadAnyDimension(hint); dim = IrisDataManager.loadAnyDimension(query);
if (dim == null) { if (dim == null) {
Iris.proj.downloadSearch(new MortarSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), hint, false); Iris.proj.downloadSearch(new MortarSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), query, false);
dim = IrisDataManager.loadAnyDimension(hint); dim = IrisDataManager.loadAnyDimension(query);
if(dim == null) if(dim == null)
{ {
throw new RuntimeException("Cannot find dimension: " + hint); throw new RuntimeException("Cannot find dimension: " + query);
} }
else else
{ {
Iris.info("Download pack: " + hint); Iris.info("Download pack: " + query);
} }
} }
@ -272,7 +272,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
if(dim == null) if(dim == null)
{ {
throw new RuntimeException("Cannot find dimension: " + hint); throw new RuntimeException("Cannot find dimension: " + query);
} }
} }
} }