tangled
alpha
login
or
join now
codexarchonic.nekoweb.org
/
ProjectInfinity
0
fork
atom
Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.
0
fork
atom
overview
issues
6
pulls
pipelines
support for preexisting dims
Lera
7 months ago
1e4affb1
32ae3482
+21
-14
3 changed files
expand all
collapse all
unified
split
common
src
main
java
net
lerariemann
infinity
util
InfinityMethods.java
core
Easterizer.java
resources
config
easter
the_end.json
+2
-4
common/src/main/java/net/lerariemann/infinity/util/InfinityMethods.java
···
123
123
* This also checks if it matches an Easter Egg dimension.
124
124
*/
125
125
static Identifier dimTextToId(String text) {
126
126
-
if (text.equals("abatised redivides"))
127
127
-
return World.END.getValue();
128
128
-
String easterId = InfinityMod.provider.easterizer.getAsEaster(text);
126
126
+
Identifier easterId = InfinityMod.provider.easterizer.getAsEaster(text);
129
127
if (easterId != null)
130
130
-
return InfinityMethods.getId(easterId);
128
128
+
return easterId;
131
129
return InfinityMethods.getDimId(getDimensionSeed(text));
132
130
}
133
131
+14
-10
common/src/main/java/net/lerariemann/infinity/util/core/Easterizer.java
···
2
2
3
3
import net.lerariemann.infinity.InfinityMod;
4
4
import net.lerariemann.infinity.dimensions.RandomDimension;
5
5
+
import net.lerariemann.infinity.util.InfinityMethods;
5
6
import net.minecraft.nbt.NbtCompound;
6
7
import net.minecraft.nbt.NbtElement;
7
8
import net.minecraft.nbt.NbtString;
9
9
+
import net.minecraft.util.Identifier;
8
10
9
11
import java.io.IOException;
10
12
import java.nio.file.Path;
···
16
18
17
19
18
20
public class Easterizer {
21
21
+
public Map<String, Identifier> destinationMap = new HashMap<>();
19
22
public Map<String, String> aliasMap = new HashMap<>();
20
23
public Map<String, NbtCompound> map = new HashMap<>();
21
24
public Map<String, String> typeMap = new HashMap<>();
···
28
31
NbtCompound compound = CommonIO.read(p.toFile());
29
32
if (compound.contains("name"))
30
33
name = NbtUtils.getString(compound, "name");
31
31
-
if (compound.contains("type"))
32
32
-
typeMap.put(name, NbtUtils.getString(compound, "type"));
33
34
if (compound.getType("aliases") == NbtElement.LIST_TYPE) {
34
35
String finalName = name;
35
36
NbtUtils.getList(compound, "aliases", NbtElement.STRING_TYPE)
···
40
41
}
41
42
else if (compound.getType("aliases") == NbtElement.STRING_TYPE)
42
43
aliasMap.put(NbtUtils.getString(compound, "aliases"), name);
43
43
-
if (compound.contains("options")) {
44
44
-
optionmap.put(name, NbtUtils.getCompound(compound, "options"));
44
44
+
if (compound.contains("destination")) destinationMap.put(name, Identifier.of(NbtUtils.getString(compound, "destination")));
45
45
+
else {
46
46
+
if (compound.contains("type"))
47
47
+
typeMap.put(name, NbtUtils.getString(compound, "type"));
48
48
+
if (compound.contains("options")) {
49
49
+
optionmap.put(name, NbtUtils.getCompound(compound, "options"));
50
50
+
}
51
51
+
map.put(name, NbtUtils.getCompound(compound, "generator"));
45
52
}
46
46
-
47
47
-
map.put(name, NbtUtils.getCompound(compound, "generator"));
48
53
});
49
54
} catch (IOException e) {
50
55
throw new RuntimeException(e);
···
65
70
return InfinityMod.provider.disabledDimensions.contains(name);
66
71
}
67
72
68
68
-
public String getAsEaster(String name) {
69
69
-
if (aliasMap.containsKey(name)) return aliasMap.get(name);
70
70
-
if (isEaster(name)) return name;
71
71
-
return null;
73
73
+
public Identifier getAsEaster(String name) {
74
74
+
if (aliasMap.containsKey(name)) name = aliasMap.get(name);
75
75
+
return destinationMap.getOrDefault(name, isEaster(name) ? InfinityMethods.getId(name) : null);
72
76
}
73
77
74
78
public boolean isEaster(String name) {
+5
common/src/main/resources/config/easter/the_end.json
···
1
1
+
{
2
2
+
"infinity_version": 2004005,
3
3
+
"name": "abatised redivides",
4
4
+
"destination": "minecraft:the_end"
5
5
+
}