Skip to content

Commit 20b715a

Browse files
committed
avoid hashing at all if the sensitive map is empty
1 parent e6af682 commit 20b715a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/mekanism/common/recipe/lookup/cache/type/ComponentSensitiveInputCache.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void clear() {
4141
*/
4242
@Override
4343
public boolean contains(INPUT input) {
44-
return super.contains(input) || componentInputCache.containsKey(input);
44+
return super.contains(input) || (!componentInputCache.isEmpty() && componentInputCache.containsKey(input));
4545
}
4646

4747
/**
@@ -51,6 +51,9 @@ public boolean contains(INPUT input) {
5151
*/
5252
@Override
5353
public Iterable<RECIPE> getRecipes(INPUT input) {
54+
if (componentInputCache.isEmpty()) {
55+
return super.getRecipes(input);
56+
}
5457
List<RECIPE> nbtRecipes = componentInputCache.getOrDefault(input, Collections.emptyList());
5558
if (nbtRecipes.isEmpty()) {
5659
return super.getRecipes(input);

0 commit comments

Comments
 (0)