Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
123fc263
Commit
123fc263
authored
Apr 22, 2022
by
Yazawazi
Committed by
GitHub
Apr 22, 2022
Browse files
cache fetters
parent
376c668d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/data/GenshinData.java
View file @
123fc263
...
...
@@ -57,6 +57,9 @@ public class GenshinData {
private
static
final
Int2ObjectMap
<
SceneData
>
sceneDataMap
=
new
Int2ObjectLinkedOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
FetterData
>
fetterDataMap
=
new
Int2ObjectOpenHashMap
<>();
// Cache
private
static
Map
<
Integer
,
List
<
Integer
>>
fetters
=
new
HashMap
<>();
public
static
Int2ObjectMap
<?>
getMapByResourceDef
(
Class
<?>
resourceDefinition
)
{
Int2ObjectMap
<?>
map
=
null
;
...
...
@@ -226,14 +229,15 @@ public class GenshinData {
}
public
static
Map
<
Integer
,
List
<
Integer
>>
getFetterDataEntries
()
{
// Can I do this?
Map
<
Integer
,
List
<
Integer
>>
fetters
=
new
HashMap
<>();
fetterDataMap
.
forEach
((
k
,
v
)
->
{
if
(!
fetters
.
containsKey
(
v
.
getAvatarId
()))
{
fetters
.
put
(
v
.
getAvatarId
(),
new
ArrayList
<>());
}
fetters
.
get
(
v
.
getAvatarId
()).
add
(
k
);
});
if
(
fetters
.
isEmpty
())
{
fetterDataMap
.
forEach
((
k
,
v
)
->
{
if
(!
fetters
.
containsKey
(
v
.
getAvatarId
()))
{
fetters
.
put
(
v
.
getAvatarId
(),
new
ArrayList
<>());
}
fetters
.
get
(
v
.
getAvatarId
()).
add
(
k
);
});
}
return
fetters
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment