diff --git a/.github/workflows/1.20.3_push.yml b/.github/workflows/1.20.3_push.yml index 78312a6d..db3f6cfc 100644 --- a/.github/workflows/1.20.3_push.yml +++ b/.github/workflows/1.20.3_push.yml @@ -8,6 +8,7 @@ on: - '**/src/**' branches: - "1.20.5" + - "1.20.5-24w14potato" workflow_dispatch: inputs: norelease: 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 6ceb78db..3552dd0b 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 @@ -58,7 +58,7 @@ public interface LootEvent { * * @see ModifyLootTable#modifyLootTable(ResourceKey, LootTableModificationContext, boolean) */ - // Event MODIFY_LOOT_TABLE = EventFactory.createLoop(); + Event MODIFY_LOOT_TABLE = EventFactory.createLoop(); @FunctionalInterface interface ModifyLootTable { 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 fe15a0f6..e7f035f1 100644 --- a/fabric/src/main/java/dev/architectury/event/fabric/EventHandlerImpl.java +++ b/fabric/src/main/java/dev/architectury/event/fabric/EventHandlerImpl.java @@ -38,7 +38,7 @@ import net.fabricmc.fabric.api.event.player.AttackBlockCallback; 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; @@ -83,7 +83,7 @@ public class EventHandlerImpl { 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((key, 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(key, 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/mixin/fabric/MixinLivingEntity.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinLivingEntity.java index 7d31bae6..82edcbd9 100644 --- a/fabric/src/main/java/dev/architectury/mixin/fabric/MixinLivingEntity.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinLivingEntity.java @@ -20,10 +20,12 @@ package dev.architectury.mixin.fabric; import dev.architectury.event.events.common.EntityEvent; +import dev.architectury.event.events.common.PlayerEvent; import dev.architectury.extensions.ItemExtension; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; @@ -33,6 +35,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(LivingEntity.class) public class MixinLivingEntity { + @Inject(method = "drop(Lnet/minecraft/world/item/ItemStack;ZZ)Lnet/minecraft/world/entity/item/ItemEntity;", at = @At("RETURN"), cancellable = true) + private void drop(ItemStack itemStack, boolean bl, boolean bl2, CallbackInfoReturnable cir) { + if ((Object) this instanceof Player player && cir.getReturnValue() != null && PlayerEvent.DROP_ITEM.invoker().drop(player, cir.getReturnValue()).isFalse()) { + cir.setReturnValue(null); + } + } + @Inject(method = "hurt", at = @At("HEAD"), cancellable = true) private void hurt(DamageSource damageSource, float f, CallbackInfoReturnable cir) { if ((Object) this instanceof Player) return; diff --git a/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayer.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayer.java index cd3b6a19..498b448c 100644 --- a/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayer.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinPlayer.java @@ -46,13 +46,6 @@ public class MixinPlayer { TickEvent.PLAYER_POST.invoker().tick((Player) (Object) this); } - @Inject(method = "drop(Lnet/minecraft/world/item/ItemStack;ZZ)Lnet/minecraft/world/entity/item/ItemEntity;", at = @At("RETURN"), cancellable = true) - private void drop(ItemStack itemStack, boolean bl, boolean bl2, CallbackInfoReturnable cir) { - if (cir.getReturnValue() != null && PlayerEvent.DROP_ITEM.invoker().drop((Player) (Object) this, cir.getReturnValue()).isFalse()) { - cir.setReturnValue(null); - } - } - @Inject(method = "interactOn", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;getItemInHand(Lnet/minecraft/world/InteractionHand;)Lnet/minecraft/world/item/ItemStack;", ordinal = 0), diff --git a/gradle.properties b/gradle.properties index d36e5926..6014c679 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,8 @@ org.gradle.daemon=false platforms=fabric -minecraft_version=24w12a -supported_version=1.20.5 (24w12a) +minecraft_version=24w14potato +supported_version=April Fools (24w14potato) artifact_type=beta @@ -13,8 +13,8 @@ archives_base_name_snapshot=architectury-snapshot base_version=12.0 maven_group=dev.architectury -fabric_loader_version=0.15.7 -fabric_api_version=0.96.12+1.20.5 +fabric_loader_version=0.15.9 +fabric_api_version=0.96.14+24w14potato mod_menu_version=9.0.0 forge_version=49.0.14