mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 02:55:26 +00:00
Flying Tests
This commit is contained in:
1 parent
8028dde5ae
commit
f9bdc66956
4 files changed
+149
-34
No files matched your search
@@ -32,6 +32,9 @@ public class DataAI {
|
||||
public EnumNavType tacticalVariant = EnumNavType.Default;
|
||||
public int useRangeMelee = 0;
|
||||
public int tacticalRadius = 8;
|
||||
|
||||
// Fly Change
|
||||
public int movementType = 0;
|
||||
|
||||
public EnumAnimation animationType = EnumAnimation.NONE;
|
||||
public EnumStandingType standingType = EnumStandingType.RotateBody;
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package noppes.npcs.entity;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
||||
public abstract class EntityNPCFlying extends EntityNPCInterface {
|
||||
|
||||
public EntityNPCFlying(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
// FLY CHANGE [WIP]
|
||||
|
||||
// @Override
|
||||
// public boolean canFly(){
|
||||
// return ai.movementType == 1;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void fall(float distance) {
|
||||
// if(!canFly())
|
||||
// super.fall(distance);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void updateFallState(double p_180433_1_, boolean p_180433_3_) {
|
||||
// if(!canFly())
|
||||
// super.updateFallState(p_180433_1_, p_180433_3_);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_){
|
||||
// if(!canFly()){
|
||||
// super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (this.isInWater()){
|
||||
// this.moveFlying(p_70612_1_, p_70612_2_, 0.02F);
|
||||
// this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
// this.motionX *= 0.800000011920929D;
|
||||
// this.motionY *= 0.800000011920929D;
|
||||
// this.motionZ *= 0.800000011920929D;
|
||||
// }
|
||||
// else if (this.isInsideOfMaterial(Material.lava)){
|
||||
// this.moveFlying(p_70612_1_, p_70612_2_, 0.02F);
|
||||
// this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
// this.motionX *= 0.5D;
|
||||
// this.motionY *= 0.5D;
|
||||
// this.motionZ *= 0.5D;
|
||||
// }
|
||||
// else{
|
||||
// float f2 = 0.91F;
|
||||
//
|
||||
// if (this.onGround){
|
||||
// f2 = this.worldObj.getBlock((int)this.posX, (int)this.boundingBox.minY - 1, (int)this.posZ).slipperiness * 0.91F;
|
||||
// }
|
||||
//
|
||||
// float f3 = 0.16277136F / (f2 * f2 * f2);
|
||||
// this.moveFlying(p_70612_1_, p_70612_2_, this.onGround ? 0.1F * f3 : 0.02F);
|
||||
// f2 = 0.91F;
|
||||
//
|
||||
// if (this.onGround){
|
||||
// f2 = this.worldObj.getBlock((int)this.posX, (int)this.boundingBox.minY - 1, (int)this.posZ).slipperiness * 0.91F;
|
||||
// }
|
||||
//
|
||||
// this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
// this.motionX *= (double)f2;
|
||||
// this.motionY *= (double)f2;
|
||||
// this.motionZ *= (double)f2;
|
||||
// }
|
||||
//
|
||||
// this.prevLimbSwingAmount = this.limbSwingAmount;
|
||||
// double d1 = this.posX - this.prevPosX;
|
||||
// double d0 = this.posZ - this.prevPosZ;
|
||||
// float f4 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F;
|
||||
//
|
||||
// if (f4 > 1.0F){
|
||||
// f4 = 1.0F;
|
||||
// }
|
||||
//
|
||||
// this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
|
||||
// this.limbSwing += this.limbSwingAmount;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isOnLadder(){
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -21,17 +21,12 @@ import net.minecraft.entity.EnumCreatureAttribute;
|
||||
import net.minecraft.entity.IRangedAttackMob;
|
||||
import net.minecraft.entity.NPCEntityHelper;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.EntityAIHurtByTarget;
|
||||
import net.minecraft.entity.ai.EntityAILeapAtTarget;
|
||||
import net.minecraft.entity.ai.EntityAIOpenDoor;
|
||||
import net.minecraft.entity.ai.EntityAIRestrictSun;
|
||||
import net.minecraft.entity.ai.EntityAITasks;
|
||||
import net.minecraft.entity.ai.*;
|
||||
import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.boss.IBossDisplayData;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityBlaze;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.passive.EntityBat;
|
||||
@@ -43,6 +38,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.pathfinding.PathNavigate;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@@ -74,31 +70,11 @@ import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.NpcDamageSource;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.VersionCompatibility;
|
||||
import noppes.npcs.ai.EntityAIAmbushTarget;
|
||||
import noppes.npcs.ai.EntityAIAnimation;
|
||||
import noppes.npcs.ai.EntityAIAttackTarget;
|
||||
import noppes.npcs.ai.EntityAIAvoidTarget;
|
||||
import noppes.npcs.ai.EntityAIBustDoor;
|
||||
import noppes.npcs.ai.EntityAIDodgeShoot;
|
||||
import noppes.npcs.ai.EntityAIFindShade;
|
||||
import noppes.npcs.ai.EntityAIFollow;
|
||||
import noppes.npcs.ai.EntityAIJob;
|
||||
import noppes.npcs.ai.EntityAILook;
|
||||
import noppes.npcs.ai.*;
|
||||
import noppes.npcs.ai.EntityAIMoveIndoors;
|
||||
import noppes.npcs.ai.EntityAIMovingPath;
|
||||
import noppes.npcs.ai.EntityAIOrbitTarget;
|
||||
import noppes.npcs.ai.EntityAIPanic;
|
||||
import noppes.npcs.ai.EntityAIRangedAttack;
|
||||
import noppes.npcs.ai.EntityAIReturn;
|
||||
import noppes.npcs.ai.EntityAIRole;
|
||||
import noppes.npcs.ai.EntityAISprintToTarget;
|
||||
import noppes.npcs.ai.EntityAIStalkTarget;
|
||||
import noppes.npcs.ai.EntityAITransform;
|
||||
import noppes.npcs.ai.EntityAIWander;
|
||||
import noppes.npcs.ai.EntityAIWatchClosest;
|
||||
import noppes.npcs.ai.EntityAIWaterNav;
|
||||
import noppes.npcs.ai.EntityAIWorldLines;
|
||||
import noppes.npcs.ai.EntityAIZigZagTarget;
|
||||
import noppes.npcs.ai.selector.NPCAttackSelector;
|
||||
import noppes.npcs.ai.target.EntityAIClearTarget;
|
||||
import noppes.npcs.ai.target.EntityAIClosestTarget;
|
||||
@@ -186,6 +162,10 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
public boolean updateClient = false;
|
||||
public boolean updateAI = false;
|
||||
|
||||
// Fly Change
|
||||
protected EntityMoveHelper moveHelper;
|
||||
protected PathNavigate navigator;
|
||||
|
||||
public EntityNPCInterface(World world) {
|
||||
super(world);
|
||||
try{
|
||||
@@ -612,7 +592,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
if (worldObj == null || worldObj.isRemote)
|
||||
return;
|
||||
aiLeap = aiAttackTarget = aiResponse = aiSprint = aiRange = null;
|
||||
|
||||
|
||||
clearTasks(tasks);
|
||||
clearTasks(targetTasks);
|
||||
IEntitySelector attackEntitySelector = new NPCAttackSelector(this);
|
||||
@@ -621,8 +601,18 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
this.targetTasks.addTask(2, new EntityAIClosestTarget(this, EntityLivingBase.class, 4, this.ai.directLOS, false, attackEntitySelector));
|
||||
this.targetTasks.addTask(3, new EntityAIOwnerHurtByTarget(this));
|
||||
this.targetTasks.addTask(4, new EntityAIOwnerHurtTarget(this));
|
||||
|
||||
this.tasks.addTask(0, new EntityAIWaterNav(this));
|
||||
|
||||
|
||||
if(canFly()){
|
||||
this.moveHelper = new FlyingMoveHelper(this);
|
||||
this.navigator = new PathNavigateFlying(this, worldObj);
|
||||
}
|
||||
else{
|
||||
this.moveHelper = new EntityMoveHelper(this);
|
||||
this.navigator = new PathNavigateGround(this, worldObj);
|
||||
this.tasks.addTask(0, new EntityAIWaterNav(this));
|
||||
}
|
||||
// this.tasks.addTask(0, new EntityAIWaterNav(this));
|
||||
this.taskCount = 1;
|
||||
this.doorInteractType();
|
||||
this.seekShelter();
|
||||
@@ -709,7 +699,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
/*
|
||||
* Branch task function for adjusting NPC door interactivity
|
||||
*/
|
||||
public void doorInteractType(){
|
||||
public void doorInteractType(){
|
||||
if(canFly()) //currently flying does not support opening doors
|
||||
return;
|
||||
EntityAIBase aiDoor = null;
|
||||
if (this.ai.doorInteract == 1)
|
||||
{
|
||||
@@ -732,7 +724,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
}
|
||||
else if (this.ai.findShelter == 1)
|
||||
{
|
||||
this.tasks.addTask(this.taskCount++, new EntityAIRestrictSun(this));
|
||||
if(!canFly()) // doesnt work when flying
|
||||
this.tasks.addTask(this.taskCount++, new EntityAIRestrictSun(this));
|
||||
this.tasks.addTask(this.taskCount++, new EntityAIFindShade(this));
|
||||
}
|
||||
}
|
||||
@@ -1574,7 +1567,11 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
public boolean canBeCollidedWith(){
|
||||
return !isKilled();
|
||||
}
|
||||
|
||||
|
||||
public boolean canFly(){
|
||||
return false;
|
||||
}
|
||||
|
||||
public EntityAIRangedAttack getRangedTask(){
|
||||
return this.aiRange;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user