mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 01:27:27 +00:00
Add two types of Leaps -- Jump and Pounce
This commit is contained in:
1 parent
ebffc0e80e
commit
509d32bfc1
4 files changed
+17
-9
No files matched your search
@@ -26,7 +26,7 @@ public class DataAI {
|
||||
public boolean avoidsSun = false;
|
||||
public boolean returnToStart = true;
|
||||
public boolean directLOS = true;
|
||||
public boolean canLeap = false;
|
||||
public int leapType = 0;
|
||||
public boolean canSprint = false;
|
||||
public boolean stopAndInteract = true;
|
||||
public EnumNavType tacticalVariant = EnumNavType.Default;
|
||||
@@ -72,7 +72,7 @@ public class DataAI {
|
||||
doorInteract = compound.getInteger("DoorInteract");
|
||||
findShelter = compound.getInteger("FindShelter");
|
||||
directLOS = compound.getBoolean("DirectLOS");
|
||||
canLeap = compound.getBoolean("CanLeap");
|
||||
leapType = compound.getInteger("LeapType");
|
||||
canSprint = compound.getBoolean("CanSprint");
|
||||
canFireIndirect = compound.getInteger("FireIndirect");
|
||||
useRangeMelee = compound.getInteger("RangeAndMelee");
|
||||
@@ -140,7 +140,7 @@ public class DataAI {
|
||||
compound.setInteger("DoorInteract", doorInteract);
|
||||
compound.setInteger("FindShelter", findShelter);
|
||||
compound.setBoolean("DirectLOS", directLOS);
|
||||
compound.setBoolean("CanLeap", canLeap);
|
||||
compound.setInteger("LeapType", leapType);
|
||||
compound.setBoolean("CanSprint", canSprint);
|
||||
compound.setInteger("FireIndirect", canFireIndirect);
|
||||
compound.setInteger("RangeAndMelee", useRangeMelee);
|
||||
|
||||
@@ -13,11 +13,17 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class VersionCompatibility {
|
||||
public static int ModRev = 21;
|
||||
public static int ModRev = 22;
|
||||
|
||||
public static void CheckNpcCompatibility(EntityNPCInterface npc, NBTTagCompound compound){
|
||||
if(npc.npcVersion == ModRev)
|
||||
return;
|
||||
if(npc.npcVersion < 22) {
|
||||
if (compound.hasKey("CanLeap")) {
|
||||
boolean canLeap = compound.getBoolean("CanLeap");
|
||||
compound.setInteger("LeapType", !canLeap ? 0 : 1);
|
||||
}
|
||||
}
|
||||
if(npc.npcVersion < 19) {
|
||||
if (compound.hasKey("CanDrown")) {
|
||||
compound.setInteger("DrowningType", (compound.getBoolean("CanDrown") ? 1 : 0));
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
addLabel(new GuiNpcLabel(11,"ai.return", guiLeft + 150, guiTop + 40));
|
||||
addButton(new GuiNpcButton(6, guiLeft + 230, guiTop + 35, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ai.returnToStart ? 1:0));
|
||||
addLabel(new GuiNpcLabel(17,"ai.leapattarget", guiLeft + 150, guiTop + 65));
|
||||
addButton(new GuiNpcButton(15,guiLeft + 230, guiTop + 60, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.canLeap ? 1:0));
|
||||
addButton(new GuiNpcButton(15,guiLeft + 230, guiTop + 60, 60, 20, new String[]{"gui.no", "ai.jump", "ai.pounce"} ,npc.ai.leapType));
|
||||
addLabel(new GuiNpcLabel(15, "ai.indirect", guiLeft + 150, guiTop + 90));
|
||||
addButton(new GuiNpcButton(13, guiLeft + 230, guiTop + 85, 60, 20, new String[]{"gui.no", "gui.whendistant", "gui.whenhidden"}, ai.canFireIndirect));
|
||||
addLabel(new GuiNpcLabel(16, "ai.rangemelee", guiLeft + 150, guiTop + 115));
|
||||
@@ -129,7 +129,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
initGui();
|
||||
}
|
||||
else if (button.id == 15) {
|
||||
ai.canLeap = (button.getValue() == 1);
|
||||
ai.leapType = (byte) button.getValue();
|
||||
}
|
||||
else if (button.id == 16) {
|
||||
ai.canSprint = (button.getValue() == 1);
|
||||
|
||||
@@ -680,7 +680,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
}
|
||||
|
||||
else if (this.ai.onAttack == 0) {
|
||||
this.setCanLeap();
|
||||
this.setLeapTask();
|
||||
if (this.inventory.getProjectile() == null || this.ai.useRangeMelee == 2)
|
||||
{
|
||||
System.out.println("checking this stuff");
|
||||
@@ -767,8 +767,10 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
/*
|
||||
* Branch task function for leaping
|
||||
*/
|
||||
public void setCanLeap() {
|
||||
if (this.ai.canLeap)
|
||||
public void setLeapTask() {
|
||||
if (this.ai.leapType == 1)
|
||||
this.tasks.addTask(this.taskCount++, aiLeap = new EntityAILeapAtTarget(this, 0.4F));
|
||||
if (this.ai.leapType == 2)
|
||||
this.tasks.addTask(this.taskCount++, aiLeap = new EntityAIPounceTarget(this));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user