|
|
|
@ -1,49 +1,102 @@
|
|
|
|
package com.zivilon.cinder_loe.entity;
|
|
|
|
package com.zivilon.cinder_loe.entity;
|
|
|
|
|
|
|
|
|
|
|
|
import com.zivilon.cinder_loe.CinderLoE;
|
|
|
|
import com.zivilon.cinder_loe.CinderLoE;
|
|
|
|
import lotr.common.LOTRCapes;
|
|
|
|
import lotr.common.*;
|
|
|
|
import lotr.common.LOTRMod;
|
|
|
|
import lotr.common.entity.ai.*;
|
|
|
|
import lotr.common.LOTRShields;
|
|
|
|
|
|
|
|
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
|
|
|
|
|
|
|
|
import lotr.common.entity.ai.LOTREntityAIRangedAttack;
|
|
|
|
|
|
|
|
import lotr.common.entity.animal.LOTREntityHorse;
|
|
|
|
import lotr.common.entity.animal.LOTREntityHorse;
|
|
|
|
import lotr.common.entity.npc.LOTREntityGondorSoldier;
|
|
|
|
import lotr.common.entity.npc.*;
|
|
|
|
import lotr.common.entity.npc.LOTREntityNPC;
|
|
|
|
import lotr.common.fac.LOTRFaction;
|
|
|
|
import lotr.common.entity.npc.LOTRNPCMount;
|
|
|
|
import lotr.common.quest.LOTRMiniQuest;
|
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
import lotr.common.quest.LOTRMiniQuestFactory;
|
|
|
|
import net.minecraft.entity.EntityLiving;
|
|
|
|
import lotr.common.world.structure.LOTRChestContents;
|
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
|
|
import net.minecraft.entity.*;
|
|
|
|
import net.minecraft.entity.IEntityLivingData;
|
|
|
|
import net.minecraft.entity.ai.*;
|
|
|
|
import net.minecraft.entity.ai.EntityAIBase;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
|
|
|
import net.minecraft.init.Items;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraft.util.MovingObjectPosition;
|
|
|
|
import net.minecraft.util.MovingObjectPosition;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
|
|
|
|
|
|
|
public class BreeOutrider extends BreeSoldier {
|
|
|
|
public class BreeOutrider extends LOTREntityBreeGuard {
|
|
|
|
private EntityAIBase rangedAttackAI = this.createBreeRangedAttackAI();
|
|
|
|
private EntityAIBase rangedAttackAI = this.createBreeRangedAttackAI();
|
|
|
|
private EntityAIBase meleeAttackAI = this.addBreeAttackAI();
|
|
|
|
private EntityAIBase meleeAttackAI = this.addBreeAttackAI();
|
|
|
|
|
|
|
|
private static ItemStack[] guardWeapons = new ItemStack[]{new ItemStack(CinderLoE.swordBree), new ItemStack(CinderLoE.swordBree), new ItemStack(LOTRMod.pikeIron)};
|
|
|
|
public BreeOutrider(World world) {
|
|
|
|
public BreeOutrider(World world) {
|
|
|
|
super(world);
|
|
|
|
super(world);
|
|
|
|
|
|
|
|
this.setSize(0.6f, 1.8f);
|
|
|
|
|
|
|
|
this.getNavigator().setAvoidsWater(true);
|
|
|
|
|
|
|
|
this.getNavigator().setBreakDoors(true);
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(0, new EntityAISwimming((EntityLiving)this));
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(1, new LOTREntityAIHiredRemainStill(this));
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(2, this.addBreeAttackAI());
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(2, this.createBreeRangedAttackAI());
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(3, new LOTREntityAIFollowHiringPlayer(this));
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(4, new EntityAIOpenDoor((EntityLiving)this, true));
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(5, new EntityAIWander((EntityCreature)this, 1.0));
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(6, new LOTREntityAIEat(this, LOTRFoods.BREE, 8000));
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(6, new LOTREntityAIDrink(this, LOTRFoods.BREE_DRINK, 6000));
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(6, new LOTREntityAIHobbitSmoke(this, 12000));
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(7, new EntityAIWatchClosest2((EntityLiving)this, EntityPlayer.class, 10.0f, 0.02f));
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(7, (EntityAIBase)new EntityAIWatchClosest2((EntityLiving)this, LOTREntityNPC.class, 5.0f, 0.02f));
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(8, (EntityAIBase)new EntityAIWatchClosest((EntityLiving)this, EntityLiving.class, 8.0f, 0.02f));
|
|
|
|
|
|
|
|
((EntityLiving)this).tasks.addTask(9, (EntityAIBase)new EntityAILookIdle((EntityLiving)this));
|
|
|
|
this.addTargetTasks(true);
|
|
|
|
this.addTargetTasks(true);
|
|
|
|
this.npcCape = LOTRCapes.RANGER;
|
|
|
|
|
|
|
|
this.spawnRidingHorse = true;
|
|
|
|
|
|
|
|
this.npcShield = LOTRShields.ALIGNMENT_BREE;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected EntityAIBase createBreeRangedAttackAI() {
|
|
|
|
|
|
|
|
return new LOTREntityAIRangedAttack(this, 1.25, 30, 40, 16.0f);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
protected EntityAIBase addBreeAttackAI() {
|
|
|
|
|
|
|
|
return new LOTREntityAIAttackOnCollide(this, 1.5, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void applyEntityAttributes() {
|
|
|
|
protected void applyEntityAttributes() {
|
|
|
|
super.applyEntityAttributes();
|
|
|
|
super.applyEntityAttributes();
|
|
|
|
this.getEntityAttribute(LOTREntityNPC.npcRangedAccuracy).setBaseValue(0.5);
|
|
|
|
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0);
|
|
|
|
|
|
|
|
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public LOTRFaction getFaction() {
|
|
|
|
|
|
|
|
return LOTRFaction.BREE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected EntityAIBase createBreeRangedAttackAI() {
|
|
|
|
@Override
|
|
|
|
return new LOTREntityAIRangedAttack(this, 1.25, 30, 40, 16.0f);
|
|
|
|
public void setupNPCGender() {
|
|
|
|
|
|
|
|
this.familyInfo.setMale((this).rand.nextBoolean());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void setupNPCName() {
|
|
|
|
|
|
|
|
this.familyInfo.setName(LOTRNames.getBreeName((this).rand, this.familyInfo.isMale()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String getNPCName() {
|
|
|
|
|
|
|
|
return this.familyInfo.getName();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void dropFewItems(boolean flag, int i) {
|
|
|
|
|
|
|
|
super.dropFewItems(flag, i);
|
|
|
|
|
|
|
|
int bones = (this).rand.nextInt(2) + (this).rand.nextInt(i + 1);
|
|
|
|
|
|
|
|
for (int l = 0; l < bones; ++l) {
|
|
|
|
|
|
|
|
this.dropItem(Items.bone, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.dropBreeItems(flag, i);
|
|
|
|
|
|
|
|
dropNPCCrossbowBolts(i);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected LOTRAchievement getKillAchievement() {
|
|
|
|
|
|
|
|
return LOTRAchievement.killBreelander;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
protected EntityAIBase addBreeAttackAI() {
|
|
|
|
|
|
|
|
return new LOTREntityAIAttackOnCollide(this, 1.45D, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void dropBreeItems(boolean flag, int i) {
|
|
|
|
|
|
|
|
if ((this).rand.nextInt(6) == 0) {
|
|
|
|
|
|
|
|
this.dropChestContents(LOTRChestContents.BREE_HOUSE, 1, 2 + i);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void entityInit() {
|
|
|
|
protected void entityInit() {
|
|
|
|
super.entityInit();
|
|
|
|
super.entityInit();
|
|
|
|
@ -54,8 +107,13 @@ public class BreeOutrider extends BreeSoldier {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
|
|
|
|
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
|
|
|
|
data = super.onSpawnWithEgg(data);
|
|
|
|
data = super.onSpawnWithEgg(data);
|
|
|
|
|
|
|
|
int i = (rand.nextInt(guardWeapons.length));
|
|
|
|
|
|
|
|
this.npcItemsInv.setMeleeWeapon(guardWeapons[i].copy());
|
|
|
|
|
|
|
|
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
|
|
|
|
|
|
|
|
setCurrentItemOrArmor(1, new ItemStack(CinderLoE.bootsBree));
|
|
|
|
|
|
|
|
setCurrentItemOrArmor(2, new ItemStack(CinderLoE.legsBree));
|
|
|
|
|
|
|
|
setCurrentItemOrArmor(3, new ItemStack(CinderLoE.bodyBree));
|
|
|
|
setCurrentItemOrArmor(4, new ItemStack(CinderLoE.helmetBreeKettle));
|
|
|
|
setCurrentItemOrArmor(4, new ItemStack(CinderLoE.helmetBreeKettle));
|
|
|
|
this.npcItemsInv.setMeleeWeapon(new ItemStack(CinderLoE.swordBree));
|
|
|
|
|
|
|
|
this.npcItemsInv.setRangedWeapon(new ItemStack(LOTRMod.ironCrossbow));
|
|
|
|
this.npcItemsInv.setRangedWeapon(new ItemStack(LOTRMod.ironCrossbow));
|
|
|
|
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
|
|
|
|
this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon());
|
|
|
|
return data;
|
|
|
|
return data;
|
|
|
|
@ -96,12 +154,30 @@ public class BreeOutrider extends BreeSoldier {
|
|
|
|
public void attackEntityWithRangedAttack(EntityLivingBase target, float f) {
|
|
|
|
public void attackEntityWithRangedAttack(EntityLivingBase target, float f) {
|
|
|
|
npcCrossbowAttack(target, f);
|
|
|
|
npcCrossbowAttack(target, f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
protected void dropFewItems(boolean flag, int i) {
|
|
|
|
|
|
|
|
super.dropFewItems(flag, i);
|
|
|
|
|
|
|
|
dropNPCCrossbowBolts(i);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public float getAlignmentBonus() {
|
|
|
|
public float getAlignmentBonus() {
|
|
|
|
return 3.0f;
|
|
|
|
return 3.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String getSpeechBank(EntityPlayer entityplayer) {
|
|
|
|
|
|
|
|
if (this.isFriendlyAndAligned(entityplayer)) {
|
|
|
|
|
|
|
|
if (this.hiredNPCInfo.getHiringPlayer() == entityplayer) {
|
|
|
|
|
|
|
|
return "bree/guard/hired";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return "bree/guard/friendly";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return "bree/guard/hostile";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public LOTRMiniQuest createMiniQuest() {
|
|
|
|
|
|
|
|
return LOTRMiniQuestFactory.BREE.createQuest(this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public LOTRMiniQuestFactory getBountyHelpSpeechDir() {
|
|
|
|
|
|
|
|
return LOTRMiniQuestFactory.BREE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|