mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-23 00:59:16 +00:00
Updates & fixes
This commit is contained in:
@@ -39,6 +39,7 @@ import com.volmit.iris.engine.platform.DummyChunkGenerator;
|
|||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
|
import com.volmit.iris.util.exceptions.IrisException;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.function.NastyRunnable;
|
import com.volmit.iris.util.function.NastyRunnable;
|
||||||
@@ -58,6 +59,8 @@ import io.papermc.lib.PaperLib;
|
|||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -137,6 +140,23 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
J.s(this::setupPapi);
|
J.s(this::setupPapi);
|
||||||
J.a(this::verifyDataPacksPost, 20);
|
J.a(this::verifyDataPacksPost, 20);
|
||||||
splash();
|
splash();
|
||||||
|
|
||||||
|
if(IrisSettings.get().getGeneral().isAutoStartDefaultStudio())
|
||||||
|
{
|
||||||
|
Iris.info("Starting up auto Studio!");
|
||||||
|
try {
|
||||||
|
Player r = new KList<>(getServer().getOnlinePlayers()).getRandom();
|
||||||
|
Iris.service(StudioSVC.class).open(r != null ? new VolmitSender(r) : sender, 1337, IrisSettings.get().getGenerator().getDefaultWorldType(), (w) -> {
|
||||||
|
J.s(() -> {for(Player i : getServer().getOnlinePlayers())
|
||||||
|
{
|
||||||
|
i.setGameMode(GameMode.SPECTATOR);
|
||||||
|
i.teleport(new Location(w, 0, 200, 0));
|
||||||
|
}});
|
||||||
|
});
|
||||||
|
} catch (IrisException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ public class IrisSettings {
|
|||||||
public boolean keepProductionOnReload = false;
|
public boolean keepProductionOnReload = false;
|
||||||
public boolean pluginMetrics = true;
|
public boolean pluginMetrics = true;
|
||||||
public boolean splashLogoStartup = true;
|
public boolean splashLogoStartup = true;
|
||||||
|
public boolean autoStartDefaultStudio = false;
|
||||||
public String forceMainWorld = "";
|
public String forceMainWorld = "";
|
||||||
public int spinh = -20;
|
public int spinh = -20;
|
||||||
public int spins = 7;
|
public int spins = 7;
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import com.volmit.iris.util.plugin.VolmitSender;
|
|||||||
public class CommandIrisDebug extends MortarCommand {
|
public class CommandIrisDebug extends MortarCommand {
|
||||||
@Command
|
@Command
|
||||||
private CommandIrisDebugSpawnerBoost boost;
|
private CommandIrisDebugSpawnerBoost boost;
|
||||||
|
@Command
|
||||||
|
private CommandIrisDebugReupdate reupdate;
|
||||||
|
|
||||||
public CommandIrisDebug() {
|
public CommandIrisDebug() {
|
||||||
super("debug", "dbg");
|
super("debug", "dbg");
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
|
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.volmit.iris.core.command;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
|
import com.volmit.iris.util.collection.KList;
|
||||||
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
|
||||||
|
public class CommandIrisDebugReupdate extends MortarCommand {
|
||||||
|
public CommandIrisDebugReupdate() {
|
||||||
|
super("reupdate", "rupt");
|
||||||
|
requiresPermission(Iris.perm.studio);
|
||||||
|
setDescription("Force update a chunk again");
|
||||||
|
setCategory("Studio");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(VolmitSender sender, String[] args) {
|
||||||
|
|
||||||
|
Chunk c = sender.player().getLocation().getChunk();
|
||||||
|
Engine e = IrisToolbelt.access(sender.player().getWorld()).getEngine();
|
||||||
|
e.getMantle().getMantle().flag(c.getX(), c.getZ(), MantleFlag.UPDATE, false);
|
||||||
|
e.updateChunk(c);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getArgsUsage() {
|
||||||
|
return "<number> [|,&,^,>>,<<,%] <other>";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,6 +56,7 @@ import com.volmit.iris.util.scheduling.jobs.ParallelQueueJob;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.zeroturnaround.zip.ZipUtil;
|
import org.zeroturnaround.zip.ZipUtil;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -63,6 +64,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@SuppressWarnings("ALL")
|
@SuppressWarnings("ALL")
|
||||||
@Data
|
@Data
|
||||||
@@ -99,12 +101,12 @@ public class IrisProject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void open(VolmitSender sender) throws IrisException {
|
public void open(VolmitSender sender) throws IrisException {
|
||||||
open(sender, 1337, () ->
|
open(sender, 1337, (w) ->
|
||||||
{
|
{
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open(VolmitSender sender, long seed, Runnable onDone) throws IrisException {
|
public void open(VolmitSender sender, long seed, Consumer<World> onDone) throws IrisException {
|
||||||
if (isOpen()) {
|
if (isOpen()) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
@@ -171,13 +173,20 @@ public class IrisProject {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
J.a(() -> activeProvider = (PlatformChunkGenerator) IrisToolbelt.createWorld()
|
J.a(() -> {
|
||||||
.seed(seed)
|
try {
|
||||||
.sender(sender)
|
activeProvider = (PlatformChunkGenerator) IrisToolbelt.createWorld()
|
||||||
.studio(true)
|
.seed(seed)
|
||||||
.name("iris/" + UUID.randomUUID())
|
.sender(sender)
|
||||||
.dimension(d.getLoadKey())
|
.studio(true)
|
||||||
.create().getGenerator());
|
.name("iris/" + UUID.randomUUID())
|
||||||
|
.dimension(d.getLoadKey())
|
||||||
|
.create().getGenerator();
|
||||||
|
onDone.accept(activeProvider.getTarget().getWorld().realWorld());
|
||||||
|
} catch (IrisException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public class BoardSVC implements IrisService, BoardProvider {
|
|||||||
|
|
||||||
if (Iris.jobCount() > 0) {
|
if (Iris.jobCount() > 0) {
|
||||||
v.add("&7&m------------------");
|
v.add("&7&m------------------");
|
||||||
v.add(C.LIGHT_PURPLE + "Tasks" + C.GRAY + ": " + Iris.jobCount());
|
v.add(C.LIGHT_PURPLE + "Tasks" + C.GRAY + ": " + Form.f(Iris.jobCount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
v.add("&7&m------------------");
|
v.add("&7&m------------------");
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import org.zeroturnaround.zip.commons.FileUtils;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class StudioSVC implements IrisService {
|
public class StudioSVC implements IrisService {
|
||||||
public static final String LISTING = "https://raw.githubusercontent.com/IrisDimensions/_listing/main/listing-v2.json";
|
public static final String LISTING = "https://raw.githubusercontent.com/IrisDimensions/_listing/main/listing-v2.json";
|
||||||
@@ -322,7 +323,7 @@ public class StudioSVC implements IrisService {
|
|||||||
|
|
||||||
public void open(VolmitSender sender, long seed, String dimm) {
|
public void open(VolmitSender sender, long seed, String dimm) {
|
||||||
try {
|
try {
|
||||||
open(sender, seed, dimm, () -> {
|
open(sender, seed, dimm, (w) -> {
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
@@ -331,7 +332,7 @@ public class StudioSVC implements IrisService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open(VolmitSender sender, long seed, String dimm, Runnable onDone) throws IrisException {
|
public void open(VolmitSender sender, long seed, String dimm, Consumer<World> onDone) throws IrisException {
|
||||||
if (isProjectOpen()) {
|
if (isProjectOpen()) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -411,12 +411,12 @@ public class IrisEngine implements Engine {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getMantle().generateMatter(x >> 4, z >> 4, multicore);
|
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);
|
getBiomeActuator().actuate(x, z, vbiomes, multicore);
|
||||||
getDecorantActuator().actuate(x, z, blocks, multicore);
|
getDecorantActuator().actuate(x, z, blocks, multicore);
|
||||||
getPostModifier().modify(x, z, vblocks, multicore);
|
getPostModifier().modify(x, z, blocks, multicore);
|
||||||
getDepositModifier().modify(x, z, vblocks, multicore);
|
getDepositModifier().modify(x, z, blocks, multicore);
|
||||||
getCaveModifier().modify(x >> 4,z >> 4, vblocks, multicore);
|
getCaveModifier().modify(x >> 4,z >> 4, blocks, multicore);
|
||||||
getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, blocks, multicore);
|
getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, blocks, multicore);
|
||||||
}
|
}
|
||||||
getMetrics().getTotal().put(p.getMilliseconds());
|
getMetrics().getTotal().put(p.getMilliseconds());
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
private final Looper looper;
|
private final Looper looper;
|
||||||
private final int id;
|
private final int id;
|
||||||
private final KMap<Long, Long> chunkCooldowns;
|
private final KMap<Long, Long> chunkCooldowns;
|
||||||
|
private final KList<Runnable> updateQueue = new KList<>();
|
||||||
private double energy = 25;
|
private double energy = 25;
|
||||||
private int entityCount = 0;
|
private int entityCount = 0;
|
||||||
private final ChronoLatch cl;
|
private final ChronoLatch cl;
|
||||||
@@ -142,7 +143,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
onAsyncTick();
|
onAsyncTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 50;
|
return 250;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
looper.setPriority(Thread.MIN_PRIORITY);
|
looper.setPriority(Thread.MIN_PRIORITY);
|
||||||
@@ -152,10 +153,18 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
|
|
||||||
private void updateChunks() {
|
private void updateChunks() {
|
||||||
for (Player i : getEngine().getWorld().realWorld().getPlayers()) {
|
for (Player i : getEngine().getWorld().realWorld().getPlayers()) {
|
||||||
J.s(() -> {
|
int r = 2;
|
||||||
Chunk c = i.getLocation().getChunk();
|
Chunk c = i.getLocation().getChunk();
|
||||||
J.a(() -> getEngine().updateChunk(c));
|
for(int x = -r; x <= r; x++)
|
||||||
}, RNG.r.i(0, 5));
|
{
|
||||||
|
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))));
|
() -> J.a(() -> spawnIn(e, true), RNG.r.i(5, 200))));
|
||||||
energy += 0.3;
|
energy += 0.3;
|
||||||
fixEnergy();
|
fixEnergy();
|
||||||
|
if(!getMantle().hasFlag(e.getX(), e.getZ(), MantleFlag.UPDATE))
|
||||||
|
{
|
||||||
|
J.a(() -> getEngine().updateChunk(e),20);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mantle getMantle() {
|
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.data.DataProvider;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
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.function.Function2;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import com.volmit.iris.util.mantle.MantleFlag;
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
import com.volmit.iris.util.math.BlockPosition;
|
import com.volmit.iris.util.math.BlockPosition;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.math.RNG;
|
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.MatterUpdate;
|
||||||
import com.volmit.iris.util.matter.slices.UpdateMatter;
|
import com.volmit.iris.util.matter.slices.UpdateMatter;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
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.scheduling.PrecisionStopwatch;
|
||||||
import com.volmit.iris.util.stream.ProceduralStream;
|
import com.volmit.iris.util.stream.ProceduralStream;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.*;
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.command.CommandSender;
|
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.generator.ChunkGenerator;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.Color;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@@ -233,21 +235,39 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
|||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
@Override
|
@Override
|
||||||
default void updateChunk(Chunk c) {
|
default void updateChunk(Chunk c) {
|
||||||
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.UPDATE, () -> J.s(() -> {
|
if(c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ() + 1)
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
&& c.getWorld().isChunkLoaded(c.getX(), c.getZ() + 1)
|
||||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterUpdate.class, (x, y, z, v) -> {
|
&& c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ())
|
||||||
if (v != null && v.isUpdate()) {
|
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ() - 1)
|
||||||
int vx = x & 15;
|
&& c.getWorld().isChunkLoaded(c.getX(), c.getZ() - 1)
|
||||||
int vz = z & 15;
|
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ())
|
||||||
update(x, y, z, c, new RNG(Cache.key(c.getX(), 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) {
|
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterCavern.class, (x, y, z, v) -> {
|
||||||
updateLighting(x, y, z, c);
|
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
|
@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.Mantle;
|
||||||
import com.volmit.iris.util.mantle.MantleChunk;
|
import com.volmit.iris.util.mantle.MantleChunk;
|
||||||
import com.volmit.iris.util.mantle.MantleFlag;
|
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.CavernMatter;
|
||||||
import com.volmit.iris.util.matter.slices.UpdateMatter;
|
import com.volmit.iris.util.matter.slices.UpdateMatter;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
@@ -236,6 +238,16 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
getMantle().set(x, y, z, CavernMatter.ON);
|
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
|
@ChunkCoordinates
|
||||||
default List<IrisFeaturePositional> getFeaturesInChunk(Chunk c) {
|
default List<IrisFeaturePositional> getFeaturesInChunk(Chunk c) {
|
||||||
return getFeaturesInChunk(c.getX(), c.getZ());
|
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.data.cache.Cache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineAssignedModifier;
|
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.biome.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.deposits.IrisDepositGenerator;
|
import com.volmit.iris.engine.object.deposits.IrisDepositGenerator;
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
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.block.data.BlockData;
|
||||||
import org.bukkit.util.BlockVector;
|
import org.bukkit.util.BlockVector;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
||||||
private final RNG rng;
|
private final RNG rng;
|
||||||
private final BlockData AIR = Material.CAVE_AIR.createBlockData();
|
private final BlockData AIR = Material.CAVE_AIR.createBlockData();
|
||||||
@@ -53,11 +56,10 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
Mantle mantle = getEngine().getMantle().getMantle();
|
Mantle mantle = getEngine().getMantle().getMantle();
|
||||||
MantleChunk mc = getEngine().getMantle().getMantle().getChunk(x, z);
|
MantleChunk mc = getEngine().getMantle().getMantle().getChunk(x, z);
|
||||||
|
|
||||||
mc.iterate(MatterCavern.class, (xx, yy, zz, c) -> {
|
mc.iterate(MatterCavern.class, (xx, yy, zz, c) -> {
|
||||||
int rx = xx & 15;
|
int rx = xx & 15;
|
||||||
int rz = zz & 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);
|
BlockData current = output.get(rx, yy, rz);
|
||||||
|
|
||||||
if(current.getMaterial().isAir())
|
if(current.getMaterial().isAir())
|
||||||
@@ -65,23 +67,11 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(B.isFluid(currentAbove) && !caveAbove)
|
|
||||||
{
|
|
||||||
getEngine().getMantle().updateBlock(xx, yy+1, zz);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(B.isFluid(current))
|
if(B.isFluid(current))
|
||||||
{
|
{
|
||||||
getEngine().getMantle().updateBlock(xx, yy, zz);
|
|
||||||
return;
|
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);
|
output.set(rx, yy, rz, AIR);
|
||||||
});
|
});
|
||||||
getEngine().getMetrics().getDeposit().put(p.getMilliseconds());
|
getEngine().getMetrics().getDeposit().put(p.getMilliseconds());
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import it.unimi.dsi.fastutil.ints.IntSets;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.block.data.Waterlogged;
|
||||||
import org.bukkit.block.data.type.Leaves;
|
import org.bukkit.block.data.type.Leaves;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -510,4 +511,8 @@ public class B {
|
|||||||
|
|
||||||
return bt.toArray(new String[0]);
|
return bt.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isWaterLogged(BlockData b) {
|
||||||
|
return (b instanceof Waterlogged) && ((Waterlogged)b).isWaterlogged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import com.volmit.iris.util.math.KochanekBartelsInterpolation;
|
|||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.math.PathInterpolation;
|
import com.volmit.iris.util.math.PathInterpolation;
|
||||||
import com.volmit.iris.util.matter.Matter;
|
import com.volmit.iris.util.matter.Matter;
|
||||||
|
import com.volmit.iris.util.matter.MatterCavern;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.parallel.HyperLock;
|
import com.volmit.iris.util.parallel.HyperLock;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
@@ -506,4 +507,8 @@ public class Mantle {
|
|||||||
public MantleChunk getChunk(Chunk e) {
|
public MantleChunk getChunk(Chunk e) {
|
||||||
return getChunk(e.getX(), e.getZ());
|
return getChunk(e.getX(), e.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteChunkSlice(int x, int z, Class<?> c) {
|
||||||
|
getChunk(x, z).deleteSlices(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,4 +241,15 @@ public class MantleChunk {
|
|||||||
public List<IrisFeaturePositional> getFeatures() {
|
public List<IrisFeaturePositional> getFeatures() {
|
||||||
return features;
|
return features;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteSlices(Class<?> c) {
|
||||||
|
for(int i = 0; i < sections.length(); i++)
|
||||||
|
{
|
||||||
|
Matter m = sections.get(i);
|
||||||
|
if(m != null && m.hasSlice(c))
|
||||||
|
{
|
||||||
|
m.deleteSlice(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user