mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +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,16 +922,17 @@ 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) {
|
||||||
|
internalId++;
|
||||||
|
}
|
||||||
BlockType type = register(defaultState, internalId, stateList);
|
BlockType type = register(defaultState, internalId, stateList);
|
||||||
values[internalId] = type;
|
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