feat: Minecraft 1.21.4 (#4980)

* feat: 1.21.4

* merge

* fix: detekt

* update baseline

* progress

* fix(MixinItem): consumableComponent can sometimes be null, I guess

* chore(MixinItem#hookSwordUse): add braces before detekt and ccetl scream at me

* feat: NoSlowBundle

* a

* refactor: no-slow

* fix: blur
- the nametags are still not quite right

* readd: limitExplosionStrength

* feat/fix: -the fakeplayer now regenerates
          -update libraries
          -outline esp

* fix: FramebufferShader

* merge

* fix: make the outline esp not look trashy

* fix: blend

* fix: ItemFramebufferRenderer

* rename GlobalFrameBuffer -> GlobalFramebuffer

* Fixed problems from review

---------

Co-authored-by: DataM0del <183248792+DataM0del@users.noreply.github.com>
Co-authored-by: yaraksan <arschwixxa123@gmail.com>
This commit is contained in:
ccetl
2024-12-23 17:21:45 +01:00
committed by GitHub
parent 1cb4e87fe6
commit e231efd047
252 changed files with 2313 additions and 1823 deletions

1
.gitignore vendored
View File

@@ -9,3 +9,4 @@
/run/
/mcef/
/logs/
/.kotlin/

View File

@@ -28,9 +28,11 @@ plugins {
id "org.jetbrains.dokka" version "1.9.10"
}
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
base {
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
}
configurations {
includeDependency

View File

@@ -18,8 +18,6 @@
<ID>BracesOnIfStatements:FlyGrim2859V.kt$FlyGrim2859V$if</ID>
<ID>BracesOnIfStatements:ItemImageAtlas.kt$ItemImageAtlas$if</ID>
<ID>BracesOnIfStatements:ModuleAntiExploit.kt$ModuleAntiExploit$if</ID>
<ID>BracesOnIfStatements:ModuleAutoBow.kt$ModuleAutoBow$else</ID>
<ID>BracesOnIfStatements:ModuleAutoBow.kt$ModuleAutoBow$if</ID>
<ID>BracesOnIfStatements:ModuleAutoFarm.kt$ModuleAutoFarm$if</ID>
<ID>BracesOnIfStatements:ModuleBlockESP.kt$ModuleBlockESP.Glow$if</ID>
<ID>BracesOnIfStatements:ModuleBlockESP.kt$ModuleBlockESP.Outline$if</ID>
@@ -87,7 +85,6 @@
<ID>LongMethod:CommandScript.kt$CommandScript$override fun createCommand(): Command</ID>
<ID>LongMethod:CommandXRay.kt$CommandXRay$override fun createCommand(): Command</ID>
<ID>LongMethod:InteropFunctionRegistry.kt$internal fun registerInteropFunctions(node: Node)</ID>
<ID>LongMethod:LiquidBounce.kt$LiquidBounce.ClientResourceReloader$override fun reload(manager: ResourceManager)</ID>
<ID>LongMethod:ModuleManager.kt$ModuleManager$fun registerInbuilt()</ID>
<ID>LongMethod:RegistryFunctions.kt$@Suppress("UNUSED_PARAMETER") fun getRegistries(requestObject: RequestObject)</ID>
<ID>LongMethod:Value.kt$Value$open fun setByString(string: String)</ID>
@@ -98,7 +95,6 @@
<ID>LongParameterList:Region.kt$Region$(minX: Int, minY: Int, minZ: Int, maxX: Int, maxY: Int, maxZ: Int)</ID>
<ID>LongParameterList:RotationsUtil.kt$RotationManager$( rotation: Rotation, considerInventory: Boolean = true, configurable: RotationsConfigurable, priority: Priority, provider: ClientModule, whenReached: RestrictedSingleUseAction? = null )</ID>
<ID>LongParameterList:RotationsUtil.kt$RotationManager$( vecRotation: VecRotation, entity: Entity? = null, considerInventory: Boolean = true, configurable: RotationsConfigurable, priority: Priority, provider: ClientModule )</ID>
<ID>LongParameterList:ScriptNetworkUtil.kt$ScriptNetworkUtil$(x: Double, y: Double, z: Double, yaw: Float, pitch: Float, onGround: Boolean)</ID>
<ID>LongParameterList:TargetFinding.kt$BlockPlacementTargetFindingOptions$( val offsetsToInvestigate: List&lt;Vec3i>, val stackToPlaceWith: ItemStack, val facePositionFactory: FaceTargetPositionFactory, val offsetPriorityGetter: (Vec3i) -> Double, val playerPositionOnPlacement: Vec3d, val playerPoseOnPlacement: EntityPose = EntityPose.STANDING, val allowPointingAway: Boolean = false )</ID>
<ID>LongParameterList:ThemeManager.kt$ThemeManager$(context: DrawContext, width: Int, height: Int, mouseX: Int, mouseY: Int, delta: Float)</ID>
<ID>LoopWithTooManyJumpStatements:BlockPlacer.kt$BlockPlacer$while</ID>
@@ -121,7 +117,6 @@
<ID>PrintStackTrace:CommandManager.kt$CommandManager$e</ID>
<ID>ReturnCount:IntegrationListener.kt$IntegrationListener$private fun handleScreenSituation(screen: Screen?): Boolean</ID>
<ID>ReturnCount:SpeedAntiCornerBump.kt$SpeedAntiCornerBump$fun getSuggestedJumpDelay( simulatedPlayer: SimulatedPlayer, n: Int = 2, ): Int?</ID>
<ID>SpreadOperator:ModuleVomit.kt$ModuleVomit$( *emptySlots.map { slot -> CreativeInventoryAction.performFillSlot(randomStack, slot) } .toTypedArray(), *emptySlots.map { slot -> ClickInventoryAction.performThrow(null, slot) } .toTypedArray() )</ID>
<ID>StringLiteralDuplication:AutoQueueGommeDuels.kt$AutoQueueGommeDuels$"AutoPlay"</ID>
<ID>StringLiteralDuplication:ScriptSetting.kt$ScriptSetting$"default"</ID>
<ID>SwallowedException:ClientInteropServer.kt$ClientInteropServer$e: Exception</ID>
@@ -152,7 +147,6 @@
<ID>UnusedParameter:ClientApi.kt$ClientApi$settings: String</ID>
<ID>UnusedParameter:CommandConfig.kt$CommandConfig$validator: (ClientModule) -> Boolean = { true }</ID>
<ID>UnusedParameter:CommandLocalConfig.kt$CommandLocalConfig$validator: (ClientModule) -> Boolean = { true }</ID>
<ID>UnusedParameter:FaceTargetPositionFactory.kt$StabilizedRotationTargetPositionFactory$face: Face</ID>
<ID>UnusedParameter:ModuleManager.kt$ModuleManager$args: List&lt;String></ID>
<ID>UnusedPrivateProperty:NoFallBlink.kt$NoFallBlink$i</ID>
</CurrentIssues>

View File

@@ -20,13 +20,13 @@ kotlin.code.style=official
org.gradle.jvmargs=-Xms1024m -Xmx4096m
# Fabric Properties
# Check these on https://fabricmc.net/versions.html
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.1
loader_version=0.16.9
min_loader_version=0.16.5
# Fabric API
fabric_version=0.110.0+1.21.1
fabric_version=0.111.0+1.21.4
# Loom
loom_version=1.9-SNAPSHOT
# Mod Properties
@@ -39,10 +39,10 @@ kotlin_version=2.1.0
# https://maven.fabricmc.net/net/fabricmc/fabric-language-kotlin/
fabric_kotlin_version=1.13.0+kotlin.2.1.0
# mcef
mcef_version=1.3.1-1.21.1
mcef_version=1.3.0-1.21.4
# mc-authlib
mc_authlib_version=1.4.1
# Recommended mods
mod_menu_version=11.0.3
sodium_version=mc1.21.1-0.6.0-fabric
viafabricplus_version=3.4.9
mod_menu_version=13.0.0-beta.1
sodium_version=mc1.21.4-0.6.5-fabric
viafabricplus_version=3.6.1

View File

@@ -1,3 +1,21 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2024 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.common;
public class ChunkUpdateFlag {

View File

@@ -0,0 +1,65 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2024 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.common;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.Framebuffer;
import java.util.ArrayList;
import java.util.List;
/**
* Modifies {@link MinecraftClient#getFramebuffer()} to return an own framebuffer so that minecraft writes results
* to that framebuffer and not the main framebuffer.
*
* @author ccetl
*/
public class GlobalFramebuffer {
public final static List<Framebuffer> stack = new ArrayList<>(2);
private static Framebuffer spoofedFramebuffer;
public static Framebuffer getSpoofedFramebuffer() {
return spoofedFramebuffer;
}
public static void push(Framebuffer spoofedFramebuffer) {
if (GlobalFramebuffer.spoofedFramebuffer != null) {
stack.addLast(GlobalFramebuffer.spoofedFramebuffer);
}
GlobalFramebuffer.spoofedFramebuffer = spoofedFramebuffer;
}
public static void pop() {
if (stack.isEmpty()) {
spoofedFramebuffer = null;
return;
}
spoofedFramebuffer = stack.getLast();
}
public static void clear() {
stack.clear();
spoofedFramebuffer = null;
}
}

View File

@@ -15,7 +15,6 @@
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*
*/
package net.ccbluex.liquidbounce.common;

View File

@@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.common;
import net.ccbluex.liquidbounce.features.module.modules.exploit.ModuleGhostHand;
@@ -66,4 +65,5 @@ public class TweakedMethods {
return BlockHitResult.createMissed(contextx.getEnd(), Direction.getFacing(vec3d.x, vec3d.y, vec3d.z), BlockPos.ofFloored(contextx.getEnd()));
});
}
}

View File

@@ -31,7 +31,7 @@ import java.net.PasswordAuthentication;
import java.net.Proxy;
@Mixin(value = MinecraftClient.class, remap = false)
public class MixinMinecraftClient {
public abstract class MixinMinecraftClient {
@ModifyExpressionValue(method = "createUrlConnection", at = @At(
value = "FIELD",

View File

@@ -0,0 +1,38 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2024 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.blaze3d;
import com.mojang.blaze3d.systems.RenderSystem;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleCustomAmbience;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = RenderSystem.class, remap = false)
public abstract class MixinRenderSystem {
@Inject(method = "clearColor", at = @At(value = "HEAD"), cancellable = true)
private static void injectFog(float red, float green, float blue, float alpha, CallbackInfo ci) {
if (ModuleCustomAmbience.FogConfigurable.INSTANCE.modifyClearColor()) {
ci.cancel();
}
}
}

View File

@@ -25,9 +25,7 @@ import net.ccbluex.liquidbounce.event.events.BlockVelocityMultiplierEvent;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleXRay;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -35,10 +33,10 @@ import org.spongepowered.asm.mixin.injection.At;
public class MixinBlock {
@ModifyReturnValue(method = "shouldDrawSide", at = @At("RETURN"))
private static boolean injectXRay(boolean original, BlockState state, BlockView world, BlockPos pos, Direction side, BlockPos otherPos) {
private static boolean injectXRay(boolean original, BlockState state, BlockState otherState, Direction side) {
var xRay = ModuleXRay.INSTANCE;
if (xRay.getRunning()) {
return xRay.shouldRender(state, pos);
return xRay.shouldRender(state, otherState, side);
}
return original;

View File

@@ -47,7 +47,7 @@ public class MixinBlockCollisionSpliterator {
*/
@ModifyExpressionValue(method = "computeNext", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/BlockState;getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;"
target = "Lnet/minecraft/block/ShapeContext;getCollisionShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/CollisionView;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/shape/VoxelShape;"
))
private VoxelShape hookCollisionShape(VoxelShape original, @Local BlockState blockState) {
if (this.pos == null || ShapeFlag.noShapeChange) {

View File

@@ -46,6 +46,7 @@ public interface MixinBlockView {
/**
* @author superblaubeere27
* @reason .
*/
@Overwrite
default BlockHitResult raycast(RaycastContext context) {

View File

@@ -39,4 +39,5 @@ public class MixinGameMode {
private static GameMode setDefaultAsNull(GameMode gameMode) {
return null;
}
}

View File

@@ -5,7 +5,6 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.GameOptions;
import net.minecraft.client.option.SimpleOption;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -38,4 +37,5 @@ public class MixinGameOptions {
cir.getReturnValue().setValue(2);
}
}
}

View File

@@ -22,6 +22,7 @@ package net.ccbluex.liquidbounce.injection.mixins.minecraft.client;
import net.ccbluex.liquidbounce.features.module.modules.combat.criticals.ModuleCriticals;
import net.ccbluex.liquidbounce.features.module.modules.movement.ModuleSprint;
import net.minecraft.client.input.Input;
import net.minecraft.util.PlayerInput;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@@ -29,23 +30,16 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Input.class)
public class MixinInput {
@Shadow
public boolean pressingRight;
@Shadow
public boolean pressingLeft;
@Shadow
public boolean pressingBack;
@Shadow
public boolean pressingForward;
public abstract class MixinInput {
@Shadow
public float movementForward;
@Shadow
public float movementSideways;
@Shadow
public boolean jumping;
@Shadow public boolean sneaking;
@Shadow
public PlayerInput playerInput;
@Inject(method = "hasForwardMovement", cancellable = true, at = @At("RETURN"))
private void hookOmnidirectionalSprintA(final CallbackInfoReturnable<Boolean> callbackInfoReturnable) {

View File

@@ -34,10 +34,12 @@ import net.minecraft.client.input.KeyboardInput;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.option.GameOptions;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.util.PlayerInput;
import net.minecraft.util.math.MathHelper;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -59,29 +61,29 @@ public class MixinKeyboardInput extends MixinInput {
? InputTracker.INSTANCE.isPressedOnAny(keyBinding) : keyBinding.isPressed();
}
@Inject(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/input/KeyboardInput;pressingBack:Z", ordinal = 0))
private void hookInventoryMoveSprint(boolean slowDown, float f, CallbackInfo ci) {
/**
* At settings.backKey.isPressed()
*/
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;isPressed()Z", ordinal = 1))
private void hookInventoryMoveSprint(CallbackInfo ci) {
if (ModuleInventoryMove.INSTANCE.shouldHandleInputs(this.settings.sprintKey)) {
this.settings.sprintKey.setPressed(InputTracker.INSTANCE.isPressedOnAny(this.settings.sprintKey));
}
}
@Inject(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/client/input/KeyboardInput;sneaking:Z", shift = At.Shift.AFTER), allow = 1)
private void injectMovementInputEvent(boolean slowDown, float f, CallbackInfo ci) {
var event = new MovementInputEvent(new DirectionalInput(this.pressingForward, this.pressingBack, this.pressingLeft, this.pressingRight), this.jumping, this.sneaking);
@Inject(method = "tick", at = @At("RETURN"))
private void injectMovementInputEvent(CallbackInfo ci) {
var event = new MovementInputEvent(new DirectionalInput(this.playerInput.forward(), this.playerInput.backward(), this.playerInput.left(), this.playerInput.right()), this.playerInput.jump(), this.playerInput.sneak());
EventManager.INSTANCE.callEvent(event);
var directionalInput = event.getDirectionalInput();
this.pressingForward = directionalInput.getForwards();
this.pressingBack = directionalInput.getBackwards();
this.pressingLeft = directionalInput.getLeft();
this.pressingRight = directionalInput.getRight();
playerInput = new PlayerInput(directionalInput.getForwards(), directionalInput.getBackwards(), directionalInput.getLeft(), directionalInput.getRight(), playerInput.jump(), playerInput.sneak(), playerInput.sprint());
this.movementForward = KeyboardInput.getMovementMultiplier(directionalInput.getForwards(), directionalInput.getBackwards());
this.movementSideways = KeyboardInput.getMovementMultiplier(directionalInput.getLeft(), directionalInput.getRight());
this.fixStrafeMovement();
this.liquid_bounce$fixStrafeMovement();
if (ModuleSuperKnockback.INSTANCE.shouldStopMoving()) {
this.movementForward = 0f;
@@ -93,11 +95,11 @@ public class MixinKeyboardInput extends MixinInput {
}
}
this.jumping = event.getJumping();
this.sneaking = event.getSneaking();
playerInput = new PlayerInput(playerInput.forward(), playerInput.backward(), playerInput.left(), playerInput.right(), event.getJump(), event.getSneak(), playerInput.sprint());
}
private void fixStrafeMovement() {
@Unique
private void liquid_bounce$fixStrafeMovement() {
ClientPlayerEntity player = MinecraftClient.getInstance().player;
RotationManager rotationManager = RotationManager.INSTANCE;
Rotation rotation = rotationManager.getCurrentRotation();

View File

@@ -21,6 +21,7 @@ package net.ccbluex.liquidbounce.injection.mixins.minecraft.client;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.common.GlobalFramebuffer;
import net.ccbluex.liquidbounce.event.EventManager;
import net.ccbluex.liquidbounce.event.events.*;
import net.ccbluex.liquidbounce.features.misc.HideAppearance;
@@ -37,6 +38,7 @@ import net.ccbluex.liquidbounce.utils.client.vfp.VfpCompatibility;
import net.ccbluex.liquidbounce.utils.combat.CombatManager;
import net.minecraft.SharedConstants;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.Framebuffer;
import net.minecraft.client.gui.screen.AccessibilityOnboardingScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.TitleScreen;
@@ -56,9 +58,7 @@ import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@@ -314,14 +314,6 @@ public abstract class MixinMinecraftClient {
EventManager.INSTANCE.callEvent(new WorldChangeEvent(world));
}
/**
* Removes frame rate limit
*/
@ModifyConstant(method = "getFramerateLimit", constant = @Constant(intValue = 60))
private int getFramerateLimit(int original) {
return getWindow().getFramerateLimit();
}
@Inject(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentFps:I",
ordinal = 0, shift = At.Shift.AFTER))
private void hookFpsChange(CallbackInfo ci) {
@@ -369,4 +361,12 @@ public abstract class MixinMinecraftClient {
this.currentScreen instanceof ModuleClickGui.ClickScreen);
}
@Inject(method = "getFramebuffer", at = @At("HEAD"), cancellable = true)
private void hookSpoofFramebuffer(CallbackInfoReturnable<Framebuffer> cir) {
var framebuffer = GlobalFramebuffer.getSpoofedFramebuffer();
if (framebuffer != null) {
cir.setReturnValue(framebuffer);
}
}
}

View File

@@ -52,8 +52,8 @@ public class MixinMouse {
}
@Inject(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSpectator()Z", shift = At.Shift.BEFORE), cancellable = true)
private void hookMouseScroll(long window, double horizontal, double vertical, CallbackInfo ci, @Local(ordinal = 2) int k) {
if (EventManager.INSTANCE.callEvent(new MouseScrollInHotbarEvent(k)).isCancelled()) {
private void hookMouseScroll(long window, double horizontal, double vertical, CallbackInfo ci, @Local(ordinal = 0) int i) {
if (EventManager.INSTANCE.callEvent(new MouseScrollInHotbarEvent(i)).isCancelled()) {
ci.cancel();
}
}

View File

@@ -15,7 +15,6 @@
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.client;

View File

@@ -1,3 +1,21 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2024 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.client;
import net.ccbluex.liquidbounce.utils.client.VanillaTranslationRecognizer;

View File

@@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.client;
import net.ccbluex.liquidbounce.LiquidBounce;

View File

@@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.client;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;

View File

@@ -18,7 +18,6 @@
*
*
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.entity;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;

View File

@@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.entity;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
@@ -195,9 +194,9 @@ public abstract class MixinClientPlayerEntity extends MixinPlayerEntity {
/**
* Hook custom sneaking multiplier
*/
@ModifyArg(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick(ZF)V", ordinal = 0), index = 1)
private float hookCustomSneakingMultiplier(float slowDownFactor) {
final PlayerSneakMultiplier playerSneakMultiplier = new PlayerSneakMultiplier(slowDownFactor);
@ModifyExpressionValue(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getAttributeValue(Lnet/minecraft/registry/entry/RegistryEntry;)D"))
private double hookCustomSneakingMultiplier(double original) {
var playerSneakMultiplier = new PlayerSneakMultiplier(original);
EventManager.INSTANCE.callEvent(playerSneakMultiplier);
return playerSneakMultiplier.getMultiplier();
}
@@ -290,7 +289,7 @@ public abstract class MixinClientPlayerEntity extends MixinPlayerEntity {
return !ModuleFreeCam.INSTANCE.getRunning() && original;
}
@ModifyVariable(method = "sendMovementPackets", at = @At("STORE"), ordinal = 2)
@ModifyVariable(method = "sendMovementPackets", at = @At("STORE"), ordinal = 1)
private boolean hookFreeCamPreventRotations(boolean bl4) {
return (!ModuleFreeCam.INSTANCE.shouldDisableRotations() || ModuleRotations.INSTANCE.shouldSendCustomRotation()) && bl4;
}
@@ -308,20 +307,21 @@ public abstract class MixinClientPlayerEntity extends MixinPlayerEntity {
@ModifyExpressionValue(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isWalking()Z"))
private boolean hookOmnidirectionalSprintB(boolean original) {
return isOmniWalking();
return liquid_bounce$isOmniWalking();
}
@ModifyExpressionValue(method = "canStartSprinting", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasStatusEffect(Lnet/minecraft/registry/entry/RegistryEntry;)Z"))
@ModifyExpressionValue(method = "canStartSprinting", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isBlind()Z"))
private boolean hookSprintIgnoreBlindness(boolean original) {
return !ModuleSprint.INSTANCE.shouldIgnoreBlindness() && original;
}
@ModifyExpressionValue(method = "canStartSprinting", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isWalking()Z"))
private boolean hookOmnidirectionalSprintC(boolean original) {
return isOmniWalking();
return liquid_bounce$isOmniWalking();
}
private boolean isOmniWalking() {
@Unique
private boolean liquid_bounce$isOmniWalking() {
boolean hasMovement = Math.abs(input.movementForward) > 1.0E-5F || Math.abs(input.movementSideways) > 1.0E-5F;
boolean isWalking = (double) Math.abs(input.movementForward) >= 0.8 || (double) Math.abs(input.movementSideways) >= 0.8;
boolean modifiedIsWalking = this.isSubmergedInWater() ? hasMovement : isWalking;

View File

@@ -22,11 +22,8 @@ package net.ccbluex.liquidbounce.injection.mixins.minecraft.entity;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import net.ccbluex.liquidbounce.config.types.NoneChoice;
import net.ccbluex.liquidbounce.event.EventManager;
import net.ccbluex.liquidbounce.event.events.PacketEvent;
import net.ccbluex.liquidbounce.event.events.PlayerAfterJumpEvent;
import net.ccbluex.liquidbounce.event.events.PlayerJumpEvent;
import net.ccbluex.liquidbounce.event.events.TransferOrigin;
import net.ccbluex.liquidbounce.features.command.commands.ingame.fakeplayer.FakePlayer;
import net.ccbluex.liquidbounce.features.module.modules.movement.*;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleAntiBlind;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleRotations;
@@ -34,24 +31,20 @@ import net.ccbluex.liquidbounce.features.module.modules.world.scaffold.ModuleSca
import net.ccbluex.liquidbounce.utils.aiming.RotationManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.network.packet.s2c.play.EntityStatusS2CPacket;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@@ -69,7 +62,7 @@ public abstract class MixinLivingEntity extends MixinEntity {
public abstract float getJumpVelocity();
@Shadow
protected abstract void jump();
public abstract void jump();
@Shadow
public abstract boolean hasStatusEffect(RegistryEntry<StatusEffect> effect);
@@ -82,27 +75,53 @@ public abstract class MixinLivingEntity extends MixinEntity {
@Shadow
public abstract void setHealth(float health);
@Shadow
public abstract boolean addStatusEffect(StatusEffectInstance effect);
@Shadow
public abstract boolean isFallFlying();
public abstract boolean isGliding();
/**
* Hook anti levitation module
* Disable [StatusEffects.LEVITATION] effect when [ModuleAntiLevitation] is enabled
*/
@Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;hasStatusEffect(Lnet/minecraft/registry/entry/RegistryEntry;)Z"))
public boolean hookTravelStatusEffect(LivingEntity instance, RegistryEntry<StatusEffect> effect) {
if ((effect == StatusEffects.LEVITATION || effect == StatusEffects.SLOW_FALLING) && ModuleAntiLevitation.INSTANCE.getRunning()) {
if (instance.hasStatusEffect(effect)) {
instance.fallDistance = 0f;
}
@ModifyExpressionValue(
method = "travelMidAir",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/LivingEntity;getStatusEffect(Lnet/minecraft/registry/entry/RegistryEntry;)Lnet/minecraft/entity/effect/StatusEffectInstance;",
ordinal = 0
),
require = 1,
allow = 1
)
public StatusEffectInstance hookTravelStatusEffect(StatusEffectInstance original) {
// If we get anyting other than levitation, the injection went wrong
assert original != StatusEffects.LEVITATION;
if (ModuleAntiLevitation.INSTANCE.getRunning()) {
return null;
}
return original;
}
/**
* Disable [StatusEffects.SLOW_FALLING] effect when [ModuleAntiLevitation] is enabled
*/
@ModifyExpressionValue(
method = "getEffectiveGravity",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/LivingEntity;hasStatusEffect(Lnet/minecraft/registry/entry/RegistryEntry;)Z",
ordinal = 0
),
require = 1,
allow = 1
)
public boolean hookTravelStatusEffect(boolean original) {
if (ModuleAntiLevitation.INSTANCE.getRunning()) {
return false;
}
return instance.hasStatusEffect(effect);
return original;
}
@Inject(method = "hasStatusEffect", at = @At("HEAD"), cancellable = true)
@@ -113,6 +132,19 @@ public abstract class MixinLivingEntity extends MixinEntity {
}
}
@Inject(method = "jump", at = @At("HEAD"), cancellable = true)
private void hookJumpEvent(CallbackInfo ci) {
if ((Object) this != MinecraftClient.getInstance().player) {
return;
}
final PlayerJumpEvent jumpEvent = new PlayerJumpEvent(getJumpVelocity());
EventManager.INSTANCE.callEvent(jumpEvent);
if (jumpEvent.isCancelled()) {
ci.cancel();
}
}
@ModifyExpressionValue(method = "jump", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getJumpVelocity()F"))
private float hookJumpEvent(float original) {
if (((Object) this) != MinecraftClient.getInstance().player) {
@@ -189,15 +221,15 @@ public abstract class MixinLivingEntity extends MixinEntity {
@Unique
private boolean previousElytra = false;
@Inject(method = "tickFallFlying", at = @At("TAIL"))
@Inject(method = "tickGliding", at = @At("TAIL"))
public void recastIfLanded(CallbackInfo callbackInfo) {
if ((Object) this != MinecraftClient.getInstance().player) {
return;
}
var elytra = isFallFlying();
var elytra = isGliding();
if (ModuleElytraRecast.INSTANCE.getRunning() && previousElytra && !elytra) {
MinecraftClient.getInstance().getSoundManager().stopSounds(SoundEvents.ITEM_ELYTRA_FLYING.getId(),
MinecraftClient.getInstance().getSoundManager().stopSounds(SoundEvents.ITEM_ELYTRA_FLYING.id(),
SoundCategory.PLAYERS);
ModuleElytraRecast.INSTANCE.recastElytra();
jumpingCooldown = 0;
@@ -236,9 +268,9 @@ public abstract class MixinLivingEntity extends MixinEntity {
}
/**
* Fall flying using modified-rotation
* Gliding using modified-rotation
*/
@ModifyExpressionValue(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getPitch()F"))
@ModifyExpressionValue(method = "calcGlidingVelocity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getPitch()F"))
private float hookModifyFallFlyingPitch(float original) {
if ((Object) this != MinecraftClient.getInstance().player) {
return original;
@@ -256,9 +288,9 @@ public abstract class MixinLivingEntity extends MixinEntity {
}
/**
* Fall flying using modified-rotation
* Gliding using modified-rotation
*/
@ModifyExpressionValue(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getRotationVector()Lnet/minecraft/util/math/Vec3d;"))
@ModifyExpressionValue(method = "calcGlidingVelocity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getRotationVector()Lnet/minecraft/util/math/Vec3d;"))
private Vec3d hookModifyFallFlyingRotationVector(Vec3d original) {
if ((Object) this != MinecraftClient.getInstance().player) {
return original;
@@ -275,38 +307,4 @@ public abstract class MixinLivingEntity extends MixinEntity {
return rotation.getRotationVec();
}
/**
* Allows instances of {@link FakePlayer} to pop infinite totems and
* bypass {@link net.minecraft.registry.tag.DamageTypeTags.BYPASSES_INVULNERABILITY}
* damage sources.
*/
@SuppressWarnings({"JavadocReference", "UnreachableCode"})
@Inject(method = "tryUseTotem", at = @At(value = "HEAD"), cancellable = true)
private void hookTryUseTotem(DamageSource source, CallbackInfoReturnable<Boolean> cir) {
if (LivingEntity.class.cast(this) instanceof FakePlayer) {
addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 900, 1));
addStatusEffect(new StatusEffectInstance(StatusEffects.ABSORPTION, 100, 1));
addStatusEffect(new StatusEffectInstance(StatusEffects.FIRE_RESISTANCE, 800, 0));
setHealth(1.0F);
EntityStatusS2CPacket packet = new EntityStatusS2CPacket(LivingEntity.class.cast(this), (byte) 35);
PacketEvent event = new PacketEvent(TransferOrigin.RECEIVE, packet, true);
EventManager.INSTANCE.callEvent(event);
if (!event.isCancelled()) {
packet.apply(MinecraftClient.getInstance().getNetworkHandler());
}
cir.setReturnValue(true);
}
}
/**
* Allows instances of {@link FakePlayer} to get attacked.
*/
@SuppressWarnings("ConstantValue")
@Redirect(method = "damage", at = @At(value = "FIELD", target = "Lnet/minecraft/world/World;isClient:Z", ordinal = 0))
private boolean hookDamage(World world) {
return !(LivingEntity.class.cast(this) instanceof FakePlayer) && world.isClient;
}
}

View File

@@ -24,7 +24,6 @@ import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import net.ccbluex.liquidbounce.event.EventManager;
import net.ccbluex.liquidbounce.event.events.PlayerEquipmentChangeEvent;
import net.ccbluex.liquidbounce.event.events.PlayerJumpEvent;
import net.ccbluex.liquidbounce.event.events.PlayerSafeWalkEvent;
import net.ccbluex.liquidbounce.event.events.PlayerStrideEvent;
import net.ccbluex.liquidbounce.features.command.commands.ingame.fakeplayer.FakePlayer;
@@ -76,8 +75,6 @@ public abstract class MixinPlayerEntity extends MixinLivingEntity {
/**
* Hook safe walk event
*
* @return
*/
@ModifyReturnValue(method = "clipAtLedge", at = @At("RETURN"))
private boolean hookSafeWalk(boolean original) {
@@ -125,19 +122,6 @@ public abstract class MixinPlayerEntity extends MixinLivingEntity {
}
}
@Inject(method = "jump", at = @At("HEAD"), cancellable = true)
private void hookJumpEvent(CallbackInfo ci) {
if ((Object) this != MinecraftClient.getInstance().player) {
return;
}
final PlayerJumpEvent jumpEvent = new PlayerJumpEvent(getJumpVelocity());
EventManager.INSTANCE.callEvent(jumpEvent);
if (jumpEvent.isCancelled()) {
ci.cancel();
}
}
@ModifyExpressionValue(method = "getBlockBreakingSpeed", at = @At(value = "INVOKE",
target = "Lnet/minecraft/entity/player/PlayerEntity;hasStatusEffect(Lnet/minecraft/registry/entry/RegistryEntry;)Z"))
private boolean injectFatigueNoSlow(boolean original) {

View File

@@ -26,6 +26,7 @@ import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(PlayerEntity.class)
public interface MixinPlayerEntityAccessor {
/*
* Used to get the TrackedData of the arm
*/
@@ -33,4 +34,5 @@ public interface MixinPlayerEntityAccessor {
static TrackedData<Byte> getTrackedMainArm() {
throw new AssertionError();
}
}

View File

@@ -40,4 +40,5 @@ public class MixinFlowableFluid {
EventManager.INSTANCE.callEvent(fluidPushEvent);
return !fluidPushEvent.isCancelled();
}
}

View File

@@ -48,7 +48,7 @@ public abstract class MixinChatInputSuggestor {
@Shadow @Nullable private ChatInputSuggestor.@Nullable SuggestionWindow window;
@Inject(method = "refresh", at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/StringReader;canRead()Z"), cancellable = true)
@Inject(method = "refresh", at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/StringReader;canRead()Z", remap = false), cancellable = true)
private void injectAutoCompletionB(CallbackInfo ci) {
if (this.textField.getText().startsWith(CommandManager.Options.INSTANCE.getPrefix())) {
this.pendingSuggestions = CommandManager.INSTANCE.autoComplete(this.textField.getText(), this.textField.getCursor());

View File

@@ -20,4 +20,5 @@ public abstract class MixinHandledScreen extends MixinScreen {
ci.cancel();
}
}
}

View File

@@ -28,7 +28,7 @@ import net.ccbluex.liquidbounce.features.module.modules.render.ModuleFreeCam;
import net.ccbluex.liquidbounce.integration.theme.component.ComponentOverlay;
import net.ccbluex.liquidbounce.integration.theme.component.FeatureTweak;
import net.ccbluex.liquidbounce.integration.theme.component.types.IntegratedComponent;
import net.ccbluex.liquidbounce.render.engine.UIRenderer;
import net.ccbluex.liquidbounce.render.engine.UiRenderer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
@@ -52,8 +52,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public abstract class MixinInGameHud {
@Final
@Shadow
private static Identifier PUMPKIN_BLUR;
@Unique
private static final Identifier liquid_bounce$PUMPKIN_BLUR = Identifier.ofVanilla("misc/pumpkinblur");
@Final
@Shadow
@@ -76,7 +76,7 @@ public abstract class MixinInGameHud {
*/
@Inject(method = "renderMainHud", at = @At("HEAD"))
private void hookRenderEventStart(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) {
UIRenderer.INSTANCE.startUIOverlayDrawing(context, tickCounter.getTickDelta(false));
UiRenderer.INSTANCE.startUIOverlayDrawing(context, tickCounter.getTickDelta(false));
// Draw after overlay event
var component = ComponentOverlay.getComponentWithTweak(FeatureTweak.TWEAK_HOTBAR);
@@ -93,7 +93,7 @@ public abstract class MixinInGameHud {
return;
}
if (module.getPumpkinBlur() && PUMPKIN_BLUR.equals(texture)) {
if (module.getPumpkinBlur() && liquid_bounce$PUMPKIN_BLUR.equals(texture)) {
callback.cancel();
return;
}
@@ -120,7 +120,7 @@ public abstract class MixinInGameHud {
}
@Inject(method = "renderScoreboardSidebar", at = @At("HEAD"), cancellable = true)
@Inject(method = "renderScoreboardSidebar*", at = @At("HEAD"), cancellable = true)
private void renderScoreboardSidebar(CallbackInfo ci) {
if (ComponentOverlay.isTweakEnabled(FeatureTweak.DISABLE_SCOREBOARD)) {
ci.cancel();
@@ -230,4 +230,12 @@ public abstract class MixinInGameHud {
return EventManager.INSTANCE.callEvent(new PerspectiveEvent(original)).getPerspective();
}
@Inject(method = "renderNauseaOverlay", at = @At("HEAD"), cancellable = true)
private void hookNauseaOverlay(DrawContext context, float distortionStrength, CallbackInfo ci) {
var antiBlind = ModuleAntiBlind.INSTANCE;
if (antiBlind.getRunning() && antiBlind.getAntiNausea()) {
ci.cancel();
}
}
}

View File

@@ -20,8 +20,8 @@ package net.ccbluex.liquidbounce.injection.mixins.minecraft.gui;
import com.llamalad7.mixinextras.sugar.Local;
import net.ccbluex.liquidbounce.features.misc.HideAppearance;
import net.ccbluex.liquidbounce.utils.client.RunnableClickEvent;
import net.ccbluex.liquidbounce.integration.theme.ThemeManager;
import net.ccbluex.liquidbounce.utils.client.RunnableClickEvent;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
@@ -41,7 +41,6 @@ import javax.annotation.Nullable;
@Mixin(Screen.class)
public abstract class MixinScreen {
@Shadow
protected abstract void remove(Element child);
@@ -81,7 +80,7 @@ public abstract class MixinScreen {
/**
* Allows the execution of {@link RunnableClickEvent}.
*/
@Inject(method = "handleTextClick", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;)V", ordinal = 2, shift = At.Shift.BEFORE), cancellable = true)
@Inject(method = "handleTextClick", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;)V", ordinal = 2, shift = At.Shift.BEFORE, remap = false), cancellable = true)
private void hookExecuteClickEvents(Style style, CallbackInfoReturnable<Boolean> cir, @Local ClickEvent clickEvent) {
if (clickEvent instanceof RunnableClickEvent runnableClickEvent) {
runnableClickEvent.run();

View File

@@ -1,40 +0,0 @@
package net.ccbluex.liquidbounce.injection.mixins.minecraft.gui;
import net.ccbluex.liquidbounce.utils.client.SignTranslationFixKt;
import net.minecraft.block.entity.SignText;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(SignText.class)
public class MixinSignText {
@Shadow
@Final
private Text[] messages;
/**
* Fixes a vulnerability where the server can find out about the installed mods via translated text.
* <p>
* This is not the same fix as by https://modrinth.com/mod/moddetectionpreventer/ even if it fixes the same issue.
* In order to prevent further issues, we completely disallow creating a sign text with unknown translatable.
*/
@Inject(method = "<init>([Lnet/minecraft/text/Text;[Lnet/minecraft/text/Text;Lnet/minecraft/util/DyeColor;Z)V", at = @At("RETURN"))
private void injectSignVulnerabilityFix(CallbackInfo ci) {
for (int i = 0; i < this.messages.length; i++) {
var msg = this.messages[i];
if (msg == null) {
continue;
}
this.messages[i] = SignTranslationFixKt.filterNonVanillaText(msg);
}
}
}

View File

@@ -28,6 +28,7 @@ import net.ccbluex.liquidbounce.features.misc.HideAppearance;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.SplashOverlay;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.resource.ResourceReload;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.ColorHelper;
@@ -36,6 +37,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.function.Function;
import java.util.function.IntSupplier;
/**
@@ -65,7 +67,7 @@ public class MixinSplashOverlay {
private void hookInit(CallbackInfo ci) {
if (!HideAppearance.INSTANCE.isHidingNow()) {
EventManager.INSTANCE.callEvent(new SplashOverlayEvent(true));
BRAND_ARGB = () -> ColorHelper.Argb.getArgb(255, 24, 26, 27);
BRAND_ARGB = () -> ColorHelper.getArgb(255, 24, 26, 27);
} else {
BRAND_ARGB = () -> MinecraftClient.getInstance().options.getMonochromeLogo().getValue() ? MONOCHROME_BLACK : MOJANG_RED;
}
@@ -110,13 +112,10 @@ public class MixinSplashOverlay {
EventManager.INSTANCE.callEvent(new ScreenRenderEvent(context, delta));
}
@WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIFFIIII)V"))
private boolean drawTexture(DrawContext instance, Identifier texture, int x, int y, int width, int height,
float u, float v, int regionWidth, int regionHeight, int textureWidth, int textureHeight) {
@WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIFFIIIIIII)V"))
private boolean drawTexture(DrawContext instance, Function<Identifier, RenderLayer> renderLayers, Identifier sprite, int x, int y, float u, float v, int width, int height, int regionWidth, int regionHeight, int textureWidth, int textureHeight, int color) {
// do not draw texture - only when hiding
return HideAppearance.INSTANCE.isHidingNow();
}
}

View File

@@ -16,11 +16,8 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.gui;
import net.minecraft.SharedConstants;
import net.minecraft.util.StringHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@@ -30,9 +27,11 @@ public class MixinStringHelper {
/**
* @author superblaubeere27
* @reason .
*/
@Overwrite
public static boolean isValidChar(char chr) {
return chr >= ' ' && chr != 127;
}
}

View File

@@ -74,7 +74,7 @@ public abstract class MixinDisconnectedScreen extends MixinScreen {
addDrawableChild(disconnectButton);
}
@Inject(method = "initTabNavigation", at = @At("HEAD"))
@Inject(method = "refreshWidgetPositions", at = @At("HEAD"))
private void moveButtons(final CallbackInfo callback) {
if (disconnectButton != null) {
// fixes button position

View File

@@ -0,0 +1,57 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2024 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.item;
import net.ccbluex.liquidbounce.interfaces.ArmorItemAdditions;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.Item;
import net.minecraft.item.equipment.ArmorMaterial;
import net.minecraft.item.equipment.EquipmentType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ArmorItem.class)
public abstract class MixinArmorItem implements ArmorItemAdditions {
@Unique
private ArmorMaterial liquid_bounce$armorMaterial;
@Unique
private EquipmentType liquid_bounce$type;
@Inject(method = "<init>", at = @At("RETURN"))
public void hookCatchArgs(ArmorMaterial material, EquipmentType type, Item.Settings settings, CallbackInfo ci) {
this.liquid_bounce$armorMaterial = material;
this.liquid_bounce$type = type;
}
@Override
public ArmorMaterial liquid_bounce$getMaterial() {
return liquid_bounce$armorMaterial;
}
@Override
public EquipmentType liquid_bounce$getType() {
return liquid_bounce$type;
}
}

View File

@@ -15,7 +15,6 @@
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.item;
@@ -30,11 +29,13 @@ import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.HeldItemRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.SwordItem;
import net.minecraft.item.consume.UseAction;
import net.minecraft.util.Arm;
import net.minecraft.util.Hand;
import net.minecraft.util.UseAction;
import net.minecraft.util.math.RotationAxis;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -78,7 +79,7 @@ public abstract class MixinHeldItemRenderer {
@Redirect(method = "renderFirstPersonItem", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;getUseAction()Lnet/minecraft/util/UseAction;",
target = "Lnet/minecraft/item/ItemStack;getUseAction()Lnet/minecraft/item/consume/UseAction;",
ordinal = 0
))
private UseAction hookUseAction(ItemStack instance) {
@@ -138,7 +139,7 @@ public abstract class MixinHeldItemRenderer {
@ModifyArg(method = "renderFirstPersonItem", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/render/item/HeldItemRenderer;applyEquipOffset(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/Arm;F)V",
ordinal = 4
ordinal = 3
), index = 2)
private float applyEquipOffset(float equipProgress) {
if (ModuleAnimations.INSTANCE.getRunning() && !ModuleAnimations.INSTANCE.getEquipOffset()) {
@@ -148,8 +149,24 @@ public abstract class MixinHeldItemRenderer {
return equipProgress;
}
/**
* This transformation was previously a VFP option but got now added to minecraft directly.
* View the code that was used to disable the VFP option here:
* https://github.com/CCBlueX/LiquidBounce/blob/e5a0dbf5458b063d3028e69e04762b8b25b998b5/src/main/java/net/ccbluex/liquidbounce/utils/client/vfp/VfpCompatibility.java#L44
*/
@ModifyExpressionValue(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;"))
private Item preventConflictingCode(Item item) {
// only applies to sword items,
// so that future items won't be affected if minecraft decides to actually make use out of this
if (item instanceof SwordItem) {
return Items.SHIELD; // makes the instanceof return true and therefore not do the transformation
}
return item;
}
@Inject(method = "renderFirstPersonItem",
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getUseAction()Lnet/minecraft/util/UseAction;")),
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getUseAction()Lnet/minecraft/item/consume/UseAction;")),
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;applyEquipOffset(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/Arm;F)V", ordinal = 2, shift = At.Shift.AFTER))
private void transformLegacyBlockAnimations(AbstractClientPlayerEntity player, float tickDelta, float pitch,
Hand hand, float swingProgress, ItemStack item, float equipProgress,

View File

@@ -24,13 +24,14 @@ import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import net.ccbluex.liquidbounce.features.module.modules.combat.ModuleSwordBlock;
import net.ccbluex.liquidbounce.utils.aiming.RotationManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.ConsumableComponent;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
import net.minecraft.item.consume.UseAction;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.UseAction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.RaycastContext;
import net.minecraft.world.World;
@@ -44,12 +45,17 @@ public class MixinItem {
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
private void hookSwordUse(World world, PlayerEntity user, Hand hand,
CallbackInfoReturnable<TypedActionResult<ItemStack>> cir) {
CallbackInfoReturnable<ActionResult> cir) {
// Hooks sword use - only if main hand (otherwise this makes no sense on 1.8)
if (((Object) this) instanceof SwordItem && ModuleSwordBlock.INSTANCE.getRunning() && !ModuleSwordBlock.INSTANCE.getOnlyVisual() && hand == Hand.MAIN_HAND) {
var itemStack = user.getStackInHand(hand);
user.setCurrentHand(hand);
cir.setReturnValue(TypedActionResult.consume(itemStack));
ConsumableComponent consumableComponent = itemStack.get(DataComponentTypes.CONSUMABLE);
if (consumableComponent == null) {
return;
}
cir.setReturnValue(consumableComponent.consume(user, itemStack, hand));
}
}

View File

@@ -49,4 +49,5 @@ public class MixinItemStack {
EventManager.INSTANCE.callEvent(event);
cir.setReturnValue(event.getLore());
}
}

View File

@@ -0,0 +1,48 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2024 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.item;
import net.ccbluex.liquidbounce.interfaces.MiningToolItemAddition;
import net.minecraft.item.Item;
import net.minecraft.item.MiningToolItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.tag.TagKey;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MiningToolItem.class)
public abstract class MixinMiningToolItem implements MiningToolItemAddition {
@Unique
private ToolMaterial liquid_bounce$material;
@Inject(method = "<init>", at = @At("RETURN"))
public void hookCatchArgs(ToolMaterial material, TagKey effectiveBlocks, float attackDamage, float attackSpeed, Item.Settings settings, CallbackInfo ci) {
this.liquid_bounce$material = material;
}
@Override
public ToolMaterial liquid_bounce$getMaterial() {
return liquid_bounce$material;
}
}

View File

@@ -28,12 +28,11 @@ import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ClientLoginNetworkHandler.class)
public class MixinClientLoginNetworkHandlerMixin {
@ModifyExpressionValue(method = "onSuccess", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/ClientBrandRetriever;getClientModName()Ljava/lang/String;"))
@ModifyExpressionValue(method = "onSuccess", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/ClientBrandRetriever;getClientModName()Ljava/lang/String;", remap = false))
private String getClientModName(String original) {
return ModuleSpoofer.INSTANCE.clientBrand(original);
}

View File

@@ -20,6 +20,7 @@
package net.ccbluex.liquidbounce.injection.mixins.minecraft.network;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import net.ccbluex.liquidbounce.common.ChunkUpdateFlag;
import net.ccbluex.liquidbounce.config.types.Choice;
import net.ccbluex.liquidbounce.event.EventManager;
@@ -47,11 +48,10 @@ import net.minecraft.util.math.Vec3d;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
import java.util.Optional;
@Mixin(ClientPlayNetworkHandler.class)
public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkHandler {
@@ -82,25 +82,24 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
ChunkUpdateFlag.chunkUpdate = false;
}
@ModifyArgs(method = "onExplosion", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;add(DDD)Lnet/minecraft/util/math/Vec3d;"))
private void onExplosionVelocity(Args args) {
double x = args.get(0);
double y = args.get(1);
double z = args.get(2);
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
@ModifyExpressionValue(method = "onExplosion", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/ExplosionS2CPacket;playerKnockback()Ljava/util/Optional;"))
private Optional<Vec3d> onExplosionVelocity(Optional<Vec3d> original) {
var present = original.isPresent();
if (present && ModuleAntiExploit.INSTANCE.getRunning() && ModuleAntiExploit.INSTANCE.getLimitExplosionStrength()) {
var vec = original.get();
double fixedX = MathHelper.clamp(vec.x, -10.0, 10.0);
double fixedY = MathHelper.clamp(vec.y, -10.0, 10.0);
double fixedZ = MathHelper.clamp(vec.z, -10.0, 10.0);
if (ModuleAntiExploit.INSTANCE.getRunning() && ModuleAntiExploit.INSTANCE.getLimitExplosionStrength()) {
double fixedX = MathHelper.clamp(x, -10.0, 10.0);
double fixedY = MathHelper.clamp(y, -10.0, 10.0);
double fixedZ = MathHelper.clamp(z, -10.0, 10.0);
if (fixedX != x || fixedY != y || fixedZ != z) {
if (fixedX != vec.x || fixedY != vec.y || fixedZ != vec.z) {
ModuleAntiExploit.INSTANCE.notifyAboutExploit("Limited too strong explosion",
true);
args.set(0, fixedX);
args.set(1, fixedY);
args.set(2, fixedZ);
return Optional.of(new Vec3d(fixedX, fixedY, fixedZ));
}
}
return original;
}
@ModifyExpressionValue(method = "onParticle", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/ParticleS2CPacket;getCount()I", ordinal = 1))
@@ -121,18 +120,6 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
return original;
}
@ModifyExpressionValue(method = "onExplosion", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/ExplosionS2CPacket;getRadius()F"))
private float onExplosionWorld(float original) {
if (ModuleAntiExploit.INSTANCE.getRunning() && ModuleAntiExploit.INSTANCE.getLimitExplosionRange()) {
float radius = MathHelper.clamp(original, -1000.0f, 1000.0f);
if (radius != original) {
ModuleAntiExploit.INSTANCE.notifyAboutExploit("Limited too big TNT explosion radius", true);
return radius;
}
}
return original;
}
@ModifyExpressionValue(method = "onGameStateChange", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/GameStateChangeS2CPacket;getReason()Lnet/minecraft/network/packet/s2c/play/GameStateChangeS2CPacket$Reason;"))
private GameStateChangeS2CPacket.Reason onGameStateChange(GameStateChangeS2CPacket.Reason original) {
if (ModuleAntiExploit.INSTANCE.getRunning() && original == GameStateChangeS2CPacket.DEMO_MESSAGE_SHOWN && ModuleAntiExploit.INSTANCE.getCancelDemo()) {
@@ -158,19 +145,19 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
}
}
@Inject(method = "onPlayerPositionLook", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;setVelocity(DDD)V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
private void injectNoRotateSet(PlayerPositionLookS2CPacket packet, CallbackInfo ci, PlayerEntity playerEntity, Vec3d vec3d, boolean bl, boolean bl2, boolean bl3, double d, double e, double f, double g, double h, double i) {
float j = packet.getYaw();
float k = packet.getPitch();
@Inject(method = "onPlayerPositionLook", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;setPosition(Lnet/minecraft/entity/player/PlayerPosition;Ljava/util/Set;Lnet/minecraft/entity/Entity;Z)Z", shift = At.Shift.AFTER))
private void injectNoRotateSet(PlayerPositionLookS2CPacket packet, CallbackInfo ci, @Local PlayerEntity playerEntity) {
float j = packet.change().yaw();
float k = packet.change().pitch();
if (!ModuleNoRotateSet.INSTANCE.getRunning() || MinecraftClient.getInstance().currentScreen instanceof DownloadingTerrainScreen) {
return;
}
// Confirm teleport
this.connection.send(new TeleportConfirmC2SPacket(packet.getTeleportId()));
this.connection.send(new TeleportConfirmC2SPacket(packet.teleportId()));
// Silently accept yaw and pitch values requested by the server.
this.connection.send(new PlayerMoveC2SPacket.Full(playerEntity.getX(), playerEntity.getY(), playerEntity.getZ(), j, k, false));
this.connection.send(new PlayerMoveC2SPacket.Full(playerEntity.getX(), playerEntity.getY(), playerEntity.getZ(), j, k, false, playerEntity.horizontalCollision));
Choice activeChoice = ModuleNoRotateSet.INSTANCE.getMode().getActiveChoice();
if (activeChoice.equals(ModuleNoRotateSet.ResetRotation.INSTANCE)) {
// Changes your server side rotation and then resets it with provided settings

View File

@@ -53,10 +53,11 @@ public abstract class MixinPlayerListEntry {
return;
}
fetchCapeTexture();
liquid_bounce$fetchCapeTexture();
}
private void fetchCapeTexture() {
@Unique
private void liquid_bounce$fetchCapeTexture() {
if (capeTextureLoading)
return;

View File

@@ -33,4 +33,5 @@ public class MixinRegistries {
private static void injectInitializeTabs(CallbackInfo ci) {
ClientItemGroups.INSTANCE.setup();
}
}

View File

@@ -19,22 +19,19 @@
package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.mojang.blaze3d.systems.RenderSystem;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.sugar.Local;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleAntiBlind;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleCustomAmbience;
import net.minecraft.block.enums.CameraSubmersionType;
import net.minecraft.client.render.BackgroundRenderer;
import net.minecraft.client.render.BackgroundRenderer.FogType;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.Fog;
import net.minecraft.entity.effect.StatusEffects;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
import java.util.List;
import java.util.stream.Stream;
@@ -42,6 +39,9 @@ import java.util.stream.Stream;
@Mixin(BackgroundRenderer.class)
public abstract class MixinBackgroundRenderer {
@Shadow
private static boolean fogEnabled;
@Redirect(method = "getFogModifier", at = @At(value = "INVOKE", target = "Ljava/util/List;stream()Ljava/util/stream/Stream;"))
private static Stream<BackgroundRenderer.StatusEffectFogModifier> injectAntiBlind(List<BackgroundRenderer.StatusEffectFogModifier> list) {
return list.stream().filter(modifier -> {
@@ -58,50 +58,33 @@ public abstract class MixinBackgroundRenderer {
});
}
@Inject(method = "applyFog", at = @At(value = "INVOKE", shift = At.Shift.AFTER, ordinal = 0, target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderFogEnd(F)V", remap = false))
private static void injectLiquidsFog(Camera camera, FogType fogType, float viewDistance, boolean thickFog, float tickDelta, CallbackInfo info) {
@ModifyReturnValue(method = "applyFog", at = @At("RETURN"))
private static Fog injectFog(Fog original, @Local(argsOnly = true) Camera camera, @Local(argsOnly = true, ordinal = 0) float viewDistance) {
var antiBlind = ModuleAntiBlind.INSTANCE;
var customAmbienceFog = ModuleCustomAmbience.Fog.INSTANCE;
if (!antiBlind.getRunning() || customAmbienceFog.getRunning()) {
return;
var customAmbienceFog = ModuleCustomAmbience.FogConfigurable.INSTANCE;
if (!antiBlind.getRunning() || customAmbienceFog.getRunning() || !fogEnabled) {
return ModuleCustomAmbience.FogConfigurable.INSTANCE.modifyFog(camera, viewDistance, original);
}
CameraSubmersionType type = camera.getSubmersionType();
if (antiBlind.getPowderSnowFog() && type == CameraSubmersionType.POWDER_SNOW) {
RenderSystem.setShaderFogStart(-8.0F);
RenderSystem.setShaderFogEnd(viewDistance * 0.5F);
return;
return new Fog(-8f, viewDistance * 0.5f, original.shape(), original.red(), original.green(), original.blue(), original.alpha());
}
if (antiBlind.getLiquidsFog()) {
// Renders fog same as spectator.
switch (type) {
case LAVA -> {
RenderSystem.setShaderFogStart(-8.0F);
RenderSystem.setShaderFogEnd(viewDistance * 0.5F);
return new Fog(-8f, viewDistance * 0.5f, original.shape(), original.red(), original.green(), original.blue(), original.alpha());
}
case WATER -> {
RenderSystem.setShaderFogStart(-8.0F);
RenderSystem.setShaderFogEnd(viewDistance);
return new Fog(-8f, viewDistance, original.shape(), original.red(), original.green(), original.blue(), original.alpha());
}
}
}
}
@Inject(method = "applyFog", at = @At("RETURN"))
private static void injectFog(Camera camera, FogType fogType, float viewDistance, boolean thickFog, float tickDelta, CallbackInfo ci) {
ModuleCustomAmbience.Fog.INSTANCE.modifyFog(camera, viewDistance);
}
@Inject(method = "applyFogColor", at = @At("RETURN"))
private static void injectFog(CallbackInfo ci) {
ModuleCustomAmbience.Fog.INSTANCE.modifyFogColor();
}
@ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;clearColor(FFFF)V"))
private static void injectFog(Args args) {
ModuleCustomAmbience.Fog.INSTANCE.modifySetColorArgs(args);
return original;
}
}

View File

@@ -30,7 +30,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class MixinChunkOcclusionDataBuilder {
@Inject(method = "markClosed", at = @At("HEAD"), cancellable = true)
private void onMarkClosed(BlockPos pos, CallbackInfo cir) {
if(ModuleXRay.INSTANCE.getRunning()) {
if (ModuleXRay.INSTANCE.getRunning()) {
cir.cancel();
}
}

View File

@@ -42,7 +42,7 @@ public abstract class MixinEntityRenderDispatcher {
MixinEntityRenderDispatcher.entity = entity;
}
@ModifyArg(method = "renderHitbox", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawBox(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/util/math/Box;FFFF)V", ordinal = 0), index = 2, require = 1, allow = 1)
@ModifyArg(method = "renderHitbox", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/VertexRendering;drawBox(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/util/math/Box;FFFF)V", ordinal = 0), index = 2, require = 1, allow = 1)
private static Box updateBoundingBox(Box box) {
var moduleHitBox = ModuleHitbox.INSTANCE;
if (moduleHitBox.getRunning() && CombatExtensionsKt.shouldBeAttacked(entity, CombatExtensionsKt.getCombatTargetsConfigurable())) {

View File

@@ -16,18 +16,19 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleCombineMobs;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleMobOwners;
import net.ccbluex.liquidbounce.features.module.modules.render.nametags.ModuleNametags;
import net.ccbluex.liquidbounce.interfaces.EntityRenderStateAddition;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.render.Frustum;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.state.EntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.text.OrderedText;
@@ -43,7 +44,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(EntityRenderer.class)
public abstract class MixinEntityRenderer<T extends Entity> {
public abstract class MixinEntityRenderer<T extends Entity, S extends EntityRenderState> {
@Shadow
@Final
@@ -60,8 +61,8 @@ public abstract class MixinEntityRenderer<T extends Entity> {
}
@Inject(method = "render", at = @At("HEAD"))
private void renderMobOwners(T entity, float yaw, float tickDelta, MatrixStack matrices,
VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
private void renderMobOwners(S state, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
var entity = ((EntityRenderStateAddition) state).liquid_bounce$getEntity();
var ownerName = ModuleMobOwners.INSTANCE.getOwnerInfoText(entity);
if (ownerName != null) {
@@ -98,11 +99,17 @@ public abstract class MixinEntityRenderer<T extends Entity> {
}
@Inject(method = "renderLabelIfPresent", at = @At("HEAD"), cancellable = true)
private void disableDuplicateNametagsAndInjectMobOwners(T entity, Text text, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, float tickDelta, CallbackInfo ci) {
private void disableDuplicateNametagsAndInjectMobOwners(S state, Text text, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
// Don't render nametags
var entity = ((EntityRenderStateAddition) state).liquid_bounce$getEntity();
if (ModuleNametags.INSTANCE.getRunning() && ModuleNametags.shouldRenderNametag(entity)) {
ci.cancel();
}
}
@Inject(method = "updateRenderState", at = @At("HEAD"))
private void hookInjectEntityIntoState(T entity, S state, float tickDelta, CallbackInfo ci) {
((EntityRenderStateAddition) state).liquid_bounce$setEntity(entity);
}
}

View File

@@ -21,8 +21,6 @@ package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.blaze3d.systems.RenderSystem;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.EventManager;
import net.ccbluex.liquidbounce.event.events.GameRenderEvent;
import net.ccbluex.liquidbounce.event.events.PerspectiveEvent;
@@ -33,15 +31,15 @@ import net.ccbluex.liquidbounce.features.module.modules.fun.ModuleDankBobbing;
import net.ccbluex.liquidbounce.features.module.modules.render.*;
import net.ccbluex.liquidbounce.features.module.modules.world.ModuleLiquidPlace;
import net.ccbluex.liquidbounce.interfaces.LightmapTextureManagerAddition;
import net.ccbluex.liquidbounce.interfaces.PostEffectPassTextureAddition;
import net.ccbluex.liquidbounce.render.engine.UIRenderer;
import net.ccbluex.liquidbounce.render.engine.UiRenderer;
import net.ccbluex.liquidbounce.render.shader.shaders.OutlineEffectShader;
import net.ccbluex.liquidbounce.utils.aiming.RaytracingExtensionsKt;
import net.ccbluex.liquidbounce.utils.aiming.Rotation;
import net.ccbluex.liquidbounce.utils.aiming.RotationManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.PostEffectProcessor;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.option.Perspective;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
@@ -49,10 +47,7 @@ import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RotationAxis;
@@ -62,7 +57,6 @@ import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -77,16 +71,6 @@ public abstract class MixinGameRenderer {
@Shadow
public abstract MinecraftClient getClient();
@Shadow
@Final
private ResourceManager resourceManager;
/**
* UI Blur Post Effect Processor
*
* @author superblaubeere27
*/
@Unique
private PostEffectProcessor blurPostEffectProcessor;
@Shadow
@Final
private Camera camera;
@@ -139,7 +123,7 @@ public abstract class MixinGameRenderer {
* Hook world render event
*/
@Inject(method = "renderWorld", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/GameRenderer;renderHand:Z", opcode = Opcodes.GETFIELD, ordinal = 0))
public void hookWorldRender(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 1) Matrix4f matrix4f2) {
public void hookWorldRender(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 2) Matrix4f matrix4f2) {
// TODO: Improve this
var newMatStack = new MatrixStack();
@@ -160,7 +144,7 @@ public abstract class MixinGameRenderer {
public void drawItemCharms(Camera camera, float tickDelta, Matrix4f matrix4f, CallbackInfo ci) {
if (ModuleItemChams.INSTANCE.getActive()) {
ModuleItemChams.INSTANCE.setActive(false);
OutlineEffectShader.INSTANCE.apply();
OutlineEffectShader.INSTANCE.apply(true);
}
}
@@ -192,14 +176,14 @@ public abstract class MixinGameRenderer {
return;
}
if (!(client.getCameraEntity() instanceof PlayerEntity playerEntity)) {
if (!(client.getCameraEntity() instanceof AbstractClientPlayerEntity playerEntity)) {
return;
}
float additionalBobbing = ModuleDankBobbing.INSTANCE.getMotion();
float g = playerEntity.horizontalSpeed - playerEntity.prevHorizontalSpeed;
float h = -(playerEntity.horizontalSpeed + g * f);
float g = playerEntity.distanceMoved - playerEntity.lastDistanceMoved;
float h = -(playerEntity.distanceMoved + g * f);
float i = MathHelper.lerp(f, playerEntity.prevStrideDistance, playerEntity.strideDistance);
matrixStack.translate((MathHelper.sin(h * MathHelper.PI) * i * 0.5F), -Math.abs(MathHelper.cos(h * MathHelper.PI) * i), 0.0D);
matrixStack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(MathHelper.sin(h * MathHelper.PI) * i * (3.0F + additionalBobbing)));
@@ -210,59 +194,19 @@ public abstract class MixinGameRenderer {
@Inject(method = "onResized", at = @At("HEAD"))
private void injectResizeUIBlurShader(int width, int height, CallbackInfo ci) {
if (this.blurPostEffectProcessor != null) {
this.blurPostEffectProcessor.setupDimensions(width, height);
}
UIRenderer.INSTANCE.setupDimensions(width, height);
}
@Inject(method = "loadPrograms", at = @At("TAIL"))
private void hookUIBlurLoad(final CallbackInfo ci) {
if (this.blurPostEffectProcessor == null) {
try {
var identifier = Identifier.of("liquidbounce", "shaders/post/ui_blur.json");
this.blurPostEffectProcessor = new PostEffectProcessor(this.client.getTextureManager(), this.resourceManager,
this.client.getFramebuffer(), identifier);
this.blurPostEffectProcessor.setupDimensions(this.client.getWindow().getFramebufferWidth(),
this.client.getWindow().getFramebufferHeight());
} catch (final Exception e) {
LiquidBounce.INSTANCE.getLogger().error("Failed to load UI blur shader", e);
}
}
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawEntityOutlinesFramebuffer()V", shift = At.Shift.AFTER))
private void injectUIBlurRender(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci) {
if (!ModuleHud.INSTANCE.isBlurable() || this.blurPostEffectProcessor == null) {
return;
}
RenderSystem.disableBlend();
RenderSystem.disableDepthTest();
RenderSystem.resetTextureMatrix();
var overlayFramebuffer = UIRenderer.INSTANCE.getOverlayFramebuffer();
var overlayTexture = overlayFramebuffer.getColorAttachment();
overlayFramebuffer.beginRead();
RenderSystem.setShaderTexture(0, overlayTexture);
((PostEffectPassTextureAddition) this.blurPostEffectProcessor.passes.get(0)).liquid_bounce$setTextureSampler("Overlay", overlayTexture);
this.blurPostEffectProcessor.passes.get(0).getProgram().getUniformByName("Radius").set(UIRenderer.INSTANCE.getBlurRadius());
this.blurPostEffectProcessor.render(tickCounter.getTickDelta(false));
UiRenderer.INSTANCE.setupDimensions(width, height);
}
@Inject(method = "render", at = @At(value = "RETURN"))
private void hookRenderEventStop(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci) {
UIRenderer.INSTANCE.endUIOverlayDrawing();
UiRenderer.INSTANCE.endUIOverlayDrawing();
}
@Inject(method = "renderBlur", at = @At("HEAD"))
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.BEFORE))
private void injectRenderBlur(CallbackInfo ci) {
UIRenderer.INSTANCE.endUIOverlayDrawing();
if (!(client.currentScreen instanceof ChatScreen)) {
UiRenderer.INSTANCE.endUIOverlayDrawing();
}
}
@Inject(method = "showFloatingItem", at = @At("HEAD"), cancellable = true)
@@ -294,14 +238,6 @@ public abstract class MixinGameRenderer {
return result;
}
@Inject(method = "renderNausea", at = @At("HEAD"), cancellable = true)
private void hookNauseaOverlay(DrawContext context, float distortionStrength, CallbackInfo ci) {
var antiBlind = ModuleAntiBlind.INSTANCE;
if (antiBlind.getRunning() && antiBlind.getAntiNausea()) {
ci.cancel();
}
}
@ModifyExpressionValue(method = "renderWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;lerp(FFF)F"))
private float hookNausea(float original) {
var antiBlind = ModuleAntiBlind.INSTANCE;
@@ -333,11 +269,11 @@ public abstract class MixinGameRenderer {
}
@ModifyReturnValue(method = "getFov", at = @At("RETURN"))
private double injectShit(double original) {
private float injectShit(float original) {
var screen = ModuleDroneControl.INSTANCE.getScreen();
if (screen != null) {
return Math.min(120.0, original / screen.getZoomFactor());
return Math.min(120f, original / screen.getZoomFactor());
}
return original;

View File

@@ -22,6 +22,7 @@ package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleAntiBlind;
import net.minecraft.client.gui.hud.InGameOverlayRenderer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
@@ -42,7 +43,7 @@ public abstract class MixinInGameOverlayRenderer {
}
@Inject(method = "renderInWallOverlay", at = @At("HEAD"), cancellable = true)
private static void hookWallOverlay(Sprite sprite, MatrixStack matrices, CallbackInfo ci) {
private static void hookWallOverlay(Sprite sprite, MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo ci) {
var antiBlind = ModuleAntiBlind.INSTANCE;
if (antiBlind.getRunning() && antiBlind.getWallOverlay()) {
ci.cancel();

View File

@@ -0,0 +1,41 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2024 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import net.minecraft.client.option.InactivityFpsLimiter;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(InactivityFpsLimiter.class)
public abstract class MixinInactivityFpsLimiter {
@Shadow
private int maxFps;
/**
* Removes frame rate limit
*/
@ModifyConstant(method = "update", constant = @Constant(intValue = 60))
private int getFramerateLimit(int original) {
return maxFps;
}
}

View File

@@ -21,24 +21,24 @@ package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import net.ccbluex.liquidbounce.features.module.modules.combat.ModuleSwordBlock;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ModelTransformationMode;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static net.minecraft.client.render.model.json.ModelTransformationMode.THIRD_PERSON_LEFT_HAND;
import static net.minecraft.client.render.model.json.ModelTransformationMode.THIRD_PERSON_RIGHT_HAND;
import static net.minecraft.item.ModelTransformationMode.THIRD_PERSON_LEFT_HAND;
import static net.minecraft.item.ModelTransformationMode.THIRD_PERSON_RIGHT_HAND;
@Mixin(ItemRenderer.class)
public class MixinItemRender {
@Inject(method = "renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/world/World;III)V", at = @At("HEAD"), cancellable = true)
@Inject(method = "renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/world/World;III)V", at = @At("HEAD"), cancellable = true)
private void hookRenderItem(LivingEntity entity, ItemStack item, ModelTransformationMode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, World world, int light, int overlay, int seed, CallbackInfo ci) {
if (renderMode == (leftHanded ? THIRD_PERSON_LEFT_HAND : THIRD_PERSON_RIGHT_HAND) && entity instanceof PlayerEntity player && ModuleSwordBlock.INSTANCE.shouldHideOffhand(player, item.getItem())) {
ci.cancel();

View File

@@ -19,15 +19,15 @@
package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.mojang.blaze3d.systems.RenderSystem;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleAntiBlind;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleCustomAmbience;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleFullBright;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleXRay;
import net.ccbluex.liquidbounce.interfaces.LightmapTextureManagerAddition;
import net.minecraft.client.gl.SimpleFramebuffer;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.NativeImageBackedTexture;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.registry.entry.RegistryEntry;
@@ -37,32 +37,18 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(LightmapTextureManager.class)
public abstract class MixinLightmapTextureManager implements LightmapTextureManagerAddition {
@Shadow
@Final
private NativeImage image;
@Shadow
@Final
private NativeImageBackedTexture texture;
@Shadow
private boolean dirty;
@Unique
private final int[] liquid_bounce$originalLightColor = new int[256];
private SimpleFramebuffer lightmapFramebuffer;
@Unique
private short liquid_bounce$currentIndex = 0;
@Unique
private boolean liquid_bounce$dirty = false;
private boolean liquid_bounce$customLightMap = false;
@ModifyExpressionValue(method = "update(F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/SimpleOption;getValue()Ljava/lang/Object;", ordinal = 1))
private Object injectXRayFullBright(Object original) {
@@ -82,54 +68,45 @@ public abstract class MixinLightmapTextureManager implements LightmapTextureMana
return (double) Float.MAX_VALUE;
}
@Inject(method = "update(F)V", at = @At(value = "HEAD"))
@Inject(method = "update(F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V"))
private void hookBlendTextureColors(float delta, CallbackInfo ci) {
if (!dirty && ModuleCustomAmbience.CustomLightColor.INSTANCE.getRunning()) {
liquid_bounce$dirty = true;
liquid_bounce$currentIndex = 0;
for (int y = 0; y < 16; y++) {
for (int x = 0; x < 16; x++) {
image.setColor(x, y, ModuleCustomAmbience.CustomLightColor.INSTANCE.blendWithLightColor(liquid_bounce$originalLightColor[liquid_bounce$currentIndex]));
liquid_bounce$currentIndex++;
}
}
texture.upload();
var lightColor = ModuleCustomAmbience.CustomLightColor.INSTANCE;
if (lightColor.getRunning()) {
lightColor.update();
}
}
@Inject(method = "update(F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/GameOptions;getDarknessEffectScale()Lnet/minecraft/client/option/SimpleOption;"))
@Inject(method = "update(F)V", at = @At(value = "HEAD"))
private void hookResetIndex(float delta, CallbackInfo ci) {
if (ModuleCustomAmbience.CustomLightColor.INSTANCE.getRunning()) {
liquid_bounce$dirty = true;
liquid_bounce$currentIndex = 0;
var customLightColor = ModuleCustomAmbience.CustomLightColor.INSTANCE;
if (customLightColor.getRunning()) {
liquid_bounce$customLightMap = true;
if (RenderSystem.getShaderTexture(2) == lightmapFramebuffer.getColorAttachment()) {
RenderSystem.setShaderTexture(2, customLightColor.getFramebuffer().getColorAttachment());
}
}
}
@ModifyArg(method = "update(F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/NativeImage;setColor(III)V"), index = 2)
private int cacheAndModifyTextureColor(int color) {
if (liquid_bounce$dirty) {
liquid_bounce$originalLightColor[liquid_bounce$currentIndex] = color;
liquid_bounce$currentIndex++;
return ModuleCustomAmbience.CustomLightColor.INSTANCE.blendWithLightColor(color);
@Inject(method = "enable", at = @At("HEAD"), cancellable = true)
private void hookSpoof(CallbackInfo ci) {
if (liquid_bounce$customLightMap) {
RenderSystem.setShaderTexture(2, ModuleCustomAmbience.CustomLightColor.INSTANCE.getFramebuffer().getColorAttachment());
ci.cancel();
}
return color;
}
@Unique
@Override
public void liquid_bounce$restoreLightMap() {
if (liquid_bounce$dirty) {
liquid_bounce$dirty = false;
liquid_bounce$currentIndex = 0;
for (int y = 0; y < 16; y++) {
for (int x = 0; x < 16; x++) {
image.setColor(x, y, liquid_bounce$originalLightColor[liquid_bounce$currentIndex]);
liquid_bounce$currentIndex++;
}
}
texture.upload();
if (RenderSystem.getShaderTexture(2) != 0) {
RenderSystem.setShaderTexture(2, lightmapFramebuffer.getColorAttachment());
}
liquid_bounce$customLightMap = false;
}
@Inject(method = "close", at = @At("HEAD"))
private void hookClose(CallbackInfo ci) {
ModuleCustomAmbience.CustomLightColor.INSTANCE.close();
}
// Turns off blinking when the darkness effect is active.

View File

@@ -21,16 +21,20 @@ package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.sugar.Local;
import it.unimi.dsi.fastutil.floats.FloatFloatPair;
import net.ccbluex.liquidbounce.features.cosmetic.CosmeticCategory;
import net.ccbluex.liquidbounce.features.cosmetic.CosmeticService;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleESP;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleRotations;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleTrueSight;
import net.ccbluex.liquidbounce.interfaces.EntityRenderStateAddition;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.state.LivingEntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.MathHelper;
@@ -44,18 +48,18 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(LivingEntityRenderer.class)
public class MixinLivingEntityRenderer<T extends LivingEntity> {
public class MixinLivingEntityRenderer<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> {
@Unique
private final ThreadLocal<@Nullable FloatFloatPair> rotationPitch = ThreadLocal.withInitial(Suppliers.nul());
@Inject(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("HEAD"))
private void injectRender(T livingEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) {
@Inject(method = "render(Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("HEAD"))
private void injectRender(S livingEntityRenderState, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) {
final var rotationPitch = ModuleRotations.INSTANCE.getRotationPitch();
this.rotationPitch.remove();
if (livingEntity != MinecraftClient.getInstance().player || !ModuleRotations.INSTANCE.shouldDisplayRotations() || !ModuleRotations.INSTANCE.getBodyParts().getHead()) {
if (((EntityRenderStateAddition) livingEntityRenderState).liquid_bounce$getEntity() != MinecraftClient.getInstance().player || !ModuleRotations.INSTANCE.shouldDisplayRotations() || !ModuleRotations.INSTANCE.getBodyParts().getHead()) {
return;
}
@@ -65,23 +69,23 @@ public class MixinLivingEntityRenderer<T extends LivingEntity> {
/**
* Head rotation pitch injection hook
*/
@Redirect(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;lerp(FFF)F", ordinal = 0))
private float injectRotationPitch(float g, float f, float s) {
@Redirect(method = "updateRenderState(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getLerpedPitch(F)F"))
private float injectRotationPitch(LivingEntity instance, float v) {
final var rot = this.rotationPitch.get();
if (rot != null) {
return MathHelper.lerp(g, rot.keyFloat(), rot.valueFloat());
return MathHelper.lerp(v, rot.keyFloat(), rot.valueFloat());
} else {
return MathHelper.lerp(g, f, s);
return instance.getLerpedPitch(v);
}
}
@ModifyExpressionValue(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isInvisibleTo(Lnet/minecraft/entity/player/PlayerEntity;)Z"))
private boolean injectTrueSight(boolean original, T livingEntity) {
@ModifyExpressionValue(method = "render(Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/LivingEntityRenderer;isVisible(Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;)Z"))
private boolean injectTrueSight(boolean original, @Local(argsOnly = true) S livingEntityRenderState) {
// Check if TrueSight is enabled and entities are enabled or ESP is enabled and in glow mode
if (ModuleTrueSight.INSTANCE.getRunning() && ModuleTrueSight.INSTANCE.getEntities() ||
ModuleESP.INSTANCE.getRunning() && ModuleESP.INSTANCE.requiresTrueSight(livingEntity)) {
return false;
ModuleESP.INSTANCE.getRunning() && ModuleESP.INSTANCE.requiresTrueSight(((LivingEntity) ((EntityRenderStateAddition) livingEntityRenderState).liquid_bounce$getEntity()))) {
return true;
}
return original;

View File

@@ -20,9 +20,10 @@ package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import net.ccbluex.liquidbounce.features.module.modules.combat.ModuleSwordBlock;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.entity.PlayerEntityRenderer;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -32,12 +33,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(PlayerEntityRenderer.class)
public class MixinPlayerEntityRenderer {
@Inject(method = "getArmPose", at = @At("HEAD"), cancellable = true)
private static void injectArmPose(AbstractClientPlayerEntity player, Hand hand, CallbackInfoReturnable<BipedEntityModel.ArmPose> cir) {
if (hand == Hand.OFF_HAND && player == MinecraftClient.getInstance().player) {
if (ModuleSwordBlock.INSTANCE.shouldHideOffhand()) {
cir.setReturnValue(BipedEntityModel.ArmPose.EMPTY);
}
@Inject(method = "getArmPose(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;)Lnet/minecraft/client/render/entity/model/BipedEntityModel$ArmPose;", at = @At("HEAD"), cancellable = true)
private static void injectArmPose(PlayerEntity player, ItemStack stack, Hand hand, CallbackInfoReturnable<BipedEntityModel.ArmPose> cir) {
if (hand == Hand.OFF_HAND && player == MinecraftClient.getInstance().player && ModuleSwordBlock.INSTANCE.shouldHideOffhand()) {
cir.setReturnValue(BipedEntityModel.ArmPose.EMPTY);
}
}

View File

@@ -1,37 +0,0 @@
package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import net.ccbluex.liquidbounce.interfaces.PostEffectPassTextureAddition;
import net.minecraft.client.gl.JsonEffectShaderProgram;
import net.minecraft.client.gl.PostEffectPass;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.HashMap;
import java.util.Map;
@Mixin(PostEffectPass.class)
public class MixinPostEffectPass implements PostEffectPassTextureAddition {
@Shadow
@Final
private JsonEffectShaderProgram program;
@Unique
private final Map<String, Integer> textureSamplerMap = new HashMap<>();
@Override
public void liquid_bounce$setTextureSampler(String name, int textureId) {
this.textureSamplerMap.put(name, textureId);
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gl/Framebuffer;endWrite()V", ordinal = 0))
private void injectTextureSamplerMap(float time, CallbackInfo ci) {
for (Map.Entry<String, Integer> stringIntegerEntry : this.textureSamplerMap.entrySet()) {
this.program.bindSampler(stringIntegerEntry.getKey(), stringIntegerEntry::getValue);
}
}
}

View File

@@ -20,12 +20,16 @@
package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleNoSignRender;
import net.ccbluex.liquidbounce.utils.client.SignTranslationFixKt;
import net.minecraft.block.entity.SignText;
import net.minecraft.text.OrderedText;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Arrays;
@@ -34,6 +38,10 @@ import java.util.function.Function;
@Mixin(SignText.class)
public class MixinSignText {
@Shadow
@Final
private Text[] messages;
@Inject(method = "getOrderedMessages", at = @At("HEAD"), cancellable = true)
private void injectNoSignRender(boolean filtered, Function<Text, OrderedText> messageOrderer, CallbackInfoReturnable<OrderedText[]> cir) {
if (ModuleNoSignRender.INSTANCE.getRunning()) {
@@ -43,4 +51,23 @@ public class MixinSignText {
}
}
/**
* Fixes a vulnerability where the server can find out about the installed mods via translated text.
* <p>
* This is not the same fix as by https://modrinth.com/mod/moddetectionpreventer/ even if it fixes the same issue.
* In order to prevent further issues, we completely disallow creating a sign text with unknown translatable.
*/
@Inject(method = "<init>([Lnet/minecraft/text/Text;[Lnet/minecraft/text/Text;Lnet/minecraft/util/DyeColor;Z)V", at = @At("RETURN"))
private void injectSignVulnerabilityFix(CallbackInfo ci) {
for (int i = 0; i < this.messages.length; i++) {
var msg = this.messages[i];
if (msg == null) {
continue;
}
this.messages[i] = SignTranslationFixKt.filterNonVanillaText(msg);
}
}
}

View File

@@ -32,12 +32,12 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(TextRenderer.class)
public abstract class MixinTextRenderer {
@ModifyArg(method = "drawInternal(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;IIZ)I", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;drawLayer(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)F"), index = 0)
@ModifyArg(method = "drawInternal(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;IIZ)I", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;drawLayer(Ljava/lang/String;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;IIZ)F"), index = 0)
private String injectNameProtectA(String text) {
return ModuleNameProtect.INSTANCE.replace(text);
}
@Redirect(method = "drawLayer(Lnet/minecraft/text/OrderedText;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;II)F", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/OrderedText;accept(Lnet/minecraft/text/CharacterVisitor;)Z"))
@Redirect(method = "drawLayer(Lnet/minecraft/text/OrderedText;FFIZLorg/joml/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/font/TextRenderer$TextLayerType;IIZ)F", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/OrderedText;accept(Lnet/minecraft/text/CharacterVisitor;)Z"))
private boolean injectNameProtectB(OrderedText orderedText, CharacterVisitor visitor) {
if (ModuleNameProtect.INSTANCE.getRunning()) {
final OrderedText wrapped = new ModuleNameProtect.NameProtectOrderedText(orderedText);

View File

@@ -0,0 +1,73 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2024 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleCustomAmbience;
import net.minecraft.client.render.WeatherRendering;
import net.minecraft.world.biome.Biome;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
@Mixin(WeatherRendering.class)
public abstract class MixinWeatherRendering {
@ModifyExpressionValue(method = "addParticlesAndSound", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getRainGradient(F)F"))
private float ambientPrecipitation2(float original) {
var moduleCustomAmbience = ModuleCustomAmbience.INSTANCE;
if (moduleCustomAmbience.getRunning() && moduleCustomAmbience.getWeather().get() == ModuleCustomAmbience.WeatherType.SNOWY) {
return 0f;
}
return original;
}
@ModifyVariable(method = "renderPrecipitation(Lnet/minecraft/world/World;Lnet/minecraft/client/render/VertexConsumerProvider;IFLnet/minecraft/util/math/Vec3d;)V", at = @At(value = "STORE"), ordinal = 1)
private int modifyPrecipitationLayers(int original) {
var precipitation = ModuleCustomAmbience.Precipitation.INSTANCE;
if (precipitation.getRunning()) {
return precipitation.getLayers();
}
return original;
}
@ModifyExpressionValue(method = "renderPrecipitation(Lnet/minecraft/world/World;Lnet/minecraft/client/render/VertexConsumerProvider;IFLnet/minecraft/util/math/Vec3d;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getRainGradient(F)F"))
private float modifyPrecipitationGradient(float original) {
var precipitation = ModuleCustomAmbience.Precipitation.INSTANCE;
if (precipitation.getRunning() && original != 0f) {
return precipitation.getGradient();
}
return original;
}
@ModifyReturnValue(method = "getPrecipitationAt", at = @At(value = "RETURN", ordinal = 1))
private Biome.Precipitation modifyBiomePrecipitation(Biome.Precipitation original) {
var moduleOverrideWeather = ModuleCustomAmbience.INSTANCE;
if (moduleOverrideWeather.getRunning() && moduleOverrideWeather.getWeather().get() == ModuleCustomAmbience.WeatherType.SNOWY) {
return Biome.Precipitation.SNOW;
}
return original;
}
}

View File

@@ -19,7 +19,7 @@
package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import net.ccbluex.liquidbounce.common.OutlineFlag;
import net.ccbluex.liquidbounce.event.EventManager;
import net.ccbluex.liquidbounce.event.events.DrawOutlinesEvent;
@@ -32,11 +32,13 @@ import net.ccbluex.liquidbounce.utils.combat.CombatExtensionsKt;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.Framebuffer;
import net.minecraft.client.render.*;
import net.minecraft.client.util.Handle;
import net.minecraft.client.util.ObjectAllocator;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.TntEntity;
import net.minecraft.world.biome.Biome;
import net.minecraft.util.profiler.Profiler;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Final;
@@ -52,48 +54,48 @@ import static org.lwjgl.opengl.GL11.*;
@Mixin(WorldRenderer.class)
public abstract class MixinWorldRenderer {
@Shadow
@Nullable
public Framebuffer entityOutlinesFramebuffer;
@Shadow
protected abstract void renderEntity(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers);
@Shadow
public abstract @Nullable Framebuffer getEntityOutlinesFramebuffer();
@Shadow
protected abstract boolean canDrawEntityOutlines();
@Shadow
protected abstract void renderTargetBlockOutline(Camera camera, VertexConsumerProvider.Immediate vertexConsumers, MatrixStack matrices, boolean translucent);
@Shadow
@Final
private MinecraftClient client;
@Shadow
@Final
public DefaultFramebufferSet framebufferSet;
@Shadow
protected abstract void renderEntity(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers);
@Shadow
@Nullable
public Framebuffer entityOutlineFramebuffer;
@Inject(method = "loadEntityOutlinePostProcessor", at = @At("RETURN"))
private void onLoadEntityOutlineShader(CallbackInfo info) {
try {
OutlineShader.INSTANCE.load();
} catch (Throwable e) {
ClientUtilsKt.getLogger().error("Failed to load outline shader", e);
}
// load the shader class to compile the shaders
//noinspection unused
var instance = OutlineShader.INSTANCE;
}
@Inject(method = "render", at = @At("HEAD"))
private void onRender(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
@Inject(method = "render", at = @At("HEAD"))
private void onRender(ObjectAllocator allocator, RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, Matrix4f positionMatrix, Matrix4f projectionMatrix, CallbackInfo ci) {
try {
if (!OutlineShader.INSTANCE.isReady()) {
return;
}
OutlineShader outlineShader = OutlineShader.INSTANCE;
outlineShader.begin(2.0F);
outlineShader.getFramebuffer().beginWrite(false);
OutlineShader.INSTANCE.update();
outlineShader.getHandle().get().beginWrite(false);
var event = new DrawOutlinesEvent(new MatrixStack(), camera, tickCounter.getTickDelta(false), DrawOutlinesEvent.OutlineType.INBUILT_OUTLINE);
EventManager.INSTANCE.callEvent(event);
if (event.getDirtyFlag()) {
outlineShader.setDirty();
outlineShader.setDirty(true);
}
client.getFramebuffer().beginWrite(false);
@@ -105,14 +107,13 @@ public abstract class MixinWorldRenderer {
@Inject(method = "renderEntity", at = @At("HEAD"))
private void injectOutlineESP(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo info) {
// Prevent stack overflow
if (RenderingFlags.isCurrentlyRenderingEntityOutline().get() || !OutlineShader.INSTANCE.isReady()) {
if (RenderingFlags.isCurrentlyRenderingEntityOutline().get()) {
return;
}
Color4b color;
if (ModuleESP.OutlineMode.INSTANCE.getRunning() && entity instanceof LivingEntity
&& CombatExtensionsKt.shouldBeShown(entity)) {
if (ModuleESP.OutlineMode.INSTANCE.getRunning() && entity instanceof LivingEntity && CombatExtensionsKt.shouldBeShown(entity)) {
color = ModuleESP.INSTANCE.getColor((LivingEntity) entity);
} else if (ModuleItemESP.OutlineMode.INSTANCE.getRunning() && ModuleItemESP.INSTANCE.shouldRender(entity)) {
color = ModuleItemESP.INSTANCE.getColor();
@@ -120,39 +121,39 @@ public abstract class MixinWorldRenderer {
return;
}
OutlineShader outlineShader = OutlineShader.INSTANCE;
Framebuffer originalBuffer = this.entityOutlinesFramebuffer;
var outlineShader = OutlineShader.INSTANCE;
var originalBuffer = framebufferSet.entityOutlineFramebuffer;
var originalBuffer2 = entityOutlineFramebuffer;
this.entityOutlinesFramebuffer = outlineShader.getFramebuffer();
framebufferSet.entityOutlineFramebuffer = outlineShader.getHandle();
entityOutlineFramebuffer = outlineShader.getHandle().get();
outlineShader.setColor(color);
outlineShader.setDirty();
outlineShader.setDirty(true);
RenderingFlags.isCurrentlyRenderingEntityOutline().set(true);
try {
renderEntity(entity, cameraX, cameraY, cameraZ, tickDelta, matrices,
outlineShader.getVertexConsumerProvider());
renderEntity(entity, cameraX, cameraY, cameraZ, tickDelta, matrices, outlineShader.getVertexConsumerProvider());
} finally {
RenderingFlags.isCurrentlyRenderingEntityOutline().set(false);
}
this.entityOutlinesFramebuffer = originalBuffer;
entityOutlineFramebuffer = originalBuffer2;
framebufferSet.entityOutlineFramebuffer = originalBuffer;
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/OutlineVertexConsumerProvider;draw()V"))
private void onDrawOutlines(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
if (!ModuleESP.OutlineMode.INSTANCE.getRunning()) {
return;
@Inject(method = "method_62214", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/OutlineVertexConsumerProvider;draw()V"))
private void onDrawOutlines(Fog fog, RenderTickCounter renderTickCounter, Camera camera, Profiler profiler, Matrix4f matrix4f, Matrix4f matrix4f2, Handle handle, Handle handle2, Handle handle3, Handle handle4, boolean bl, Frustum frustum, Handle handle5, CallbackInfo ci) {
if (OutlineShader.INSTANCE.getDirty()) {
OutlineShader.INSTANCE.draw();
}
OutlineShader.INSTANCE.end(tickCounter.getTickDelta(false));
}
@Inject(method = "drawEntityOutlinesFramebuffer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gl/Framebuffer;draw(IIZ)V"))
@Inject(method = "drawEntityOutlinesFramebuffer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gl/Framebuffer;drawInternal(II)V"))
private void onDrawEntityOutlinesFramebuffer(CallbackInfo info) {
if (OutlineShader.INSTANCE.isReady() && OutlineShader.INSTANCE.isDirty()) {
OutlineShader.INSTANCE.drawFramebuffer();
if (OutlineShader.INSTANCE.getDirty()) {
OutlineShader.INSTANCE.apply(false);
}
}
@@ -179,12 +180,7 @@ public abstract class MixinWorldRenderer {
}
}
@Inject(method = "onResized", at = @At("HEAD"))
private void onResized(int w, int h, CallbackInfo info) {
OutlineShader.INSTANCE.onResized(w, h);
}
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isSleeping()Z"))
@Redirect(method = "getEntitiesToRender", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isSleeping()Z"))
private boolean hookFreeCamRenderPlayerFromAllPerspectives(LivingEntity instance) {
return ModuleFreeCam.INSTANCE.renderPlayerFromAllPerspectives(instance);
}
@@ -194,7 +190,7 @@ public abstract class MixinWorldRenderer {
*
* @author 1zuna
*/
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;hasOutline(Lnet/minecraft/entity/Entity;)Z"))
@Redirect(method = "renderEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;hasOutline(Lnet/minecraft/entity/Entity;)Z"))
private boolean injectHasOutline(MinecraftClient instance, Entity entity) {
if (ModuleItemESP.GlowMode.INSTANCE.getRunning() && ModuleItemESP.INSTANCE.shouldRender(entity)) {
return true;
@@ -213,12 +209,31 @@ public abstract class MixinWorldRenderer {
return instance.hasOutline(entity);
}
@Redirect(method = "getEntitiesToRender", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;hasOutline(Lnet/minecraft/entity/Entity;)Z"))
private boolean injectHasOutline2(MinecraftClient instance, Entity entity) {
if (ModuleItemESP.GlowMode.INSTANCE.getRunning() && ModuleItemESP.INSTANCE.shouldRender(entity)) {
return true;
}
if (ModuleESP.GlowMode.INSTANCE.getRunning() && CombatExtensionsKt.shouldBeShown(entity)) {
return true;
}
if (ModuleTNTTimer.INSTANCE.getRunning() && ModuleTNTTimer.INSTANCE.getEsp() && entity instanceof TntEntity) {
return true;
}
if (ModuleStorageESP.Glow.INSTANCE.getRunning() && ModuleStorageESP.categorize(entity) != null) {
return true;
}
return instance.hasOutline(entity);
}
/**
* Inject ESP color as glow color
*
* @author 1zuna
*/
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getTeamColorValue()I"))
@Redirect(method = "renderEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getTeamColorValue()I"))
private int injectTeamColor(Entity instance) {
if (ModuleItemESP.GlowMode.INSTANCE.getRunning() && ModuleItemESP.INSTANCE.shouldRender(instance)) {
return ModuleItemESP.INSTANCE.getColor().toARGB();
@@ -243,15 +258,16 @@ public abstract class MixinWorldRenderer {
return instance.getTeamColorValue();
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/OutlineVertexConsumerProvider;draw()V", shift = At.Shift.BEFORE))
private void onRenderOutline(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
@Inject(method = "method_62214", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/OutlineVertexConsumerProvider;draw()V", shift = At.Shift.BEFORE))
private void onRenderOutline(Fog fog, RenderTickCounter renderTickCounter, Camera camera, Profiler profiler, Matrix4f matrix4f, Matrix4f matrix4f2, Handle handle, Handle handle2, Handle handle3, Handle handle4, boolean bl, Frustum frustum, Handle handle5, CallbackInfo ci) {
if (!this.canDrawEntityOutlines()) {
return;
}
//noinspection DataFlowIssue
this.getEntityOutlinesFramebuffer().beginWrite(false);
var event = new DrawOutlinesEvent(new MatrixStack(), camera, tickCounter.getTickDelta(false), DrawOutlinesEvent.OutlineType.MINECRAFT_GLOW);
var event = new DrawOutlinesEvent(new MatrixStack(), camera, renderTickCounter.getTickDelta(false), DrawOutlinesEvent.OutlineType.MINECRAFT_GLOW);
EventManager.INSTANCE.callEvent(event);
@@ -260,20 +276,12 @@ public abstract class MixinWorldRenderer {
MinecraftClient.getInstance().getFramebuffer().beginWrite(false);
}
@ModifyVariable(method = "render",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/BufferBuilderStorage;getOutlineVertexConsumers()Lnet/minecraft/client/render/OutlineVertexConsumerProvider;",
ordinal = 1),
ordinal = 3,
name = "bl3",
require = 1
)
private boolean hookOutlineFlag(boolean bl3) {
if (OutlineFlag.drawOutline) {
@Inject(method = "method_62214", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/BufferBuilderStorage;getOutlineVertexConsumers()Lnet/minecraft/client/render/OutlineVertexConsumerProvider;", shift = At.Shift.AFTER))
private void hookOutlineFlag(Fog fog, RenderTickCounter renderTickCounter, Camera camera, Profiler profiler, Matrix4f matrix4f, Matrix4f matrix4f2, Handle handle, Handle handle2, Handle handle3, Handle handle4, boolean bl, Frustum frustum, Handle handle5, CallbackInfo ci, @Local(ordinal = 0) VertexConsumerProvider.Immediate immediate, @Local(ordinal = 0) MatrixStack matrixStack) {
if (OutlineFlag.drawOutline && !bl) {
OutlineFlag.drawOutline = false;
return true;
renderTargetBlockOutline(camera, immediate, matrixStack, false);
}
return bl3;
}
@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;setupTerrain(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/Frustum;ZZ)V"), index = 3)
@@ -281,89 +289,19 @@ public abstract class MixinWorldRenderer {
return ModuleFreeCam.INSTANCE.getRunning() || spectator;
}
@ModifyExpressionValue(method = "renderWeather", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/Biome;getPrecipitation(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/world/biome/Biome$Precipitation;"))
private Biome.Precipitation modifyBiomePrecipitation(Biome.Precipitation original) {
var moduleOverrideWeather = ModuleCustomAmbience.INSTANCE;
if (moduleOverrideWeather.getRunning() && moduleOverrideWeather.getWeather().get() == ModuleCustomAmbience.WeatherType.SNOWY) {
return Biome.Precipitation.SNOW;
}
return original;
}
@ModifyExpressionValue(method = "renderWeather", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getRainGradient(F)F"))
private float modifyPrecipitationGradient(float original) {
var precipitation = ModuleCustomAmbience.Precipitation.INSTANCE;
if (precipitation.getRunning() && original != 0f) {
return precipitation.getGradient();
}
return original;
}
@ModifyVariable(method = "renderWeather", at = @At(value = "STORE"), ordinal = 3)
private int modifyPrecipitationLayers(int original) {
var precipitation = ModuleCustomAmbience.Precipitation.INSTANCE;
if (precipitation.getRunning()) {
return precipitation.getLayers();
}
return original;
}
@ModifyExpressionValue(method = "renderWeather", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;isFancyGraphicsOrBetter()Z"))
private boolean modifyPrecipitationLayersSet(boolean original) {
var precipitation = ModuleCustomAmbience.Precipitation.INSTANCE;
if (precipitation.getRunning()) {
return false;
}
return original;
}
@ModifyExpressionValue(method = "tickRainSplashing", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getRainGradient(F)F"))
private float removeRainSplashing(float original) {
var moduleOverrideWeather = ModuleCustomAmbience.INSTANCE;
if (moduleOverrideWeather.getRunning() && moduleOverrideWeather.getWeather().get() == ModuleCustomAmbience.WeatherType.SNOWY) {
return 0f;
}
return original;
}
@ModifyArgs(
method = "drawBlockOutline",
@ModifyArgs(method = "drawBlockOutline",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/render/WorldRenderer;drawCuboidShapeOutline(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/util/shape/VoxelShape;DDDFFFF)V"
target = "Lnet/minecraft/client/render/VertexRendering;drawOutline(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/util/shape/VoxelShape;DDDI)V"
)
)
private void modifyBlockOutlineArgs(Args args) {
// args: MatrixStack matrices,
// VertexConsumer vertexConsumer,
// VoxelShape shape,
// double offsetX,
// double offsetY,
// double offsetZ,
// float red,
// float green,
// float blue,
// float alpha
if (!ModuleBlockOutline.INSTANCE.getRunning()) {
return;
}
var color = ModuleBlockOutline.INSTANCE.getOutlineColor();
var red = color.getR() / 255f;
var green = color.getG() / 255f;
var blue = color.getB() / 255f;
var alpha = color.getA() / 255f;
args.set(6, red);
args.set(7, green);
args.set(8, blue);
args.set(9, alpha);
args.set(6, ModuleBlockOutline.INSTANCE.getOutlineColor().toARGB());
}
}

View File

@@ -16,26 +16,32 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.entity;
package net.ccbluex.liquidbounce.injection.mixins.minecraft.render.entity;
import com.mojang.authlib.GameProfile;
import net.ccbluex.liquidbounce.interfaces.OtherClientPlayerEntityAddition;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.network.OtherClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.damage.DamageSource;
import net.ccbluex.liquidbounce.interfaces.EntityRenderStateAddition;
import net.minecraft.client.render.entity.state.EntityRenderState;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
@Mixin(OtherClientPlayerEntity.class)
public abstract class MixinOtherClientPlayerEntity extends AbstractClientPlayerEntity implements OtherClientPlayerEntityAddition {
@Mixin(EntityRenderState.class)
public abstract class MixinEntityRenderState implements EntityRenderStateAddition {
public MixinOtherClientPlayerEntity(ClientWorld world, GameProfile profile) {
super(world, profile);
@Unique
private Entity liquid_bounce$entity;
@Unique
@Override
@SuppressWarnings("unused")
public void liquid_bounce$setEntity(Entity entity) {
this.liquid_bounce$entity = entity;
}
@Unique
@Override
public boolean liquid_bounce$actuallyDamage(DamageSource source, float amount) {
return super.damage(source, amount);
@SuppressWarnings("unused")
public Entity liquid_bounce$getEntity() {
return liquid_bounce$entity;
}
}

View File

@@ -1,40 +1,40 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2024 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.render.entity.feature;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import net.ccbluex.liquidbounce.features.cosmetic.CosmeticCategory;
import net.ccbluex.liquidbounce.features.cosmetic.CosmeticService;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.VertexConsumerProvider;
import net.ccbluex.liquidbounce.interfaces.EntityRenderStateAddition;
import net.minecraft.client.render.entity.feature.Deadmau5FeatureRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.render.entity.state.PlayerEntityRenderState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(Deadmau5FeatureRenderer.class)
public class MixinDeadmau5FeatureRenderer {
@ModifyExpressionValue(
method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/network/AbstractClientPlayerEntity;FFFFFF)V",
at = @At(value = "INVOKE", target = "Ljava/lang/String;equals(Ljava/lang/Object;)Z")
)
private boolean onRender(
boolean original,
MatrixStack matrixStack,
VertexConsumerProvider vertexConsumerProvider,
int i,
AbstractClientPlayerEntity abstractClientPlayerEntity,
float f,
float g,
float h,
float j,
float k,
float l
) {
return original || CosmeticService.INSTANCE.hasCosmetic(abstractClientPlayerEntity.getUuid(),
CosmeticCategory.DEADMAU5_EARS);
@ModifyExpressionValue(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/PlayerEntityRenderState;FF)V", at = @At(value = "INVOKE", target = "Ljava/lang/String;equals(Ljava/lang/Object;)Z", remap = false))
private boolean onRender(boolean original, @Local(argsOnly = true) PlayerEntityRenderState playerEntityRenderState) {
return original || CosmeticService.INSTANCE.hasCosmetic(((EntityRenderStateAddition) playerEntityRenderState).liquid_bounce$getEntity().getUuid(), CosmeticCategory.DEADMAU5_EARS);
}
}

View File

@@ -14,6 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
*/
@Mixin(TextColor.class)
public class MixinTextColor implements ClientTextColorAdditions {
@Shadow
@Final
private @Nullable String name;
@@ -58,4 +59,5 @@ public class MixinTextColor implements ClientTextColorAdditions {
public int hashCode() {
return Objects.hashCode(this.name, this.rgb, this.bypassesNameProtect);
}
}

View File

@@ -11,8 +11,7 @@ import org.spongepowered.asm.mixin.injection.At;
@Mixin(TranslatableTextContent.class)
public class MixinTranslatableTextContent {
@ModifyExpressionValue(method = "updateTranslations", at = @At(value = "INVOKE",
target = "Lnet/minecraft/util/Language;getInstance()Lnet/minecraft/util/Language;"))
@ModifyExpressionValue(method = "updateTranslations", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Language;getInstance()Lnet/minecraft/util/Language;"))
private Language hookClientTranslations(Language original) {
if ((Object) this instanceof LanguageText) {
return LanguageManager.INSTANCE.getLanguage();

View File

@@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.sodium;
import net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache;
@@ -45,4 +44,5 @@ public class MixinSodiumBlockOcclusionCache {
cir.setReturnValue(module.shouldRender(selfState, pos));
cir.cancel();
}
}

View File

@@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.injection.mixins.sodium;
import net.caffeinemc.mods.sodium.client.model.light.data.LightDataAccess;

View File

@@ -18,19 +18,18 @@
*/
package net.ccbluex.liquidbounce.interfaces;
import net.ccbluex.liquidbounce.features.command.commands.ingame.fakeplayer.FakePlayer;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.item.equipment.ArmorMaterial;
import net.minecraft.item.equipment.EquipmentType;
/**
* Additions to {@link net.minecraft.client.network.OtherClientPlayerEntity}.
* Additions to {@link net.minecraft.item.ArmorItem}
*/
public interface OtherClientPlayerEntityAddition {
public interface ArmorItemAdditions {
/**
* Allows the entity to receive damage.
* Used in {@link FakePlayer}.
*/
@SuppressWarnings("unused")
boolean liquid_bounce$actuallyDamage(DamageSource source, float amount);
ArmorMaterial liquid_bounce$getMaterial();
@SuppressWarnings("unused")
EquipmentType liquid_bounce$getType();
}

View File

@@ -16,16 +16,17 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.render.shader.shaders
package net.ccbluex.liquidbounce.interfaces;
import net.ccbluex.liquidbounce.render.engine.MinecraftFramebufferShader
import net.minecraft.entity.Entity;
object DitheringShader : MinecraftFramebufferShader("dithering_shader") {
/**
* Addition to {@link net.minecraft.client.render.entity.state.EntityRenderState}
*/
public interface EntityRenderStateAddition {
fun begin(ditherAmount: Float) {
this.setUniform1f("ditherAmount", ditherAmount)
// this.vertexConsumerProvider!!.setColor(255, 255, 255, 255)
this.beginInternal()
}
void liquid_bounce$setEntity(Entity entity);
Entity liquid_bounce$getEntity();
}

View File

@@ -19,7 +19,7 @@
package net.ccbluex.liquidbounce.interfaces;
/**
* Additions to {@link net.minecraft.client.gui.hud.ChatHudLine}.
* Additions to {@link net.minecraft.client.render.LightmapTextureManager}.
*/
public interface LightmapTextureManagerAddition {

View File

@@ -16,22 +16,16 @@
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.render.shader.shaders
package net.ccbluex.liquidbounce.interfaces;
import com.mojang.blaze3d.systems.RenderSystem
import net.ccbluex.liquidbounce.render.engine.Color4b
import net.ccbluex.liquidbounce.render.engine.MinecraftFramebufferShader
import net.minecraft.item.ToolMaterial;
object BlurUIShader : MinecraftFramebufferShader("blur_ui") {
/**
* Addition to {@link net.minecraft.item.MiningToolItem}
*/
public interface MiningToolItemAddition {
fun begin(shaderTexture: Int) {
this.beginInternal()
RenderSystem.setShaderTexture(1, shaderTexture)
}
fun setColor(color: Color4b) {
this.vertexConsumerProvider?.setColor(color.r, color.g, color.b, color.a)
}
@SuppressWarnings("unused")
ToolMaterial liquid_bounce$getMaterial();
}

View File

@@ -1,5 +0,0 @@
package net.ccbluex.liquidbounce.interfaces;
public interface PostEffectPassTextureAddition {
void liquid_bounce$setTextureSampler(String name, int textureId);
}

View File

@@ -25,7 +25,6 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.protocol.version.VersionType;
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
import de.florianmichael.viafabricplus.screen.base.ProtocolSelectionScreen;
import de.florianmichael.viafabricplus.settings.impl.VisualSettings;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.utils.client.ClientProtocolVersion;
import net.minecraft.client.MinecraftClient;
@@ -41,17 +40,6 @@ public enum VfpCompatibility {
INSTANCE;
public void unsafeDisableConflictingVfpOptions() {
try {
VisualSettings visualSettings = VisualSettings.global();
// 1 == off, 0 == on
visualSettings.enableSwordBlocking.setValue(1);
} catch (Throwable throwable) {
LiquidBounce.INSTANCE.getLogger().error("Failed to disable conflicting options", throwable);
}
}
public ClientProtocolVersion unsafeGetProtocolVersion() {
try {
ProtocolVersion version = ProtocolTranslator.getTargetVersion();

View File

@@ -57,7 +57,6 @@ import net.ccbluex.liquidbounce.utils.aiming.RotationManager
import net.ccbluex.liquidbounce.utils.block.ChunkScanner
import net.ccbluex.liquidbounce.utils.client.ErrorHandler
import net.ccbluex.liquidbounce.utils.client.InteractionTracker
import net.ccbluex.liquidbounce.utils.client.disableConflictingVfpOptions
import net.ccbluex.liquidbounce.utils.client.mc
import net.ccbluex.liquidbounce.utils.combat.CombatManager
import net.ccbluex.liquidbounce.utils.combat.combatTargetsConfigurable
@@ -290,13 +289,6 @@ object LiquidBounce : EventListener {
}.onFailure {
logger.error("Failed to load settings list from API", it)
}
// Disable conflicting options
runCatching {
disableConflictingVfpOptions()
}.onSuccess {
logger.info("Disabled conflicting options.")
}
}
}

View File

@@ -50,7 +50,7 @@ open class CancellableEvent : Event() {
}
/**
* State of event. Might be PRE or POST.
* MixinEntityRenderState of event. Might be PRE or POST.
*/
enum class EventState(val stateName: String) {
PRE("PRE"), POST("POST")

View File

@@ -53,7 +53,7 @@ class KeyEvent(val key: InputUtil.Key, val action: Int) : Event()
class InputHandleEvent : Event()
@Nameable("movementInput")
class MovementInputEvent(var directionalInput: DirectionalInput, var jumping: Boolean, var sneaking: Boolean) : Event()
class MovementInputEvent(var directionalInput: DirectionalInput, var jump: Boolean, var sneak: Boolean) : Event()
@Nameable("mouseRotation")
class MouseRotationEvent(var cursorDeltaX: Double, var cursorDeltaY: Double) : CancellableEvent()

View File

@@ -23,8 +23,8 @@ package net.ccbluex.liquidbounce.event.events
import net.ccbluex.liquidbounce.event.CancellableEvent
import net.ccbluex.liquidbounce.event.Event
import net.ccbluex.liquidbounce.event.EventState
import net.ccbluex.liquidbounce.utils.client.Nameable
import net.ccbluex.liquidbounce.integration.interop.protocol.event.WebSocketEvent
import net.ccbluex.liquidbounce.utils.client.Nameable
import net.minecraft.entity.MovementType
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.fluid.Fluid
@@ -77,7 +77,7 @@ class PlayerAfterJumpEvent : Event()
class PlayerUseMultiplier(var forward: Float, var sideways: Float) : Event()
@Nameable("playerSneakMultiplier")
class PlayerSneakMultiplier(var multiplier: Float) : Event()
class PlayerSneakMultiplier(var multiplier: Double) : Event()
@Nameable("playerInteractedItem")
class PlayerInteractedItem(val player: PlayerEntity, val hand: Hand, val actionResult: ActionResult) : Event()

View File

@@ -57,7 +57,7 @@ fun enchantmentParameter(name: String = "enchantment"): ParameterBuilder<String>
.begin<String>(name)
.verifiedBy(ParameterBuilder.STRING_VALIDATOR)
.autocompletedWith { _ ->
world.registryManager.get(RegistryKeys.ENCHANTMENT).indexedEntries.map {
world.registryManager.getOrThrow(RegistryKeys.ENCHANTMENT).indexedEntries.map {
it.idAsString
}
}

View File

@@ -61,7 +61,7 @@ object CommandItems : CommandFactory {
val identifier = Identifier.tryParse(name)
val displayName = identifier.toString()
val block = Registries.BLOCK.getOrEmpty(identifier).orElseThrow {
val block = Registries.BLOCK.getOptionalValue(identifier).orElseThrow {
throw CommandException(command.result("blockNotExists", displayName))
}
@@ -86,7 +86,7 @@ object CommandItems : CommandFactory {
val identifier = Identifier.tryParse(name)
val displayName = identifier.toString()
val block = Registries.BLOCK.getOrEmpty(identifier).orElseThrow {
val block = Registries.BLOCK.getOptionalValue(identifier).orElseThrow {
throw CommandException(command.result("blockNotExists", displayName))
}

View File

@@ -194,7 +194,7 @@ object CommandItemEnchant : CommandFactory, MinecraftShortcuts {
private fun enchantmentByName(enchantmentName: String, command: Command): RegistryEntry<Enchantment> {
val identifier = Identifier.tryParse(enchantmentName)
val registry = world.registryManager.get(RegistryKeys.ENCHANTMENT)
val registry = world.registryManager.getOrThrow(RegistryKeys.ENCHANTMENT)
val enchantment = registry.getEntry(identifier).orElseThrow {
throw CommandException(command.resultWithTree("enchantmentNotExists", enchantmentName))
}
@@ -216,7 +216,7 @@ object CommandItemEnchant : CommandFactory, MinecraftShortcuts {
}
private fun enchantAll(item: ItemStack, onlyAcceptable: Boolean, level: Int?) {
world.registryManager.get(RegistryKeys.ENCHANTMENT).indexedEntries.forEach { enchantment ->
world.registryManager.getOrThrow(RegistryKeys.ENCHANTMENT).indexedEntries.forEach { enchantment ->
if(!enchantment.value().isAcceptableItem(item) && onlyAcceptable) {
return@forEach
}

View File

@@ -20,6 +20,7 @@ package net.ccbluex.liquidbounce.features.command.commands.ingame.fakeplayer
import com.mojang.authlib.GameProfile
import net.ccbluex.liquidbounce.event.EventListener
import net.ccbluex.liquidbounce.event.events.AttackEntityEvent
import net.ccbluex.liquidbounce.event.events.GameTickEvent
import net.ccbluex.liquidbounce.event.events.NotificationEvent
import net.ccbluex.liquidbounce.event.events.PacketEvent
@@ -31,11 +32,13 @@ import net.ccbluex.liquidbounce.features.command.builder.CommandBuilder
import net.ccbluex.liquidbounce.features.command.builder.ParameterBuilder
import net.ccbluex.liquidbounce.lang.translation
import net.ccbluex.liquidbounce.utils.client.*
import net.ccbluex.liquidbounce.utils.entity.getDamageFromExplosion
import net.ccbluex.liquidbounce.utils.entity.getEffectiveDamage
import net.minecraft.entity.Entity
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.attribute.EntityAttributes
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket
import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket
import net.minecraft.world.explosion.Explosion
import net.minecraft.world.explosion.ExplosionBehavior
import java.math.BigDecimal
import java.math.RoundingMode
import java.util.*
@@ -55,8 +58,6 @@ object CommandFakePlayer : CommandFactory, EventListener {
private var recording = false
private val snapshots = ArrayList<PosPoseSnapshot>()
private val explosionBehavior: ExplosionBehavior = ExplosionBehavior()
// the entity ids of fake players shouldn't conflict with real entity ids, so they are negative
private var fakePlayerId = -1
@@ -293,29 +294,14 @@ object CommandFakePlayer : CommandFactory, EventListener {
* so an ExplosionS2CPacket handler is required.
*/
if (packet is ExplosionS2CPacket) {
val explosion = Explosion(
world,
null,
packet.x,
packet.y,
packet.z,
packet.radius,
packet.affectedBlocks,
packet.destructionType,
packet.particle,
packet.emitterParticle,
packet.soundEvent
)
fakePlayers.forEach { fakePlayer ->
if (!explosionBehavior.shouldDamage(explosion, fakePlayer)) { // might not be necessary
return@handler
}
fakePlayer.damage(
Explosion.createDamageSource(world, null),
explosionBehavior.calculateDamage(explosion, fakePlayer)
val damage = fakePlayer.getDamageFromExplosion(
pos = packet.center // will only work for crystals
)
val absorption = fakePlayer.absorptionAmount
fakePlayer.health -= damage - absorption
fakePlayer.absorptionAmount -= damage.coerceAtMost(absorption)
}
}
@@ -324,14 +310,48 @@ object CommandFakePlayer : CommandFactory, EventListener {
*/
if (
packet is PlayerInteractEntityC2SPacket &&
fakePlayers.any { fakePlayers ->
packet.entityId == fakePlayers.id
fakePlayers.any { fakePlayer ->
packet.entityId == fakePlayer.id
}
) {
it.cancelEvent()
}
}
@Suppress("unused")
val attackHandler = handler<AttackEntityEvent> {
if (fakePlayers.isEmpty()) {
return@handler
}
val contains = fakePlayers.none { player ->
player.id == it.entity.id
}
if (!contains) {
return@handler
}
val fakePlayer = it.entity as LivingEntity
val genericAttackDamage = if (player.isUsingRiptide) {
player.riptideAttackDamage
} else {
player.getAttributeValue(EntityAttributes.ATTACK_DAMAGE).toFloat()
}
val damageSource = player.damageSources.playerAttack(player)
var enchantAttackDamage = player.getDamageAgainst(fakePlayer, genericAttackDamage,
damageSource) - genericAttackDamage
val attackCooldown = player.getAttackCooldownProgress(0.5f)
enchantAttackDamage *= attackCooldown
val damage = fakePlayer.getEffectiveDamage(damageSource, enchantAttackDamage, false)
val absorption = fakePlayer.absorptionAmount
fakePlayer.health -= damage - absorption
fakePlayer.absorptionAmount -= damage.coerceAtMost(absorption)
}
/**
* Recordings are made in the tick event handler.
*/

View File

@@ -19,10 +19,16 @@
package net.ccbluex.liquidbounce.features.command.commands.ingame.fakeplayer
import com.mojang.authlib.GameProfile
import net.ccbluex.liquidbounce.interfaces.OtherClientPlayerEntityAddition
import net.ccbluex.liquidbounce.event.EventManager.callEvent
import net.ccbluex.liquidbounce.event.events.PacketEvent
import net.ccbluex.liquidbounce.event.events.TransferOrigin
import net.minecraft.client.MinecraftClient
import net.minecraft.client.network.OtherClientPlayerEntity
import net.minecraft.client.world.ClientWorld
import net.minecraft.entity.damage.DamageSource
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.effect.StatusEffectInstance
import net.minecraft.entity.effect.StatusEffects
import net.minecraft.network.packet.s2c.play.EntityStatusS2CPacket
/**
* This class represents a Fake Player implementing
@@ -64,12 +70,21 @@ open class FakePlayer(
this.limbAnimator.pos = snapshot.limbPos
}
/**
* Applies the actual damage.
*/
override fun damage(source: DamageSource?, amount: Float): Boolean {
@Suppress("CAST_NEVER_SUCCEEDS") // it does succeed with the mixin into OtherClientPlayerEntity
return (this as OtherClientPlayerEntityAddition).`liquid_bounce$actuallyDamage`(source, amount)
override fun setHealth(health: Float) {
super.setHealth(health)
if (getHealth() <= 0f) {
addStatusEffect(StatusEffectInstance(StatusEffects.REGENERATION, 900, 1))
addStatusEffect(StatusEffectInstance(StatusEffects.ABSORPTION, 100, 1))
addStatusEffect(StatusEffectInstance(StatusEffects.FIRE_RESISTANCE, 800, 0))
setHealth(1.0f)
val packet = EntityStatusS2CPacket(LivingEntity::class.java.cast(this), 35.toByte())
val event = PacketEvent(TransferOrigin.RECEIVE, packet, true)
callEvent(event)
if (!event.isCancelled) {
packet.apply(MinecraftClient.getInstance().networkHandler)
}
}
}
/**
@@ -81,6 +96,10 @@ open class FakePlayer(
}
super.tick()
if (age % 10 == 0 && health < 20f) {
health = (health + 0.5f).coerceAtMost(20f)
}
}
/**

View File

@@ -59,7 +59,7 @@ object CommandXRay : CommandFactory {
val identifier = Identifier.tryParse(name)
val displayName = identifier.toString()
val block = Registries.BLOCK.getOrEmpty(identifier).orElseThrow {
val block = Registries.BLOCK.getOptionalValue(identifier).orElseThrow {
throw CommandException(command.result("blockNotExists", displayName))
}
@@ -87,7 +87,7 @@ object CommandXRay : CommandFactory {
val identifier = Identifier.tryParse(name)
val displayName = identifier.toString()
val block = Registries.BLOCK.getOrEmpty(identifier).orElseThrow {
val block = Registries.BLOCK.getOptionalValue(identifier).orElseThrow {
throw CommandException(command.result("blockNotExists", displayName))
}

View File

@@ -86,7 +86,7 @@ fun SimpleInventory.inventoryAsCompound(title: Text): List<NbtCompound> {
val itemList = NbtList()
stacks.forEachIndexed { index, itemStack ->
val itemCompound = itemStack.encode(DynamicRegistryManager.EMPTY) as NbtCompound
val itemCompound = itemStack.toNbt(DynamicRegistryManager.EMPTY) as NbtCompound
itemCompound.putByte("Slot", index.toByte())
itemList.add(itemCompound)

View File

@@ -20,6 +20,9 @@ package net.ccbluex.liquidbounce.features.cosmetic
import com.mojang.authlib.GameProfile
import net.ccbluex.liquidbounce.LiquidBounce
import net.ccbluex.liquidbounce.event.EventListener
import net.ccbluex.liquidbounce.event.events.DisconnectEvent
import net.ccbluex.liquidbounce.event.handler
import net.ccbluex.liquidbounce.utils.client.mc
import net.minecraft.client.texture.NativeImage
import net.minecraft.client.texture.NativeImageBackedTexture
@@ -31,7 +34,7 @@ import java.net.URI
/**
* A cape cosmetic manager
*/
object CapeCosmeticsManager {
object CapeCosmeticsManager : EventListener {
/**
* I would prefer to use CLIENT_API but due to Cloudflare causing issues with SSL and their browser integrity check,
@@ -87,15 +90,16 @@ object CapeCosmeticsManager {
LiquidBounce.logger.info("Successfully loaded cape for ${player.name}")
val id = Identifier.of("liquidbounce", "cape-$name")
// Register cape texture
val capeTexture = mc.textureManager.registerDynamicTexture("liquidbounce-$name",
nativeImageBackedTexture)
mc.textureManager.registerTexture(id, nativeImageBackedTexture)
// Cache cape texture
cachedCapes[name] = capeTexture
cachedCapes[name] = id
// Return cape texture
response.response(capeTexture)
response.response(id)
}
}
}
@@ -136,4 +140,10 @@ object CapeCosmeticsManager {
return name to String.format(CAPE_NAME_DL_BASE_URL, name)
}
@Suppress("unused")
private val disconnectHandler = handler<DisconnectEvent> {
cachedCapes.values.forEach { mc.textureManager.destroyTexture(it) }
cachedCapes.clear()
}
}

View File

@@ -25,6 +25,7 @@ import net.ccbluex.liquidbounce.api.oauth.OAuthClient
import net.ccbluex.liquidbounce.config.gson.util.decode
import net.ccbluex.liquidbounce.config.types.Configurable
import net.ccbluex.liquidbounce.event.EventListener
import net.ccbluex.liquidbounce.event.events.DisconnectEvent
import net.ccbluex.liquidbounce.event.events.SessionEvent
import net.ccbluex.liquidbounce.event.handler
import net.ccbluex.liquidbounce.utils.client.Chronometer
@@ -76,7 +77,7 @@ object CosmeticService : EventListener, Configurable("Cosmetics") {
if (task == null) {
// Check if the required time in milliseconds has passed of the REFRESH_DELAY
if (lastUpdate.hasElapsed(REFRESH_DELAY) || force) {
task = Util.getDownloadWorkerExecutor().submit {
task = Util.getDownloadWorkerExecutor().service.submit {
runCatching {
carriers = decode<Set<String>>(HttpClient.get(CARRIERS_URL))
task = null
@@ -204,5 +205,10 @@ object CosmeticService : EventListener, Configurable("Cosmetics") {
transferTemporaryOwnership(uuid)
}
@Suppress("unused")
private val disconnectHandler = handler<DisconnectEvent> {
carriersCosmetics.clear()
}
}

View File

@@ -145,7 +145,9 @@ object ModuleBacktrack : ClientModule("Backtrack", Category.COMBAT) {
val pos = if (packet is EntityS2CPacket) {
position?.withDelta(packet.deltaX.toLong(), packet.deltaY.toLong(), packet.deltaZ.toLong())
} else {
(packet as EntityPositionS2CPacket).let { vec -> Vec3d(vec.x, vec.y, vec.z) }
(packet as EntityPositionS2CPacket).let { p ->
Vec3d(p.change.position.x, p.change.position.y, p.change.position.z)
}
}
position?.setPos(pos)
@@ -217,8 +219,7 @@ object ModuleBacktrack : ClientModule("Backtrack", Category.COMBAT) {
0.0,
0.0,
0.0,
entity.yaw,
1.0f,
1f,
event.matrixStack,
mc.bufferBuilders.entityVertexConsumers,
reducedLight

View File

@@ -42,6 +42,7 @@ import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket
import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket
import net.minecraft.network.packet.s2c.play.HealthUpdateS2CPacket
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket
import kotlin.jvm.optionals.getOrNull
/**
* FakeLag module
@@ -159,9 +160,11 @@ object ModuleFakeLag : ClientModule("FakeLag", Category.COMBAT) {
// Flush on explosion
is ExplosionS2CPacket -> {
if (packet.playerVelocityX != 0f || packet.playerVelocityY != 0f || packet.playerVelocityZ != 0f) {
chronometer.reset()
return@handler
packet.playerKnockback.getOrNull()?.let { knockback ->
if (knockback.x != 0.0 || knockback.y != 0.0 || knockback.z != 0.0) {
chronometer.reset()
return@handler
}
}
}

View File

@@ -21,9 +21,8 @@ import net.minecraft.util.math.Vec2f
import net.minecraft.util.math.Vec3d
import org.joml.Vector2d
import org.lwjgl.glfw.GLFW
import java.lang.Math.pow
import kotlin.math.hypot
import kotlin.math.log
import kotlin.math.pow
private const val DRAG_BUTTON = 0
@@ -45,8 +44,8 @@ class DroneControlScreen : Screen("BowAimbot Control Panel".asText()) {
private var zoomSteps = 0.0
fun getZoomFactor(): Double {
return pow(ZOOM_STEP_BASE, zoomSteps)
fun getZoomFactor(): Float {
return ZOOM_STEP_BASE.pow(zoomSteps).toFloat()
}
override fun mouseDragged(mouseX: Double, mouseY: Double, button: Int, deltaX: Double, deltaY: Double): Boolean {

View File

@@ -89,7 +89,7 @@ object CriticalsJump : Choice("Jump") {
// Change the jump motion only if the jump is a normal jump (small jumps, i.e. honey blocks
// are not affected) and currently.
if (enemies.isNotEmpty() && player.isOnGround) {
event.jumping = true
event.jump = true
adjustNextJump = true
}
}

View File

@@ -185,8 +185,8 @@ object CrystalAuraDamageOptions : Configurable("Damage") {
): DamageProvider {
return NormalDamageProvider(entity.getDamageFromExplosion(
crystal,
maxBlastResistance = maxBlastResistance,
include = include
include = include,
maxBlastResistance = maxBlastResistance
))
}
};

View File

@@ -95,16 +95,16 @@ abstract class PredictFeature(name: String) : ToggleableConfigurable(ModuleCryst
if (!enabled) {
return NormalDamageProvider(player.getDamageFromExplosion(
crystal,
maxBlastResistance = maxBlastResistance,
include = include
include = include,
maxBlastResistance = maxBlastResistance
))
}
val simulated = getSnapshotPos(player, ticks)
val predictedDamage = player.getDamageFromExplosion(
crystal,
maxBlastResistance = maxBlastResistance,
include = include,
maxBlastResistance = maxBlastResistance,
entityBoundingBox = Box(
simulated.x,
simulated.y,
@@ -120,7 +120,7 @@ abstract class PredictFeature(name: String) : ToggleableConfigurable(ModuleCryst
return NormalDamageProvider(predictedDamage)
}
val damage = player.getDamageFromExplosion(crystal, maxBlastResistance = maxBlastResistance, include = include)
val damage = player.getDamageFromExplosion(crystal, include = include, maxBlastResistance = maxBlastResistance)
calcMode as Both
return calcMode.logicalOperator.getDamageProvider(damage, predictedDamage)
}

View File

@@ -76,7 +76,8 @@ object SubmoduleIdPredict : ToggleableConfigurable(ModuleCrystalAura, "IDPredict
player.z,
rotation.yaw,
rotation.pitch,
player.isOnGround
player.isOnGround,
player.horizontalCollision
))
}
@@ -91,7 +92,8 @@ object SubmoduleIdPredict : ToggleableConfigurable(ModuleCrystalAura, "IDPredict
player.z,
oldRotation!!.yaw,
oldRotation!!.pitch,
player.isOnGround
player.isOnGround,
player.horizontalCollision
))
}

View File

@@ -510,14 +510,16 @@ object ModuleKillAura : ClientModule("KillAura", Category.COMBAT) {
}
if (rotations.rotationTimingMode == RotationTimingMode.ON_TICK && rotation != null) {
network.sendPacket(Full(player.x, player.y, player.z, rotation.yaw, rotation.pitch, player.isOnGround))
network.sendPacket(Full(player.x, player.y, player.z, rotation.yaw, rotation.pitch, player.isOnGround,
player.horizontalCollision))
}
attack()
if (rotations.rotationTimingMode == RotationTimingMode.ON_TICK && rotation != null) {
network.sendPacket(
Full(player.x, player.y, player.z, player.withFixedYaw(rotation), player.pitch, player.isOnGround)
Full(player.x, player.y, player.z, player.withFixedYaw(rotation), player.pitch, player.isOnGround,
player.horizontalCollision)
)
}

View File

@@ -37,9 +37,10 @@ import net.ccbluex.liquidbounce.utils.combat.shouldBeAttacked
import net.ccbluex.liquidbounce.utils.entity.isBlockAction
import net.ccbluex.liquidbounce.utils.entity.rotation
import net.minecraft.item.ItemStack
import net.minecraft.item.consume.UseAction
import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket
import net.minecraft.util.ActionResult
import net.minecraft.util.Hand
import net.minecraft.util.UseAction
import net.minecraft.util.hit.HitResult
import java.security.SecureRandom
@@ -141,7 +142,8 @@ object KillAuraAutoBlock : ToggleableConfigurable(ModuleKillAura, "AutoBlocking"
// Interact with the item in the block hand
val actionResult = interaction.interactItem(player, blockHand)
if (actionResult.isAccepted) {
if (actionResult.shouldSwingHand()) {
if (actionResult is ActionResult.Success &&
actionResult.swingSource == ActionResult.SwingSource.CLIENT) {
player.swingHand(blockHand)
}
}

View File

@@ -82,7 +82,7 @@ object KillAuraFightBot : ToggleableConfigurable(ModuleKillAura, "FightBot", fal
// Jump if we are stuck
if (player.horizontalCollision) {
ev.jumping = true
ev.jump = true
}
}

View File

@@ -26,7 +26,7 @@ import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket.PositionAndOnGr
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket
import net.minecraft.util.math.Box
import net.minecraft.util.math.Vec3i
import java.util.TreeSet
import java.util.*
import kotlin.math.roundToInt
private class Node(val position: Vec3i, var parent: Node? = null) {
@@ -124,7 +124,8 @@ object AStarMode : TpAuraChoice("AStar") {
packet.z = position.z
packet.changePosition = true
} else if (packet is PlayerPositionLookS2CPacket) {
chat(markAsError("Server setback detected - teleport failed at ${packet.x} ${packet.y} ${packet.z}!"))
val change = packet.change.position
chat(markAsError("Server setback detected - teleport failed at ${change.x} ${change.y} ${change.z}!"))
stuckChronometer.reset()
pathCache = null
desyncPlayerPosition = null
@@ -147,7 +148,7 @@ object AStarMode : TpAuraChoice("AStar") {
for (position in chunk) {
network.sendPacket(
PositionAndOnGround(
position.x + 0.5, position.y.toDouble(), position.z + 0.5, false
position.x + 0.5, position.y.toDouble(), position.z + 0.5, false, false
)
)
desyncPlayerPosition = position.toVec3d()
@@ -155,7 +156,7 @@ object AStarMode : TpAuraChoice("AStar") {
continue
} else {
// If the path is clear, we can teleport to the last position of the chunk.
network.sendPacket(PositionAndOnGround(end.x, end.y, end.z, false))
network.sendPacket(PositionAndOnGround(end.x, end.y, end.z, false, false))
desyncPlayerPosition = end
}
}

View File

@@ -69,7 +69,8 @@ internal object VelocityExemptGrim117 : Choice("ExemptGrim117") {
it.cancelEvent()
waitTicks(1)
repeat(if (alternativeBypass) 4 else 1) {
network.sendPacket(Full(player.x, player.y, player.z, player.yaw, player.pitch, player.isOnGround))
network.sendPacket(Full(player.x, player.y, player.z, player.yaw, player.pitch, player.isOnGround,
player.horizontalCollision))
}
network.sendPacket(
PlayerActionC2SPacket(

View File

@@ -57,7 +57,7 @@ internal object VelocityJumpReset : Choice("JumpReset") {
return@handler
}
it.jumping = true
it.jump = true
limitUntilJump = 0
}

Some files were not shown because too many files have changed in this diff Show More