Search in sources :

Example 1 with EntityPearcelBoss

use of com.miningmark48.pearcelmod.entity.EntityPearcelBoss in project Pearcel-Mod by MiningMark48.

the class ItemGuardianFood method onFoodEaten.

@Override
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
    BlockPos pos = player.getPosition();
    int x = pos.getX();
    int y = pos.getY();
    int z = pos.getZ();
    Random rand = new Random();
    int num = rand.nextInt(5) + 10;
    int range = 25;
    List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(x - range, y - range, z - range, x + range, y + range, z + range));
    if (!world.isRemote) {
        EntityPearcelBoss pb = new EntityPearcelBoss(world);
        pb.setPosition(x, y + num, z);
        world.spawnEntity(new EntityLightningBolt(world, x, y, z, true));
        world.spawnEntity(pb);
        for (EntityPlayer e : players) {
            e.sendMessage(new TextComponentString(TextFormatting.GREEN + Translate.toLocal("chat.item.guardian_food.summoned")));
        }
    }
    world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, x + 0.5, y + num + 0.5, z + 0.5, 1.0D, 0.0D, 0.0D);
    for (EntityPlayer e : players) {
        e.playSound(ModSoundEvents.MOB_PEARCEL_BOSS_LAUGH, 5.0F, 1.0F);
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Random(java.util.Random) EntityPearcelBoss(com.miningmark48.pearcelmod.entity.EntityPearcelBoss) EntityPlayer(net.minecraft.entity.player.EntityPlayer) BlockPos(net.minecraft.util.math.BlockPos) EntityLightningBolt(net.minecraft.entity.effect.EntityLightningBolt) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 2 with EntityPearcelBoss

use of com.miningmark48.pearcelmod.entity.EntityPearcelBoss in project Pearcel-Mod by MiningMark48.

the class ItemPearcelStaff method hitEntity.

@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase hitEntity, EntityLivingBase attackEntity) {
    if (hitEntity instanceof EntityPearcelBoss) {
        return false;
    } else {
        hitEntity.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 2000, 2, true, false));
        hitEntity.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 5000, 2, true, false));
        return true;
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) EntityPearcelBoss(com.miningmark48.pearcelmod.entity.EntityPearcelBoss)

Aggregations

EntityPearcelBoss (com.miningmark48.pearcelmod.entity.EntityPearcelBoss)2 Random (java.util.Random)1 EntityLightningBolt (net.minecraft.entity.effect.EntityLightningBolt)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 PotionEffect (net.minecraft.potion.PotionEffect)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 BlockPos (net.minecraft.util.math.BlockPos)1 TextComponentString (net.minecraft.util.text.TextComponentString)1