Search in sources :

Example 1 with EntitySentientSpecter

use of WayofTime.bloodmagic.entity.mob.EntitySentientSpecter in project BloodMagic by WayofTime.

the class ItemSentientSword method spawnSentientEntityOnDrop.

@Override
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player) {
    World world = player.getEntityWorld();
    if (!world.isRemote) {
        this.recalculatePowers(droppedStack, world, player);
        EnumDemonWillType type = this.getCurrentType(droppedStack);
        double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
        if (soulsRemaining < 1024) {
            return false;
        }
        PlayerDemonWillHandler.consumeDemonWill(type, player, 100);
        EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
        specterEntity.setPosition(player.posX, player.posY, player.posZ);
        world.spawnEntity(specterEntity);
        specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
        specterEntity.setType(this.getCurrentType(droppedStack));
        specterEntity.setOwner(player);
        specterEntity.setTamed(true);
        return true;
    }
    return false;
}
Also used : EntitySentientSpecter(WayofTime.bloodmagic.entity.mob.EntitySentientSpecter) World(net.minecraft.world.World) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 2 with EntitySentientSpecter

use of WayofTime.bloodmagic.entity.mob.EntitySentientSpecter in project BloodMagic by WayofTime.

the class ItemSentientBow method spawnSentientEntityOnDrop.

@Override
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player) {
    World world = player.getEntityWorld();
    if (!world.isRemote) {
        this.recalculatePowers(droppedStack, world, player);
        EnumDemonWillType type = this.getCurrentType(droppedStack);
        double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
        if (soulsRemaining < 1024) {
            return false;
        }
        PlayerDemonWillHandler.consumeDemonWill(type, player, 100);
        EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
        specterEntity.setPosition(player.posX, player.posY, player.posZ);
        world.spawnEntity(specterEntity);
        specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
        specterEntity.setType(this.getCurrentType(droppedStack));
        specterEntity.setOwner(player);
        specterEntity.setTamed(true);
        return true;
    }
    return false;
}
Also used : EntitySentientSpecter(WayofTime.bloodmagic.entity.mob.EntitySentientSpecter) World(net.minecraft.world.World) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 3 with EntitySentientSpecter

use of WayofTime.bloodmagic.entity.mob.EntitySentientSpecter in project BloodMagic by WayofTime.

the class ItemSentientAxe method spawnSentientEntityOnDrop.

@Override
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player) {
    World world = player.getEntityWorld();
    if (!world.isRemote) {
        this.recalculatePowers(droppedStack, world, player);
        EnumDemonWillType type = this.getCurrentType(droppedStack);
        double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
        if (soulsRemaining < 1024) {
            return false;
        }
        PlayerDemonWillHandler.consumeDemonWill(type, player, 100);
        EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
        specterEntity.setPosition(player.posX, player.posY, player.posZ);
        world.spawnEntity(specterEntity);
        specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
        specterEntity.setType(this.getCurrentType(droppedStack));
        specterEntity.setOwner(player);
        specterEntity.setTamed(true);
        return true;
    }
    return false;
}
Also used : EntitySentientSpecter(WayofTime.bloodmagic.entity.mob.EntitySentientSpecter) World(net.minecraft.world.World) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 4 with EntitySentientSpecter

use of WayofTime.bloodmagic.entity.mob.EntitySentientSpecter in project BloodMagic by WayofTime.

the class GenericHandler method onExplosion.

@SubscribeEvent
public static void onExplosion(ExplosionEvent.Start event) {
    World world = event.getWorld();
    Explosion exp = event.getExplosion();
    Vec3d position = exp.getPosition();
    double radius = 3;
    AxisAlignedBB bb = new AxisAlignedBB(position.x - radius, position.y - radius, position.z - radius, position.x + radius, position.y + radius, position.z + radius);
    List<EntitySentientSpecter> specterList = world.getEntitiesWithinAABB(EntitySentientSpecter.class, bb);
    if (!specterList.isEmpty()) {
        for (EntitySentientSpecter specter : specterList) {
            if (specter.absorbExplosion(exp)) {
                event.setCanceled(true);
                return;
            }
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Explosion(net.minecraft.world.Explosion) EntitySentientSpecter(WayofTime.bloodmagic.entity.mob.EntitySentientSpecter) World(net.minecraft.world.World) Vec3d(net.minecraft.util.math.Vec3d) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 5 with EntitySentientSpecter

use of WayofTime.bloodmagic.entity.mob.EntitySentientSpecter in project BloodMagic by WayofTime.

the class ItemSentientPickaxe method spawnSentientEntityOnDrop.

@Override
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player) {
    World world = player.getEntityWorld();
    if (!world.isRemote) {
        this.recalculatePowers(droppedStack, world, player);
        EnumDemonWillType type = this.getCurrentType(droppedStack);
        double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
        if (soulsRemaining < 1024) {
            return false;
        }
        PlayerDemonWillHandler.consumeDemonWill(type, player, 100);
        EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
        specterEntity.setPosition(player.posX, player.posY, player.posZ);
        world.spawnEntity(specterEntity);
        specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());
        specterEntity.setType(this.getCurrentType(droppedStack));
        specterEntity.setOwner(player);
        specterEntity.setTamed(true);
        return true;
    }
    return false;
}
Also used : EntitySentientSpecter(WayofTime.bloodmagic.entity.mob.EntitySentientSpecter) World(net.minecraft.world.World) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Aggregations

EntitySentientSpecter (WayofTime.bloodmagic.entity.mob.EntitySentientSpecter)6 World (net.minecraft.world.World)6 EnumDemonWillType (WayofTime.bloodmagic.soul.EnumDemonWillType)5 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 Vec3d (net.minecraft.util.math.Vec3d)1 Explosion (net.minecraft.world.Explosion)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1