Skip to content

Commit

Permalink
Major Highway Builder fixes and improvements. (#4999)
Browse files Browse the repository at this point in the history
For a highlight of the new features, check the body of the pull request.
  • Loading branch information
Wide-Cat authored Jan 25, 2025
1 parent 979ebf0 commit dc76fe1
Show file tree
Hide file tree
Showing 9 changed files with 1,542 additions and 295 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.sugar.Local;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.entity.player.ItemUseCrosshairTargetEvent;
import meteordevelopment.meteorclient.events.game.GameLeftEvent;
import meteordevelopment.meteorclient.events.game.OpenScreenEvent;
import meteordevelopment.meteorclient.events.game.ResourcePacksReloadedEvent;
import meteordevelopment.meteorclient.events.game.ResolutionChangedEvent;
import meteordevelopment.meteorclient.events.game.ResourcePacksReloadedEvent;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.gui.WidgetScreen;
import meteordevelopment.meteorclient.mixininterface.IMinecraftClient;
import meteordevelopment.meteorclient.systems.config.Config;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.player.FastUse;
import meteordevelopment.meteorclient.systems.modules.player.Multitask;
import meteordevelopment.meteorclient.systems.modules.world.HighwayBuilder;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.misc.CPSUtils;
import meteordevelopment.meteorclient.utils.misc.MeteorStarscript;
Expand All @@ -34,6 +36,7 @@
import net.minecraft.client.option.GameOptions;
import net.minecraft.client.util.Window;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.profiler.Profilers;
Expand Down Expand Up @@ -163,6 +166,18 @@ private String setTitle(String original) {
return customTitle;
}

// Have to add this condition if we want to draw back a bow using packets, without it getting cancelled by vanilla code
@WrapWithCondition(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;stopUsingItem(Lnet/minecraft/entity/player/PlayerEntity;)V"))
private boolean wrapStopUsing(ClientPlayerInteractionManager instance, PlayerEntity player) {
return HB$stopUsingItem();
}

@Unique
private boolean HB$stopUsingItem() {
HighwayBuilder b = Modules.get().get(HighwayBuilder.class);
return !b.isActive() || !b.drawingBow;
}

@Inject(method = "onResolutionChanged", at = @At("TAIL"))
private void onResolutionChanged(CallbackInfo info) {
MeteorClient.EVENT_BUS.post(ResolutionChangedEvent.get());
Expand Down Expand Up @@ -203,7 +218,7 @@ private boolean handleInputEventsModifyIsUsingItem(boolean original) {
@Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z", ordinal = 0, shift = At.Shift.BEFORE))
private void handleInputEventsInjectStopUsingItem(CallbackInfo info) {
if (Modules.get().get(Multitask.class).attackingEntities() && player.isUsingItem()) {
if (!options.useKey.isPressed()) interactionManager.stopUsingItem(player);
if (!options.useKey.isPressed() && HB$stopUsingItem()) interactionManager.stopUsingItem(player);
while (options.useKey.wasPressed());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.mixin;

import net.minecraft.inventory.Inventory;
import net.minecraft.screen.ShulkerBoxScreenHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(ShulkerBoxScreenHandler.class)
public interface ShulkerBoxScreenHandlerAccessor {
@Accessor("inventory")
Inventory meteor$getInventory();
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class AutoEat extends Module {

// General

private final Setting<List<Item>> blacklist = sgGeneral.add(new ItemListSetting.Builder()
public final Setting<List<Item>> blacklist = sgGeneral.add(new ItemListSetting.Builder()
.name("blacklist")
.description("Which items to not eat.")
.defaultValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import meteordevelopment.meteorclient.systems.modules.Categories;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.world.HighwayBuilder;
import meteordevelopment.meteorclient.systems.modules.world.PacketMine;
import meteordevelopment.meteorclient.utils.render.color.Color;
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
Expand Down Expand Up @@ -43,7 +44,6 @@ public class BreakIndicators extends Module {
.build()
);


private final Setting<SettingColor> startColor = sgGeneral.add(new ColorSetting.Builder()
.name("start-color")
.description("The color for the non-broken block.")
Expand Down Expand Up @@ -72,6 +72,25 @@ private void onRender(Render3DEvent event) {
if (packetMine.get() && !Modules.get().get(PacketMine.class).blocks.isEmpty()) {
renderPacket(event, Modules.get().get(PacketMine.class).blocks);
}

HighwayBuilder b = Modules.get().get(HighwayBuilder.class);
if (!b.isActive()) return;

if (b.normalMining != null) {
VoxelShape voxelShape = b.normalMining.blockState.getOutlineShape(mc.world, b.normalMining.blockPos);
if (voxelShape.isEmpty()) return;

double normalised = Math.min(1, b.normalMining.progress());
renderBlock(event, voxelShape.getBoundingBox(), b.normalMining.blockPos, 1 - normalised, normalised);
}

if (b.packetMining != null) {
VoxelShape voxelShape = b.packetMining.blockState.getOutlineShape(mc.world, b.packetMining.blockPos);
if (voxelShape.isEmpty()) return;

double normalised = Math.min(1, b.packetMining.progress());
renderBlock(event, voxelShape.getBoundingBox(), b.packetMining.blockPos, 1 - normalised, normalised);
}
}

private void renderNormal(Render3DEvent event) {
Expand Down
Loading

0 comments on commit dc76fe1

Please sign in to comment.