mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +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
|
@Required
|
||||||
@Desc("The human readable name of this dimension")
|
@Desc("The human readable name of this dimension")
|
||||||
private String name = "A 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)
|
@RegistryListResource(IrisJigsawStructure.class)
|
||||||
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
|
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
|
||||||
private String stronghold;
|
private String stronghold;
|
||||||
@ -238,13 +242,11 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
private int caveLavaHeight = 8;
|
private int caveLavaHeight = 8;
|
||||||
|
|
||||||
public int getMaxHeight() {
|
public int getMaxHeight() {
|
||||||
return 320;
|
return (int) getDimensionHeight().getMax();
|
||||||
// return (int) getDimensionHeight().getMax();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinHeight() {
|
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) {
|
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) {
|
if(write) {
|
||||||
File mcm = new File(datapacks, "iris/pack.mcmeta");
|
File mcm = new File(datapacks, "iris/pack.mcmeta");
|
||||||
try {
|
try {
|
||||||
@ -434,4 +451,30 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
public void scanForErrors(JSONObject p, VolmitSender sender) {
|
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