Skip to content

Commit ae00af5

Browse files
committed
Support 1.18 worlds, add fabric 1.18 support, start adding forge 1.17.1
1 parent f52d463 commit ae00af5

File tree

169 files changed

+4164
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+4164
-88
lines changed

BlueMapCore/build.gradle

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,27 @@ license {
3434
}
3535

3636
//resource Extensions
37+
String[] resourceIds = [
38+
"1_12", "1_13", "1_15", "1_16", "1_18"
39+
];
40+
3741
task zipResourceExtensions {
38-
dependsOn 'zipResourceExtensions1_12'
39-
dependsOn 'zipResourceExtensions1_13'
40-
dependsOn 'zipResourceExtensions1_15'
41-
dependsOn 'zipResourceExtensions1_16'
42+
for (String id : resourceIds) {
43+
dependsOn "zipResourceExtensions$id"
44+
}
45+
}
46+
47+
for (String id : resourceIds) zipResourcesTask(id)
48+
void zipResourcesTask(String resourceId) {
49+
task ("zipResourceExtensions$resourceId", type: Zip) {
50+
from fileTree("src/main/resourceExtensions/mc$resourceId")
51+
archiveName 'resourceExtensions.zip'
52+
destinationDir(file("src/main/resources/de/bluecolored/bluemap/mc$resourceId/"))
53+
outputs.upToDateWhen{ false }
54+
}
4255
}
4356

57+
/*
4458
task zipResourceExtensions1_12(type: Zip) {
4559
from fileTree('src/main/resourceExtensions/mc1_12')
4660
archiveName 'resourceExtensions.zip'
@@ -68,6 +82,7 @@ task zipResourceExtensions1_16(type: Zip) {
6882
destinationDir(file('src/main/resources/de/bluecolored/bluemap/mc1_16/'))
6983
outputs.upToDateWhen { false }
7084
}
85+
*/
7186

7287
//always update the zip before build
7388
processResources.dependsOn(zipResourceExtensions)

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/MinecraftVersion.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ public enum MinecraftResource {
148148
MC_1_15 (new MinecraftVersion(1, 15), "mc1_15", "https://launcher.mojang.com/v1/objects/e3f78cd16f9eb9a52307ed96ebec64241cc5b32d/client.jar"),
149149
MC_1_16 (new MinecraftVersion(1, 16), "mc1_16", "https://launcher.mojang.com/v1/objects/228fdf45541c4c2fe8aec4f20e880cb8fcd46621/client.jar"),
150150
MC_1_16_2 (new MinecraftVersion(1, 16, 2), "mc1_16", "https://launcher.mojang.com/v1/objects/653e97a2d1d76f87653f02242d243cdee48a5144/client.jar"),
151-
MC_1_17 (new MinecraftVersion(1, 17), "mc1_16", "https://launcher.mojang.com/v1/objects/1cf89c77ed5e72401b869f66410934804f3d6f52/client.jar");
151+
MC_1_17 (new MinecraftVersion(1, 17), "mc1_16", "https://launcher.mojang.com/v1/objects/1cf89c77ed5e72401b869f66410934804f3d6f52/client.jar"),
152+
MC_1_18 (new MinecraftVersion(1, 18), "mc1_18", "https://launcher.mojang.com/v1/objects/020aa79e63a7aab5d6f30e5ec7a6c08baee6b64c/client.jar");
152153

153154
private final MinecraftVersion version;
154155
private final String resourcePrefix;

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil113.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public ChunkAnvil113(MCAWorld world, CompoundTag chunkTag) {
6161
Section section = new Section(sectionTag);
6262
if (section.getSectionY() >= 0 && section.getSectionY() < sections.length) sections[section.getSectionY()] = section;
6363
}
64+
} else {
65+
sections = new Section[0];
6466
}
6567

6668
Tag<?> tag = levelData.get("Biomes"); //tag can be byte-array or int-array
@@ -116,14 +118,14 @@ public LightData getLightData(int x, int y, int z, LightData target) {
116118
}
117119

118120
@Override
119-
public int getBiome(int x, int y, int z) {
121+
public String getBiome(int x, int y, int z) {
120122
x = x & 0xF; // Math.floorMod(pos.getX(), 16)
121123
z = z & 0xF;
122124
int biomeIntIndex = z * 16 + x;
123125

124-
if (biomeIntIndex >= this.biomes.length) return Biome.DEFAULT.getNumeralId();
126+
if (biomeIntIndex >= this.biomes.length) return Biome.DEFAULT.getFullId();
125127

126-
return biomes[biomeIntIndex];
128+
return LegacyBiomes.idFor(biomes[biomeIntIndex]);
127129
}
128130

129131
private class Section {

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil115.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public ChunkAnvil115(MCAWorld world, CompoundTag chunkTag) {
6161
Section section = new Section(sectionTag);
6262
if (section.getSectionY() >= 0 && section.getSectionY() < sections.length) sections[section.getSectionY()] = section;
6363
}
64+
} else {
65+
sections = new Section[0];
6466
}
6567

6668
Tag<?> tag = levelData.get("Biomes"); //tag can be byte-array or int-array
@@ -116,16 +118,16 @@ public LightData getLightData(int x, int y, int z, LightData target) {
116118
}
117119

118120
@Override
119-
public int getBiome(int x, int y, int z) {
121+
public String getBiome(int x, int y, int z) {
120122
x = (x & 0xF) / 4; // Math.floorMod(pos.getX(), 16)
121123
z = (z & 0xF) / 4;
122124
y = y / 4;
123125
int biomeIntIndex = y * 16 + z * 4 + x;
124126

125-
if (biomeIntIndex < 0) return Biome.DEFAULT.getNumeralId();
126-
if (biomeIntIndex >= this.biomes.length) return Biome.DEFAULT.getNumeralId();
127+
if (biomeIntIndex < 0) return Biome.DEFAULT.getFullId();
128+
if (biomeIntIndex >= this.biomes.length) return Biome.DEFAULT.getFullId();
127129

128-
return biomes[biomeIntIndex];
130+
return LegacyBiomes.idFor(biomes[biomeIntIndex]);
129131
}
130132

131133
private static class Section {

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil116.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public ChunkAnvil116(MCAWorld world, CompoundTag chunkTag) {
8282
for (Section section : sectionList) {
8383
sections[section.sectionY - sectionMin] = section;
8484
}
85+
} else {
86+
sections = new Section[0];
8587
}
8688

8789
Tag<?> tag = levelData.get("Biomes"); //tag can be byte-array or int-array
@@ -130,8 +132,8 @@ public LightData getLightData(int x, int y, int z, LightData target) {
130132
}
131133

132134
@Override
133-
public int getBiome(int x, int y, int z) {
134-
if (biomes.length < 16) return Biome.DEFAULT.getNumeralId();
135+
public String getBiome(int x, int y, int z) {
136+
if (biomes.length < 16) return Biome.DEFAULT.getFullId();
135137

136138
x = (x & 0xF) / 4; // Math.floorMod(pos.getX(), 16)
137139
z = (z & 0xF) / 4;
@@ -142,7 +144,7 @@ public int getBiome(int x, int y, int z) {
142144
if (biomeIntIndex >= biomes.length) biomeIntIndex -= (((biomeIntIndex - biomes.length) >> 4) + 1) * 16;
143145
if (biomeIntIndex < 0) biomeIntIndex -= (biomeIntIndex >> 4) * 16;
144146

145-
return biomes[biomeIntIndex];
147+
return LegacyBiomes.idFor(biomes[biomeIntIndex]);
146148
}
147149

148150
@Override

0 commit comments

Comments
 (0)