Skip to content

Commit

Permalink
Update reach module given changes in recent versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Wide-Cat committed Sep 5, 2024
1 parent 9c62310 commit 29d8d01
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ private void onGetOffGroundSpeed(CallbackInfoReturnable<Float> info) {

@ModifyReturnValue(method = "getBlockInteractionRange", at = @At("RETURN"))
private double modifyBlockInteractionRange(double original) {
return Modules.get().get(Reach.class).blockReach();
return Math.max(0, original + Modules.get().get(Reach.class).blockReach());
}

@ModifyReturnValue(method = "getEntityInteractionRange", at = @At("RETURN"))
private double modifyEntityInteractionRange(double original) {
return Modules.get().get(Reach.class).entityReach();
return Math.max(0, original + Modules.get().get(Reach.class).entityReach());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,47 @@

package meteordevelopment.meteorclient.systems.modules.player;

import meteordevelopment.meteorclient.gui.GuiTheme;
import meteordevelopment.meteorclient.gui.widgets.WWidget;
import meteordevelopment.meteorclient.settings.DoubleSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Categories;
import meteordevelopment.meteorclient.systems.modules.Module;
import net.minecraft.entity.attribute.EntityAttributes;
import meteordevelopment.meteorclient.utils.Utils;

public class Reach extends Module {
private final SettingGroup sgGeneral = settings.getDefaultGroup();

private final Setting<Double> blockReach = sgGeneral.add(new DoubleSetting.Builder()
.name("block-reach")
.description("The reach modifier for blocks.")
.defaultValue(4.5)
.min(0)
.sliderMax(6)
.name("extra-block-reach")
.description("The distance to add to your block reach.")
.sliderMax(1)
.build()
);

private final Setting<Double> entityReach = sgGeneral.add(new DoubleSetting.Builder()
.name("entity-reach")
.description("The reach modifier for entities.")
.defaultValue(3)
.min(0)
.sliderMax(6)
.name("extra-entity-reach")
.description("The distance to add to your entity reach.")
.sliderMax(1)
.build()
);

public Reach() {
super(Categories.Player, "reach", "Gives you super long arms.");
}

@Override
public WWidget getWidget(GuiTheme theme) {
return theme.label("Note: on vanilla servers you may give yourself up to 4 blocks of additional reach for specific actions - " +
"interacting with block entities (chests, furnaces, etc.) or with vehicles. This does not work on paper servers.", Utils.getWindowWidth() / 3.0);
}

public double blockReach() {
if (!isActive()) return mc.player.getAttributeValue(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE);
return blockReach.get().floatValue();
return isActive() ? blockReach.get() : 0;
}

public double entityReach() {
if (!isActive()) return mc.player.getAttributeValue(EntityAttributes.PLAYER_ENTITY_INTERACTION_RANGE);
return entityReach.get().floatValue();
return isActive() ? entityReach.get() : 0;
}
}

1 comment on commit 29d8d01

@Nekiplay
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gg

Please sign in to comment.