Skip to content

Commit 28dbf53

Browse files
committed
Merge branch 'master' into feature/renderer
2 parents 38727ea + 11a6c5a commit 28dbf53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+572
-391
lines changed

.github/workflows/code_quality.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Qodana
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches:
7+
- master # The 'master' branch
8+
9+
jobs:
10+
qodana:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
checks: write
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
20+
fetch-depth: 0 # a full history is required for pull request analysis
21+
- name: 'Qodana Scan'
22+
uses: JetBrains/qodana-action@v2024.1
23+
env:
24+
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}

build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import net.fabricmc.loom.api.LoomGradleExtensionAPI
23
import net.fabricmc.loom.task.RemapJarTask
4+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
35
import java.util.*
46

57
val targets = listOf("META-INF/*.toml", "fabric.mod.json")
@@ -14,6 +16,8 @@ val minecraftVersion: String by project
1416
val yarnMappings: String by project
1517

1618
val libs = file("libs")
19+
val Project.loom: LoomGradleExtensionAPI
20+
get() = (this as ExtensionAware).extensions.getByName("loom") as LoomGradleExtensionAPI
1721

1822
plugins {
1923
kotlin("jvm") version "2.0.0"
@@ -104,4 +108,12 @@ allprojects {
104108
sourceCompatibility = JavaVersion.VERSION_17
105109
targetCompatibility = JavaVersion.VERSION_17
106110
}
111+
112+
tasks {
113+
compileKotlin {
114+
compilerOptions {
115+
jvmTarget.set(JvmTarget.JVM_17)
116+
}
117+
}
118+
}
107119
}

common/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencies {
2727
implementation(kotlin("reflect"))
2828

2929
// Baritone
30-
// modImplementation("baritone-api:baritone-api:1.10.2")
30+
// modImplementation("baritone-api:baritone-api:1.10.2")
3131
modImplementation("baritone-api:baritone-unoptimized-fabric:1.10.2")
3232
}
3333

common/src/main/java/com/lambda/mixin/entity/EntityMixin.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.lambda.mixin.entity;
22

33
import com.lambda.Lambda;
4+
import com.lambda.event.EventFlow;
5+
import com.lambda.event.events.EntityEvent;
46
import com.lambda.interaction.RotationManager;
57
import com.lambda.util.math.Vec2d;
68
import net.minecraft.entity.Entity;
@@ -9,7 +11,9 @@
911
import org.spongepowered.asm.mixin.Mixin;
1012
import org.spongepowered.asm.mixin.Shadow;
1113
import org.spongepowered.asm.mixin.injection.At;
14+
import org.spongepowered.asm.mixin.injection.Inject;
1215
import org.spongepowered.asm.mixin.injection.Redirect;
16+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1317

1418
@Mixin(Entity.class)
1519
public abstract class EntityMixin {
@@ -61,4 +65,9 @@ float fixDirectionPitch2(Entity entity) {
6165

6266
return (float) rot.getY();
6367
}
68+
69+
@Inject(method = "changeLookDirection", at = @At("HEAD"), cancellable = true)
70+
private void changeLookDirection(double cursorDeltaX, double cursorDeltaY, CallbackInfo ci) {
71+
if (EventFlow.post(new EntityEvent.ChangeLookDirection(cursorDeltaX, cursorDeltaY)).isCanceled()) ci.cancel();
72+
}
6473
}

common/src/main/java/com/lambda/mixin/entity/LivingEntityMixin.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ void onJump(CallbackInfo ci) {
4545
self.velocityDirty = true;
4646
}
4747

48-
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isImmobile()Z"))
49-
void onTravelH(CallbackInfo ci) {
50-
Entity self = (Entity) (Object) this;
51-
if (self != Lambda.getMc().player) return;
52-
53-
RotationManager.update();
54-
}
55-
5648
@Redirect(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getPitch()F"))
5749
private float hookModifyFallFlyingPitch(LivingEntity entity) {
5850
Float pitch = RotationManager.getMovementPitch();

common/src/main/java/com/lambda/mixin/input/KeyBindingMixin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.lambda.mixin.input;
22

3+
import com.lambda.module.modules.movement.Speed;
34
import com.lambda.module.modules.movement.Sprint;
45
import net.minecraft.client.option.KeyBinding;
56
import org.spongepowered.asm.mixin.Mixin;
@@ -17,5 +18,6 @@ void autoSprint(CallbackInfoReturnable<Boolean> cir) {
1718
if (!Objects.equals(instance.getTranslationKey(), "key.sprint")) return;
1819

1920
if (Sprint.INSTANCE.isEnabled()) cir.setReturnValue(true);
21+
if (Speed.INSTANCE.isEnabled() && Speed.getMode() == Speed.Mode.GRIM_STRAFE) cir.setReturnValue(true);
2022
}
2123
}

common/src/main/java/com/lambda/mixin/input/MouseMixin.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

common/src/main/kotlin/com/lambda/Lambda.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ import org.apache.logging.log4j.Logger
2121
import java.awt.Color
2222
import java.util.*
2323

24+
2425
object Lambda {
2526
const val MOD_NAME = "Lambda"
2627
const val MOD_ID = "lambda"
2728
const val SYMBOL = "λ"
2829
val VERSION: String = LoaderInfo.getVersion()
2930
val LOG: Logger = LogManager.getLogger(SYMBOL)
31+
3032
@JvmStatic
3133
val mc: MinecraftClient by lazy { MinecraftClient.getInstance() }
3234

common/src/main/kotlin/com/lambda/LoaderInfo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ object LoaderInfo {
88
@ExpectPlatform
99
@JvmStatic
1010
fun getVersion(): String = "DEV"
11-
}
11+
}

common/src/main/kotlin/com/lambda/brigadier/argument/BlockArguments.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ fun DefaultArgumentReader<BlockStateArgumentType>.value(): BlockStateArgument {
5757
/**
5858
* Creates a block predicate argument with [name] as the parameter name.
5959
*
60-
* @param context The command build context
60+
* @param name The name of the argument
61+
* @param registryAccess The command registry access
6162
*/
6263
@BrigadierDsl
6364
fun <S> blockPredicate(
@@ -70,7 +71,8 @@ fun <S> blockPredicate(
7071
/**
7172
* Creates a block state argument with [name] as the parameter name.
7273
*
73-
* @param context The command build context
74+
* @param name The name of the argument
75+
* @param registryAccess The command registry access
7476
*/
7577
@BrigadierDsl
7678
fun <S> blockState(

0 commit comments

Comments
 (0)