mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-22 00:29:19 +00:00
Datapack Shenanigans
This commit is contained in:
@@ -24,7 +24,7 @@ plugins {
|
|||||||
id "de.undercouch.download" version "5.0.1"
|
id "de.undercouch.download" version "5.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
version '2.3.13-1.19.3' // Needs to be version specific
|
version '2.3.14-1.19.3' // Needs to be version specific
|
||||||
def nmsVersion = "1.19.3" //[NMS]
|
def nmsVersion = "1.19.3" //[NMS]
|
||||||
def apiVersion = '1.19'
|
def apiVersion = '1.19'
|
||||||
def specialSourceVersion = '1.11.0' //[NMS]
|
def specialSourceVersion = '1.11.0' //[NMS]
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
@SuppressWarnings("CanBeFinal")
|
@SuppressWarnings("CanBeFinal")
|
||||||
public class Iris extends VolmitPlugin implements Listener {
|
public class Iris extends VolmitPlugin implements Listener {
|
||||||
public static final String OVERWORLD_TAG = "2092";
|
public static final String OVERWORLD_TAG = "2100";
|
||||||
|
|
||||||
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
|
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
|
||||||
|
|
||||||
|
|||||||
@@ -54,20 +54,70 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
public static final BlockData WATER = Material.WATER.createBlockData();
|
public static final BlockData WATER = Material.WATER.createBlockData();
|
||||||
private static final String DP_OVERWORLD_DEFAULT = """
|
private static final String DP_OVERWORLD_DEFAULT = """
|
||||||
{
|
{
|
||||||
"ultrawarm": false,
|
"ambient_light": 0.0,
|
||||||
"natural": true,
|
|
||||||
"coordinate_scale": 1.0,
|
|
||||||
"has_skylight": true,
|
|
||||||
"has_ceiling": false,
|
|
||||||
"ambient_light": 0,
|
|
||||||
"piglin_safe": false,
|
|
||||||
"bed_works": true,
|
"bed_works": true,
|
||||||
"respawn_anchor_works": true,
|
"coordinate_scale": 1.0,
|
||||||
|
"effects": "minecraft:overworld",
|
||||||
|
"has_ceiling": false,
|
||||||
"has_raids": true,
|
"has_raids": true,
|
||||||
"monster_spawn_block_light_limit": 7,
|
"has_skylight": true,
|
||||||
"monster_spawn_light_level": 7,
|
|
||||||
"infiniburn": "#minecraft:infiniburn_overworld",
|
"infiniburn": "#minecraft:infiniburn_overworld",
|
||||||
"effects": "minecraft: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<Position2> parallaxSize = new AtomicCache<>();
|
||||||
private final transient AtomicCache<CNG> rockLayerGenerator = new AtomicCache<>();
|
private final transient AtomicCache<CNG> rockLayerGenerator = new AtomicCache<>();
|
||||||
@@ -86,6 +136,10 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
@MaxNumber(2032)
|
@MaxNumber(2032)
|
||||||
@Desc("Maximum height at which players can be teleported to through gameplay.")
|
@Desc("Maximum height at which players can be teleported to through gameplay.")
|
||||||
private int logicalHeight = 256;
|
private int logicalHeight = 256;
|
||||||
|
@Desc("Maximum height at which players can be teleported to through gameplay.")
|
||||||
|
private int logicalHeightEnd = 256;
|
||||||
|
@Desc("Maximum height at which players can be teleported to through gameplay.")
|
||||||
|
private int logicalHeightNether = 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;
|
||||||
@@ -107,12 +161,8 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
private int strongholdJumpDistance = 1280;
|
private int strongholdJumpDistance = 1280;
|
||||||
@Desc("Define the maximum strongholds to place")
|
@Desc("Define the maximum strongholds to place")
|
||||||
private int maxStrongholds = 14;
|
private int maxStrongholds = 14;
|
||||||
@Desc("Improves the biome grid variation by shuffling the cell grid more depending on the seed. This makes biomes across multiple seeds look far different than before.")
|
|
||||||
private boolean aggressiveBiomeReshuffle = false;
|
|
||||||
@Desc("Tree growth override settings")
|
@Desc("Tree growth override settings")
|
||||||
private IrisTreeSettings treeSettings = new IrisTreeSettings();
|
private IrisTreeSettings treeSettings = new IrisTreeSettings();
|
||||||
@Desc("Upon joining this world, Iris will send a resource pack request to the client. If they have previously selected yes, it will auto-switch depending on which dimension they go to.")
|
|
||||||
private String resourcePack = "";
|
|
||||||
@Desc("Spawn Entities in this dimension over time. Iris will continually replenish these mobs just like vanilla does.")
|
@Desc("Spawn Entities in this dimension over time. Iris will continually replenish these mobs just like vanilla does.")
|
||||||
@ArrayType(min = 1, type = String.class)
|
@ArrayType(min = 1, type = String.class)
|
||||||
@RegistryListResource(IrisSpawner.class)
|
@RegistryListResource(IrisSpawner.class)
|
||||||
@@ -174,6 +224,10 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
private int fluidHeight = 63;
|
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.")
|
@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);
|
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);
|
||||||
@RegistryListResource(IrisBiome.class)
|
@RegistryListResource(IrisBiome.class)
|
||||||
@Desc("Keep this either undefined or empty. Setting any biome name into this will force iris to only generate the specified biome. Great for testing.")
|
@Desc("Keep this either undefined or empty. Setting any biome name into this will force iris to only generate the specified biome. Great for testing.")
|
||||||
private String focus = "";
|
private String focus = "";
|
||||||
@@ -279,7 +333,6 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
KList<Position2> pos = new KList<>();
|
KList<Position2> pos = new KList<>();
|
||||||
int jump = strongholdJumpDistance;
|
int jump = strongholdJumpDistance;
|
||||||
RNG rng = new RNG((seed * 223) + 12945);
|
RNG rng = new RNG((seed * 223) + 12945);
|
||||||
|
|
||||||
for (int i = 0; i < maxStrongholds + 1; i++) {
|
for (int i = 0; i < maxStrongholds + 1; i++) {
|
||||||
int m = i + 1;
|
int m = i + 1;
|
||||||
pos.add(new Position2(
|
pos.add(new Position2(
|
||||||
@@ -416,7 +469,7 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!dimensionHeight.equals(new IrisRange(-64, 320)) && this.name.equalsIgnoreCase("overworld")) {
|
if (!dimensionHeight.equals(new IrisRange(-64, 320)) && this.name.equalsIgnoreCase("overworld")) {
|
||||||
Iris.verbose(" Installing Data Pack Dimension Type: \"minecraft:overworld\"");
|
Iris.verbose(" Installing Data Pack Dimension Types: \"minecraft:overworld\", \"minecraft:the_nether\", \"minecraft:the_end\"");
|
||||||
changed = writeDimensionType(changed, datapacks);
|
changed = writeDimensionType(changed, datapacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,24 +510,63 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean writeDimensionType(boolean changed, File datapacks) {
|
public boolean writeDimensionType(boolean changed, File datapacks) {
|
||||||
File dimType = new File(datapacks, "iris/data/minecraft/dimension_type/overworld.json");
|
File dimTypeOverworld = new File(datapacks, "iris/data/minecraft/dimension_type/overworld.json");
|
||||||
if (!dimType.exists())
|
if (!dimTypeOverworld.exists())
|
||||||
changed = true;
|
changed = true;
|
||||||
dimType.getParentFile().mkdirs();
|
dimTypeOverworld.getParentFile().mkdirs();
|
||||||
try {
|
try {
|
||||||
IO.writeAll(dimType, generateDatapackJson());
|
IO.writeAll(dimTypeOverworld, generateDatapackJsonOverworld());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
e.printStackTrace();
|
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;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateDatapackJson() {
|
private String generateDatapackJsonOverworld() {
|
||||||
JSONObject obj = new JSONObject(DP_OVERWORLD_DEFAULT);
|
JSONObject obj = new JSONObject(DP_OVERWORLD_DEFAULT);
|
||||||
obj.put("min_y", dimensionHeight.getMin());
|
obj.put("min_y", dimensionHeight.getMin());
|
||||||
obj.put("height", dimensionHeight.getMax() - dimensionHeight.getMin());
|
obj.put("height", dimensionHeight.getMax() - dimensionHeight.getMin());
|
||||||
obj.put("logical_height", logicalHeight);
|
obj.put("logical_height", logicalHeight);
|
||||||
return obj.toString(4);
|
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