-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nxyi
committed
Sep 10, 2024
1 parent
34af99c
commit ca08a2e
Showing
3 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.dark.zewo2.commands; | ||
|
||
import com.mojang.brigadier.builder.LiteralArgumentBuilder; | ||
import meteordevelopment.meteorclient.commands.Command; | ||
import net.minecraft.command.CommandSource; | ||
import net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket; | ||
import net.minecraft.screen.slot.SlotActionType; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Optional; | ||
|
||
public class DupeCommand extends Command { | ||
public DupeCommand() { | ||
super("dupe", "popbobsexdupe"); | ||
} | ||
|
||
@Override | ||
public void build(LiteralArgumentBuilder<CommandSource> builder) { | ||
builder.executes(context -> { | ||
ArrayList<String> pages = new ArrayList<>(); | ||
pages.add("real"); | ||
mc.player.networkHandler.sendPacket(new BookUpdateC2SPacket(mc.player.getInventory().selectedSlot, pages, Optional.of("veryrealpopbobsexdupe2024realpopbobrealreal"))); | ||
return 1; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.dark.zewo2.modules; | ||
|
||
import com.dark.zewo2.Addon; | ||
import meteordevelopment.meteorclient.events.packets.PacketEvent; | ||
import meteordevelopment.meteorclient.settings.BoolSetting; | ||
import meteordevelopment.meteorclient.settings.Setting; | ||
import meteordevelopment.meteorclient.settings.SettingGroup; | ||
import meteordevelopment.meteorclient.systems.modules.Module; | ||
import meteordevelopment.meteorclient.utils.player.ChatUtils; | ||
import meteordevelopment.orbit.EventHandler; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.network.packet.s2c.play.EntityStatusS2CPacket; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
public class TotemNotifier extends Module { | ||
final Map<UUID, Integer> popMap = new HashMap<>(); | ||
|
||
private final SettingGroup sgGeneral = settings.getDefaultGroup(); | ||
|
||
private Setting<Boolean> announce = sgGeneral.add(new BoolSetting.Builder() | ||
.name("Announce") | ||
.description("Announce the pop in chat") | ||
.defaultValue(false) | ||
.build()); | ||
|
||
private Setting<Boolean> self = sgGeneral.add(new BoolSetting.Builder() | ||
.name("Self") | ||
.description("Include yourself in the pops.") | ||
.defaultValue(false) | ||
.build()); | ||
|
||
public TotemNotifier() { | ||
super(Addon.CATEGORY, "TotemNotifier", "Notify you when someone pops a totem"); | ||
} | ||
|
||
@Override | ||
public void onActivate() { | ||
popMap.clear(); | ||
} | ||
|
||
@EventHandler | ||
private void onReceivePacket(PacketEvent.Receive event) { | ||
if (!(event.packet instanceof EntityStatusS2CPacket packet)) return; | ||
|
||
if (packet.getStatus() != 35) return; | ||
|
||
Entity entity = packet.getEntity(mc.world); | ||
|
||
if (entity == mc.player && !self.get()) return; | ||
|
||
if (!(entity instanceof PlayerEntity player)) return; | ||
|
||
int pops = popMap.getOrDefault(player.getUuid(), 0); | ||
popMap.put(player.getUuid(), ++pops); | ||
|
||
String message = "%s has popped their %s totem".formatted(player.getGameProfile().getName(), pops); | ||
|
||
if (announce.get()) ChatUtils.sendPlayerMsg(message); | ||
else ChatUtils.info(message); | ||
} | ||
} |