Skip to content

Commit e4a5e7b

Browse files
committed
Merge branch 'master' into feature/taskflow
2 parents 24fda9c + 27be54f commit e4a5e7b

File tree

85 files changed

+445
-317
lines changed

Some content is hidden

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

85 files changed

+445
-317
lines changed

common/src/main/java/com/lambda/mixin/baritone/MixinBaritonePlayerContext.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414

1515
@Mixin(value = BaritonePlayerContext.class, remap = false) // fix compileJava warning
1616
public class MixinBaritonePlayerContext {
17-
@Shadow @Final private Baritone baritone;
17+
@Shadow
18+
@Final
19+
private Baritone baritone;
1820

1921
// Let baritone know the actual rotation
2022
@Inject(method = "playerRotations", at = @At("HEAD"), cancellable = true, remap = false)

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@
2121
@Mixin(value = ClientPlayerEntity.class, priority = Integer.MAX_VALUE)
2222
public abstract class ClientPlayerEntityMixin extends EntityMixin {
2323

24-
@Shadow protected abstract void autoJump(float dx, float dz);
24+
@Shadow
25+
public Input input;
26+
@Shadow
27+
private boolean autoJumpEnabled;
2528

26-
@Shadow public abstract boolean isUsingItem();
29+
@Shadow
30+
protected abstract void autoJump(float dx, float dz);
2731

28-
@Shadow private boolean autoJumpEnabled;
29-
30-
@Shadow public Input input;
32+
@Shadow
33+
public abstract boolean isUsingItem();
3134

3235
@Inject(method = "move", at = @At("HEAD"), cancellable = true)
3336
void onMove(MovementType movementType, Vec3d movement, CallbackInfo ci) {

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313

1414
@Mixin(Entity.class)
1515
public abstract class EntityMixin {
16-
@Shadow public void move(MovementType movementType, Vec3d movement) {}
16+
@Shadow
17+
public void move(MovementType movementType, Vec3d movement) {
18+
}
1719

18-
@Shadow public abstract float getYaw();
20+
@Shadow
21+
public abstract float getYaw();
1922

2023
@Redirect(method = "updateVelocity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getYaw()F"))
2124
public float velocityYaw(Entity entity) {

common/src/main/java/com/lambda/mixin/render/GlStateManagerMixin.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
99

1010
import static org.lwjgl.opengl.GL11.*;
11-
import static org.lwjgl.opengl.GL11.GL_CULL_FACE;
1211

1312
@Mixin(GlStateManager.class)
1413
public class GlStateManagerMixin {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ object Lambda {
2525
const val SYMBOL = "λ"
2626
val VERSION: String = LoaderInfo.getVersion()
2727
val LOG: Logger = LogManager.getLogger(SYMBOL)
28-
@JvmStatic val mc: MinecraftClient by lazy { MinecraftClient.getInstance() }
28+
@JvmStatic
29+
val mc: MinecraftClient by lazy { MinecraftClient.getInstance() }
2930

3031
val gson: Gson = GsonBuilder()
3132
.setPrettyPrinting()

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@
2323
package com.lambda.brigadier.argument
2424

2525
import com.lambda.brigadier.*
26-
import com.lambda.brigadier.assumeSourceNotUsed
2726
import com.mojang.brigadier.arguments.ArgumentType
2827
import com.mojang.brigadier.arguments.IntegerArgumentType
29-
3028
import com.mojang.brigadier.builder.LiteralArgumentBuilder
3129
import net.minecraft.command.argument.TimeArgumentType
3230
import net.minecraft.command.argument.UuidArgumentType
@@ -70,7 +68,7 @@ fun DefaultArgumentReader<UuidArgumentType>.value(): UUID {
7068
@BrigadierDsl
7169
fun <S> time(
7270
name: String,
73-
minimumTicks: Int = 0
71+
minimumTicks: Int = 0,
7472
): DefaultArgumentConstructor<S, TimeArgumentType> {
7573
return argument(name, TimeArgumentType.time(minimumTicks))
7674
}
@@ -80,7 +78,7 @@ fun <S> time(
8078
*/
8179
@BrigadierDsl
8280
fun <S> uuid(
83-
name: String
81+
name: String,
8482
): RequiredArgumentConstructor<
8583
S,
8684
DefaultArgumentDescriptor<
@@ -99,7 +97,7 @@ fun <S> uuid(
9997
*/
10098
@BrigadierDsl
10199
fun <S> literal(
102-
name: String
100+
name: String,
103101
): ArgumentConstructor<
104102
S,
105103
LiteralArgumentBuilder<S>,

common/src/main/kotlin/com/lambda/brigadier/brigadier.md

Lines changed: 54 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,32 @@ registerEvents {
4343
//optional argument
4444
optional(literal("ping")) { ping ->
4545
execute {
46-
//shorthand for source.sendFeedback
47-
sendFeedback(
48-
buildText {
49-
val sourceName = entity?.displayName ?: "stranger"
50-
literal("Hello $sourceName! ")
51-
52-
//accessing an argument with a special requirement (block pos must be loaded)
53-
val state = world.getBlockState(getPos().requireLoaded())
54-
val id = Registry.BLOCK.getId(state.block)
55-
literal("Selected block was $id. ")
56-
57-
//accessing a normal argument
58-
val range = getIntRange().value()
59-
val random = Random.nextInt(range.min ?: 0, (range.max ?: 100) + 1)
60-
literal("Random number is $random.")
61-
62-
//check if optional present
63-
if (ping != null) {
64-
literal(" Pong!")
65-
}
66-
}
67-
)
68-
}
69-
}
70-
}
71-
}
46+
//shorthand for source.sendFeedback
47+
sendFeedback(
48+
buildText {
49+
val sourceName = entity?.displayName ?: "stranger"
50+
literal("Hello $sourceName! ")
51+
52+
//accessing an argument with a special requirement (block pos must be loaded)
53+
val state = world.getBlockState(getPos().requireLoaded())
54+
val id = Registry.BLOCK.getId(state.block)
55+
literal("Selected block was $id. ")
56+
57+
//accessing a normal argument
58+
val range = getIntRange().value()
59+
val random = Random.nextInt(range.min ?: 0, (range.max ?: 100) + 1)
60+
literal("Random number is $random.")
61+
62+
//check if optional present
63+
if (ping != null) {
64+
literal(" Pong!")
65+
}
66+
}
67+
)
68+
}
69+
}
70+
}
71+
}
7272
}
7373
}
7474
```
@@ -126,20 +126,23 @@ and pass those along with the name to QKL's `argument` function:
126126

127127
```kotlin
128128
//arguments using default descriptors can use shorter versions and typealiases
129-
@BrigadierDsl fun <S> identifier(
129+
@BrigadierDsl
130+
fun <S> identifier(
130131
name: String
131132
): DefaultArgumentConstructor<S, IdentifierArgumentType> {
132133
return argument(name, IdentifierArgumentType.identifier())
133134
}
134135

135136
//two ways to create an entity argument
136-
@BrigadierDsl fun <S> entity(
137+
@BrigadierDsl
138+
fun <S> entity(
137139
name: String
138140
): RequiredArgumentConstructor<S, SingleEntityArgumentDescriptor> {
139141
return argument(name, EntityArgumentType.entity(), SingleEntityArgumentDescriptor)
140142
}
141143

142-
@BrigadierDsl fun <S> entities(
144+
@BrigadierDsl
145+
fun <S> entities(
143146
name: String
144147
): RequiredArgumentConstructor<S, ListEntityArgumentDescriptor> {
145148
return argument(name, EntityArgumentType.entities(), ListEntityArgumentDescriptor)
@@ -156,25 +159,28 @@ and the argument name:
156159
//A reader using the default descriptor for StringArgumentType and usable on any context
157160
//If creating multiple functions with the same name, give them different JVM names
158161
@JvmName("valueStringArg")
159-
@BrigadierDsl fun DefaultArgumentReader<StringArgumentType>.value(): String {
162+
@BrigadierDsl
163+
fun DefaultArgumentReader<StringArgumentType>.value(): String {
160164
return StringArgumentType.getString(context, name)
161165
}
162166

163167
//A reader for multiple entities argument
164168
//Uses the List descriptor and can only be called for ServerCommandSource contexts
165169
@JvmName("optionalEntityArg")
166-
@BrigadierDsl fun ArgumentReader<
167-
ServerCommandSource,
170+
@BrigadierDsl
171+
fun ArgumentReader<
172+
ServerCommandSource,
168173
ListEntityArgumentDescriptor
169174
>.optional(): Collection<Entity> {
170-
return EntityArgumentType.getOptionalEntities(context, name)
175+
return EntityArgumentType.getOptionalEntities(context, name)
171176
}
172177

173178
//A reader for string-based EnumArgumentType
174179
//Similar to above, but callable on any context
175180
@JvmName("valueEnumStringArg")
176-
@BrigadierDsl fun ArgumentReader<*, StringEnumArgumentDescriptor>.value(): String {
177-
return EnumArgumentType.getEnum(context, name)
181+
@BrigadierDsl
182+
fun ArgumentReader<*, StringEnumArgumentDescriptor>.value(): String {
183+
return EnumArgumentType.getEnum(context, name)
178184
}
179185
```
180186

@@ -219,28 +225,28 @@ context receiver instead, e.g.:
219225
@BrigadierDsl
220226
context(CommandContext<*>)
221227
fun <T : Enum<T>> ArgumentReader<TypedEnumArgumentDescriptor<T>>.value(): T {
222-
return EnumArgumentType.getEnumConstant(
223-
this@CommandContext,
224-
name,
225-
argumentDescriptor.type
226-
)
228+
return EnumArgumentType.getEnumConstant(
229+
this@CommandContext,
230+
name,
231+
argumentDescriptor.type
232+
)
227233
}
228234
```
229235

230236
The use-site would then change as well:
231237

232238
```kotlin
233239
//before
234-
required(blockPos("pos")) { getPos ->
235-
execute {
236-
getPos().value()
237-
}
240+
required(blockPos("pos")) { getPos ->
241+
execute {
242+
getPos().value()
243+
}
238244
}
239245

240246
//after
241-
required(blockPos("pos")) { pos ->
242-
execute {
243-
pos.value()
244-
}
247+
required(blockPos("pos")) { pos ->
248+
execute {
249+
pos.value()
250+
}
245251
}
246252
```

common/src/main/kotlin/com/lambda/command/commands/ModuleCommand.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ import com.lambda.util.Communication.joinToText
1717
import com.lambda.util.Communication.warn
1818
import com.lambda.util.StringUtils
1919
import com.lambda.util.primitives.extension.CommandBuilder
20-
import com.lambda.util.text.*
2120
import com.lambda.util.text.ClickEvents.suggestCommand
21+
import com.lambda.util.text.buildText
22+
import com.lambda.util.text.clickEvent
23+
import com.lambda.util.text.literal
24+
import com.lambda.util.text.styled
2225
import java.awt.Color
2326

2427
object ModuleCommand : LambdaCommand(

common/src/main/kotlin/com/lambda/command/commands/ReplayCommand.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package com.lambda.command.commands
22

33
import com.google.gson.JsonSyntaxException
4-
import com.lambda.brigadier.*
5-
import com.lambda.brigadier.argument.*
4+
import com.lambda.brigadier.CommandResult
5+
import com.lambda.brigadier.argument.greedyString
6+
import com.lambda.brigadier.argument.integer
7+
import com.lambda.brigadier.argument.literal
8+
import com.lambda.brigadier.argument.value
9+
import com.lambda.brigadier.executeWithResult
10+
import com.lambda.brigadier.required
611
import com.lambda.command.LambdaCommand
712
import com.lambda.module.modules.player.Replay
813
import com.lambda.util.FolderRegister

common/src/main/kotlin/com/lambda/config/AbstractSetting.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,5 @@ abstract class AbstractSetting<T : Any>(
100100
value = defaultValue
101101
}
102102

103-
class ValueListener <T> (val requiresValueChange: Boolean, val execute: (from: T, to: T) -> Unit)
103+
class ValueListener<T>(val requiresValueChange: Boolean, val execute: (from: T, to: T) -> Unit)
104104
}

0 commit comments

Comments
 (0)