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

@@ -6,7 +6,6 @@ import carpet.fakes.ServerPlayerEntityInterface;
import carpet.patches.EntityPlayerMPFake;
import carpet.settings.SettingsManager;
import carpet.utils.Messenger;
import com.google.common.collect.Sets;
import com.mojang.authlib.GameProfile;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher;
@@ -35,9 +34,10 @@ import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import static net.minecraft.commands.Commands.argument;
import static net.minecraft.commands.Commands.literal;
@@ -51,8 +51,7 @@ public class PlayerCommand
{
final String[] gamemodeStrings = Arrays.stream(GameType.values())
.map(GameType::getName)
.collect(Collectors.toList())
.toArray(new String[]{});
.toArray(String[]::new);
LiteralArgumentBuilder<CommandSourceStack> literalargumentbuilder = literal("player")
.requires((player) -> SettingsManager.canUseCommand(player, CarpetSettings.commandPlayer))
.then(argument("player", StringArgumentType.word())
@@ -143,7 +142,7 @@ public class PlayerCommand
private static Collection<String> getPlayers(CommandSourceStack source)
{
Set<String> players = Sets.newLinkedHashSet(Arrays.asList("Steve", "Alex"));
Set<String> players = new LinkedHashSet<>(List.of("Steve", "Alex"));
players.addAll(source.getOnlinePlayerNames());
return players;
}