From d4f399c9e1f4c33440e8e2853dc4be047c2f2432 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Mon, 1 Apr 2024 20:27:07 +0900 Subject: [PATCH] Update to 24w12a Signed-off-by: shedaniel --- .../event/events/common/LootEvent.java | 32 ++++++------------- .../main/resources/architectury.accessWidener | 2 -- .../event/fabric/EventHandlerImpl.java | 6 ++-- .../LootTableModificationContextImpl.java | 5 --- gradle.properties | 6 ++-- .../dev/architectury/test/loot/TestLoot.java | 4 +-- .../test/registry/TestRegistries.java | 2 +- 7 files changed, 18 insertions(+), 39 deletions(-) diff --git a/common/src/main/java/dev/architectury/event/events/common/LootEvent.java b/common/src/main/java/dev/architectury/event/events/common/LootEvent.java index 897523119..6ceb78dba 100644 --- a/common/src/main/java/dev/architectury/event/events/common/LootEvent.java +++ b/common/src/main/java/dev/architectury/event/events/common/LootEvent.java @@ -21,11 +21,10 @@ import dev.architectury.event.Event; import dev.architectury.event.EventFactory; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.storage.loot.LootDataManager; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.storage.loot.LootPool; +import net.minecraft.world.level.storage.loot.LootTable; import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; /** * Events related to loot tables and loot generation. @@ -57,23 +56,21 @@ public interface LootEvent { * }); * } * - * @see ModifyLootTable#modifyLootTable(LootDataManager, ResourceLocation, LootTableModificationContext, boolean) + * @see ModifyLootTable#modifyLootTable(ResourceKey, LootTableModificationContext, boolean) */ - Event MODIFY_LOOT_TABLE = EventFactory.createLoop(); + // Event MODIFY_LOOT_TABLE = EventFactory.createLoop(); @FunctionalInterface interface ModifyLootTable { /** * Modifies a loot table. * - * @param lootDataManager the {@link LootDataManager} instance containing all loot tables, - * may be {@code null} - * @param id the loot table ID - * @param context the context used to modify the loot table - * @param builtin if {@code true}, the loot table is built-in; - * if {@code false}, it is from a user data pack + * @param key the loot table key + * @param context the context used to modify the loot table + * @param builtin if {@code true}, the loot table is built-in; + * if {@code false}, it is from a user data pack */ - void modifyLootTable(@Nullable LootDataManager lootDataManager, ResourceLocation id, LootTableModificationContext context, boolean builtin); + void modifyLootTable(ResourceKey key, LootTableModificationContext context, boolean builtin); } /** @@ -86,15 +83,6 @@ interface LootTableModificationContext { * * @param pool the pool to add */ - void addPool(LootPool pool); - - /** - * Adds a pool to the loot table. - * - * @param pool the pool to add - */ - default void addPool(LootPool.Builder pool) { - addPool(pool.build()); - } + void addPool(LootPool.Builder pool); } } diff --git a/common/src/main/resources/architectury.accessWidener b/common/src/main/resources/architectury.accessWidener index 9538a243e..ba3ba25a2 100644 --- a/common/src/main/resources/architectury.accessWidener +++ b/common/src/main/resources/architectury.accessWidener @@ -26,8 +26,6 @@ accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties speedFactor F accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties jumpFactor F mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties jumpFactor F -accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties drops Lnet/minecraft/resources/ResourceLocation; -mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties drops Lnet/minecraft/resources/ResourceLocation; accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties canOcclude Z mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties canOcclude Z accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties isAir Z diff --git a/fabric/src/main/java/dev/architectury/event/fabric/EventHandlerImpl.java b/fabric/src/main/java/dev/architectury/event/fabric/EventHandlerImpl.java index 5f42cfa98..fe15a0f6d 100644 --- a/fabric/src/main/java/dev/architectury/event/fabric/EventHandlerImpl.java +++ b/fabric/src/main/java/dev/architectury/event/fabric/EventHandlerImpl.java @@ -38,12 +38,10 @@ import net.fabricmc.fabric.api.event.player.AttackEntityCallback; import net.fabricmc.fabric.api.event.player.UseBlockCallback; import net.fabricmc.fabric.api.event.player.UseItemCallback; -import net.fabricmc.fabric.api.loot.v2.LootTableEvents; +// import net.fabricmc.fabric.api.loot.v2.LootTableEvents; import net.fabricmc.fabric.api.message.v1.ServerMessageDecoratorEvent; import net.fabricmc.fabric.api.message.v1.ServerMessageEvents; -import java.util.concurrent.CompletableFuture; - public class EventHandlerImpl { @Environment(EnvType.CLIENT) public static void registerClient() { @@ -85,7 +83,7 @@ public static void registerCommon() { AttackBlockCallback.EVENT.register((player, world, hand, pos, face) -> InteractionEvent.LEFT_CLICK_BLOCK.invoker().click(player, hand, pos, face).asMinecraft()); AttackEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> PlayerEvent.ATTACK_ENTITY.invoker().attack(player, world, entity, hand, hitResult).asMinecraft()); - LootTableEvents.MODIFY.register((resourceManager, lootManager, id, tableBuilder, source) -> LootEvent.MODIFY_LOOT_TABLE.invoker().modifyLootTable(lootManager, id, new LootTableModificationContextImpl(tableBuilder), source.isBuiltin())); + // LootTableEvents.MODIFY.register((key, tableBuilder, source) -> LootEvent.MODIFY_LOOT_TABLE.invoker().modifyLootTable(lootManager, id, new LootTableModificationContextImpl(tableBuilder), source.isBuiltin())); ServerMessageDecoratorEvent.EVENT.register(ServerMessageDecoratorEvent.CONTENT_PHASE, (player, component) -> { ChatEvent.ChatComponent chatComponent = new ChatComponentImpl(component); diff --git a/fabric/src/main/java/dev/architectury/event/fabric/LootTableModificationContextImpl.java b/fabric/src/main/java/dev/architectury/event/fabric/LootTableModificationContextImpl.java index 3d00da9a1..8c63c23cd 100644 --- a/fabric/src/main/java/dev/architectury/event/fabric/LootTableModificationContextImpl.java +++ b/fabric/src/main/java/dev/architectury/event/fabric/LootTableModificationContextImpl.java @@ -30,11 +30,6 @@ final class LootTableModificationContextImpl implements LootEvent.LootTableModif this.tableBuilder = tableBuilder; } - @Override - public void addPool(LootPool pool) { - tableBuilder.pool(pool); - } - @Override public void addPool(LootPool.Builder pool) { tableBuilder.withPool(pool); diff --git a/gradle.properties b/gradle.properties index 3c42a6f73..d36e59266 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,8 @@ org.gradle.daemon=false platforms=fabric -minecraft_version=24w09a -supported_version=1.20.5 (24w09a) +minecraft_version=24w12a +supported_version=1.20.5 (24w12a) artifact_type=beta @@ -14,7 +14,7 @@ base_version=12.0 maven_group=dev.architectury fabric_loader_version=0.15.7 -fabric_api_version=0.96.6+1.20.5 +fabric_api_version=0.96.12+1.20.5 mod_menu_version=9.0.0 forge_version=49.0.14 diff --git a/testmod-common/src/main/java/dev/architectury/test/loot/TestLoot.java b/testmod-common/src/main/java/dev/architectury/test/loot/TestLoot.java index 9ae36a740..6056a9a6d 100644 --- a/testmod-common/src/main/java/dev/architectury/test/loot/TestLoot.java +++ b/testmod-common/src/main/java/dev/architectury/test/loot/TestLoot.java @@ -27,13 +27,13 @@ public class TestLoot { public static void init() { - LootEvent.MODIFY_LOOT_TABLE.register((lootTables, id, context, builtin) -> { + /*LootEvent.MODIFY_LOOT_TABLE.register((lootTables, id, context, builtin) -> { // Check that the loot table is dirt and built-in if (builtin && Blocks.DIRT.getLootTable().equals(id)) { // Create a loot pool with a single item entry of Items.DIAMOND LootPool.Builder pool = LootPool.lootPool().add(LootItem.lootTableItem(Items.DIAMOND)); context.addPool(pool); } - }); + });*/ } } diff --git a/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java b/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java index a4bd6620f..bc64c5989 100644 --- a/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java +++ b/testmod-common/src/main/java/dev/architectury/test/registry/TestRegistries.java @@ -113,7 +113,7 @@ public TestInt(int value) { public static final RegistrySupplier TEST_EQUIPPABLE = ITEMS.register("test_eqippable", () -> new EquippableTickingItem(new Item.Properties().arch$tab(TestRegistries.TEST_TAB))); public static final RegistrySupplier TEST_EDIBLE = ITEMS.register("test_edible", () -> { - FoodProperties.Builder fpBuilder = new FoodProperties.Builder().nutrition(8).saturationMod(0.8F).meat(); + FoodProperties.Builder fpBuilder = new FoodProperties.Builder().nutrition(8).saturationModifier(0.8F); FoodPropertiesHooks.effect(fpBuilder, () -> new MobEffectInstance(TEST_EFFECT, 100), 1); return new Item(new Item.Properties().food(fpBuilder.build()).arch$tab(TestRegistries.TEST_TAB)); });