Skip to content

Commit 263d15b

Browse files
authored
Utils, threads, sound, network, graphics, and gui docs (163)
1 parent a9beef9 commit 263d15b

Some content is hidden

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

45 files changed

+136
-1042
lines changed

src/main/java/com/lambda/mixin/render/CapeFeatureRendererMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
public class CapeFeatureRendererMixin {
3434
@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 = "Lnet/minecraft/client/util/SkinTextures;capeTexture()Lnet/minecraft/util/Identifier;"))
3535
Identifier renderCape(Identifier original, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, PlayerEntityRenderState player, float f, float g) {
36-
var entry = Lambda.getMc().getNetworkHandler().getPlayerListEntry(player.name);
36+
var entry = Lambda.getMc().getNetworkHandler().getPlayerListEntry(player.name); // this will cause issues if we try to render while not in game
3737
if (entry == null) return original;
3838

3939
var profile = entry.getProfile();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import com.lambda.util.Communication.info
3333
import com.lambda.util.Communication.joinToText
3434
import com.lambda.util.Communication.warn
3535
import com.lambda.util.StringUtils
36+
import com.lambda.util.StringUtils.findSimilarStrings
3637
import com.lambda.util.extension.CommandBuilder
3738
import com.lambda.util.text.ClickEvents.suggestCommand
3839
import com.lambda.util.text.buildText
@@ -93,8 +94,7 @@ object ModuleCommand : LambdaCommand(
9394
}
9495
literal("not found!")
9596
}
96-
val similarModules = StringUtils.findSimilarStrings(
97-
name,
97+
val similarModules = name.findSimilarStrings(
9898
ModuleRegistry.moduleNames,
9999
3
100100
)

src/main/kotlin/com/lambda/config/Configurable.kt

Lines changed: 7 additions & 225 deletions
Original file line numberDiff line numberDiff line change
@@ -91,43 +91,13 @@ abstract class Configurable(
9191
}
9292
}
9393

94-
/**
95-
* Creates a [BooleanSetting] with the provided parameters and adds it to the [settings].
96-
*
97-
* @param name The unique identifier for the setting.
98-
* @param defaultValue The default [Boolean] value of the setting.
99-
* @param description A brief explanation of the setting's purpose and behavior.
100-
* @param visibility A lambda expression that determines the visibility status of the setting.
101-
*
102-
* ```kotlin
103-
* private val foo by setting("Foo", true)
104-
* ```
105-
*
106-
* @return The created [BooleanSetting].
107-
*/
10894
fun setting(
10995
name: String,
11096
defaultValue: Boolean,
11197
description: String = "",
11298
visibility: () -> Boolean = { true },
11399
) = BooleanSetting(name, defaultValue, description, visibility).register()
114100

