Skip to content

Commit f51a82e

Browse files
committed
Fix ReIndev ids not being usable with FoxLoader
1 parent 36d9265 commit f51a82e

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

loader/src/main/java/com/fox2code/foxloader/registry/GameRegistry.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -713,34 +713,44 @@ private static ServerRegistry initializeMappingsEx(ServerRegistry serverRegistry
713713
}
714714

715715
public static String strRegIdToItemStrId(String id) {
716-
if (id.startsWith("reindev:")) {
717-
String name = id.substring(8);
716+
String reIndevId = null;
717+
if (id.indexOf(':') == -1) {
718+
reIndevId = id;
719+
} else if (id.startsWith("reindev:")) {
720+
reIndevId = id.substring(8);
721+
}
718722

723+
if (reIndevId != null) {
719724
for(int i = 0; i < INITIAL_TRANSLATED_BLOCK_ID; ++i) {
720725
Item item;
721726
if ((item = Items.ITEMS_LIST[i]) != null && item != FALLBACK_ITEM &&
722-
(item.getItemName().replace("item.", "").equals(name) ||
723-
item.getItemName().equals(name) || item.isItemBlock() &&
724-
item.getItemName().replace("tile.", "").equals(name))) {
727+
(item.getItemName().replace("item.", "").equals(reIndevId) ||
728+
item.getItemName().equals(reIndevId) || item.isItemBlock() &&
729+
item.getItemName().replace("tile.", "").equals(reIndevId))) {
725730
return "" + item.itemID;
726731
}
727732
}
728-
} else if (id.indexOf(':') != -1) {
733+
} else {
729734
RegistryEntry registryEntry = registryEntries.get(id);
730735
if (registryEntry != null) return "" + registryEntry.realId;
731736
}
732737
return id;
733738
}
734739

735740
public static String strRegIdToBlockStrId(String id) {
736-
if (id.startsWith("reindev:")) {
737-
String name = id.substring(8);
741+
String reIndevId = null;
742+
if (id.indexOf(':') == -1) {
743+
reIndevId = id;
744+
} else if (id.startsWith("reindev:")) {
745+
reIndevId = id.substring(8);
746+
}
738747

748+
if (reIndevId != null) {
739749
for(int i = 0; i < PatchConstants.ORIGINAL_BLOCK_LIMIT; ++i) {
740750
Block block;
741751
if ((block = Blocks.BLOCKS_LIST[i]) != null && block != FALLBACK_BLOCK &&
742-
(block.getBlockName().replace("tile.", "").equals(name) ||
743-
block.getBlockName().equals(name))) {
752+
(block.getBlockName().replace("tile.", "").equals(reIndevId) ||
753+
block.getBlockName().equals(reIndevId))) {
744754
return "" + block.blockID;
745755
}
746756
}

0 commit comments

Comments
 (0)