Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
support 1.19.4 world convert && bump 1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolLoong committed Mar 30, 2023
1 parent a2a5cac commit aa69ffb
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 21 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ D:\your device path\1.19.2\.MINECRAFT\SAVES\new world ←this is save_path

### Support Version

| Version | Available |
|:---------:| :----: |
| Below 1.7 ||
| 1.7-1.12 ||
| 1.13-1.14 ||
| 1.15-1.19 ||
| Version | Available |
|:-----------:| :----: |
| Below 1.7 ||
| 1.7-1.12 ||
| 1.13-1.14 ||
| 1.15-1.19.4 ||

### Tips

Expand Down
Binary file not shown.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>cn.coolloong</groupId>
<artifactId>pnxworldconvert</artifactId>
<version>1.0.3</version>
<version>1.0.5</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
Expand Down Expand Up @@ -44,11 +44,11 @@
<dependencies>
<dependency>
<!-- maven local repository -->
<!-- mvn install:install-file -Dfile=${project.basedir}/libs/powernukkitx-1.19.60-r1-mini.jar -DgroupId=cn.powernukkitx -DartifactId=powernukkitx -Dversion=1.19.60-r1-mini -Dpackaging=jar -->
<!-- mvn install:install-file -Dfile=${project.basedir}/libs/powernukkitx-1.19.70-r1-mini.jar -DgroupId=cn.powernukkitx -DartifactId=powernukkitx -Dversion=1.19.70-r1-mini -Dpackaging=jar -->
<!-- mvn dependency:purge-local-repository -DmanualInclude="cn.powernukkitx:powernukkitx"-->
<groupId>cn.powernukkitx</groupId>
<artifactId>powernukkitx</artifactId>
<version>1.19.60-r1-mini</version>
<version>1.19.70-r1-mini</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/cn/coolloong/SupportVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public enum SupportVersion {
MC_OLD(169, 1343),//1.9-1.12
MC_NEW(2200, 3218);//1.15-1.19.3
MC_NEW(2200, 3337);//1.15-1.19.3
final int start;
final int end;

Expand All @@ -11,12 +11,18 @@ public enum SupportVersion {
this.end = end;
}

public static SupportVersion selectVersion(int dataVersion) {
/**
* Select version support version.
*
* @param dataVersion the data version
* @return the support version
*/
public static SupportVersion selectVersion(int dataVersion) throws UnsupportedOperationException {
for (var ver : SupportVersion.values()) {
if (dataVersion <= ver.end && dataVersion >= ver.start) {
return ver;
}
}
return MC_OLD;
throw new UnsupportedOperationException("UnSupport World Version: " + dataVersion);
}
}
3 changes: 1 addition & 2 deletions src/main/java/cn/coolloong/convert/OldRegionConvertWork.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public void run() {
return;
}
try {
end:
for (int rx = regionX * 32; rx < regionX * 32 + 32; ++rx) {
for (int rz = regionZ * 32; rz < regionZ * 32 + 32; ++rz) {
if (nowThread.isInterrupted()) throw new InterruptedException();
Expand Down Expand Up @@ -113,7 +112,7 @@ public void run() {
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} catch (AnvilException | IOException e) {
} catch (Exception e) {
this.progress = -1;
e.printStackTrace();
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/cn/coolloong/convert/RegionConvertWork.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public void run() {
return;
}
try {
end:
for (int rx = regionX * 32; rx < regionX * 32 + 32; ++rx) {
for (int rz = regionZ * 32; rz < regionZ * 32 + 32; ++rz) {
if (nowThread.isInterrupted()) throw new InterruptedException();
Expand Down Expand Up @@ -155,7 +154,7 @@ public void run() {
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} catch (AnvilException | IOException e) {
} catch (Exception e) {
this.progress = -1;
e.printStackTrace();
}
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/cn/coolloong/utils/ConvertWorkFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ public static RegionConvertWork make(File mca, LevelProvider levelProvider, Dime
for (int rz = regionZ * 32; rz < regionZ * 32 + 32; ++rz) {
var chunkData = region.getChunkData(rx, rz);
if (chunkData != null) {
//noinspection ConstantConditions
if (chunkData.contains("DataVersion")) {
tmpVersion = SupportVersion.selectVersion(chunkData.getInt("DataVersion"));
} else tmpVersion = SupportVersion.MC_OLD;
try {
if (chunkData.contains("DataVersion")) {
//noinspection ConstantConditions
tmpVersion = SupportVersion.selectVersion(chunkData.getInt("DataVersion"));
} else tmpVersion = SupportVersion.MC_OLD;
} catch (UnsupportedOperationException e) {
e.printStackTrace();
PNXWorldConverter.close(1);
}
break end;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/cn/coolloong/utils/DataConvert.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static org.jglrxavpok.hephaistos.mca.BlockState convertLegacyId(String Le
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
System.out.println("找不到legacyID对应的方块:" + LegacyId);
Logger.warn("cant find legacyID:" + LegacyId);
return new org.jglrxavpok.hephaistos.mca.BlockState("minecraft:air", Map.of());
}
var name = list.get(0).toString();
Expand Down Expand Up @@ -174,6 +174,7 @@ public static BlockState convertBlockState(org.jglrxavpok.hephaistos.mca.BlockSt
BLOCK_STATE_CACHE.put(sourceType, result);
return result;
} catch (NoSuchElementException e) {
Logger.warn("cant find: " + beBlockName);
BLOCK_STATE_CACHE.put(sourceType, BlockState.AIR);
return BlockState.AIR;
}
Expand Down
16 changes: 16 additions & 0 deletions src/main/resources/jeItemsMapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -933,66 +933,82 @@
},
"minecraft:white_wool": {
"bedrock_identifier": "minecraft:white_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 1996
},
"minecraft:orange_wool": {
"bedrock_identifier": "minecraft:orange_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 1997
},
"minecraft:magenta_wool": {
"bedrock_identifier": "minecraft:magenta_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 1998
},
"minecraft:light_blue_wool": {
"bedrock_identifier": "minecraft:light_blue_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 1999
},
"minecraft:yellow_wool": {
"bedrock_identifier": "minecraft:yellow_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2000
},
"minecraft:lime_wool": {
"bedrock_identifier": "minecraft:lime_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2001
},
"minecraft:pink_wool": {
"bedrock_identifier": "minecraft:pink_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2002
},
"minecraft:gray_wool": {
"bedrock_identifier": "minecraft:gray_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2003
},
"minecraft:light_gray_wool": {
"bedrock_identifier": "minecraft:light_gray_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2004
},
"minecraft:cyan_wool": {
"bedrock_identifier": "minecraft:cyan_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2005
},
"minecraft:purple_wool": {
"bedrock_identifier": "minecraft:purple_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2006
},
"minecraft:blue_wool": {
"bedrock_identifier": "minecraft:blue_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2007
},
"minecraft:brown_wool": {
"bedrock_identifier": "minecraft:brown_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2008
},
"minecraft:green_wool": {
"bedrock_identifier": "minecraft:green_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2009
},
"minecraft:red_wool": {
"bedrock_identifier": "minecraft:red_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2010
},
"minecraft:black_wool": {
"bedrock_identifier": "minecraft:black_wool",
"bedrock_data": 0,
"firstBlockRuntimeId": 2011
},
"minecraft:dandelion": {
Expand Down

0 comments on commit aa69ffb

Please sign in to comment.