115-
/**
116-
* Creates an [EnumSetting] with the provided parameters and adds it to the [settings].
117-
*
118-
* @param name The unique identifier for the setting.
119-
* @param defaultValue The default [Enum] value of the setting.
120-
* @param description A brief explanation of the setting's purpose and behavior.
121-
* @param visibility A lambda expression that determines the visibility status of the setting.
122-
*
123-
* ```kotlin
124-
* enum class Foo { A, B, C }
125-
* private val foo by setting("Foo", Foo.A)
126-
* ```
127-
*
128-
*
129-
* @return The created [EnumSetting].
130-
*/
131101
inline fun <reified T : Enum<T>> setting(
132102
name: String,
133103
defaultValue: T,
@@ -136,37 +106,13 @@ abstract class Configurable(
136106
visibility: () -> Boolean = { true },
137107
) = EnumSetting(name, defaultValue, description, visibility).register()
138108

139-
/**
140-
* Creates a [CharSetting] with the provided parameters and adds it to the [settings].
141-
*
142-
* @param name The unique identifier for the setting.
143-
* @param defaultValue The default [Char] value of the setting.
144-
* @param description A brief explanation of the setting's purpose and behavior.
145-
* @param visibility A lambda expression that determines the visibility status of the setting.
146-
*
147-
* @return The created [CharSetting].
148-
*/
149109
fun setting(
150110
name: String,
151111
defaultValue: Char,
152112
description: String = "",
153113
visibility: () -> Boolean = { true },
154114
) = CharSetting(name, defaultValue, description, visibility).register()
155115

156-
/**
157-
* Creates a [StringSetting] with the provided parameters and adds it to the [settings].
158-
*
159-
* @param name The unique identifier for the setting.
160-
* @param defaultValue The default [String] value of the setting.
161-
* @param description A brief explanation of the setting's purpose and behavior.
162-
* @param visibility A lambda expression that determines the visibility status of the setting.
163-
*
164-
* ```kotlin
165-
* private val foo by setting("Foo", "bar")
166-
* ```
167-
*
168-
* @return The created [StringSetting].
169-
*/
170116
fun setting(
171117
name: String,
172118
defaultValue: String,
@@ -176,23 +122,6 @@ abstract class Configurable(
176122
visibility: () -> Boolean = { true },
177123
) = StringSetting(name, defaultValue, multiline, flags, description, visibility).register()
178124

179-
/**
180-
* Constructs a [ListSetting] instance with the specified parameters and appends it to the [settings] collection.
181-
*
182-
* The type parameter [T] must either be a primitive type or a type with a registered type adapter in [Lambda.gson].
183-
*
184-
* @param name The unique identifier for the setting.
185-
* @param defaultValue The default [List] value of type [T] for the setting.
186-
* @param description A brief explanation of the setting's purpose and behavior.
187-
* @param visibility A lambda expression that determines the visibility status of the setting.
188-
*
189-
* ```kotlin
190-
* // the parameter type is inferred from the defaultValue
191-
* private val foo by setting("Foo", arrayListOf("bar", "baz"))
192-
* ```
193-
*
194-
* @return The created [ListSetting].
195-
*/
196125
inline fun <reified T : Any> setting(
197126
name: String,
198127
immutableList: List<T>,
@@ -208,23 +137,6 @@ abstract class Configurable(
208137
visibility,
209138
).register()
210139

211-
/**
212-
* Constructs a [MapSetting] instance with the specified parameters and appends it to the [settings] collection.
213-
*
214-
* The type parameter [K] and [V] must either be a primitive type or a type with a registered type adapter in [Lambda.gson].
215-
*
216-
* @param name The unique identifier for the setting.
217-
* @param defaultValue The default [Map] value of type [K] and [V] for the setting.
218-
* @param description A brief explanation of the setting's purpose and behavior.
219-
* @param visibility A lambda expression that determines the visibility status of the setting.
220-
*
221-
* ```kotlin
222-
* // the parameter types are inferred from the defaultValue
223-
* private val foo by setting("Foo", mapOf("bar" to 1, "baz" to 2))
224-
* ```
225-
*
226-
* @return The created [MapSetting].
227-
*/
228140
inline fun <reified K : Any, reified V : Any> setting(
229141
name: String,
230142
defaultValue: Map<K, V>,
@@ -238,23 +150,6 @@ abstract class Configurable(
238150
visibility
239151
).register()
240152

241-
/**
242-
* Constructs a [SetSetting] instance with the specified parameters and appends it to the [settings] collection.
243-
*
244-
* The type parameter [T] must either be a primitive type or a type with a registered type adapter in [Lambda.gson].
245-
*
246-
* @param name The unique identifier for the setting.
247-
* @param defaultValue The default [Set] value of type [T] for the setting.
248-
* @param description A brief explanation of the setting's purpose and behavior.
249-
* @param visibility A lambda expression that determines the visibility status of the setting.
250-
*
251-
* ```kotlin
252-
* // the parameter type is inferred from the defaultValue
253-
* private val foo by setting("Foo", setOf("bar", "baz"))
254-
* ```
255-
*
256-
* @return The created [SetSetting].
257-
*/
258153
inline fun <reified T : Any> setting(
259154
name: String,
260155
immutableList: Set<T>,
@@ -270,21 +165,6 @@ abstract class Configurable(
270165
visibility,
271166
).register()
272167

273-
/**
274-
* Creates a [DoubleSetting] with the provided parameters and adds it to the [settings].
275-
*
276-
* The value of the setting is coerced into the specified [range] and rounded to the nearest [step].
277-
*
278-
* @param name The unique identifier for the setting.
279-
* @param defaultValue The default [Double] value of the setting.
280-
* @param range The range within which the setting's value must fall.
281-
* @param step The step to which the setting's value is rounded.
282-
* @param description A brief explanation of the setting's purpose and behavior.
283-
* @param visibility A lambda expression that determines the visibility status of the setting.
284-
* @param unit The unit of the setting. E.g. "°C", "m/s", "ms", "ticks", etc.
285-
*
286-
* @return The created [DoubleSetting].
287-
*/
288168
fun setting(
289169
name: String,
290170
defaultValue: Double,
@@ -295,21 +175,6 @@ abstract class Configurable(
295175
visibility: () -> Boolean = { true },
296176
) = DoubleSetting(name, defaultValue, range, step, description, unit, visibility).register()
297177

298-
/**
299-
* Creates a [FloatSetting] with the provided parameters and adds it to the [settings].
300-
*
301-
* The value of the setting is coerced into the specified [range] and rounded to the nearest [step].
302-
*
303-
* @param name The unique identifier for the setting.
304-
* @param defaultValue The default [Float] value of the setting.
305-
* @param range The range within which the setting's value must fall.
306-
* @param step The step to which the setting's value is rounded.
307-
* @param description A brief explanation of the setting's purpose and behavior.
308-
* @param visibility A lambda expression that determines the visibility status of the setting.
309-
* @param unit The unit of the setting. E.g. "°C", "m/s", "ms", "ticks", etc.
310-
*
311-
* @return The created [FloatSetting].
312-
*/
313178
fun setting(
314179
name: String,
315180
defaultValue: Float,
@@ -320,21 +185,6 @@ abstract class Configurable(
320185
visibility: () -> Boolean = { true },
321186
) = FloatSetting(name, defaultValue, range, step, description, unit, visibility).register()
322187

323-
/**
324-
* Creates an [IntegerSetting] with the provided parameters and adds it to the [settings].
325-
*
326-
* The value of the setting is coerced into the specified [range] and rounded to the nearest [step].
327-
*
328-
* @param name The unique identifier for the setting.
329-
* @param defaultValue The default [Int] value of the setting.
330-
* @param range The range within which the setting's value must fall.
331-
* @param step The step to which the setting's value is rounded.
332-
* @param description A brief explanation of the setting's purpose and behavior.
333-
* @param visibility A lambda expression that determines the visibility status of the setting.
334-
* @param unit The unit of the setting. E.g. "°C", "m/s", "ms", "ticks", etc.
335-
*
336-
* @return The created [IntegerSetting].
337-
*/
338188
fun setting(
339189
name: String,
340190
defaultValue: Int,
@@ -345,21 +195,6 @@ abstract class Configurable(
345195
visibility: () -> Boolean = { true },
346196
) = IntegerSetting(name, defaultValue, range, step, description, unit, visibility).register()
347197

348-
/**
349-
* Creates a [LongSetting] with the provided parameters and adds it to the [settings].
350-
*
351-
* The value of the setting is coerced into the specified [range] and rounded to the nearest [step].
352-
*
353-
* @param name The unique identifier for the setting.
354-
* @param defaultValue The default [Long] value of the setting.
355-
* @param range The range within which the setting's value must fall.
356-
* @param step The step to which the setting's value is rounded.
357-
* @param description A brief explanation of the setting's purpose and behavior.
358-
* @param visibility A lambda expression that determines the visibility status of the setting.
359-
* @param unit The unit of the setting. E.g. "°C", "m/s", "ms", "ticks", etc.
360-
*
361-
* @return The created [LongSetting].
362-
*/
363198
fun setting(
364199
name: String,
365200
defaultValue: Long,
@@ -370,101 +205,48 @@ abstract class Configurable(
370205
visibility: () -> Boolean = { true },
371206
) = LongSetting(name, defaultValue, range, step, description, unit, visibility).register()
372207

373-
/**
374-
* Creates a [KeybindSetting] with the provided parameters and adds it to the [settings].
375-
*
376-
* @param name The unique identifier for the setting.
377-
* @param defaultValue The default [KeyCode] value of the setting.
378-
* @param description A brief explanation of the setting's purpose and behavior.
379-
* @param visibility A lambda expression that determines the visibility status of the setting.
380-
*
381-
* @return The created [KeybindSetting].
382-
*/
383208
fun setting(
384209
name: String,
385210
defaultValue: Bind,
386211
description: String = "",
387212
visibility: () -> Boolean = { true },
388213
) = KeybindSetting(name, defaultValue, description, visibility).register()
389214

390-
/**
391-
* Creates a [ColorSetting] with the provided parameters and adds it to the [settings].
392-
*
393-
* @param name The unique identifier for the setting.
394-
* @param defaultValue The default [Color] value of the setting.
395-
* @param description A brief explanation of the setting's purpose and behavior.
396-
* @param visibility A lambda expression that determines the visibility status of the setting.
397-
*
398-
* @return The created [ColorSetting].
399-
*/
215+
fun setting(
216+
name: String,
217+
defaultValue: KeyCode,
218+
description: String = "",
219+
visibility: () -> Boolean = { true },
220+
) = KeybindSetting(name, defaultValue, description, visibility).register()
221+
400222
fun setting(
401223
name: String,
402224
defaultValue: Color,
403225
description: String = "",
404226
visibility: () -> Boolean = { true },
405227
) = ColorSetting(name, defaultValue, description, visibility).register()
406228

407-
/**
408-
* Creates a [Vec3dSetting] with the provided parameters and adds it to the [settings].
409-
*
410-
* @param name The unique identifier for the setting.
411-
* @param defaultValue The default [Vec3d] value of the setting.
412-
* @param description A brief explanation of the setting's purpose and behavior.
413-
* @param visibility A lambda expression that determines the visibility status of the setting.
414-
*
415-
* @return The created [Vec3dSetting].
416-
*/
417229
fun setting(
418230
name: String,
419231
defaultValue: Vec3d,
420232
description: String = "",
421233
visibility: () -> Boolean = { true },
422234
) = Vec3dSetting(name, defaultValue, description, visibility).register()
423235

424-
/**
425-
* Creates a [BlockPosSetting] with the provided parameters and adds it to the [settings].
426-
*
427-
* @param name The unique identifier for the setting.
428-
* @param defaultValue The default [BlockPos.Mutable] value of the setting.
429-
* @param description A brief explanation of the setting's purpose and behavior.
430-
* @param visibility A lambda expression that determines the visibility status of the setting.
431-
*
432-
* @return The created [BlockPosSetting].
433-
*/
434236
fun setting(
435237
name: String,
436238
defaultValue: BlockPos.Mutable,
437239
description: String = "",
438240
visibility: () -> Boolean = { true },
439241
) = BlockPosSetting(name, defaultValue, description, visibility).register()
440242

441-
/**
442-
* Creates a [BlockPosSetting] with the provided parameters and adds it to the [settings].
443-
*
444-
* @param name The unique identifier for the setting.
445-
* @param defaultValue The default [BlockPos] value of the setting.
446-
* @param description A brief explanation of the setting's purpose and behavior.
447-
* @param visibility A lambda expression that determines the visibility status of the setting.
448-
*
449-
* @return The created [BlockPosSetting].
450-
*/
451243
fun setting(
452244
name: String,
453245
defaultValue: BlockPos,
454246
description: String = "",
455247
visibility: () -> Boolean = { true },
456248
) = BlockPosSetting(name, defaultValue, description, visibility).register()
457249

458-
/**
459-
* Creates a [BlockSetting] with the provided parameters and adds it to the [settings].
460-
*
461-
* @param name The unique identifier for the setting.
462-
* @param defaultValue The default [Block] value of the setting.
463-
* @param description A brief explanation of the setting's purpose and behavior.
464-
* @param visibility A lambda expression that determines the visibility status of the setting.
465-
*
466-
* @return The created [BlockSetting].
467-
*/
468250
fun setting(
469251
name: String,
470252
defaultValue: Block,

0 commit comments

Comments
 (0)