mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 03:49:10 +00:00
Fixed concurrent modification bug with NPC tasks.
This commit is contained in:
1 parent
7de585843d
commit
1af875aea9
3 files changed
+8
-3
No files matched your search
@@ -141,7 +141,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
}
|
||||
else if (button.id == 17) {
|
||||
ai.tacticalVariant = EnumNavType.values()[button.getValue()];
|
||||
ai.directLOS = EnumNavType.values()[button.getValue()] == EnumNavType.Stalk ? false : this.ai.directLOS;
|
||||
ai.directLOS = EnumNavType.values()[button.getValue()] != EnumNavType.Stalk && this.ai.directLOS;
|
||||
initGui();
|
||||
}
|
||||
else if (button.id == 22) {
|
||||
|
||||
@@ -434,7 +434,11 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
|
||||
protected void updateAITasks()
|
||||
{
|
||||
super.updateAITasks();
|
||||
try {
|
||||
super.updateAITasks();
|
||||
} catch (ConcurrentModificationException ignored){
|
||||
}
|
||||
|
||||
this.getNavigator().onUpdateNavigation();
|
||||
this.getMoveHelper().onUpdateMoveHelper();
|
||||
}
|
||||
|
||||
@@ -613,10 +613,11 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
}
|
||||
|
||||
public void setTacticalVariant(int variant){
|
||||
if(variant > EnumNavType.values().length-1)
|
||||
if(variant > EnumNavType.values().length-1 || variant < 0)
|
||||
return;
|
||||
|
||||
npc.ai.tacticalVariant = EnumNavType.values()[variant];
|
||||
npc.ai.directLOS = EnumNavType.values()[variant] != EnumNavType.Stalk && npc.ai.directLOS;
|
||||
}
|
||||
|
||||
public int getTacticalVariant(){
|
||||
|
||||
Reference in new issue
Block a user