Search in sources :

Example 6 with EntityCombustByEntityEvent

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

the class AbstractArrowEntityMixin method arclight$fireShot.

@Redirect(method = "onEntityHit", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setFire(I)V"))
private void arclight$fireShot(Entity entity, int seconds, EntityRayTraceResult result) {
    EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), ((EntityBridge) entity).bridge$getBukkitEntity(), seconds);
    Bukkit.getPluginManager().callEvent(combustEvent);
    if (!combustEvent.isCancelled()) {
        ((EntityBridge) entity).bridge$setOnFire(combustEvent.getDuration(), false);
    }
}
Also used : ServerPlayerEntityBridge(io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge) EntityBridge(io.izzel.arclight.common.bridge.entity.EntityBridge) EntityCombustByEntityEvent(org.bukkit.event.entity.EntityCombustByEntityEvent) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Example 7 with EntityCombustByEntityEvent

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

the class EntityMixin method arclight$onStruckByLightning$EntityCombustByEntityEvent0.

@Redirect(method = "onStruckByLightning", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setFire(I)V"))
public void arclight$onStruckByLightning$EntityCombustByEntityEvent0(Entity entity, int seconds) {
    final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
    final org.bukkit.entity.Entity stormBukkitEntity = ((EntityBridge) entity).bridge$getBukkitEntity();
    final PluginManager pluginManager = Bukkit.getPluginManager();
    // CraftBukkit start - Call a combust event when lightning strikes
    EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
    pluginManager.callEvent(entityCombustEvent);
    if (!entityCombustEvent.isCancelled()) {
        this.setFire(entityCombustEvent.getDuration());
    }
// CraftBukkit end
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) 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) EntityCombustByEntityEvent(org.bukkit.event.entity.EntityCombustByEntityEvent) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

EntityCombustByEntityEvent (org.bukkit.event.entity.EntityCombustByEntityEvent)7 EntityBridge (io.izzel.arclight.common.bridge.entity.EntityBridge)6 Redirect (org.spongepowered.asm.mixin.injection.Redirect)4 MobEntityBridge (io.izzel.arclight.common.bridge.entity.MobEntityBridge)3 ServerPlayerEntityBridge (io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge)3 InternalEntityBridge (io.izzel.arclight.common.bridge.entity.InternalEntityBridge)2 LivingEntityBridge (io.izzel.arclight.common.bridge.entity.LivingEntityBridge)2 LivingEntity (net.minecraft.entity.LivingEntity)2 Overwrite (org.spongepowered.asm.mixin.Overwrite)2 PlayerEntityBridge (io.izzel.arclight.common.bridge.entity.player.PlayerEntityBridge)1 DamageSourceBridge (io.izzel.arclight.common.bridge.util.DamageSourceBridge)1 NPCCombustByBlockEvent (net.citizensnpcs.api.event.NPCCombustByBlockEvent)1 NPCCombustByEntityEvent (net.citizensnpcs.api.event.NPCCombustByEntityEvent)1 NPCCombustEvent (net.citizensnpcs.api.event.NPCCombustEvent)1 NPC (net.citizensnpcs.api.npc.NPC)1 Entity (net.minecraft.entity.Entity)1 MobEntity (net.minecraft.entity.MobEntity)1 EnderDragonPartEntity (net.minecraft.entity.boss.dragon.EnderDragonPartEntity)1 ArmorStandEntity (net.minecraft.entity.item.ArmorStandEntity)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1