mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
1
.github/workflows/1.20.3_push.yml
vendored
1
.github/workflows/1.20.3_push.yml
vendored
@@ -8,6 +8,7 @@ on:
|
||||
- '**/src/**'
|
||||
branches:
|
||||
- "1.20.5"
|
||||
- "1.20.5-24w14potato"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
norelease:
|
||||
|
||||
@@ -58,7 +58,7 @@ public interface LootEvent {
|
||||
*
|
||||
* @see ModifyLootTable#modifyLootTable(ResourceKey, LootTableModificationContext, boolean)
|
||||
*/
|
||||
// Event<ModifyLootTable> MODIFY_LOOT_TABLE = EventFactory.createLoop();
|
||||
Event<ModifyLootTable> MODIFY_LOOT_TABLE = EventFactory.createLoop();
|
||||
|
||||
@FunctionalInterface
|
||||
interface ModifyLootTable {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<ItemEntity> 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<Boolean> cir) {
|
||||
if ((Object) this instanceof Player) return;
|
||||
|
||||
@@ -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<ItemEntity> 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),
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user