Search in sources :

Example 1 with Projectile

use of org.spongepowered.api.entity.projectile.Projectile in project SpongeCommon by SpongePowered.

the class InteractionPacketState method unwind.

@Override
public void unwind(BasicPacketContext phaseContext) {
    final EntityPlayerMP player = phaseContext.getPacketPlayer();
    final ItemStack usedStack = phaseContext.getItemUsed();
    final ItemStackSnapshot usedSnapshot = ItemStackUtil.snapshotOf(usedStack);
    final Entity spongePlayer = EntityUtil.fromNative(player);
    try (CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) {
        Sponge.getCauseStackManager().pushCause(spongePlayer);
        Sponge.getCauseStackManager().addContext(EventContextKeys.SPAWN_TYPE, InternalSpawnTypes.DROPPED_ITEM);
        final boolean hasBlocks = !phaseContext.getCapturedBlockSupplier().isEmpty();
        final List<BlockSnapshot> capturedBlcoks = phaseContext.getCapturedBlocks();
        @Nullable final BlockSnapshot firstBlockChange = hasBlocks ? capturedBlcoks.get(0) : null;
        if (hasBlocks) {
            if (!TrackingUtil.processBlockCaptures(capturedBlcoks, this, phaseContext)) {
                // Stop entities like XP from being spawned
                return;
            }
        } else {
            phaseContext.getBlockItemDropSupplier().acceptIfNotEmpty(map -> {
                if (ShouldFire.DROP_ITEM_EVENT_DESTRUCT) {
                    for (BlockSnapshot blockChange : capturedBlcoks) {
                        final Location<World> location = blockChange.getLocation().get();
                        final Vector3d position = location.getPosition();
                        final BlockPos blockPos = VecHelper.toBlockPos(position);
                        final Collection<EntityItem> entityItems = map.get(blockPos);
                        if (!entityItems.isEmpty()) {
                            final List<Entity> items = entityItems.stream().map(EntityUtil::fromNative).collect(Collectors.toList());
                            final DropItemEvent.Destruct event = SpongeEventFactory.createDropItemEventDestruct(Sponge.getCauseStackManager().getCurrentCause(), items);
                            SpongeImpl.postEvent(event);
                            if (!event.isCancelled()) {
                                processSpawnedEntities(player, event);
                            }
                        }
                    }
                } else {
                    for (BlockSnapshot blockChange : capturedBlcoks) {
                        final Location<World> location = blockChange.getLocation().get();
                        final Vector3d position = location.getPosition();
                        final BlockPos blockPos = VecHelper.toBlockPos(position);
                        final Collection<EntityItem> entityItems = map.get(blockPos);
                        if (!entityItems.isEmpty()) {
                            processEntities(player, (Collection<Entity>) (Collection<?>) entityItems);
                        }
                    }
                }
            });
        }
        phaseContext.getCapturedItemsSupplier().acceptAndClearIfNotEmpty(items -> {
            final ArrayList<Entity> entities = new ArrayList<>();
            for (EntityItem item : items) {
                entities.add(EntityUtil.fromNative(item));
            }
            final DropItemEvent.Dispense dispense = SpongeEventFactory.createDropItemEventDispense(Sponge.getCauseStackManager().getCurrentCause(), entities);
            SpongeImpl.postEvent(dispense);
            if (!dispense.isCancelled()) {
                processSpawnedEntities(player, dispense);
            }
        });
        phaseContext.getCapturedEntityDropSupplier().acceptIfNotEmpty(map -> {
            if (map.isEmpty()) {
                return;
            }
            final PrettyPrinter printer = new PrettyPrinter(80);
            printer.add("Processing Interaction").centre().hr();
            printer.add("The item stacks captured are: ");
            for (Map.Entry<UUID, Collection<ItemDropData>> entry : map.asMap().entrySet()) {
                printer.add("  - Entity with UUID: %s", entry.getKey());
                for (ItemDropData stack : entry.getValue()) {
                    printer.add("    - %s", stack);
                }
            }
            printer.trace(System.err);
        });
        phaseContext.getCapturedEntitySupplier().acceptAndClearIfNotEmpty(entities -> {
            final List<Entity> projectiles = new ArrayList<>(entities.size());
            final List<Entity> spawnEggs = new ArrayList<>(entities.size());
            final List<Entity> xpOrbs = new ArrayList<>(entities.size());
            final List<Entity> normalPlacement = new ArrayList<>(entities.size());
            final List<Entity> items = new ArrayList<>(entities.size());
            for (Entity entity : entities) {
                if (entity instanceof Projectile || entity instanceof EntityThrowable) {
                    projectiles.add(entity);
                } else if (usedSnapshot.getType() == ItemTypes.SPAWN_EGG) {
                    spawnEggs.add(entity);
                } else if (entity instanceof EntityItem) {
                    items.add(entity);
                } else if (entity instanceof EntityXPOrb) {
                    xpOrbs.add(entity);
                } else {
                    normalPlacement.add(entity);
                }
            }
            if (!projectiles.isEmpty()) {
                if (ShouldFire.SPAWN_ENTITY_EVENT) {
                    try (CauseStackManager.StackFrame frame2 = Sponge.getCauseStackManager().pushCauseFrame()) {
                        Sponge.getCauseStackManager().addContext(EventContextKeys.SPAWN_TYPE, InternalSpawnTypes.PROJECTILE);
                        Sponge.getCauseStackManager().pushCause(usedSnapshot);
                        final SpawnEntityEvent event = SpongeEventFactory.createSpawnEntityEvent(Sponge.getCauseStackManager().getCurrentCause(), projectiles);
                        if (!SpongeImpl.postEvent(event)) {
                            processSpawnedEntities(player, event);
                        }
                    }
                } else {
                    processEntities(player, projectiles);
                }
            }
            if (!spawnEggs.isEmpty()) {
                if (ShouldFire.SPAWN_ENTITY_EVENT) {
                    try (CauseStackManager.StackFrame frame2 = Sponge.getCauseStackManager().pushCauseFrame()) {
                        Sponge.getCauseStackManager().addContext(EventContextKeys.SPAWN_TYPE, InternalSpawnTypes.PROJECTILE);
                        Sponge.getCauseStackManager().pushCause(usedSnapshot);
                        final SpawnEntityEvent event = SpongeEventFactory.createSpawnEntityEvent(Sponge.getCauseStackManager().getCurrentCause(), spawnEggs);
                        if (!SpongeImpl.postEvent(event)) {
                            processSpawnedEntities(player, event);
                        }
                    }
                } else {
                    processEntities(player, spawnEggs);
                }
            }
            if (!items.isEmpty()) {
                if (ShouldFire.DROP_ITEM_EVENT_DISPENSE) {
                    final DropItemEvent.Dispense dispense = SpongeEventFactory.createDropItemEventDispense(Sponge.getCauseStackManager().getCurrentCause(), items);
                    if (!SpongeImpl.postEvent(dispense)) {
                        processSpawnedEntities(player, dispense);
                    }
                } else {
                    processEntities(player, items);
                }
            }
            if (!xpOrbs.isEmpty()) {
                if (ShouldFire.SPAWN_ENTITY_EVENT) {
                    try (final CauseStackManager.StackFrame stackFrame = Sponge.getCauseStackManager().pushCauseFrame()) {
                        if (firstBlockChange != null) {
                            stackFrame.pushCause(firstBlockChange);
                        }
                        stackFrame.addContext(EventContextKeys.SPAWN_TYPE, InternalSpawnTypes.EXPERIENCE);
                        final SpawnEntityEvent event = SpongeEventFactory.createSpawnEntityEvent(Sponge.getCauseStackManager().getCurrentCause(), xpOrbs);
                        if (!SpongeImpl.postEvent(event)) {
                            processSpawnedEntities(player, event);
                        }
                    }
                } else {
                    processEntities(player, xpOrbs);
                }
            }
            if (!normalPlacement.isEmpty()) {
                if (ShouldFire.SPAWN_ENTITY_EVENT) {
                    try (final CauseStackManager.StackFrame stackFrame = Sponge.getCauseStackManager().pushCauseFrame()) {
                        if (firstBlockChange != null) {
                            stackFrame.pushCause(firstBlockChange);
                        }
                        final SpawnEntityEvent event = SpongeEventFactory.createSpawnEntityEvent(Sponge.getCauseStackManager().getCurrentCause(), normalPlacement);
                        if (!SpongeImpl.postEvent(event)) {
                            processSpawnedEntities(player, event);
                        }
                    }
                } else {
                    processEntities(player, normalPlacement);
                }
            }
        });
        final IMixinContainer mixinContainer = ContainerUtil.toMixin(player.openContainer);
        mixinContainer.setCaptureInventory(false);
        mixinContainer.getCapturedTransactions().clear();
    }
}
Also used : Entity(org.spongepowered.api.entity.Entity) ArrayList(java.util.ArrayList) World(org.spongepowered.api.world.World) PrettyPrinter(org.spongepowered.asm.util.PrettyPrinter) CauseStackManager(org.spongepowered.api.event.CauseStackManager) BlockPos(net.minecraft.util.math.BlockPos) UUID(java.util.UUID) EntityItem(net.minecraft.entity.item.EntityItem) DropItemEvent(org.spongepowered.api.event.item.inventory.DropItemEvent) EntityThrowable(net.minecraft.entity.projectile.EntityThrowable) BlockSnapshot(org.spongepowered.api.block.BlockSnapshot) SpawnEntityEvent(org.spongepowered.api.event.entity.SpawnEntityEvent) Projectile(org.spongepowered.api.entity.projectile.Projectile) IMixinContainer(org.spongepowered.common.interfaces.IMixinContainer) Vector3d(com.flowpowered.math.vector.Vector3d) ItemStackSnapshot(org.spongepowered.api.item.inventory.ItemStackSnapshot) Collection(java.util.Collection) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ItemStack(org.spongepowered.api.item.inventory.ItemStack) ItemDropData(org.spongepowered.common.event.tracking.context.ItemDropData) Map(java.util.Map) Nullable(javax.annotation.Nullable) EntityXPOrb(net.minecraft.entity.item.EntityXPOrb)

