mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Working on supporting custom heights per world.
This commit is contained in:
parent
81ce84b3f1
commit
525e3db24a
@ -70,6 +70,10 @@ public class IrisDimension extends IrisRegistrant {
|
||||
@Required
|
||||
@Desc("The human readable name of this dimension")
|
||||
private String name = "A Dimension";
|
||||
@MinNumber(1)
|
||||
@MaxNumber(2032)
|
||||
@Desc("Maximum height at which players can be teleported to through gameplay.")
|
||||
private int logicalHeight = 256;
|
||||
@RegistryListResource(IrisJigsawStructure.class)
|
||||
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
|
||||
private String stronghold;
|
||||
@ -238,13 +242,11 @@ public class IrisDimension extends IrisRegistrant {
|
||||
private int caveLavaHeight = 8;
|
||||
|
||||
public int getMaxHeight() {
|
||||
return 320;
|
||||
// return (int) getDimensionHeight().getMax();
|
||||
return (int) getDimensionHeight().getMax();
|
||||
}
|
||||
|
||||
public int getMinHeight() {
|
||||
return -64;
|
||||
// return (int) getDimensionHeight().getMin();
|
||||
return (int) getDimensionHeight().getMin();
|
||||
}
|
||||
|
||||
public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
@ -399,6 +401,21 @@ public class IrisDimension extends IrisRegistrant {
|
||||
}
|
||||
}
|
||||
|
||||
if(!dimensionHeight.equals(new IrisRange(-64, 320))) {
|
||||
File dimType = new File(datapacks, "iris/data/minecraft/dimension_type/" + getLoadKey().toLowerCase() + ".json");
|
||||
if(!dimType.exists())
|
||||
changed = true;
|
||||
|
||||
Iris.verbose(" Installing Data Pack Dimension Type: " + dimType.getPath());
|
||||
dimType.getParentFile().mkdirs();
|
||||
try {
|
||||
IO.writeAll(dimType, generateDatapackJson());
|
||||
} catch(IOException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if(write) {
|
||||
File mcm = new File(datapacks, "iris/pack.mcmeta");
|
||||
try {
|
||||
@ -434,4 +451,30 @@ public class IrisDimension extends IrisRegistrant {
|
||||
public void scanForErrors(JSONObject p, VolmitSender sender) {
|
||||
|
||||
}
|
||||
|
||||
private String generateDatapackJson() {
|
||||
JSONObject obj = new JSONObject(DP_OVERWORLD_DEFAULT);
|
||||
obj.put("min_y", dimensionHeight.getMin());
|
||||
obj.put("height", dimensionHeight.getMax() - dimensionHeight.getMin());
|
||||
obj.put("logical_height", logicalHeight);
|
||||
return obj.toString(4);
|
||||
}
|
||||
|
||||
private static final String DP_OVERWORLD_DEFAULT = """
|
||||
{
|
||||
"name": "minecraft:overworld",
|
||||
"ultrawarm": false,
|
||||
"natural": true,
|
||||
"coordinate_scale": 1.0,
|
||||
"has_skylight": true,
|
||||
"has_ceiling": false,
|
||||
"ambient_light": 0,
|
||||
"fixed_time": false,
|
||||
"piglin_safe": false,
|
||||
"bed_works": true,
|
||||
"respawn_anchor_works": false,
|
||||
"has_raids": true,
|
||||
"infiniburn": "infiniburn_overworld",
|
||||
"effects": "minecraft:overworld"
|
||||
}""";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user