Merge remote-tracking branch 'origin/master'

This commit is contained in:
cyberpwn 2021-09-22 06:28:41 -04:00
commit 32994ce4af
5 changed files with 60 additions and 19 deletions

View File

@ -39,6 +39,7 @@ 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.Chunk;
import org.bukkit.World;
import java.io.File;
import java.util.concurrent.ExecutionException;
@ -252,4 +253,40 @@ public class CommandIris implements DecreeExecutor {
sender().sendMessage(C.RED + "You must be in an Iris World to use regen!");
}
}
@Decree(description = "Update the pack of a world (UNSAFE!)", name = "^world", aliases = "update-world")
public void updateWorld(
@Param(description = "The world to update", contextual = true)
World world,
@Param(description = "The pack to install into the world", contextual = true, aliases = "dimension")
IrisDimension pack,
@Param(description = "Make sure to make a backup & read the warnings first!", defaultValue = "false", aliases = "c")
boolean confirm,
@Param(description = "Should Iris download the pack again for you", defaultValue = "false", name = "fresh-download", aliases = {"fresh", "new"})
boolean freshDownload
) {
if (!confirm) {
sender().sendMessage(new String[]{
C.RED + "You should always make a backup before using this",
C.YELLOW + "Issues caused by this can be, but are not limited to:",
C.YELLOW + " - Broken chunks (cut-offs) between old and new chunks (before & after the update)",
C.YELLOW + " - Regenerated chunks that do not fit in with the old chunks",
C.YELLOW + " - Structures not spawning again when regenerating",
C.YELLOW + " - Caves not lining up",
C.YELLOW + " - Terrain layers not lining up",
C.RED + "Now that you are aware of the risks, and have made a back-up:",
C.RED + "/iris ^world <world> <pack> confirm=true"
});
return;
}
File folder = world.getWorldFolder();
folder.mkdirs();
if (freshDownload) {
Iris.service(StudioSVC.class).downloadSearch(sender(), pack.getLoadKey(), false, true);
}
Iris.service(StudioSVC.class).installIntoWorld(sender(), pack.getLoadKey(), folder);
}
}

View File

@ -658,7 +658,7 @@ public class CommandStudio implements DecreeExecutor {
player().setGameMode(GameMode.SPECTATOR);
}
@Decree(description = "Update your dimension project")
@Decree(description = "Update your dimension projects VSCode workspace")
public void update(
@Param(description = "The dimension to update the workspace of", contextual = true, defaultValue = "overworld")
IrisDimension dimension

View File

@ -525,9 +525,9 @@ public class IrisProject {
public void compile(VolmitSender sender) {
IrisData data = IrisData.get(getPath());
KList<Job> jobs = new KList<Job>();
KList<File> files = new KList<File>();
KList<File> objects = new KList<File>();
KList<Job> jobs = new KList<>();
KList<File> files = new KList<>();
KList<File> objects = new KList<>();
files(getPath(), files);
filesObjects(getPath(), objects);

View File

@ -87,7 +87,7 @@ public class MantleObjectComponent extends IrisMantleComponent {
@BlockCoordinates
private void placeObject(MantleWriter writer, RNG rng, int x, int z, IrisObjectPlacement objectPlacement) {
for (int i = 0; i < objectPlacement.getDensity(); i++) {
for (int i = 0; i < objectPlacement.getDensity(rng, x, z, getData()); i++) {
IrisObject v = objectPlacement.getScale().get(rng, objectPlacement.getObject(getComplex(), rng));
if (v == null) {
return;
@ -104,7 +104,7 @@ public class MantleObjectComponent extends IrisMantleComponent {
@BlockCoordinates
private Set<String> guessPlacedKeys(RNG rng, int x, int z, IrisObjectPlacement objectPlacement) {
Set<String> f = new KSet<>();
for (int i = 0; i < objectPlacement.getDensity(); i++) {
for (int i = 0; i < objectPlacement.getDensity(rng, x, z, getData()); i++) {
IrisObject v = objectPlacement.getScale().get(rng, objectPlacement.getObject(getComplex(), rng));
if (v == null) {
continue;

View File

@ -62,7 +62,6 @@ public class IrisObjectPlacement {
private IrisObjectRotation rotation = new IrisObjectRotation();
@Desc("Limit the max height or min height of placement.")
private IrisObjectLimit clamp = new IrisObjectLimit();
@MinNumber(0)
@MaxNumber(1)
@Desc("The maximum layer level of a snow filter overtop of this placement. Set to 0 to disable. Max of 1.")
@ -74,6 +73,8 @@ public class IrisObjectPlacement {
@MinNumber(1)
@Desc("If the chance check passes, place this many in a single chunk")
private int density = 1;
@Desc("If the chance check passes, and you specify this, it picks a number in the range based on noise, and 'density' is ignored.")
private IrisStyledRange densityStyle = null;
@MaxNumber(64)
@MinNumber(0)
@Desc("If the place mode is set to stilt, you can over-stilt it even further into the ground. Especially useful when using fast stilt due to inaccuracies.")
@ -164,18 +165,6 @@ public class IrisObjectPlacement {
return getSurfaceWarp(rng, data).fitDouble(-(getWarp().getMultiplier() / 2D), (getWarp().getMultiplier() / 2D), x, y, z);
}
public int getTriesForChunk(RNG random) {
if (chance <= 0) {
return 0;
}
if (chance >= 1 || random.nextDouble() < chance) {
return density;
}
return 0;
}
public IrisObject getObject(DataProvider g, RNG random) {
if (place.isEmpty()) {
return null;
@ -194,6 +183,21 @@ public class IrisObjectPlacement {
return false;
}
public int getDensity() {
if (densityStyle == null) {
return density;
}
return densityStyle.getMid();
}
public int getDensity(RNG rng, double x, double z, IrisData data) {
if (densityStyle == null) {
return density;
}
return (int) Math.round(densityStyle.get(rng, x, z, data));
}
private TableCache getCache(IrisData manager) {
return cache.aquire(() -> {
TableCache tc = new TableCache();