mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
commit
9345828c97
@ -24,6 +24,7 @@ import com.volmit.iris.util.io.IO;
|
||||
import com.volmit.iris.util.json.JSONException;
|
||||
import com.volmit.iris.util.json.JSONObject;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -24,6 +24,7 @@ import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisBiomeCustom;
|
||||
import com.volmit.iris.engine.object.IrisDimension;
|
||||
import com.volmit.iris.engine.object.IrisRange;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KSet;
|
||||
import com.volmit.iris.util.format.C;
|
||||
@ -94,6 +95,29 @@ public class ServerConfigurator {
|
||||
public static void installDataPacks(boolean fullInstall) {
|
||||
Iris.info("Checking Data Packs...");
|
||||
File packs = new File("plugins/Iris/packs");
|
||||
double ultimateMaxHeight = 0;
|
||||
double ultimateMinHeight = 0;
|
||||
if (packs.exists() && packs.isDirectory()) {
|
||||
for (File pack : packs.listFiles()) {
|
||||
IrisData data = IrisData.get(pack);
|
||||
if (pack.isDirectory()) {
|
||||
File dimensionsFolder = new File(pack, "dimensions");
|
||||
if (dimensionsFolder.exists() && dimensionsFolder.isDirectory()) {
|
||||
for (File file : dimensionsFolder.listFiles()) {
|
||||
if (file.isFile() && file.getName().endsWith(".json")) {
|
||||
IrisDimension dim = data.getDimensionLoader().load(file.getName().split("\\Q.\\E")[0]);
|
||||
if (ultimateMaxHeight < dim.getDimensionHeight().getMax()) {
|
||||
ultimateMaxHeight = dim.getDimensionHeight().getMax();
|
||||
}
|
||||
if (ultimateMinHeight > dim.getDimensionHeight().getMin()) {
|
||||
ultimateMinHeight = dim.getDimensionHeight().getMin();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (packs.exists()) {
|
||||
for (File i : packs.listFiles()) {
|
||||
@ -113,7 +137,7 @@ public class ServerConfigurator {
|
||||
|
||||
Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath());
|
||||
for (File dpack : getDatapacksFolder()) {
|
||||
dim.installDataPack(() -> data, dpack);
|
||||
dim.installDataPack(() -> data, dpack, ultimateMaxHeight, ultimateMinHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.Console;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
@ -59,6 +60,7 @@ import static com.volmit.iris.core.service.EditSVC.deletingWorld;
|
||||
import static com.volmit.iris.core.tools.IrisBenchmarking.inProgress;
|
||||
import static com.volmit.iris.core.safeguard.IrisSafeguard.unstablemode;
|
||||
import static com.volmit.iris.core.safeguard.ServerBootSFG.incompatibilities;
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
@Decree(name = "iris", aliases = {"ir", "irs"}, description = "Basic Command")
|
||||
public class CommandIris implements DecreeExecutor {
|
||||
@ -184,7 +186,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
}
|
||||
|
||||
/*
|
||||
/todo Fix PREGEN
|
||||
/todo
|
||||
@Decree(description = "Benchmark a pack", origin = DecreeOrigin.CONSOLE)
|
||||
public void packbenchmark(
|
||||
@Param(description = "Dimension to benchmark")
|
||||
@ -196,28 +198,16 @@ public class CommandIris implements DecreeExecutor {
|
||||
IrisPackBenchmarking.runBenchmark();
|
||||
} */
|
||||
|
||||
/* /todo Different approach this feels useless atm
|
||||
@Decree(description = "Check for instabilities", origin = DecreeOrigin.CONSOLE)
|
||||
public void fixunstable() throws InterruptedException {
|
||||
if (unstablemode){
|
||||
sender().sendMessage(C.RED + "Incompatibilities are posted in console..");
|
||||
|
||||
Iris.info(C.RED + "Your server is experiencing an incompatibility with the Iris plugin.");
|
||||
Iris.info(C.RED + "Please rectify this problem to avoid further complications.");
|
||||
Iris.info(C.RED + "----------------------------------------------------------------");
|
||||
Iris.info(C.RED + "Command ran: /iris fixunstable");
|
||||
UtilsSFG.printIncompatibleWarnings();
|
||||
Iris.info(C.RED + "----------------------------------------------------------------");
|
||||
} else {
|
||||
Iris.info(C.BLUE + "Iris is running stable..");
|
||||
sender().sendMessage("Iris is running stable..");
|
||||
}
|
||||
} */
|
||||
|
||||
@Decree(description = "Print world height information", origin = DecreeOrigin.PLAYER)
|
||||
public void height() {
|
||||
sender().sendMessage(C.GREEN + "" + sender().player().getWorld().getMinHeight() + " to " + sender().player().getWorld().getMaxHeight());
|
||||
sender().sendMessage(C.GREEN + "Total Height: " + (sender().player().getWorld().getMaxHeight() - sender().player().getWorld().getMinHeight()));
|
||||
if (sender().isPlayer()) {
|
||||
sender().sendMessage(C.GREEN + "" + sender().player().getWorld().getMinHeight() + " to " + sender().player().getWorld().getMaxHeight());
|
||||
sender().sendMessage(C.GREEN + "Total Height: " + (sender().player().getWorld().getMaxHeight() - sender().player().getWorld().getMinHeight()));
|
||||
} else {
|
||||
World mainWorld = getServer().getWorlds().get(0);
|
||||
Iris.info(C.GREEN + "" + mainWorld.getMinHeight() + " to " + mainWorld.getMaxHeight());
|
||||
Iris.info(C.GREEN + "Total Height: " + (mainWorld.getMaxHeight() - mainWorld.getMinHeight()));
|
||||
}
|
||||
}
|
||||
|
||||
@Decree(description = "QOL command to open a overworld studio world.", sync = true)
|
||||
@ -234,7 +224,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
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()));
|
||||
sender().sendMessage(C.RED + "This is not an Iris world. Iris worlds: " + String.join(", ", getServer().getWorlds().stream().filter(IrisToolbelt::isIrisWorld).map(World::getName).toList()));
|
||||
return;
|
||||
}
|
||||
sender().sendMessage(C.GREEN + "Removing world: " + world.getName());
|
||||
@ -417,7 +407,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
World world
|
||||
) {
|
||||
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()));
|
||||
sender().sendMessage(C.RED + "This is not an Iris world. Iris worlds: " + String.join(", ", getServer().getWorlds().stream().filter(IrisToolbelt::isIrisWorld).map(World::getName).toList()));
|
||||
return;
|
||||
}
|
||||
sender().sendMessage(C.GREEN + "Unloading world: " + world.getName());
|
||||
@ -492,7 +482,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
World world
|
||||
) {
|
||||
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()));
|
||||
sender().sendMessage(C.RED + "This is not an Iris world. Iris worlds: " + String.join(", ", getServer().getWorlds().stream().filter(IrisToolbelt::isIrisWorld).map(World::getName).toList()));
|
||||
return;
|
||||
}
|
||||
sender().sendMessage(C.GREEN + "Evacuating world" + world.getName());
|
||||
|
@ -28,7 +28,6 @@ import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.matter.slices.JigsawPieceMatter;
|
||||
import com.volmit.iris.util.matter.slices.container.JigsawPieceContainer;
|
||||
import lombok.Data;
|
||||
import org.bukkit.Axis;
|
||||
@ -75,7 +74,7 @@ public class PlannedStructure {
|
||||
}
|
||||
}
|
||||
|
||||
public void place(MantleWriter placer, Mantle e, Engine eng) {
|
||||
public void place(IObjectPlacer placer, Mantle e, Engine eng) {
|
||||
IrisObjectPlacement options = new IrisObjectPlacement();
|
||||
options.getRotation().setEnabled(false);
|
||||
int startHeight = pieces.get(0).getPosition().getY();
|
||||
@ -85,7 +84,7 @@ public class PlannedStructure {
|
||||
}
|
||||
}
|
||||
|
||||
public void place(PlannedPiece i, int startHeight, IrisObjectPlacement o, MantleWriter placer, Mantle e, Engine eng) {
|
||||
public void place(PlannedPiece i, int startHeight, IrisObjectPlacement o, IObjectPlacer placer, Mantle e, Engine eng) {
|
||||
IrisObjectPlacement options = o;
|
||||
|
||||
if (i.getPiece().getPlacementOptions() != null) {
|
||||
@ -123,69 +122,10 @@ public class PlannedStructure {
|
||||
|
||||
int id = rng.i(0, Integer.MAX_VALUE);
|
||||
JigsawPieceContainer container = JigsawPieceContainer.toContainer(i.getPiece());
|
||||
vo.place(xx, height, zz, new IObjectPlacer() {
|
||||
@Override
|
||||
public int getHighest(int x, int z, IrisData data) {
|
||||
return placer.getHighest(x, z, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHighest(int x, int z, IrisData data, boolean ignoreFluid) {
|
||||
return placer.getHighest(x, z, data, ignoreFluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, BlockData d) {
|
||||
placer.setData(x, y, z, container);
|
||||
placer.set(x, y, z, d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData get(int x, int y, int z) {
|
||||
placer.setData(x, y, z, container);
|
||||
return placer.get(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreventingDecay() {
|
||||
return placer.isPreventingDecay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCarved(int x, int y, int z) {
|
||||
return placer.isCarved(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid(int x, int y, int z) {
|
||||
return placer.isSolid(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUnderwater(int x, int z) {
|
||||
return placer.isUnderwater(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidHeight() {
|
||||
return placer.getFluidHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDebugSmartBore() {
|
||||
return placer.isDebugSmartBore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTile(int xx, int yy, int zz, TileData<? extends TileState> tile) {
|
||||
placer.setTile(xx, yy, zz, tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Engine getEngine() {
|
||||
return placer.getEngine();
|
||||
}
|
||||
}, options, rng, (b, data) -> e.set(b.getX(), b.getY(), b.getZ(), v.getLoadKey() + "@" + id), null, getData());
|
||||
vo.place(xx, height, zz, placer, options, rng, (b, data) -> {
|
||||
e.set(b.getX(), b.getY(), b.getZ(), v.getLoadKey() + "@" + id);
|
||||
e.set(b.getX(), b.getY(), b.getZ(), container);
|
||||
}, null, getData());
|
||||
}
|
||||
|
||||
public void place(World world) {
|
||||
@ -361,10 +301,6 @@ public class PlannedStructure {
|
||||
|
||||
public boolean collidesWith(PlannedPiece piece, PlannedPiece ignore) {
|
||||
for (PlannedPiece i : pieces) {
|
||||
if (i.equals(ignore)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i.collidesWith(piece)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import com.volmit.iris.engine.mantle.EngineMantle;
|
||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||
import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.context.ChunkContext;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
@ -53,8 +54,6 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
|
||||
@ChunkCoordinates
|
||||
private void generateJigsaw(MantleWriter writer, RNG rng, int x, int z, IrisBiome biome, IrisRegion region) {
|
||||
boolean placed = false;
|
||||
|
||||
if (getDimension().getStronghold() != null) {
|
||||
List<Position2> poss = getDimension().getStrongholds(seed());
|
||||
|
||||
@ -63,43 +62,30 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
if (x == pos.getX() >> 4 && z == pos.getZ() >> 4) {
|
||||
IrisJigsawStructure structure = getData().getJigsawStructureLoader().load(getDimension().getStronghold());
|
||||
place(writer, pos.toIris(), structure, rng);
|
||||
placed = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!placed) {
|
||||
for (IrisJigsawStructurePlacement i : biome.getJigsawStructures()) {
|
||||
if (rng.nextInt(i.getRarity()) == 0) {
|
||||
IrisPosition position = new IrisPosition((x << 4) + rng.nextInt(15), 0, (z << 4) + rng.nextInt(15));
|
||||
IrisJigsawStructure structure = getData().getJigsawStructureLoader().load(i.getStructure());
|
||||
place(writer, position, structure, rng);
|
||||
placed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean placed = placeStructures(writer, rng, x, z, biome.getJigsawStructures());
|
||||
if (!placed)
|
||||
placed = placeStructures(writer, rng, x, z, region.getJigsawStructures());
|
||||
if (!placed)
|
||||
placeStructures(writer, rng, x, z, getDimension().getJigsawStructures());
|
||||
}
|
||||
|
||||
if (!placed) {
|
||||
for (IrisJigsawStructurePlacement i : region.getJigsawStructures()) {
|
||||
if (rng.nextInt(i.getRarity()) == 0) {
|
||||
IrisPosition position = new IrisPosition((x << 4) + rng.nextInt(15), 0, (z << 4) + rng.nextInt(15));
|
||||
IrisJigsawStructure structure = getData().getJigsawStructureLoader().load(i.getStructure());
|
||||
place(writer, position, structure, rng);
|
||||
placed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!placed) {
|
||||
for (IrisJigsawStructurePlacement i : getDimension().getJigsawStructures()) {
|
||||
if (rng.nextInt(i.getRarity()) == 0) {
|
||||
IrisPosition position = new IrisPosition((x << 4) + rng.nextInt(15), 0, (z << 4) + rng.nextInt(15));
|
||||
IrisJigsawStructure structure = getData().getJigsawStructureLoader().load(i.getStructure());
|
||||
place(writer, position, structure, rng);
|
||||
}
|
||||
@ChunkCoordinates
|
||||
private boolean placeStructures(MantleWriter writer, RNG rng, int x, int z, KList<IrisJigsawStructurePlacement> structures) {
|
||||
for (IrisJigsawStructurePlacement i : structures) {
|
||||
if (rng.nextInt(i.getRarity()) == 0) {
|
||||
IrisPosition position = new IrisPosition((x << 4) + rng.nextInt(15), 0, (z << 4) + rng.nextInt(15));
|
||||
IrisJigsawStructure structure = getData().getJigsawStructureLoader().load(i.getStructure());
|
||||
place(writer, position, structure, rng);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
|
@ -22,9 +22,11 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.data.DataProvider;
|
||||
import com.volmit.iris.util.data.Dimension;
|
||||
import com.volmit.iris.util.io.IO;
|
||||
import com.volmit.iris.util.json.JSONObject;
|
||||
import com.volmit.iris.util.math.Position2;
|
||||
@ -40,6 +42,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -439,7 +442,7 @@ public class IrisDimension extends IrisRegistrant {
|
||||
return landBiomeStyle;
|
||||
}
|
||||
|
||||
public boolean installDataPack(DataProvider data, File datapacks) {
|
||||
public boolean installDataPack(DataProvider data, File datapacks, double ultimateMaxHeight, double ultimateMinHeight) {
|
||||
boolean write = false;
|
||||
boolean changed = false;
|
||||
|
||||
@ -470,6 +473,8 @@ public class IrisDimension extends IrisRegistrant {
|
||||
|
||||
if (!dimensionHeight.equals(new IrisRange(-64, 320)) && this.name.equalsIgnoreCase("overworld")) {
|
||||
Iris.verbose(" Installing Data Pack Dimension Types: \"minecraft:overworld\", \"minecraft:the_nether\", \"minecraft:the_end\"");
|
||||
dimensionHeight.setMax(ultimateMaxHeight);
|
||||
dimensionHeight.setMin(ultimateMinHeight);
|
||||
changed = writeDimensionType(changed, datapacks);
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
package com.volmit.iris.util.plugin;
|
||||
|
||||
import com.volmit.iris.util.format.C;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@ -28,4 +30,5 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
@Target(FIELD)
|
||||
public @interface Command {
|
||||
String value() default "";
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user