Port to 1.20.2 (#305)
Co-authored-by: Cloudburst <18114966+C10udburst@users.noreply.github.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.client.gui.screen.recipebook.RecipeResultCollection;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeEntry;
|
||||
import net.minecraft.screen.CraftingScreenHandler;
|
||||
import net.minecraft.screen.slot.SlotActionType;
|
||||
|
||||
@@ -70,8 +71,8 @@ public class AutoCraft extends Module {
|
||||
List<Item> itemList = items.get();
|
||||
List<RecipeResultCollection> recipeResultCollectionList = mc.player.getRecipeBook().getOrderedResults();
|
||||
for (RecipeResultCollection recipeResultCollection : recipeResultCollectionList) {
|
||||
for (Recipe<?> recipe : recipeResultCollection.getRecipes(true)) {
|
||||
if (!itemList.contains(recipe.getOutput(mc.world.getRegistryManager()).getItem())) continue;
|
||||
for (RecipeEntry<?> recipe : recipeResultCollection.getRecipes(true)) {
|
||||
if (!itemList.contains(recipe.value().getResult(mc.world.getRegistryManager()).getItem())) continue;
|
||||
mc.interactionManager.clickRecipe(currentScreenHandler.syncId, recipe, craftAll.get());
|
||||
mc.interactionManager.clickSlot(currentScreenHandler.syncId, 0, 1,
|
||||
drop.get() ? SlotActionType.THROW : SlotActionType.QUICK_MOVE, mc.player);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class AutoGrind extends Module {
|
||||
|
||||
if (mc.currentScreen == null) break;
|
||||
|
||||
InvUtils.quickMove().slot(i);
|
||||
InvUtils.quickSwap().slot(i);
|
||||
InvUtils.move().fromId(2).to(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class AutoSoup extends Module {
|
||||
|
||||
// move soup in inventory to hotbar
|
||||
if (soupInInventory != -1)
|
||||
InvUtils.quickMove().slot(soupInInventory);
|
||||
InvUtils.quickSwap().slot(soupInInventory);
|
||||
}
|
||||
|
||||
private int findSoup(int startSlot, int endSlot) {
|
||||
|
||||
@@ -54,16 +54,16 @@ public class BungeeCordSpoof extends Module {
|
||||
|
||||
@EventHandler
|
||||
private void onPacketSend(PacketEvent.Send event) {
|
||||
if (event.packet instanceof HandshakeC2SPacket packet && packet.getIntendedState() == NetworkState.LOGIN) {
|
||||
if (event.packet instanceof HandshakeC2SPacket packet && packet.getNewNetworkState() == NetworkState.LOGIN) {
|
||||
if (whitelist.get() && !whitelistedServers.get().contains(Utils.getWorldName())) return;
|
||||
String address = packet.getAddress() + "\0" + forwardedIP + "\0" + mc.getSession().getUuid().replace("-", "")
|
||||
String address = packet.address() + "\0" + forwardedIP + "\0" + mc.getSession().getUuidOrNull().toString().replace("-", "")
|
||||
+ (spoofProfile.get() ? getProperty() : "");
|
||||
((HandshakeC2SPacketAccessor) packet).setAddress(address);
|
||||
((HandshakeC2SPacketAccessor) (Object) packet).setAddress(address);
|
||||
}
|
||||
}
|
||||
|
||||
private String getProperty() {
|
||||
PropertyMap propertyMap = mc.getSession().getProfile().getProperties();
|
||||
PropertyMap propertyMap = mc.getGameProfile().getProperties();
|
||||
return "\0" + GSON.toJson(propertyMap.values().toArray());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ColorSigns extends Module {
|
||||
}
|
||||
|
||||
private void checkWarning() {
|
||||
String brand = mc.player.getServerBrand();
|
||||
String brand = mc.player.getServer().getServerModName();
|
||||
if (brand == null) return;
|
||||
if (brand.contains("Paper")) warning("You are on a paper server. Color signs won't work here");
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import meteordevelopment.meteorclient.events.packets.PacketEvent;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
@@ -13,7 +14,7 @@ import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.player.ChatUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
|
||||
import net.minecraft.text.HoverEvent;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.Text;
|
||||
@@ -53,27 +54,33 @@ public class CustomPackets extends Module {
|
||||
@EventHandler
|
||||
private void onCustomPayloadPacket(PacketEvent.Receive event) {
|
||||
if (event.packet instanceof CustomPayloadS2CPacket packet) {
|
||||
switch (packet.getChannel().toString()) {
|
||||
switch (packet.payload().id().toString()) {
|
||||
case "badlion:mods" -> event.setCancelled(onBadlionModsPacket(packet));
|
||||
default -> onUnknownPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PacketByteBuf buffer = new PacketByteBuf(Unpooled.buffer());
|
||||
|
||||
private void onUnknownPacket(CustomPayloadS2CPacket packet) {
|
||||
if (!unknownPackets.get()) return;
|
||||
MutableText text = Text.literal(packet.getChannel().toString());
|
||||
MutableText text = Text.literal(packet.payload().id().toString());
|
||||
buffer.clear();
|
||||
packet.payload().write(buffer);
|
||||
text.setStyle(text.getStyle()
|
||||
.withHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
Text.literal(readString(packet.getData()))
|
||||
)));
|
||||
Text.literal(readString(buffer)
|
||||
))));
|
||||
info(text);
|
||||
}
|
||||
|
||||
private boolean onBadlionModsPacket(CustomPayloadS2CPacket packet) {
|
||||
if (!mods.get()) return false;
|
||||
String json = readString(packet.getData());
|
||||
buffer.clear();
|
||||
packet.payload().write(buffer);
|
||||
String json = readString(buffer);
|
||||
Map<String, BadlionMod> mods = GSON_NON_PRETTY.fromJson(json, BADLION_MODS_TYPE);
|
||||
ChatUtils.sendMsg("Badlion", format("Mods", formatMods(mods)));
|
||||
return true;
|
||||
|
||||
@@ -171,12 +171,12 @@ public class NewChunks extends Module {
|
||||
else if (event.packet instanceof ChunkDataS2CPacket && mc.world != null) {
|
||||
ChunkDataS2CPacket packet = (ChunkDataS2CPacket) event.packet;
|
||||
|
||||
ChunkPos pos = new ChunkPos(packet.getX(), packet.getZ());
|
||||
ChunkPos pos = new ChunkPos(packet.getChunkX(), packet.getChunkZ());
|
||||
|
||||
if (!newChunks.contains(pos) && mc.world.getChunkManager().getChunk(packet.getX(), packet.getZ()) == null) {
|
||||
if (!newChunks.contains(pos) && mc.world.getChunkManager().getChunk(packet.getChunkX(), packet.getChunkZ()) == null) {
|
||||
WorldChunk chunk = new WorldChunk(mc.world, pos);
|
||||
try {
|
||||
chunk.loadFromPacket(packet.getChunkData().getSectionsDataBuf(), new NbtCompound(), packet.getChunkData().getBlockEntities(packet.getX(), packet.getZ()));
|
||||
chunk.loadFromPacket(packet.getChunkData().getSectionsDataBuf(), new NbtCompound(), packet.getChunkData().getBlockEntities(packet.getChunkX(), packet.getChunkZ()));
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user