Skip to content

Commit 84a238d

Browse files
committed
bookchat
1 parent b898e4f commit 84a238d

File tree

5 files changed

+152
-26
lines changed

5 files changed

+152
-26
lines changed

src/main/java/com/nxyi/addon/Addon.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public class Addon extends MeteorAddon {
2525
@Override
2626
public void onInitialize() {
2727
LOG.info("Kawaii Mode Activated");
28-
master
2928

3029
// Modules
3130
Modules.get().add(new SpamBypass());
@@ -50,13 +49,13 @@ public void onInitialize() {
5049
Modules.get().add(new Groupmessage());
5150
Modules.get().add(new RainbowArmor());
5251
Modules.get().add(new PenisESP());
53-
Modules.get().add(new SleepDetector());
5452
Modules.get().add(new EntityFly());
5553
Modules.get().add(new FakeAttack());
5654
Modules.get().add(new AutoHorn());
5755
Modules.get().add(new AntiSpawnpoint());
5856
Modules.get().add(new phase());
5957
Modules.get().add(new AntiBorder());
58+
Modules.get().add(new Bookchat());
6059

6160

6261
// Commands
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.nxyi.addon.Utils;
2+
3+
import net.minecraft.client.MinecraftClient;
4+
import net.minecraft.item.Item;
5+
import net.minecraft.item.Items;
6+
import net.minecraft.screen.slot.SlotActionType;
7+
8+
public class InvUtils {
9+
private static MinecraftClient client = MinecraftClient.getInstance();
10+
11+
public static int finditem(Item item) {
12+
int index = -1;
13+
for(int i = 0; i < 45; i++) {
14+
if(MinecraftClient.getInstance().player.getInventory().getStack(i).getItem() == item) {
15+
index = i;
16+
break;
17+
}
18+
}
19+
return index;
20+
}
21+
22+
public static int findItemInHotbar(Item item) {
23+
int index = -1;
24+
for(int i = 0; i < 9; i++) {
25+
if(MinecraftClient.getInstance().player.getInventory().getStack(i).getItem() == item) {
26+
index = i;
27+
break;
28+
}
29+
}
30+
return index;
31+
}
32+
33+
public static int getamount(Item item) {
34+
int amount = 0;
35+
for(int i = 0; i < 45; i++) {
36+
if(MinecraftClient.getInstance().player.getInventory().getStack(i).getItem() == item) {
37+
amount = amount + 1;
38+
}
39+
}
40+
return amount;
41+
}
42+
43+
public static void movetoslot(int to, int from){
44+
client.interactionManager.clickSlot(0, InvUtils.getslot(from), 0, SlotActionType.PICKUP, client.player);
45+
client.interactionManager.clickSlot(0, to, 0, SlotActionType.PICKUP, client.player);
46+
client.interactionManager.clickSlot(0, InvUtils.getslot(from), 0, SlotActionType.PICKUP, client.player);
47+
}
48+
49+
public static int getslot(int index) {
50+
return index < 9 ? index + 36 : index;
51+
}
52+
}

src/main/java/com/nxyi/addon/Utils/JinxUtils.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
import static meteordevelopment.meteorclient.MeteorClient.mc;
3232

3333
public class JinxUtils {
34+
35+
public static void sleep(long ms) {
36+
try {
37+
Thread.sleep(ms);
38+
} catch (Exception ignored) {
39+
}
40+
}
3441
public static final List<String> ANTICHEAT_LIST = Arrays.asList("grimac", "nocheatplus", "negativity", "warden", "horizon", "illegalstack", "coreprotect", "exploitsx", "vulcan", "abc", "spartan", "kauri", "anticheatreloaded", "witherac", "godseye", "matrix", "wraith");
3542
public static void sendSignedMessage(String message) {
3643
if (message.startsWith("/")) mc.player.sendMessage(Text.of(message.substring(1)));
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package com.nxyi.addon.modules;
2+
3+
import com.google.common.base.Splitter;
4+
import com.nxyi.addon.Addon;
5+
import com.nxyi.addon.Utils.InvUtils;
6+
import meteordevelopment.meteorclient.events.game.SendMessageEvent;
7+
import meteordevelopment.meteorclient.events.world.TickEvent;
8+
import meteordevelopment.meteorclient.settings.BoolSetting;
9+
import meteordevelopment.meteorclient.settings.Setting;
10+
import meteordevelopment.meteorclient.settings.SettingGroup;
11+
import meteordevelopment.meteorclient.settings.StringSetting;
12+
import meteordevelopment.meteorclient.systems.modules.Module;
13+
import meteordevelopment.orbit.EventHandler;
14+
import net.minecraft.entity.player.PlayerEntity;
15+
import net.minecraft.item.Items;
16+
import net.minecraft.nbt.NbtCompound;
17+
import net.minecraft.nbt.NbtElement;
18+
import net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket;
19+
import net.minecraft.screen.slot.SlotActionType;
20+
import net.minecraft.util.Hand;
21+
22+
import java.lang.reflect.Array;
23+
import java.util.*;
24+
25+
public class Bookchat extends Module {
26+
27+
public Bookchat() {
28+
super(Addon.CATEGORY, "Bookchat", "Secretly chat using books");
29+
}
30+
31+
public String lasttext = null;
32+
private final SettingGroup sgGeneral = this.settings.getDefaultGroup();
33+
private final Setting<String> person = sgGeneral.add(new StringSetting.Builder().name("Person").description("Person your chatting with").defaultValue("").build());
34+
35+
private final Setting<Boolean> autobook = sgGeneral.add(new BoolSetting.Builder()
36+
.name("autoswitchbook")
37+
.description("Automatically hold the book on chat if not in hand")
38+
.defaultValue(true)
39+
.build()
40+
);
41+
42+
@EventHandler
43+
private void onchat(SendMessageEvent event){
44+
String msg = mc.player.getEntityName() + " : " + event.message;
45+
event.cancel();
46+
if (mc.player.getMainHandStack().getItem().equals(Items.WRITABLE_BOOK)){
47+
int index = InvUtils.finditem(Items.WRITABLE_BOOK);
48+
if (index == -1) {
49+
info("you are not holding a book");
50+
return;
51+
}
52+
info(msg);
53+
mc.player.networkHandler.sendPacket(new BookUpdateC2SPacket(mc.player.getInventory().selectedSlot, Collections.singletonList(msg), Optional.empty()));
54+
}
55+
}
56+
57+
@Override
58+
public void onActivate() {
59+
lasttext = "";
60+
if (person.get().isEmpty()){
61+
toggle();
62+
info("please put the username of the person you want to chat with in the module settings");
63+
}
64+
}
65+
66+
@EventHandler
67+
private void ontick(TickEvent.Pre event){
68+
PlayerEntity playerEntity = null;
69+
70+
if (person.get().isEmpty()) return;
71+
for (PlayerEntity p : mc.world.getPlayers()){
72+
if (p.getEntityName().equalsIgnoreCase(person.get())){
73+
playerEntity = p;
74+
}
75+
}
76+
77+
if (playerEntity == null) return;
78+
79+
if (playerEntity.getMainHandStack().getItem().equals(Items.WRITABLE_BOOK)){
80+
String text = playerEntity.getMainHandStack().getNbt().get("pages").toString()
81+
.replaceAll("\\]", "")
82+
.replaceAll("\\[", "")
83+
.replaceAll("\"", "")
84+
.replaceAll("," , " ");
85+
86+
if (Objects.equals(lasttext, text)) return;
87+
88+
lasttext = text;
89+
info(text);
90+
}
91+
}
92+
}

src/main/java/com/nxyi/addon/modules/SleepDetector.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)