Replace more instances of String#split with BlockUtils#getCleanIdentifier

This commit is contained in:
Camotoy 2021-07-17 09:43:25 -04:00
parent 4e629feee8
commit 80b8d18c31
No known key found for this signature in database
GPG Key ID: 7EEFB66FE798081F
2 changed files with 4 additions and 3 deletions

View File

@ -39,6 +39,7 @@ import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.inventory.InventoryTranslator;
import org.geysermc.connector.registry.BlockRegistries;
import org.geysermc.connector.utils.BlockUtils;
import java.util.Collections;
import java.util.HashSet;
@ -62,10 +63,10 @@ public class BlockInventoryHolder extends InventoryHolder {
if (validBlocks != null) {
Set<String> validBlocksTemp = new HashSet<>(validBlocks.length + 1);
Collections.addAll(validBlocksTemp, validBlocks);
validBlocksTemp.add(javaBlockIdentifier.split("\\[")[0]);
validBlocksTemp.add(BlockUtils.getCleanIdentifier(javaBlockIdentifier));
this.validBlocks = ImmutableSet.copyOf(validBlocksTemp);
} else {
this.validBlocks = Collections.singleton(javaBlockIdentifier.split("\\[")[0]);
this.validBlocks = Collections.singleton(BlockUtils.getCleanIdentifier(javaBlockIdentifier));
}
}

View File

@ -272,7 +272,7 @@ public class BlockRegistryPopulator {
BlockStateValues.storeBlockStateValues(entry.getKey(), javaRuntimeId, entry.getValue());
String cleanJavaIdentifier = entry.getKey().split("\\[")[0];
String cleanJavaIdentifier = BlockUtils.getCleanIdentifier(entry.getKey());
String bedrockIdentifier = entry.getValue().get("bedrock_identifier").asText();
if (!BlockRegistries.JAVA_CLEAN_IDENTIFIERS.get().containsValue(cleanJavaIdentifier)) {