mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-01 23:47:21 +00:00
fix world creation
This commit is contained in:
parent
ab3397a373
commit
7cf43ad7ab
@ -120,4 +120,8 @@ public interface INMSBinding {
|
|||||||
default DataVersion getDataVersion() {
|
default DataVersion getDataVersion() {
|
||||||
return DataVersion.V1192;
|
return DataVersion.V1192;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default int getSpawnChunkCount(World world) {
|
||||||
|
return 441;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,6 @@ public class IrisCreator {
|
|||||||
|
|
||||||
J.a(() ->
|
J.a(() ->
|
||||||
{
|
{
|
||||||
int req = 441;
|
|
||||||
Supplier<Integer> g = () -> {
|
Supplier<Integer> g = () -> {
|
||||||
if (finalAccess1 == null || finalAccess1.getEngine() == null) {
|
if (finalAccess1 == null || finalAccess1.getEngine() == null) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -160,6 +159,9 @@ public class IrisCreator {
|
|||||||
return finalAccess1.getEngine().getGenerated();
|
return finalAccess1.getEngine().getGenerated();
|
||||||
};
|
};
|
||||||
if(!benchmark) {
|
if(!benchmark) {
|
||||||
|
if (finalAccess1 == null) return;
|
||||||
|
int req = finalAccess1.getSpawnChunks().join();
|
||||||
|
|
||||||
while (g.get() < req) {
|
while (g.get() < req) {
|
||||||
double v = (double) g.get() / (double) req;
|
double v = (double) g.get() / (double) req;
|
||||||
if (sender.isPlayer()) {
|
if (sender.isPlayer()) {
|
||||||
|
@ -63,6 +63,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
@ -84,6 +85,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
|||||||
private final AtomicBoolean setup;
|
private final AtomicBoolean setup;
|
||||||
private final boolean studio;
|
private final boolean studio;
|
||||||
private final AtomicInteger a = new AtomicInteger(0);
|
private final AtomicInteger a = new AtomicInteger(0);
|
||||||
|
private final CompletableFuture<Integer> spawnChunks = new CompletableFuture<>();
|
||||||
private final boolean smartVanillaHeight;
|
private final boolean smartVanillaHeight;
|
||||||
private Engine engine;
|
private Engine engine;
|
||||||
private Looper hotloader;
|
private Looper hotloader;
|
||||||
@ -148,6 +150,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
|||||||
} else {
|
} else {
|
||||||
INMS.get().inject(event.getWorld().getSeed(), engine, event.getWorld());
|
INMS.get().inject(event.getWorld().getSeed(), engine, event.getWorld());
|
||||||
Iris.info("Injected Iris Biome Source into " + event.getWorld().getName());
|
Iris.info("Injected Iris Biome Source into " + event.getWorld().getName());
|
||||||
|
spawnChunks.complete(INMS.get().getSpawnChunkCount(event.getWorld()));
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import com.volmit.iris.engine.framework.Hotloadable;
|
|||||||
import com.volmit.iris.util.data.DataProvider;
|
import com.volmit.iris.util.data.DataProvider;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public interface PlatformChunkGenerator extends Hotloadable, DataProvider {
|
public interface PlatformChunkGenerator extends Hotloadable, DataProvider {
|
||||||
@ -46,4 +47,6 @@ public interface PlatformChunkGenerator extends Hotloadable, DataProvider {
|
|||||||
boolean isStudio();
|
boolean isStudio();
|
||||||
|
|
||||||
void touch(World world);
|
void touch(World world);
|
||||||
|
|
||||||
|
CompletableFuture<Integer> getSpawnChunks();
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import java.lang.reflect.Method;
|
|||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@ -576,4 +577,12 @@ public class NMSBinding implements INMSBinding {
|
|||||||
public DataVersion getDataVersion() {
|
public DataVersion getDataVersion() {
|
||||||
return DataVersion.V1205;
|
return DataVersion.V1205;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSpawnChunkCount(World world) {
|
||||||
|
var radius = Optional.ofNullable(world.getGameRuleValue(GameRule.SPAWN_CHUNK_RADIUS))
|
||||||
|
.orElseGet(() -> world.getGameRuleDefault(GameRule.SPAWN_CHUNK_RADIUS));
|
||||||
|
if (radius == null) throw new IllegalStateException("GameRule.SPAWN_CHUNK_RADIUS is null!");
|
||||||
|
return (int) Math.pow(2 * radius + 1, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import java.lang.reflect.Method;
|
|||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@ -581,4 +582,12 @@ public class NMSBinding implements INMSBinding {
|
|||||||
public DataVersion getDataVersion() {
|
public DataVersion getDataVersion() {
|
||||||
return DataVersion.V1205;
|
return DataVersion.V1205;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSpawnChunkCount(World world) {
|
||||||
|
var radius = Optional.ofNullable(world.getGameRuleValue(GameRule.SPAWN_CHUNK_RADIUS))
|
||||||
|
.orElseGet(() -> world.getGameRuleDefault(GameRule.SPAWN_CHUNK_RADIUS));
|
||||||
|
if (radius == null) throw new IllegalStateException("GameRule.SPAWN_CHUNK_RADIUS is null!");
|
||||||
|
return (int) Math.pow(2 * radius + 1, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user