Skip to content
Open
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
24 changes: 23 additions & 1 deletion src/main/java/org/icetank/AutoAnvilRenameModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.ShulkerBoxBlock;
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
import org.rusherhack.client.api.events.client.EventUpdate;
import org.rusherhack.client.api.feature.module.ModuleCategory;
import org.rusherhack.client.api.feature.module.ToggleableModule;
Expand All @@ -32,6 +33,27 @@ public class AutoAnvilRenameModule extends ToggleableModule {
private final BooleanSetting autoXP = new BooleanSetting("AutoXP", false);
private int delay = 0;

private void throwXPBottle() {
if (mc.player == null) return;

float yaw = mc.player.getYRot();

// Not quite 90degrees for better reliability
float pitch = 87.5f;


// serverside rotation
mc.player.connection.send(
new ServerboundMovePlayerPacket.Rot(yaw, pitch, mc.player.onGround(), mc.player.horizontalCollision)
);

// throw bottle at feet
mc.player.connection.send(
new ServerboundUseItemPacket(
InteractionHand.MAIN_HAND, 0, yaw, pitch)
);
}

public AutoAnvilRenameModule() {
super("AutoAnvilRename", "Renames items in an anvil automatically", ModuleCategory.CLIENT);

Expand Down Expand Up @@ -85,7 +107,7 @@ void tick() {
}

if (mc.player.isHolding(Items.EXPERIENCE_BOTTLE)) {
mc.player.connection.send(new ServerboundUseItemPacket(InteractionHand.MAIN_HAND, 1, 1, 1));
throwXPBottle();
}
}

Expand Down