You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
3.0 KiB
Java
92 lines
3.0 KiB
Java
package com.zivilon.cinder_loe.entity;
|
|
|
|
import com.zivilon.cinder_loe.CinderLoE;
|
|
|
|
import lotr.common.LOTRFoods;
|
|
import lotr.common.LOTRMod;
|
|
import lotr.common.entity.ai.*;
|
|
import lotr.common.entity.animal.LOTREntityHorse;
|
|
import lotr.common.entity.npc.*;
|
|
import lotr.common.fac.LOTRFaction;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.EntityLiving;
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
import net.minecraft.entity.SharedMonsterAttributes;
|
|
import net.minecraft.entity.ai.*;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.init.Items;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.potion.Potion;
|
|
import net.minecraft.potion.PotionEffect;
|
|
import net.minecraft.util.DamageSource;
|
|
import net.minecraft.util.MovingObjectPosition;
|
|
import net.minecraft.util.StatCollector;
|
|
import net.minecraft.world.World;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
public class DarkSpider extends LOTREntitySpiderBase {
|
|
public static int VENOM_DARK = 3;
|
|
public DarkSpider(World world) {
|
|
super(world);
|
|
}
|
|
@Override
|
|
protected int getRandomSpiderScale() {
|
|
return this.rand.nextInt(4);
|
|
}
|
|
@Override
|
|
protected int getRandomSpiderType() {
|
|
return VENOM_DARK;
|
|
}
|
|
@Override
|
|
public LOTRFaction getFaction() {
|
|
return LOTRFaction.UTUMNO;
|
|
}
|
|
|
|
@Override
|
|
public boolean attackEntityAsMob(Entity entity) {
|
|
if (super.attackEntityAsMob(entity)) {
|
|
if (entity instanceof EntityLivingBase) {
|
|
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.blindness.id, 200, 0));
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
@Override
|
|
protected boolean canRideSpider() {
|
|
return false;
|
|
}
|
|
@Override
|
|
public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) {
|
|
}
|
|
@Override
|
|
public boolean attackEntityFrom(DamageSource source, float amount) {
|
|
if (source.getEntity() instanceof EntityLivingBase) {
|
|
EntityLivingBase attacker = (EntityLivingBase) source.getEntity();
|
|
if (attacker instanceof EntityPlayer) {
|
|
EntityPlayer player = (EntityPlayer) attacker;
|
|
if (this.getSpiderScale() > 4 && this.rand.nextDouble() < 0.5) {
|
|
spawnDarkSpiders(player);
|
|
}
|
|
}
|
|
}
|
|
return super.attackEntityFrom(source, amount);
|
|
}
|
|
private void spawnDarkSpiders(EntityPlayer player) {
|
|
World world = player.worldObj;
|
|
for (int i = 0; i < 10; i++) {
|
|
DarkSpider babySpider = new DarkSpider(world);
|
|
babySpider.setLocationAndAngles(player.posX, player.posY, player.posZ, player.rotationYaw, 0.0F);
|
|
babySpider.setSpiderScale(0);
|
|
babySpider.setHealth(10);
|
|
world.spawnEntityInWorld(babySpider);
|
|
}
|
|
}
|
|
@Override
|
|
public ItemStack getPickedResult(MovingObjectPosition target) {
|
|
return null;
|
|
}
|
|
}
|