Fix more warnings and do some small optimizations (#1356)

* Fix more warnings and do some small optimizations

* Fix more warnings in ValueConversions

* Clean up some decompiler names and fix an unnecessary transformation around commands

* Use (way) more compact data structure for slot map

* Minor tweaks
Such as map directly in the collector

* I hate vanilla javac
Revert map changes in latest commit
This commit is contained in:
altrisi authored and GitHub committed 2022-05-27 19:43:45 +02:00
1 parent e4dc080657
commit f18cfb09d2
18 files changed
+116 -139

No files matched your search

@@ -21,12 +21,12 @@ import carpet.script.value.ScreenValue;
import carpet.script.value.StringValue;
import carpet.script.value.Value;
import carpet.script.value.ValueConversions;
import com.google.common.collect.Sets;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import net.minecraft.commands.arguments.item.ItemInput;
import net.minecraft.core.HolderSet;
@@ -336,7 +336,7 @@ public class Inventories {
if (lv.size() > inventoryLocator.offset()+1)
amount = (int)NumericValue.asNumber(lv.get(inventoryLocator.offset()+1)).getLong();
// not enough
if (((amount == 1) && (!inventoryLocator.inventory().hasAnyOf(Sets.newHashSet(searchItem.getItem()))))
if (((amount == 1) && (!inventoryLocator.inventory().hasAnyOf(Set.of(searchItem.getItem()))))
|| (inventoryLocator.inventory().countItem(searchItem.getItem()) < amount)) return Value.FALSE;
for (int i = 0, maxi = inventoryLocator.inventory().getContainerSize(); i < maxi; i++)
{