9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-19 15:09:18 +00:00

Compare commits

...

16 Commits

Author SHA1 Message Date
Brian Fopiano
1cb2ea6c17 Merge pull request #829 from VolmitSoftware/Development
Development
2022-07-16 15:46:30 -07:00
Vatuu
b82edfe688 V+ 2022-07-16 02:55:59 +02:00
Vatuu
6b32eb3441 Added convenience command. 2022-07-16 02:52:06 +02:00
Vatuu
23a07fa8a5 Fixed vines and glow lichen not generating properly. 2022-07-16 02:41:03 +02:00
Vatuu
b019faedd2 Made the creator not error without a sender. 2022-07-15 20:02:26 +02:00
Brian Fopiano
f52cd29e7b Merge pull request #821 from VolmitSoftware/Development
Development
2022-07-07 14:23:57 -07:00
Vatuu
6a44e593a6 V+ 2022-07-07 23:04:32 +02:00
Vatuu
f7065fe034 Datenpackete werden nun in allen registrierten Welten generiert. 2022-07-07 22:54:54 +02:00
Vatuu
0a247956f7 Fixed colour and printout. 2022-07-07 22:28:59 +02:00
DanMB
03836acded ffff 2022-07-07 13:12:59 -07:00
Brian Fopiano
b5fb277982 Merge pull request #819 from VolmitSoftware/Development
Development update 2.2.2
2022-07-01 16:11:20 -07:00
Vatuu
e523d3c166 V+ 2022-07-02 01:04:39 +02:00
Vatuu
41477e4aa6 Made the overworld use releases instead. (Hack) 2022-07-02 01:03:18 +02:00
Vatuu
fbaf42a8c4 Merge remote-tracking branch 'origin/Development' into Development 2022-07-01 21:00:17 +02:00
Vatuu
1c3668047b Fixed PlaceholderAPI issues. 2022-07-01 20:59:54 +02:00
Vatuu
7d78c69b6e /iris create now registers to bukkit.yml 2022-07-01 18:40:13 +02:00
12 changed files with 117 additions and 91 deletions

View File

@@ -24,7 +24,7 @@ plugins {
id "de.undercouch.download" version "5.0.1"
}
version '2.2.1-1.19' // Needs to be version specific
version '2.2.4-1.19' // Needs to be version specific
def nmsVersion = "1.19"
def apiVersion = '1.19'
def spigotJarVersion = '1.19-R0.1-SNAPSHOT'

View File

@@ -85,7 +85,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;

View File

@@ -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()) {

View File

@@ -45,7 +45,7 @@ import java.io.File;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@Decree(name = "iris", aliases = {"ir", "irs"}, description = "Basic Command")
@Decree(name = "iris", aliases = {"ir", "irs", "i"}, description = "Basic Command")
public class CommandIris implements DecreeExecutor {
private CommandStudio studio;
private CommandPregen pregen;
@@ -107,6 +107,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.")
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 +176,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)

View File

@@ -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());
}
}

View File

@@ -344,44 +344,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;

View File

@@ -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();

View File

@@ -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,24 @@ 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();
}
}
}
}

View File

@@ -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();

View File

@@ -28,6 +28,7 @@ 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 +40,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 +98,25 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
}
}
}
private BlockData fixFaces(BlockData b, int x, int y, int z) {
Material mat = b.getMaterial();
if(mat == Material.VINE || mat == Material.GLOW_LICHEN) {
MultipleFacing data = (MultipleFacing)b.clone();
boolean found = false;
for(BlockFace f : BlockFace.values()) {
if(!f.isCartesian())
continue;
Material m = getEngine().getMantle().get(x, y, z).getMaterial();
if(m.isSolid()) {
found = true;
data.setFace(f, m.isSolid());
}
}
if(!found)
data.setFace(BlockFace.UP, true);
return data;
}
return b;
}
}

View File

@@ -199,7 +199,9 @@ public class B {
STONE_BUTTON,
WARPED_BUTTON,
TORCH,
SOUL_TORCH
SOUL_TORCH,
GLOW_LICHEN,
VINE
}).forEach((i) -> b.add(i.ordinal()));
b.addAll(foliageCache);

View File

@@ -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, i ]
api-version: ${apiversion}
hotload-dependencies: false
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller", "WorldEdit"]
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller", "WorldEdit", "PlaceholderAPI"]