mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 23:39:50 +00:00
Added Flying Code / Corrected Hidden Parts not Saving
Added a ton of code regarding Flying doesn't work correctly. Please Uncomment them by searching for Comment: // Fly Change Fixed Hidden Parts not Saving
This commit is contained in:
1 parent
7e7aaa805b
commit
3727d1af7a
18 files changed
+1365
-101
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package noppes.npcs.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityFlying;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
@@ -9,9 +10,12 @@ import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
|
||||
public class EntityCustomNpc extends EntityNPCInterface{
|
||||
// FLY CHANGE
|
||||
// extends EntityNPCInterface
|
||||
// extends EntityNPCFlying
|
||||
public class EntityCustomNpc extends EntityNPCFlying {
|
||||
public ModelData modelData = new ModelData();
|
||||
|
||||
|
||||
public EntityCustomNpc(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@@ -18,82 +18,82 @@ public abstract class EntityNPCFlying extends EntityNPCInterface {
|
||||
|
||||
// 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;
|
||||
// }
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,30 +3,20 @@ package noppes.npcs.entity;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
import net.minecraft.entity.DataWatcher;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EnumCreatureAttribute;
|
||||
import net.minecraft.entity.IRangedAttackMob;
|
||||
import net.minecraft.entity.NPCEntityHelper;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.*;
|
||||
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;
|
||||
@@ -51,7 +41,6 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.ServerChatEvent;
|
||||
@@ -65,7 +54,6 @@ import noppes.npcs.DataScript;
|
||||
import noppes.npcs.DataStats;
|
||||
import noppes.npcs.IChatMessages;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.NpcDamageSource;
|
||||
import noppes.npcs.Server;
|
||||
@@ -75,6 +63,9 @@ import noppes.npcs.ai.EntityAIMoveIndoors;
|
||||
import noppes.npcs.ai.EntityAIPanic;
|
||||
import noppes.npcs.ai.EntityAIWander;
|
||||
import noppes.npcs.ai.EntityAIWatchClosest;
|
||||
import noppes.npcs.ai.pathfinder.FlyingMoveHelper;
|
||||
import noppes.npcs.ai.pathfinder.PathNavigateFlying;
|
||||
import noppes.npcs.ai.pathfinder.PathNavigateGround;
|
||||
import noppes.npcs.ai.selector.NPCAttackSelector;
|
||||
import noppes.npcs.ai.target.EntityAIClearTarget;
|
||||
import noppes.npcs.ai.target.EntityAIClosestTarget;
|
||||
@@ -100,7 +91,6 @@ import noppes.npcs.controllers.LinkedNpcController.LinkedData;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.PlayerQuestData;
|
||||
import noppes.npcs.controllers.QuestData;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.TransformData;
|
||||
import noppes.npcs.roles.JobBard;
|
||||
import noppes.npcs.roles.JobFollower;
|
||||
@@ -162,9 +152,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
public boolean updateClient = false;
|
||||
public boolean updateAI = false;
|
||||
|
||||
// Fly Change
|
||||
// protected EntityMoveHelper moveHelper;
|
||||
// protected PathNavigate navigator;
|
||||
// Fly Change
|
||||
// public EntityMoveHelper moveHelper;
|
||||
// public PathNavigate navigator;
|
||||
|
||||
public EntityNPCInterface(World world) {
|
||||
super(world);
|
||||
@@ -602,6 +592,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
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);
|
||||
@@ -610,9 +601,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
// 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.tasks.addTask(0, new EntityAIWaterNav(this));
|
||||
|
||||
this.taskCount = 1;
|
||||
this.doorInteractType();
|
||||
this.seekShelter();
|
||||
|
||||
Reference in new issue
Block a user