mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 11:38:03 +01:00
Use collection copies
This commit is contained in:
parent
ba8667a361
commit
089a90df52
@ -20,7 +20,7 @@ final class BlockImpl implements Block {
|
||||
private static final ObjectArray<Block> BLOCK_STATE_MAP = new ObjectArray<>();
|
||||
private static final Registry.Container<Block> CONTAINER = new Registry.Container<>(Registry.Resource.BLOCKS,
|
||||
(container, namespace, object) -> {
|
||||
final var stateObject = (Map<String, Object>) object.remove("states");
|
||||
final var stateObject = (Map<String, Object>) object.get("states");
|
||||
// Loop each state
|
||||
var propertyEntry = new HashMap<Map<String, String>, Block>();
|
||||
var unmodifiableEntries = Collections.unmodifiableMap(propertyEntry);
|
||||
|
@ -537,15 +537,14 @@ public final class Registry {
|
||||
reader.beginArray();
|
||||
while (reader.hasNext()) list.add(readObject(reader));
|
||||
reader.endArray();
|
||||
list.trimToSize();
|
||||
yield list;
|
||||
yield List.copyOf(list);
|
||||
}
|
||||
case BEGIN_OBJECT -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
reader.beginObject();
|
||||
while (reader.hasNext()) map.put(reader.nextName().intern(), readObject(reader));
|
||||
reader.endObject();
|
||||
yield map;
|
||||
yield Map.copyOf(map);
|
||||
}
|
||||
case STRING -> reader.nextString().intern();
|
||||
case NUMBER -> ToNumberPolicy.LONG_OR_DOUBLE.readNumber(reader);
|
||||
|
Loading…
Reference in New Issue
Block a user