Cache the blockState and biome wrapper hashCodes
This commit is contained in:
+5
-2
@@ -88,7 +88,8 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
#endif
|
||||
|
||||
/** technically final, but since it requires a method call to generate it can't be marked as such */
|
||||
private String serialString = null;
|
||||
private String serialString;
|
||||
private int hashCode;
|
||||
|
||||
|
||||
|
||||
@@ -119,6 +120,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
{
|
||||
this.biome = biome;
|
||||
this.serialString = this.serialize(levelWrapper);
|
||||
this.hashCode = Objects.hash(this.serialString);
|
||||
LOGGER.trace("Created BiomeWrapper ["+this.serialString+"] for ["+biome+"]");
|
||||
}
|
||||
|
||||
@@ -127,6 +129,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
{
|
||||
this.biome = null;
|
||||
this.serialString = EMPTY_STRING;
|
||||
this.hashCode = Objects.hash(this.serialString);
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +171,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() { return Objects.hash(this.getSerialString()); }
|
||||
public int hashCode() { return this.hashCode; }
|
||||
|
||||
@Override
|
||||
public String getSerialString() { return this.serialString; }
|
||||
|
||||
+3
-1
@@ -83,6 +83,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
public final BlockState blockState;
|
||||
/** technically final, but since it requires a method call to generate it can't be marked as such */
|
||||
private String serialString;
|
||||
private final int hashCode;
|
||||
/**
|
||||
* Cached opacity value, -1 if not populated. <br>
|
||||
* Should be between {@link IBlockStateWrapper#FULLY_OPAQUE} and {@link IBlockStateWrapper#FULLY_OPAQUE}
|
||||
@@ -121,6 +122,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
{
|
||||
this.blockState = blockState;
|
||||
this.serialString = this.serialize(levelWrapper);
|
||||
this.hashCode = Objects.hash(this.serialString);
|
||||
this.irisBlockMaterialId = this.calculateIrisBlockMaterialId();
|
||||
LOGGER.trace("Created BlockStateWrapper ["+this.serialString+"] for ["+blockState+"] with material ID ["+this.irisBlockMaterialId+"]");
|
||||
}
|
||||
@@ -245,7 +247,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() { return Objects.hash(this.getSerialString()); }
|
||||
public int hashCode() { return this.hashCode; }
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
Submodule coreSubProjects updated: 9f195231db...a1950ebccc
Reference in New Issue
Block a user