3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-03 14:50:19 +01:00

Replace more instances of String#split with BlockUtils#getCleanIdentifier

Dieser Commit ist enthalten in:
Camotoy 2021-07-17 09:43:25 -04:00
Ursprung 4e629feee8
Commit 80b8d18c31
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -272,7 +272,7 @@ public class BlockRegistryPopulator {
BlockStateValues.storeBlockStateValues(entry.getKey(), javaRuntimeId, entry.getValue()); 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(); String bedrockIdentifier = entry.getValue().get("bedrock_identifier").asText();
if (!BlockRegistries.JAVA_CLEAN_IDENTIFIERS.get().containsValue(cleanJavaIdentifier)) { if (!BlockRegistries.JAVA_CLEAN_IDENTIFIERS.get().containsValue(cleanJavaIdentifier)) {