Example 2 with Projectile

use of org.spongepowered.api.entity.projectile.Projectile in project SpongeCommon by SpongePowered.

the class EntityTickPhaseState method spawnEntityOrCapture.

@Override
public boolean spawnEntityOrCapture(EntityTickContext context, Entity entity, int chunkX, int chunkZ) {
    final Entity tickingEntity = context.getSource(Entity.class).orElseThrow(TrackingUtil.throwWithContext("Not ticking on an Entity!", context));
    final Optional<User> creator = context.getOwner();
    final Optional<User> notifier = context.getNotifier();
    final User entityCreator = notifier.orElseGet(() -> creator.orElse(null));
    try (CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) {
        context.addNotifierAndOwnerToCauseStack();
        Sponge.getCauseStackManager().pushCause(tickingEntity);
        if (entity instanceof EntityXPOrb) {
            Sponge.getCauseStackManager().addContext(EventContextKeys.SPAWN_TYPE, InternalSpawnTypes.EXPERIENCE);
            if (EntityUtil.isEntityDead(tickingEntity)) {
                if (tickingEntity instanceof EntityLivingBase) {
                    CombatEntry entry = ((EntityLivingBase) tickingEntity).getCombatTracker().getBestCombatEntry();
                    if (entry != null) {
                        if (entry.damageSrc != null) {
                            Sponge.getCauseStackManager().addContext(EventContextKeys.LAST_DAMAGE_SOURCE, (DamageSource) entry.damageSrc);
                        }
                    }
                }
            }
            final List<Entity> experience = new ArrayList<Entity>(1);
            experience.add(entity);
            final SpawnEntityEvent event = SpongeEventFactory.createSpawnEntityEvent(Sponge.getCauseStackManager().getCurrentCause(), experience);
            if (!SpongeImpl.postEvent(event)) {
                for (Entity anEntity : event.getEntities()) {
                    if (entityCreator != null) {
                        EntityUtil.toMixin(anEntity).setCreator(entityCreator.getUniqueId());
                    }
                    EntityUtil.getMixinWorld(entity).forceSpawnEntity(anEntity);
                }
                return true;
            }
            return false;
        } else if (tickingEntity instanceof Ageable && tickingEntity.getClass() == entity.getClass()) {
            Sponge.getCauseStackManager().addContext(EventContextKeys.SPAWN_TYPE, InternalSpawnTypes.BREEDING);
            if (tickingEntity instanceof EntityAnimal) {
                final EntityPlayer playerInLove = ((EntityAnimal) tickingEntity).getLoveCause();
                if (playerInLove != null) {
                    Sponge.getCauseStackManager().addContext(EventContextKeys.PLAYER, (Player) playerInLove);
                }
            }
            final List<Entity> breeding = new ArrayList<Entity>(1);
            breeding.add(entity);
            SpawnEntityEvent event = SpongeEventFactory.createSpawnEntityEvent(Sponge.getCauseStackManager().getCurrentCause(), breeding);
            if (!SpongeImpl.postEvent(event)) {
                for (Entity anEntity : event.getEntities()) {
                    if (entityCreator != null) {
                        EntityUtil.toMixin(anEntity).setCreator(entityCreator.getUniqueId());
                    }
                    EntityUtil.getMixinWorld(entity).forceSpawnEntity(anEntity);
                }
                return true;
            }
            return false;
        } else if (entity instanceof Projectile) {
            Sponge.getCauseStackManager().addContext(EventContextKeys.SPAWN_TYPE, InternalSpawnTypes.PROJECTILE);
            final List<Entity> projectile = new ArrayList<Entity>(1);
            projectile.add(entity);
            final SpawnEntityEvent event = SpongeEventFactory.createSpawnEntityEvent(Sponge.getCauseStackManager().getCurrentCause(), projectile);
            SpongeImpl.postEvent(event);
            if (!event.isCancelled()) {
                for (Entity anEntity : event.getEntities()) {
                    if (entityCreator != null) {
                        anEntity.setCreator(entityCreator.getUniqueId());
                    }
                    EntityUtil.getMixinWorld(entity).forceSpawnEntity(anEntity);
                }
                return true;
            }
            return false;
        }
        final List<Entity> nonExp = new ArrayList<Entity>(1);
        nonExp.add(entity);
        Sponge.getCauseStackManager().addContext(EventContextKeys.SPAWN_TYPE, InternalSpawnTypes.PASSIVE);
        final SpawnEntityEvent event = SpongeEventFactory.createSpawnEntityEvent(Sponge.getCauseStackManager().getCurrentCause(), nonExp);
        SpongeImpl.postEvent(event);
        if (!event.isCancelled()) {
            for (Entity anEntity : event.getEntities()) {
                if (entityCreator != null) {
                    anEntity.setCreator(entityCreator.getUniqueId());
                }
                EntityUtil.getMixinWorld(entity).forceSpawnEntity(anEntity);
            }
            return true;
        }
    }
    return false;
}
Also used : Entity(org.spongepowered.api.entity.Entity) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Player(org.spongepowered.api.entity.living.player.Player) User(org.spongepowered.api.entity.living.player.User) ArrayList(java.util.ArrayList) CombatEntry(net.minecraft.util.CombatEntry) Ageable(org.spongepowered.api.entity.living.Ageable) SpawnEntityEvent(org.spongepowered.api.event.entity.SpawnEntityEvent) IProjectile(net.minecraft.entity.IProjectile) Projectile(org.spongepowered.api.entity.projectile.Projectile) CauseStackManager(org.spongepowered.api.event.CauseStackManager) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ArrayList(java.util.ArrayList) List(java.util.List) EntityAnimal(net.minecraft.entity.passive.EntityAnimal) EntityXPOrb(net.minecraft.entity.item.EntityXPOrb)

