mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 14:00:26 +00:00
Merge remote-tracking branch 'origin/v3.4.3' into v3.4.3
# Conflicts: # core/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainNormalActuator.java
This commit is contained in:
commit
dd598d18bf
4 files changed
+68
-39
No files matched your search
+1
-1
@@ -55,7 +55,7 @@ dependencies {
|
|||||||
compileOnly 'org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT'
|
compileOnly 'org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT'
|
||||||
compileOnly 'org.apache.logging.log4j:log4j-api:2.19.0'
|
compileOnly 'org.apache.logging.log4j:log4j-api:2.19.0'
|
||||||
compileOnly 'org.apache.logging.log4j:log4j-core:2.19.0'
|
compileOnly 'org.apache.logging.log4j:log4j-core:2.19.0'
|
||||||
compileOnly 'commons-io:commons-io:2.13.0'
|
compileOnly 'commons-io:commons-io:2.14.0'
|
||||||
compileOnly 'commons-lang:commons-lang:2.6'
|
compileOnly 'commons-lang:commons-lang:2.6'
|
||||||
compileOnly 'com.github.oshi:oshi-core:5.8.5'
|
compileOnly 'com.github.oshi:oshi-core:5.8.5'
|
||||||
compileOnly 'org.lz4:lz4-java:1.8.0'
|
compileOnly 'org.lz4:lz4-java:1.8.0'
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ public class IrisEngine implements Engine {
|
|||||||
cleaning = new AtomicBoolean(false);
|
cleaning = new AtomicBoolean(false);
|
||||||
context.touch();
|
context.touch();
|
||||||
merger = getDimension().getMerger();
|
merger = getDimension().getMerger();
|
||||||
|
merger.loadWorld(this);
|
||||||
updateMemoryWorld();
|
updateMemoryWorld();
|
||||||
getData().setEngine(this);
|
getData().setEngine(this);
|
||||||
getData().loadPrefetch(this);
|
getData().loadPrefetch(this);
|
||||||
|
|||||||
@@ -7,10 +7,13 @@ import com.volmit.iris.engine.framework.Engine;
|
|||||||
import com.volmit.iris.engine.object.annotations.Desc;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
import com.volmit.iris.util.context.ChunkedDataCache;
|
import com.volmit.iris.util.context.ChunkedDataCache;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import com.volmit.iris.util.hunk.view.ChunkDataHunkView;
|
import com.volmit.iris.util.hunk.view.ChunkDataHunkView;
|
||||||
import com.volmit.iris.util.math.RollingSequence;
|
import com.volmit.iris.util.math.RollingSequence;
|
||||||
|
import com.volmit.iris.util.misc.E;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -32,7 +35,7 @@ import static org.bukkit.Bukkit.createChunkData;
|
|||||||
@Data
|
@Data
|
||||||
public class IrisMerger {
|
public class IrisMerger {
|
||||||
private transient RollingSequence mergeDuration = new RollingSequence(20);
|
private transient RollingSequence mergeDuration = new RollingSequence(20);
|
||||||
private transient Engine engine;
|
private transient World worldsave;
|
||||||
|
|
||||||
@Desc("Selected Generator")
|
@Desc("Selected Generator")
|
||||||
private String generator;
|
private String generator;
|
||||||
@@ -59,11 +62,11 @@ public class IrisMerger {
|
|||||||
* Merges underground from a selected chunk into the corresponding chunk in the outcome world.
|
* Merges underground from a selected chunk into the corresponding chunk in the outcome world.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void generateVanillaUnderground(int x, int z, Engine engine) {
|
public void generateVanillaUnderground(int x, int z, Hunk<BlockData> h, Engine engine) {
|
||||||
if (engine.getMemoryWorld() == null)
|
if (engine.getMemoryWorld() == null)
|
||||||
throw new IllegalStateException("MemoryWorld is null. Ensure that it has been initialized.");
|
throw new IllegalStateException("MemoryWorld is null. Ensure that it has been initialized.");
|
||||||
if (engine.getWorld() == null)
|
if (engine.getWorld().realWorld() == null)
|
||||||
throw new IllegalStateException("World is null. Ensure that the world has been properly loaded.");
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
@@ -73,11 +76,14 @@ public class IrisMerger {
|
|||||||
|
|
||||||
ChunkGenerator.ChunkData chunkData;
|
ChunkGenerator.ChunkData chunkData;
|
||||||
if (world.isBlank()) {
|
if (world.isBlank()) {
|
||||||
memoryWorld = engine.getMemoryWorld();
|
throw new UnsupportedOperationException("No.");
|
||||||
bukkit = memoryWorld.getBukkit();
|
// memoryWorld = engine.getMemoryWorld();
|
||||||
chunkData = memoryWorld.getChunkData(x, z);
|
// bukkit = memoryWorld.getBukkit();
|
||||||
|
// chunkData = memoryWorld.getChunkData(x, z);
|
||||||
} else {
|
} else {
|
||||||
bukkit = loadWorld(world);
|
bukkit = Bukkit.getWorld(world);
|
||||||
|
if (bukkit == null)
|
||||||
|
throw new IllegalStateException("Somehow world is null? Initialization Failed!");
|
||||||
chunkData = getChunkDataAt(bukkit, x, z);
|
chunkData = getChunkDataAt(bukkit, x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,29 +119,36 @@ public class IrisMerger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BlockData blockData = vh.get(xx, y, zz);
|
BlockData blockData = vh.get(xx, y, zz);
|
||||||
nms.setBlock(
|
h.set(xx, y, zz, blockData);
|
||||||
world,
|
// nms.setBlock(
|
||||||
wX + xx,
|
// world,
|
||||||
y - minHeight,
|
// wX + xx,
|
||||||
wZ + zz,
|
// y - minHeight,
|
||||||
blockData,
|
// wZ + zz,
|
||||||
flag,
|
// blockData,
|
||||||
0
|
// flag,
|
||||||
);
|
// 0
|
||||||
|
// );
|
||||||
|
|
||||||
if (nms.hasTile(blockData.getMaterial())) {
|
// if (nms.hasTile(blockData.getMaterial())) {
|
||||||
var tile = nms.serializeTile(new Location(bukkit, wX + xx, y - minHeight, wZ + zz));
|
// var tile = nms.serializeTile(new Location(bukkit, wX + xx, y - minHeight, wZ + zz));
|
||||||
if (tile != null) {
|
// if (tile != null) {
|
||||||
nms.deserializeTile(tile, new Location(world, wX + xx, y - minHeight, wZ + zz));
|
// nms.deserializeTile(tile, new Location(world, wX + xx, y - minHeight, wZ + zz));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (x % 4 == 0 && z % 4 == 0 && y % 4 == 0) {
|
// if (x % 4 == 0 && z % 4 == 0 && y % 4 == 0) {
|
||||||
var biome = chunkData.getBiome(xx, y, zz);
|
// Biome biome;
|
||||||
if (caveBiomes.contains(biome)) {
|
// try {
|
||||||
world.setBiome(wX + xx, y - minHeight, wZ + zz, biome);
|
// biome = chunkData.getBiome(xx, y, zz);
|
||||||
}
|
// } catch (UnsupportedOperationException e) {
|
||||||
}
|
// biome = bukkit.getBiome(wX + xx, y, wZ + zz);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (caveBiomes.contains(biome)) {
|
||||||
|
// world.setBiome(wX + xx, y - minHeight, wZ + zz, biome);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,12 +222,27 @@ public class IrisMerger {
|
|||||||
return chunkData;
|
return chunkData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private World loadWorld(String worldName) {
|
public void loadWorld(Engine engine) {
|
||||||
World world = Bukkit.getWorld(worldName);
|
if (!engine.getDimension().isEnableExperimentalMerger())
|
||||||
if (world != null)
|
return;
|
||||||
return world;
|
J.sfut(() -> {
|
||||||
WorldCreator worldCreator = new WorldCreator(worldName);
|
worldsave = Bukkit.getWorld(world);
|
||||||
world = Bukkit.createWorld(worldCreator);
|
if (worldsave == null) {
|
||||||
return world;
|
WorldCreator worldCreator = new WorldCreator(world);
|
||||||
|
worldsave = Bukkit.createWorld(worldCreator);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// new Thread(() -> {
|
||||||
|
// try {
|
||||||
|
// boolean wait = true;
|
||||||
|
// while (wait) {
|
||||||
|
// Thread.sleep(100);
|
||||||
|
// if (Bukkit.getWorld(world) != null)
|
||||||
|
// wait = false;
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -385,8 +385,8 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onChunkGeneration(ChunkLoadEvent event) {
|
private void onChunkGeneration(ChunkLoadEvent event) {
|
||||||
if(!event.isNewChunk() || !engine.getWorld().realWorld().equals(event.getWorld()) || !engine.getDimension().isEnableExperimentalMerger() || engine.getMemoryWorld() == null) return;
|
//if(!event.isNewChunk() || !engine.getWorld().realWorld().equals(event.getWorld()) || !engine.getDimension().isEnableExperimentalMerger() || engine.getMemoryWorld() == null) return;
|
||||||
engine.getMerger().generateVanillaUnderground(event.getChunk().getX(), event.getChunk().getZ(), engine);
|
//engine.getMerger().generateVanillaUnderground(event.getChunk().getX(), event.getChunk().getZ(), engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in new issue
Block a user