use of org.bukkit.event.entity.EntityCombustByBlockEvent in project Arclight by IzzelAliz.
the class EntityMixin method arclight$setOnFireFromLava$bukkitEvent.
@Redirect(method = "setOnFireFromLava", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setFire(I)V"))
public void arclight$setOnFireFromLava$bukkitEvent(Entity entity, int seconds) {
if ((Object) this instanceof LivingEntity && fire <= 0) {
// ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block damager = null;
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
EntityCombustEvent combustEvent = new EntityCombustByBlockEvent(damager, damagee, 15);
Bukkit.getPluginManager().callEvent(combustEvent);
if (!combustEvent.isCancelled()) {
this.setFire(combustEvent.getDuration());
}
} else {
// This will be called every single tick the entity is in lava, so don't throw an event
this.setFire(15);
}
}
use of org.bukkit.event.entity.EntityCombustByBlockEvent in project Citizens2 by CitizensDev.
the class EventListen method onEntityCombust.
/*
* Entity events
*/
@EventHandler
public void onEntityCombust(EntityCombustEvent event) {
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getEntity());
if (npc == null)
return;
event.setCancelled(npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true));
if (event instanceof EntityCombustByEntityEvent) {
Bukkit.getPluginManager().callEvent(new NPCCombustByEntityEvent((EntityCombustByEntityEvent) event, npc));
} else if (event instanceof EntityCombustByBlockEvent) {
Bukkit.getPluginManager().callEvent(new NPCCombustByBlockEvent((EntityCombustByBlockEvent) event, npc));
} else {
Bukkit.getPluginManager().callEvent(new NPCCombustEvent(event, npc));
}
}
use of org.bukkit.event.entity.EntityCombustByBlockEvent in project Arclight by IzzelAliz.
the class EntityMixin method arclight$move$EntityCombustEvent.
@Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setFire(I)V"))
public void arclight$move$EntityCombustEvent(Entity entity, int seconds) {
EntityCombustEvent event = new EntityCombustByBlockEvent(null, getBukkitEntity(), 8);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.setFire(event.getDuration());
}
}
Aggregations