mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-28 03:29:06 +00:00
Updates & fixes
This commit is contained in:
@@ -411,12 +411,12 @@ public class IrisEngine implements Engine {
|
||||
}
|
||||
} else {
|
||||
getMantle().generateMatter(x >> 4, z >> 4, multicore);
|
||||
getTerrainActuator().actuate(x, z, vblocks, multicore);
|
||||
getTerrainActuator().actuate(x, z, blocks, multicore);
|
||||
getBiomeActuator().actuate(x, z, vbiomes, multicore);
|
||||
getDecorantActuator().actuate(x, z, blocks, multicore);
|
||||
getPostModifier().modify(x, z, vblocks, multicore);
|
||||
getDepositModifier().modify(x, z, vblocks, multicore);
|
||||
getCaveModifier().modify(x >> 4,z >> 4, vblocks, multicore);
|
||||
getPostModifier().modify(x, z, blocks, multicore);
|
||||
getDepositModifier().modify(x, z, blocks, multicore);
|
||||
getCaveModifier().modify(x >> 4,z >> 4, blocks, multicore);
|
||||
getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, blocks, multicore);
|
||||
}
|
||||
getMetrics().getTotal().put(p.getMilliseconds());
|
||||
|
||||
@@ -62,6 +62,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
private final Looper looper;
|
||||
private final int id;
|
||||
private final KMap<Long, Long> chunkCooldowns;
|
||||
private final KList<Runnable> updateQueue = new KList<>();
|
||||
private double energy = 25;
|
||||
private int entityCount = 0;
|
||||
private final ChronoLatch cl;
|
||||
@@ -142,7 +143,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
onAsyncTick();
|
||||
}
|
||||
|
||||
return 50;
|
||||
return 250;
|
||||
}
|
||||
};
|
||||
looper.setPriority(Thread.MIN_PRIORITY);
|
||||
@@ -152,10 +153,18 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
|
||||
private void updateChunks() {
|
||||
for (Player i : getEngine().getWorld().realWorld().getPlayers()) {
|
||||
J.s(() -> {
|
||||
Chunk c = i.getLocation().getChunk();
|
||||
J.a(() -> getEngine().updateChunk(c));
|
||||
}, RNG.r.i(0, 5));
|
||||
int r = 2;
|
||||
Chunk c = i.getLocation().getChunk();
|
||||
for(int x = -r; x <= r; x++)
|
||||
{
|
||||
for(int z = -r; z <= r; z++)
|
||||
{
|
||||
if(c.getWorld().isChunkLoaded(c.getX() + x, c.getZ() + z))
|
||||
{
|
||||
getEngine().updateChunk(c.getWorld().getChunkAt(c.getX() + x, c.getZ() + z));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,6 +381,10 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
() -> J.a(() -> spawnIn(e, true), RNG.r.i(5, 200))));
|
||||
energy += 0.3;
|
||||
fixEnergy();
|
||||
if(!getMantle().hasFlag(e.getX(), e.getZ(), MantleFlag.UPDATE))
|
||||
{
|
||||
J.a(() -> getEngine().updateChunk(e),20);
|
||||
}
|
||||
}
|
||||
|
||||
public Mantle getMantle() {
|
||||
|
||||
@@ -46,12 +46,14 @@ import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.data.DataProvider;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.function.Function2;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.mantle.MantleFlag;
|
||||
import com.volmit.iris.util.math.BlockPosition;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.matter.MatterCavern;
|
||||
import com.volmit.iris.util.matter.MatterUpdate;
|
||||
import com.volmit.iris.util.matter.slices.UpdateMatter;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
@@ -61,20 +63,20 @@ import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
import com.volmit.iris.util.stream.ProceduralStream;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.block.CraftBlock;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -233,21 +235,39 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
||||
@ChunkCoordinates
|
||||
@Override
|
||||
default void updateChunk(Chunk c) {
|
||||
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.UPDATE, () -> J.s(() -> {
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterUpdate.class, (x, y, z, v) -> {
|
||||
if (v != null && v.isUpdate()) {
|
||||
int vx = x & 15;
|
||||
int vz = z & 15;
|
||||
update(x, y, z, c, new RNG(Cache.key(c.getX(), c.getZ())));
|
||||
if(c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ() + 1)
|
||||
&& c.getWorld().isChunkLoaded(c.getX(), c.getZ() + 1)
|
||||
&& c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ())
|
||||
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ() - 1)
|
||||
&& c.getWorld().isChunkLoaded(c.getX(), c.getZ() - 1)
|
||||
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ())
|
||||
&& c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ() - 1)
|
||||
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ() + 1))
|
||||
{
|
||||
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.UPDATE, () -> J.s(() -> {
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
|
||||
if (vx > 0 && vx < 15 && vz > 0 && vz < 15) {
|
||||
updateLighting(x, y, z, c);
|
||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterCavern.class, (x, y, z, v) -> {
|
||||
update(x, y, z, c, new RNG(Cache.key(c.getX(), c.getZ())));
|
||||
});
|
||||
|
||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterUpdate.class, (x, y, z, v) -> {
|
||||
if (v != null && v.isUpdate()) {
|
||||
int vx = x & 15;
|
||||
int vz = z & 15;
|
||||
update(x, y, z, c, new RNG(Cache.key(c.getX(), c.getZ())));
|
||||
if (vx > 0 && vx < 15 && vz > 0 && vz < 15) {
|
||||
updateLighting(x, y, z, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
getMetrics().getUpdates().put(p.getMilliseconds());
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
getMantle().getMantle().deleteChunkSlice(c.getX(), c.getZ(), MatterCavern.class);
|
||||
getMantle().getMantle().deleteChunkSlice(c.getX(), c.getZ(), MatterUpdate.class);
|
||||
getMetrics().getUpdates().put(p.getMilliseconds());
|
||||
}, RNG.r.i(0, 20)));
|
||||
}
|
||||
}
|
||||
|
||||
@BlockCoordinates
|
||||
|
||||
@@ -35,6 +35,8 @@ import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
import com.volmit.iris.util.mantle.MantleChunk;
|
||||
import com.volmit.iris.util.mantle.MantleFlag;
|
||||
import com.volmit.iris.util.matter.Matter;
|
||||
import com.volmit.iris.util.matter.MatterCavern;
|
||||
import com.volmit.iris.util.matter.slices.CavernMatter;
|
||||
import com.volmit.iris.util.matter.slices.UpdateMatter;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
@@ -236,6 +238,16 @@ public interface EngineMantle extends IObjectPlacer {
|
||||
getMantle().set(x, y, z, CavernMatter.ON);
|
||||
}
|
||||
|
||||
@BlockCoordinates
|
||||
default void dropCavernBlock(int x, int y, int z) {
|
||||
Matter matter = getMantle().getChunk(x & 15, z & 15).get(y & 15);
|
||||
|
||||
if(matter != null)
|
||||
{
|
||||
matter.slice(MatterCavern.class).set(x & 15, y & 15, z & 15, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
default List<IrisFeaturePositional> getFeaturesInChunk(Chunk c) {
|
||||
return getFeaturesInChunk(c.getX(), c.getZ());
|
||||
|
||||
@@ -21,6 +21,7 @@ package com.volmit.iris.engine.modifier;
|
||||
import com.volmit.iris.engine.data.cache.Cache;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.EngineAssignedModifier;
|
||||
import com.volmit.iris.engine.object.basic.IrisPosition;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||
import com.volmit.iris.engine.object.deposits.IrisDepositGenerator;
|
||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
||||
@@ -39,6 +40,8 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
||||
private final RNG rng;
|
||||
private final BlockData AIR = Material.CAVE_AIR.createBlockData();
|
||||
@@ -53,11 +56,10 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
Mantle mantle = getEngine().getMantle().getMantle();
|
||||
MantleChunk mc = getEngine().getMantle().getMantle().getChunk(x, z);
|
||||
|
||||
mc.iterate(MatterCavern.class, (xx, yy, zz, c) -> {
|
||||
int rx = xx & 15;
|
||||
int rz = zz & 15;
|
||||
boolean caveAbove = mantle.get(xx, yy+1, zz, MatterCavern.class) != null;
|
||||
BlockData currentAbove = output.get(rx, yy+1, rz);
|
||||
BlockData current = output.get(rx, yy, rz);
|
||||
|
||||
if(current.getMaterial().isAir())
|
||||
@@ -65,23 +67,11 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
||||
return;
|
||||
}
|
||||
|
||||
if(B.isFluid(currentAbove) && !caveAbove)
|
||||
{
|
||||
getEngine().getMantle().updateBlock(xx, yy+1, zz);
|
||||
}
|
||||
|
||||
if(B.isFluid(current))
|
||||
{
|
||||
getEngine().getMantle().updateBlock(xx, yy, zz);
|
||||
return;
|
||||
}
|
||||
|
||||
if(B.isFoliage(currentAbove) && !caveAbove)
|
||||
{
|
||||
output.set(rx, yy+1, rz, AIR);
|
||||
getEngine().getMantle().updateBlock(xx, yy+2, zz);
|
||||
}
|
||||
|
||||
output.set(rx, yy, rz, AIR);
|
||||
});
|
||||
getEngine().getMetrics().getDeposit().put(p.getMilliseconds());
|
||||
|
||||
Reference in New Issue
Block a user