Skip to content

Commit

Permalink
1.19.4 update (#66)
Browse files Browse the repository at this point in the history
* 1.19.4 update

* remove "on" prefix from tracking events
  • Loading branch information
SilverAndro authored Mar 31, 2023
1 parent 79193be commit 0801546
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 36 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ org.gradle.parallel=true
kotlin.incremental=true
kotlin.code.style=official

version=1.1.1
version=2.0.0
flkVersion=1.9.2
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ coroutines = "1.6.4"
datetime = "0.4.0"
dokka = "1.7.20"
kotlin = "1.8.10"
minecraft = "1.19.3"
qsl = "4.0.0-beta.9+1.19.3"
quilt_loader = "0.18.3"
quilt_mappings = "1.19.3+build.5"
minecraft = "1.19.4"
qsl = "5.0.0-beta.1+1.19.4"
quilt_loader = "0.18.5"
quilt_mappings = "1.19.4+build.5"
serialization = "1.5.0"
serialization_plugin = "1.8.10" # usually same as kotlin but can lag behind
binary_compat_plugin = "0.12.1"
Expand Down
16 changes: 10 additions & 6 deletions library/api/library.api
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ public final class org/quiltmc/qkl/library/brigadier/argument/ArgumentsKt {
public static final fun testClass (Ljava/lang/String;)Lorg/quiltmc/qkl/library/brigadier/ArgumentConstructor;
public static final fun testFunction (Ljava/lang/String;)Lorg/quiltmc/qkl/library/brigadier/ArgumentConstructor;
public static final fun text (Ljava/lang/String;)Lorg/quiltmc/qkl/library/brigadier/ArgumentConstructor;
public static final fun time (Ljava/lang/String;)Lorg/quiltmc/qkl/library/brigadier/ArgumentConstructor;
public static final fun time (Ljava/lang/String;I)Lorg/quiltmc/qkl/library/brigadier/ArgumentConstructor;
public static synthetic fun time$default (Ljava/lang/String;IILjava/lang/Object;)Lorg/quiltmc/qkl/library/brigadier/ArgumentConstructor;
public static final fun uuid (Ljava/lang/String;)Lorg/quiltmc/qkl/library/brigadier/ArgumentConstructor;
public static final fun valueAngleArg (Lorg/quiltmc/qkl/library/brigadier/ArgumentReader;)F
public static final fun valueBlockPosArg (Lorg/quiltmc/qkl/library/brigadier/ArgumentReader;)Lnet/minecraft/util/math/BlockPos;
Expand Down Expand Up @@ -297,7 +298,9 @@ public final class org/quiltmc/qkl/library/brigadier/util/RequiredChainKt {
public final class org/quiltmc/qkl/library/brigadier/util/ServerCommandUtilKt {
public static final fun broadcastSystemMessage (Lcom/mojang/brigadier/context/CommandContext;Lnet/minecraft/text/Text;Z)V
public static final fun getEntity (Lcom/mojang/brigadier/context/CommandContext;)Lnet/minecraft/entity/Entity;
public static final fun getEntityOrThrow (Lcom/mojang/brigadier/context/CommandContext;)Lnet/minecraft/entity/Entity;
public static final fun getPlayer (Lcom/mojang/brigadier/context/CommandContext;)Lnet/minecraft/server/network/ServerPlayerEntity;
public static final fun getPlayerOrThrow (Lcom/mojang/brigadier/context/CommandContext;)Lnet/minecraft/server/network/ServerPlayerEntity;
public static final fun getServer (Lcom/mojang/brigadier/context/CommandContext;)Lnet/minecraft/server/MinecraftServer;
public static final fun getWorld (Lcom/mojang/brigadier/context/CommandContext;)Lnet/minecraft/server/world/ServerWorld;
public static final fun sendFeedback (Lcom/mojang/brigadier/context/CommandContext;Lnet/minecraft/text/Text;Z)V
Expand Down Expand Up @@ -336,7 +339,7 @@ public final class org/quiltmc/qkl/library/client/screen/ScreenEventsKt {
public static final fun afterMouseClick (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function4;)V
public static final fun afterMouseRelease (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function4;)V
public static final fun afterMouseScroll (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function5;)V
public static final fun afterScreenInit (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function4;)V
public static final fun afterScreenInit (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function3;)V
public static final fun afterScreenRender (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function5;)V
public static final fun afterScreenTick (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function1;)V
public static final fun allowKeyPress (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function4;)V
Expand All @@ -349,7 +352,7 @@ public final class org/quiltmc/qkl/library/client/screen/ScreenEventsKt {
public static final fun beforeMouseClick (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function4;)V
public static final fun beforeMouseRelease (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function4;)V
public static final fun beforeMouseScroll (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function5;)V
public static final fun beforeScreenInit (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function4;)V
public static final fun beforeScreenInit (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function3;)V
public static final fun beforeScreenRender (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function5;)V
public static final fun beforeScreenTick (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function1;)V
public static final fun onScreenRemoved (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function1;)V
Expand Down Expand Up @@ -780,7 +783,8 @@ public final class org/quiltmc/qkl/library/networking/PlayerLookupsKt {
}

public final class org/quiltmc/qkl/library/networking/ServerEventsKt {
public static final fun onEntityTrackingStart (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function2;)V
public static final fun afterEntityTrackingStart (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function2;)V
public static final fun beforeEntityTrackingStart (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function2;)V
public static final fun onEntityTrackingStop (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function2;)V
public static final fun onLoginDisconnect (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function2;)V
public static final fun onLoginInit (Lorg/quiltmc/qkl/library/EventRegistration;Lkotlin/jvm/functions/Function2;)V
Expand All @@ -800,8 +804,8 @@ public final class org/quiltmc/qkl/library/recipe/RecipeEventsKt {

public final class org/quiltmc/qkl/library/recipe/RecipeExtensionsKt {
public static final fun coerceIngredient (Ljava/lang/Object;)Lnet/minecraft/recipe/Ingredient;
public static final fun foodCookingRecipe (Lnet/minecraft/util/Identifier;Ljava/lang/String;Ljava/lang/Object;Lnet/minecraft/item/ItemStack;Lnet/minecraft/recipe/book/CookingRecipeCategory;FIII)[Lnet/minecraft/recipe/AbstractCookingRecipe;
public static synthetic fun foodCookingRecipe$default (Lnet/minecraft/util/Identifier;Ljava/lang/String;Ljava/lang/Object;Lnet/minecraft/item/ItemStack;Lnet/minecraft/recipe/book/CookingRecipeCategory;FIIIILjava/lang/Object;)[Lnet/minecraft/recipe/AbstractCookingRecipe;
public static final fun foodCookingRecipe (Lnet/minecraft/util/Identifier;Ljava/lang/String;Ljava/lang/Object;Lnet/minecraft/item/ItemStack;Lnet/minecraft/recipe/CookingCategory;FIII)[Lnet/minecraft/recipe/AbstractCookingRecipe;
public static synthetic fun foodCookingRecipe$default (Lnet/minecraft/util/Identifier;Ljava/lang/String;Ljava/lang/Object;Lnet/minecraft/item/ItemStack;Lnet/minecraft/recipe/CookingCategory;FIIIILjava/lang/Object;)[Lnet/minecraft/recipe/AbstractCookingRecipe;
public static final fun registerStaticRecipe (Lnet/minecraft/recipe/Recipe;)Lnet/minecraft/recipe/Recipe;
public static final fun registerStaticRecipes ([Lnet/minecraft/recipe/Recipe;)V
public static final fun shapedRecipe (Lnet/minecraft/util/Identifier;Ljava/lang/String;Ljava/lang/String;Lnet/minecraft/item/ItemStack;[Lkotlin/Pair;)Lnet/minecraft/recipe/ShapedRecipe;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 QuiltMC
* Copyright 2023 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -77,9 +77,10 @@ public fun DefaultArgumentReader<UuidArgumentType>.value(): UUID {
*/
@BrigadierDsl
public fun <S> time(
name: String
name: String,
minimumTicks: Int = 0
): DefaultArgumentConstructor<S, TimeArgumentType> {
return argument(name, TimeArgumentType.time())
return argument(name, TimeArgumentType.of(minimumTicks))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public fun ArgumentReader<
MessageArgumentType
>
>.resolveSigned(consumer: (SignedChatMessage) -> Unit) {
MessageArgumentType.resolveSignedMessage(context, name, consumer)
MessageArgumentType.resolveChatMessage(context, name, consumer)
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 QuiltMC
* Copyright 2023 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,25 +29,46 @@ import net.minecraft.text.Text
* Player executing the command or
* `null` if not executed by a player.
*
* @see ServerCommandSource.m_ozupobtn
* @see ServerCommandSource.getPlayer
*
* @author Cypher121
*/
//TODO wait for mappings
public val CommandContext<ServerCommandSource>.player: ServerPlayerEntity?
get() = source.m_ozupobtn()
get() = source.player

/**
* Player executing the command or throws
* `REQUIRES_PLAYER_EXCEPTION` if not executed by a player.
*
* @see ServerCommandSource.getPlayerOrThrow
*
* @author SilverAndro
*/
public val CommandContext<ServerCommandSource>.playerOrThrow: ServerPlayerEntity
get() = source.playerOrThrow

/**
* Entity executing the command or
* `null` if not executed by an entity.
*
* @see ServerCommandSource.entity
* @see ServerCommandSource.getEntity
*
* @author Cypher121
*/
public val CommandContext<ServerCommandSource>.entity: Entity?
get() = source.entity

/**
* Entity executing the command or throws
* `REQUIRES_ENTITY_EXCEPTION` if not executed by an entity.
*
* @see ServerCommandSource.getEntityOrThrow
*
* @author SilverAndro
*/
public val CommandContext<ServerCommandSource>.entityOrThrow: Entity
get() = source.entityOrThrow

/**
* World from which the command originates.
*
Expand Down Expand Up @@ -87,13 +108,13 @@ public fun CommandContext<ServerCommandSource>.sendFeedback(
* Sends [message] to every player on the server,
* to chat or the toolbar overlay controlled by [overlay]
*
* @see PlayerManager.m_bgctehjy
* @see PlayerManager.broadcastSystemMessage
*
* @author Cypher121
*/
public fun CommandContext<ServerCommandSource>.broadcastSystemMessage(
message: Text,
overlay: Boolean
) {
server.playerManager.m_bgctehjy(message, overlay)
server.playerManager.broadcastSystemMessage(message, overlay)
}
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ public fun EventRegistration.afterKeyRelease(callback: KeyboardKey<Unit>) {
public typealias ScreenGenericCallback = Screen.() -> Unit
public typealias ScreenInitCallback = Screen.(
client: MinecraftClient,
scaledWidth: Int,
scaledHeight: Int
firstTimeInit: Boolean
) -> Unit

public typealias ScreenRenderCallback = Screen.(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 QuiltMC
* Copyright 2023 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -143,16 +143,29 @@ public typealias EntityTrackingCallback = (
) -> Unit

/**
* Invoked when a player on the server starts tracking an entity.
* Invoked before a player on the server starts tracking an entity.
* This usually happens when the entity gets close enough
* to the player to be seen.
*
* @see EntityTrackingEvents.START_TRACKING
* @see EntityTrackingEvents.BEFORE_START_TRACKING
*
* @author SilverAndro
*/
public fun EventRegistration.beforeEntityTrackingStart(callback: EntityTrackingCallback) {
EntityTrackingEvents.BEFORE_START_TRACKING.register(EntityTrackingEvents.BeforeStartTracking(callback))
}

/**
* Invoked after a player on the server starts tracking an entity.
* This usually happens when the entity gets close enough
* to the player to be seen.
*
* @see EntityTrackingEvents.AFTER_START_TRACKING
*
* @author sschr15
*/
public fun EventRegistration.onEntityTrackingStart(callback: EntityTrackingCallback) {
EntityTrackingEvents.START_TRACKING.register(EntityTrackingEvents.StartTracking(callback))
public fun EventRegistration.afterEntityTrackingStart(callback: EntityTrackingCallback) {
EntityTrackingEvents.AFTER_START_TRACKING.register(EntityTrackingEvents.AfterStartTracking(callback))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import net.minecraft.item.Item
import net.minecraft.item.ItemConvertible
import net.minecraft.item.ItemStack
import net.minecraft.recipe.*
import net.minecraft.recipe.book.CookingRecipeCategory
import net.minecraft.registry.tag.TagKey
import net.minecraft.util.Identifier
import net.minecraft.registry.RegistryKeys
Expand Down Expand Up @@ -174,7 +173,7 @@ public fun foodCookingRecipe(
group: String,
input: IngredientLike,
result: ItemStack,
category: CookingRecipeCategory,
category: CookingCategory,
experience: Float = 0.0f,
cookTime: Int = 200,
smokerCookTime: Int = cookTime / 2,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 QuiltMC
* Copyright 2023 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -47,7 +47,7 @@ internal class SerializerCodec<A>(
"Encoding exception at $trace: ${e.message}"
}

DataResult.error(errorMessage)
DataResult.error { errorMessage }
}
}

Expand All @@ -65,7 +65,7 @@ internal class SerializerCodec<A>(
"Encoding exception at $trace: ${e.message}"
}

DataResult.error(errorMessage)
DataResult.error { errorMessage }
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 QuiltMC
* Copyright 2023 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,7 +50,7 @@ private object BrigadierDslSamples {
required(boolean("toCaps")) { getToCaps -> // or as an accessor
// Standard builder methods can be called as normal
requires {
it.player.experienceLevel > Random.nextInt()
it.playerOrThrow.experienceLevel > Random.nextInt()
}

// Execute the command with an extension method
Expand Down

0 comments on commit 0801546

Please sign in to comment.