knockback() function for ScriptEntity now *only* knocks the entity back instead of hitting it.

Flying NPC's get knocked back properly, and their vertical speed has been increased.

Flying NPC's vertical flying speed can be changed by npc.setFlySpeed(double speed) from ScriptNpc.
This commit is contained in:
luisc committed 2021-12-06 00:10:10 -06:00
1 parent 3cd1410c19
commit 12333de3a1
9 files changed
+62 -40

No files matched your search

+10 -2
View File
@@ -35,6 +35,7 @@ public class DataAI {
// Fly Change
public int movementType = 0;
public double flySpeed = 1.0D;
public EnumAnimation animationType = EnumAnimation.NONE;
public EnumStandingType standingType = EnumStandingType.RotateBody;
@@ -96,8 +97,13 @@ public class DataAI {
setMovingPath(NBTTags.getIntegerArraySet(compound.getTagList("MovingPathNew",10)));
movingPos = compound.getInteger("MovingPos");
movingPattern = compound.getInteger("MovingPatern");
movementType = compound.getInteger("MovingType");
if(!compound.hasKey("FlySpeed"))
flySpeed = 1.0D;
else
flySpeed = compound.getDouble("FlySpeed");
startPos = compound.getIntArray("StartPosNew");
if (startPos == null || startPos.length != 3){
startPos = new int[] {
@@ -143,8 +149,10 @@ public class DataAI {
compound.setTag("MovingPathNew", NBTTags.nbtIntegerArraySet(movingPath));
compound.setInteger("MovingPos", movingPos);
compound.setInteger("MovingPatern", movingPattern);
compound.setInteger("MovingType", movementType);
compound.setDouble("FlySpeed",flySpeed);
npc.setAvoidWater(avoidsWater);
compound.setIntArray("StartPosNew", npc.getStartPos());