From 79350b2a10dfdfd7bfe6d4275207fc86efc66c36 Mon Sep 17 00:00:00 2001 From: etianl <115842502+etianl@users.noreply.github.com> Date: Mon, 12 Feb 2024 04:01:44 -0800 Subject: [PATCH] 0.8.3 AutoDisplays added, FIRE mode added to LavaAura **0.8.3** - AutoDisplay module added which automatically spams block displays around all player's heads to blind them or text displays around them for trolling or advertising. Requires operator access. - Added a "FIRE" mode to LavaAura which can make use of either Flint and Steel or Fire Charges to burn entities. There is a new option added in relation to that for automatically extinguishing the fire. - Added a new option to LavaAura to not burn entities if they are already burning. (Mainly for the FIRE option in LavaAura to conserve flints) - Removed the .onlyAttackable() filter from the entity list setting in AutoLava so you can target any entity with it such as items. - Made the .crash command by default crash all players but you if no player is specified. - Added error messages that say Command too long and may toggle the module off or skip over the command to save you from getting kicked from server for AutoCommand, AutoScoreboard, AutoTitles, HandOfGod, and OPServerKillModule modules. --- README.md | 3 +- gradle.properties | 2 +- .../java/pwn/noobs/trouserstreak/Trouser.java | 1 + .../trouserstreak/commands/CrashCommand.java | 40 +- .../trouserstreak/modules/AutoCommand.java | 20 +- .../trouserstreak/modules/AutoDisplays.java | 222 ++++++++++ .../trouserstreak/modules/AutoScoreboard.java | 20 +- .../trouserstreak/modules/AutoTitles.java | 42 +- .../trouserstreak/modules/HandOfGod.java | 22 +- .../noobs/trouserstreak/modules/LavaAura.java | 398 ++++++++++++++---- .../modules/OPServerKillModule.java | 24 +- src/main/resources/fabric.mod.json | 2 +- 12 files changed, 678 insertions(+), 118 deletions(-) create mode 100644 src/main/java/pwn/noobs/trouserstreak/modules/AutoDisplays.java diff --git a/README.md b/README.md index b8402043b..d49f628f9 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ In no particular order - **Airstrike+:** Rains down whatever entities you desire. It used to only rain fireballs, and I also changed the positioning of the spawning. (Credits to Allah-Hack for the original) - **AnHero:** Become An Hero! (A quick way back to spawn.) (Credits to etianl :D) - **AutoCommand:** Automates a list of commands you set in it's options at the push of a button! Credits to [aaaasdfghjkllll](https://github.com/aaaasdfghjkllll). I only added a full auto option because who doesn't love full auto? +- **AutoDisplays:** Automatically spams block displays around all player's heads to blind them or text displays around them for trolling and advertising. Requires operator access. (Credits to etianl :D) - **AutoDrop:** Drops the stack in your selected slot automatically, or you can choose a slot to dump. You can shift click your inventory items to dump your trash easily. (Credits to etianl :D) - **AutoLavaCaster** Simple timer based bot for lavacasting. Aim at the top of the block you want to cast on and activate the module. It places lava, then after an amount of time removes the lava, places the water after a specified delay, removes it after a specified delay, it will build the mountain upward, tower you up and repeat. Position yourself on a block above and diagonally, mostly perpendicular from the targeted block for best results. (Credits to etianl :D) - *AutoLavaCaster Notes:* @@ -81,7 +82,7 @@ This will return the lowest block placed with AutoMountain until AutoLavacast is - **HandOfGod:** Runs the "/fill" command on the world around you or around everyone else in different ways as you move around, and as you click. Destroy and modify the world with ease! Operator status required. (Credits to etianl :D) - **Inventory Dupe (1.17):** Duplicates things in your crafting slots when the module is enabled and the Dupe button is pressed in your inventory. Only works on Minecraft servers on the version 1.17, not any version before or after.(Credit to ItsVen and Da0neDatGotAway for original creation of the dupe, and to B2H990 for making the fabric mod. Credits to etianl for porting to Meteor.) - **InstaKill:** Shoots arrows and tridents with incredible power and velocity. Enabling multiple buttons causes the amount of packets to add up. (Credits to Saturn5Vfive) -- **LavaAura:** Automatically places and picks up lava buckets at an entity's feet on a tick delay. Also has the option of placing lavabuckets on every block face which may be useful in creative mode. (Credits to etianl :D) +- **LavaAura:** Automatically places and picks up lava buckets at an entity's position on a tick delay, or sets the entity on fire using flint and steel or fire charges. Also has the option of placing lavabuckets or fire on every block face which may be useful in creative mode. (Credits to etianl :D) - **LecternCrash:** Crash 1.18.X vanilla servers and possibly below. (Credits to Coderx-Gamer) - **NbtEditor:** Requires Creative mode. Generates custom entities in the form of a custom spawn egg, and it can also generate items with custom enchantments and potions with custom effects all based on the settings you configure. (Credits to etianl :D) - **NewerNewChunks:** NewChunks module with new newchunk estimation exploits, and the ability to save chunk data for later! Also with special options for tracing servers that have been updated from a version before the build limit updates, which throw false positives normally. (Credits to Meteor Rejects, and BleachHack from where it was ported, and etianl for updating :D.) diff --git a/gradle.properties b/gradle.properties index f5202aa3f..25c3a5cf4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ yarn_mappings=1.20.4+build.3 loader_version=0.15.3 # Mod Properties -mod_version=0.8.2-1.20.4 +mod_version=0.8.3-1.20.4 maven_group=pwn.noobs archives_base_name=1trouser-streak diff --git a/src/main/java/pwn/noobs/trouserstreak/Trouser.java b/src/main/java/pwn/noobs/trouserstreak/Trouser.java index 5f00935b6..900ada7dc 100644 --- a/src/main/java/pwn/noobs/trouserstreak/Trouser.java +++ b/src/main/java/pwn/noobs/trouserstreak/Trouser.java @@ -51,6 +51,7 @@ public void onInitialize() { Modules.get().add(new AutoCommand()); Modules.get().add(new AutoScoreboard()); Modules.get().add(new AutoTitles()); + Modules.get().add(new AutoDisplays()); Commands.add(new LavaTimeCalculator()); Commands.add(new CasterTimer()); Commands.add(new NewChunkCounter()); diff --git a/src/main/java/pwn/noobs/trouserstreak/commands/CrashCommand.java b/src/main/java/pwn/noobs/trouserstreak/commands/CrashCommand.java index 3bafba17c..409d1bb49 100644 --- a/src/main/java/pwn/noobs/trouserstreak/commands/CrashCommand.java +++ b/src/main/java/pwn/noobs/trouserstreak/commands/CrashCommand.java @@ -5,9 +5,12 @@ import meteordevelopment.meteorclient.commands.Command; import meteordevelopment.meteorclient.commands.arguments.PlayerListEntryArgumentType; import meteordevelopment.meteorclient.utils.player.ChatUtils; +import net.minecraft.client.network.PlayerListEntry; import net.minecraft.command.CommandSource; import net.minecraft.text.Text; +import java.util.concurrent.CopyOnWriteArrayList; + import static com.mojang.brigadier.Command.SINGLE_SUCCESS; import static meteordevelopment.meteorclient.MeteorClient.mc; @@ -15,14 +18,45 @@ public class CrashCommand extends Command { public CrashCommand() { super("crash", "Crash players, requires permission level 2 or higher"); } + private CopyOnWriteArrayList players; @Override public void build(LiteralArgumentBuilder builder) { + builder.executes(ctx -> { + players = new CopyOnWriteArrayList<>(mc.getNetworkHandler().getPlayerList()); + if (players.size() <= 1) { // Check if there is only one player (you) on the server + error("No other players found on the server"); + return SINGLE_SUCCESS; + } + if(mc.player.hasPermissionLevel(2)) { + ChatUtils.sendPlayerMsg("/execute at @a[name=!" + mc.player.getName().getLiteralString() + "] run particle ash ~ ~ ~ 1 1 1 1 2147483647 force @a[name=!" + mc.player.getName().getLiteralString() + "]"); + StringBuilder playerNames = new StringBuilder("Crashing players: "); + for (PlayerListEntry player : players) { + if (!player.getProfile().getId().equals(mc.player.getGameProfile().getId())) { + playerNames.append(player.getProfile().getName()).append(", "); + } + } + playerNames.setLength(playerNames.length() - 2); // Remove the extra comma and space at the end + ChatUtils.sendMsg(Text.of(playerNames.toString())); + return SINGLE_SUCCESS; + } else if (!(mc.player.hasPermissionLevel(2))) error("Must have permission level 2 or higher"); + return SINGLE_SUCCESS; + }); builder.then(argument("player", PlayerListEntryArgumentType.create()).executes(context -> { GameProfile profile = PlayerListEntryArgumentType.get(context).getProfile(); - if(mc.player.hasPermissionLevel(2)) ChatUtils.sendPlayerMsg("/execute at " + profile.getName() + " run particle ash ~ ~ ~ 1 1 1 1 2147483647 force " + profile.getName()); - ChatUtils.sendMsg(Text.of("Crashing player: "+profile.getName())); + if (profile != null) { + if (mc.getNetworkHandler().getPlayerList().stream().anyMatch(player -> player.getProfile().getId().equals(profile.getId()))) { + if (mc.player.hasPermissionLevel(2)) { + ChatUtils.sendPlayerMsg("/execute at " + profile.getName() + " run particle ash ~ ~ ~ 1 1 1 1 2147483647 force " + profile.getName()); + ChatUtils.sendMsg(Text.of("Crashing player: " + profile.getName())); + } else if (!mc.player.hasPermissionLevel(2)) error("Must have permission level 2 or higher"); + } else { + error("Player not found in the current server"); + } + } else { + error("Player profile not found"); + } return SINGLE_SUCCESS; })); } -} +} \ No newline at end of file diff --git a/src/main/java/pwn/noobs/trouserstreak/modules/AutoCommand.java b/src/main/java/pwn/noobs/trouserstreak/modules/AutoCommand.java index c2bd4b83b..a0eb4a1e8 100644 --- a/src/main/java/pwn/noobs/trouserstreak/modules/AutoCommand.java +++ b/src/main/java/pwn/noobs/trouserstreak/modules/AutoCommand.java @@ -93,7 +93,14 @@ private void onTick(TickEvent.Post event) { if(sent && !auto.get()) return; if(mc.player.hasPermissionLevel(permissionLevel.get()) && !auto.get()) { - if(mode.get() == Mode.Manual) for(String command : commands.get()) ChatUtils.sendPlayerMsg(command); + if(mode.get() == Mode.Manual) for(String command : commands.get()) { + if (command.length()<=256){ + ChatUtils.sendPlayerMsg(command); + } + else { + error("This command too long, shorten it somehow ("+command+")"); + } + } if(mode.get() == Mode.Macro) { try { Macros.get().get(macroName.get()).onAction(); @@ -107,7 +114,14 @@ private void onTick(TickEvent.Post event) { if (ticks<=atickdelay.get()){ ticks++; } else if (ticks>atickdelay.get()){ - if(mode.get() == Mode.Manual) for(String command : commands.get()) ChatUtils.sendPlayerMsg(command); + if(mode.get() == Mode.Manual) for(String command : commands.get()) { + if (command.length()<=256){ + ChatUtils.sendPlayerMsg(command); + } + else { + error("This command too long, shorten it somehow ("+command+")"); + } + } if(mode.get() == Mode.Macro) { try { Macros.get().get(macroName.get()).onAction(); @@ -124,4 +138,4 @@ public enum Mode { Manual, Macro } -} +} \ No newline at end of file diff --git a/src/main/java/pwn/noobs/trouserstreak/modules/AutoDisplays.java b/src/main/java/pwn/noobs/trouserstreak/modules/AutoDisplays.java new file mode 100644 index 000000000..b740ef0f4 --- /dev/null +++ b/src/main/java/pwn/noobs/trouserstreak/modules/AutoDisplays.java @@ -0,0 +1,222 @@ + +package pwn.noobs.trouserstreak.modules; + +import meteordevelopment.meteorclient.events.world.TickEvent; +import meteordevelopment.meteorclient.settings.*; +import meteordevelopment.meteorclient.systems.friends.Friends; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.utils.player.ChatUtils; +import meteordevelopment.meteorclient.utils.render.color.SettingColor; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.client.network.PlayerListEntry; +import pwn.noobs.trouserstreak.Trouser; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +public class AutoDisplays extends Module { + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + private final SettingGroup sgBlock = settings.createGroup("Block Display Options"); + private final SettingGroup sgText = settings.createGroup("Text Display Options"); + public final Setting notOP = sgGeneral.add(new BoolSetting.Builder() + .name("Toggle Module if not OP") + .description("Turn this off to prevent the bug of module always being turned off when you join server.") + .defaultValue(false) + .build() + ); + private final Setting trollfriends = sgGeneral.add(new BoolSetting.Builder() + .name("Spawn for Friends") + .description("Whether or not to summon displays for friends.") + .defaultValue(false) + .build()); + private final Setting trollyourself = sgGeneral.add(new BoolSetting.Builder() + .name("Spawn for yourself") + .description("Whether or not to summon displays for yourself.") + .defaultValue(false) + .build()); + private final Setting killEntities = sgGeneral.add(new BoolSetting.Builder() + .name("Kill Entities") + .description("Whether to remove existing entities before creating new ones. Reduces lag.") + .defaultValue(true) + .build()); + private final Setting tickDelay = sgGeneral.add(new IntSetting.Builder() + .name("Tick Delay") + .description("Delay in ticks before creating block and text displays.") + .defaultValue(0) + .min(0) + .sliderMax(100) + .build()); + private final Setting killDelay = sgGeneral.add(new IntSetting.Builder() + .name("Kill Delay") + .description("Delay in ticks before removing existing entities.") + .defaultValue(6) + .min(0) + .sliderMax(100) + .build()); + private final Setting displayMode = sgGeneral.add(new EnumSetting.Builder() + .name("Display Mode") + .description("The mode for creating displays.") + .defaultValue(Modes.TEXT) + .build()); + private final Setting block = sgBlock.add(new BlockSetting.Builder() + .name("Block") + .description("The block to be displayed.") + .defaultValue(Blocks.BLACK_CONCRETE) + .visible(() -> displayMode.get() == Modes.BLOCK) + .build()); + private final Setting blockbrightness = sgBlock.add(new IntSetting.Builder() + .name("Block Brightness") + .description("Light level of the entity.") + .defaultValue(0) + .min(0) + .sliderMax(15) + .max(15) + .visible(() -> displayMode.get() == Modes.BLOCK) + .build()); + private final Setting text = sgText.add(new StringSetting.Builder() + .name("Custom Text") + .description("Too much text will get you kicked.") + .defaultValue("Your server is being renovated! youtube.com/@mountainsoflavainc.6913") + .visible(() -> displayMode.get() == Modes.TEXT) + .build()); + private final Setting textbrightness = sgText.add(new IntSetting.Builder() + .name("Text Brightness") + .description("Light level of the entity.") + .defaultValue(15) + .min(0) + .sliderMax(15) + .max(15) + .visible(() -> displayMode.get() == Modes.TEXT) + .build()); + private final Setting backgroundColor = sgText.add(new ColorSetting.Builder() + .name("Background Color") + .description("The background color with transparency.") + .defaultValue(new SettingColor(255, 0, 0, 255)) + .visible(() -> displayMode.get() == Modes.TEXT) + .build() + ); + private final Setting distance = sgText.add(new DoubleSetting.Builder() + .name("Custom Text Distance") + .description("Distance from the player to render the text display.") + .defaultValue(2.5) + .min(1) + .sliderRange(1, 10) + .visible(() -> displayMode.get() == Modes.TEXT) + .build()); + public AutoDisplays() { + super(Trouser.Main, "auto-displays", "Automatically spam block or text displays around players. Requires operator access."); + } + private CopyOnWriteArrayList players; + private int tickTimer = 0; + private int killTimer = 0; + @Override + public void onActivate() { + tickTimer = 0; + killTimer = 0; + if (notOP.get() && !(mc.player.hasPermissionLevel(2)) && mc.world.isChunkLoaded(mc.player.getChunkPos().x, mc.player.getChunkPos().z)) { + toggle(); + error("Must have permission level 2 or higher"); + } + } + @Override + public void onDeactivate() { + switch (displayMode.get()) { + case BLOCK -> { + if (killEntities.get())ChatUtils.sendPlayerMsg("/kill @e[type=minecraft:block_display,tag=MOLcustomentityTag]"); + } + case TEXT -> { + if (killEntities.get())ChatUtils.sendPlayerMsg("/kill @e[type=minecraft:text_display,tag=MOLcustomentityTag]"); + } + } + } + @EventHandler + private void onPreTick(TickEvent.Pre event) { + if (killTimer >= killDelay.get()) { + killTimer = 0; + + switch (displayMode.get()) { + case BLOCK -> { + if (killEntities.get())ChatUtils.sendPlayerMsg("/kill @e[type=minecraft:block_display,tag=MOL]"); + } + + case TEXT -> { + if (killEntities.get())ChatUtils.sendPlayerMsg("/kill @e[type=minecraft:text_display,tag=MOL]"); + } + } + } else { + killTimer++; + } + } + @EventHandler + private void onPostTick(TickEvent.Post event) { + if (tickTimer >= tickDelay.get()) { + tickTimer = 0; + + switch (displayMode.get()) { + case BLOCK -> createBlockDisplays(); + case TEXT -> createTextDisplays(); + } + } else { + tickTimer++; + } + } + private void createBlockDisplays() { + for (int y = 2; y >= 0; y--) { + for (int x = 1; x >= -1; x--) { + for (int z = 1; z >= -1; z--) { + if (x == 0 && z == 0 && y == 1) continue; // Skip the center position + String fullString = block.get().toString(); + String[] parts = fullString.split(":"); + String block = parts[1]; + String blockName = block.replace("}", ""); + players = new CopyOnWriteArrayList<>(mc.getNetworkHandler().getPlayerList()); + List friendNames = new ArrayList<>(); + if (!trollyourself.get())friendNames.add("name=!" + mc.player.getName().getLiteralString()); + for (PlayerListEntry player : players) { + if (Friends.get().isFriend(player) && !trollfriends.get()) + friendNames.add("name=!" + player.getProfile().getName()); + } + String friendsString = String.join(",", friendNames); + String thecommand = "/execute at @a[" + friendsString + "] run summon minecraft:block_display ~" + (x - 0.5) + " ~" + y + " ~" + (z - 0.5) + " {block_state:{Name:\"minecraft:"+blockName+"\"},brightness:{sky:"+blockbrightness.get()+",block:"+blockbrightness.get()+"},Tags:[\"MOL\"]}"; + if (thecommand.length()<=256)ChatUtils.sendPlayerMsg(thecommand); + else { + error("Command too long, shorten it somehow"); + toggle(); + } + } + } + } + } + private void createTextDisplays() { + int color = (backgroundColor.get().a << 24) | (backgroundColor.get().r << 16) | (backgroundColor.get().g << 8) | backgroundColor.get().b; + players = new CopyOnWriteArrayList<>(mc.getNetworkHandler().getPlayerList()); + List friendNames = new ArrayList<>(); + if (!trollyourself.get())friendNames.add("name=!" + mc.player.getName().getLiteralString()); + for (PlayerListEntry player : players) { + if (Friends.get().isFriend(player) && !trollfriends.get()) + friendNames.add("name=!" + player.getProfile().getName()); + } + String friendsString = String.join(",", friendNames); + String thecommand1 = "/execute at @a[" + friendsString + "] run summon text_display ~ ~1 ~-"+distance.get()+" {brightness:{sky:"+textbrightness.get()+",block:"+textbrightness.get()+"},background:" + color + ",text:'\"" + text.get() + "\"',Tags:[\"MOL\"],Rotation:[0f, 0f]}"; + String thecommand2 = "/execute at @a[" + friendsString + "] run summon text_display ~ ~1 ~"+distance.get()+" {brightness:{sky:"+textbrightness.get()+",block:"+textbrightness.get()+"},background:" + color + ",text:'\"" + text.get() + "\"',Tags:[\"MOL\"],Rotation:[180f, 0f]}"; + String thecommand3 = "/execute at @a[" + friendsString + "] run summon text_display ~"+distance.get()+" ~1 ~ {brightness:{sky:"+textbrightness.get()+",block:"+textbrightness.get()+"},background:" + color + ",text:'\"" + text.get() + "\"',Tags:[\"MOL\"],Rotation:[90f, 0f]}"; + String thecommand4 = "/execute at @a[" + friendsString + "] run summon text_display ~-"+distance.get()+" ~1 ~ {brightness:{sky:"+textbrightness.get()+",block:"+textbrightness.get()+"},background:" + color + ",text:'\"" + text.get() + "\"',Tags:[\"MOL\"],Rotation:[-90f, 0f]}"; + if (thecommand1.length()<=256 && thecommand2.length()<=256 && thecommand3.length()<=256 && thecommand4.length()<=256){ + ChatUtils.sendPlayerMsg(thecommand1); + ChatUtils.sendPlayerMsg(thecommand2); + ChatUtils.sendPlayerMsg(thecommand3); + ChatUtils.sendPlayerMsg(thecommand4); + } + else { + error("Command too long, shorten it somehow"); + toggle(); + } + } + public enum Modes { + BLOCK, + TEXT + } +} \ No newline at end of file diff --git a/src/main/java/pwn/noobs/trouserstreak/modules/AutoScoreboard.java b/src/main/java/pwn/noobs/trouserstreak/modules/AutoScoreboard.java index 10f0aa966..a89509408 100644 --- a/src/main/java/pwn/noobs/trouserstreak/modules/AutoScoreboard.java +++ b/src/main/java/pwn/noobs/trouserstreak/modules/AutoScoreboard.java @@ -73,13 +73,27 @@ public void onActivate() { @EventHandler private void onTick(TickEvent.Post event) { String scoreboardName = RandomStringUtils.randomAlphabetic(10).toLowerCase(); - ChatUtils.sendPlayerMsg("/scoreboard objectives add " + scoreboardName + " dummy {\"text\":\"" + MeteorStarscript.run(MeteorStarscript.compile(title.get())) + "\",\"color\":\"" + titleColor.get() + "\"}"); + String thecommand = "/scoreboard objectives add " + scoreboardName + " dummy {\"text\":\"" + MeteorStarscript.run(MeteorStarscript.compile(title.get())) + "\",\"color\":\"" + titleColor.get() + "\"}"; + if (thecommand.length()<=256){ + ChatUtils.sendPlayerMsg(thecommand); + } + else { + error("Title is too long, shorten it somehow"); + toggle(); + } ChatUtils.sendPlayerMsg("/scoreboard objectives setdisplay sidebar " + scoreboardName); int i = content.get().size(); for(String string : content.get()) { String randomName = RandomStringUtils.randomAlphabetic(10).toLowerCase(); ChatUtils.sendPlayerMsg("/team add " + randomName); - ChatUtils.sendPlayerMsg("/team modify " + randomName + " suffix {\"text\":\" " + MeteorStarscript.run(MeteorStarscript.compile(string)) + "\"}"); + String thecommand2 = "/team modify " + randomName + " suffix {\"text\":\" " + MeteorStarscript.run(MeteorStarscript.compile(string)) + "\"}"; + if (thecommand2.length()<=256){ + ChatUtils.sendPlayerMsg(thecommand2); + } + else { + error("A content line is too long, shorten it somehow"); + toggle(); + } ChatUtils.sendPlayerMsg("/team modify " + randomName + " color " + contentColor); ChatUtils.sendPlayerMsg("/team join " + randomName + " " + i); ChatUtils.sendPlayerMsg("/scoreboard players set " + i + " " + scoreboardName + " " + i); @@ -88,4 +102,4 @@ private void onTick(TickEvent.Post event) { toggle(); info("Created scoreboard."); } -} +} \ No newline at end of file diff --git a/src/main/java/pwn/noobs/trouserstreak/modules/AutoTitles.java b/src/main/java/pwn/noobs/trouserstreak/modules/AutoTitles.java index dc562e83e..3a8c6cdad 100644 --- a/src/main/java/pwn/noobs/trouserstreak/modules/AutoTitles.java +++ b/src/main/java/pwn/noobs/trouserstreak/modules/AutoTitles.java @@ -242,15 +242,33 @@ public void onActivate() { if (!notitlefrend.get()) { if (notitleself.get()){ + if (messageLengthExceedsLimit("/title @a[name=!" + mc.player.getName().getLiteralString() + "] title {\"text\":\"" + title.get() + "\", \"bold\":" + titlebold.get() + ", \"italic\":" + titleitalic.get() + ", \"color\":\"" + titlecolour.get() + "\"}")) { + error("Title is too long, shorten it somehow"); + toggle(); + return; + } ChatUtils.sendPlayerMsg("/title @a[name=!" + mc.player.getName().getLiteralString() + "] times " + fadein + " " + duration + " " + fadeout); ChatUtils.sendPlayerMsg("/title @a[name=!" + mc.player.getName().getLiteralString() + "] title {\"text\":\"" + title.get() + "\", \"bold\":" + titlebold.get() + ", \"italic\":" + titleitalic.get() + ", \"color\":\"" + titlecolour.get() + "\"}"); - if (makesubtitle.get())ChatUtils.sendPlayerMsg("/title @a[name=!" + mc.player.getName().getLiteralString() + "] subtitle {\"text\":\"" + subtitle.get() + "\", \"bold\":" + subtitlebold.get() + ", \"italic\":" + subtitleitalic.get() + ", \"color\":\"" + subtitlecolour.get() + "\"}"); - if (makeactionbar.get())ChatUtils.sendPlayerMsg("/title @a[name=!" + mc.player.getName().getLiteralString() + "] actionbar {\"text\":\"" + actionbar.get() + "\", \"bold\":" + actionbarbold.get() + ", \"italic\":" + actionbaritalic.get() + ", \"color\":\"" + actionbarcolour.get() + "\"}"); + if (makesubtitle.get() && messageLengthExceedsLimit("/title @a[name=!" + mc.player.getName().getLiteralString() + "] subtitle {\"text\":\"" + subtitle.get() + "\", \"bold\":" + subtitlebold.get() + ", \"italic\":" + subtitleitalic.get() + ", \"color\":\"" + subtitlecolour.get() + "\"}")) { + error("Subtitle command is too long, shorten it somehow"); + } else if (makesubtitle.get())ChatUtils.sendPlayerMsg("/title @a[name=!" + mc.player.getName().getLiteralString() + "] subtitle {\"text\":\"" + subtitle.get() + "\", \"bold\":" + subtitlebold.get() + ", \"italic\":" + subtitleitalic.get() + ", \"color\":\"" + subtitlecolour.get() + "\"}"); + if (makeactionbar.get() && messageLengthExceedsLimit("/title @a[name=!" + mc.player.getName().getLiteralString() + "] actionbar {\"text\":\"" + actionbar.get() + "\", \"bold\":" + actionbarbold.get() + ", \"italic\":" + actionbaritalic.get() + ", \"color\":\"" + actionbarcolour.get() + "\"}")) { + error("Action bar command is too long, shorten it somehow"); + } else if (makeactionbar.get())ChatUtils.sendPlayerMsg("/title @a[name=!" + mc.player.getName().getLiteralString() + "] actionbar {\"text\":\"" + actionbar.get() + "\", \"bold\":" + actionbarbold.get() + ", \"italic\":" + actionbaritalic.get() + ", \"color\":\"" + actionbarcolour.get() + "\"}"); } else if (!notitleself.get()){ + if (messageLengthExceedsLimit("/title @a title {\"text\":\"" + title.get() + "\", \"bold\":" + titlebold.get() + ", \"italic\":" + titleitalic.get() + ", \"color\":\"" + titlecolour.get() + "\"}")) { + error("Title is too long, shorten it somehow"); + toggle(); + return; + } ChatUtils.sendPlayerMsg("/title @a times " + fadein + " " + duration + " " + fadeout); ChatUtils.sendPlayerMsg("/title @a title {\"text\":\"" + title.get() + "\", \"bold\":" + titlebold.get() + ", \"italic\":" + titleitalic.get() + ", \"color\":\"" + titlecolour.get() + "\"}"); - if (makesubtitle.get())ChatUtils.sendPlayerMsg("/title @a subtitle {\"text\":\"" + subtitle.get() + "\", \"bold\":" + subtitlebold.get() + ", \"italic\":" + subtitleitalic.get() + ", \"color\":\"" + subtitlecolour.get() + "\"}"); - if (makeactionbar.get())ChatUtils.sendPlayerMsg("/title @a actionbar {\"text\":\"" + actionbar.get() + "\", \"bold\":" + actionbarbold.get() + ", \"italic\":" + actionbaritalic.get() + ", \"color\":\"" + actionbarcolour.get() + "\"}"); + if (makesubtitle.get() && messageLengthExceedsLimit("/title @a subtitle {\"text\":\"" + subtitle.get() + "\", \"bold\":" + subtitlebold.get() + ", \"italic\":" + subtitleitalic.get() + ", \"color\":\"" + subtitlecolour.get() + "\"}")) { + error("Subtitle command is too long, shorten it somehow"); + } else if (makesubtitle.get())ChatUtils.sendPlayerMsg("/title @a subtitle {\"text\":\"" + subtitle.get() + "\", \"bold\":" + subtitlebold.get() + ", \"italic\":" + subtitleitalic.get() + ", \"color\":\"" + subtitlecolour.get() + "\"}"); + if (makeactionbar.get() && messageLengthExceedsLimit("/title @a actionbar {\"text\":\"" + actionbar.get() + "\", \"bold\":" + actionbarbold.get() + ", \"italic\":" + actionbaritalic.get() + ", \"color\":\"" + actionbarcolour.get() + "\"}")) { + error("Action bar command is too long, shorten it somehow"); + } else if (makeactionbar.get())ChatUtils.sendPlayerMsg("/title @a actionbar {\"text\":\"" + actionbar.get() + "\", \"bold\":" + actionbarbold.get() + ", \"italic\":" + actionbaritalic.get() + ", \"color\":\"" + actionbarcolour.get() + "\"}"); } } else if (notitlefrend.get()) { players = new CopyOnWriteArrayList<>(mc.getNetworkHandler().getPlayerList()); @@ -260,10 +278,19 @@ public void onActivate() { if(Friends.get().isFriend(player) && notitlefrend.get()) friendNames.add("name=!" + player.getProfile().getName()); } String friendsString = String.join(",", friendNames); + if (messageLengthExceedsLimit("/title @a[" + friendsString + "] title {\"text\":\"" + title.get() + "\", \"bold\":" + titlebold.get() + ", \"italic\":" + titleitalic.get() + ", \"color\":\"" + titlecolour.get() + "\"}")) { + error("Title is too long, shorten it somehow"); + toggle(); + return; + } ChatUtils.sendPlayerMsg("/title @a[" + friendsString + "] times " + fadein + " " + duration + " " + fadeout); ChatUtils.sendPlayerMsg("/title @a[" + friendsString + "] title {\"text\":\"" + title.get() + "\", \"bold\":" + titlebold.get() + ", \"italic\":" + titleitalic.get() + ", \"color\":\"" + titlecolour.get() + "\"}"); - if (makesubtitle.get())ChatUtils.sendPlayerMsg("/title @a[" + friendsString + "] subtitle {\"text\":\"" + subtitle.get() + "\", \"bold\":" + subtitlebold.get() + ", \"italic\":" + subtitleitalic.get() + ", \"color\":\"" + subtitlecolour.get() + "\"}"); - if (makeactionbar.get())ChatUtils.sendPlayerMsg("/title @a[" + friendsString + "] actionbar {\"text\":\"" + actionbar.get() + "\", \"bold\":" + actionbarbold.get() + ", \"italic\":" + actionbaritalic.get() + ", \"color\":\"" + actionbarcolour.get() + "\"}"); + if (makesubtitle.get() && messageLengthExceedsLimit("/title @a[" + friendsString + "] subtitle {\"text\":\"" + subtitle.get() + "\", \"bold\":" + subtitlebold.get() + ", \"italic\":" + subtitleitalic.get() + ", \"color\":\"" + subtitlecolour.get() + "\"}")) { + error("Subtitle command is too long, shorten it somehow"); + } else if (makesubtitle.get())ChatUtils.sendPlayerMsg("/title @a[" + friendsString + "] subtitle {\"text\":\"" + subtitle.get() + "\", \"bold\":" + subtitlebold.get() + ", \"italic\":" + subtitleitalic.get() + ", \"color\":\"" + subtitlecolour.get() + "\"}"); + if (makeactionbar.get() && messageLengthExceedsLimit("/title @a[" + friendsString + "] actionbar {\"text\":\"" + actionbar.get() + "\", \"bold\":" + actionbarbold.get() + ", \"italic\":" + actionbaritalic.get() + ", \"color\":\"" + actionbarcolour.get() + "\"}")) { + error("Action bar command is too long, shorten it somehow"); + } else if (makeactionbar.get())ChatUtils.sendPlayerMsg("/title @a[" + friendsString + "] actionbar {\"text\":\"" + actionbar.get() + "\", \"bold\":" + actionbarbold.get() + ", \"italic\":" + actionbaritalic.get() + ", \"color\":\"" + actionbarcolour.get() + "\"}"); } toggle(); } @@ -272,6 +299,9 @@ public void onActivate() { public void onTick(TickEvent.Post event) { toggle(); } + private boolean messageLengthExceedsLimit(String message) { + return message.length() > 256; + } public enum fadeinModes { seconds, days } diff --git a/src/main/java/pwn/noobs/trouserstreak/modules/HandOfGod.java b/src/main/java/pwn/noobs/trouserstreak/modules/HandOfGod.java index c51a90f2a..ab167f973 100644 --- a/src/main/java/pwn/noobs/trouserstreak/modules/HandOfGod.java +++ b/src/main/java/pwn/noobs/trouserstreak/modules/HandOfGod.java @@ -761,10 +761,24 @@ else if (trollreplace.get()) friendNames.add("name=!" + player.getProfile().getName()); } String friendsString = String.join(",", friendNames); - if (!trollreplace.get()) - ChatUtils.sendPlayerMsg("/execute at @a[" + friendsString + "] run fill " + "~" + trollwidth.get() + " " + "~" + trollheight.get() + " " + "~" + trolldepth.get() + " " + "~-" + trollwidth.get() + " " + "~-" + trollheight.get() + " " + "~-" + trolldepth.get() + " " + tBlockName); - else if (trollreplace.get()) - ChatUtils.sendPlayerMsg("/execute at @a[" + friendsString + "] run fill " + "~" + trollwidth.get() + " " + "~" + trollheight.get() + " " + "~" + trolldepth.get() + " " + "~-" + trollwidth.get() + " " + "~-" + trollheight.get() + " " + "~-" + trolldepth.get() + " " + tBlockName + " replace " + tRepblockName); + if (!trollreplace.get()){ + String thecommand = "/execute at @a[" + friendsString + "] run fill " + "~" + trollwidth.get() + " " + "~" + trollheight.get() + " " + "~" + trolldepth.get() + " " + "~-" + trollwidth.get() + " " + "~-" + trollheight.get() + " " + "~-" + trolldepth.get() + " " + tBlockName; + if (thecommand.length()<=256){ + ChatUtils.sendPlayerMsg(thecommand); + } + else { + error("Fill Around Other Players Command is too long, you have too many friends online."); + } + } + else if (trollreplace.get()){ + String thecommand2 = "/execute at @a[" + friendsString + "] run fill " + "~" + trollwidth.get() + " " + "~" + trollheight.get() + " " + "~" + trolldepth.get() + " " + "~-" + trollwidth.get() + " " + "~-" + trollheight.get() + " " + "~-" + trolldepth.get() + " " + tBlockName + " replace " + tRepblockName; + if (thecommand2.length()<=256){ + ChatUtils.sendPlayerMsg(thecommand2); + } + else { + error("Fill Around Other Players Command is too long, you have too many friends online."); + } + } } } else if (trollrenderdist.get()){ //every player in render distance diff --git a/src/main/java/pwn/noobs/trouserstreak/modules/LavaAura.java b/src/main/java/pwn/noobs/trouserstreak/modules/LavaAura.java index 33efe5c6c..6527cb89b 100644 --- a/src/main/java/pwn/noobs/trouserstreak/modules/LavaAura.java +++ b/src/main/java/pwn/noobs/trouserstreak/modules/LavaAura.java @@ -14,13 +14,13 @@ import net.minecraft.command.argument.EntityAnchorArgumentType; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Items; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; import net.minecraft.world.GameMode; import net.minecraft.world.RaycastContext; @@ -31,41 +31,99 @@ public class LavaAura extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); - + private final SettingGroup sgLAVA = settings.createGroup("LAVA Options"); + private final SettingGroup sgFIRE = settings.createGroup("FIRE Options"); + private final Setting mode = sgGeneral.add(new EnumSetting.Builder() + .name("mode") + .description("Selects the mode for placing around entities - Lava or Fire.") + .defaultValue(Mode.LAVA) + .build() + ); + private final Setting fireMode = sgGeneral.add(new EnumSetting.Builder() + .name("fire-mode") + .description("Selects the fire mode for placing fire - Flint and Steel or Fire Charge.") + .defaultValue(FireMode.FLINT_AND_STEEL) + .visible(() -> mode.get() == Mode.FIRE) + .build() + ); + public final Setting noburnburning = sgFIRE.add(new BoolSetting.Builder() + .name("No Burn Already Burning") + .description("Do not burn already burning entities") + .defaultValue(true) + .visible(() -> mode.get() == Mode.FIRE) + .build() + ); + public final Setting nolavaburning = sgLAVA.add(new BoolSetting.Builder() + .name("No Lava Already Burning") + .description("Do not Lava already burning entities") + .defaultValue(false) + .visible(() -> mode.get() == Mode.LAVA) + .build() + ); private final Setting>> entities = sgGeneral.add(new EntityTypeListSetting.Builder() .name("entities") .description("Entities to Lava.") - .onlyAttackable() .defaultValue(EntityType.PLAYER, EntityType.VILLAGER) .build() ); public final Setting trollfriends = sgGeneral.add(new BoolSetting.Builder() - .name("Lava Friends") + .name("Lava/Burn Friends") .description("Lava bucket your friends too") .defaultValue(false) .build() ); private final Setting range = sgGeneral.add(new DoubleSetting.Builder() .name("range") - .description("Lava placement range.") + .description("Lava/Fire placement range.") .defaultValue(6) .min(2) .sliderRange(2, 10) .build() ); - public final Setting pickup = sgGeneral.add(new BoolSetting.Builder() + public final Setting pickup = sgLAVA.add(new BoolSetting.Builder() .name("Pickup Lava") .description("pickup lava after placing") .defaultValue(true) + .visible(() -> mode.get() == Mode.LAVA) .build() ); - public final Setting pickuptickdelay = sgGeneral.add(new IntSetting.Builder() + public final Setting pickuptickdelay = sgLAVA.add(new IntSetting.Builder() .name("Lava Pickup Tick Delay") .description("Tick Delay for lava pickup") .defaultValue(1) .min(0) .sliderMax(20) - .visible(() -> pickup.get()) + .visible(() -> pickup.get() && mode.get() == Mode.LAVA) + .build() + ); + public final Setting extinguish = sgFIRE.add(new BoolSetting.Builder() + .name("Extinguish Fire") + .description("extinguish fire after placing") + .defaultValue(true) + .visible(() -> mode.get() == Mode.FIRE) + .build() + ); + public final Setting extinguishtickdelay = sgFIRE.add(new IntSetting.Builder() + .name("Extinguish Fire Tick Delay") + .description("Tick Delay for Extinguish Fire") + .defaultValue(5) + .min(0) + .sliderMax(20) + .visible(() -> extinguish.get() && mode.get() == Mode.FIRE) + .build() + ); + public final Setting norotate = sgFIRE.add(new BoolSetting.Builder() + .name("No Rotations") + .description("do not rotate to the target to burn them") + .defaultValue(true) + .visible(() -> mode.get() == Mode.FIRE) + .build() + ); + public final Setting ignorewalls = sgFIRE.add(new BoolSetting.Builder() + .name("Ignore Walls") + .description("burn things through walls") + .defaultValue(true) + .visible(() -> mode.get() == Mode.FIRE) .build() ); public final Setting maxtargets = sgGeneral.add(new IntSetting.Builder() @@ -77,8 +135,8 @@ public class LavaAura extends Module { .build() ); private final Setting lavaeverything = sgGeneral.add(new BoolSetting.Builder() - .name("Lava-Everything") - .description("Lava all the blocks. Creative mode recommended.") + .name("Lava/Burn-Everything") + .description("Lava or set fire to all the blocks. Creative mode recommended.") .defaultValue(false) .build() ); @@ -94,6 +152,7 @@ public LavaAura() { } private Set lavaPlaced = new HashSet<>(); private int ticks = 0; + private int fireticks = 0; @EventHandler private void onTick(TickEvent.Pre event) { if (!mc.player.isAlive() || PlayerUtils.getGameMode() == GameMode.SPECTATOR) return; @@ -109,7 +168,7 @@ private void onTick(TickEvent.Pre event) { // Sort entities based on distance to the player List sortedEntities = targetedEntities.stream() - .filter(entity -> entity instanceof LivingEntity && entity != mc.player + .filter(entity -> entity instanceof Entity && entity != mc.player && (entities.get().contains(entity.getType()) || (trollfriends.get() && entity instanceof PlayerEntity && !Friends.get().isFriend((PlayerEntity) entity)))) .sorted(Comparator.comparingDouble(entity -> mc.player.getPos().distanceTo(entity.getPos()))) .collect(Collectors.toList()); @@ -120,88 +179,170 @@ private void onTick(TickEvent.Pre event) { if (targets >= maxtargets.get()) { break; } - if (entity instanceof LivingEntity && entity != mc.player) { - if (!entities.get().contains(entity.getType()) || (!trollfriends.get() && entity instanceof PlayerEntity && Friends.get().isFriend((PlayerEntity) entity))) continue; - LivingEntity livingEntity = (LivingEntity) entity; - Vec3d targetPos = livingEntity.getPos(); + if (entity instanceof Entity && entity != mc.player) { + if (!entities.get().contains(entity.getType()) || (!trollfriends.get() && entity instanceof PlayerEntity && Friends.get().isFriend((PlayerEntity) entity))) + continue; + Entity targetEntity = entity; + Vec3d targetPos = targetEntity.getPos(); double distance = mc.player.getPos().distanceTo(entity.getPos()); - BlockHitResult blockHitResult = mc.world.raycast(new RaycastContext( - mc.player.getCameraPosVec(1.0f), - targetPos.add(0,0.05,0), - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.ANY, - mc.player - )); - if (blockHitResult.getType() == HitResult.Type.MISS) { - if (distance <= range.get()) { - //small area around player to not lava - BlockPos targetBlockPos = BlockPos.ofFloored(targetPos); - BlockPos targetBlockPos2 = BlockPos.ofFloored(targetPos).add(0,1,0); - BlockPos targetBlockPos3 = BlockPos.ofFloored(targetPos).add(0,-1,0); - BlockPos targetBlockPos4 = BlockPos.ofFloored(targetPos).add(0,2,0); - BlockPos targetBlockPos5 = BlockPos.ofFloored(targetPos).add(1,1,0); - BlockPos targetBlockPos6 = BlockPos.ofFloored(targetPos).add(0,1,1); - BlockPos targetBlockPos7 = BlockPos.ofFloored(targetPos).add(-1,1,0); - BlockPos targetBlockPos8 = BlockPos.ofFloored(targetPos).add(0,1,-1); - BlockPos targetBlockPos9 = BlockPos.ofFloored(targetPos).add(1,1,1); - BlockPos targetBlockPos10 = BlockPos.ofFloored(targetPos).add(-1,1,-1); - BlockPos targetBlockPos11 = BlockPos.ofFloored(targetPos).add(1,1,-1); - BlockPos targetBlockPos12 = BlockPos.ofFloored(targetPos).add(-1,1,1); - BlockPos targetBlockPos13 = BlockPos.ofFloored(targetPos).add(1,0,0); - BlockPos targetBlockPos14 = BlockPos.ofFloored(targetPos).add(0,0,1); - BlockPos targetBlockPos15 = BlockPos.ofFloored(targetPos).add(-1,0,0); - BlockPos targetBlockPos16 = BlockPos.ofFloored(targetPos).add(0,0,-1); - BlockPos targetBlockPos17 = BlockPos.ofFloored(targetPos).add(1,0,1); - BlockPos targetBlockPos18 = BlockPos.ofFloored(targetPos).add(-1,0,-1); - BlockPos targetBlockPos19 = BlockPos.ofFloored(targetPos).add(1,0,-1); - BlockPos targetBlockPos20 = BlockPos.ofFloored(targetPos).add(-1,0,1); - BlockPos targetBlockPos21 = BlockPos.ofFloored(targetPos).add(1,-1,0); - BlockPos targetBlockPos22 = BlockPos.ofFloored(targetPos).add(0,-1,1); - BlockPos targetBlockPos23 = BlockPos.ofFloored(targetPos).add(-1,-1,0); - BlockPos targetBlockPos24 = BlockPos.ofFloored(targetPos).add(0,-1,-1); - BlockPos targetBlockPos25 = BlockPos.ofFloored(targetPos).add(1,-1,1); - BlockPos targetBlockPos26 = BlockPos.ofFloored(targetPos).add(-1,-1,-1); - BlockPos targetBlockPos27 = BlockPos.ofFloored(targetPos).add(1,-1,-1); - BlockPos targetBlockPos28 = BlockPos.ofFloored(targetPos).add(-1,-1,1); + if (mode.get() == Mode.LAVA || (mode.get() == Mode.FIRE && !ignorewalls.get())) { + BlockHitResult blockHitResult = mc.world.raycast(new RaycastContext( + mc.player.getCameraPosVec(1.0f), + targetPos.add(0, 0.05, 0), + RaycastContext.ShapeType.COLLIDER, + RaycastContext.FluidHandling.ANY, + mc.player + )); + if (blockHitResult.getType() == HitResult.Type.MISS) { + if (distance <= range.get()) { + //small area around player to not lava + BlockPos targetBlockPos = BlockPos.ofFloored(targetPos); + BlockPos targetBlockPos2 = BlockPos.ofFloored(targetPos).add(0, 1, 0); + BlockPos targetBlockPos3 = BlockPos.ofFloored(targetPos).add(0, -1, 0); + BlockPos targetBlockPos4 = BlockPos.ofFloored(targetPos).add(0, 2, 0); + BlockPos targetBlockPos5 = BlockPos.ofFloored(targetPos).add(1, 1, 0); + BlockPos targetBlockPos6 = BlockPos.ofFloored(targetPos).add(0, 1, 1); + BlockPos targetBlockPos7 = BlockPos.ofFloored(targetPos).add(-1, 1, 0); + BlockPos targetBlockPos8 = BlockPos.ofFloored(targetPos).add(0, 1, -1); + BlockPos targetBlockPos9 = BlockPos.ofFloored(targetPos).add(1, 1, 1); + BlockPos targetBlockPos10 = BlockPos.ofFloored(targetPos).add(-1, 1, -1); + BlockPos targetBlockPos11 = BlockPos.ofFloored(targetPos).add(1, 1, -1); + BlockPos targetBlockPos12 = BlockPos.ofFloored(targetPos).add(-1, 1, 1); + BlockPos targetBlockPos13 = BlockPos.ofFloored(targetPos).add(1, 0, 0); + BlockPos targetBlockPos14 = BlockPos.ofFloored(targetPos).add(0, 0, 1); + BlockPos targetBlockPos15 = BlockPos.ofFloored(targetPos).add(-1, 0, 0); + BlockPos targetBlockPos16 = BlockPos.ofFloored(targetPos).add(0, 0, -1); + BlockPos targetBlockPos17 = BlockPos.ofFloored(targetPos).add(1, 0, 1); + BlockPos targetBlockPos18 = BlockPos.ofFloored(targetPos).add(-1, 0, -1); + BlockPos targetBlockPos19 = BlockPos.ofFloored(targetPos).add(1, 0, -1); + BlockPos targetBlockPos20 = BlockPos.ofFloored(targetPos).add(-1, 0, 1); + BlockPos targetBlockPos21 = BlockPos.ofFloored(targetPos).add(1, -1, 0); + BlockPos targetBlockPos22 = BlockPos.ofFloored(targetPos).add(0, -1, 1); + BlockPos targetBlockPos23 = BlockPos.ofFloored(targetPos).add(-1, -1, 0); + BlockPos targetBlockPos24 = BlockPos.ofFloored(targetPos).add(0, -1, -1); + BlockPos targetBlockPos25 = BlockPos.ofFloored(targetPos).add(1, -1, 1); + BlockPos targetBlockPos26 = BlockPos.ofFloored(targetPos).add(-1, -1, -1); + BlockPos targetBlockPos27 = BlockPos.ofFloored(targetPos).add(1, -1, -1); + BlockPos targetBlockPos28 = BlockPos.ofFloored(targetPos).add(-1, -1, 1); - if (!targetBlockPos.equals(mc.player.getBlockPos()) && - !targetBlockPos2.equals(mc.player.getBlockPos()) && - !targetBlockPos3.equals(mc.player.getBlockPos()) && - !targetBlockPos4.equals(mc.player.getBlockPos()) && - !targetBlockPos5.equals(mc.player.getBlockPos()) && - !targetBlockPos6.equals(mc.player.getBlockPos()) && - !targetBlockPos7.equals(mc.player.getBlockPos()) && - !targetBlockPos8.equals(mc.player.getBlockPos()) && - !targetBlockPos9.equals(mc.player.getBlockPos()) && - !targetBlockPos10.equals(mc.player.getBlockPos()) && - !targetBlockPos11.equals(mc.player.getBlockPos()) && - !targetBlockPos12.equals(mc.player.getBlockPos()) && - !targetBlockPos13.equals(mc.player.getBlockPos()) && - !targetBlockPos14.equals(mc.player.getBlockPos()) && - !targetBlockPos15.equals(mc.player.getBlockPos()) && - !targetBlockPos16.equals(mc.player.getBlockPos()) && - !targetBlockPos17.equals(mc.player.getBlockPos()) && - !targetBlockPos18.equals(mc.player.getBlockPos()) && - !targetBlockPos19.equals(mc.player.getBlockPos()) && - !targetBlockPos20.equals(mc.player.getBlockPos()) && - !targetBlockPos21.equals(mc.player.getBlockPos()) && - !targetBlockPos22.equals(mc.player.getBlockPos()) && - !targetBlockPos23.equals(mc.player.getBlockPos()) && - !targetBlockPos24.equals(mc.player.getBlockPos()) && - !targetBlockPos25.equals(mc.player.getBlockPos()) && - !targetBlockPos26.equals(mc.player.getBlockPos()) && - !targetBlockPos27.equals(mc.player.getBlockPos()) && - !targetBlockPos28.equals(mc.player.getBlockPos()) - ) { - if (mc.world.getBlockState(targetBlockPos).getBlock() != Blocks.WATER && mc.world.getBlockState(targetBlockPos).getBlock() != Blocks.LAVA) { - mc.player.lookAt(EntityAnchorArgumentType.EntityAnchor.EYES, targetPos.add(0,0.05,0)); - placeLava(); + + if (!targetBlockPos.equals(mc.player.getBlockPos()) && + !targetBlockPos2.equals(mc.player.getBlockPos()) && + !targetBlockPos3.equals(mc.player.getBlockPos()) && + !targetBlockPos4.equals(mc.player.getBlockPos()) && + !targetBlockPos5.equals(mc.player.getBlockPos()) && + !targetBlockPos6.equals(mc.player.getBlockPos()) && + !targetBlockPos7.equals(mc.player.getBlockPos()) && + !targetBlockPos8.equals(mc.player.getBlockPos()) && + !targetBlockPos9.equals(mc.player.getBlockPos()) && + !targetBlockPos10.equals(mc.player.getBlockPos()) && + !targetBlockPos11.equals(mc.player.getBlockPos()) && + !targetBlockPos12.equals(mc.player.getBlockPos()) && + !targetBlockPos13.equals(mc.player.getBlockPos()) && + !targetBlockPos14.equals(mc.player.getBlockPos()) && + !targetBlockPos15.equals(mc.player.getBlockPos()) && + !targetBlockPos16.equals(mc.player.getBlockPos()) && + !targetBlockPos17.equals(mc.player.getBlockPos()) && + !targetBlockPos18.equals(mc.player.getBlockPos()) && + !targetBlockPos19.equals(mc.player.getBlockPos()) && + !targetBlockPos20.equals(mc.player.getBlockPos()) && + !targetBlockPos21.equals(mc.player.getBlockPos()) && + !targetBlockPos22.equals(mc.player.getBlockPos()) && + !targetBlockPos23.equals(mc.player.getBlockPos()) && + !targetBlockPos24.equals(mc.player.getBlockPos()) && + !targetBlockPos25.equals(mc.player.getBlockPos()) && + !targetBlockPos26.equals(mc.player.getBlockPos()) && + !targetBlockPos27.equals(mc.player.getBlockPos()) && + !targetBlockPos28.equals(mc.player.getBlockPos()) + ) { + if (mc.world.getBlockState(targetBlockPos).getBlock() != Blocks.WATER && mc.world.getBlockState(targetBlockPos).getBlock() != Blocks.LAVA) { + if (mode.get() == Mode.LAVA) { + mc.player.lookAt(EntityAnchorArgumentType.EntityAnchor.EYES, targetPos.add(0, 0.05, 0)); + if (nolavaburning.get() && !entity.isOnFire()) placeLava(); + else if (!nolavaburning.get()) placeLava(); + } else if (mode.get() == Mode.FIRE) { + if (!norotate.get()) + mc.player.lookAt(EntityAnchorArgumentType.EntityAnchor.EYES, targetPos.add(0, 0.05, 0)); + if (noburnburning.get() && !entity.isOnFire()) placeFire(targetBlockPos); + else if (!noburnburning.get()) placeFire(targetBlockPos); + } + } } } } + } else if (mode.get() == Mode.FIRE && ignorewalls.get()){ + if (distance <= range.get()) { + //small area around player to not lava + BlockPos targetBlockPos = BlockPos.ofFloored(targetPos); + BlockPos targetBlockPos2 = BlockPos.ofFloored(targetPos).add(0, 1, 0); + BlockPos targetBlockPos3 = BlockPos.ofFloored(targetPos).add(0, -1, 0); + BlockPos targetBlockPos4 = BlockPos.ofFloored(targetPos).add(0, 2, 0); + BlockPos targetBlockPos5 = BlockPos.ofFloored(targetPos).add(1, 1, 0); + BlockPos targetBlockPos6 = BlockPos.ofFloored(targetPos).add(0, 1, 1); + BlockPos targetBlockPos7 = BlockPos.ofFloored(targetPos).add(-1, 1, 0); + BlockPos targetBlockPos8 = BlockPos.ofFloored(targetPos).add(0, 1, -1); + BlockPos targetBlockPos9 = BlockPos.ofFloored(targetPos).add(1, 1, 1); + BlockPos targetBlockPos10 = BlockPos.ofFloored(targetPos).add(-1, 1, -1); + BlockPos targetBlockPos11 = BlockPos.ofFloored(targetPos).add(1, 1, -1); + BlockPos targetBlockPos12 = BlockPos.ofFloored(targetPos).add(-1, 1, 1); + BlockPos targetBlockPos13 = BlockPos.ofFloored(targetPos).add(1, 0, 0); + BlockPos targetBlockPos14 = BlockPos.ofFloored(targetPos).add(0, 0, 1); + BlockPos targetBlockPos15 = BlockPos.ofFloored(targetPos).add(-1, 0, 0); + BlockPos targetBlockPos16 = BlockPos.ofFloored(targetPos).add(0, 0, -1); + BlockPos targetBlockPos17 = BlockPos.ofFloored(targetPos).add(1, 0, 1); + BlockPos targetBlockPos18 = BlockPos.ofFloored(targetPos).add(-1, 0, -1); + BlockPos targetBlockPos19 = BlockPos.ofFloored(targetPos).add(1, 0, -1); + BlockPos targetBlockPos20 = BlockPos.ofFloored(targetPos).add(-1, 0, 1); + BlockPos targetBlockPos21 = BlockPos.ofFloored(targetPos).add(1, -1, 0); + BlockPos targetBlockPos22 = BlockPos.ofFloored(targetPos).add(0, -1, 1); + BlockPos targetBlockPos23 = BlockPos.ofFloored(targetPos).add(-1, -1, 0); + BlockPos targetBlockPos24 = BlockPos.ofFloored(targetPos).add(0, -1, -1); + BlockPos targetBlockPos25 = BlockPos.ofFloored(targetPos).add(1, -1, 1); + BlockPos targetBlockPos26 = BlockPos.ofFloored(targetPos).add(-1, -1, -1); + BlockPos targetBlockPos27 = BlockPos.ofFloored(targetPos).add(1, -1, -1); + BlockPos targetBlockPos28 = BlockPos.ofFloored(targetPos).add(-1, -1, 1); + + + if (!targetBlockPos.equals(mc.player.getBlockPos()) && + !targetBlockPos2.equals(mc.player.getBlockPos()) && + !targetBlockPos3.equals(mc.player.getBlockPos()) && + !targetBlockPos4.equals(mc.player.getBlockPos()) && + !targetBlockPos5.equals(mc.player.getBlockPos()) && + !targetBlockPos6.equals(mc.player.getBlockPos()) && + !targetBlockPos7.equals(mc.player.getBlockPos()) && + !targetBlockPos8.equals(mc.player.getBlockPos()) && + !targetBlockPos9.equals(mc.player.getBlockPos()) && + !targetBlockPos10.equals(mc.player.getBlockPos()) && + !targetBlockPos11.equals(mc.player.getBlockPos()) && + !targetBlockPos12.equals(mc.player.getBlockPos()) && + !targetBlockPos13.equals(mc.player.getBlockPos()) && + !targetBlockPos14.equals(mc.player.getBlockPos()) && + !targetBlockPos15.equals(mc.player.getBlockPos()) && + !targetBlockPos16.equals(mc.player.getBlockPos()) && + !targetBlockPos17.equals(mc.player.getBlockPos()) && + !targetBlockPos18.equals(mc.player.getBlockPos()) && + !targetBlockPos19.equals(mc.player.getBlockPos()) && + !targetBlockPos20.equals(mc.player.getBlockPos()) && + !targetBlockPos21.equals(mc.player.getBlockPos()) && + !targetBlockPos22.equals(mc.player.getBlockPos()) && + !targetBlockPos23.equals(mc.player.getBlockPos()) && + !targetBlockPos24.equals(mc.player.getBlockPos()) && + !targetBlockPos25.equals(mc.player.getBlockPos()) && + !targetBlockPos26.equals(mc.player.getBlockPos()) && + !targetBlockPos27.equals(mc.player.getBlockPos()) && + !targetBlockPos28.equals(mc.player.getBlockPos()) + ) { + if (mc.world.getBlockState(targetBlockPos).getBlock() != Blocks.WATER && mc.world.getBlockState(targetBlockPos).getBlock() != Blocks.LAVA) { + if (!norotate.get()) + mc.player.lookAt(EntityAnchorArgumentType.EntityAnchor.EYES, targetPos.add(0, 0.05, 0)); + if (noburnburning.get() && !entity.isOnFire()) placeFire(targetBlockPos); + else if (!noburnburning.get()) placeFire(targetBlockPos); + } + } + } } } targets++; @@ -210,16 +351,21 @@ private void onTick(TickEvent.Pre event) { if (lavaeverything.get()) { BlockPos playerPos = mc.player.getBlockPos(); - for (int x = (int) -Math.round(range.get()); x <= range.get(); x++) { - for (int y = (int) -Math.round(range.get()); y <= range.get(); y++) { - for (int z = (int) -Math.round(range.get()); z <= range.get(); z++) { + for (int x = (int) -Math.round(range.get()); x < range.get(); x++) { + for (int y = (int) -Math.round(range.get()); y < range.get(); y++) { + for (int z = (int) -Math.round(range.get()); z < range.get(); z++) { BlockPos blockPos = playerPos.add(x, y, z); if (mc.world.getBlockState(blockPos).getBlock() != Blocks.AIR && mc.world.getBlockState(blockPos).getBlock() != Blocks.WATER && mc.world.getBlockState(blockPos).getBlock() != Blocks.LAVA) { // Check if the block has not had lava placed on it if (!lavaPlaced.contains(blockPos)) { - mc.player.lookAt(EntityAnchorArgumentType.EntityAnchor.EYES, new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ())); - placeLava(); + if (mode.get() == Mode.LAVA) { + mc.player.lookAt(EntityAnchorArgumentType.EntityAnchor.EYES, new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ())); + placeLava(); + } else if (mode.get() == Mode.FIRE) { + if (!norotate.get())mc.player.lookAt(EntityAnchorArgumentType.EntityAnchor.EYES, new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ())); + placeFire(blockPos.up()); + }; // Add the block to the set to indicate that lava has been placed on it lavaPlaced.add(blockPos); @@ -229,7 +375,7 @@ private void onTick(TickEvent.Pre event) { } } } - if (pickup.get() && !lavaeverything.get()){ + if (mode.get() == Mode.LAVA && pickup.get() && !lavaeverything.get()){ if (ticks=pickuptickdelay.get()){ @@ -237,8 +383,18 @@ private void onTick(TickEvent.Pre event) { ticks=0; } } - mc.player.setYaw(originalYaw); - mc.player.setPitch(originalPitch); + else if (mode.get() == Mode.FIRE && extinguish.get() && !lavaeverything.get()){ + if (fireticks=extinguishtickdelay.get()){ + extinguishFireOnTick(); + fireticks=0; + } + } + if (mode.get() == Mode.LAVA || (mode.get() == Mode.FIRE && !norotate.get())){ + mc.player.setYaw(originalYaw); + mc.player.setPitch(originalPitch); + } } private void placeLava() { FindItemResult findItemResult = InvUtils.findInHotbar(Items.LAVA_BUCKET); @@ -250,6 +406,21 @@ private void placeLava() { mc.interactionManager.interactItem(mc.player,Hand.MAIN_HAND); mc.player.getInventory().selectedSlot = prevSlot; } + private void placeFire(BlockPos targetBlockPos) { + FindItemResult findItemResult = InvUtils.findInHotbar(Items.FLINT_AND_STEEL);; + if (fireMode.get() == FireMode.FIRE_CHARGE) { + findItemResult = InvUtils.findInHotbar(Items.FIRE_CHARGE); + } + + if (!findItemResult.found()) { + return; // Exit if the required item is not found + } + int prevSlot = mc.player.getInventory().selectedSlot; + mc.player.getInventory().selectedSlot = findItemResult.slot(); + mc.interactionManager.interactBlock(mc.player, Hand.MAIN_HAND, new BlockHitResult( + new Vec3d(targetBlockPos.getX(), targetBlockPos.getY(), targetBlockPos.getZ()), Direction.UP, targetBlockPos.down(), false)); + mc.player.getInventory().selectedSlot = prevSlot; + } private void pickUpLavaOnTick() { BlockPos playerPos = mc.player.getBlockPos(); @@ -278,6 +449,39 @@ private void pickUpLavaOnTick() { } } } + private void extinguishFireOnTick() { + BlockPos playerPos = mc.player.getBlockPos(); + + for (int x = (int) -Math.round(range.get()+1); x <= range.get()+1; x++) { + for (int y = (int) -Math.round(range.get()+1); y <= range.get()+1; y++) { + for (int z = (int) -Math.round(range.get()+1); z <= range.get()+1; z++) { + BlockPos blockPos = playerPos.add(x, y, z); + BlockState blockState = mc.world.getBlockState(blockPos); + + if (blockState.getBlock() == Blocks.FIRE) { + if (!ignorewalls.get()){ + // Perform a raycast to check for obstructions + BlockHitResult blockHitResult = mc.world.raycast(new RaycastContext( + mc.player.getCameraPosVec(1.0f), + new Vec3d(blockPos.getX(), blockPos.getY()+0.25, blockPos.getZ()), + RaycastContext.ShapeType.COLLIDER, + RaycastContext.FluidHandling.NONE, + mc.player + )); + + if (blockHitResult.getType() == HitResult.Type.MISS) { + if (!norotate.get()) mc.player.lookAt(EntityAnchorArgumentType.EntityAnchor.EYES, new Vec3d(blockPos.getX(), blockPos.getY()+0.25, blockPos.getZ())); + mc.interactionManager.attackBlock(blockPos, Direction.DOWN); + } + } else if (ignorewalls.get()){ + if (!norotate.get()) mc.player.lookAt(EntityAnchorArgumentType.EntityAnchor.EYES, new Vec3d(blockPos.getX(), blockPos.getY()+0.25, blockPos.getZ())); + mc.interactionManager.attackBlock(blockPos, Direction.DOWN); + } + } + } + } + } + } private void pickupLiquid() { FindItemResult findItemResult = InvUtils.findInHotbar(Items.BUCKET); if (!findItemResult.found()) { @@ -288,4 +492,12 @@ private void pickupLiquid() { mc.interactionManager.interactItem(mc.player, Hand.MAIN_HAND); mc.player.getInventory().selectedSlot = prevSlot; } + public enum Mode { + LAVA, + FIRE + } + public enum FireMode { + FLINT_AND_STEEL, + FIRE_CHARGE + } } \ No newline at end of file diff --git a/src/main/java/pwn/noobs/trouserstreak/modules/OPServerKillModule.java b/src/main/java/pwn/noobs/trouserstreak/modules/OPServerKillModule.java index bdb09d467..025b14fa2 100644 --- a/src/main/java/pwn/noobs/trouserstreak/modules/OPServerKillModule.java +++ b/src/main/java/pwn/noobs/trouserstreak/modules/OPServerKillModule.java @@ -149,7 +149,13 @@ else if (nocrashfrend.get()) { if(Friends.get().isFriend(player) && nocrashfrend.get()) friendNames.add("name=!" + player.getProfile().getName()); } String friendsString = String.join(",", friendNames); - ChatUtils.sendPlayerMsg("/execute at @a[" + friendsString + "] run particle ash ~ ~ ~ 1 1 1 1 2147483647 force @a[" + friendsString + "]"); + String thecommand = "/execute at @a[" + friendsString + "] run particle ash ~ ~ ~ 1 1 1 1 2147483647 force @a[" + friendsString + "]"; + if (thecommand.length()<=256){ + ChatUtils.sendPlayerMsg(thecommand); + } + else { + error("Crash all players command is too long, you have too many friends online."); + } } } if (ticks == 3*tickdelay.get()){ @@ -173,7 +179,13 @@ else if (nocrashfrend.get()) { if(Friends.get().isFriend(player) && nocrashfrend.get()) friendNames.add("name=!" + player.getProfile().getName()); } String friendsString = String.join(",", friendNames); - ChatUtils.sendPlayerMsg("/execute at @a[" + friendsString + "] run particle ash ~ ~ ~ 1 1 1 1 2147483647 force @a[" + friendsString + "]"); + String thecommand2 = "/execute at @a[" + friendsString + "] run particle ash ~ ~ ~ 1 1 1 1 2147483647 force @a[" + friendsString + "]"; + if (thecommand2.length()<=256){ + ChatUtils.sendPlayerMsg(thecommand2); + } + else { + error("Crash all players command is too long, you have too many friends online."); + } } } if (ticks == 3*tickdelay.get()){ @@ -200,7 +212,13 @@ else if (nocrashfrend.get()) { if(Friends.get().isFriend(player) && nocrashfrend.get()) friendNames.add("name=!" + player.getProfile().getName()); } String friendsString = String.join(",", friendNames); - ChatUtils.sendPlayerMsg("/execute at @a[" + friendsString + "] run particle ash ~ ~ ~ 1 1 1 1 2147483647 force @a[" + friendsString + "]"); + String thecommand2 = "/execute at @a[" + friendsString + "] run particle ash ~ ~ ~ 1 1 1 1 2147483647 force @a[" + friendsString + "]"; + if (thecommand2.length()<=256){ + ChatUtils.sendPlayerMsg(thecommand2); + } + else { + error("Crash all players command is too long, you have too many friends online."); + } } } if (ticks == 4*tickdelay.get()){ //kill server diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0d326b0b8..ca4437ddc 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "streak-addon", - "version": "0.8.2", + "version": "0.8.3", "name": "TrouserStreak", "description": "Trouser-Streak is a compilation of modules, updated to the latest version and optimized for maximum grief. I did not make all of these.", "authors": [