Example 3 with Projectile

use of org.spongepowered.api.entity.projectile.Projectile in project Skree by Skelril.

the class PlayerCombatParser method parse.

default void parse(CollideEntityEvent.Impact event) {
    Optional<Projectile> optProjectile = event.getCause().first(Projectile.class);
    if (!optProjectile.isPresent()) {
        return;
    }
    Projectile projectile = optProjectile.get();
    ProjectileSource source = optProjectile.get().getShooter();
    if (!(source instanceof Player)) {
        return;
    }
    Player attacker = (Player) source;
    for (Entity anEntity : event.getEntities()) {
        if (anEntity instanceof Player) {
            Player defender = (Player) anEntity;
            processPvP(attacker, defender);
            processPvP(attacker, defender, projectile);
        }
    }
}
Also used : Entity(org.spongepowered.api.entity.Entity) Player(org.spongepowered.api.entity.living.player.Player) ProjectileSource(org.spongepowered.api.entity.projectile.source.ProjectileSource) Projectile(org.spongepowered.api.entity.projectile.Projectile)

Example 4 with Projectile

use of org.spongepowered.api.entity.projectile.Projectile in project RedProtect by FabioZumbi12.

the class RPEntityListener method onEntityDamage.

@Listener(order = Order.FIRST, beforeModifications = true)
public void onEntityDamage(DamageEntityEvent e) {
    // victim
    Entity e1 = e.getTargetEntity();
    RedProtect.get().logger.debug("entity", "RPEntityListener - DamageEntityEvent entity target " + e1.getType().getName());
    Region r = RedProtect.get().rm.getTopRegion(e1.getLocation());
    if (e1 instanceof Living && !(e1 instanceof Monster)) {
        if (r != null && r.flagExists("invincible")) {
            if (r.getFlagBool("invincible")) {
                e.setCancelled(true);
            }
        }
    }
    if (e1 instanceof Animal || e1 instanceof Villager || e1 instanceof Golem || e1 instanceof Ambient) {
        if (r != null && r.flagExists("invincible")) {
            if (r.getFlagBool("invincible")) {
                if (e1 instanceof Animal) {
                    ((Animal) e1).setTarget(null);
                }
                e.setCancelled(true);
            }
        }
    }
    // damager
    if (!e.getCause().first(Living.class).isPresent()) {
        return;
    }
    Entity e2 = e.getCause().first(Living.class).get();
    RedProtect.get().logger.debug("entity", "RPEntityListener - DamageEntityEvent damager " + e2.getType().getName());
    if (e2 instanceof Projectile) {
        Projectile a = (Projectile) e2;
        if (a.getShooter() instanceof Entity) {
            e2 = (Entity) a.getShooter();
        }
    }
    Region r1 = RedProtect.get().rm.getTopRegion(e1.getLocation());
    Region r2 = RedProtect.get().rm.getTopRegion(e2.getLocation());
    if (e.getCause().containsType(Lightning.class) || e.getCause().containsType(Explosive.class) || e.getCause().containsType(Fireball.class) || e.getCause().containsType(Explosion.class)) {
        if (r1 != null && !r1.canFire() && !(e2 instanceof Player)) {
            e.setCancelled(true);
            return;
        }
    }
    if (e1 instanceof Player) {
        if (e2 instanceof Player) {
            Player p2 = (Player) e2;
            if (r1 != null) {
                ItemType itemInHand = ItemTypes.NONE;
                if (p2.getItemInHand(HandTypes.MAIN_HAND).isPresent()) {
                    itemInHand = p2.getItemInHand(HandTypes.MAIN_HAND).get().getItem();
                } else if (p2.getItemInHand(HandTypes.OFF_HAND).isPresent()) {
                    itemInHand = p2.getItemInHand(HandTypes.OFF_HAND).get().getItem();
                }
                if (itemInHand.getType().equals(ItemTypes.EGG) && !r1.canProtectiles(p2)) {
                    e.setCancelled(true);
                    RPLang.sendMessage(p2, "playerlistener.region.cantuse");
                    return;
                }
                if (r2 != null) {
                    if (itemInHand.getType().equals(ItemTypes.EGG) && !r2.canProtectiles(p2)) {
                        e.setCancelled(true);
                        RPLang.sendMessage(p2, "playerlistener.region.cantuse");
                        return;
                    }
                    if ((r1.flagExists("pvp") && !r1.canPVP(p2)) || (r1.flagExists("pvp") && !r2.canPVP(p2))) {
                        e.setCancelled(true);
                        RPLang.sendMessage(p2, "entitylistener.region.cantpvp");
                    }
                } else if (r1.flagExists("pvp") && !r1.canPVP(p2)) {
                    e.setCancelled(true);
                    RPLang.sendMessage(p2, "entitylistener.region.cantpvp");
                }
            } else if (r2 != null && r2.flagExists("pvp") && !r2.canPVP(p2)) {
                e.setCancelled(true);
                RPLang.sendMessage(p2, "entitylistener.region.cantpvp");
            }
        }
    } else if (e1 instanceof Animal || e1 instanceof Villager || e1 instanceof Golem || e instanceof Ambient) {
        if (r1 != null && e2 instanceof Player) {
            Player p2 = (Player) e2;
            if (!r1.canInteractPassives(p2)) {
                e.setCancelled(true);
                RPLang.sendMessage(p2, "entitylistener.region.cantpassive");
            }
        }
    } else if ((e1 instanceof Hanging) && e2 instanceof Player) {
        Player p2 = (Player) e2;
        if (r1 != null && !r1.canBuild(p2)) {
            e.setCancelled(true);
            RPLang.sendMessage(p2, "playerlistener.region.cantuse");
            return;
        }
        if (r2 != null && !r2.canBuild(p2)) {
            e.setCancelled(true);
            RPLang.sendMessage(p2, "playerlistener.region.cantuse");
        }
    } else if ((e1 instanceof Hanging) && e2 instanceof Monster) {
        if (r1 != null || r2 != null) {
            RedProtect.get().logger.debug("entity", "Cancelled ItemFrame drop Item");
            e.setCancelled(true);
        }
    } else if ((e1 instanceof Explosive)) {
        if ((r1 != null && !r1.canFire()) || (r2 != null && !r2.canFire())) {
            e.setCancelled(true);
        }
    }
}
Also used : Entity(org.spongepowered.api.entity.Entity) Player(org.spongepowered.api.entity.living.player.Player) Explosion(org.spongepowered.api.world.explosion.Explosion) Living(org.spongepowered.api.entity.living.Living) ItemType(org.spongepowered.api.item.ItemType) Projectile(org.spongepowered.api.entity.projectile.Projectile) Golem(org.spongepowered.api.entity.living.golem.Golem) Ambient(org.spongepowered.api.entity.living.Ambient) Explosive(org.spongepowered.api.entity.explosive.Explosive) Hanging(org.spongepowered.api.entity.hanging.Hanging) Animal(org.spongepowered.api.entity.living.animal.Animal) Lightning(org.spongepowered.api.entity.weather.Lightning) Monster(org.spongepowered.api.entity.living.monster.Monster) Villager(org.spongepowered.api.entity.living.Villager) Region(br.net.fabiozumbi12.RedProtect.Sponge.Region) Listener(org.spongepowered.api.event.Listener)

