still broken
parent
12f858bbbd
commit
bd53f99b20
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,144 +0,0 @@
|
|||||||
package com.zivilon.cinder_loe.entity;
|
|
||||||
|
|
||||||
import com.zivilon.cinder_loe.CinderLoE;
|
|
||||||
import lotr.common.LOTRLevelData;
|
|
||||||
import lotr.common.LOTRMod;
|
|
||||||
import lotr.common.entity.LOTREntities;
|
|
||||||
import lotr.common.entity.ai.LOTREntityAIAttackOnCollide;
|
|
||||||
import lotr.common.entity.ai.LOTREntityAIFollowHiringPlayer;
|
|
||||||
import lotr.common.entity.ai.LOTREntityAIHiredRemainStill;
|
|
||||||
import lotr.common.entity.npc.LOTREntityNPC;
|
|
||||||
import lotr.common.entity.npc.LOTREntityNPCRideable;
|
|
||||||
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.util.DamageSource;
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class LimwaithCrocodile extends LOTREntityNPCRideable {
|
|
||||||
public LimwaithCrocodile(World world) {
|
|
||||||
super(world);
|
|
||||||
this.setSize(2.1f, 0.7f);
|
|
||||||
((EntityLiving) this).tasks.addTask(0, (EntityAIBase) new EntityAISwimming((EntityLiving) this));
|
|
||||||
((EntityLiving) this).tasks.addTask(1, (EntityAIBase) new LOTREntityAIHiredRemainStill(this));
|
|
||||||
((EntityLiving) this).tasks.addTask(2, (EntityAIBase) new LOTREntityAIAttackOnCollide(this, 1.5D, false));
|
|
||||||
((EntityLiving) this).tasks.addTask(3, (EntityAIBase) new LOTREntityAIFollowHiringPlayer(this));
|
|
||||||
((EntityLiving) this).tasks.addTask(4, (EntityAIBase) new EntityAIWander(this, 1.0D));
|
|
||||||
((EntityLiving) this).tasks.addTask(5, (EntityAIBase) new EntityAIWatchClosest2((EntityLiving) this, EntityPlayer.class, 8.0F, 0.02F));
|
|
||||||
((EntityLiving) this).tasks.addTask(6, (EntityAIBase) new EntityAIWatchClosest2((EntityLiving) this, LOTREntityNPC.class, 12.0F, 0.02F));
|
|
||||||
((EntityLiving) this).tasks.addTask(7, (EntityAIBase) new EntityAIWatchClosest((EntityLiving) this, EntityLiving.class, 8.0F, 0.02F));
|
|
||||||
((EntityLiving) this).tasks.addTask(8, (EntityAIBase) new EntityAILookIdle((EntityLiving) this));
|
|
||||||
|
|
||||||
this.addTargetTasks(true);
|
|
||||||
this.spawnsInDarkness = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void entityInit() {
|
|
||||||
super.entityInit();
|
|
||||||
((Entity) this).getDataWatcher().addObject(20, (Object) 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void applyEntityAttributes() {
|
|
||||||
super.applyEntityAttributes();
|
|
||||||
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D);
|
|
||||||
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2D);
|
|
||||||
getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(8.0D);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSnapTime() {
|
|
||||||
return ((Entity) this).getDataWatcher().getWatchableObjectInt(20);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSnapTime(int i) {
|
|
||||||
((Entity) this).getDataWatcher().updateObject(20, (Object) i);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAIEnabled() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canBreatheUnderwater() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean attackEntityAsMob(Entity entity) {
|
|
||||||
boolean flag = super.attackEntityAsMob(entity);
|
|
||||||
if (flag) {
|
|
||||||
if (!((Entity) this).worldObj.isRemote) {
|
|
||||||
this.setSnapTime(20);
|
|
||||||
}
|
|
||||||
((Entity) this).worldObj.playSoundAtEntity((Entity) this, "lotr:crocodile.snap", this.getSoundVolume(), this.getSoundPitch());
|
|
||||||
}
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
protected void dropFewItems(boolean flag, int i) {
|
|
||||||
int hides = 2 + rand.nextInt(3) + rand.nextInt(1 + i);
|
|
||||||
for (int l = 0; l < hides; l++)
|
|
||||||
dropItem(Items.bone, 1);
|
|
||||||
int meats = 2 + rand.nextInt(3) + rand.nextInt(1 + i);
|
|
||||||
for (int j = 0; j < meats; j++) {
|
|
||||||
if (isBurning()) {
|
|
||||||
dropItem(Items.fish, 1);
|
|
||||||
} else {
|
|
||||||
dropItem(Items.leather, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dropItem(LOTRMod.zebraRaw, 1);
|
|
||||||
}
|
|
||||||
protected String getLivingSound() {
|
|
||||||
return "lotr:crocodile.say";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getHurtSound() {
|
|
||||||
return "lotr:crocodile.say";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getDeathSound() {
|
|
||||||
return "lotr:crocodile.death";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
|
|
||||||
// No ranged attack implemented
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getPickedResult(MovingObjectPosition target) {
|
|
||||||
return new ItemStack(LOTRMod.spawnEgg, 1, LOTREntities.getEntityID((Entity) this));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isMountSaddled() {
|
|
||||||
return this.isNPCTamed() && ((Entity) this).riddenByEntity instanceof EntityPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getBelongsToNPC() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBelongsToNPC(boolean flag) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMountArmorTexture() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onLivingUpdate() {
|
|
||||||
super.onLivingUpdate();
|
|
||||||
if (!((Entity) this).worldObj.isRemote) {
|
|
||||||
Entity rider = ((Entity) this).riddenByEntity;
|
|
||||||
}
|
|
||||||
if (!((Entity) this).worldObj.isRemote && ((Entity) this).riddenByEntity instanceof EntityPlayer && LOTRLevelData.getData((EntityPlayer) ((Entity) this).riddenByEntity).getAlignment(this.getFaction()) < 50.0f) {
|
|
||||||
((Entity) this).riddenByEntity.mountEntity(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue