Skip to content

Commit

Permalink
chore(legacy): Improved option exclusion/hide process. (CCBlueX#4320)
Browse files Browse the repository at this point in the history
Also fixed player item hand being considered a block by SilentHotbar when actual slot is not on the chosen slot that has a block.
  • Loading branch information
mems01 authored Nov 1, 2024
1 parent 3072e16 commit a6d5961
Show file tree
Hide file tree
Showing 15 changed files with 185 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class ModuleCommand(val module: Module, val values: Set<Value<*>> = module.value

return when (args.size) {
1 -> values
.filter { it !is FontValue && it.isSupported() && it.name.startsWith(args[0], true) }
.filter { it !is FontValue && it.shouldRender() && it.name.startsWith(args[0], true) }
.map { it.name.lowercase() }
2 -> {
when (module[args[0]]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ object AutoPot : Module("AutoPot", Category.COMBAT, hideModule = false) {
private val mode by ListValue("Mode", arrayOf("Normal", "Jump", "Port"), "Normal")

private val options = RotationSettings(this).withoutKeepRotation().apply {
applyServerSideValue.isSupported = { false }
applyServerSideValue.note = BoolValue.NoteType.HIDE
resetTicksValue.isSupported = { false }
applyServerSideValue.hideWithState(false)
resetTicksValue.hideWithState()

immediate = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ object NoRotateSet : Module("NoRotateSet", Category.MISC, gameDetecting = false,
val affectRotation by BoolValue("AffectRotation", true)

private val options = RotationSettings(this) { affectRotation }.apply {
applyServerSideValue.isSupported = { false }
applyServerSideValue.note = BoolValue.NoteType.HIDE
resetTicksValue.isSupported = { false }
applyServerSideValue.excludeWithState(true)
resetTicksValue.excludeWithState(1)

withoutKeepRotation()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ object Nuker : Module("Nuker", Category.WORLD, gameDetecting = false, hideModule
private val options = RotationSettings(this).apply {
immediate = true

resetTicksValue.isSupported = { false }
resetTicksValue.hideWithState()
withoutKeepRotation()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ object Scaffold : Module("Scaffold", Category.WORLD, Keyboard.KEY_I, hideModule
private val modeList = ListValue("Rotations", arrayOf("Off", "Normal", "Stabilized", "GodBridge"), "Normal")

private val options = RotationSettingsWithRotationModes(this, modeList).apply {
strictValue.isSupported = { false }
strictValue.excludeWithState()
resetTicksValue.setSupport { { it && scaffoldMode != "Telly" } }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ public class MixinInventoryPlayer {
@Redirect(method = {"getCurrentItem", "decrementAnimations", "getStrVsBlock"}, at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/InventoryPlayer;currentItem:I", opcode = Opcodes.GETFIELD))
private int hookSilentHotbar(InventoryPlayer instance) {
return instance.player instanceof EntityPlayerSP ? SilentHotbar.INSTANCE.getCurrentSlot() : instance.currentItem;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import net.ccbluex.liquidbounce.features.module.modules.combat.KillAura;
import net.ccbluex.liquidbounce.features.module.modules.movement.NoSlow;
import net.ccbluex.liquidbounce.features.module.modules.render.SilentHotbarModule;
import net.ccbluex.liquidbounce.utils.SilentHotbar;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.model.ModelPlayer;
Expand All @@ -30,30 +32,35 @@ public abstract class MixinRenderPlayer {
* @author CCBlueX
*/
@Overwrite
private void setModelVisibilities(AbstractClientPlayer p_setModelVisibilities_1_) {
private void setModelVisibilities(AbstractClientPlayer entity) {
ModelPlayer modelplayer = this.getMainModel();
if (p_setModelVisibilities_1_.isSpectator()) {
if (entity.isSpectator()) {
modelplayer.setInvisible(false);
modelplayer.bipedHead.showModel = true;
modelplayer.bipedHeadwear.showModel = true;
} else {
ItemStack itemstack = p_setModelVisibilities_1_.inventory.getCurrentItem();
SilentHotbarModule module = SilentHotbarModule.INSTANCE;

int slot = SilentHotbar.INSTANCE.renderSlot(module.handleEvents() && module.getKeepItemInHandInThirdPerson());

ItemStack itemstack = entity instanceof EntityPlayerSP ? entity.inventory.getStackInSlot(slot) : entity.getHeldItem();

modelplayer.setInvisible(true);
modelplayer.bipedHeadwear.showModel = p_setModelVisibilities_1_.isWearing(EnumPlayerModelParts.HAT);
modelplayer.bipedBodyWear.showModel = p_setModelVisibilities_1_.isWearing(EnumPlayerModelParts.JACKET);
modelplayer.bipedLeftLegwear.showModel = p_setModelVisibilities_1_.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG);
modelplayer.bipedRightLegwear.showModel = p_setModelVisibilities_1_.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG);
modelplayer.bipedLeftArmwear.showModel = p_setModelVisibilities_1_.isWearing(EnumPlayerModelParts.LEFT_SLEEVE);
modelplayer.bipedRightArmwear.showModel = p_setModelVisibilities_1_.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE);
modelplayer.bipedHeadwear.showModel = entity.isWearing(EnumPlayerModelParts.HAT);
modelplayer.bipedBodyWear.showModel = entity.isWearing(EnumPlayerModelParts.JACKET);
modelplayer.bipedLeftLegwear.showModel = entity.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG);
modelplayer.bipedRightLegwear.showModel = entity.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG);
modelplayer.bipedLeftArmwear.showModel = entity.isWearing(EnumPlayerModelParts.LEFT_SLEEVE);
modelplayer.bipedRightArmwear.showModel = entity.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE);
modelplayer.heldItemLeft = 0;
modelplayer.aimedBow = false;
modelplayer.isSneak = p_setModelVisibilities_1_.isSneaking();
modelplayer.isSneak = entity.isSneaking();
if (itemstack == null) {
modelplayer.heldItemRight = 0;
} else {
modelplayer.heldItemRight = 1;
boolean isForceBlocking = p_setModelVisibilities_1_ instanceof EntityPlayerSP && ((itemstack.getItem() instanceof ItemSword && KillAura.INSTANCE.getRenderBlocking()) || NoSlow.INSTANCE.isUNCPBlocking());
if (p_setModelVisibilities_1_.getItemInUseCount() > 0 || isForceBlocking) {
boolean isForceBlocking = entity instanceof EntityPlayerSP && ((itemstack.getItem() instanceof ItemSword && KillAura.INSTANCE.getRenderBlocking()) || NoSlow.INSTANCE.isUNCPBlocking());
if (entity.getItemInUseCount() > 0 || isForceBlocking) {
EnumAction enumaction = isForceBlocking? EnumAction.BLOCK : itemstack.getItemUseAction();
if (enumaction == EnumAction.BLOCK) {
modelplayer.heldItemRight = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ object BlackStyle : Style() {
)

// Draw settings
val moduleValues = moduleElement.module.values.filter { it.isSupported() }
val moduleValues = moduleElement.module.values.filter { it.shouldRender() }
if (moduleValues.isNotEmpty()) {
font35.drawString(
if (moduleElement.showSettings) "<" else ">",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ object LiquidBounceStyle : Style() {
} else Int.MAX_VALUE
)

val moduleValues = moduleElement.module.values.filter { it.isSupported() }
val moduleValues = moduleElement.module.values.filter { it.shouldRender() }
if (moduleValues.isNotEmpty()) {
font35.drawString(
if (moduleElement.showSettings) "-" else "+",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ object NullStyle : Style() {
} else Int.MAX_VALUE
)

val moduleValues = moduleElement.module.values.filter { it.isSupported() }
val moduleValues = moduleElement.module.values.filter { it.shouldRender() }
if (moduleValues.isNotEmpty()) {
font35.drawString(
if (moduleElement.showSettings) "-" else "+",
Expand Down
Loading

0 comments on commit a6d5961

Please sign in to comment.