Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.20.6 #50

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
}

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21

archivesBaseName = project.archives_base_name
version = project.mod_version
Expand Down Expand Up @@ -64,7 +64,7 @@ tasks.withType(Jar) {
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"

def targetVersion = 17
def targetVersion = 21

if (JavaVersion.current().isJava9Compatible()) {
it.options.release = targetVersion
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ org.gradle.jvmargs = -Xmx4G

# Fabric Properties

minecraft_version = 1.19.4
yarn_version = 1.19.4+build.1
loader_version = 0.14.17
minecraft_version = 1.20.6
yarn_version = 1.20.6+build.3
loader_version = 0.16.4

# Mod Properties

Expand All @@ -14,4 +14,4 @@ archives_base_name = vector-addon

# Meteor Client

meteor_version = 0.5.3
meteor_version = 0.5.7
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
16 changes: 8 additions & 8 deletions src/main/java/cally72jhb/addon/VectorAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import cally72jhb.addon.modules.render.*;
import cally72jhb.addon.utils.ExecutorTask;
import meteordevelopment.meteorclient.addons.MeteorAddon;
import meteordevelopment.meteorclient.systems.commands.Commands;
import meteordevelopment.meteorclient.commands.Commands;
import meteordevelopment.meteorclient.systems.modules.Modules;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -61,13 +61,13 @@ public void onInitialize() {

// Commands

Commands.get().add(new CenterCommand());
Commands.get().add(new DesyncCommand());
Commands.get().add(new ItemCommand());
Commands.get().add(new PlayerHeadCommand());
Commands.get().add(new TeleportCommand());
Commands.get().add(new TrashCommand());
Commands.get().add(new UUIDCommand());
Commands.add(new CenterCommand());
Commands.add(new DesyncCommand());
Commands.add(new ItemCommand());
Commands.add(new PlayerHeadCommand());
Commands.add(new TeleportCommand());
Commands.add(new TrashCommand());
Commands.add(new UUIDCommand());

// Done Initializing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class PlayerArgumentType implements ArgumentType<PlayerEntity> {
if (mc.world != null) {
EXAMPLES = mc.world.getPlayers()
.stream()
.map(PlayerEntity::getEntityName)
.map(PlayerEntity::getNameForScoreboard)
.collect(Collectors.toList()
);
}
Expand Down Expand Up @@ -53,7 +53,7 @@ public PlayerEntity parse(StringReader reader) throws CommandSyntaxException {
PlayerEntity player = null;

for (PlayerEntity entity : mc.world.getPlayers()) {
if (entity.getEntityName().equalsIgnoreCase(argument)) {
if (entity.getDisplayName().getString().equalsIgnoreCase(argument)) {
player = entity;
break;
}
Expand All @@ -66,7 +66,7 @@ public PlayerEntity parse(StringReader reader) throws CommandSyntaxException {

@Override
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
return CommandSource.suggestMatching(mc.world.getPlayers().stream().map(PlayerEntity::getEntityName), builder);
return CommandSource.suggestMatching(mc.world.getPlayers().stream().map(PlayerEntity::getNameForScoreboard), builder);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class PlayerNameArgumentType implements ArgumentType<String> {
if (mc.world != null && mc.getNetworkHandler() != null) {
EXAMPLES = mc.world.getPlayers()
.stream()
.map(PlayerEntity::getEntityName)
.map(PlayerEntity::getNameForScoreboard)
.collect(Collectors.toList()
);

Expand Down Expand Up @@ -60,7 +60,7 @@ public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> cont
Collection<String> suggestions = new ArrayList<>(
mc.world.getPlayers()
.stream()
.map(PlayerEntity::getEntityName)
.map(PlayerEntity::getNameForScoreboard)
.toList()
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package cally72jhb.addon.commands.commands;

import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.systems.commands.Command;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.command.CommandSource;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;

import static com.mojang.brigadier.Command.SINGLE_SUCCESS;

public class CenterCommand extends Command {
public CenterCommand() {
super("center", "Centers you on the block you are currently standing on.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package cally72jhb.addon.commands.commands;

import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.systems.commands.Command;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
import net.minecraft.network.packet.c2s.play.TeleportConfirmC2SPacket;

import static com.mojang.brigadier.Command.SINGLE_SUCCESS;

public class DesyncCommand extends Command {
private Entity entity = null;

Expand All @@ -31,7 +29,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
}
} else {
if (!mc.player.hasVehicle()) {
mc.world.addEntity(this.entity.getId(), this.entity);
mc.world.addEntity(this.entity);
mc.player.startRiding(this.entity, true);

this.entity = null;
Expand Down Expand Up @@ -59,7 +57,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
}
} else {
if (!mc.player.hasVehicle()) {
mc.world.addEntity(this.entity.getId(), this.entity);
mc.world.addEntity(this.entity);
mc.player.startRiding(this.entity, true);

this.entity = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import meteordevelopment.meteorclient.systems.commands.Command;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.command.CommandSource;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket;
Expand All @@ -16,8 +16,6 @@

import java.util.List;

import static com.mojang.brigadier.Command.SINGLE_SUCCESS;

public class ItemCommand extends Command {
public ItemCommand() {
super("item", "Allows you to put any item in any slot in your inventory.", "move");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import meteordevelopment.meteorclient.systems.commands.Command;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.command.CommandSource;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.NbtComponent;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.StringNbtReader;
Expand All @@ -19,8 +21,6 @@

import java.util.Random;

import static com.mojang.brigadier.Command.SINGLE_SUCCESS;

public class PlayerHeadCommand extends Command {
private final static SimpleCommandExceptionType NO_CREATIVE = new SimpleCommandExceptionType(Text.literal("You must be in creative mode to use this."));

Expand Down Expand Up @@ -69,11 +69,11 @@ private void giveHead(String player, int amount) throws CommandSyntaxException {

if (array != null) {
if (amount > 1) stack.setCount(MathHelper.clamp(amount, 1, 64));

stack.setNbt(StringNbtReader.parse(
//TODO: actual nbt string needs updating
stack.set(DataComponentTypes.ENTITY_DATA, NbtComponent.of(StringNbtReader.parse(
"{SkullOwner:{Id:" + id + ",Properties:{textures:[{Value:\""
+ array.get("properties").getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()
+ "\"}]}}}")
+ "\"}]}}}"))
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
import com.mojang.brigadier.arguments.FloatArgumentType;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.systems.commands.Command;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket;
import net.minecraft.util.math.Vec3d;

import static com.mojang.brigadier.Command.SINGLE_SUCCESS;

public class TeleportCommand extends Command {
public TeleportCommand() {
super("teleport", "Allows to teleport small distances.", "tp");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import cally72jhb.addon.utils.Utils;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.systems.commands.Command;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.command.CommandSource;
import net.minecraft.screen.slot.SlotActionType;

import static com.mojang.brigadier.Command.SINGLE_SUCCESS;

public class TrashCommand extends Command {
public TrashCommand() {
super("trash", "Destroys the item you are holding in your hand.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import cally72jhb.addon.commands.arguments.PlayerArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.systems.commands.Command;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.player.PlayerEntity;

import static com.mojang.brigadier.Command.SINGLE_SUCCESS;

public class UUIDCommand extends Command {
public UUIDCommand() {
super("uuid", "Returns a players uuid.");
Expand All @@ -25,7 +23,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
PlayerEntity player = PlayerArgumentType.getPlayer(context, "player");

if (player != null) {
info(player.getEntityName() + "'s UUID is " + player.getUuid().toString());
info(player.getDisplayName() + "'s UUID is " + player.getUuid().toString());
}

return SINGLE_SUCCESS;
Expand Down
25 changes: 5 additions & 20 deletions src/main/java/cally72jhb/addon/mixin/ClientConnectionMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,16 @@
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.Queue;

//Seems to work the same ??
@Mixin(ClientConnection.class)
public abstract class ClientConnectionMixin {
@Shadow public abstract boolean isOpen();
@Shadow protected abstract void sendQueuedPackets();
@Shadow protected abstract void sendImmediately(Packet<?> packet, @Nullable PacketCallbacks callbacks);

@Shadow @Final private Queue<ClientConnection.QueuedPacket> packetQueue;
@Shadow protected abstract void sendImmediately(Packet<?> packet, @Nullable PacketCallbacks callbacks, boolean flush);

@Inject(method = "send(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/PacketCallbacks;)V", at = @At("HEAD"), cancellable = true)
private void onSend(Packet<?> packet, PacketCallbacks callbacks, CallbackInfo info) {
Expand Down Expand Up @@ -57,10 +51,7 @@ private void onSend(Packet<?> packet, PacketCallbacks callbacks, CallbackInfo in
info.cancel();

if (this.isOpen()) {
this.sendQueuedPackets();
this.sendImmediately(modified, callbacks);
} else {
this.packetQueue.add(new ClientConnection.QueuedPacket(modified, callbacks));
this.sendImmediately(modified, callbacks, true);
}
} else if (packet instanceof PlayerMoveC2SPacket.Full move) {
PlayerMoveC2SPacket.Full modified = new PlayerMoveC2SPacket.Full(
Expand All @@ -76,10 +67,7 @@ private void onSend(Packet<?> packet, PacketCallbacks callbacks, CallbackInfo in
info.cancel();

if (this.isOpen()) {
this.sendQueuedPackets();
this.sendImmediately(modified, callbacks);
} else {
this.packetQueue.add(new ClientConnection.QueuedPacket(modified, callbacks));
this.sendImmediately(modified, callbacks, true);
}
} else if (packet instanceof VehicleMoveC2SPacket move) {
BoatEntity entity = new BoatEntity(EntityType.BOAT, mc.world);
Expand All @@ -98,10 +86,7 @@ private void onSend(Packet<?> packet, PacketCallbacks callbacks, CallbackInfo in
info.cancel();

if (this.isOpen()) {
this.sendQueuedPackets();
this.sendImmediately(modified, callbacks);
} else {
this.packetQueue.add(new ClientConnection.QueuedPacket(modified, callbacks));
this.sendImmediately(modified, callbacks, true);
}
}
}
Expand Down
Loading