mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-29 20:19:06 +00:00
remove unnecessary minecraft dimension height calculations
This commit is contained in:
@@ -135,30 +135,6 @@ 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()) {
|
||||
if (i.isDirectory()) {
|
||||
@@ -177,7 +153,7 @@ public class ServerConfigurator {
|
||||
|
||||
Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath());
|
||||
for (File dpack : getDatapacksFolder()) {
|
||||
dim.installDataPack(() -> data, dpack, ultimateMaxHeight, ultimateMinHeight);
|
||||
dim.installDataPack(() -> data, dpack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,73 +56,6 @@ import java.io.IOException;
|
||||
public class IrisDimension extends IrisRegistrant {
|
||||
public static final BlockData STONE = Material.STONE.createBlockData();
|
||||
public static final BlockData WATER = Material.WATER.createBlockData();
|
||||
private static final String DP_OVERWORLD_DEFAULT = """
|
||||
{
|
||||
"ambient_light": 0.0,
|
||||
"bed_works": true,
|
||||
"coordinate_scale": 1.0,
|
||||
"effects": "minecraft:overworld",
|
||||
"has_ceiling": false,
|
||||
"has_raids": true,
|
||||
"has_skylight": true,
|
||||
"infiniburn": "#minecraft:infiniburn_overworld",
|
||||
"monster_spawn_block_light_limit": 0,
|
||||
"monster_spawn_light_level": {
|
||||
"type": "minecraft:uniform",
|
||||
"value": {
|
||||
"max_inclusive": 7,
|
||||
"min_inclusive": 0
|
||||
}
|
||||
},
|
||||
"natural": true,
|
||||
"piglin_safe": false,
|
||||
"respawn_anchor_works": false,
|
||||
"ultrawarm": false
|
||||
}""";
|
||||
|
||||
private static final String DP_NETHER_DEFAULT = """
|
||||
{
|
||||
"ambient_light": 0.1,
|
||||
"bed_works": false,
|
||||
"coordinate_scale": 8.0,
|
||||
"effects": "minecraft:the_nether",
|
||||
"fixed_time": 18000,
|
||||
"has_ceiling": true,
|
||||
"has_raids": false,
|
||||
"has_skylight": false,
|
||||
"infiniburn": "#minecraft:infiniburn_nether",
|
||||
"monster_spawn_block_light_limit": 15,
|
||||
"monster_spawn_light_level": 7,
|
||||
"natural": false,
|
||||
"piglin_safe": true,
|
||||
"respawn_anchor_works": true,
|
||||
"ultrawarm": true
|
||||
}""";
|
||||
|
||||
private static final String DP_END_DEFAULT = """
|
||||
{
|
||||
"ambient_light": 0.0,
|
||||
"bed_works": false,
|
||||
"coordinate_scale": 1.0,
|
||||
"effects": "minecraft:the_end",
|
||||
"fixed_time": 6000,
|
||||
"has_ceiling": false,
|
||||
"has_raids": true,
|
||||
"has_skylight": false,
|
||||
"infiniburn": "#minecraft:infiniburn_end",
|
||||
"monster_spawn_block_light_limit": 0,
|
||||
"monster_spawn_light_level": {
|
||||
"type": "minecraft:uniform",
|
||||
"value": {
|
||||
"max_inclusive": 7,
|
||||
"min_inclusive": 0
|
||||
}
|
||||
},
|
||||
"natural": false,
|
||||
"piglin_safe": false,
|
||||
"respawn_anchor_works": false,
|
||||
"ultrawarm": false
|
||||
}""";
|
||||
private final transient AtomicCache<Position2> parallaxSize = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> rockLayerGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> fluidLayerGenerator = new AtomicCache<>();
|
||||
@@ -230,10 +163,6 @@ public class IrisDimension extends IrisRegistrant {
|
||||
private int fluidHeight = 63;
|
||||
@Desc("Define the min and max Y bounds of this dimension. Please keep in mind that Iris internally generates from 0 to (max - min). \n\nFor example at -64 to 320, Iris is internally generating to 0 to 384, then on outputting chunks, it shifts it down by the min height (64 blocks). The default is -64 to 320. \n\nThe fluid height is placed at (fluid height + min height). So a fluid height of 63 would actually show up in the world at 1.")
|
||||
private IrisRange dimensionHeight = new IrisRange(-64, 320);
|
||||
@Desc("Define the min and max Y bounds of this dimension. Please keep in mind that Iris internally generates from 0 to (max - min). \n\nFor example at -64 to 320, Iris is internally generating to 0 to 384, then on outputting chunks, it shifts it down by the min height (64 blocks). The default is -64 to 320. \n\nThe fluid height is placed at (fluid height + min height). So a fluid height of 63 would actually show up in the world at 1.")
|
||||
private IrisRange dimensionHeightEnd = new IrisRange(-64, 320);
|
||||
@Desc("Define the min and max Y bounds of this dimension. Please keep in mind that Iris internally generates from 0 to (max - min). \n\nFor example at -64 to 320, Iris is internally generating to 0 to 384, then on outputting chunks, it shifts it down by the min height (64 blocks). The default is -64 to 320. \n\nThe fluid height is placed at (fluid height + min height). So a fluid height of 63 would actually show up in the world at 1.")
|
||||
private IrisRange dimensionHeightNether = new IrisRange(-64, 320);
|
||||
@Desc("Enable smart vanilla height")
|
||||
private boolean smartVanillaHeight = false;
|
||||
@RegistryListResource(IrisBiome.class)
|
||||
@@ -376,6 +305,10 @@ public class IrisDimension extends IrisRegistrant {
|
||||
return environment;
|
||||
}
|
||||
|
||||
public IrisRange getDimensionHeight() {
|
||||
return smartVanillaHeight ? new IrisRange(-64, 320) : dimensionHeight;
|
||||
}
|
||||
|
||||
public boolean hasFocusRegion() {
|
||||
return !focusRegion.equals("");
|
||||
}
|
||||
@@ -447,7 +380,7 @@ public class IrisDimension extends IrisRegistrant {
|
||||
return landBiomeStyle;
|
||||
}
|
||||
|
||||
public boolean installDataPack(DataProvider data, File datapacks, double ultimateMaxHeight, double ultimateMinHeight) {
|
||||
public boolean installDataPack(DataProvider data, File datapacks) {
|
||||
boolean write = false;
|
||||
boolean changed = false;
|
||||
|
||||
@@ -476,13 +409,6 @@ 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);
|
||||
}
|
||||
|
||||
if (write) {
|
||||
File mcm = new File(datapacks, "iris/pack.mcmeta");
|
||||
try {
|
||||
@@ -518,67 +444,4 @@ public class IrisDimension extends IrisRegistrant {
|
||||
public void scanForErrors(JSONObject p, VolmitSender sender) {
|
||||
|
||||
}
|
||||
|
||||
public boolean writeDimensionType(boolean changed, File datapacks) {
|
||||
File dimTypeOverworld = new File(datapacks, "iris/data/minecraft/dimension_type/overworld.json");
|
||||
if (!dimTypeOverworld.exists())
|
||||
changed = true;
|
||||
dimTypeOverworld.getParentFile().mkdirs();
|
||||
try {
|
||||
IO.writeAll(dimTypeOverworld, generateDatapackJsonOverworld());
|
||||
} catch (IOException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
File dimTypeNether = new File(datapacks, "iris/data/minecraft/dimension_type/the_nether.json");
|
||||
if (!dimTypeNether.exists())
|
||||
changed = true;
|
||||
dimTypeNether.getParentFile().mkdirs();
|
||||
try {
|
||||
IO.writeAll(dimTypeNether, generateDatapackJsonNether());
|
||||
} catch (IOException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
File dimTypeEnd = new File(datapacks, "iris/data/minecraft/dimension_type/the_end.json");
|
||||
if (!dimTypeEnd.exists())
|
||||
changed = true;
|
||||
dimTypeEnd.getParentFile().mkdirs();
|
||||
try {
|
||||
IO.writeAll(dimTypeEnd, generateDatapackJsonEnd());
|
||||
} catch (IOException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
private String generateDatapackJsonOverworld() {
|
||||
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 String generateDatapackJsonNether() {
|
||||
JSONObject obj = new JSONObject(DP_NETHER_DEFAULT);
|
||||
obj.put("min_y", dimensionHeightNether.getMin());
|
||||
obj.put("height", dimensionHeightNether.getMax() - dimensionHeightNether.getMin());
|
||||
obj.put("logical_height", logicalHeightNether);
|
||||
return obj.toString(4);
|
||||
}
|
||||
|
||||
private String generateDatapackJsonEnd() {
|
||||
JSONObject obj = new JSONObject(DP_END_DEFAULT);
|
||||
obj.put("min_y", dimensionHeightEnd.getMin());
|
||||
obj.put("height", dimensionHeightEnd.getMax() - dimensionHeightEnd.getMin());
|
||||
obj.put("logical_height", logicalHeightEnd);
|
||||
return obj.toString(4);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user