Commit Graph
41 Commits
Author SHA1 Message Date
Kam 6dce4e5cdc Revert "Smoother + Most-Cost Effective Flight Pathing"
This reverts commit a79ba3a0e4.
2026-02-24 22:28:57 -05:00
Kam a79ba3a0e4 Smoother + Most-Cost Effective Flight Pathing 2026-02-23 04:38:02 -05:00
Kam 180d257024 Proper Reformating 2025-03-13 17:14:45 -04:00
KAMKEEL bda76bafe6 Optimize Imports 2023-01-12 21:33:06 -05:00
Luis C.M 51b412a0bf Pathing improvements.
EntityAIReturn:
-Fixed NPC still creating a new path when close to the NPC's home.

EntityNPCInterface:
-Fixed flying NPCs having their home Y position dip into the ground.
-NPCs update their move helpers and navigators when they can't breathe.

FlyingMoveHelper:
-Reduced calls to Math.atan2 (very expensive operation to be unnecessarily calling every tick)

FlyPathFinder:
-Water opens an OPEN path point iff the NPC can swim, not iff the NPC's drowning type != 1.

NPCPath:
-Made PathPoint occurrences use NPCPathPoint

PathNavigateFlying:
-A slightly larger area of blocks with respect to width is checked om rayTraceBlocks(), and the function now also correctly checks for liquids.
2022-11-13 23:49:49 -06:00
Luis C.M e1c9b69335 Removed LRU hashmap, increases performance. 2022-11-12 17:43:36 -06:00
Luis C.M 52563f1cfe Reverted PathNavigateFlying. 2022-11-12 17:25:01 -06:00
Luis C.M d86f571df6 PathNavigateFlying:
-Fixed pathfinder running into lava & water when it shouldn't.
FlyPathFinder:
-Simplified nodeTypeToOffset switch statement, removed unused function, and made air always return an open path node type.
EntityNPCInterface:
-Fixed "In Air" drowning type. Breathes underwater now.
EntityNPCFlying:
-Fixed NPCs still using flight movement when not being able to breathe.
ICustomNpc:
-Added canBreathe() function
2022-11-12 15:53:20 -06:00
Luis C.M aa4b1dd9fb PathNavigateFlying:
-Significantly improved flight performance using an LRUHashMap.
2022-11-12 12:09:22 -06:00
Luis C.M c3a0298902 Improved performance of isDirectPathBetweenPoints. 2022-11-11 03:16:56 -06:00
Luis C.M 3f58ef029c Improved isDirectPathBetweenPoints detection in flight pathing, still need to optimize. 2022-11-11 02:17:54 -06:00
Luis C.M a69468322e Added new isDirectPathBetweenPoints function with severely increased performance. 2022-11-10 20:19:36 -06:00
Luis C.M 554bcac4d3 Fixed flying pathfinding not being able to go above/below walls in the air 2022-11-10 00:47:40 -06:00
KAMKEEL 45c43a399b Clean and Refactor Fly Code 2022-11-07 21:23:33 -05:00
KAMKEEL 054f4d85ee Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2022-11-07 15:40:11 -05:00
KAMKEEL 5ac230ee52 Fix this.NoPath Null Check 2022-11-07 15:40:07 -05:00
Luis C.M 4674f59ae1 Fly pathing size compatibility fix 2022-11-07 14:28:41 -06:00
KAMKEEL eb9efce68c Update PathNavigateFlying.java 2022-11-07 15:08:39 -05:00
Luis C.M 219d0f1802 Fixed strange flight behavior in flying NPCs with sizes below 5. 2022-11-07 13:32:31 -06:00
Luis C.M cc42f1f141 PathNavigateFlying:
-Flying fix. :)
2022-11-07 06:46:38 -06:00
KAMKEEL 33d7b73cb1 Fix Fly Remote Reset 2022-11-07 01:39:47 -05:00
KAMKEEL 291065024a Revert "Revert "CostMalus != 0 :D""
This reverts commit 8aef214c88.
2022-11-07 01:08:53 -05:00
KAMKEEL 8aef214c88 Revert "CostMalus != 0 :D"
This reverts commit f564a388ad.
2022-11-07 00:57:14 -05:00
KAMKEEL f564a388ad CostMalus != 0 :D 2022-11-07 00:08:27 -05:00
KAMKEEL d9af49fa4a Improve Flying Overhaul
-- Renamed Files to for more universal names
- Refactored Function Inputs

