mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-19 15:09:18 +00:00
Compare commits
59 Commits
old/iris3
...
2.2.9-1.19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2871038584 | ||
|
|
340885f939 | ||
|
|
1e32e47f54 | ||
|
|
3c759f3b01 | ||
|
|
6615f34d20 | ||
|
|
3a4aac1ee4 | ||
|
|
4d6c092615 | ||
|
|
93421a1dc9 | ||
|
|
209458a856 | ||
|
|
82bd94620e | ||
|
|
af9f017871 | ||
|
|
2f8922ea87 | ||
|
|
0ea936f3fe | ||
|
|
d1870ee0a8 | ||
|
|
d2151690ad | ||
|
|
dff373e7d5 | ||
|
|
0aec2a664f | ||
|
|
723b696393 | ||
|
|
f5f89eb4e4 | ||
|
|
df15332c7f | ||
|
|
61d9e5a869 | ||
|
|
9628b66a97 | ||
|
|
5e041366d4 | ||
|
|
3ecae8d72c | ||
|
|
5709ce9d82 | ||
|
|
ce3c334ac5 | ||
|
|
2ed5aa8730 | ||
|
|
8480a63dda | ||
|
|
132a1695f3 | ||
|
|
21775630c3 | ||
|
|
eac2ef7c6d | ||
|
|
386997f646 | ||
|
|
637b90ad62 | ||
|
|
95d755c2ec | ||
|
|
781aeebef6 | ||
|
|
5e133fd51a | ||
|
|
85f62a3b9d | ||
|
|
a32de58c8b | ||
|
|
1cb2ea6c17 | ||
|
|
6a37ab7af2 | ||
|
|
e0f0aaf767 | ||
|
|
3d7c5b050a | ||
|
|
6bc57c255f | ||
|
|
b82edfe688 | ||
|
|
6b32eb3441 | ||
|
|
23a07fa8a5 | ||
|
|
b019faedd2 | ||
|
|
4430433a10 | ||
|
|
f52cd29e7b | ||
|
|
6a44e593a6 | ||
|
|
f7065fe034 | ||
|
|
0a247956f7 | ||
|
|
03836acded | ||
|
|
b5fb277982 | ||
|
|
e523d3c166 | ||
|
|
41477e4aa6 | ||
|
|
fbaf42a8c4 | ||
|
|
1c3668047b | ||
|
|
7d78c69b6e |
1
.github/ISSUE_TEMPLATE/bug.yml
vendored
1
.github/ISSUE_TEMPLATE/bug.yml
vendored
@@ -39,6 +39,7 @@ body:
|
||||
- 1.17
|
||||
- 1.17.1
|
||||
- 1.18
|
||||
- 1.19
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
|
||||
12
build.gradle
12
build.gradle
@@ -24,10 +24,10 @@ plugins {
|
||||
id "de.undercouch.download" version "5.0.1"
|
||||
}
|
||||
|
||||
version '2.2.1-1.19' // Needs to be version specific
|
||||
def nmsVersion = "1.19"
|
||||
version '2.2.9-1.19.2' // Needs to be version specific
|
||||
def nmsVersion = "1.19.2"
|
||||
def apiVersion = '1.19'
|
||||
def spigotJarVersion = '1.19-R0.1-SNAPSHOT'
|
||||
def spigotJarVersion = '1.19.1-R0.1-SNAPSHOT'
|
||||
def name = getRootProject().getName() // Defined in settings.gradle
|
||||
def main = 'com.volmit.iris.Iris'
|
||||
|
||||
@@ -38,7 +38,7 @@ registerCustomOutputTask('Psycho', 'D://Dan/MinecraftDevelopment/server/plugins'
|
||||
registerCustomOutputTask('ArcaneArts', 'C://Users/arcane/Documents/development/server/plugins')
|
||||
registerCustomOutputTask('Coco', 'D://Documents/MC/plugins')
|
||||
registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins')
|
||||
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19/plugins')
|
||||
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19.1/plugins')
|
||||
// ========================== UNIX ==============================
|
||||
registerCustomOutputTaskUnix('CyberpwnLT', '/Users/danielmills/development/server/plugins')
|
||||
registerCustomOutputTaskUnix('PsychoLT', '/Users/brianfopiano/Desktop/REMOTES/RemoteMinecraft/plugins')
|
||||
@@ -124,10 +124,10 @@ dependencies {
|
||||
// Provided or Classpath
|
||||
compileOnly 'org.projectlombok:lombok:1.18.24'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.24'
|
||||
implementation 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT'
|
||||
implementation 'org.spigotmc:spigot-api:1.19.1-R0.1-SNAPSHOT'
|
||||
implementation 'me.clip:placeholderapi:2.11.1'
|
||||
implementation 'io.th0rgal:oraxen:1.94.0'
|
||||
implementation 'org.bukkit:craftbukkit:1.19-R0.1-SNAPSHOT:remapped-mojang'
|
||||
implementation 'org.bukkit:craftbukkit:1.19.1-R0.1-SNAPSHOT:remapped-mojang'
|
||||
implementation 'com.github.LoneDev6:api-itemsadder:3.1.0b'
|
||||
|
||||
// Shaded
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.volmit.iris.core.ServerConfigurator;
|
||||
import com.volmit.iris.core.link.*;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.pregenerator.LazyPregenerator;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.EnginePanic;
|
||||
@@ -85,7 +86,11 @@ import java.util.Objects;
|
||||
|
||||
@SuppressWarnings("CanBeFinal")
|
||||
public class Iris extends VolmitPlugin implements Listener {
|
||||
|
||||
public static final String OVERWORLD_TAG = "2086";
|
||||
|
||||
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
|
||||
|
||||
public static Iris instance;
|
||||
public static BukkitAudiences audiences;
|
||||
public static MultiverseCoreLink linkMultiverseCore;
|
||||
@@ -400,6 +405,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
J.s(() -> {
|
||||
J.a(() -> PaperLib.suggestPaper(this));
|
||||
J.a(() -> IO.delete(getTemp()));
|
||||
J.a(LazyPregenerator::loadLazyGenerators, 100);
|
||||
J.a(this::bstats);
|
||||
J.ar(this::checkConfigHotload, 60);
|
||||
J.sr(this::tickQueue, 0);
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.io.IO;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.Queue;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@@ -38,6 +39,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ServerConfigurator {
|
||||
@@ -82,43 +84,21 @@ public class ServerConfigurator {
|
||||
}
|
||||
}
|
||||
|
||||
private static File getDatapacksFolder() {
|
||||
private static List<File> getDatapacksFolder() {
|
||||
if(!IrisSettings.get().getGeneral().forceMainWorld.isEmpty()) {
|
||||
return new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks");
|
||||
return new KList<File>().qadd(new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks"));
|
||||
}
|
||||
|
||||
File props = new File("server.properties");
|
||||
|
||||
if(props.exists()) {
|
||||
try {
|
||||
KList<String> m = new KList<>(IO.readAll(props).split("\\Q\n\\E"));
|
||||
|
||||
for(String i : m) {
|
||||
if(i.trim().startsWith("level-name=")) {
|
||||
return new File(i.trim().split("\\Q=\\E")[1] + "/datapacks");
|
||||
}
|
||||
}
|
||||
} catch(IOException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
KList<File> worlds = new KList<>();
|
||||
Bukkit.getServer().getWorlds().forEach(w -> worlds.add(new File(w.getWorldFolder(), "datapacks")));
|
||||
return worlds;
|
||||
}
|
||||
|
||||
|
||||
public static void installDataPacks(boolean fullInstall) {
|
||||
Iris.info("Checking Data Packs...");
|
||||
boolean reboot = false;
|
||||
File packs = new File("plugins/Iris/packs");
|
||||
File dpacks = getDatapacksFolder();
|
||||
|
||||
if(dpacks == null) {
|
||||
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
||||
return;
|
||||
}
|
||||
|
||||
if(packs.exists()) {
|
||||
if(packs.exists()) {
|
||||
for(File i : packs.listFiles()) {
|
||||
if(i.isDirectory()) {
|
||||
Iris.verbose("Checking Pack: " + i.getPath());
|
||||
@@ -135,8 +115,8 @@ public class ServerConfigurator {
|
||||
}
|
||||
|
||||
Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath());
|
||||
if(dim.installDataPack(() -> data, dpacks)) {
|
||||
reboot = true;
|
||||
for(File dpack : getDatapacksFolder()) {
|
||||
dim.installDataPack(() -> data, dpack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,19 +127,12 @@ public class ServerConfigurator {
|
||||
|
||||
Iris.info("Data Packs Setup!");
|
||||
|
||||
if(fullInstall) {
|
||||
if(fullInstall)
|
||||
verifyDataPacksPost(IrisSettings.get().getAutoConfiguration().isAutoRestartOnCustomBiomeInstall());
|
||||
}
|
||||
}
|
||||
|
||||
private static void verifyDataPacksPost(boolean allowRestarting) {
|
||||
File packs = new File("plugins/Iris/packs");
|
||||
File dpacks = getDatapacksFolder();
|
||||
|
||||
if(dpacks == null) {
|
||||
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
||||
return;
|
||||
}
|
||||
|
||||
boolean bad = false;
|
||||
if(packs.exists()) {
|
||||
|
||||
@@ -38,10 +38,12 @@ import com.volmit.iris.util.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.jobs.QueueJob;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
@@ -76,8 +78,6 @@ public class CommandIris implements DecreeExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
sender().sendMessage(C.RED + "You should not be using this command to create new worlds. Instead, use the tutorial: https://docs.volmit.com/iris/getting-started");
|
||||
|
||||
try {
|
||||
IrisToolbelt.createWorld()
|
||||
.dimension(type.getLoadKey())
|
||||
@@ -96,6 +96,37 @@ public class CommandIris implements DecreeExecutor {
|
||||
sender().sendMessage(C.GREEN + "Successfully created your world!");
|
||||
}
|
||||
|
||||
@Decree(description = "Remove an Iris world", aliases = {"del", "rm"}, sync = true)
|
||||
public void remove(
|
||||
@Param(description = "The world to remove")
|
||||
World world,
|
||||
@Param(description = "Whether to also remove the folder (if set to false, just does not load the world)", defaultValue = "true")
|
||||
boolean delete
|
||||
) {
|
||||
if (!IrisToolbelt.isIrisWorld(world)) {
|
||||
sender().sendMessage(C.RED + "This is not an Iris world. Iris worlds: " + String.join(", ", Bukkit.getServer().getWorlds().stream().filter(IrisToolbelt::isIrisWorld).map(World::getName).toList()));
|
||||
return;
|
||||
}
|
||||
sender().sendMessage(C.GREEN + "Removing world: " + world.getName());
|
||||
try {
|
||||
if (IrisToolbelt.removeWorld(world)) {
|
||||
sender().sendMessage(C.GREEN + "Successfully removed " + world.getName() + " from bukkit.yml");
|
||||
} else {
|
||||
sender().sendMessage(C.YELLOW + "Looks like the world was already removed from bukkit.yml");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
sender().sendMessage(C.RED + "Failed to save bukkit.yml because of " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
IrisToolbelt.evacuate(world, "Deleting world");
|
||||
Bukkit.unloadWorld(world, false);
|
||||
if (delete && world.getWorldFolder().delete()) {
|
||||
sender().sendMessage(C.GREEN + "Successfully removed world folder");
|
||||
} else {
|
||||
sender().sendMessage(C.RED + "Failed to remove world folder");
|
||||
}
|
||||
}
|
||||
|
||||
@Decree(description = "Print version information")
|
||||
public void version() {
|
||||
sender().sendMessage(C.GREEN + "Iris v" + Iris.instance.getDescription().getVersion() + " by Volmit Software");
|
||||
@@ -107,6 +138,12 @@ public class CommandIris implements DecreeExecutor {
|
||||
sender().sendMessage(C.GREEN + "Total Height: " + (sender().player().getWorld().getMaxHeight() - sender().player().getWorld().getMinHeight()));
|
||||
}
|
||||
|
||||
@Decree(description = "QOL command to open a overworld studio world.", sync = true)
|
||||
public void so() {
|
||||
sender().sendMessage(C.GREEN + "Opening studio for the \"Overworld\" pack (seed: 1337)");
|
||||
Iris.service(StudioSVC.class).open(sender(), 1337, "overworld");
|
||||
}
|
||||
|
||||
@Decree(description = "Set aura spins")
|
||||
public void aura(
|
||||
@Param(description = "The h color value", defaultValue = "-20")
|
||||
@@ -170,9 +207,13 @@ public class CommandIris implements DecreeExecutor {
|
||||
@Param(name = "overwrite", description = "Whether or not to overwrite the pack with the downloaded one", aliases = "force", defaultValue = "false")
|
||||
boolean overwrite
|
||||
) {
|
||||
branch = pack.equals("overworld") ? "stable" : branch;
|
||||
sender().sendMessage(C.GREEN + "Downloading pack: " + pack + "/" + branch + (trim ? " trimmed" : "") + (overwrite ? " overwriting" : ""));
|
||||
Iris.service(StudioSVC.class).downloadSearch(sender(), "IrisDimensions/" + pack + "/" + branch, trim, overwrite);
|
||||
if(pack.equals("overworld")) {
|
||||
String url = "https://github.com/IrisDimensions/overworld/releases/download/" + Iris.OVERWORLD_TAG + "/overworld.zip";
|
||||
Iris.service(StudioSVC.class).downloadRelease(sender(), url, trim, overwrite);
|
||||
} else {
|
||||
Iris.service(StudioSVC.class).downloadSearch(sender(), "IrisDimensions/" + pack + "/" + branch, trim, overwrite);
|
||||
}
|
||||
}
|
||||
|
||||
@Decree(description = "Get metrics for your world", aliases = "measure", origin = DecreeOrigin.PLAYER)
|
||||
|
||||
@@ -148,7 +148,7 @@ public class NoiseExplorerGUI extends JPanel implements MouseWheelListener, List
|
||||
JFrame frame = new JFrame("Noise Explorer");
|
||||
NoiseExplorerGUI nv = new NoiseExplorerGUI();
|
||||
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||
KList<String> li = new KList<>(NoiseStyle.values()).toStringList();
|
||||
KList<String> li = new KList<>(NoiseStyle.values()).toStringList().sort();
|
||||
combo = new JComboBox<>(li.toArray(new String[0]));
|
||||
combo.setSelectedItem("STATIC");
|
||||
combo.setFocusable(false);
|
||||
|
||||
@@ -83,7 +83,6 @@ public class PregeneratorJob implements PregenListener {
|
||||
this.pregenerator = new IrisPregenerator(task, method, this);
|
||||
max = new Position2(0, 0);
|
||||
min = new Position2(0, 0);
|
||||
KList<Runnable> draw = new KList<>();
|
||||
task.iterateRegions((xx, zz) -> {
|
||||
min.setX(Math.min(xx << 5, min.getX()));
|
||||
min.setZ(Math.min(zz << 5, min.getZ()));
|
||||
|
||||
@@ -20,6 +20,7 @@ package com.volmit.iris.core.link;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.Location;
|
||||
@@ -59,15 +60,15 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
|
||||
|
||||
if(p.equalsIgnoreCase("biome_name")) {
|
||||
if(a != null) {
|
||||
return a.getEngine().getBiome(l).getName();
|
||||
return getBiome(a, l).getName();
|
||||
}
|
||||
} else if(p.equalsIgnoreCase("biome_id")) {
|
||||
if(a != null) {
|
||||
return a.getEngine().getBiome(l).getLoadKey();
|
||||
return getBiome(a, l).getLoadKey();
|
||||
}
|
||||
} else if(p.equalsIgnoreCase("biome_file")) {
|
||||
if(a != null) {
|
||||
return a.getEngine().getBiome(l).getLoadFile().getPath();
|
||||
return getBiome(a, l).getLoadFile().getPath();
|
||||
}
|
||||
} else if(p.equalsIgnoreCase("region_name")) {
|
||||
if(a != null) {
|
||||
@@ -107,4 +108,8 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private IrisBiome getBiome(PlatformChunkGenerator a, Location l) {
|
||||
return a.getEngine().getBiome(l.getBlockX(), l.getBlockY() - l.getWorld().getMinHeight(), l.getBlockZ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ package com.volmit.iris.core.nms;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.nms.v19_1.NMSBinding19_1;
|
||||
import com.volmit.iris.core.nms.v19_2.NMSBinding19_2;
|
||||
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -28,7 +28,7 @@ import org.bukkit.Bukkit;
|
||||
public class INMS {
|
||||
//@builder
|
||||
private static final KMap<String, Class<? extends INMSBinding>> bindings = new KMap<String, Class<? extends INMSBinding>>()
|
||||
.qput("v1_19_R1", NMSBinding19_1.class);
|
||||
.qput("v1_19_R1", NMSBinding19_2.class);
|
||||
//@done
|
||||
private static final INMSBinding binding = bind();
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.core.nms.v19_1;
|
||||
package com.volmit.iris.core.nms.v19_2;
|
||||
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
@@ -39,15 +39,10 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import net.minecraft.core.*;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.BitStorage;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.chunk.Palette;
|
||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -74,7 +69,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class NMSBinding19_1 implements INMSBinding {
|
||||
public class NMSBinding19_2 implements INMSBinding {
|
||||
|
||||
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
|
||||
private final BlockData AIR = Material.AIR.createBlockData();
|
||||
@@ -344,44 +339,12 @@ public class NMSBinding19_1 implements INMSBinding {
|
||||
ChunkAccess s = (ChunkAccess) getFieldForBiomeStorage(chunk).get(chunk);
|
||||
Holder<net.minecraft.world.level.biome.Biome> biome = (Holder<net.minecraft.world.level.biome.Biome>) somethingVeryDirty;
|
||||
s.setBiome(x, y, z, biome);
|
||||
/*int l = QuartPos.fromBlock(s.getMinBuildHeight());
|
||||
int i1 = l + QuartPos.fromBlock(s.getHeight()) - 1;
|
||||
PalettedContainer<Holder<net.minecraft.world.level.biome.Biome>> palette = getPalette(s, s.getSectionIndex(QuartPos.toBlock(Mth.clamp(y, l, i1))));
|
||||
int index = getPaletteIndex(x, y, z, s, palette);
|
||||
int data = getPaletteDataId(palette, biome);
|
||||
setPaletteData(palette, index, data);*/
|
||||
} catch(IllegalAccessException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private PalettedContainer<Holder<net.minecraft.world.level.biome.Biome>> getPalette(ChunkAccess ca, int index) {
|
||||
LevelChunkSection[] sections = fieldForClass(LevelChunkSection[].class, ChunkAccess.class, ca);
|
||||
return fieldForClass(PalettedContainer.class, LevelChunkSection.class, sections[index]);
|
||||
}
|
||||
|
||||
private int getPaletteIndex(int x, int y, int z, ChunkAccess s, PalettedContainer<?> palette) {
|
||||
int l = QuartPos.fromBlock(s.getMinBuildHeight());
|
||||
int i1 = l + QuartPos.fromBlock(s.getHeight()) - 1;
|
||||
int j1 = Mth.clamp(y, l, i1);
|
||||
return fieldForClass(PalettedContainer.Strategy.class, PalettedContainer.class, palette).getIndex(x & 3, j1 & 3, z & 3);
|
||||
}
|
||||
|
||||
private <T extends Holder<?>> int getPaletteDataId(PalettedContainer<T> palette, T data) throws ClassNotFoundException {
|
||||
Class<?> dataType = getClassType(PalettedContainer.class, 1);
|
||||
Object paletteData = fieldFor(dataType, palette);
|
||||
Palette<T> fuckinFinally = fieldForClass(Palette.class,dataType, paletteData);
|
||||
return fuckinFinally.idFor(data);
|
||||
}
|
||||
|
||||
private void setPaletteData(PalettedContainer<?> palette, int index, int data) throws ClassNotFoundException {
|
||||
Class<?> dataType = getClassType(PalettedContainer.class, 1);
|
||||
Object paletteData = fieldFor(dataType, palette);
|
||||
BitStorage storage = fieldForClass(BitStorage.class, dataType, paletteData);
|
||||
storage.set(index, data);
|
||||
}
|
||||
|
||||
private Field getFieldForBiomeStorage(Object storage) {
|
||||
Field f = biomeStorageCache;
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.Looper;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@@ -55,10 +56,12 @@ public class IrisPregenerator {
|
||||
private final KSet<Position2> retry;
|
||||
private final KSet<Position2> net;
|
||||
private final ChronoLatch cl;
|
||||
private final Semaphore limiter;
|
||||
|
||||
public IrisPregenerator(PregenTask task, PregeneratorMethod generator, PregenListener listener) {
|
||||
this.listener = listenify(listener);
|
||||
cl = new ChronoLatch(5000);
|
||||
limiter = new Semaphore(Runtime.getRuntime().availableProcessors());
|
||||
generatedRegions = new KSet<>();
|
||||
this.shutdown = new AtomicBoolean(false);
|
||||
this.paused = new AtomicBoolean(false);
|
||||
@@ -140,6 +143,7 @@ public class IrisPregenerator {
|
||||
generator.close();
|
||||
ticker.interrupt();
|
||||
listener.onClose();
|
||||
getMantle().trim(0);
|
||||
}
|
||||
|
||||
private void visitRegion(int x, int z, boolean regions) {
|
||||
@@ -162,12 +166,26 @@ public class IrisPregenerator {
|
||||
boolean hit = false;
|
||||
if(generator.supportsRegions(x, z, listener) && regions) {
|
||||
hit = true;
|
||||
listener.onRegionGenerating(x, z);
|
||||
generator.generateRegion(x, z, listener);
|
||||
try {
|
||||
limiter.acquire();
|
||||
listener.onRegionGenerating(x, z);
|
||||
generator.generateRegion(x, z, listener);
|
||||
limiter.release();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else if(!regions) {
|
||||
hit = true;
|
||||
listener.onRegionGenerating(x, z);
|
||||
PregenTask.iterateRegion(x, z, (xx, zz) -> generator.generateChunk(xx, zz, listener));
|
||||
PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
||||
try {
|
||||
limiter.acquire();
|
||||
generator.generateChunk(xx, zz, listener);
|
||||
limiter.release();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(hit) {
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
package com.volmit.iris.core.pregenerator;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.io.IO;
|
||||
import com.volmit.iris.util.math.Position2;
|
||||
import com.volmit.iris.util.math.Spiraler;
|
||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class LazyPregenerator extends Thread implements Listener
|
||||
{
|
||||
private final LazyPregenJob job;
|
||||
private final File destination;
|
||||
private final int maxPosition;
|
||||
private final World world;
|
||||
private final long rate;
|
||||
private final ChronoLatch latch;
|
||||
|
||||
public LazyPregenerator(LazyPregenJob job, File destination)
|
||||
{
|
||||
this.job = job;
|
||||
this.destination = destination;
|
||||
this.maxPosition = new Spiraler(job.getRadiusBlocks() * 2, job.getRadiusBlocks() * 2, (x, z) -> {}).count();
|
||||
this.world = Bukkit.getWorld(job.getWorld());
|
||||
this.rate = Math.round((1D / (job.chunksPerMinute / 60D)) * 1000D);
|
||||
this.latch = new ChronoLatch(60000);
|
||||
}
|
||||
|
||||
public LazyPregenerator(File file) throws IOException {
|
||||
this(new Gson().fromJson(IO.readAll(file), LazyPregenJob.class), file);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(WorldUnloadEvent e)
|
||||
{
|
||||
if(e.getWorld().equals(world)) {
|
||||
interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
while(!interrupted()) {
|
||||
J.sleep(rate);
|
||||
tick();
|
||||
}
|
||||
|
||||
try {
|
||||
saveNow();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
if(latch.flip())
|
||||
{
|
||||
save();
|
||||
Iris.info("LazyGen: " + world.getName() + " RTT: " + Form.duration((Math.pow((job.radiusBlocks / 16D), 2) / job.chunksPerMinute) * 60 * 1000, 2));
|
||||
}
|
||||
|
||||
if(job.getPosition() >= maxPosition)
|
||||
{
|
||||
if(job.isHealing())
|
||||
{
|
||||
int pos = (job.getHealingPosition() + 1) % maxPosition;
|
||||
job.setHealingPosition(pos);
|
||||
tickRegenerate(getChunk(pos));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Iris.verbose("Completed Lazy Gen!");
|
||||
interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
int pos = job.getPosition() + 1;
|
||||
job.setPosition(pos);
|
||||
tickGenerate(getChunk(pos));
|
||||
}
|
||||
}
|
||||
|
||||
private void tickGenerate(Position2 chunk) {
|
||||
if(PaperLib.isPaper()) {
|
||||
PaperLib.getChunkAtAsync(world, chunk.getX(), chunk.getZ(), true).thenAccept((i) -> Iris.verbose("Generated Async " + chunk));
|
||||
}
|
||||
else {
|
||||
J.s(() -> world.getChunkAt(chunk.getX(), chunk.getZ()));
|
||||
Iris.verbose("Generated " + chunk);
|
||||
}
|
||||
}
|
||||
|
||||
private void tickRegenerate(Position2 chunk) {
|
||||
J.s(() -> world.regenerateChunk(chunk.getX(), chunk.getZ()));
|
||||
Iris.verbose("Regenerated " + chunk);
|
||||
}
|
||||
|
||||
public Position2 getChunk(int position)
|
||||
{
|
||||
int p = -1;
|
||||
AtomicInteger xx = new AtomicInteger();
|
||||
AtomicInteger zz = new AtomicInteger();
|
||||
Spiraler s = new Spiraler(job.getRadiusBlocks() * 2, job.getRadiusBlocks() * 2, (x, z) -> {
|
||||
xx.set(x);
|
||||
zz.set(z);
|
||||
});
|
||||
|
||||
while(s.hasNext() && p++ < position) {
|
||||
s.next();
|
||||
}
|
||||
|
||||
return new Position2(xx.get(), zz.get());
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
J.a(() -> {
|
||||
try {
|
||||
saveNow();
|
||||
}
|
||||
|
||||
catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void saveNow() throws IOException {
|
||||
IO.writeAll(this.destination, new Gson().toJson(job));
|
||||
}
|
||||
|
||||
public static void loadLazyGenerators()
|
||||
{
|
||||
for(World i : Bukkit.getWorlds())
|
||||
{
|
||||
File lazygen = new File(i.getWorldFolder(), "lazygen.json");
|
||||
|
||||
if(lazygen.exists()) {
|
||||
try {
|
||||
LazyPregenerator p = new LazyPregenerator(lazygen);
|
||||
p.start();
|
||||
Iris.info("Started Lazy Pregenerator: " + p.job);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public static class LazyPregenJob
|
||||
{
|
||||
private String world;
|
||||
@Builder.Default private int healingPosition = 0;
|
||||
@Builder.Default private boolean healing = false;
|
||||
@Builder.Default private int chunksPerMinute = 32; // 48 hours is roughly 5000 radius
|
||||
@Builder.Default private int radiusBlocks = 5000;
|
||||
@Builder.Default private int position = 0;
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public class StudioSVC implements IrisService {
|
||||
String[] nodes = url.split("\\Q/\\E");
|
||||
String repo = nodes.length == 1 ? "IrisDimensions/" + nodes[0] : nodes[0] + "/" + nodes[1];
|
||||
branch = nodes.length > 2 ? nodes[2] : branch;
|
||||
download(sender, repo, branch, trim, forceOverwrite);
|
||||
download(sender, repo, branch, trim, forceOverwrite, false);
|
||||
} catch(Throwable e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
@@ -179,12 +179,22 @@ public class StudioSVC implements IrisService {
|
||||
}
|
||||
}
|
||||
|
||||
public void download(VolmitSender sender, String repo, String branch, boolean trim) throws JsonSyntaxException, IOException {
|
||||
download(sender, repo, branch, trim, false);
|
||||
public void downloadRelease(VolmitSender sender, String url, boolean trim, boolean forceOverwrite) {
|
||||
try {
|
||||
download(sender, "IrisDimensions", url, trim, forceOverwrite, true);
|
||||
} catch(Throwable e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
sender.sendMessage("Failed to download 'IrisDimensions/overworld' from " + url + ".");
|
||||
}
|
||||
}
|
||||
|
||||
public void download(VolmitSender sender, String repo, String branch, boolean trim, boolean forceOverwrite) throws JsonSyntaxException, IOException {
|
||||
String url = "https://codeload.github.com/" + repo + "/zip/refs/heads/" + branch;
|
||||
public void download(VolmitSender sender, String repo, String branch, boolean trim) throws JsonSyntaxException, IOException {
|
||||
download(sender, repo, branch, trim, false, false);
|
||||
}
|
||||
|
||||
public void download(VolmitSender sender, String repo, String branch, boolean trim, boolean forceOverwrite, boolean directUrl) throws JsonSyntaxException, IOException {
|
||||
String url = directUrl ? branch : "https://codeload.github.com/" + repo + "/zip/refs/heads/" + branch;
|
||||
sender.sendMessage("Downloading " + url + " "); //The extra space stops a bug in adventure API from repeating the last letter of the URL
|
||||
File zip = Iris.getNonCachedFile("pack-" + trim + "-" + repo, url);
|
||||
File temp = Iris.getTemp();
|
||||
|
||||
@@ -38,8 +38,11 @@ import org.bukkit.GameRule;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@@ -102,6 +105,9 @@ public class IrisCreator {
|
||||
throw new IrisException("Dimension cannot be found null for id " + dimension());
|
||||
}
|
||||
|
||||
if(sender == null)
|
||||
sender = Iris.getSender();
|
||||
|
||||
if(!studio()) {
|
||||
Iris.service(StudioSVC.class).installIntoWorld(sender, d.getLoadKey(), new File(name()));
|
||||
}
|
||||
@@ -174,7 +180,8 @@ public class IrisCreator {
|
||||
world.get().setTime(6000);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else
|
||||
addToBukkitYml();
|
||||
|
||||
if(pregen != null) {
|
||||
CompletableFuture<Boolean> ff = new CompletableFuture<>();
|
||||
@@ -204,7 +211,38 @@ public class IrisCreator {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return world.get();
|
||||
}
|
||||
|
||||
private static final File BUKKIT_YML = new File(Bukkit.getServer().getWorldContainer(), "bukkit.yml");
|
||||
|
||||
private void addToBukkitYml() {
|
||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(BUKKIT_YML);
|
||||
String gen = "Iris:" + dimension;
|
||||
ConfigurationSection section = yml.contains("worlds") ? yml.getConfigurationSection("worlds") : yml.createSection("worlds");
|
||||
if(!section.contains(name)) {
|
||||
section.createSection(name).set("generator", gen);
|
||||
try {
|
||||
yml.save(BUKKIT_YML);
|
||||
Iris.info("Registered \"" + name + "\" in bukkit.yml");
|
||||
} catch(IOException e) {
|
||||
Iris.error("Failed to update bukkit.yml!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean removeFromBukkitYml(String name) throws IOException {
|
||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(BUKKIT_YML);
|
||||
ConfigurationSection section = yml.getConfigurationSection("worlds");
|
||||
if (section == null) {
|
||||
return false;
|
||||
}
|
||||
section.set(name, null);
|
||||
if (section.getValues(false).keySet().stream().noneMatch(k -> section.get(k) != null)) {
|
||||
yml.set("worlds", null);
|
||||
}
|
||||
yml.save(BUKKIT_YML);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -221,7 +222,6 @@ public class IrisToolbelt {
|
||||
new VolmitSender(j, Iris.instance.getTag()).sendMessage("You have been evacuated from this world. " + m);
|
||||
j.teleport(i.getSpawnLocation());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -248,4 +248,8 @@ public class IrisToolbelt {
|
||||
if(e == null) {return;}
|
||||
e.getEngine().getMantle().getMantle().remove(x, y - world.getMinHeight(), z, of);
|
||||
}
|
||||
|
||||
public static boolean removeWorld(World world) throws IOException {
|
||||
return IrisCreator.removeFromBukkitYml(world.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisBiomeCustom;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.hunk.view.BiomeGridHunkHolder;
|
||||
import com.volmit.iris.util.hunk.view.BiomeGridHunkView;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||
@@ -56,6 +57,14 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
|
||||
hh.forceBiomeBaseInto(x, y, z, bb);
|
||||
}
|
||||
return true;
|
||||
} else if(h instanceof BiomeGridHunkHolder hh) {
|
||||
ChunkGenerator.BiomeGrid g = hh.getChunk();
|
||||
if(g instanceof TerrainChunk) {
|
||||
((TerrainChunk) g).getBiomeBaseInjector().setBiome(x, y, z, bb);
|
||||
} else {
|
||||
hh.forceBiomeBaseInto(x, y, z, bb);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} catch(Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -23,11 +23,13 @@ import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisDecorationPart;
|
||||
import com.volmit.iris.engine.object.IrisDecorator;
|
||||
import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
import org.bukkit.block.data.type.PointedDripstone;
|
||||
|
||||
public class IrisCeilingDecorator extends IrisEngineDecorator {
|
||||
@@ -39,11 +41,10 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
|
||||
@Override
|
||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1, Hunk<BlockData> data, IrisBiome biome, int height, int max) {
|
||||
IrisDecorator decorator = getDecorator(biome, realX, realZ);
|
||||
|
||||
if(decorator != null) {
|
||||
if(!decorator.isStacking()) {
|
||||
if(height >= 0 || height < getEngine().getHeight()) {
|
||||
data.set(x, height, z, decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()));
|
||||
data.set(x, height, z, fixFaces(decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()), realX, height, realZ));
|
||||
}
|
||||
} else {
|
||||
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
|
||||
@@ -98,4 +99,24 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BlockData fixFaces(BlockData b, int x, int y, int z) {
|
||||
if(B.isVineBlock(b)) {
|
||||
MultipleFacing data = (MultipleFacing)b.clone();
|
||||
boolean found = false;
|
||||
for(BlockFace f : BlockFace.values()) {
|
||||
if(!f.isCartesian())
|
||||
continue;
|
||||
Material m = getEngine().getMantle().get(x + f.getModX(), y + f.getModY(), z + f.getModZ()).getMaterial();
|
||||
if(m.isSolid()) {
|
||||
found = true;
|
||||
data.setFace(f, m.isSolid());
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
data.setFace(BlockFace.UP, true);
|
||||
return data;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,14 @@ import com.volmit.iris.engine.object.InferredType;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisDecorationPart;
|
||||
import com.volmit.iris.engine.object.IrisDecorator;
|
||||
import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
import org.bukkit.block.data.type.PointedDripstone;
|
||||
|
||||
public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
@@ -55,7 +57,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
bd = decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData());
|
||||
|
||||
if(!underwater) {
|
||||
if(!canGoOn(bd, bdx)) {
|
||||
if(!canGoOn(bd, bdx) && !decorator.isForcePlace()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -72,8 +74,9 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
((Bisected) bd).setHalf(Bisected.Half.BOTTOM);
|
||||
}
|
||||
|
||||
data.set(x, height + 1, z, bd);
|
||||
|
||||
if(decorator.getForceBlock() != null)
|
||||
data.set(x, height, z, fixFaces(decorator.getForceBlock().getBlockData(getData()), x, height, z));
|
||||
data.set(x, height + 1, z, fixFaces(bd, x, height, z));
|
||||
} else {
|
||||
if(height < getDimension().getFluidHeight()) {
|
||||
max = getDimension().getFluidHeight();
|
||||
@@ -139,4 +142,24 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BlockData fixFaces(BlockData b, int x, int y, int z) {
|
||||
if(B.isVineBlock(b)) {
|
||||
MultipleFacing data = (MultipleFacing)b.clone();
|
||||
boolean found = false;
|
||||
for(BlockFace f : BlockFace.values()) {
|
||||
if(!f.isCartesian())
|
||||
continue;
|
||||
Material m = getEngine().getMantle().get(x + f.getModX(), y + f.getModY(), z + f.getModZ()).getMaterial();
|
||||
if(m.isSolid()) {
|
||||
found = true;
|
||||
data.setFace(f, m.isSolid());
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
data.setFace(BlockFace.UP, true);
|
||||
return data;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,10 +42,10 @@ public class ModeOverworld extends IrisEngineMode implements EngineMode {
|
||||
var deposit = new IrisDepositModifier(getEngine());
|
||||
var perfection = new IrisPerfectionModifier(getEngine());
|
||||
|
||||
registerStage((x, z, k, p, m) -> biome.actuate(x, z, p, m));
|
||||
registerStage(burst(
|
||||
(x, z, k, p, m) -> generateMatter(x >> 4, z >> 4, m),
|
||||
(x, z, k, p, m) -> terrain.actuate(x, z, k, m),
|
||||
(x, z, k, p, m) -> biome.actuate(x, z, p, m)
|
||||
(x, z, k, p, m) -> terrain.actuate(x, z, k, m)
|
||||
));
|
||||
registerStage((x, z, k, p, m) -> cave.modify(x >> 4, z >> 4, k, m));
|
||||
registerStage((x, z, k, p, m) -> deposit.modify(x, z, k, m));
|
||||
|
||||
@@ -53,6 +53,8 @@ public class IrisDecorator {
|
||||
private IrisGeneratorStyle variance = NoiseStyle.STATIC.style();
|
||||
@Desc("Forcefully place this decorant anywhere it is supposed to go even if it should not go on a specific surface block. For example, you could force tallgrass to place on top of stone by using this.")
|
||||
private boolean forcePlace = false;
|
||||
@Desc("Forced the surface block of this decorant to be the specified block. Assumes forcePlace.")
|
||||
private IrisBlockData forceBlock;
|
||||
@DependsOn({"scaleStack", "stackMin", "stackMax"})
|
||||
@Desc("If stackMax is set to true, use this to limit its max height for large caverns")
|
||||
private int absoluteMaxStack = 30;
|
||||
|
||||
@@ -47,9 +47,11 @@ import lombok.experimental.Accessors;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.TileState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.Leaves;
|
||||
import org.bukkit.util.BlockVector;
|
||||
@@ -779,7 +781,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
zz += config.warp(rng, i.getZ() + z, i.getY() + y, i.getX() + x, getLoader());
|
||||
}
|
||||
|
||||
if(yv < 0 && (config.getMode().equals(ObjectPlaceMode.PAINT))) {
|
||||
if(yv < 0 && (config.getMode().equals(ObjectPlaceMode.PAINT)) && !B.isVineBlock(data)) {
|
||||
yy = (int) Math.round(i.getY()) + Math.floorDiv(h, 2) + placer.getHighest(xx, zz, getLoader(), config.isUnderwater());
|
||||
}
|
||||
|
||||
@@ -799,10 +801,20 @@ public class IrisObject extends IrisRegistrant {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(config.isWaterloggable() && yy <= placer.getFluidHeight() && data instanceof Waterlogged) {
|
||||
if((config.isWaterloggable() || config.isUnderwater()) && yy <= placer.getFluidHeight() && data instanceof Waterlogged) {
|
||||
((Waterlogged) data).setWaterlogged(true);
|
||||
}
|
||||
|
||||
if(B.isVineBlock(data)) {
|
||||
MultipleFacing f = (MultipleFacing)data;
|
||||
for(BlockFace face : f.getAllowedFaces()) {
|
||||
BlockData facingBlock = placer.get(xx + face.getModX(), yy + face.getModY(), zz + face.getModZ());
|
||||
if(B.isSolid(facingBlock) && !B.isVineBlock(facingBlock)) {
|
||||
f.setFace(face, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(listener != null) {
|
||||
listener.accept(new BlockPosition(xx, yy, zz));
|
||||
}
|
||||
@@ -811,7 +823,9 @@ public class IrisObject extends IrisRegistrant {
|
||||
placer.getEngine().getMantle().getMantle().set(xx, yy, zz, new MatterMarker(markers.get(g)));
|
||||
}
|
||||
|
||||
if(!data.getMaterial().equals(Material.AIR) && !data.getMaterial().equals(Material.CAVE_AIR)) {
|
||||
boolean wouldReplace = B.isSolid(placer.get(xx, yy, zz)) && B.isVineBlock(data);
|
||||
|
||||
if(!data.getMaterial().equals(Material.AIR) && !data.getMaterial().equals(Material.CAVE_AIR) && !wouldReplace) {
|
||||
placer.set(xx, yy, zz, data);
|
||||
if(tile != null) {
|
||||
placer.setTile(xx, yy, zz, tile);
|
||||
@@ -849,6 +863,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
BlockVector i = g.clone();
|
||||
i = config.getRotation().rotate(i.clone(), spinx, spiny, spinz).clone();
|
||||
i = config.getTranslate().translate(i.clone(), config.getRotation(), spinx, spiny, spinz).clone();
|
||||
d = config.getRotation().rotate(d, spinx, spiny, spinz);
|
||||
|
||||
if(i.getBlockY() != lowest)
|
||||
continue;
|
||||
@@ -882,7 +897,7 @@ public class IrisObject extends IrisRegistrant {
|
||||
|
||||
int highest = placer.getHighest(xx, zz, getLoader(), true);
|
||||
|
||||
if(config.isWaterloggable() && highest <= placer.getFluidHeight() && d instanceof Waterlogged)
|
||||
if((config.isWaterloggable() || config.isUnderwater()) && highest <= placer.getFluidHeight() && d instanceof Waterlogged)
|
||||
((Waterlogged) d).setWaterlogged(true);
|
||||
|
||||
if(yv >= 0 && config.isBottom())
|
||||
@@ -894,8 +909,19 @@ public class IrisObject extends IrisRegistrant {
|
||||
if(settings.getYMax() != 0)
|
||||
lowerBound -= Math.min(config.getStiltSettings().getYMax() - (lowest + y - highest), 0);
|
||||
}
|
||||
for(int j = lowest + y; j > lowerBound; j--)
|
||||
for(int j = lowest + y; j > lowerBound; j--) {
|
||||
if(B.isVineBlock(d)) {
|
||||
MultipleFacing f = (MultipleFacing)d;
|
||||
for(BlockFace face : f.getAllowedFaces()) {
|
||||
BlockData facingBlock = placer.get(xx + face.getModX(), j + face.getModY(), zz + face.getModZ());
|
||||
if(B.isSolid(facingBlock) && !B.isVineBlock(facingBlock)) {
|
||||
f.setFace(face, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
placer.set(xx, j, zz, d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
readLock.unlock();
|
||||
|
||||
@@ -81,12 +81,14 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
private Engine engine;
|
||||
private Looper hotloader;
|
||||
private StudioMode lastMode;
|
||||
private DummyBiomeProvider dummyBiomeProvider;
|
||||
@Setter
|
||||
private StudioGenerator studioGenerator;
|
||||
|
||||
public BukkitChunkGenerator(IrisWorld world, boolean studio, File dataLocation, String dimensionKey) {
|
||||
setup = new AtomicBoolean(false);
|
||||
studioGenerator = null;
|
||||
dummyBiomeProvider = new DummyBiomeProvider();
|
||||
populators = new KList<>();
|
||||
loadLock = new Semaphore(LOAD_LOCKS);
|
||||
this.world = world;
|
||||
@@ -368,6 +370,6 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
@Nullable
|
||||
@Override
|
||||
public BiomeProvider getDefaultBiomeProvider(@NotNull WorldInfo worldInfo) {
|
||||
return null;
|
||||
return dummyBiomeProvider;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.volmit.iris.engine.platform;
|
||||
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BiomeProvider;
|
||||
import org.bukkit.generator.WorldInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DummyBiomeProvider extends BiomeProvider {
|
||||
private final List<Biome> ALL = new KList<>(Biome.values()).qdel(Biome.CUSTOM);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z) {
|
||||
return Biome.PLAINS;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Biome> getBiomes(@NotNull WorldInfo worldInfo) {
|
||||
return ALL;
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,10 @@ public class B {
|
||||
STONE_BUTTON,
|
||||
WARPED_BUTTON,
|
||||
TORCH,
|
||||
SOUL_TORCH
|
||||
SOUL_TORCH,
|
||||
GLOW_LICHEN,
|
||||
VINE,
|
||||
SCULK_VEIN
|
||||
}).forEach((i) -> b.add(i.ordinal()));
|
||||
b.addAll(foliageCache);
|
||||
|
||||
@@ -402,6 +405,8 @@ public class B {
|
||||
}
|
||||
|
||||
public static boolean isSolid(BlockData mat) {
|
||||
if(mat == null)
|
||||
return false;
|
||||
return mat.getMaterial().isSolid();
|
||||
}
|
||||
|
||||
@@ -672,4 +677,11 @@ public class B {
|
||||
public static void registerCustomBlockData(String namespace, String key, BlockData blockData) {
|
||||
custom.put(namespace + ":" + key, blockData);
|
||||
}
|
||||
|
||||
public static boolean isVineBlock(BlockData data) {
|
||||
return switch(data.getMaterial()) {
|
||||
case VINE, SCULK_VEIN, GLOW_LICHEN -> true;
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ public class BiomeGridHunkView implements Hunk<Biome> {
|
||||
if(y > highest)
|
||||
{
|
||||
highest = y;
|
||||
Iris.info("Highest = " + highest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,4 +75,14 @@ public class Spiraler {
|
||||
z += dz;
|
||||
i++;
|
||||
}
|
||||
|
||||
public int count() {
|
||||
int c = 0;
|
||||
while(hasNext()) {
|
||||
next();
|
||||
c++;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ package com.volmit.iris.util.stream;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.data.cache.Cache;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.IRare;
|
||||
import com.volmit.iris.engine.object.IrisStyledRange;
|
||||
@@ -531,6 +532,21 @@ public interface ProceduralStream<T> extends ProceduralLayer, Interpolated<T> {
|
||||
|
||||
ProceduralStream<?> getSource();
|
||||
|
||||
default void fillChunk(int x, int z, T[] c) {
|
||||
if(c.length != 256) {
|
||||
throw new RuntimeException("Not 256 Length for chunk get");
|
||||
}
|
||||
|
||||
int xs = x << 4;
|
||||
int zs = z << 4;
|
||||
|
||||
for(int i = 0; i < 16; i++) {
|
||||
for(int j = 0; j < 16; j++) {
|
||||
c[Cache.to1D(i+xs, j+zs, 0, 16, 16)] = get(i+xs, j+zs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
T get(double x, double z);
|
||||
|
||||
T get(double x, double y, double z);
|
||||
|
||||
@@ -2,7 +2,7 @@ name: ${name}
|
||||
version: ${version}
|
||||
main: ${main}
|
||||
load: STARTUP
|
||||
authors: [ cyberpwn, NextdoorPsycho ]
|
||||
authors: [ cyberpwn, NextdoorPsycho. Vatuu ]
|
||||
website: volmit.com
|
||||
description: More than a Dimension!
|
||||
libraries:
|
||||
@@ -19,7 +19,7 @@ libraries:
|
||||
- bsf:bsf:2.4.0
|
||||
commands:
|
||||
iris:
|
||||
aliases: [ ir, irs ]
|
||||
aliases: [ ir, irs]
|
||||
api-version: ${apiversion}
|
||||
hotload-dependencies: false
|
||||
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller", "WorldEdit"]
|
||||
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller", "WorldEdit", "PlaceholderAPI"]
|
||||
Reference in New Issue
Block a user