From 0ca2b2f28233905c42bf4b055e282eb340284032 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 23 Dec 2024 21:40:55 -0600 Subject: [PATCH] minor data point ID map optimization --- .../dataObjects/fullData/FullDataPointIdMap.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/FullDataPointIdMap.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/FullDataPointIdMap.java index c8a18374c..0a9fb92ad 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/FullDataPointIdMap.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/FullDataPointIdMap.java @@ -564,16 +564,16 @@ public class FullDataPointIdMap public String serialize() { return this.biome.getSerialString() + BLOCK_STATE_SEPARATOR_STRING + this.blockState.getSerialString(); } - public static Entry deserialize(String str, ILevelWrapper levelWrapper) throws IOException, DataCorruptedException + public static Entry deserialize(String str, ILevelWrapper levelWrapper) throws DataCorruptedException { - String[] stringArray = str.split(BLOCK_STATE_SEPARATOR_STRING); - if (stringArray.length != 2) + int separatorIndex = str.indexOf(BLOCK_STATE_SEPARATOR_STRING); + if (separatorIndex == -1) { - throw new DataCorruptedException("Failed to deserialize BiomeBlockStateEntry"); + throw new DataCorruptedException("Failed to deserialize BiomeBlockStateEntry ["+str+"], unable to find separator."); } - IBiomeWrapper biome = WRAPPER_FACTORY.deserializeBiomeWrapperOrGetDefault(stringArray[0], levelWrapper); - IBlockStateWrapper blockState = WRAPPER_FACTORY.deserializeBlockStateWrapperOrGetDefault(stringArray[1], levelWrapper); + IBiomeWrapper biome = WRAPPER_FACTORY.deserializeBiomeWrapperOrGetDefault(str.substring(0, separatorIndex), levelWrapper); + IBlockStateWrapper blockState = WRAPPER_FACTORY.deserializeBlockStateWrapperOrGetDefault(str.substring(separatorIndex+BLOCK_STATE_SEPARATOR_STRING.length()), levelWrapper); return Entry.getEntry(biome, blockState); }