PathNavigateFlying
---- REMOVED pathCooldown/maxCooldown
+ Added updatePath() to calculate IF the current PATH is making progress and IF not should update. If distance to target is SHORTENING, no additional calculation needed
+ Improved getPathToXYZ -- if Current Path was REMOVED during updatePath then find a new path
+ Improved getPathToEntityLiving-- if Current Path was REMOVED during updatePath then find a new path
+ Added tryUpdatePath as a manual/timed update if Navigation is OLD
+ Added CHECKforSTUCK function to correct if NPC gets stuck WHILE pathing (Fixes more issues) -- There is a new Timeout Variable that if the NPC gets stuck for TOO long that PATHING should be removed and reattemped. If reattempted multiple times the NPC will TIMEOUT timer will continue to increase in threshold to severely reduce lag
+ Upgraded isDirectPathBetweenPoints from 1.12 better calculation method

FlyPathFinder
+ Added getPathPriority() to getStart() for lag reduction
+ Added PATH break; if infinite loop is created during addToPath
+ Added distanceManhattan and costMalus to distanceToNext calculation to calculate better SHORTEST path to TARGET
+ Added CostMalus calculation into findPathOptions (Less Calculations Needed)
+ Added NPCPathPoint Cost Usage

NPCPath
+ getCurrentPos() -- Returns current VEC3 of Index and Path
-- Renamed from FlyPathEntity

NPCPathPoint
+ DistanceFromOrigin to keep track of distance calculated from origin
+ Added Cost to keep track of CostMalus + Manhattan Calculation
-- Renamed from FlyPathPoint

PathHeap
-- Renamed from FlyPath
2022-11-06 22:01:48 -05:00
KAMKEEL 39a2e2f991 Merge Initial Fly 2022-11-05 04:41:08 -04:00
KAMKEEL ad8cd35083 Kam is a Legend 2022-11-05 03:35:55 -04:00
Luis C.M 4bad48352c NPCs no longer constantly pathfind when set to return to their home, and already there.
Flying NPCs:
-Pathfinding has a cooldown to decrease the amount of times they create a new path.
-Fly height limit implemented using getTopSolidOrLiquidBlock instead of iterating through blocks below the NPC.
2022-11-04 23:56:09 -05:00
c0508383 502cde0068 Reverted distance check for clearing path entity. 2022-08-27 23:51:14 -05:00
c0508383 907126cd79 Possible fix for flying NPC lag. 2022-08-27 23:48:07 -05:00
Luis C.M 1f79b52176 More fixes for flight pathing 2022-05-15 01:21:06 -05:00
Luis C.M 44459a23a7 More fixes to flight pathing:
PathNavigateFlying:
Flight pathing checks if it's stuck every 10 ticks now, and clears the path to be able to path again if so.

FlyPathFinder:
If a point on the path is air, the path finder checks if the NPC will run into any blocks above that point due to its height.
2022-05-14 01:52:20 -05:00
Luis C.M f9f73a75d2 More fixes to flight pathing. 2022-05-14 01:15:54 -05:00
Luis C.M 115b66d0c6 NPC flight fixes and a minor change to the createIItemStack function. 2022-05-13 23:14:55 -05:00
Luis C.M 85a1892c71 Changes to NPC flight:
-Improved flight pathing greatly, MUCH MUCH smoother now.
-The "flying speed" of an NPC now correctly speeds up how fast the NPC climbs vertically while flying
-NPCs now properly return to start while flying
2022-05-04 03:06:40 -05:00
luisc 33e884c217 Flying is now smoother, NPCs can pathfind downwards easier while flying. 2022-02-18 03:34:20 -06:00
luisc 73db2da124 Fixed flying not working in small enclosed spaces. 2022-01-03 15:50:31 -06:00
luisc 2147bd00d0 Pathing classes for NPC flying added. NPCs can now follow tactical variants while flying, and their pathing is a LOT better. 2021-12-08 04:00:28 -06:00
luisc 43b3241801 Implemented path navigator and move helper for flying NPCs (npc.getNavigator() and npc.getMoveHelper() used to return the default navigator and move helper, added override function).
Improved Flying AI getting stuck when trying to get over a block towards the enemy.
2021-12-07 03:57:57 -06:00
luisc 12333de3a1 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.
2021-12-06 00:10:10 -06:00
KAMKEEL 3727d1af7a 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
2021-07-10 00:48:03 -04:00