Java Code Examples for net.minecraft.entity.Entity#getBukkitEntity()
The following examples show how to use
net.minecraft.entity.Entity#getBukkitEntity() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CraftEventFactory.java From Thermos with GNU General Public License v3.0 | 6 votes |
private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions) { EntityDamageEvent event; if (damager != null) { event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, modifiers, modifierFunctions); } else { event = new EntityDamageEvent(damagee.getBukkitEntity(), cause, modifiers, modifierFunctions); } callEvent(event); if (!event.isCancelled()) { event.getEntity().setLastDamageCause(event); } return event; }
Example 2
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 6 votes |
private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions) { EntityDamageEvent event; if (damager != null) { event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, modifiers, modifierFunctions); } else { event = new EntityDamageEvent(damagee.getBukkitEntity(), cause, modifiers, modifierFunctions); } callEvent(event); if (!event.isCancelled()) { event.getEntity().setLastDamageCause(event); } return event; }
Example 3
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 6 votes |
public static BlockIgniteEvent callBlockIgniteEvent(World world, int x, int y, int z, Entity igniter) { org.bukkit.World bukkitWorld = world.getWorld(); org.bukkit.entity.Entity bukkitIgniter = igniter.getBukkitEntity(); IgniteCause cause; switch (bukkitIgniter.getType()) { case ENDER_CRYSTAL: cause = IgniteCause.ENDER_CRYSTAL; break; case LIGHTNING: cause = IgniteCause.LIGHTNING; break; case SMALL_FIREBALL: case FIREBALL: cause = IgniteCause.FIREBALL; break; default: cause = IgniteCause.FLINT_AND_STEEL; } BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(x, y, z), cause, bukkitIgniter); world.getServer().getPluginManager().callEvent(event); return event; }
Example 4
Source File: CraftHumanEntity.java From Kettle with GNU General Public License v3.0 | 5 votes |
@Override public org.bukkit.entity.Entity getShoulderEntityRight() { if (!getHandle().getRightShoulderEntity().hasNoTags()) { Entity shoulder = EntityList.createEntityFromNBT(getHandle().getRightShoulderEntity(), getHandle().world); return (shoulder == null) ? null : shoulder.getBukkitEntity(); } return null; }
Example 5
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 5 votes |
public static boolean handleBlockFormEvent(World world, BlockPos pos, IBlockState block, @Nullable Entity entity) { BlockState blockState = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()).getState(); blockState.setType(CraftMagicNumbers.getMaterial(block.getBlock())); blockState.setRawData((byte) block.getBlock().getMetaFromState(block)); BlockFormEvent event = (entity == null) ? new BlockFormEvent(blockState.getBlock(), blockState) : new EntityBlockFormEvent(entity.getBukkitEntity(), blockState.getBlock(), blockState); world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { blockState.update(true); } return !event.isCancelled(); }
Example 6
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 5 votes |
/** * Mob spawner event. */ public static SpawnerSpawnEvent callSpawnerSpawnEvent(Entity spawnee, BlockPos pos) { CraftEntity entity = spawnee.getBukkitEntity(); BlockState state = entity.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()).getState(); if (!(state instanceof org.bukkit.block.CreatureSpawner)) { state = null; } SpawnerSpawnEvent event = new SpawnerSpawnEvent(entity, (org.bukkit.block.CreatureSpawner) state); entity.getServer().getPluginManager().callEvent(event); return event; }
Example 7
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 5 votes |
public static ProjectileHitEvent callProjectileHitEvent(Entity entity, RayTraceResult position) { Block hitBlock = null; if (position.typeOfHit == RayTraceResult.Type.BLOCK) { BlockPos blockposition = position.getBlockPos(); hitBlock = entity.getBukkitEntity().getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); } ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), position.entityHit == null ? null : position.entityHit.getBukkitEntity(), hitBlock); entity.world.getServer().getPluginManager().callEvent(event); return event; }
Example 8
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 5 votes |
public static EntityBreakDoorEvent callEntityBreakDoorEvent(Entity entity, int x, int y, int z) { org.bukkit.entity.Entity entity1 = entity.getBukkitEntity(); Block block = entity1.getWorld().getBlockAt(x, y, z); EntityBreakDoorEvent event = new EntityBreakDoorEvent((LivingEntity) entity1, block); entity1.getServer().getPluginManager().callEvent(event); return event; }
Example 9
Source File: CraftHumanEntity.java From Kettle with GNU General Public License v3.0 | 5 votes |
@Override public org.bukkit.entity.Entity getShoulderEntityLeft() { if (!getHandle().getLeftShoulderEntity().hasNoTags()) { Entity shoulder = EntityList.createEntityFromNBT(getHandle().getLeftShoulderEntity(), getHandle().world); return (shoulder == null) ? null : shoulder.getBukkitEntity(); } return null; }
Example 10
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static EntityTargetLivingEntityEvent callEntityTargetLivingEvent(Entity entity, EntityLivingBase target, EntityTargetEvent.TargetReason reason) { EntityTargetLivingEntityEvent event = new EntityTargetLivingEntityEvent(entity.getBukkitEntity(), (LivingEntity) target.getBukkitEntity(), reason); entity.getBukkitEntity().getServer().getPluginManager().callEvent(event); return event; }
Example 11
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static EntityTargetEvent callEntityTargetEvent(Entity entity, Entity target, EntityTargetEvent.TargetReason reason) { EntityTargetEvent event = new EntityTargetEvent(entity.getBukkitEntity(), target == null ? null : target.getBukkitEntity(), reason); entity.getBukkitEntity().getServer().getPluginManager().callEvent(event); return event; }
Example 12
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static ProjectileLaunchEvent callProjectileLaunchEvent(Entity entity) { Projectile bukkitEntity = (Projectile) entity.getBukkitEntity(); ProjectileLaunchEvent event = new ProjectileLaunchEvent(bukkitEntity); Bukkit.getPluginManager().callEvent(event); return event; }
Example 13
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static CreeperPowerEvent callCreeperPowerEvent(Entity creeper, Entity lightning, CreeperPowerEvent.PowerCause cause) { CreeperPowerEvent event = new CreeperPowerEvent((Creeper) creeper.getBukkitEntity(), (LightningStrike) lightning.getBukkitEntity(), cause); creeper.getBukkitEntity().getServer().getPluginManager().callEvent(event); return event; }
Example 14
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static ExpBottleEvent callExpBottleEvent(Entity entity, int exp) { ThrownExpBottle bottle = (ThrownExpBottle) entity.getBukkitEntity(); ExpBottleEvent event = new ExpBottleEvent(bottle, exp); Bukkit.getPluginManager().callEvent(event); return event; }
Example 15
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static HorseJumpEvent callHorseJumpEvent(Entity horse, float power) { HorseJumpEvent event = new HorseJumpEvent((AbstractHorse) horse.getBukkitEntity(), power); horse.getBukkitEntity().getServer().getPluginManager().callEvent(event); return event; }
Example 16
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static BlockIgniteEvent callBlockIgniteEvent(World world, int x, int y, int z, IgniteCause cause, Entity igniter) { BlockIgniteEvent event = new BlockIgniteEvent(world.getWorld().getBlockAt(x, y, z), cause, igniter.getBukkitEntity()); world.getServer().getPluginManager().callEvent(event); return event; }
Example 17
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static PlayerLeashEntityEvent callPlayerLeashEntityEvent(EntityLiving entity, Entity leashHolder, EntityPlayer player) { PlayerLeashEntityEvent event = new PlayerLeashEntityEvent(entity.getBukkitEntity(), leashHolder.getBukkitEntity(), (Player) player.getBukkitEntity()); entity.world.getServer().getPluginManager().callEvent(event); return event; }
Example 18
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static PigZapEvent callPigZapEvent(Entity pig, Entity lightning, Entity pigzombie) { PigZapEvent event = new PigZapEvent((Pig) pig.getBukkitEntity(), (LightningStrike) lightning.getBukkitEntity(), (PigZombie) pigzombie.getBukkitEntity()); pig.getBukkitEntity().getServer().getPluginManager().callEvent(event); return event; }
Example 19
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static VehicleCreateEvent callVehicleCreateEvent(Entity entity) { Vehicle bukkitEntity = (Vehicle) entity.getBukkitEntity(); VehicleCreateEvent event = new VehicleCreateEvent(bukkitEntity); Bukkit.getPluginManager().callEvent(event); return event; }
Example 20
Source File: CraftPlayer.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public org.bukkit.entity.Entity getSpectatorTarget() { Entity followed = getHandle().getSpectatingEntity(); return followed == getHandle() ? null : followed.getBukkitEntity(); }