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

Set load factor to 1 for deterministically sized collections

Dieser Commit ist enthalten in:
KennyTV 2020-06-08 23:13:47 +02:00
Ursprung 6167c3b526
Commit 5bd1ef882e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
5 geänderte Dateien mit 10 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -185,7 +185,7 @@ public abstract class MetadataRewriter {
public <T extends Enum<T> & EntityType> void mapTypes(EntityType[] oldTypes, Class<T> newTypeClass) {
if (typeMapping == null) {
typeMapping = new Int2IntOpenHashMap(oldTypes.length);
typeMapping = new Int2IntOpenHashMap(oldTypes.length, 1F);
typeMapping.defaultReturnValue(-1);
}
for (EntityType oldType : oldTypes) {

Datei anzeigen

@ -31,11 +31,11 @@ import java.util.Map.Entry;
public class ConnectionData {
private static final BlockChangeRecord[] A = new BlockChangeRecord[0];
public static BlockConnectionProvider blockConnectionProvider;
static Int2ObjectMap<String> idToKey = new Int2ObjectOpenHashMap<>(8582);
static Map<String, Integer> keyToId = new HashMap<>(8582);
static Int2ObjectMap<String> idToKey = new Int2ObjectOpenHashMap<>(8582, 1F);
static Map<String, Integer> keyToId = new HashMap<>(8582, 1F);
static Int2ObjectMap<ConnectionHandler> connectionHandlerMap = new Int2ObjectOpenHashMap<>(1);
static Int2ObjectMap<BlockData> blockConnectionData = new Int2ObjectOpenHashMap<>(1);
static IntSet occludingStates = new IntOpenHashSet(377);
static IntSet occludingStates = new IntOpenHashSet(377, 1F);
public static void update(UserConnection user, Position position) {
for (BlockFace face : BlockFace.values()) {
@ -213,10 +213,10 @@ public class ConnectionData {
keyToId.put(key, id);
}
connectionHandlerMap = new Int2ObjectOpenHashMap<>(3650);
connectionHandlerMap = new Int2ObjectOpenHashMap<>(3650, 1F);
if (!Via.getConfig().isReduceBlockStorageMemory()) {
blockConnectionData = new Int2ObjectOpenHashMap<>(1146);
blockConnectionData = new Int2ObjectOpenHashMap<>(1146, 1F);
JsonObject mappingBlockConnections = MappingDataLoader.loadData("blockConnections.json");
for (Entry<String, JsonElement> entry : mappingBlockConnections.entrySet()) {
int id = keyToId.get(entry.getKey());
@ -243,7 +243,7 @@ public class ConnectionData {
JsonObject blockData = MappingDataLoader.loadData("blockData.json");
JsonArray occluding = blockData.getAsJsonArray("occluding");
for (JsonElement jsonElement : occluding) {
occludingStates.add(keyToId.get(jsonElement.getAsString()));
occludingStates.add(keyToId.get(jsonElement.getAsString()).intValue());
}
List<ConnectorInitAction> initActions = new ArrayList<>();

Datei anzeigen

@ -26,7 +26,7 @@ public class BlockIdData {
reader,
new TypeToken<Map<String, String[]>>() {
}.getType()
));
), 1F);
fallbackReverseMapping = new HashMap<>();
for (Map.Entry<String, String[]> entry : blockIdMapping.entrySet()) {
for (String val : entry.getValue()) {

Datei anzeigen

@ -4,7 +4,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
public class EntityTypeRewriter {
private static final Int2IntMap ENTITY_TYPES = new Int2IntOpenHashMap(93);
private static final Int2IntMap ENTITY_TYPES = new Int2IntOpenHashMap(83, 1F);
static {
ENTITY_TYPES.defaultReturnValue(-1);

Datei anzeigen

@ -33,7 +33,7 @@ import java.util.List;
import java.util.Optional;
public class WorldPackets {
private static final IntSet VALID_BIOMES = new IntOpenHashSet(70);
private static final IntSet VALID_BIOMES = new IntOpenHashSet(70, 1F);
static {
// Client will crash if it receives a invalid biome id