mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
refactor: switch to EnumSet for heightmaps to improve performance (#2248)
This commit is contained in:
parent
3041ff3e50
commit
a553961c05
@ -9,7 +9,7 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.HashMap;
|
import java.util.EnumMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -95,7 +95,7 @@ public interface IChunkSet extends IBlocks, OutputExtent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default Map<HeightMapType, int[]> getHeightMaps() {
|
default Map<HeightMapType, int[]> getHeightMaps() {
|
||||||
return new HashMap<>();
|
return new EnumMap<>(HeightMapType.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,7 +15,7 @@ import com.sk89q.worldedit.world.block.BlockTypesCache;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.EnumMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -40,7 +40,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
public BlockVector3ChunkMap<CompoundTag> tiles;
|
public BlockVector3ChunkMap<CompoundTag> tiles;
|
||||||
public HashSet<CompoundTag> entities;
|
public HashSet<CompoundTag> entities;
|
||||||
public HashSet<UUID> entityRemoves;
|
public HashSet<UUID> entityRemoves;
|
||||||
public Map<HeightMapType, int[]> heightMaps;
|
public EnumMap<HeightMapType, int[]> heightMaps;
|
||||||
private boolean fastMode = false;
|
private boolean fastMode = false;
|
||||||
private int bitMask = -1;
|
private int bitMask = -1;
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<HeightMapType, int[]> getHeightMaps() {
|
public Map<HeightMapType, int[]> getHeightMaps() {
|
||||||
return heightMaps == null ? new HashMap<>() : heightMaps;
|
return heightMaps == null ? new EnumMap<>(HeightMapType.class) : heightMaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -177,7 +177,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
@Override
|
@Override
|
||||||
public void setHeightMap(HeightMapType type, int[] heightMap) {
|
public void setHeightMap(HeightMapType type, int[] heightMap) {
|
||||||
if (heightMaps == null) {
|
if (heightMaps == null) {
|
||||||
heightMaps = new HashMap<>();
|
heightMaps = new EnumMap<>(HeightMapType.class);
|
||||||
}
|
}
|
||||||
heightMaps.put(type, heightMap);
|
heightMaps.put(type, heightMap);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user