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:
1 parent
e4dc080657
commit
f18cfb09d2
18 files changed
+116
-139
No files matched your search
@@ -28,13 +28,13 @@ public class CounterCommand
|
||||
CarpetSettings.hopperCounters);
|
||||
|
||||
literalargumentbuilder.
|
||||
then((Commands.literal("reset").executes( (p_198489_1_)->
|
||||
resetCounter(p_198489_1_.getSource(), null))));
|
||||
then((Commands.literal("reset").executes( (context)->
|
||||
resetCounter(context.getSource(), null))));
|
||||
for (DyeColor enumDyeColor: DyeColor.values())
|
||||
{
|
||||
String color = enumDyeColor.toString();
|
||||
literalargumentbuilder.
|
||||
then((Commands.literal(color).executes( (p_198489_1_)-> displayCounter(p_198489_1_.getSource(), color, false))));
|
||||
then((Commands.literal(color).executes( (context)-> displayCounter(context.getSource(), color, false))));
|
||||
literalargumentbuilder.then(Commands.literal(color).
|
||||
then(Commands.literal("reset").executes((context) ->
|
||||
resetCounter(context.getSource(), color))));
|
||||
|
||||
@@ -35,7 +35,7 @@ public class MobAICommand
|
||||
executes( (c) -> {
|
||||
MobAI.startTracking(
|
||||
Registry.ENTITY_TYPE.get(EntitySummonArgument.getSummonableEntity(c, "entity type")),
|
||||
MobAI.TrackingType.byName(StringArgumentType.getString(c, "aspect"))
|
||||
MobAI.TrackingType.valueOf(StringArgumentType.getString(c, "aspect").toUpperCase())
|
||||
);
|
||||
return 1;
|
||||
})));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user