mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Replaced an empty for loop with a while loop for better readability.
This commit is contained in:
parent
d20b8ddb2a
commit
678a99667d
@ -892,7 +892,9 @@ public final class BlockTypes {
|
|||||||
Map<String, String> blockMap = blocks.stream().collect(Collectors.toMap(item -> item.charAt(item.length() - 1) == ']' ? item.substring(0, item.indexOf('[')) : item, item -> item));
|
Map<String, String> blockMap = blocks.stream().collect(Collectors.toMap(item -> item.charAt(item.length() - 1) == ']' ? item.substring(0, item.indexOf('[')) : item, item -> item));
|
||||||
|
|
||||||
int size = blockMap.size();
|
int size = blockMap.size();
|
||||||
for (Field field : BlockID.class.getDeclaredFields()) size = Math.max(field.getInt(null) + 1, size);
|
for (Field field : BlockID.class.getDeclaredFields()) {
|
||||||
|
size = Math.max(field.getInt(null) + 1, size);
|
||||||
|
}
|
||||||
BIT_OFFSET = MathMan.log2nlz(size);
|
BIT_OFFSET = MathMan.log2nlz(size);
|
||||||
BIT_MASK = ((1 << BIT_OFFSET) - 1);
|
BIT_MASK = ((1 << BIT_OFFSET) - 1);
|
||||||
values = new BlockType[size];
|
values = new BlockType[size];
|
||||||
@ -920,15 +922,16 @@ public final class BlockTypes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Register new blocks
|
// Register new blocks
|
||||||
int internalId = 1;
|
int internalId = 1;
|
||||||
for (Map.Entry<String, String> entry : blockMap.entrySet()) {
|
for (Map.Entry<String, String> entry : blockMap.entrySet()) {
|
||||||
String defaultState = entry.getValue();
|
String defaultState = entry.getValue();
|
||||||
// Skip already registered ids
|
// Skip already registered ids
|
||||||
for (; values[internalId] != null; internalId++);
|
while(values[internalId] != null) {
|
||||||
BlockType type = register(defaultState, internalId, stateList);
|
internalId++;
|
||||||
values[internalId] = type;
|
|
||||||
}
|
}
|
||||||
|
BlockType type = register(defaultState, internalId, stateList);
|
||||||
|
values[internalId] = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
states = stateList.toArray(new BlockState[stateList.size()]);
|
states = stateList.toArray(new BlockState[stateList.size()]);
|
||||||
|
Loading…
Reference in New Issue
Block a user