bug fixes maybe, add module hashcolor on hud
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m18s

This commit is contained in:
Jess H 2024-06-15 01:03:26 +01:00
parent fcb1b0ed9f
commit 8afd259e75
Signed by: UnixSystemV
GPG key ID: 9B21C50B68D67F19
4 changed files with 33 additions and 4 deletions

View file

@ -3,6 +3,8 @@ package de.com.baseband.client.feature;
import de.com.baseband.client.BaseBand;
import de.com.baseband.client.event.KeyManager;
import de.com.baseband.client.feature.category.Command;
import de.com.baseband.client.gui.lib.component.Button;
import de.com.baseband.client.gui.lib.component.Component;
import de.com.baseband.client.gui.lib.component.*;
import de.com.baseband.client.registry.AnyGate;
import de.com.baseband.client.registry.ConfigHandle;
@ -12,9 +14,11 @@ import de.com.baseband.client.registry.annotation.*;
import de.com.baseband.client.util.adapt.FieldFinder;
import de.com.baseband.client.util.adapt.Marker;
import de.com.baseband.client.util.type.KeyBind;
import de.tudbut.tools.Hasher;
import net.minecraft.client.Minecraft;
import net.minecraftforge.common.MinecraftForge;
import java.awt.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -44,6 +48,12 @@ public abstract class Feature extends ToggleButton implements SetCommand {
this.setLambda(this::updateEnabled);
}
public final int color = getHashColor();
private int getHashColor() {
return Color.decode("#"+Hasher.sha256hex(toString()).substring(0,6)).getRGB();
}
// feature methods
protected boolean defaultEnable() {

View file

@ -139,6 +139,10 @@ public class HUD extends Feature {
@Description("Renders a slightly transparent background below the HUD")
public boolean background = true;
@Config("Module HashColors")
@Description("Gets the Module color from a hash of the module's name")
public boolean hashColor = false;
@Config("Text shadow")
public boolean textShadow = true;
@ -233,7 +237,7 @@ public class HUD extends Feature {
TextSplitter.drawString(initString, 3,3, theme.getGreenColor(), textShadow, false);
int y = 3 + TextSplitter.getStringHeight(initString);
for (Feature f : renderFeatures) {
mc.fontRenderer.drawString(f.text, 3, y, theme.getGreenColor(), textShadow);
mc.fontRenderer.drawString(f.text, 3, y, hashColor ? f.color : theme.getGreenColor(), textShadow);
y = y + mc.fontRenderer.FONT_HEIGHT;
}

View file

@ -5,8 +5,10 @@ import de.com.baseband.client.feature.Feature;
import de.com.baseband.client.feature.category.World;
import de.com.baseband.client.mixin.mixins.IPlayerControllerMP;
import de.com.baseband.client.registry.annotation.Config;
import net.minecraft.client.Minecraft;
import net.minecraft.network.play.client.CPacketPlayerDigging;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
@World
public class FastBreak extends Feature {
@ -24,7 +26,8 @@ public class FastBreak extends Feature {
public enum Mode {
Damage,
Packet
Packet,
Instant
}
@Override
@ -51,8 +54,19 @@ public class FastBreak extends Feature {
mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, event.getBlockPos(), event.getEnumFacing()));
event.setCancelled(true);
}
if (mode == Mode.Instant) {
mc.player.swingArm(EnumHand.MAIN_HAND);
mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, event.getBlockPos(), event.getEnumFacing()));
event.setCancelled(true);
}
if (mode == Mode.Damage && ((IPlayerControllerMP) mc.playerController).getDamage() >= 0.7f) {
((IPlayerControllerMP) mc.playerController).setDamage(1.0f);
}
}
private boolean isNotUnbreakable(BlockPos pos) {
return mc.world.getBlockState(pos).getBlock().getBlockHardness(mc.world.getBlockState(pos), Minecraft.getMinecraft().world, pos) != -1;
}
}

View file

@ -4,6 +4,7 @@ import de.com.baseband.client.feature.Feature;
import de.com.baseband.client.feature.Features;
import de.com.baseband.client.feature.category.World;
import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
import net.minecraft.util.EnumHand;
@World
public class FastUse extends Feature {
@ -14,8 +15,8 @@ public class FastUse extends Feature {
@Override
public void onTick() {
if (mc.gameSettings.keyBindUseItem.isKeyDown() && !Features.getFeature(AutoEat.class).eating) {
mc.getConnection().sendPacket(new CPacketPlayerTryUseItem(mc.player.getActiveHand()));
if (mc.gameSettings.keyBindUseItem.isKeyDown() && !mc.player.getHeldItemMainhand().isEmpty() && !Features.getFeature(AutoEat.class).eating) {
mc.getConnection().sendPacket(new CPacketPlayerTryUseItem(EnumHand.MAIN_HAND));
}
}
}