Example 5 with Projectile

use of org.spongepowered.api.entity.projectile.Projectile in project RedProtect by FabioZumbi12.

the class RPMine18 method onEntityDamage.

@Listener(order = Order.FIRST, beforeModifications = true)
public void onEntityDamage(DamageEntityEvent e, @First Entity e2) {
    Entity e1 = e.getTargetEntity();
    Location<World> loc = e1.getLocation();
    Player damager = null;
    if (e2 instanceof Projectile) {
        Projectile proj = (Projectile) e2;
        if (proj.getShooter() instanceof Player) {
            damager = (Player) proj.getShooter();
        }
    } else if (e2 instanceof Player) {
        damager = (Player) e2;
    }
    Region r1 = RedProtect.get().rm.getTopRegion(loc);
    if (r1 == null) {
        // global flags
        if (e1 instanceof ArmorStand) {
            if (e2 instanceof Player) {
                if (!RedProtect.get().cfgs.getGlobalFlag(loc.getExtent().getName(), "build")) {
                    e.setCancelled(true);
                    return;
                }
            }
        }
        return;
    }
    if (e1 instanceof ArmorStand) {
        if (r1 != null && !r1.canBuild(damager)) {
            e.setCancelled(true);
            RPLang.sendMessage(damager, "blocklistener.region.cantbreak");
        }
    }
}
Also used : Entity(org.spongepowered.api.entity.Entity) Player(org.spongepowered.api.entity.living.player.Player) ArmorStand(org.spongepowered.api.entity.living.ArmorStand) Region(br.net.fabiozumbi12.RedProtect.Sponge.Region) World(org.spongepowered.api.world.World) Projectile(org.spongepowered.api.entity.projectile.Projectile) Listener(org.spongepowered.api.event.Listener)

Aggregations

Projectile (org.spongepowered.api.entity.projectile.Projectile)11 Entity (org.spongepowered.api.entity.Entity)10 Player (org.spongepowered.api.entity.living.player.Player)8 Listener (org.spongepowered.api.event.Listener)7 World (org.spongepowered.api.world.World)6 Region (br.net.fabiozumbi12.RedProtect.Sponge.Region)4 Living (org.spongepowered.api.entity.living.Living)4 ArrayList (java.util.ArrayList)3 Collection (java.util.Collection)3 EntityXPOrb (net.minecraft.entity.item.EntityXPOrb)3 ProjectileSource (org.spongepowered.api.entity.projectile.source.ProjectileSource)3 Vector3d (com.flowpowered.math.vector.Vector3d)2 List (java.util.List)2 Optional (java.util.Optional)2 Nullable (javax.annotation.Nullable)2 EntityLivingBase (net.minecraft.entity.EntityLivingBase)2 IProjectile (net.minecraft.entity.IProjectile)2 EntityItem (net.minecraft.entity.item.EntityItem)2 EntityAnimal (net.minecraft.entity.passive.EntityAnimal)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2