Search in sources :

Example 1 with EntityDropItemEvent

use of org.bukkit.event.entity.EntityDropItemEvent in project Arclight by IzzelAliz.

the class EntityMixin method arclight$entityDropItem.

@Inject(method = "entityDropItem(Lnet/minecraft/item/ItemStack;F)Lnet/minecraft/entity/item/ItemEntity;", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addEntity(Lnet/minecraft/entity/Entity;)Z"))
public void arclight$entityDropItem(ItemStack stack, float offsetY, CallbackInfoReturnable<ItemEntity> cir, ItemEntity itementity) {
    EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) ((EntityBridge) itementity).bridge$getBukkitEntity());
    Bukkit.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        cir.setReturnValue(null);
    }
}
Also used : EntityDropItemEvent(org.bukkit.event.entity.EntityDropItemEvent) InternalEntityBridge(io.izzel.arclight.common.bridge.entity.InternalEntityBridge) LivingEntityBridge(io.izzel.arclight.common.bridge.entity.LivingEntityBridge) MobEntityBridge(io.izzel.arclight.common.bridge.entity.MobEntityBridge) ServerPlayerEntityBridge(io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge) EntityBridge(io.izzel.arclight.common.bridge.entity.EntityBridge) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 2 with EntityDropItemEvent

use of org.bukkit.event.entity.EntityDropItemEvent in project Arclight by IzzelAliz.

the class ArclightEventFactory method callEntityDropItemEvent.

public static EntityDropItemEvent callEntityDropItemEvent(org.bukkit.entity.Entity entity, org.bukkit.entity.Item drop) {
    EntityDropItemEvent bukkitEvent = new EntityDropItemEvent(entity, drop);
    callEvent(bukkitEvent);
    return bukkitEvent;
}
Also used : EntityDropItemEvent(org.bukkit.event.entity.EntityDropItemEvent)

Aggregations

EntityDropItemEvent (org.bukkit.event.entity.EntityDropItemEvent)2 EntityBridge (io.izzel.arclight.common.bridge.entity.EntityBridge)1 InternalEntityBridge (io.izzel.arclight.common.bridge.entity.InternalEntityBridge)1 LivingEntityBridge (io.izzel.arclight.common.bridge.entity.LivingEntityBridge)1 MobEntityBridge (io.izzel.arclight.common.bridge.entity.MobEntityBridge)1 ServerPlayerEntityBridge (io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1