Compare commits

..
Author SHA1 Message Date
Vidal 1ab1dd1e16 Merge remote-tracking branch 'origin/dev' into new-abilities 2026-03-15 19:58:18 -03:00
Kam f6e7809a29 Fix Auction House ID Saving 2026-03-15 18:23:14 -04:00
Kam 85ef28ca76 Fix DataScript Issue Global API Objects 2026-03-15 18:03:17 -04:00
Kam f4062f3edd Fix Script Container Issue 2026-03-15 14:43:07 -04:00
Vidal 7c4159dcd2 Merge remote-tracking branch 'origin/dev' into new-abilities 2026-03-15 15:01:17 -03:00
Vidal c2c6079b43 added native target id 2026-03-15 13:39:05 -03:00
Vidal fb3a392f2e Merge remote-tracking branch 'origin/dev' into new-abilities 2026-03-15 01:51:22 -03:00
Vidal 956d2e27be yet more pillar fixes 2026-03-15 01:50:52 -03:00
Kam 92133afe75 Fix issue with Finish Quest API 2026-03-15 00:09:56 -04:00
Vidal 9546500b4b more pillar changes and fixes 2026-03-14 22:30:01 -03:00
Vidal a2beef0549 numerous fixes to pillars (now they work!) 2026-03-14 20:22:57 -03:00
Vidal 0222a4984e pillar ability 2026-03-14 19:16:30 -03:00
Vidal d4a89dad1d pillar entity 2026-03-14 19:16:22 -03:00
Vidal ca7f3f937b changed charging-related classes to support EntityEnergyAbility instead of EntityEnergyProjectile 2026-03-14 13:46:36 -03:00
Vidal b989a89889 AbilityDefend event 2026-03-13 20:48:25 -03:00
Kam edf5ff7c73 Chained Ability Cooldown on NPCs 2026-03-13 18:54:18 -04:00
Kam ab60fdbd12 Fix Chained Ability Icons + Chained Ability Per Cooldown Config Options 2026-03-13 18:52:17 -04:00
Kam ac953685c8 Mob Spawner / Job Spawner Selection Fixes for Folder Support 2026-03-13 18:43:53 -04:00
bigguy345 a59d2d0088 IMPORTANT PROFILER 2026-03-14 00:14:29 +02:00
bigguy345 9c82fabf1b DAWG EASIEST 3X OPTIMISATION OF MY LIFE 2026-03-13 23:36:59 +02:00
Kam 16f0022505 1.11.1 2026-03-13 17:20:12 -04:00
bigguy345 956410c345 feat: implement IntelliJ-style weigher chain for autocomplete ranking
- Add 8 independent weigher classes (MatchQuality, MemberKind, ContextFit, UsageFrequency, ImportStatus, Deprecated, InheritanceDepth, Alphabetical)
- Replace fragile penalty-based scoring with composable weigher chain architecture
- Expand MemberKind to 11 tiers: enum_const > local > instance_field > instance_method > type_class > type_enum > type_interface > static_field > static_method > keyword > snippet
- Reorder weighers for optimal UX: imported always ranks above unimported regardless of usage
- Fix unimported class penalty bug (was being overwritten by calculateMatchScore)
- Implement DeprecatedWeigher (deprecated flag now scored)
- Mark addScoreBoost() @Deprecated in favor of weigher chain
- Add getInheritanceDepth() getter to AutocompleteItem
- Update JSAutocompleteProvider to use 8-weigher chain with InheritanceDepthWeigher
- Comprehensive test coverage: 127+ test methods across weigher unit tests and integration tests
- Matches IntelliJ IDEA's weigher chain pattern (battle-tested production architecture)
2026-03-13 23:00:46 +02:00
bigguy345 81b3d1c2d3 Fixed autocomplete item package color for interfaces/enums 2026-03-13 20:47:54 +02:00
bigguy345 f25b9164d0 Added parameter autocomplete coloring 2026-03-13 20:01:10 +02:00
bigguy345 c0a022c5b5 Tightened excluded range checks in receiver chain resolution (fixes stupid . in comments fkin up next line bug) 2026-03-13 19:49:30 +02:00
bigguy345 ce8c9b3b94 oh shit 2026-03-13 19:40:06 +02:00
bigguy345 b6e3ee8404 Umm one is enough 2026-03-13 18:34:09 +02:00
bigguy345 85d4bb2628 man get this old washed shit outta my face 2026-03-13 18:33:27 +02:00
bigguy345 82128ce318 Proper Hover Info data for generic classes with type params 2026-03-13 18:33:03 +02:00
bigguy345 390b3446a3 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified
# Conflicts:
#	src/main/java/noppes/npcs/client/gui/util/script/interpreter/type/TypeInfo.java
2026-03-13 18:30:09 +02:00
bigguy345 f66d2f0193 GenericContext overhaul, removed redundant TypeSubstitutor 2026-03-13 18:29:06 +02:00
bigguy345 53446e06c6 unified TypeInfo API access to it uses exposed TypeInfo members instead of inner raw Class reflection calls 2026-03-13 18:20:44 +02:00
bigguy345 691a7fb2c7 unified TypeInfo API access to it uses exposed TypeInfo members instead of inner raw Class reflection calls 2026-03-13 17:47:29 +02:00
Kam 57e6934fe5 Merge branch 'dev' into syntax-highlighter-unified 2026-03-13 03:13:24 -04:00
bigguy345 335ffdd074 editor color scheme improvements 2026-03-13 06:41:22 +02:00
bigguy345 0906378894 JANINO FIXES 2026-03-13 06:21:07 +02:00
bigguy345 7282081832 Fixed x undefined when
//comment.
x = 10;
2026-03-13 06:06:00 +02:00
bigguy345 a3c7398628 Whole buncha ergonomic hover info tweaks 2026-03-13 05:52:41 +02:00
bigguy345 07594f574b Fixed autocomplete showing in comments 2026-03-13 04:56:07 +02:00
bigguy345 3b7798338f Proper TypeInfo.typeParam overload that is much needed + IntersectionTypeInfo for type parameter <T extends X & Interface1 & Interface2<T>> 2026-03-13 03:53:05 +02:00
bigguy345 eae5a08932 Made TokenType priority internal 2026-03-13 03:43:39 +02:00
bigguy345 547989a6d4 Smoothened script editor scrolling again (now that we have proper fonts) 2026-03-13 03:32:27 +02:00
bigguy345 f6f19c0e48 Improved font rendering for ITALIC and BOLD to remove glyph artifacts 2026-03-13 03:26:06 +02:00
bigguy345 f8a7241747 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-13 03:24:46 +02:00
bigguy345 4ccec31efa Removed MODIFIER, IMPORT_KEYWORD and CLASS_IMPORT token types, all replaced with KEYWORD 2026-03-13 03:22:46 +02:00
bigguy345 b7c3c53dc9 Fixed ScriptColorScheme not respecting resourcepack priority 2026-03-13 03:03:39 +02:00
bigguy345 f1f3b17402 Correctly calculated new font width throughout script editor endpoints (for italics/bold) 2026-03-13 03:00:54 +02:00
bigguy345 254655cb1d Improved <> formatting and auto insertion 2026-03-13 02:46:16 +02:00
Kam a212822d45 Merge remote-tracking branch 'origin/dev' into dev 2026-03-12 20:33:50 -04:00
Kam 26ae7adac5 Fix Sound Selection 2026-03-12 20:33:43 -04:00
Kam c797fbec80 Fix Base Directory for Category Manager System for NEW WORLDs 2026-03-12 20:29:05 -04:00
Kam 17c48fab97 Merge branch 'dev' into syntax-highlighter-unified 2026-03-12 16:20:53 -04:00
bigguy345 bcd60d80ea Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified
# Conflicts:
#	src/main/java/noppes/npcs/config/GlyphCache.java
2026-03-12 21:49:50 +02:00
bigguy345 71f0ee1973 FONT SO PRETTY IT GOT ME ACTING FONTOSEXUAL 2026-03-12 21:48:16 +02:00
Kam 8119515705 Add Script Optimizations / Caching 2026-03-12 15:47:56 -04:00
bigguy345 28d7b02350 OMG BEST FONT RENDERING EVER FUUUUCK 2026-03-12 17:26:26 +02:00
bigguy345 be4aa2592a MASSIVE FONT RENDERING FIX, HUGE HUGE HUGE 2026-03-12 10:39:02 +02:00
bigguy345 4b9f2e3b47 MASSIVE FONT RENDERING FIX, HUGE HUGE HUGE 2026-03-12 08:54:50 +02:00
bigguy345 05c27c5d20 Added cursor caret color to editor color scheme 2026-03-12 06:57:38 +02:00
somehussar 6f2288c81f Simplify this. Issue was with wrongly packaged ZIPs 2026-03-12 04:58:45 +01:00
bigguy345 88d496137a SCRIPT EDITOR COLOR SCHEMES (W.I.P 2026-03-12 04:53:27 +02:00
Kam b231f65bfb Profile Sync Quest Data Crash Fix 2026-03-11 21:57:56 -04:00
Kam 15749c8ad7 Profile Sync Quest Data Crash Fix 2026-03-11 21:42:27 -04:00
Kam 5cf9b26a2e Add Changelog 2026-03-11 17:39:21 -04:00
Kam d5356a83ef Linked NPC Abilities + Overlays Fix 2026-03-11 17:11:57 -04:00
Kam 19d6ec7e52 1.11 Release 2026-03-11 16:04:56 -04:00
Kam 5acb371fab Uncomment + Todo for Goatee 2026-03-11 14:18:03 -04:00
Kam c6eadbd193 1.11 Final Pre-Release 2026-03-11 14:09:43 -04:00
Kam f18ae4e08f Merge branch 'dev' into syntax-highlighter-unified 2026-03-11 14:08:19 -04:00
bigguy345 59ba554315 Fixed "Java" language option and editor tab language button being available for ScriptHandlers with no janino handling 2026-03-11 16:25:15 +02:00
bigguy345 9207cc3f43 Fixed paramterize() -> substitute() cyclic StackOverFlow 2026-03-11 14:41:46 +02:00
bigguy345 0af3bdfd04 Removed redundants 2026-03-11 14:39:37 +02:00
bigguy345 102c4fc398 Expanded scope of patterns/markers to handle nested generics more robustly 2026-03-11 14:38:49 +02:00
bigguy345 f53edb6e64 Parsed lambdas properly in their own path + cached their values and hooked up their AssingmentInfo errors 2026-03-11 14:35:38 +02:00
bigguy345 acaefbb68c Improved unimported autocomplete classes handling + colored gray 2026-03-11 14:08:28 +02:00
bigguy345 09cbbe75c9 More janino lambda fixes 2026-03-11 12:56:18 +02:00
Kam 81c2b860c6 rename to cnpc_animations 2026-03-11 05:39:28 -04:00
bigguy345 57128a8d8b Fixed various formatting line wrap bugs 2026-03-11 10:53:32 +02:00
Kam 6bf33e4296 Add API Registry System for API Links and Such 2026-03-11 03:55:07 -04:00
Kam 3aaf54e2c2 Fix Scaling and Defaults for HUD 2026-03-11 03:38:15 -04:00
bigguy345 28b8cda4cf Improved lambda formatting 2026-03-11 08:52:05 +02:00
bigguy345 b5cff355e6 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-11 08:39:56 +02:00
bigguy345 a00dbf4b1a Improved Loop patterns 2026-03-11 08:39:23 +02:00
bigguy345 627b973175 Split parseScriptTypes into 2 passes to properly resolve forward references to script-defined types 2026-03-11 08:38:17 +02:00
bigguy345 0db8844b4d Fixed KeyPresetManager not correctly loading default values 2026-03-11 08:19:12 +02:00
bigguy345 cd0c9640af Fixed more lambda bugs in editor and janino compiler (the scope of the lambda wasn't properly set for constructors) 2026-03-11 08:18:13 +02:00
bigguy345 c88bd50be9 ScriptTypeInfo is now properly compared to TypeInfo parents + removed parent constructor mismatch errors from interfaces 2026-03-11 08:17:23 +02:00
bigguy345 1289778874 Revamped the error framework with new DocumentErrors in TokenHoverInfo 2026-03-11 08:15:32 +02:00
Kam 00be1a45ba Upgrade README and IMAGES 2026-03-11 02:06:53 -04:00
Kam f5a8b5c601 Upgrade README and IMAGES 2026-03-11 02:06:48 -04:00
bigguy345 90c7abca5f Tightened and refined the hell out of class declaration type parameter marking logic 2026-03-11 07:29:19 +02:00
Kam ef01da4b5b Merge branch 'dev' into syntax-highlighter-unified 2026-03-11 01:02:01 -04:00
Kam f544236230 BETTER MD FILES 2026-03-11 01:00:59 -04:00
bigguy345 3a57ed57da New improved DocumentError framework (oops forgor) 2026-03-11 06:32:29 +02:00
bigguy345 13b71a6c48 New improved DocumentError framework 2026-03-11 06:31:08 +02:00
bigguy345 76fb5d04f7 FIXED 3 JANINO COMPILATION BUGS 2026-03-11 05:59:41 +02:00
Kam 60213303ae Update MD Files 2026-03-10 23:54:23 -04:00
Kam 5ef50c1682 Merge pull request #267 from zeng-github01/old-quest-data-import
Fixes lagacy quest data import
2026-03-10 23:39:36 -04:00
bigguy345 57ba3236bc Extended TypeParam parsing and marking code for class header declarations and & interface additions like <T extends Number & Comparable & Serializable) 2026-03-11 05:38:59 +02:00
Kam 5717037012 Merge pull request #262 from PeTcHeNkA/fix/issue-32-customnpc-invalid-texture-fallback
fix: add fallback skin for invalid CustomNPC texture paths#244
2026-03-10 23:38:09 -04:00
bigguy345 4ddb6d32f3 Added lambda brace auto-complete 2026-03-11 05:30:36 +02:00
Kam 60ea87bd2c Merge branch 'syntax-highlighter-unified' into dev 2026-03-10 23:23:42 -04:00
Kam a7d780565f Fix Sizing Changes Mid Firing 2026-03-10 23:01:54 -04:00
bigguy345 3b1896a696 Fixed SAM type inference for lambda arguments in constructor not applied properly 2026-03-11 04:54:27 +02:00
Kam 3859bb70cb Fix Cloning Systems 2026-03-10 22:54:02 -04:00
Kam 9d65f3d20b Merge branch 'syntax-highlighter-unified' into dev 2026-03-10 22:11:18 -04:00
bigguy345 cddd6cfe57 Fixed:
1) Nested Brace Auto-Completion
2) Backspace on Empty Lines
3) Shift+Tab Mid-Line
2026-03-11 04:09:47 +02:00
Kam 0cc3a48f0b Fix Ability Cloning Behavior for Scripts 2026-03-10 21:55:25 -04:00
Kam 9b0c364e13 Fix Ability Cloning Behavior for Scripts 2026-03-10 21:51:12 -04:00
zeng-github01 4e1b4dda58 resolve conflict 2026-03-11 09:45:38 +08:00
bigguy345 ac0bdafb16 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-11 03:38:21 +02:00
bigguy345 88d34a970c Merge branch 'refs/heads/dev' into syntax-highlighter-unified 2026-03-11 03:34:28 +02:00
zeng-github01 9a07bb36a4 Support for loading quest data from legacy CustomNPCs formats (1.6.4) 2026-03-11 09:24:13 +08:00
Kam 7b8ad7c6b5 Add Interpolation to Size of Energy Projectiles 2026-03-10 21:19:49 -04:00
bigguy345 fd4cebf692 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-11 03:12:35 +02:00
bigguy345 a37dd308a1 Turned off debug printlns 2026-03-11 03:12:23 +02:00
Kam 30885683f2 Delete standalone-JaninoLoader-1.0.1-ALPHA.jar 2026-03-10 21:08:30 -04:00
Kam 0ae167cb4f Create standalone-JaninoLoader-1.0.1-ALPHA.jar 2026-03-10 21:07:31 -04:00
Kam ec152e4171 Merge branch 'syntax-highlighter-unified' into dev 2026-03-10 21:07:17 -04:00
bigguy345 2eeb3ae398 Turned off debug printlns 2026-03-11 03:03:37 +02:00
Vidal 75b4bdfed8 getTick on EnergyProjectileTick 2026-03-10 22:01:54 -03:00
bigguy345 81d5cc25a6 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-11 02:58:59 +02:00
bigguy345 ff845325c6 BIG JANINO!! ALL TYPES OF LAMBDAS AND GENERICS ARE NOW FUNCTIONAL. 2026-03-11 02:56:17 +02:00
bigguy345 6688055434 Tightened TypeChecker logic for type args so BiConsumer<X, Y> and BiConsumer<X, Z> aren't treated as compatible 2026-03-11 02:45:58 +02:00
Kam f905e39af2 Modules + [deploy-docs] 2026-03-10 20:28:26 -04:00
Kam 58a07f2ab6 FIX SUBMODULE REFERENCE 2026-03-10 20:26:47 -04:00
bigguy345 c9d685d1ab Fixed "Map<String, BiConsumer<IPlayer, IEnergyProjectile>> "" being parsed as ", IEnergyProjectile>>" in parameter 2026-03-11 02:14:56 +02:00
Kam 63ebc409f0 1.11 and 1.2 2026-03-10 19:56:23 -04:00
Kam c631eb8e75 Change Styling 2026-03-10 19:30:46 -04:00
Kam 96074038e9 Small Styling Changes for Testing 2026-03-10 19:17:17 -04:00
Kam 8b1b40d0f9 Fix Style Sheet 2026-03-10 19:06:36 -04:00
bigguy345 486abca78b Made type params with no bounds aka just <T> fallback to java.lang.Object 2026-03-11 00:53:39 +02:00
bigguy345 2b5b4eb2d7 Proper constructor parameter handling 2026-03-11 00:47:34 +02:00
bigguy345 54ba686380 Added <> to type param hover info so its <T> 2026-03-11 00:45:03 +02:00
bigguy345 7615eda083 Proper generic array processing + showed bound type for generic on assignment errors + small constructor forgor from last commit 2026-03-10 23:57:06 +02:00
somehussar 779d9ce391 Add JDK 8 setup using Zulu distribution 2026-03-10 22:56:12 +01:00
bigguy345 db909866b8 Improved TypeInfo.equals logic + proper TypeChecker equals check (how the fuck was this NOT added before you fucking dumdum) 2026-03-10 23:56:01 +02:00
bigguy345 4de90ab9c1 oops FORGOR 2026-03-10 23:55:35 +02:00
somehussar 41193dbc0d Fix generation process for manifest 2026-03-10 22:48:26 +01:00
Kam 8d584f4e4e Submodules 2026-03-10 17:13:08 -04:00
Kam 74c79e1a5c Add Doc Support for CNPC+ and Extract into Config.JS File for easier Constants Handling 2026-03-10 17:07:20 -04:00
bigguy345 4d36e74d79 Added generic parameterization to parseMethodArguments 2026-03-10 22:53:22 +02:00
bigguy345 eef4e9a922 Type Arg class ScriptTypeInfo + TokenHoverInfo + display fixes 2026-03-10 22:14:45 +02:00
bigguy345 a88fed137a Improved TokenHoverInfo method declaration logic 2026-03-10 22:12:31 +02:00
bigguy345 62c15cceff Properly marked type parameters and outbounds (T extends Number) + new type param color and TokenType 2026-03-10 17:55:18 +02:00
bigguy345 54d8aa48fb Implement highlight and type resolution for ScriptTypeInfo parameterized java class
i.e.:
public class Box<T>{
    private T value;
    public Box(T value) { this.value = value; }
    public T get() { return value; }
}
2026-03-10 15:34:04 +02:00
bigguy345 dbc276daa7 Removed 3 deprecated methods (all were superseded by GenericContext) 2026-03-10 15:30:22 +02:00
Kam f1e4aa5b6e Merge pull request #249 from KAMKEEL/syntax-highlighter-unified
Syntax Highlighter to Janino Scripts
2026-03-10 05:51:51 -04:00
Kam 057ef7b80e Merge branch 'dev' into syntax-highlighter-unified 2026-03-10 05:50:32 -04:00
Kam d1d4155c88 Some GUI and Packet Fixes 2026-03-10 04:50:28 -04:00
Kam 270cb26460 Better Copy Handling 2026-03-10 03:47:07 -04:00
Kam 18d788974a Small Fix 2026-03-10 03:21:47 -04:00
Kam ba9ae62e51 Cloning for Scripts 2026-03-10 02:45:52 -04:00
Kam b05a028137 Fix Close on ESC Outline and Tag Select 2026-03-10 01:37:46 -04:00
Kam f4fdde4a0b Merge branch 'dev' into syntax-highlighter-unified 2026-03-09 23:56:21 -04:00
Kam 3d1a0b5418 1.11 Pre Release 3 2026-03-09 23:56:12 -04:00
Kam 5fda8a2de9 Fix Rendering / Selection 2026-03-09 23:40:56 -04:00
Kam b6b6eb5548 Fix Some Selection Logic and Such in the Fullscreen Move Systems 2026-03-09 23:03:53 -04:00
Kam 248b56ec1f Move Confirmation 2026-03-09 22:56:22 -04:00
Kam 07ebe90437 Fix Barrier Collision Logic 2026-03-09 22:56:09 -04:00
Kam b0168c1d55 Fix Some issues with Lang Setup, Button Widths, Moving System 2026-03-09 22:15:22 -04:00
Kam 676c0626d1 Fix Some Bounding Box Issues!!!!! 2026-03-09 19:56:25 -04:00
Kam b013f412b2 Six Overlays in Singleplayer 2026-03-09 19:54:29 -04:00
Kam 86638e20b0 Merge branch 'dev' into syntax-highlighter-unified 2026-03-09 17:52:25 -04:00
Kam 2dd34b21e6 Documentation to Square Telegraph 2026-03-09 17:50:46 -04:00
Vidal 3bf93a128c Merge remote-tracking branch 'origin/dev' into dev 2026-03-09 18:48:12 -03:00
Vidal 0244db1e5c Ooopsie 2026-03-09 18:47:51 -03:00
Kam d8b18d7058 Allow Null Owners in Energy 2026-03-09 17:47:13 -04:00
Vidal d4e0841f16 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified
# Conflicts:
#	src/api
2026-03-09 18:44:41 -03:00
Vidal 75fcf542a0 Square telegraph 2026-03-09 18:44:15 -03:00
Kam abf5da8b66 Merge branch 'dev' into syntax-highlighter-unified 2026-03-09 17:39:11 -04:00
Kam c423ab43f1 1.11 Pre Release 2 2026-03-09 17:38:59 -04:00
Kam 0977f7422a Renaming Scheme for Energy Handler and Energy Extender 2026-03-09 17:36:55 -04:00
Kam 5bb0d6db58 Update dependencies.gradle 2026-03-09 17:32:58 -04:00
Kam 993c9d09c3 Kill Zones on Chunk Load / World Load 2026-03-09 17:27:11 -04:00
Kam b960ef602c Add Absorbing Radius to Barriers 2026-03-09 17:26:55 -04:00
Kam 2f4ddb30ec Fix Crossing Domes at Y Level 2026-03-09 17:22:31 -04:00
Kam 029f460b75 Kill Energy Entities on Load Chunk 2026-03-09 17:07:31 -04:00
Vidal 2737b6e03b Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-09 18:06:58 -03:00
Kam 1efafeef2f Merge branch 'dev' into syntax-highlighter-unified 2026-03-09 16:22:10 -04:00
Kam f3676cd99e Update API 2026-03-09 16:20:18 -04:00
Kam 24532cea79 Merge branch 'dev' into syntax-highlighter-unified 2026-03-09 15:29:14 -04:00
Kam aae0e64988 Update dependencies.gradle 2026-03-09 15:27:44 -04:00
Kam 5700899beb Fix Job Spawner 2026-03-09 15:26:39 -04:00
Kam d2a13d0e66 Add Janino Support for Recipe, Effect and Linked Item Scripts 2026-03-09 14:28:38 -04:00
bigguy345 9368c889d7 Fixed for (Map.Entry<String, Integer> e : map.entrySet()) not being properly marked nor resolved 2026-03-09 14:05:46 +02:00
Kam bff45bd793 Save Overlays on Modification 2026-03-09 04:32:15 -04:00
bigguy345 69f9d218ca Rewrote all GuiScriptTextArea scissoring logic to handle new panning 2026-03-09 09:57:21 +02:00
bigguy345 35b9b8e66f Completely revamped FormatHelper to be token based + huge logic and performance improvements 2026-03-09 09:42:11 +02:00
bigguy345 f015eef645 Handled inner classes i.e. Outer.Inner.Innermost 2026-03-09 09:41:18 +02:00
bigguy345 18c15b13bc GuiScriptInterface is now pannable! Core functionality added to GuiNPCInterface, which means technically any child of that can be pannable 2026-03-09 09:13:29 +02:00
bigguy345 45cda3cc90 Merge branch 'dev' into syntax-highlighter-unified 2026-03-09 07:37:50 +02:00
Vidal d90fd568a6 Merge remote-tracking branch 'origin/dev' into syntax-highlighter-unified 2026-03-09 02:24:21 -03:00
Kam 7712b21faa Fix Instance Scripts 2026-03-09 01:21:39 -04:00
Kam 42e27a873b Update ConfigClient.java 2026-03-09 01:04:35 -04:00
Vidal 3276bf9cd3 Merge remote-tracking branch 'origin/dev' into syntax-highlighter-unified 2026-03-09 01:54:59 -03:00
Kam 8e29350f12 Add Proximity Based Alpha Handling for Energy Projectiles 2026-03-09 00:50:42 -04:00
bigguy345 7f4f672d81 Fixed formatter adding spaces between operators i.e >= becomes > = #2 FAAAH 2026-03-09 06:34:01 +02:00
bigguy345 40cac999c4 Merge branch 'dev' into syntax-highlighter-unified 2026-03-09 06:22:28 +02:00
bigguy345 89fdddfd75 Fixed formatter adding spaces between operators i.e >= becomes > = 2026-03-09 06:21:52 +02:00
bigguy345 96372c05fd Fixed method call args being marked as duplicate declarations 2026-03-09 06:21:24 +02:00
bigguy345 965267a770 Fixed keywords being marked as method calls/declarations 2026-03-09 05:45:33 +02:00
Kam bc448c2af2 Fix Movement Blocking within Domes 2026-03-08 23:31:58 -04:00
bigguy345 089c6d25bc Fixed Java method calls of ScriptType members i.e. getYaw() of AbilityLine without 'this.' or object 'abilityLine.' not highlighting nor resolving properly 2026-03-09 05:24:50 +02:00
Kam 992066d19b Small Set Speed Fix 2026-03-08 23:10:42 -04:00
bigguy345 58d9bafe7a HoverInfo Padding adjustments for markdown code blocks 2026-03-09 04:51:30 +02:00
Kam 182f7d8c9c Added Scripting Projectile and Barrier Syncing 2026-03-08 22:49:34 -04:00
bigguy345 e1afe9afb2 Properly highlighted ClassTypeInfo constructor calls
i.e var IntArray = Java.type("int[]");
    var array = new IntArray() // this
2026-03-09 03:47:04 +02:00
bigguy345 44dfec6283 Single line multi var decalartion support i.e var x = 10, y = "faah", z = player; OR int x,y,z; 2026-03-09 03:00:42 +02:00
bigguy345 8b00733ddf syntheticMethods Autocomplete logic needed for ObjectLiterals and InnerCallableScopes proper functioning 2026-03-09 02:47:11 +02:00
bigguy345 70510cf224 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-09 02:31:59 +02:00
Kam 06dc722aca Merge branch 'dev' into syntax-highlighter-unified 2026-03-08 20:10:51 -04:00
Kam ed176cfaf5 1.11 Pre Release 1 2026-03-08 20:10:45 -04:00
Kam 27ea836f71 Better Texture Browsing for Ability Icons 2026-03-08 20:09:33 -04:00
Kam e57fab9160 Mixin Entity Packet Loss Fixer for Server-Side Logic 2026-03-08 19:49:44 -04:00
Kam 8203fc7d6b Better Texture Selection GUI 2026-03-08 19:49:30 -04:00
bigguy345 879dca7391 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-09 00:38:08 +02:00
bigguy345 e3fc9e8e4a Fixed method calls of JS type constructors throwing errors, made it dynamic 2026-03-09 00:35:53 +02:00
bigguy345 dc3e25bcba Added JS [] array resolution i.e. var list = ["hi", player]
+ added missing Array.d.ts overloads
2026-03-09 00:35:05 +02:00
Kam 4369f99225 Fix some Ability Command Issues 2026-03-08 18:05:44 -04:00
bigguy345 14a4c440b6 Object Literals AKA 'dict'
Phase #3: Functions
2026-03-08 21:45:12 +02:00
Kam b10dad8bcc Fix some Categorical Assign Packets 2026-03-08 15:39:16 -04:00
Kam 2e21b36796 Fix Beam and Laser Scripting 2026-03-08 15:39:06 -04:00
Vidal f546bd72b8 Added janino script unit to ability script 2026-03-08 13:47:32 -03:00
bigguy345 68b16fecfe Properly marked parameter headers in lambdas/func expressions i.e. the first 'item' in func = (item) => item + 1 2026-03-08 17:04:43 +02:00
bigguy345 c0d5bf3acc Expanded scope of "this." resolution to account for JS script types and inner scopes too. (compat for new ObjectLiterals & not implemented yet but soonTM JS prototypes) 2026-03-08 16:17:21 +02:00
bigguy345 86c3277075 Added JS arrow function => and shorthand methods handling 2026-03-08 12:09:16 +02:00
Kam 4457352c49 Merge branch 'dev' into syntax-highlighter-unified 2026-03-07 20:01:36 -05:00
Kam 180b2d7229 REMOVE the Junkimus Prime 2026-03-07 19:12:20 -05:00
Kam 4e33891ae5 Fixed / Improved Track Speed Handling on NPCs 2026-03-07 18:26:41 -05:00
Kam 393abc08ed Fix some Firing Script Behavior for Energy Projectiles 2026-03-07 15:30:11 -05:00
Kam ee7e8c17e8 Improve Track Delay 2026-03-07 15:12:55 -05:00
Kam f8ed7cfe19 Fix Ticking Ability Crash 2026-03-07 15:12:47 -05:00
bigguy345 959717fafd Object Literals AKA 'dict'
Phase #2: Nested Dicts
2026-03-07 17:23:08 +02:00
bigguy345 f01bc0a117 Object Literals AKA 'dict'
Phase #1: Fields
2026-03-07 15:56:37 +02:00
bigguy345 c00ad8e0a7 Fixed loop vars like for(var x in list) declared in top level outside of methods being declared duplicate 2026-03-07 15:48:10 +02:00
bigguy345 ec885d5ddb Removed comments from resolving expressions 2026-03-07 13:54:13 +02:00
bigguy345 19c1458b1d Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-07 13:26:59 +02:00
Kam 5b1301aac5 Merge branch 'dev' into syntax-highlighter-unified 2026-03-06 22:04:44 -05:00
Kam e6ad49327a 1.11 Beta 15 2026-03-06 22:04:36 -05:00
Kam 5669fe2fda Merge branch 'dev' into syntax-highlighter-unified 2026-03-06 22:03:52 -05:00
Kam 111156da5a Completed Tag Support for Auras, Forms, Outlines, Effects, Linked Items, Abilities 2026-03-06 22:03:26 -05:00
bigguy345 458162901e Added 'constructor()' method and 'class' field to Java.type() 2026-03-07 05:03:12 +02:00
bigguy345 5ad6a429cc Added JS keywords 2026-03-07 02:40:03 +02:00
bigguy345 cdae8e5e29 For loops handling now functional 2026-03-07 02:37:58 +02:00
bigguy345 437b74b353 Proper array assignment/declaration resolution 2026-03-07 01:30:19 +02:00
Kam 0eeeec5d22 Fix some Toggle Logic 2026-03-06 17:50:17 -05:00
bigguy345 fb3d6546e5 Fixed broken varargs overload selector logic 2026-03-07 00:40:04 +02:00
Kam 34b3d9365a Fix Counter Damage Logic to Support DBC Addon 2026-03-06 17:26:52 -05:00
bigguy345 9f26b27210 Properly parsed TypeScript standard varargs syntax 2026-03-07 00:25:20 +02:00
bigguy345 6547225e8d Parameterized Array.d.ts so it shows proper types and not just any/any[] 2026-03-07 00:20:23 +02:00
bigguy345 f78d326102 syntheticField getter 2026-03-07 00:00:12 +02:00
bigguy345 740d675294 Merged Array.d.ts members into Array types in JS 2026-03-06 23:51:37 +02:00
bigguy345 dabaab7675 Merge branch 'dev' into syntax-highlighter-unified 2026-03-06 23:46:16 +02:00
bigguy345 5152be9c4e Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-06 20:59:59 +02:00
bigguy345 2798e54167 Made "any" primitive 2026-03-06 20:59:39 +02:00
bigguy345 831ef6c4f9 Completion of last commit 2026-03-06 20:52:28 +02:00
bigguy345 98885faaa2 (WIP) Properly handled merging Object.d.ts members into current java.lang.Object handling in type resolution & autocomplete 2026-03-06 20:25:12 +02:00
bigguy345 ef499fd7bd forgot this 2026-03-06 18:39:10 +02:00
bigguy345 ac8ab9b0f0 Properly parsed statics and finals for JS types in Autocomplete 2026-03-06 18:38:40 +02:00
bigguy345 ca7602098f Properly static'd and final'd ES5.1 globals 2026-03-06 17:39:00 +02:00
bigguy345 ff5626530e Fixed parameters of type 'any' unresolved 2026-03-06 17:06:22 +02:00
bigguy345 0bc6751914 Made JS parameters expecting String universally compatible with all types 2026-03-06 17:02:04 +02:00
Kam 790b84e7d3 Fix Energy Projectile Fired Hook on Abilities 2026-03-06 06:04:47 -05:00
Kam ae8dbf43b5 Fix Laser Offset Look vector 2026-03-06 05:54:10 -05:00
Kam fbfc2eb64c Fix Import 2026-03-06 05:54:03 -05:00
Kam 0f5a191bcf Prevent Movement Abilities through Barriers 2026-03-06 05:53:55 -05:00
Kam 948b708223 Beam Steering Fix 2026-03-06 05:44:03 -05:00
Kam 2a55c36b74 Reset Position / World Time when Entity is reflected 2026-03-06 05:42:56 -05:00
Kam f25b9fabf8 Fix Movement Suppression when GUI Screen is Open 2026-03-06 05:42:39 -05:00
Kam fd25217dee Better Scrolling Functionality for Inventory Hud Management 2026-03-06 05:22:09 -05:00
Kam fa60ec42f3 Add Support for Next / Prev Buttons for Ability Hud 2026-03-06 05:21:56 -05:00
Kam ce1ac1be84 Fix Clipping Screen on Custom Effect Animated Texture Controls 2026-03-06 05:21:03 -05:00
Kam 0b1e4f9ed4 Huge Overhaul to Fullscreen Modes + Folder Support for:
- Animations
- Abilities
- Forms
- Auras
- Outlines
- Effects
- Linked Items
2026-03-06 05:20:11 -05:00
Kam bac6eec44e Merge branch 'dev' into syntax-highlighter-unified 2026-03-05 22:50:21 -05:00
bigguy345 ff81281337 All varargs i.e 'String...' handling is now completely functional 2026-03-06 05:09:36 +02:00
bigguy345 8ccdabef47 Fixed '("faah").length' bug or smthn idk anymore 2026-03-06 03:58:40 +02:00
bigguy345 106f886e83 Made JS 'number' primitive 2026-03-06 02:24:47 +02:00
bigguy345 c1b298e46d In JS enriched String/Object types with ES5.1 unique members added in .d.ts files 2026-03-06 01:55:06 +02:00
bigguy345 1d1962603b Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-06 00:15:41 +02:00
bigguy345 18f614d142 Parsed static .d.ts members properly 2026-03-05 22:50:30 +02:00
bigguy345 f0770fb7fc Checked static context 2026-03-05 22:47:54 +02:00
Kam c11cd4a6bb Upgrade MD Files 2026-03-05 14:46:49 -05:00
Kam a4da94792d Unfocus Textfield on Subgui Close 2026-03-05 14:45:34 -05:00
bigguy345 3172e6673f Implemented ES5.1 global functions 2026-03-05 21:12:50 +02:00
bigguy345 eaedb1b88f Added array.length and array.clone() to TypeInfo arrays 2026-03-05 20:25:38 +02:00
bigguy345 100ed4ecdd Adjusted package name consistency + removed [] for arrays 2026-03-05 19:02:39 +02:00
bigguy345 7c3b823ce1 Change globalEngineImports structure 2026-03-05 18:53:43 +02:00
bigguy345 61d1efe943 Unused 2026-03-05 18:51:46 +02:00
bigguy345 4d2938ac81 Added proper generics to autocomplete menu i.e List<String> is now rendered with proper colors for List, String and <> 2026-03-05 18:50:33 +02:00
bigguy345 d762f21c54 Fixed hover bug 2026-03-05 18:47:40 +02:00
bigguy345 0a42ea6d57 Proper array syntax highlight colors for editor/hover info/autocomplete are finally implemented i 2026-03-05 17:32:07 +02:00
bigguy345 ad2c8c89c1 Array syntax is now functional and resolves i.e. 'items[i].getName()' 2026-03-05 16:07:39 +02:00
bigguy345 131f0e2d74 Treated "Object" as universally compatible in JS (methods requiring int accepts Object) 2026-03-05 13:53:01 +02:00
bigguy345 5899ea7932 Treated all java primitive numbers as universally compatible in JS (methods requiring int accept float/double) 2026-03-05 13:40:00 +02:00
bigguy345 8539fe96a4 Fix DTSJSDocParser not working for files like RegExp and String (removed artificial window) 2026-03-05 13:24:49 +02:00
bigguy345 8996f2b7f1 Fixed containsOperator failing for "" + Object 2026-03-05 13:10:29 +02:00
Kam 1885308639 Merge branch 'dev' into syntax-highlighter-unified 2026-03-05 04:42:28 -05:00
Kam 211f741a64 1.11 Beta 14 2026-03-05 04:41:56 -05:00
Kam 37d4b97a44 Ability Checking 2026-03-05 03:15:47 -05:00
Kam 3919831857 LANGS 2026-03-05 02:20:26 -05:00
Kam e309794fd7 Custom Ability Telegraph Controls, Inner Radius Fix 2026-03-05 02:18:34 -05:00
Kam dbca3da639 Fix some Packet / Language Handling for Race Condition 2026-03-05 01:37:44 -05:00
Kam 6007b49271 Fix Texture Pathing Removing Icons 2026-03-05 00:53:19 -05:00
Vidal ddb4072ac1 Merge remote-tracking branch 'origin/dev' into dev 2026-03-05 02:36:03 -03:00
Vidal 9cf43d9f7e Renamed AMMO to COUNT and cleaned up legacy code 2026-03-05 02:35:53 -03:00
Vidal 82f9ecaf4a Submodules 2026-03-05 01:45:58 -03:00
bigguy345 66c4b4c4c3 Tightened safety checks 2026-03-05 04:19:58 +02:00
Kam 8c8815dc45 Various Changes / Health Preservation to Request Spawn Data 2026-03-04 20:56:06 -05:00
bigguy345 8b41391a5f In JavaScript mode, assigned all integers/float/doubles/longs as 'number' instead of their java types 2026-03-05 03:51:16 +02:00
bigguy345 bfcca3e6f9 In JavaScript mode, treat java.lang.Object as "any", universally compatible with all types 2026-03-05 03:50:37 +02:00
Kam 5271f90fa9 Merge branch 'dev' into syntax-highlighter-unified 2026-03-04 20:45:46 -05:00
Kam 12cf4b9a85 Revert Script Token 2026-03-04 20:45:33 -05:00
Kam 34d2533473 Revert "Better Script Session Token Handling"
This reverts commit e4033481bc.
2026-03-04 20:38:49 -05:00
bigguy345 9b7528f723 Fixed spaces being inappropriately stripped from parsed .d.ts JSDocs 2026-03-05 02:59:42 +02:00
bigguy345 1cf1ffd2c0 Hover Info panel padding/panning/resize adjustments
No longer stripping spaces from ``` code markdown blocks
2026-03-05 02:59:04 +02:00
bigguy345 36c2326466 Fixed the accursed backspace/enter tab multiplication bug 2026-03-05 02:36:19 +02:00
bigguy345 f02f8478da Properly scissored Autocomplete panel 2026-03-05 02:15:45 +02:00
bigguy345 0b9abf2a57 Made Autocomplete panel pannable and resizable 2026-03-05 01:52:18 +02:00
bigguy345 c537a09ad1 Made Hover Info resizable via handle at bottom right 2026-03-05 01:17:22 +02:00
bigguy345 bee84a622c Merge branch 'dev' into syntax-highlighter-unified 2026-03-05 00:50:59 +02:00
bigguy345 b9b1b0725a JSDoc hover tooltip improvements: fix scissor clip, remove trailing whitespace, balance code block padding, support multi-resolution wrapping, add tooltip panning
- Trim trailing blank lines from JSDoc descriptions to remove extra bottom space
- Add tooltip panning: drag M1 anywhere on tooltip panel body to reposition it freely
2026-03-05 00:35:25 +02:00
bigguy345 e8b0c6a542 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-05 00:32:34 +02:00
Kam e4033481bc Better Script Session Token Handling 2026-03-04 17:28:45 -05:00
Kam 88d8af8b96 Revert "Crazy Logging for Health Spam Debugging"
This reverts commit a981060e9e.
2026-03-04 17:28:23 -05:00
Kam cf49d9a778 Revert "Fix Timer not being able to be called from a Spawning NPC [Revert if not working]"
This reverts commit d1b32ea8a1.
2026-03-04 17:28:18 -05:00
Vidal bed959c658 ConditionCompare abstraction for Skill and DBCLevel 2026-03-04 19:27:27 -03:00
Kam c5cd2d7ce1 Merge branch 'dev' into syntax-highlighter-unified 2026-03-04 16:21:29 -05:00
Kam 5a879cd6a5 Beta 13.1 2026-03-04 16:21:22 -05:00
Kam d3346111c7 Animation Resync on Teleport 2026-03-04 16:19:42 -05:00
Kam a981060e9e Crazy Logging for Health Spam Debugging 2026-03-04 16:05:09 -05:00
Kam d1b32ea8a1 Fix Timer not being able to be called from a Spawning NPC [Revert if not working] 2026-03-04 15:59:41 -05:00
bigguy345 2578ce1cf6 feat(hover): wire tooltip scrollbar drag into GuiScriptTextArea input handling
- drawTextBox: update scrollbar drag each frame via Mouse.isButtonDown(0),
  release drag when button lifted (mirrors existing ScrollState pattern)
- mouseClicked: intercept LMB on tooltip scrollbar thumb before text interaction

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <[email protected]>
2026-03-04 22:56:10 +02:00
bigguy345 58f86058d4 feat(hover): scrollbar drag/hover-highlight, smooth scroll, compact blank-line spacing
- HoverState: add smooth-scroll lerp (updateSmoothScroll, targetScrollOffset),
  scrollbar thumb bounds (setScrollbarThumb), click/drag/release state methods,
  and fix broken scrollTooltip/getTooltipScrollOffset/resetTooltipScroll methods
  that referenced the deleted int field
- TokenHoverRenderer: call updateSmoothScroll each frame; store thumb bounds
  for drag+hover detection; highlight thumb on hover/drag; reduce empty
  DocumentationLine height from lineHeight+LINE_SPACING to lineHeight/2

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)
Co-authored-by: Sisyphus <[email protected]>
2026-03-04 22:54:38 +02:00
bigguy345 24af603ce1 Java/Janino editor fixes and improvements:
- Fixed clicking and adding hooks not properly resolving added types like INpcEvent.CollideEvent

- Imported wildcards of all available events in the given context.
  i.e ScriptContext NPC has INpcEvent,IProjectileEvent,IAbilityEvent,etc.. as available wildcard imports

- Added nested types to autocomplete of outer classes so INpcEvent. shows InitEvent, UpdateEvent, InteractEvent,etc...

- Added wildcard imports to autocomplete
2026-03-04 15:08:30 +02:00
bigguy345 784fb8da65 feat(hover): markdown-aware JSDoc description rendering with heading and code colors 2026-03-04 14:11:46 +02:00
bigguy345 f08e97af1f fix(jsdoc): preserve newlines in JSDoc description and tag continuation 2026-03-04 14:05:20 +02:00
bigguy345 60fc7ec252 Add ECMAScript 5.1 global imports like Math/JSON/Date/Number 2026-03-04 13:21:40 +02:00
bigguy345 789c7f5317 faaah 2026-03-04 13:00:50 +02:00
bigguy345 2821b5da09 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-04 12:54:29 +02:00
Kam bd9d56943e Fix Push Through wall Teleport Logic for Barriers 2026-03-04 04:32:54 -05:00
Kam b72e6e3466 Update EffectScriptPacket.java 2026-03-04 02:02:54 -05:00
Kam 2eecf9c230 Merge branch 'dev' into syntax-highlighter-unified 2026-03-03 23:01:37 -05:00
Kam 2f33abc75c 1.11 Beta 13 2026-03-03 23:01:03 -05:00
Kam 556d7daa13 Fix Script Contexts 2026-03-03 22:53:18 -05:00
Kam 9e68943b7e Merge branch 'dev' into syntax-highlighter-unified 2026-03-03 22:32:38 -05:00
Kam 307a029995 Fix Script Ability System on Create not Available 2026-03-03 22:31:32 -05:00
Kam 54e0ca6510 Fix Instanced Abilities Reloading per Usage 2026-03-03 22:15:49 -05:00
Kam 2ba2372bde Fix some Selection Handling for Abilities 2026-03-03 21:56:17 -05:00
Kam 513956062d Merge branch 'dev' into syntax-highlighter-unified 2026-03-03 20:30:02 -05:00
Kam b59f0b8f2f Energy Explosion API and some changes to Energy Projectile API 2026-03-03 17:11:12 -05:00
Kam 6f6e080ee0 Add Better Info Panel and Display Damage to Abilities 2026-03-03 16:32:16 -05:00
Kam d9f100d245 Cleanup Damage Handling Logic for CNPC+ and DBC Addon for better readability / context. Added Magic Data Support to Abilities 2026-03-03 14:55:50 -05:00
Kam c3096b320e Fix Critical and Attribute Handling for CNPC+ and DBC Addon 2026-03-03 04:06:34 -05:00
Kam 159b740f39 Fix Panel Redirection 2026-03-03 03:11:41 -05:00
Kam 9f311903e0 Update Modules 2026-03-03 02:02:27 -05:00
Kam ee192a247f Better API Handling for Scripting Energy Utilitizes / Damage Handling 2026-03-03 02:02:13 -05:00
Kam 572a51ad32 Better API Handling for Scripting Energy Utilitizes / Damage Handling 2026-03-03 02:02:05 -05:00
Kam 7df1cfbfb9 Script Token Handling 2026-03-03 01:58:45 -05:00
Kam 6489f75b7d Fix DBC Damage for Panel, Sweeper, Zones 2026-03-03 00:36:45 -05:00
Kam dad49f1867 Add Track Delay and Anchor Handling 2026-03-02 20:09:32 -05:00
Kam 36aab9e86e Fix Some LOGIC!!!! 2026-03-02 18:29:39 -05:00
Kam c16aae75e2 Merge branch 'dev' into syntax-highlighter-unified 2026-03-02 16:38:44 -05:00
Kam dfa6ccb350 Fixes to some Script Handling 2026-03-02 16:38:35 -05:00
Kam 702dec9c40 Small Bug Fixes to Flight, Command Handling, Linked Items 2026-03-02 15:23:54 -05:00
bigguy345 a5ffe34c2d feat(script-editor): apply receiver generic type args to legacy Object params in JDK collection methods
This change enables the script editor to display and validate generic type arguments
for method parameters that are erased to Object in Java's built-in collection interfaces.

MOTIVATION
----------
Java's Map, Collection, List, Deque, and concurrent variants use Object-typed parameters
(e.g., Map.get(Object), Collection.contains(Object)) for backward-compatibility reasons.
When the receiver is parameterized (e.g., HashMap<String, Integer>), the editor should
show get(String) instead of get(Object) to provide better hints and stricter validation.

IMPLEMENTATION
--------------
New GenericParameterAdapter utility (contract-level rules, NOT per-concrete-class):
- Covers 8 JDK collection contracts exhaustively (Map, ConcurrentMap, Collection, List,
  Set, Deque, BlockingQueue, BlockingDeque)
- 35+ rules total mapping erased Object params to appropriate type arguments (K, V, or E)
- Integrated into MethodInfo.fromReflection() so all code paths (autocomplete, hover,
  validation) use the same adapted parameter types
- Hover signature rendering now routes through MethodInfo for parameterized receivers,
  ensuring consistency with autocomplete

Related-to: Generic type argument substitution framework (TypeSubstitutor, GenericContext)
which already applied V correctly; this extends that same mechanism to K/E for the
JDK's intentionally-erased-for-compatibility method parameters.
2026-03-02 17:11:52 +02:00
bigguy345 26ebb69f81 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-02 14:08:19 +02:00
bigguy345 6b7563cab3 Fixed broken null assignments i.e. var npc = null 2026-03-02 14:08:00 +02:00
bigguy345 4fa7a73704 Fixed JS func expressions/lambda fields broken scope logic + fixed another statement line separation logic 2026-03-02 14:07:59 +02:00
bigguy345 6328826c9e Fixed .d.ts js types of same assignability/inheritance (ICustomNpc -> IEntity) not being checked properly 2026-03-02 13:30:29 +02:00
bigguy345 006766bc1e Fixed .d.ts type merges overriding same-arity methods i.e spawn(IWorld) used to override spawn(IEntity, no more 2026-03-02 13:29:39 +02:00
Kam 109e31fd2d Fix Hooks not Registering 2026-03-02 06:13:40 -05:00
bigguy345 fbb46ae9f2 Improved statement line separation logic so it includes chained dots on whitespaces and lines 2026-03-02 12:49:36 +02:00
Kam ce5c85b0ad Merge branch 'dev' into syntax-highlighter-unified 2026-03-02 04:01:23 -05:00
Kam a077c7b32f Add Ignore I-Frames to Abilities 2026-03-02 03:58:18 -05:00
Kam f6a8edfef1 Fix Guard with DBC Damage 2026-03-02 02:58:03 -05:00
Kam d33276407e Update AbilityDodge.java 2026-03-02 00:15:43 -05:00
Kam b95aaefe8f Fix Vortex not working on Mobs 2026-03-02 00:15:33 -05:00
Kam a5de6d80cc Update AbilityDodge.java 2026-03-02 00:15:23 -05:00
Kam 7e34d06103 Fix Vortex not working on Mobs 2026-03-01 23:58:23 -05:00
Kam c6c023dda7 1.2 Beta 12 2026-03-01 21:13:57 -05:00
Kam d58e583d22 Update gradle-plugins 2026-03-01 21:12:26 -05:00
Kam 8ed04fb58b Merge branch 'dev' into syntax-highlighter-unified 2026-03-01 21:08:36 -05:00
Kam 2448655fc4 1.11 Beta 12 2026-03-01 21:07:52 -05:00
Kam 6500187ca1 Fix Anchor Launch Point 2026-03-01 20:57:17 -05:00
bigguy345 32fd6af04f Fix hook signatures to follow runtime hook registrations in ScriptHookController.
This fixes broken unresolved DBC addon hook event types
2026-03-02 02:28:01 +02:00
bigguy345 36f7233297 Narrow integer literals to byte/short/char when expected i.e setByte(100) no longer throws "Expected byte, provided int" 2026-03-02 01:47:56 +02:00
bigguy345 edb285c90b Applied scope logic more consistently for variables/assignments 2026-03-02 00:45:24 +02:00
bigguy345 29f0282fe4 Merge branch 'dev' into syntax-highlighter-unified 2026-03-02 00:26:51 +02:00
bigguy345 e1be96412d Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-03-02 00:20:45 +02:00
bigguy345 d45f09c27c Extracted ScopeInfo to its own class 2026-03-01 23:33:36 +02:00
Kam 61d08882a9 Lots of Fixes 2026-03-01 16:19:50 -05:00
Kam 0ad15e674a Clear Ability on Teleport 2026-03-01 15:55:22 -05:00
Kam edb9686703 Cancel Only during Windup 2026-03-01 15:49:04 -05:00
Kam 6eeeddad3f Sort Ordering for Concurrent and Custom 2026-03-01 15:34:29 -05:00
Kam b406382564 Fix Counter Damage for DBC / CNPC+ 2026-03-01 15:21:47 -05:00
Kam eacb3f8c5f Update icons.png 2026-03-01 15:06:25 -05:00
Kam de312aaccc Fix Orb Icon 2026-03-01 05:00:12 -05:00
Kam cf3ba63d01 Add Ability Tab Icon 2026-03-01 04:59:27 -05:00
Kam e7fcc3a71a Merge remote-tracking branch 'origin/dev' into dev 2026-03-01 04:44:51 -05:00
Kam a479a9d941 Fix Charging on Staff Resetting 2026-03-01 04:44:42 -05:00
Kam d6eccdd556 Ki Redirection for Barriers, Color Shifting, Better Logic Handling for Built in DBC Ki Abilities 2026-03-01 04:32:25 -05:00
Kam 40613fa56a Bunch of API Additions
- ITintData
- IHitboxData
- Sound Management APIS
- Tactical Chance
- Swimming
- Fire Reactions
- Sprint
- Door Interact
- Walking Range
2026-03-01 04:27:12 -05:00
Kam b1d7082584 Launch from Anchor Point Setting 2026-03-01 04:11:21 -05:00
Kam aa53d0588c Merge branch 'dev' into syntax-highlighter-unified 2026-03-01 03:34:56 -05:00
Kam 6f1a837296 Renaming for Better Schema 2026-03-01 03:00:17 -05:00
Kam 7202f74e78 Update API and Cleanup Unused Code 2026-03-01 02:50:44 -05:00
Kam f1a6d7488f Counter, Dodge, Guard Animation Hookup + Damage Fixes 2026-03-01 01:59:44 -05:00
Kam b49316d9bb Counter, Dodge, Guard Abilities 2026-03-01 00:09:57 -05:00
Kam fc71fb5a33 Counter, Dodge, Guard Abilities [WIP] 2026-02-28 23:23:52 -05:00
Kam d3d9dd352a Target Owner for Barriers on Reflection 2026-02-28 19:43:01 -05:00
Kam 1a0ce41e00 Add Free Aim Functionality for Beams 2026-02-28 19:25:13 -05:00
Kam de2fcea154 Animated Texture Support 2026-02-28 18:34:21 -05:00
Kam 988dbe0cd2 Fix Scripts not being available on Ability / Chained Creation 2026-02-28 18:12:55 -05:00
Kam f71694e210 Fix Default Icon Logic in DBC Addon to work with Layering System of CNPC+ 2026-02-28 17:05:54 -05:00
Kam 8056640102 Default Icon Layer Handling 2026-02-28 16:58:38 -05:00
Kam eaec10e529 Fix Some Quest Cooldown Behavior 2026-02-28 14:17:23 -05:00
Kam 38df157c40 Staff Charging Fix 2026-02-28 14:04:11 -05:00
Kam fed82bc932 Vortex Fixes 2026-02-28 13:15:13 -05:00
somehussar 80ab2eaae9 Change image download headers.
- Simplified connection headers.
- Added a config to fall back to the original connection headers.
2026-02-28 02:23:47 +01:00
Kam 3bd25c689b Fix Animation Lookup 2026-02-27 17:07:04 -05:00
Kam 3bbde1f748 Field Def Size Fixes 2026-02-27 16:45:48 -05:00
Kam 675c4ef4f9 Remove all Legacy Ability Content, cleanup API.
- Add Script Tab to Abilities
- Add Custom Ability
- Add Icon Support for Abilities / Default Icon Support
- Remove Icon Tab and throw it into Effects with allowed Override
- Removed Deprecated API Sources
2026-02-27 16:43:35 -05:00
Kam 936dc7f0cc Add Offsets to Barriers 2026-02-27 00:47:45 -05:00
Vidal a7edf0e221 Merge remote-tracking branch 'origin/dev' into dev 2026-02-27 02:38:57 -03:00
Vidal f1f0df425f changed angle field min value to negative infinity 2026-02-27 02:38:46 -03:00
Kam 1c02657282 Barrier Logic Corrections 2026-02-27 00:11:11 -05:00
Kam 3d21a7634c Merge branch 'dev' into syntax-highlighter-unified 2026-02-26 19:29:16 -05:00
Kam 04e6cbe6cf 1.11 Beta 11 2026-02-26 19:29:08 -05:00
Kam 6db33c3a27 Update gradle-plugins 2026-02-26 19:28:24 -05:00
Kam 7108f9c7de Update gradle-plugins 2026-02-26 19:28:12 -05:00
Kam 6a10a25389 Merge branch 'dev' into syntax-highlighter-unified 2026-02-26 19:27:42 -05:00
Vidal 277cc0ec2f Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	gradle-plugins
2026-02-26 20:31:11 -03:00
Vidal ab7dcd0be9 Modules 2026-02-26 20:30:49 -03:00
Vidal acf69caf7e EYE anchor point Y offset fixed 2026-02-26 19:43:16 -03:00
Kam 2f1e67660d Anchor Point Helper Eye - Item Staff Fixes 2026-02-26 02:59:40 -05:00
Kam 8b1ef36dc5 Anchor Point Eye Fix 2026-02-26 02:34:10 -05:00
Kam 1cd629f39c Modules 2026-02-26 02:26:08 -05:00
Kam 2e221b42a1 Fix Broken Charging Spamming 2026-02-25 23:15:32 -05:00
Vidal 690336036d Pushed Dash API methods to the right branch now lmao 2026-02-26 01:03:21 -03:00
Vidal 9791893d2b Merge remote-tracking branch 'origin/dev' into dev 2026-02-25 23:01:22 -03:00
Vidal 643de56cf5 Reverted dash concurrent 2026-02-25 23:01:07 -03:00
Vidal 099f008766 updated submodules 2026-02-25 23:00:58 -03:00
Vidal ef013e7095 Merge remote-tracking branch 'origin/dev' into dev 2026-02-25 23:00:04 -03:00
Vidal 9cae588b7c Made dash concurrent 2026-02-25 22:01:57 -03:00
Vidal d050dd4c5c API methods for dash 2026-02-25 21:50:06 -03:00
Vidal 22ca64ccf8 Removed ass active sound 2026-02-25 21:48:17 -03:00
Vidal 81857669b0 Changes to AbilityDash and AbilityLaser animations 2026-02-25 21:46:48 -03:00
Vidal 986c308846 Prevented fur to be applied on non saiyan races 2026-02-25 19:33:05 -03:00
bigguy345 be50fdeda5 Forgotten if clause from yesterday 2026-02-25 20:45:00 +02:00
bigguy345 30be75dbae Fix autocomplete menu scroll math when visible rows < max
When the menu shrinks in windowed/cramped layouts, several paths still assumed MAX_VISIBLE_ITEMS (10) for maxScroll/hover/scrollbar calculations, making the last entries unreachable. Use the actual visible capacity (visibleItemsCount) consistently and normalize scissor Y conversion for scaled GUI coords
2026-02-25 19:54:32 +02:00
bigguy345 28293fd6d7 Changed ShowImplementationFieldsInAutocomplete config description 2026-02-25 17:35:52 +02:00
bigguy345 f9f1cb760c Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-02-25 17:14:12 +02:00
bigguy345 6c45957b82 Add ShowImplementationFieldsInAutocomplete config 2026-02-25 17:13:35 +02:00
bigguy345 4d08f85419 Enrich .d.ts files with the interface implementation fields, so in scripts calls like event.npc and event.player are now syntax highlighted and type resolved 2026-02-25 16:37:41 +02:00
bigguy345 5b8827549f Fixed broken .d.ts fields parsing logic 2026-02-25 16:29:52 +02:00
bigguy345 f1d902849e Smart auto-pair insertion/skip-over for (), [], "" and '' in GuiScriptTextArea 2026-02-25 13:52:47 +02:00
bigguy345 2ca145b264 Fixed auto {} brace insertion not respecting existing } that has different indent/whitespaces 2026-02-25 13:04:07 +02:00
Kam f07ec0df33 Merge branch 'dev' into syntax-highlighter-unified 2026-02-25 04:33:12 -05:00
Kam 3476f6bd94 1.11 Beta 10 2026-02-25 04:33:00 -05:00
Kam ae265c83b0 Merge branch 'dev' into syntax-highlighter-unified 2026-02-25 04:32:24 -05:00
Kam 008fca66bf Merge remote-tracking branch 'origin/dev' into dev 2026-02-25 04:31:32 -05:00
Kam d8bc3d4177 CNPC+ Debug Command for Energy Projectiles + Compile Fixes 2026-02-25 04:31:17 -05:00
Kam f73e8d02f9 Update EntityAbilityDome.java 2026-02-25 04:12:20 -05:00
Kam 744ffc5ab7 Complete Overhaul to Laser Shot -> Ability Laser 2026-02-25 03:52:20 -05:00
Kam f877279df0 Update EntityAbilityLaser.java 2026-02-25 00:02:09 -05:00
Kam 26f5a84f97 Better Naming 2026-02-25 00:00:55 -05:00
Kam 8a998c6f62 Fix Barrier + DBC Logic 2026-02-24 23:52:01 -05:00
Kam 481c7ee5cb Fix Slam Jumping into Air on Target Mode 2026-02-24 23:21:57 -05:00
Kam 47ebc2889f Reflection Barrier Fixes 2026-02-24 23:18:59 -05:00
Kam 92cfbbcc9d Fix Panels in Ground Issue 2026-02-24 22:30:19 -05:00
Kam 455d303971 Revert "Better Diagonal Flight Pathing"
This reverts commit 960b223155.
2026-02-24 22:28:59 -05:00
Kam 6dce4e5cdc Revert "Smoother + Most-Cost Effective Flight Pathing"
This reverts commit a79ba3a0e4.
2026-02-24 22:28:57 -05:00
Kam 90735e6866 Scripting Ability Handling Improvement and Copy Data 2026-02-24 21:23:40 -05:00
Kam 50fd3c1856 Fix Quest / Dialog Modification Names 2026-02-24 21:08:59 -05:00
Kam 39025c41b3 Merge branch 'dev' into syntax-highlighter-unified 2026-02-24 19:16:32 -05:00
Kam 01b08f9fbf 1.11 Beta 9.1 2026-02-24 19:16:23 -05:00
Kam 3e1b4fd692 Merge branch 'dev' into syntax-highlighter-unified 2026-02-24 19:12:35 -05:00
Kam edc3fa55c8 Fix Defaults 2026-02-24 19:11:49 -05:00
Kam f832b3bf2d Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2026-02-24 19:06:54 -05:00
Kam dfd016d10c Update CNPCData.java 2026-02-24 19:06:48 -05:00
Kam 5128086ebe Merge remote-tracking branch 'origin/dev' into dev 2026-02-24 19:05:27 -05:00
Kam 930b7ed423 Better Energy Charging Syncing 2026-02-24 19:05:08 -05:00
Kam 9eadeaa611 Dialog and Quest Saving Bug 2026-02-24 19:03:26 -05:00
Kam b2f89035b9 MENU BG for Everything!!!! 2026-02-24 18:55:52 -05:00
Kam d36ec5c259 Small Linked Item Building Fix 2026-02-24 18:35:40 -05:00
Kam c492e16cc8 Smaller Auction System Fixes 2026-02-24 18:34:10 -05:00
Kam e7b033ecf0 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	src/main/java/noppes/npcs/controllers/AuctionController.java
2026-02-24 18:24:59 -05:00
Kam aa186d8b7d Smaller Auction System Fixes 2026-02-24 18:24:44 -05:00
Vidal 4dee23fea2 Merge remote-tracking branch 'origin/dev' into dev 2026-02-24 20:24:01 -03:00
Vidal 36f76f9cbe Linked Item API methods 2026-02-24 20:23:44 -03:00
Kam a023f3ec82 Better Ability Data Syncing 2026-02-24 18:20:57 -05:00
Kam bf277bbdfe Auction House Space Check Fix 2026-02-24 17:46:52 -05:00
bigguy345 0c842a22b9 Fix java method declaration MethodInfo not being fetched properly 2026-02-24 23:02:25 +02:00
bigguy345 dd2e7f765c Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-02-24 23:02:01 +02:00
Kam 86541779db Merge branch 'dev' into syntax-highlighter-unified 2026-02-24 15:30:28 -05:00
Kam 7c8f18f65e 1.11 Beta 9 2026-02-24 15:28:01 -05:00
Kam d45bfde162 Potion Effect Amplifier 2026-02-24 15:27:30 -05:00
Kam 953a706846 Allow Negatives 2026-02-24 15:27:13 -05:00
Kam 251c7b109f Better Key Press Handling CNPC+ 2026-02-24 15:15:06 -05:00
bigguy345 95897dc746 Show 'function' instead of 'void' or other return type for hover info of JS method declarations 2026-02-24 21:34:18 +02:00
bigguy345 a107e045eb Suppress redundant bracket pair generation in script editor and adjusted JSDoc Enter behavior 2026-02-24 21:19:30 +02:00
bigguy345 53f06ab388 Properly sanitized pasted text from trailing spaces at end of line, fixes forced soft-wrap when too many consecutive trailing spaces 2026-02-24 20:18:45 +02:00
bigguy345 d59d990b70 Marked JavaTextContainer as deprecated 2026-02-24 19:49:53 +02:00
bigguy345 12850bfe36 Improve JS 'any' propagation in expression typing 2026-02-24 18:53:10 +02:00
bigguy345 182c00b142 Fix JS 'number' and 'any' compatibility in expression type resolution
i.e fixes 'i * offsetMulti' in 'skinOverlay.setOffset(0, 0, i * offsetMulti)' not resolving properly
2026-02-24 17:57:01 +02:00
bigguy345 63f6c7c045 Made .d.ts files retain java primitive types ('int' retained as is without transforming to 'number') + necessary changes to support that 2026-02-24 15:50:12 +02:00
bigguy345 5c53b7e768 .d.ts API asset files are now reloaded on mc resource reload 2026-02-24 14:05:56 +02:00
bigguy345 fa38f93677 Merge branch 'dev' into syntax-highlighter-unified 2026-02-24 10:32:17 +02:00
bigguy345 81c59cbaf0 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-02-24 10:30:08 +02:00
Kam 6ad71a1ebf Fixes to some Logic and Debug Prints 2026-02-24 03:17:57 -05:00
Kam efb11dd332 Fix Slam with Damage Reduction with Float Ki and Flying 2026-02-24 01:50:23 -05:00
Kam 5d16e79767 A various amount of fixes!!!!! 2026-02-24 01:15:37 -05:00
Kam 083d38b9d3 Merge remote-tracking branch 'origin/dev' into dev 2026-02-24 00:31:36 -05:00
Kam 7d4157774a Better Ground Telegraph Handling 2026-02-24 00:31:20 -05:00
Kam 8aa16c882e Fix Interrupt Logic 2026-02-24 00:21:54 -05:00
Kam 2f170363de Add Fail Safes to Cooldown and Locking 2026-02-24 00:12:18 -05:00
Kam abc34b3f6f Fix Rendering Glitches 2026-02-23 23:19:33 -05:00
Vidal 08728efcdd Merge remote-tracking branch 'origin/dev' into dev 2026-02-24 00:09:01 -03:00
Vidal b360ecf4a8 Returned null by default on condition extensions 2026-02-24 00:08:49 -03:00
Kam 5d4d21359f Prevent Overbidding on Auctions 2026-02-23 22:08:12 -05:00
Vidal 0eec52f6d9 Merge remote-tracking branch 'origin/dev' into dev 2026-02-24 00:01:06 -03:00
Vidal aa160ba8fc Added condition checking to extenders
Extended HP condition to read DBC HP instead
2026-02-24 00:00:51 -03:00
Vidal 1a368b2bc7 Removed old Condition class 2026-02-23 23:56:19 -03:00
Kam 670b811e03 Better Ability Data Syncing 2026-02-23 21:46:23 -05:00
Kam a724f7f12c Fix Barrier is Ally Crash 2026-02-23 21:19:32 -05:00
Kam 1f76564b9d Why are we using Camera Yaw for Spawning NPCs? Fix Starring at the Ground 2026-02-23 20:44:15 -05:00
Kam ed09511952 So many LOG spam?! 2026-02-23 20:43:53 -05:00
Kam 9a791bba25 Reapply "Fix Animation Offsets with Vanilla Offsets"
This reverts commit dbe835612d.
2026-02-23 19:15:09 -05:00
Kam 57308e278c Merge branch 'dev' into syntax-highlighter-unified 2026-02-23 18:51:05 -05:00
Kam 8e6436dc69 1.11 Beta 8.1 2026-02-23 18:50:51 -05:00
Kam dbe835612d Revert "Fix Animation Offsets with Vanilla Offsets"
This reverts commit f95e7afb4e.
2026-02-23 18:50:27 -05:00
Kam 25f7114340 Fix Packet 2026-02-23 18:50:04 -05:00
Kam 20168406b5 Merge branch 'dev' into syntax-highlighter-unified 2026-02-23 17:51:18 -05:00
Kam 1e26cf6cb0 1.11 Beta 8 2026-02-23 17:51:11 -05:00
Kam 5cf69f90fb Merge branch 'dev' into syntax-highlighter-unified 2026-02-23 17:50:20 -05:00
Kam b84294f112 Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2026-02-23 17:45:41 -05:00
Kam b082ccfbd7 Auction Global Manage System 2026-02-23 17:45:40 -05:00
luisc 088b1c211e Merge remote-tracking branch 'origin/dev' into dev 2026-02-23 16:15:56 -06:00
luisc fcbd2545cb changed rotation of orbs and discs based on their heading 2026-02-23 16:15:43 -06:00
Kam 03bea7461d Optimize Explosion Handling 2026-02-23 14:33:02 -05:00
Kam e4fe8c5112 Max Hits for Piece and Multi 2026-02-23 14:21:55 -05:00
Kam 21cd8e9e01 Fix Hover Labels on Scroll Components 2026-02-23 13:40:24 -05:00
Kam f95e7afb4e Fix Animation Offsets with Vanilla Offsets 2026-02-23 13:33:46 -05:00
Kam 37b38daa00 Improved Natural Despawn Handling PR 4 - Natural Spawns 2026-02-23 05:44:45 -05:00
Kam 6abd29b12d Natural Spawns PR3 - Better Runtime Control of Natural Spawns 2026-02-23 05:27:45 -05:00
Kam 5c42308ca3 Natural Spawns PR2 Improvements to GUI Functionality 2026-02-23 05:21:51 -05:00
Kam 27e9f98862 Natural Spawn Patch 1 2026-02-23 05:03:01 -05:00
Kam a79ba3a0e4 Smoother + Most-Cost Effective Flight Pathing 2026-02-23 04:38:02 -05:00
Kam 960b223155 Better Diagonal Flight Pathing
@c0508383
2026-02-23 04:30:24 -05:00
Kam 20dc8e0efc Fix Flying Gravity Syncing Issue 2026-02-23 04:11:07 -05:00
Kam adf9cd7012 Add Barrier Reflection! 2026-02-23 00:17:34 -05:00
Kam b5534b4a39 Lot's of Weird Ability Interaction Fixes 2026-02-22 22:39:33 -05:00
Kam 25320f8de1 Fix Remote Checks 2026-02-22 21:51:10 -05:00
Kam feecf8d991 Slam while flying 2026-02-22 21:35:43 -05:00
Kam d2d5bcc59b Various Fixes to CNPC Abilities
- super slow speed orb has weird properites, after awhile it flies weirdly
- Binding HUD scroll key to middle mouse button crashes client
- Zero Knockback still does knockback to CNPCs
- Charge: the telegraph is where you are looking but you actuually charge where your current body rotation is instead
- using slam mid air makes it not work correctly
- Beam disappears after going out of the render distance but still fires
- Player vortex can only pull one target

Slam now takes current height when being used to calculate damage
2026-02-22 21:19:44 -05:00
Kam ec60a9bb21 Request Client Packet Fix NPC [Invisibility Patch] 2026-02-22 18:24:36 -05:00
Kam da2604e3d6 Merge branch 'dev' into syntax-highlighter-unified 2026-02-22 17:16:30 -05:00
Kam 0f00bd6ba3 Why 2026-02-22 17:16:23 -05:00
Kam f3fcfd96d3 Merge branch 'dev' into syntax-highlighter-unified 2026-02-22 16:58:31 -05:00
Kam 57528f9590 Disable Request Spawn Data 2026-02-22 16:57:49 -05:00
Kam c0ce53a814 Merge branch 'dev' into syntax-highlighter-unified 2026-02-22 16:46:18 -05:00
Kam c081efd42e Remove this Profile Block 2026-02-22 16:46:05 -05:00
Kam 2a3417e31b Beta 7 2026-02-22 16:42:49 -05:00
Kam 0c4238dfb4 Update SkinOverlay.java 2026-02-22 16:35:04 -05:00
Kam 23aa11e316 Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2026-02-22 16:33:03 -05:00
Kam 3de8cd49b6 Better Filename Handling for Abilities, Dash Directional Improvements, Fixed Duplicate Ability Name Handling 2026-02-22 16:33:01 -05:00
Vidal 4500b10d7f getColor and setColor to skin overlays 2026-02-22 18:03:37 -03:00
Kam 71dbf77def Skip Tick 0 for Rendering 2026-02-22 15:39:24 -05:00
Kam de92d57f13 Fix some Projectile Firing 2026-02-22 15:02:14 -05:00
Kam f818568bd3 Fix Panel Held / Anchored Mode 2026-02-22 14:16:40 -05:00
Kam 9a1bd5f2f8 Explosion Client-Side only 2026-02-22 14:09:33 -05:00
Vidal d3ca0622e4 Modified base energy abilities hit types 2026-02-22 15:15:21 -03:00
Kam 7b6e378121 Energy Explosions 2026-02-22 05:41:28 -05:00
Kam f58a6010d9 Reorganize 2026-02-22 03:28:56 -05:00
Kam 18968bf7c7 Fix Firing Energy Projectiles and Make Charging State purely visual 2026-02-22 03:07:37 -05:00
Kam 3a8f829de9 Merge remote-tracking branch 'origin/dev' into dev 2026-02-21 20:39:37 -05:00
Kam b6749e306b Add Hit Type to Projectiles 2026-02-21 20:39:16 -05:00
Kam b4334c2835 Fix Chained Abilities not Saving 2026-02-21 18:18:56 -05:00
Kam 79fa879eb6 Merge branch 'dev' into syntax-highlighter-unified 2026-02-21 17:44:01 -05:00
Kam 26da3ae2f9 1.11 Beta 6.1 2026-02-21 17:43:41 -05:00
Kam 61d253638a Fix Server Side Crash 2026-02-21 17:10:48 -05:00
Kam 8e73428458 Update RequestProperSpawnData.java 2026-02-21 16:50:23 -05:00
Kam 64e7a5153e Fix Crosshair Alignment 2026-02-21 16:49:21 -05:00
somehussar 3b198c927c Fix crash 2026-02-21 22:39:12 +01:00
Vidal 51f35bae56 Merge remote-tracking branch 'origin/dev' into dev 2026-02-21 17:41:04 -03:00
Kam 8873705ce7 Fix Some Flying Logic 2026-02-21 15:28:59 -05:00
Vidal e194bd71cd Fixed setRace 2026-02-21 17:13:42 -03:00
Kam 520c810476 Merge branch 'dev' into syntax-highlighter-unified 2026-02-21 14:47:33 -05:00
Kam 55370b26a0 1.11 Beta 6 2026-02-21 14:47:26 -05:00
Kam 381da07b46 Merge branch 'dev' into syntax-highlighter-unified 2026-02-21 14:46:24 -05:00
Kam 21f6353188 Merge remote-tracking branch 'origin/dev' into dev 2026-02-21 14:40:27 -05:00
Kam ecfedff9d2 - Barrier Health Scaling with DBC Addon
- Healing Health Scaling with DBC Addon
- Ki Attacks collided with Barriers
- Remove Ability Slot (Deprecated)
- Refactored Naming Scheme for Barrier Abilities
- Fixed Player Settings for Ignore Dex, DBC Stats, etc.
2026-02-21 14:40:14 -05:00
Vidal 7d5ad7abfe Energy charge data for future implementation 2026-02-21 13:21:16 -03:00
Vidal 72c6c004b0 Changed condition summary to use filter names 2026-02-21 11:58:53 -03:00
Kam 04679a3406 Disable Projectile and Slicer 2026-02-21 05:24:33 -05:00
Kam 3e58013ad6 Various Fixes 🐶 2026-02-21 05:09:00 -05:00
Kam 12c50d5f6a Whoops Forgot to Sync NBTs 2026-02-21 04:56:53 -05:00
Kam 06809933ed Update API 2026-02-21 04:42:07 -05:00
Kam 3921b3e654 Dash Directional Key 2026-02-21 04:42:00 -05:00
Kam e210bac2bf Fix Caster Positoning and Lock / Movement Dashing Abilities 2026-02-21 04:41:51 -05:00
Kam aa58cf8041 Fix DBC Turbo Bounceback in Liquid and Lava 2026-02-21 04:41:14 -05:00
Kam 0a6d9e1ef9 Merge remote-tracking branch 'origin/dev' into dev 2026-02-21 04:15:30 -05:00
Kam 5b52c817d7 Add New Dash Directional 2026-02-21 04:11:39 -05:00
Kam 4dde214f94 Fix Persistent Ability Entities 2026-02-21 04:11:28 -05:00
Kam 6369cb2b65 Better Animation Snapping 2026-02-21 03:48:50 -05:00
Kam f538cebd03 Fix Custom Effects Preview with Height 2026-02-21 03:33:54 -05:00
Kam ce310da9ca Merge remote-tracking branch 'origin/dev' into dev 2026-02-21 03:32:01 -05:00
Kam 9dac3d01d9 Show Attributes on Items in Auction House 2026-02-21 03:31:44 -05:00
bigguy345 bc3a622d1b Merge branch 'dev' into syntax-highlighter-unified 2026-02-21 10:31:10 +02:00
Kam ef276b8145 Merge remote-tracking branch 'origin/dev' into dev 2026-02-21 03:28:29 -05:00
Kam 1b5584c585 Has Effect and Class Condition 2026-02-21 03:28:16 -05:00
Kam 5c975a339d Show Attributes on Items in Auction House 2026-02-21 03:24:20 -05:00
bigguy345 3cdc932684 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-02-21 10:18:48 +02:00
Kam 185f06822a Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2026-02-21 03:04:19 -05:00
Kam f2ac1f1817 Fix Effects Height 2026-02-21 03:04:14 -05:00
Kam 75a58f7e74 Condition Registry [2/2] 2026-02-21 03:03:42 -05:00
Kam 606bc093df Condition Registry [1/2] 2026-02-21 02:36:41 -05:00
Vidal 8648e019a9 Changed some logic on conditions for automatically checking all filters 2026-02-21 03:24:27 -03:00
Kam 99de894d3f Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2026-02-21 01:10:06 -05:00
Kam 94c4e76823 Update api 2026-02-21 01:09:47 -05:00
Kam a18503dfe9 Fix Domes 2026-02-21 01:09:39 -05:00
KamandClaude Opus 4.6 b3357a2751 Fix dome melee for all radii with server-side tick detection
MC's processUseEntity uses player.getDistanceSqToEntity(dome) for reach
validation, which computes center-to-center distance. For domes with
radius > 5, this always exceeds the 36-block threshold, making melee
impossible regardless of how close the player is to the surface.

Fix: server-side processMeleeHits() in onUpdate detects swinging players
near the dome surface via ray-sphere intersection, then calls
attackTargetEntityWithCurrentItem directly — bypassing MC's broken reach
check while preserving full damage calculation (enchantments, crits, etc).

Also adds adjustMeleeBoundingBox for client-side entity picking (places a
small 2x2x2 BB at the nearest sphere surface point toward the player),
and allows melee targeting from both inside and outside the dome.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-21 00:57:49 -05:00
KamandClaude Opus 4.6 e711a9012b Fix barrier solid/knockback behavior and dome melee targeting
- Rewrite solid system to use reactive crossing detection (prevPos comparison)
  instead of prediction-based teleportation that caused client rubber-banding
- Reduce knockback force (0.06 multiplier) so it pushes without fully blocking
- Add client-side solid prediction for smooth movement blocking (local player only)
- Fix dome melee from inside: canBeCollidedWith returns false when player is inside
- Fix dome melee from outside: getCollisionBorderSize set to 0 to prevent raycast
  from returning far exit point beyond reach distance
- Clean up dome bounding box: use setPosition/updateBoundingBox instead of custom setSize

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-20 23:55:32 -05:00
Vidal acb99b5c48 Added percent option to ConditionHPThreshold and added EQUAL comparison type 2026-02-21 01:21:33 -03:00
Vidal 36babe51cc Added ConditionItem and increased the max amount of conditions an ability can hold to 5 2026-02-21 01:12:57 -03:00
Vidal fb938c2b7d Fixed charge and orb active anim 2026-02-21 01:12:30 -03:00
Vidal 8384b6dd64 Merge remote-tracking branch 'origin/dev' into dev 2026-02-20 22:49:11 -03:00
Vidal 42b7d7e42e A few orb and beam changes and rotation sync for body and head during animations 2026-02-20 22:48:59 -03:00
luisc 0a85bb5a7b - fixed dome collisions
- changed dome alpha rendering
- removed open container check for abilities
2026-02-20 19:36:45 -06:00
Vidal 89e87b7656 Condition overhaul completed 2026-02-20 21:36:08 -03:00
somehussar a2e0bb50b9 Apparently the import got removed. 2026-02-21 00:27:31 +01:00
Kam 88dee1f544 Merge remote-tracking branch 'origin/dev' into dev 2026-02-20 18:17:11 -05:00
Kam f620e820e8 Dome, Panel Settings 2026-02-20 18:16:52 -05:00
somehussar 15486a1ea8 Merge remote-tracking branch 'upstream/dev' into dev 2026-02-21 00:04:33 +01:00
somehussar c121d0c4e2 Fix missing spawndata. 2026-02-21 00:03:48 +01:00
Vidal 09c2085270 Overhauled Condition system 2026-02-20 18:58:41 -03:00
Kam 14545818bd Fix Animation Syncing for Built in 2026-02-20 13:13:45 -05:00
Kam cb57e26d04 Modified Damage on Energy Projectile System 2026-02-20 03:51:11 -05:00
Kam a6265d7ba3 Forgot to Commit modifyProjectileDamage 2026-02-20 03:50:56 -05:00
Kam 4bd149c01b Check Barrier Collisions within Laser Shot 2026-02-20 03:50:41 -05:00
Kam bc9342c2eb Guard Ability now reflects it has Damage when it canCounter 2026-02-20 03:50:07 -05:00
Kam 5edc9b5047 Allow Externals to Modify Projectile Damage 2026-02-20 03:49:50 -05:00
Kam 44118ec770 Complete Ability Hud System + Added-Per-Ability Cooldown System to be Reflected in Hud and Hud GUI 2026-02-20 03:47:12 -05:00
Kam 877fe2b275 Fix Conditions Build Error 2026-02-20 03:33:58 -05:00
Kam 86fe9fd6bb Sweeper Height and Width Configs 2026-02-20 02:17:11 -05:00
Kam 747918c4dc Better Barrier Tracking 2026-02-20 02:17:00 -05:00
Kam 077fc3cb1d Better Telegraph Tracking 2026-02-20 02:16:40 -05:00
Kam 5e24a0cf36 Fixed Dazed Handling 2026-02-20 02:16:26 -05:00
Kam 0d871b16bf Line of Sight Handling for Cutter and Heavy Hit 2026-02-20 02:16:07 -05:00
Kam 1f31ae94c1 Charge and Slam Fixes 2026-02-20 02:15:51 -05:00
Kam 549dfaa1b9 Merge remote-tracking branch 'origin/dev' into dev 2026-02-20 01:59:46 -05:00
Kam fc8e2e9e7f Create Ability Hud Editor and Remove Ability Wheel. 2026-02-20 01:59:01 -05:00
Vidal d9b63038dd Ability Conditions overhaul WIP 2026-02-19 23:32:50 -03:00
Kam 1e8844a3e9 Merge branch 'dev' into syntax-highlighter-unified 2026-02-19 20:10:22 -05:00
Kam 8f76e007e4 1.11 Beta 5 2026-02-19 20:08:00 -05:00
Kam c2f9fdb47f Merge branch 'dev' into syntax-highlighter-unified 2026-02-19 20:06:47 -05:00
Vidal 2929b0b37a Updated 2026-02-19 21:58:38 -03:00
Vidal eca9cd9d16 Merge remote-tracking branch 'origin/dev' into dev 2026-02-19 21:41:14 -03:00
Vidal 9ec0f767a6 Ability Hotbar changes 2026-02-19 21:40:36 -03:00
Kam d397cabd51 Merge remote-tracking branch 'origin/dev' into dev 2026-02-19 19:28:11 -05:00
Kam f7d0fbcf33 Rendering Fixes and Logic Fixes for all Energy Abilities 2026-02-19 19:27:56 -05:00
bigguy345 ba520c3224 Merge branch 'dev' into syntax-highlighter-unified 2026-02-20 01:18:17 +02:00
Kam 235722fb3a Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2026-02-19 16:11:36 -05:00
Kam bb7791c691 Fix Textfield 2026-02-19 16:11:34 -05:00
Kam 024718e7f4 - Fix Sub GUI interactions for Built-In Abilities
- Allow Status Effect Selection from DBC Addon End
2026-02-19 15:39:06 -05:00
bigguy345 6c12c9e742 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-02-19 22:25:43 +02:00
bigguy345 4764b8eb30 Enabled script console 2026-02-19 22:24:31 +02:00
Kam a94219cd0d Fix Some GUI Saving Bugs in Abilities and Chained Abilities 2026-02-19 14:57:10 -05:00
Vidal 755a9313e4 Merge remote-tracking branch 'origin/dev' into dev 2026-02-19 16:20:23 -03:00
Vidal 45eee2be66 Custom Effect changes 2026-02-19 16:20:13 -03:00
Kam 69568160bc Fixes with GUI for Picking Abilities and Allow Concurrency on DBC Toggles and Zone Abilities 2026-02-19 14:09:29 -05:00
Kam e54a9a83bb Create IAbilityEffect + Concurrent Ability Support for Chained Abilities 2026-02-19 12:55:37 -05:00
Kam 1e45d96253 Fix DBC Flying Issue with Abilities 2026-02-19 03:12:59 -05:00
Kam 6fdf9daf24 Add Max to Energy Entities to prevent any long-term issues / errors 2026-02-19 02:14:34 -05:00
Kam e330b517a8 Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2026-02-19 01:53:41 -05:00
Kam ff54c6d9af Enhance Textfield to allow CTRL Operations 2026-02-19 01:53:26 -05:00
Kam 0e4afecf1d Fix Burst For Projectiles 2026-02-19 01:52:21 -05:00
Kam 53185b4833 Merge remote-tracking branch 'origin/dev' into dev 2026-02-19 01:37:53 -05:00
Kam c3e4e2b54f Fix Textfield 2026-02-19 01:37:45 -05:00
Kam e91fe89e6a Add Inner Alpha Handling 2026-02-19 01:35:21 -05:00
Kam e5fc58366b Fix Death Ability Bug 2026-02-18 23:16:01 -05:00
Kam df6beb4f15 Merge branch 'dev' into syntax-highlighter-unified 2026-02-18 22:41:27 -05:00
Kam 9f8f742a0e Beta 4 2026-02-18 22:41:19 -05:00
Kam 0e6ece56c6 Fix DBC Toggle Abilities and Wheel System 2026-02-18 22:19:18 -05:00
Kam 40a02b73e2 Fixes to some GUI and Chained Abiltiy Logic for Clearing States 2026-02-18 15:31:33 -05:00
Kam 48f6c162d5 Bugs fixes to Abilities
- Add Hit Scan to Laser
- Switching Dimensions Ability fix
- Chained Ability Targeting Conditions Fix
- Chained Ability Previewing
- Lang Keys Added
2026-02-18 14:10:55 -05:00
Kam 1569204d83 - Extend Energy Projectile Distance to 150 by Default
- Fix a bug with Wheel not Clearing for Adding / Removing Abilities
- Fix a bug not being able to resolve Built In Abilities
- Fix a Chained Ability Windup System
2026-02-18 14:07:05 -05:00
Kam 1de1c4e710 Reformat Code 2026-02-18 05:13:51 -05:00
Kam 21e920426e Fix Sub Gui Spam Closing 2026-02-18 05:06:14 -05:00
Kam ca5461c94f Ability Wheel Accepts - Chained Abilities
Lang File Cleanup / Merging
Chained Ability Icon System
2026-02-18 04:57:28 -05:00
Kam 4510b3bbd1 Large Auction Cleanup + Auction Events
- Auction Enums
- Better Notification Handling
- Auction Cancelation Events
- Lang Key Cleanup
2026-02-18 04:55:03 -05:00
Kam 0512588a7a Add Chained Abilities 2026-02-18 04:02:51 -05:00
KamandClaude Opus 4.6 0311dc5806 Merge upstream dev: name-based storage, UUID/DisplayName, toggle system
Resolved conflicts in AbstractDataAbilities, DataAbilities, PlayerAbilityData
to integrate both toggle system (upstream) and chain delay tracking (local).
ChainedAbility now has UUID and DisplayName fields matching Ability pattern.
ChainedAbilityController rewritten: saves in abilities/chained/, dual-index
by name and UUID, legacy migration from chained_abilities/ directory.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-17 23:27:49 -05:00
KamandClaude Opus 4.6 2f814c1903 IAbilityAction interface, AbilityAction unified slot, and bug fixes
- Added IAbilityAction interface (internal + API) for unified Ability/ChainedAbility handling
- Created AbilityAction (replaces AbilitySlot) with 3 modes: INLINE_ABILITY, ABILITY_REFERENCE, CHAIN_REFERENCE
- Unified DataAbilities storage from dual lists to single List<AbilityAction>
- Added ChainedAbility, ChainedAbilityEntry, ChainedAbilityController
- Updated PlayerAbilityData with resolveActionKey() for chain: prefix resolution
- Added resolveAction/canResolveAction to AbilityController
- Fixed unsafe cast in DataAbilities.onDamage()
- Fixed NPE in GuiNPCAbilities for chain reference slots
- Fixed NPC chain interrupt double cooldown
- Fixed removeAbility() incorrectly removing chain references

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-17 23:22:03 -05:00
Kam 6514b217b9 Abilities are now Stored by Name not UUID. Refactor Built In and Toggleable Abilities 2026-02-17 23:08:12 -05:00
bigguy345 375c41daba Merge branch 'dev' into syntax-highlighter-unified 2026-02-18 05:32:25 +02:00
bigguy345 b4c0859759 Merge remote-tracking branch 'origin/syntax-highlighter-unified' into syntax-highlighter-unified 2026-02-18 05:26:29 +02:00
bigguy345 430ff7c3a8 Improve autocomplete for method reference contexts
- trigger completion after :: and detect method-reference receiver chains

- restrict suggestions to methods (plus constructor refs) in method-reference mode

- insert method names without parentheses when completing method references
2026-02-18 05:21:55 +02:00
bigguy345 e2b35d6d54 Method reference and SAM type resolution
- add full parser/type-resolver support for Java method and constructor references

- infer SAM callback types for named JS script methods with conflict reporting

- surface argument-level SAM/type mismatch errors in method validation
2026-02-18 05:21:42 +02:00
Kam f39d843c70 Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2026-02-17 21:03:58 -05:00
Kam 2bcf3b03d5 Refactoring and Bug Fixes 2026-02-17 21:03:54 -05:00
Vidal 90e146e7b0 Merge remote-tracking branch 'origin/dev' into dev 2026-02-17 23:02:39 -03:00
Vidal 8001a14d3a HeavyHit refactor
- Hit Delay ticks
2026-02-17 23:02:24 -03:00
Kam c7956a24a6 Abilities are now Stored by Name not UUID 2026-02-17 20:44:27 -05:00
Vidal bc336abf9d Proper register for ability variants 2026-02-17 20:41:07 -03:00
Vidal c6b2797b5d Attempt at implementing ability variants directly from the register 2026-02-17 20:11:42 -03:00
Vidal 52269705b5 Merge remote-tracking branch 'origin/dev' into dev 2026-02-17 19:38:52 -03:00
Kam 89158cb10a Ability Potion Effect 2026-02-17 17:37:51 -05:00
Kam fb5029796f Update AbilityEnergyProjectile.java 2026-02-17 17:32:54 -05:00
Kam dcd9572024 Merge branch 'barriers' into dev 2026-02-17 17:32:48 -05:00
Vidal 071cbc9890 Applied the fix to select gui as well 2026-02-17 18:38:58 -03:00
Vidal 55149ab5d1 Fixed the check that prevented built-in types from showing up in NPC Abilities 2026-02-17 18:31:47 -03:00
Vidal 7ed68b7efe Added dazed animation 2026-02-17 17:05:29 -03:00
Kam c07e9e7006 Create Barrier Abilities + Heavy Refactoring 2026-02-17 14:32:13 -05:00
Vidal cbc2b73625 Renamed AbstractEnergyProjectileAbility to AbilityEnergyProjectile 2026-02-17 01:49:07 -03:00
Vidal a296a533c9 Made registered animations load at once 2026-02-16 20:42:57 -03:00
Vidal dd6a27b915 Fixed wrong names being registered on Animation register and added debug to anim controller 2026-02-16 20:21:32 -03:00
Vidal d826206d31 Prevented anim controller from loading twice 2026-02-16 13:47:31 -03:00
Vidal 6506de70b8 Set Animation Controller to load on server start 2026-02-16 12:40:02 -03:00
Claude d1f2c9695c Fix panel directional check to only block incoming projectiles
The dot product was being computed but not used - panels were blocking
projectiles from both sides. Now correctly checks which side the
projectile approaches from and only blocks if it's moving toward
the panel surface.

https://claude.ai/code/session_01EV9KpiykvW4rASz7ju5iTG
2026-02-16 13:27:29 +00:00
Claude 0ebdfafccd Add Energy Barrier and Slicer ability system
Implements four new energy ability types:

- Energy Dome: Spherical barrier centered on caster that blocks incoming
  energy projectiles. Configurable per-projectile-type damage multipliers,
  HP/durability and duration modes. RING telegraph.

- Energy Wall: Placeable flat energy panel with configurable dimensions
  and height offset (can float above ground). Optional launching mode
  fires the wall forward with damage/knockback.

- Energy Shield: Held energy panel that follows the caster and rotates
  with their look direction. Defensive blocking ability.

- Energy Slicer: Thin wide blade projectile (JJK Cleave inspired).
  Extends AbstractEnergyProjectileAbility. Piercing by default.

Architecture:
- EnergyBarrierData: HP, duration, per-type damage multiplier map
- EnergyPanelData: Panel dimensions, height offset, launch properties
- AbstractEnergyBarrierAbility: Shared base for Dome/Wall/Shield
- EntityEnergyDome, EntityEnergyPanel, EntityEnergySlicer entities
- RenderEnergyDome, RenderEnergyPanel, RenderEnergySlicer renderers
  with translucent inner/outer layers (voxel-blocky aesthetic)
- Projectile-barrier collision system in EntityAbilityProjectile

https://claude.ai/code/session_01EV9KpiykvW4rASz7ju5iTG
2026-02-16 08:54:55 +00:00
Kam 2a5dd6dfd6 Merge branch 'dev' into syntax-highlighter-unified 2026-02-16 01:59:25 -05:00
Kam 01e18e0221 Beta 3 2026-02-16 01:49:57 -05:00
Kam 6c8e15c014 Update api 2026-02-16 01:40:53 -05:00
Kam f4ad421c2e Player Ability Checking
Enhance ability validation: add method to check if an ability can be resolved without deep copy and prune invalid unlocked abilities during load
2026-02-16 01:40:51 -05:00
Kam cd28f69a0e Enhance ability validation: add method to check if an ability can be resolved without deep copy and prune invalid unlocked abilities during load 2026-02-16 01:39:14 -05:00
Kam 21b1571868 Add flight checker to prevent abilities from affecting flying players 2026-02-16 01:15:52 -05:00
Kam e722279009 Update API hash to reflect recent changes 2026-02-16 01:03:35 -05:00
Kam 071d89cc15 Add energy projectile types and events: implement IEnergyOrb, IEnergyBeam, IEnergyDisc, and IEnergyLaser interfaces, along with their respective script handlers and event hooks 2026-02-16 01:03:05 -05:00
Kam 1ed012331b Enhance ability input handling: block movement during ability locks, ensure proper input suppression, and cancel abilities on logout, dimension change, death, and respawn 2026-02-15 23:15:50 -05:00
Kam 121563ba24 Enhance knockback mechanics: add methods for applying and forcefully applying knockback, respecting or ignoring knockback resistance 2026-02-15 23:07:57 -05:00
Kam 19e2882c4a Merge remote-tracking branch 'origin/dev' into dev 2026-02-15 22:04:55 -05:00
Kam 1fb52a4ae9 Refactor movement abilities: extract shared logic into AbilityMovement class for Charge and Dash abilities 2026-02-15 22:04:47 -05:00
Kam 248dbf66da Enhance ability animation handling: track ability animation state, clear orphaned animations on login, and ensure proper animation continuation 2026-02-15 22:03:32 -05:00
Kam 3beaf68815 Update GuiNPCAbilities.java 2026-02-15 21:44:36 -05:00
Kam eda8931b5f Refactor entity owner checks and enhance FULL_MODEL rotation support in ability entities 2026-02-15 21:29:26 -05:00
Kam ce24c0a4ff Enhance ability selection and display: add toggleable ability handling, improve ability name color coding, and update ability selection messaging 2026-02-15 19:21:30 -05:00
Kam 45d05b9157 Add trap presets & trigger-reveal visuals
Introduce client-side trap presets and a visual "trigger reveal" for traps, plus related entity/renderer changes.

- AbilityTrap: add TrapPreset enum and applyTrapPresetDefaults; wire a SubGuiTrapPresetSelector hook to apply presets from the GUI; pass visibility into created trap entities.
- EntityAbilityZone: add visible flag, TRIGGER_FLASH_STATUS state, setEntityState usage to notify clients of triggers, handleHealthUpdate to start client-side flash, and adjust construction/serialization accordingly.
- RenderAbilityZone: implement trigger-reveal visuals (revealFade, triggerReveal) that briefly show a burst when traps trigger, skip rendering for invisible traps unless revealing, and tweak flash/timing logic.
- Minor cleanup: remove/condense comment blocks and refactor noisy helpers across AbilityZone/AbilityHazard, plus language entry update and new SubGuiTrapPresetSelector GUI class.

These changes enable preset application for traps and improve client-side feedback when traps trigger.
2026-02-15 19:19:57 -05:00
Kam 89464ce6c0 Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2026-02-15 18:16:01 -05:00
Kam 2dfdfb19d1 Client-side trade validation and stock update
Perform more complete client-side checks before predicting currency deductions in GuiNPCTrader.handleMouseClick. The method now verifies that the item can be given to the player (canGivePlayerClient), that the slot is enabled, and that stock is available, mirroring server-side checks. When a client-side purchase is accepted, availableStock is decremented if applicable. Added a private canGivePlayerClient(ItemStack) helper to check cursor-stack compatibility and max stack size. These changes prevent the UI from showing incorrect balances for trades the server would reject.
2026-02-15 18:15:56 -05:00
Kam ff9f9b9660 Enhance ability variant selection: inject a default "Base" variant when no built-in variants are available 2026-02-15 18:05:07 -05:00
Kam 8c2ef1084a Fix Burst Refire 2026-02-15 17:47:44 -05:00
KamandClaude Opus 4.6 e466ef6771 Remove Ki Cost from base Ability - DBC-specific concern
Ki Cost belongs in the DBC Addon's DBCAbilityStats system,
not in the base ability infrastructure.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-15 04:47:19 -05:00
Vidal 61405add97 Added Ki Cost to Ability 2026-02-15 00:40:43 -03:00
Kam 0f774a68fc Refactor ability handling: replace damage handler with ability extenders for improved lifecycle management and damage routing 2026-02-14 21:06:12 -05:00
Kam 5a9b9a1feb Merge branch 'dev' into syntax-highlighter-unified 2026-02-14 20:52:24 -05:00
Kam f8c75dd79b Fix Burst Refiring 2026-02-14 20:08:56 -05:00
Vidal f03d93d6a8 Oopsie i swapped commits, last commit was changing min values on anchor offset fields 2026-02-14 19:43:34 -03:00
Vidal 3be9104ec3 Made min and max double neg/pos infinity 2026-02-14 19:43:03 -03:00
Kam a23b199e7e Refactoring for Code Cleanup and Projectile Abstract Class Handling 2026-02-14 15:21:56 -05:00
Vidal a1f3f5184b Changed anchor offsets min values 2026-02-14 17:05:17 -03:00
Vidal 331361f21e Merge remote-tracking branch 'origin/dev' into dev 2026-02-14 17:04:21 -03:00
Vidal 19fb0ff5b7 Changed how float text fields handle negative values 2026-02-14 17:03:59 -03:00
Kam da4ee2e20d Refactor ability management: enhance deep copy functionality, streamline custom ability handling, and update versioning logic 2026-02-14 14:43:25 -05:00
Vidal e1eda3ce19 Added an option to register multiple animations under one common name 2026-02-14 16:22:53 -03:00
Vidal 7009bddc20 Merge remote-tracking branch 'origin/dev' into dev 2026-02-14 15:01:24 -03:00
Vidal 41d3361209 Added dazed animation 2026-02-14 11:26:02 -03:00
Kam 85874d4eb5 Merge branch 'dev' into syntax-highlighter-unified 2026-02-14 04:04:23 -05:00
Kam 2a1a5643d3 Potion Effect System + Manual and Remove Bulk 2026-02-14 04:04:13 -05:00
Kam 85db3df355 feat: implement player ability state management with rotation and position locking 2026-02-14 04:02:01 -05:00
Kam befebdb9f7 refactor: enhance collision detection for ability movement 2026-02-14 04:02:01 -05:00
KamandClaude Opus 4.6 9fcda980ee fix: convert gradle-plugins from directory to submodule
Matches dev branch's submodule reference so branch switching works seamlessly.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-14 03:57:40 -05:00
Kam 0b0dcdc58d feat: implement player ability state management with rotation and position locking 2026-02-14 03:50:28 -05:00
Kam ab1f0d7f92 Merge branch 'dev' into syntax-highlighter-unified 2026-02-13 18:43:11 -05:00
Kam 09ab6458a1 refactor: enhance collision detection for ability movement 2026-02-13 16:28:45 -05:00
Kam 910f3b3744 Add NPC inline edit support and adjust ability launch mechanics 2026-02-13 15:01:28 -05:00
Kam f4d7861a9d fix: prevent special key detection when a screen is open 2026-02-13 14:52:58 -05:00
Kam 185d915928 refactor: simplify NBT reading for ability properties and potion effects 2026-02-13 14:17:17 -05:00
Vidal d4100c61dc Merge remote-tracking branch 'origin/dev' into dev 2026-02-13 12:56:15 -03:00
Kam f16c8ae115 Merge branch 'dev' into syntax-highlighter-unified 2026-02-12 21:08:21 -05:00
bigguy345 ac223cbb53 IAction exceptions now report to script console 2026-02-13 04:06:59 +02:00
Kam bc9fd53ae8 Beta 2 2026-02-12 20:35:03 -05:00
Kam 105d274955 Merge branch 'dev' into syntax-highlighter-unified 2026-02-12 20:33:44 -05:00
Kam 5d682962be feat: add BuiltInAbilityGetPacket for requesting built-in abilities by name 2026-02-12 20:30:45 -05:00
Kam 0cb5a993c7 Merge remote-tracking branch 'origin/dev' into dev 2026-02-12 20:30:27 -05:00
Kam 2c00ecae9e feat: add built-in ability handling and UI updates for ability management 2026-02-12 20:30:12 -05:00
Kam 356ae65b69 Fix Dialog and Quest Category Bug 2026-02-12 20:28:50 -05:00
Vidal 68cd3cd812 Merge remote-tracking branch 'origin/dev' into dev 2026-02-12 21:21:43 -03:00
Kam 9dae4bae55 feat: enhance damage handling for abilities and implement guard counter mechanics 2026-02-12 18:53:40 -05:00
Vidal 0e7a6c9fe1 Merge remote-tracking branch 'origin/dev' into dev 2026-02-12 20:39:50 -03:00
Kam 6f9cafa141 Add Custom Particle Handling and Preset Handling to Trap and Hazards 2026-02-12 18:15:41 -05:00
Vidal b13919b7b3 Merge remote-tracking branch 'origin/dev' into dev 2026-02-12 18:49:31 -03:00
Vidal bf3391a1a8 Made trap windup a bit slower to match the animation
Made the previously only hazard animation play on both hazard and trap
2026-02-12 18:46:11 -03:00
Kam 2d3106a256 Fix Zone Defaults 2026-02-12 15:01:19 -05:00
Vidal ab1de29e47 Merge remote-tracking branch 'origin/dev' into dev 2026-02-12 16:24:26 -03:00
Kam 64ba087cc5 Merge Conflict Compile Issues 2026-02-12 14:07:03 -05:00
Kam 3500b0f55f Ability Trap & Hazard Update 2026-02-12 13:55:56 -05:00
Vidal edc63b7200 Merge remote-tracking branch 'origin/dev' into dev 2026-02-12 14:15:27 -03:00
Vidal 70ed5a0717 Hotfix² 2026-02-12 14:13:37 -03:00
Vidal 20dd01f8e6 Merge remote-tracking branch 'origin/dev' into dev 2026-02-12 14:02:43 -03:00
Vidal c2c571ae7e Hotfix 2026-02-12 14:02:00 -03:00
Vidal be23823404 Merge remote-tracking branch 'origin/dev' into dev 2026-02-12 13:48:30 -03:00
Vidal 8a3b0b9866 why... 2026-02-12 13:48:15 -03:00
Vidal 5b8e5ea338 Merge remote-tracking branch 'origin/dev' into dev 2026-02-12 13:24:44 -03:00
Vidal 540903d71f Changed Abilities register method call 2026-02-12 13:24:28 -03:00
Vidal cac27535f8 Charge animation 2026-02-12 13:03:57 -03:00
Vidal 171578ad9b Fixed heavy hit animation 2026-02-12 12:52:58 -03:00
Vidal 0dc6f9aab3 Orb Barrage animation 2026-02-12 12:38:13 -03:00
Vidal eee9b32a5b Added eye anchor point using the entity's eye height 2026-02-12 12:14:21 -03:00
Vidal 91762bb1ba Hazard animation 2026-02-12 11:28:00 -03:00
Vidal bd6953008b Merge remote-tracking branch 'origin/dev' into dev 2026-02-12 11:01:49 -03:00
Vidal 974cfc8c56 Changed fire delay for dual disc 2026-02-12 10:59:42 -03:00
Vidal 4d19e90c0d Merge remote-tracking branch 'origin/dev' into dev 2026-02-12 10:22:52 -03:00
Kam d76f5d40a4 Prevent Passive Factions from taking Damage 2026-02-08 01:46:13 -05:00
Kam 2387ece1ff Update Abilities to Support Player Casting (Part 1) 2026-02-08 01:32:18 -05:00
Kam c05b6e60b8 Update AbilityDash.java 2026-02-07 17:07:05 -05:00
Kam 0fcf37542b Update AbilityDash.java 2026-02-07 15:31:49 -05:00
Kam 9054abadeb Fix Ability 2026-02-07 01:54:16 -05:00
Kam e541f4145a Merge remote-tracking branch 'origin/dev' into dev 2026-02-06 22:43:43 -05:00
Kam 4c5e44fb22 Add anchor offset methods and update ability variant selection UI 2026-02-06 22:43:07 -05:00
Kam 12380d838b lighning 2026-02-06 22:39:47 -05:00
Kam 74cae17ebd Burst and Dual Mode + Variant Ability Support 2026-02-06 20:25:52 -05:00
Kam af02b0ab1d Various Fixes 2026-02-06 16:28:38 -05:00
Kam 2e5c4c3bf4 Fix Preview Handling for Abilities, Fix Disc Positioning in Real World 2026-02-06 05:04:19 -05:00
Kam 70583743ce Fix Ability and Custom Button 2026-02-06 03:36:32 -05:00
Kam 55cd8cc5b3 Fix Rotation Locking 2026-02-06 03:34:45 -05:00
Kam 4f7773eb3f Fix Preview Entity 2026-02-06 03:34:29 -05:00
Kam 095709b9d2 Add ability wheel and toggle abilities for enhanced gameplay 2026-02-05 22:49:40 -05:00
Vidal 572e94cf33 Merge remote-tracking branch 'origin/dev' into dev 2026-02-04 23:53:19 -03:00
Kam 45a4313b70 Enhance ability system with position locking and duplicate name confirmation for presets 2026-02-04 21:50:39 -05:00
Vidal 921ec259ee Merge remote-tracking branch 'origin/dev' into dev 2026-02-04 23:30:37 -03:00
Vidal a38c2f83ef Merge remote-tracking branch 'origin/dev' into dev 2026-02-04 06:23:17 -03:00
Vidal 9449d1d0f3 Merge remote-tracking branch 'origin/dev' into dev 2026-02-04 06:18:14 -03:00
Vidal 69ee5eae48 Merge remote-tracking branch 'origin/dev' into dev 2026-02-04 05:09:58 -03:00
Vidal f2673803ee Merge remote-tracking branch 'origin/dev' into dev 2026-02-03 13:28:18 -03:00
Vidal aa05ef75bb Merge remote-tracking branch 'origin/dev' into dev 2026-02-03 07:45:36 -03:00
Vidal dbafb2cace Merge remote-tracking branch 'origin/dev' into dev 2026-02-03 02:45:35 -03:00
Vidal f127a2fa7c Merge remote-tracking branch 'origin/dev' into dev 2026-02-02 03:03:39 -03:00
Vidal d644f72eae Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 20:53:24 -03:00
Vidal f91baaa6f6 Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 20:49:47 -03:00
Vidal de5b62343d Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 20:44:44 -03:00
Vidal 0de310c5db Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 20:39:28 -03:00
Vidal 3b7f9627eb Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 20:27:34 -03:00
Vidal 90a542b6b1 Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 20:09:29 -03:00
Vidal f6598205fd Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 06:51:41 -03:00
Vidal 943605c3e7 Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 06:46:33 -03:00
Vidal 2ba3bd2148 Added a bunch of ki-based abilities 2026-02-01 06:06:14 -03:00
Vidal aa4e565646 Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 04:28:55 -03:00
Vidal 3a16fc3e4e Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 02:04:23 -03:00
Vidal 74521c9672 Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 01:02:32 -03:00
Vidal 07292b4d6b Merge remote-tracking branch 'origin/dev' into dev 2026-02-01 00:10:36 -03:00
Vidal 9b3f35f6b4 Merge remote-tracking branch 'origin/dev' into dev 2026-01-31 19:22:58 -03:00
Vidal c9c44d6bf8 Merge remote-tracking branch 'origin/dev' into dev 2026-01-31 16:48:35 -03:00
Vidal 3f086c8046 Merge remote-tracking branch 'origin/dev' into dev 2026-01-30 12:34:16 -03:00
Vidal 71860e8dba Merge remote-tracking branch 'origin/dev' into dev 2026-01-29 23:47:53 -03:00
Vidal a1038c0e5b Merge remote-tracking branch 'origin/dev' into dev 2026-01-29 00:36:15 -03:00
Vidal 3513c92a22 Merge remote-tracking branch 'origin/dev' into dev 2026-01-27 19:17:21 -03:00
Vidal 606cb060fa Merge remote-tracking branch 'origin/dev' into dev 2026-01-26 19:11:22 -03:00
Vidal 4f873437d8 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	src/api
2026-01-26 00:53:20 -03:00
Vidal 1b755d7c87 part 3? 2026-01-26 00:48:31 -03:00
Kam 8e9d2fedc5 Hitbox Fixes 2026-01-19 16:29:50 -05:00
PeTcHeNkA 6e2fe788d2 Improve readability in getEntityTexture#RenderNPCInterface 2025-12-24 03:50:03 +03:00
PeTcHeNkA 9f30438c4f Validate ResourceLocation existence before assignment in getEntityTexture
Previously, skinType==0 branch created a ResourceLocation directly without
checking if the resource actually exists. This was inconsistent with
adjustLocalTexture(), which probes the ResourceManager and falls back on
missing assets.

Now we call Minecraft.geMinecraft().getResourceManager().getResource(resLoc)
and catch IOException. On failure, we fall back to a valid texture via
fallBackSkin(npc), ensuring rendering always uses a valid path and avoiding
invalid ResourceLocation assignments.

This change aligns behavior across texture loading paths and prevents
rendering errors when NPC textures are missing.
2025-12-24 03:39:33 +03:00
PeTcHeNkA 6cce314341 fix: add fallback skin for invalid CustomNPC texture paths
- Add empty string check in skinType 0 else branch
- Set textureLocation to fallBackSkin(npc) for invalid textures
- Add null safety check before returning textureLocation
- Prevents transparent NPCs when invalid paths like "customnpcs:textures/entity/test.png" or "teststring" are used
2025-12-24 03:28:09 +03:00
774 changed files with 86141 additions and 34195 deletions

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
<script>
(function() {
// Fix uppercase text in table cells
// Javadoc 11: method names are in th[scope="row"] a, not td a
function fixCase() {
document.querySelectorAll("th[scope='row'] a, td a, .memberNameLink a").forEach(function(el) {
var t = el.textContent.trim();
if (t.length > 2 && t === t.toUpperCase() && t.indexOf(" ") === -1) {
el.textContent = t.toLowerCase();
}
});
}
// Correct navPadding = topNav height + subNav height
// Uses !important to override jQuery's inline style
function fixPadding() {
var topNav = document.querySelector(".topNav");
var subNav = document.querySelector(".subNav");
var pad = document.querySelector(".navPadding");
if (!pad) return;
var h = (topNav ? topNav.offsetHeight : 0) + (subNav ? subNav.offsetHeight : 0);
if (h > 0) {
pad.style.setProperty("padding-top", h + "px", "important");
}
}
document.addEventListener("DOMContentLoaded", function() {
fixCase();
// Run fixPadding after jQuery has had its chance
setTimeout(fixPadding, 0);
setTimeout(fixPadding, 50);
setTimeout(fixPadding, 200);
// Use MutationObserver to permanently override any further jQuery writes
var pad = document.querySelector(".navPadding");
if (pad) {
var observer = new MutationObserver(function() {
fixPadding();
});
observer.observe(pad, { attributes: true, attributeFilter: ["style"] });
}
});
})();
</script>
+11
View File
@@ -0,0 +1,11 @@
<div id="javadoc-header">
<a href="/CustomNPC-Plus/" class="header-brand">
<div class="header-title">
CustomNPC+
<span>Javadoc Reference</span>
</div>
</a>
<a href="/CustomNPC-Plus/" class="header-back">
Back to Index
</a>
</div>
+954
View File
@@ -0,0 +1,954 @@
/* ============================================================
CustomNPC+ — Javadoc Theme (Javadoc 11)
Tokyo Night — Styled Edition
============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');
:root {
/* ── Tokyo Night palette ── */
--bg: #1a1b26;
--bg2: #1f2335;
--bg3: #24283b;
--bg-elevated: #292e42;
--border: #3b4261;
--border2: #414868;
--text: #c0caf5;
--text-mid: #a9b1d6;
--text-dim: #565f89;
--green: #9ece6a;
--green-dim: rgba(158, 206, 106, 0.12);
--blue: #7aa2f7;
--blue-dim: rgba(122, 162, 247, 0.12);
--amber: #e0af68;
--amber-dim: rgba(224, 175, 104, 0.10);
--purple: #bb9af7;
--purple-dim: rgba(187, 154, 247, 0.10);
--cyan: #7dcfff;
--cyan-dim: rgba(125, 207, 255, 0.10);
--red: #f7768e;
--highlight-bg: rgba(122, 162, 247, 0.08);
--hover-bg: rgba(187, 154, 247, 0.08);
--nav-h: 44px;
--subnav-h: 36px;
/* ── Font stacks ── */
--font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
--font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
}
* { box-sizing: border-box !important; }
html, body {
height: 100%;
}
body {
background: var(--bg) !important;
color: var(--text) !important;
font-family: var(--font-mono) !important;
font-size: 13px !important;
line-height: 1.6 !important;
margin: 0 !important;
padding: 0 !important;
min-height: 100vh !important;
display: flex !important;
flex-direction: column !important;
}
.skipNav { display: none !important; }
/* ══════════════════════════════════════════════
NAVIGATION
══════════════════════════════════════════════ */
.fixedNav {
position: fixed !important;
top: 0 !important; left: 0 !important; right: 0 !important;
z-index: 100 !important;
}
/* Top bar — gradient accent stripe on top */
.topNav {
position: relative !important;
background: var(--bg2) !important;
border-bottom: 1px solid var(--border) !important;
height: var(--nav-h) !important;
margin: 0 !important; padding: 0 !important;
display: flex !important;
align-items: stretch !important;
overflow: visible !important;
}
/* Gradient accent line across the very top */
.topNav::before {
content: '' !important;
position: absolute !important;
top: 0 !important; left: 0 !important; right: 0 !important;
height: 2px !important;
background: linear-gradient(90deg, var(--blue), var(--purple), var(--cyan)) !important;
z-index: 10 !important;
}
/* Nav list — leave room on right for brand */
.topNav > ul.navList {
list-style: none !important;
margin: 0 !important;
padding: 2px 0 0 8px !important;
padding-right: 320px !important;
display: flex !important;
align-items: stretch !important;
flex-shrink: 0 !important;
}
.topNav > ul.navList > li {
display: flex !important;
align-items: center !important;
margin: 0 !important;
padding: 0 16px !important;
height: var(--nav-h) !important;
font-family: var(--font-ui) !important;
font-size: 12px !important;
font-weight: 500 !important;
white-space: nowrap !important;
text-transform: none !important;
letter-spacing: 0.01em !important;
color: var(--text-dim) !important;
border-bottom: 2px solid transparent !important;
transition: color 0.2s !important;
}
.topNav > ul.navList > li > a {
display: flex !important;
align-items: center !important;
height: var(--nav-h) !important;
margin: 0 -16px !important;
padding: 0 16px !important;
color: var(--text-dim) !important;
font-family: var(--font-ui) !important;
font-size: 12px !important;
font-weight: 500 !important;
text-decoration: none !important;
text-transform: none !important;
letter-spacing: 0.01em !important;
white-space: nowrap !important;
border-bottom: 2px solid transparent !important;
transition: color 0.2s, border-color 0.2s !important;
}
.topNav > ul.navList > li > a:hover {
color: var(--text) !important;
border-bottom-color: var(--purple) !important;
background: transparent !important;
text-shadow: none !important;
text-decoration: none !important;
}
/* Active item — gradient underline */
.topNav > ul.navList > li.navBarCell1Rev {
color: var(--text) !important;
border-image: linear-gradient(90deg, var(--blue), var(--purple)) 1 !important;
border-bottom-width: 2px !important;
border-bottom-style: solid !important;
}
/* ── Brand — pinned to far right of topNav ── */
.topNav > .aboutLanguage {
position: absolute !important;
top: 0 !important; right: 0 !important;
height: var(--nav-h) !important;
display: flex !important;
align-items: center !important;
gap: 12px !important;
padding: 0 16px !important;
background: var(--bg2) !important;
border-left: 1px solid var(--border) !important;
z-index: 5 !important;
}
/* Hide the duplicate in bottom nav */
.bottomNav > .aboutLanguage,
.bottomNav .aboutLanguage {
display: none !important;
}
#javadoc-header {
display: flex !important;
align-items: center !important;
gap: 12px !important;
}
.header-brand { text-decoration: none !important; }
/* Brand title — gradient text */
.header-title {
font-family: var(--font-ui) !important;
font-size: 14px !important;
font-weight: 700 !important;
background: linear-gradient(135deg, var(--blue), var(--purple)) !important;
-webkit-background-clip: text !important;
-webkit-text-fill-color: transparent !important;
background-clip: text !important;
line-height: 1.4 !important;
white-space: nowrap !important;
}
.header-title span {
display: block !important;
font-family: var(--font-mono) !important;
font-size: 9px !important;
font-weight: 400 !important;
background: none !important;
-webkit-text-fill-color: var(--text-dim) !important;
color: var(--text-dim) !important;
margin-top: 1px !important;
letter-spacing: 0.1em !important;
text-transform: uppercase !important;
}
.header-back {
display: inline-flex !important;
align-items: center !important;
text-decoration: none !important;
color: var(--text-dim) !important;
font-family: var(--font-ui) !important;
font-size: 11px !important;
font-weight: 500 !important;
padding: 5px 12px !important;
border: 1px solid var(--border2) !important;
border-radius: 6px !important;
white-space: nowrap !important;
transition: all 0.2s !important;
}
.header-back:hover {
color: var(--text) !important;
border-color: var(--purple) !important;
background: var(--purple-dim) !important;
text-decoration: none !important;
text-shadow: none !important;
}
/* ── Sub nav ── */
.subNav {
background: var(--bg3) !important;
border-bottom: 1px solid var(--border) !important;
height: var(--subnav-h) !important;
margin: 0 !important;
padding: 0 14px !important;
display: flex !important;
align-items: center !important;
gap: 12px !important;
overflow: hidden !important;
}
/* Search first */
.subNav > ul.navListSearch {
order: -1 !important;
}
.subNav ul,
.subNav ul.navList,
.subNav ul.subNavList,
.subNav ul.navListSearch {
list-style: none !important;
margin: 0 !important;
padding: 0 !important;
display: flex !important;
align-items: center !important;
gap: 0 !important;
}
.subNav li {
display: flex !important;
align-items: center !important;
font-family: var(--font-ui) !important;
font-size: 11px !important;
color: var(--text-dim) !important;
padding: 0 6px !important;
white-space: nowrap !important;
border: none !important;
height: auto !important;
text-transform: none !important;
}
.subNav a {
color: var(--blue) !important;
text-decoration: none !important;
font-size: 11px !important;
font-family: var(--font-ui) !important;
transition: color 0.15s !important;
}
.subNav a:hover { color: var(--purple) !important; text-shadow: none !important; }
.subNav label {
font-family: var(--font-ui) !important;
font-size: 11px !important;
color: var(--text-dim) !important;
text-transform: none !important;
margin-right: 4px !important;
}
/* ══════════════════════════════════════════════
CONTENT
══════════════════════════════════════════════ */
main {
background: var(--bg) !important;
padding: 28px !important;
flex: 1 0 auto !important;
}
.contentContainer, div.contentContainer {
background: var(--bg) !important;
padding: 0 28px 0px !important;
}
.header {
padding: 0 28px 0 !important;
margin-bottom: 20px !important;
}
/* Subtitle under h1 on help/overview pages */
.header .subTitle,
div.subTitle {
color: var(--text-mid) !important;
font-family: var(--font-ui) !important;
font-size: 13px !important;
line-height: 1.7 !important;
margin-top: 8px !important;
}
.packageLabelInType {
font-family: var(--font-mono) !important;
font-size: 11px !important;
color: var(--text-dim) !important;
}
/* ── Headings ── */
h1, h2, h3, h4, h5, h6 {
font-family: var(--font-ui) !important;
font-weight: 600 !important;
line-height: 1.5 !important;
text-transform: none !important;
letter-spacing: -0.01em !important;
}
/* Page title — gradient accent bar */
h1.title, h2.title {
font-size: 22px !important;
font-weight: 700 !important;
color: var(--text) !important;
border-bottom: none !important;
padding-bottom: 16px !important;
padding-left: 16px !important;
margin-bottom: 24px !important;
margin-top: 0 !important;
border-left: 4px solid transparent !important;
border-image: linear-gradient(180deg, var(--blue), var(--purple)) 1 !important;
}
/* Section h2 — colored panel */
section > h2,
li.blockList > section > h2 {
font-size: 14px !important;
color: var(--green) !important;
border-left: 3px solid var(--green) !important;
border-bottom: none !important;
padding: 10px 14px !important;
margin: 0 !important;
background: var(--green-dim) !important;
}
/* Generic h2 (table section headers like "Method Summary") */
h2 {
font-size: 14px !important;
color: var(--amber) !important;
border-bottom: none !important;
border-left: 3px solid var(--amber) !important;
padding: 8px 12px !important;
margin-top: 28px !important;
margin-bottom: 12px !important;
background: var(--amber-dim) !important;
}
/* h3 — table section headers inside blockList */
h3 {
font-size: 12px !important;
color: var(--text-mid) !important;
margin: 0 !important;
padding: 10px 14px !important;
background: var(--bg3) !important;
border-bottom: 1px solid var(--border) !important;
}
/* h4 — method detail names */
h4 {
font-size: 13px !important;
font-weight: 600 !important;
color: var(--cyan) !important;
margin: 0 !important;
padding: 10px 14px !important;
background: var(--bg3) !important;
border-bottom: 1px solid var(--border) !important;
border-left: 3px solid var(--cyan) !important;
}
/* ── blockList sections — card-like containers ── */
ul.blockList > li.blockList,
ul.blockListLast > li.blockList {
border: 1px solid var(--border) !important;
border-radius: 6px !important;
margin-bottom: 14px !important;
padding: 0 !important;
background: var(--bg2) !important;
overflow: hidden !important;
}
/* Help page: section cards with padding around their content */
ul.blockList > li.blockList > section {
padding: 0 !important;
}
ul.blockList > li.blockList > section > p,
ul.blockList > li.blockList > section > ul:not(.blockList):not(.blockListLast) {
padding: 14px 18px !important;
margin: 0 !important;
color: var(--text-mid) !important;
font-family: var(--font-ui) !important;
font-size: 13px !important;
line-height: 1.7 !important;
}
/* Nested lists inside section content */
ul.blockList > li.blockList > section > ul:not(.blockList):not(.blockListLast) > li {
color: var(--text-mid) !important;
font-family: var(--font-ui) !important;
font-size: 13px !important;
padding: 3px 0 !important;
list-style: none !important;
}
ul.blockList > li.blockList > section > ul:not(.blockList):not(.blockListLast) > li::before {
content: '\203A' !important;
color: var(--purple) !important;
margin-right: 8px !important;
font-weight: 700 !important;
}
/* ── Inherited methods block ── */
ul.blockList > li.blockList > h3,
ul.blockList > li.blockList > ul.blockList > li.blockList > h3 {
font-size: 11px !important;
color: var(--text-dim) !important;
padding: 8px 14px !important;
background: var(--bg3) !important;
border-bottom: 1px solid var(--border) !important;
margin: 0 !important;
}
/* The comma-separated code block of inherited method names */
ul.blockList > li.blockList > code,
li.blockList > code {
display: block !important;
padding: 10px 16px !important;
color: var(--text-dim) !important;
font-family: var(--font-mono) !important;
font-size: 12px !important;
background: var(--bg) !important;
border: none !important;
line-height: 1.8 !important;
}
/* ── Inheritance chain ── */
ul.inheritance {
list-style: none !important;
padding: 0 !important;
margin: 0 0 16px !important;
font-size: 12px !important;
color: var(--text-dim) !important;
}
ul.inheritance li { padding-left: 16px !important; }
ul.inheritance li:first-child { padding-left: 0 !important; }
/* ── General content lists (help page) ── */
main ul:not(.blockList):not(.blockListLast):not(.navList):not(.subNavList):not(.navListSearch):not(.inheritance) {
padding-left: 0 !important;
margin: 4px 0 4px 12px !important;
list-style: none !important;
}
main ul:not(.blockList):not(.blockListLast):not(.navList):not(.subNavList):not(.navListSearch):not(.inheritance) > li {
color: var(--text-mid) !important;
font-family: var(--font-ui) !important;
font-size: 13px !important;
padding: 3px 0 !important;
line-height: 1.7 !important;
}
main ul:not(.blockList):not(.blockListLast):not(.navList):not(.subNavList):not(.navListSearch):not(.inheritance) > li::before {
content: '\203A' !important;
color: var(--purple) !important;
margin-right: 8px !important;
font-weight: 700 !important;
}
/* General paragraphs in content */
main > div p, .contentContainer p {
color: var(--text-mid) !important;
font-family: var(--font-ui) !important;
font-size: 13px !important;
line-height: 1.7 !important;
margin: 8px 0 !important;
}
/* Emphasized phrase */
.emphasizedPhrase {
display: block !important;
color: var(--text-dim) !important;
font-family: var(--font-mono) !important;
font-size: 12px !important;
font-style: italic !important;
border-left: 2px solid var(--purple) !important;
padding: 8px 14px !important;
margin-top: 16px !important;
background: var(--purple-dim) !important;
border-radius: 0 4px 4px 0 !important;
}
/* Bottom footer subNav */
footer {
/*margin-top: auto;*/
}
footer .subNav {
background: var(--bg3) !important;
border-top: 1px solid var(--border) !important;
border-bottom: none !important;
height: var(--subnav-h) !important;
padding: 0 14px !important;
display: flex !important;
align-items: center !important;
gap: 12px !important;
overflow: hidden !important;
}
/* ══════════════════════════════════════════════
TABLES
══════════════════════════════════════════════ */
table {
width: 100% !important;
border-collapse: collapse !important;
border: 1px solid var(--border) !important;
border-radius: 6px !important;
margin: 16px 0 !important;
font-size: 13px !important;
overflow: hidden !important;
}
caption {
background: var(--bg3) !important;
padding: 8px 14px !important;
text-align: left !important;
border-bottom: 1px solid var(--border2) !important;
caption-side: top !important;
}
/* Table tabs — pill style */
.activeTableTab, .tableTab {
font-family: var(--font-ui) !important;
font-size: 11px !important;
font-weight: 500 !important;
text-transform: none !important;
padding: 4px 12px !important;
border: 1px solid var(--border2) !important;
border-radius: 20px !important;
display: inline-block !important;
margin-right: 6px !important;
cursor: pointer !important;
transition: all 0.2s !important;
}
.activeTableTab {
color: var(--text) !important;
border-color: var(--blue) !important;
background: var(--blue-dim) !important;
}
.tableTab { color: var(--text-dim) !important; background: var(--bg3) !important; }
.tableTab a { color: var(--text-dim) !important; text-decoration: none !important; }
.tableTab a:hover { color: var(--text) !important; text-shadow: none !important; }
/* Column headers */
th[scope="col"] {
background: var(--bg-elevated) !important;
color: var(--text-dim) !important;
font-family: var(--font-ui) !important;
font-size: 10px !important;
font-weight: 600 !important;
letter-spacing: 0.06em !important;
text-transform: uppercase !important;
padding: 10px 14px !important;
border-bottom: 2px solid var(--border2) !important;
text-align: left !important;
}
/* Data cells */
th[scope="row"], td {
background: var(--bg2) !important;
color: var(--text) !important;
padding: 10px 14px !important;
border-bottom: 1px solid var(--border) !important;
vertical-align: top !important;
text-align: left !important;
font-family: var(--font-mono) !important;
font-size: 12px !important;
font-weight: 400 !important;
text-transform: none !important;
letter-spacing: 0 !important;
transition: background 0.15s !important;
}
/* Stronger alternating row contrast */
tr.altColor > td, tr.altColor > th[scope="row"] { background: var(--bg) !important; }
tr.rowColor > td, tr.rowColor > th[scope="row"] { background: var(--bg2) !important; }
tr:hover > td, tr:hover > th[scope="row"] {
background: var(--purple-dim) !important;
border-bottom-color: rgba(187, 154, 247, 0.25) !important;
}
tr:hover > td a, tr:hover > th[scope="row"] a {
color: var(--purple) !important;
}
/* ── Links ── */
a, a:visited { color: var(--blue) !important; text-decoration: none !important; transition: color 0.15s !important; }
a:hover { color: var(--purple) !important; text-decoration: none !important; }
.memberNameLink a { color: var(--cyan) !important; font-weight: 500 !important; }
.memberNameLink a:hover { color: var(--purple) !important; }
.externalLink { color: var(--blue) !important; }
/* ── Description blocks ── */
div.block {
color: var(--text-mid) !important;
font-family: var(--font-ui) !important;
font-size: 13px !important;
line-height: 1.7 !important;
padding: 4px 0 !important;
}
ul.blockList > li.blockList > div.block{ padding: 12px 16px !important; margin: 0 !important; }
/* ── Method detail ── */
ul.blockList, ul.blockListLast { list-style: none !important; padding: 0 !important; margin: 0 !important; }
ul.blockList > li.blockList, ul.blockListLast > li.blockList {
border: 1px solid var(--border) !important;
border-radius: 6px !important;
margin-bottom: 12px !important;
padding: 0 !important;
overflow: hidden !important;
}
/* Method/type signatures — accent left bar */
pre.methodSignature, pre.typeSignature {
background: var(--bg2) !important;
border: none !important;
border-bottom: 1px solid var(--border) !important;
border-left: 3px solid var(--cyan) !important;
margin: 0 !important;
padding: 14px 18px !important;
font-family: var(--font-mono) !important;
font-size: 12px !important;
color: var(--text) !important;
overflow-x: auto !important;
white-space: pre-wrap !important;
}
pre {
background: var(--bg2) !important;
border: 1px solid var(--border) !important;
border-left: 3px solid var(--blue) !important;
border-radius: 6px !important;
padding: 14px 18px !important;
font-family: var(--font-mono) !important;
font-size: 12px !important;
color: var(--text) !important;
overflow-x: auto !important;
margin: 0 !important;
white-space: pre-wrap !important;
}
code {
font-family: var(--font-mono) !important;
font-size: 12px !important;
color: var(--cyan) !important;
background: var(--bg3) !important;
padding: 2px 6px !important;
border-radius: 4px !important;
}
dl { padding: 12px 16px !important; margin: 0 !important; }
dt { margin-bottom: 4px !important; }
dd { margin: 0 0 8px 16px !important; color: var(--text-mid) !important; font-size: 12px !important; }
.paramLabel, .returnLabel, .throwsLabel, .seeLabel, .simpleTagLabel {
font-family: var(--font-ui) !important;
font-size: 10px !important;
font-weight: 600 !important;
color: var(--purple) !important;
text-transform: uppercase !important;
letter-spacing: 0.06em !important;
}
.typeNameLabel { color: var(--cyan) !important; }
.deprecationBlock {
background: var(--amber-dim) !important;
border-left: 3px solid var(--amber) !important;
border-radius: 0 6px 6px 0 !important;
padding: 10px 14px !important;
color: var(--amber) !important;
font-size: 12px !important;
}
/* ── Inputs ── */
input[type="text"] {
background: var(--bg) !important;
border: 1px solid var(--border2) !important;
color: var(--text) !important;
font-family: var(--font-mono) !important;
font-size: 12px !important;
padding: 5px 12px !important;
outline: none !important;
border-radius: 6px !important;
transition: border-color 0.2s, box-shadow 0.2s !important;
}
input[type="text"]:focus {
border-color: var(--blue) !important;
box-shadow: 0 0 0 2px var(--blue-dim) !important;
}
input[type="reset"] {
background: var(--bg3) !important;
border: 1px solid var(--border2) !important;
color: var(--text-dim) !important;
font-family: var(--font-ui) !important;
font-size: 11px !important;
padding: 5px 12px !important;
cursor: pointer !important;
border-radius: 6px !important;
transition: all 0.2s !important;
}
input[type="reset"]:hover {
border-color: var(--text-dim) !important;
color: var(--text-mid) !important;
}
/* ══════════════════════════════════════════════
BOTTOM NAV
══════════════════════════════════════════════ */
.bottomNav {
background: var(--bg2) !important;
border-top: 1px solid var(--border) !important;
min-height: var(--nav-h) !important;
padding: 0 !important;
margin-top: 32px !important;
overflow: hidden !important;
position: relative !important;
}
/* Gradient accent line on bottom nav too */
.bottomNav::after {
content: '' !important;
position: absolute !important;
bottom: 0 !important; left: 0 !important; right: 0 !important;
height: 2px !important;
background: linear-gradient(90deg, var(--blue), var(--purple), var(--cyan)) !important;
}
.bottomNav ul.navList[title="Navigation"] {
list-style: none !important;
margin: 0 !important;
padding: 0 0 0 8px !important;
display: flex !important;
align-items: stretch !important;
height: var(--nav-h) !important;
}
.bottomNav ul.navList[title="Navigation"] li {
display: flex !important;
align-items: center !important;
margin: 0 !important;
padding: 0 16px !important;
height: var(--nav-h) !important;
font-family: var(--font-ui) !important;
font-size: 12px !important;
font-weight: 500 !important;
white-space: nowrap !important;
text-transform: none !important;
letter-spacing: 0.01em !important;
color: var(--text-dim) !important;
border-top: 2px solid transparent !important;
transition: color 0.2s !important;
}
.bottomNav ul.navList[title="Navigation"] li > a {
display: flex !important;
align-items: center !important;
height: var(--nav-h) !important;
margin: 0 -16px !important;
padding: 0 16px !important;
color: var(--text-dim) !important;
text-decoration: none !important;
font-family: var(--font-ui) !important;
font-size: 12px !important;
font-weight: 500 !important;
transition: color 0.2s !important;
}
.bottomNav ul.navList[title="Navigation"] li > a:hover {
color: var(--text) !important;
text-shadow: none !important;
}
.bottomNav ul.navList[title="Navigation"] li.navBarCell1Rev {
color: var(--text) !important;
border-image: linear-gradient(90deg, var(--blue), var(--purple)) 1 !important;
border-top-width: 2px !important;
border-top-style: solid !important;
}
.bottomNav .aboutLanguage {
display: none !important;
}
.legalCopy {
background: var(--bg2) !important;
color: var(--text-dim) !important;
font-size: 11px !important;
font-family: var(--font-ui) !important;
padding: 14px 18px !important;
text-align: center !important;
border-top: 1px solid var(--border) !important;
}
/* ══════════════════════════════════════════════
SEARCH RESULTS DROPDOWN (jQuery UI Autocomplete)
══════════════════════════════════════════════ */
.ui-autocomplete {
background: var(--bg2) !important;
border: 1px solid var(--border2) !important;
border-radius: 8px !important;
max-height: 400px !important;
overflow-y: auto !important;
overflow-x: hidden !important;
z-index: 9999 !important;
list-style: none !important;
padding: 4px 0 !important;
margin: 4px 0 0 !important;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(122, 162, 247, 0.05) !important;
}
/* Category headers */
.ui-autocomplete .ui-autocomplete-category {
background: var(--bg-elevated) !important;
color: var(--text-dim) !important;
font-family: var(--font-ui) !important;
font-size: 10px !important;
font-weight: 600 !important;
text-transform: uppercase !important;
letter-spacing: 0.06em !important;
padding: 6px 14px !important;
border-bottom: 1px solid var(--border) !important;
border-top: 1px solid var(--border) !important;
cursor: default !important;
}
/* Individual result items */
.ui-autocomplete .ui-menu-item {
background: var(--bg2) !important;
margin: 0 !important;
list-style: none !important;
}
.ui-autocomplete .ui-menu-item > div,
.ui-autocomplete .ui-menu-item-wrapper {
background: var(--bg2) !important;
color: var(--text) !important;
font-family: var(--font-mono) !important;
font-size: 12px !important;
padding: 7px 14px !important;
border: none !important;
border-left: 2px solid transparent !important;
cursor: pointer !important;
line-height: 1.5 !important;
transition: all 0.1s !important;
}
/* Hover / focus state */
.ui-autocomplete .ui-menu-item > div.ui-state-active,
.ui-autocomplete .ui-menu-item > div.ui-state-focus,
.ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
.ui-autocomplete .ui-menu-item-wrapper.ui-state-focus,
.ui-autocomplete .ui-state-active,
.ui-autocomplete .ui-state-focus {
background: var(--purple-dim) !important;
color: var(--text) !important;
border: none !important;
border-left: 2px solid var(--purple) !important;
margin: 0 !important;
}
/* Highlighted matching text */
.resultHighlight {
color: var(--cyan) !important;
font-weight: 600 !important;
}
/* Search tag result extras */
.searchTagHolderResult {
color: var(--text-dim) !important;
font-size: 11px !important;
}
.searchTagDescResult {
color: var(--text-dim) !important;
font-size: 11px !important;
font-style: italic !important;
}
/* "No results found" */
.ui-autocomplete .ui-menu-item:only-child > div {
color: var(--text-dim) !important;
font-style: italic !important;
}
/* Override jQuery UI defaults */
.ui-widget {
font-family: var(--font-mono) !important;
}
.ui-widget-content {
background: var(--bg2) !important;
color: var(--text) !important;
border-color: var(--border2) !important;
}
.ui-menu .ui-menu-item {
padding: 0 !important;
}
/* Watermark style for search input placeholder */
.watermark {
color: var(--text-dim) !important;
}
/* ══════════════════════════════════════════════
MISC
══════════════════════════════════════════════ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
::selection { background: rgba(187, 154, 247, 0.25); color: var(--text); }
hr { border: none !important; border-top: 1px solid var(--border) !important; margin: 24px 0 !important; }
+14
View File
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Javadoc Index</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500;600&family=IBM+Plex+Sans:ital,wght@0,300;0,600;1,300&display=swap" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
+1679
View File
File diff suppressed because it is too large. Load diff
+19
View File
@@ -0,0 +1,19 @@
{
"name": "javadoc-index",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@vitejs/plugin-react": "^4.2.1",
"vite": "^7.3.1"
}
}
+64
View File
@@ -0,0 +1,64 @@
import styles from './App.module.css'
import { useDocs } from './useDocs'
import TerminalHeader from './components/TerminalHeader'
import Section from './components/Section'
import { ReleaseCard, ExperimentalCard } from './components/Card'
import { LoadingState, ErrorState, EmptyState } from './components/States'
import Footer from './components/Footer'
export default function App() {
const { data, loading, error } = useDocs()
const releases = data?.releases || []
const experimental = data?.experimental || []
return (
<div className={styles.root}>
<TerminalHeader />
{/* ── Releases ── */}
<Section
label="Release"
variant="releases"
count={loading ? undefined : releases.length}
>
{loading ? (
<LoadingState />
) : error ? (
<ErrorState message={error} />
) : releases.length === 0 ? (
<EmptyState label="releases" />
) : (
<div className={styles.grid}>
{releases.map((r, i) => (
<ReleaseCard key={r.id} release={r} index={i} />
))}
</div>
)}
</Section>
{/* ── Experimental ── */}
<Section
label="Experimental"
variant="experimental"
count={loading ? undefined : experimental.length}
>
{loading ? (
<LoadingState />
) : error ? null : experimental.length === 0 ? (
<EmptyState label="experimental branches" />
) : (
<div className={styles.grid}>
{experimental.map((b, i) => (
<ExperimentalCard key={b.id} branch={b} index={i} />
))}
</div>
)}
</Section>
{!loading && !error && (
<Footer source={data?.source} />
)}
</div>
)
}
+16
View File
@@ -0,0 +1,16 @@
.root {
max-width: 1100px;
margin: 0 auto;
padding: 48px 32px 96px;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 10px;
}
@media (max-width: 600px) {
.root { padding: 24px 16px 64px; }
.grid { grid-template-columns: 1fr; }
}
+97
View File
@@ -0,0 +1,97 @@
import styles from './Card.module.css'
import { REPO_NAME } from '../config'
const BASE_PATH = `/${REPO_NAME}`
function formatDate(iso) {
if (!iso) return null
try {
return new Intl.DateTimeFormat('en-GB', {
day: '2-digit', month: 'short', year: 'numeric'
}).format(new Date(iso))
} catch (e) { return null }
}
export function ReleaseCard({ release, index }) {
const isLatest = release.isLatest
const date = formatDate(release.date)
const cardClass = isLatest
? styles.card + ' ' + styles.latest
: styles.card + ' ' + styles.release
return (
<a
href={BASE_PATH + '/' + release.path + '/'}
className={cardClass}
style={{ animationDelay: (index * 50) + 'ms' }}
>
<div className={styles.header}>
<div className={styles.badges}>
{isLatest && (
<span className={styles.badge + ' ' + styles.badgeLatest}>● latest</span>
)}
<span className={styles.badge + ' ' + styles.badgeRelease}>release</span>
</div>
<span className={styles.arrow}>→</span>
</div>
<div className={styles.version}>
v{release.version}
</div>
<div className={styles.meta}>
{date && (
<div className={styles.metaRow}>
<span className={styles.metaKey}>date</span>
<span className={styles.metaVal}>{date}</span>
</div>
)}
<div className={styles.metaRow}>
<span className={styles.metaKey}>path</span>
<span className={styles.metaVal}>{release.path}/</span>
</div>
</div>
</a>
)
}
export function ExperimentalCard({ branch, index }) {
const date = formatDate(branch.date)
return (
<a
href={BASE_PATH + '/' + branch.path + '/'}
className={styles.card + ' ' + styles.experimental}
style={{ animationDelay: (index * 50) + 'ms' }}
>
<div className={styles.header}>
<span className={styles.badge + ' ' + styles.badgeExperimental}>
experimental
</span>
<span className={styles.arrow}>→</span>
</div>
<div className={styles.version + ' ' + styles.versionBranch}>
{branch.branch}
</div>
<div className={styles.meta}>
{date && (
<div className={styles.metaRow}>
<span className={styles.metaKey}>date</span>
<span className={styles.metaVal}>{date}</span>
</div>
)}
{branch.hash && (
<div className={styles.metaRow}>
<span className={styles.metaKey}>sha</span>
<span className={styles.metaVal + ' ' + styles.hash}>{branch.hash}</span>
</div>
)}
<div className={styles.metaRow}>
<span className={styles.metaKey}>path</span>
<span className={styles.metaVal}>{branch.path}/</span>
</div>
</div>
</a>
)
}
@@ -0,0 +1,143 @@
.card {
display: block;
text-decoration: none;
background: var(--bg2);
border: 1px solid var(--border);
border-radius: 6px;
padding: 20px 22px;
transition: border-color 0.15s, background 0.15s, transform 0.15s;
position: relative;
overflow: hidden;
animation: fadeUp 0.35s ease both;
}
.card::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0;
height: 2px;
opacity: 0;
transition: opacity 0.15s;
}
.release::before { background: var(--green); }
.latest::before { background: linear-gradient(90deg, var(--green), var(--blue)); }
.experimental::before { background: var(--amber); }
.card:hover {
border-color: var(--border2);
background: var(--bg3);
transform: translateY(-2px);
}
.card:hover::before { opacity: 1; }
/* ── Header ── */
.header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 14px;
}
.badges {
display: flex;
align-items: center;
gap: 6px;
}
.badge {
font-size: 9px;
font-weight: 600;
letter-spacing: 0.12em;
text-transform: uppercase;
padding: 2px 8px;
border-radius: 2px;
border: 1px solid;
}
.badgeLatest {
color: var(--green);
border-color: var(--green-dim);
background: rgba(57, 211, 83, 0.08);
animation: pulseBorder 2s ease infinite;
}
.badgeRelease {
color: var(--text-dim);
border-color: var(--border2);
background: transparent;
}
.badgeExperimental {
color: var(--amber);
border-color: var(--amber-dim);
background: rgba(240, 160, 48, 0.08);
}
.arrow {
font-size: 14px;
color: var(--border2);
transition: color 0.15s, transform 0.15s;
}
.card:hover .arrow {
color: var(--text-mid);
transform: translateX(3px);
}
/* ── Version ── */
.version {
font-size: 20px;
font-weight: 500;
color: var(--text);
margin-bottom: 4px;
letter-spacing: -0.01em;
}
.latest .version { color: var(--green); }
.versionBranch { font-size: 16px; color: var(--amber); }
/* ── Meta ── */
.meta {
display: flex;
flex-direction: column;
gap: 3px;
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid var(--border);
}
.metaRow {
display: flex;
align-items: center;
gap: 8px;
font-size: 10px;
color: var(--text-dim);
}
.metaKey {
min-width: 36px;
color: var(--text-dim);
}
.metaVal {
color: var(--text-mid);
font-family: 'IBM Plex Mono', monospace;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.hash { color: var(--blue); }
/* ── Animations ── */
@keyframes fadeUp {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseBorder {
0%, 100% { border-color: var(--green-dim); }
50% { border-color: var(--green); }
}
+29
View File
@@ -0,0 +1,29 @@
import styles from './Footer.module.css'
import { REPO_OWNER, REPO_NAME } from '../useDocs'
export default function Footer({ source }) {
const now = new Intl.DateTimeFormat('en-GB', {
day: '2-digit', month: 'short', year: 'numeric',
hour: '2-digit', minute: '2-digit', timeZoneName: 'short'
}).format(new Date())
return (
<footer className={styles.footer}>
<span>
<span className={styles.dot} />
Auto-generated · {source === 'manifest' ? 'manifest.json' : 'GitHub API'}
</span>
<span>{now}</span>
<span>Template by:&nbsp;
<a
href={`https://github.com/somehussar/`}
target="_blank"
rel="noopener noreferrer"
className={styles.link}
>
github.com/somehussar
</a>
</span>
</footer>
)
}
@@ -0,0 +1,36 @@
.footer {
margin-top: 64px;
padding-top: 20px;
border-top: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 8px;
font-size: 11px;
color: var(--text-dim);
}
.dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--green);
margin-right: 6px;
animation: blink 2s ease infinite;
}
.link {
color: var(--blue);
text-decoration: none;
}
.link:hover {
text-decoration: underline;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.3; }
}
+18
View File
@@ -0,0 +1,18 @@
import styles from './Section.module.css'
export default function Section({ label, count, variant, children }) {
return (
<section className={styles.section}>
<div className={styles.header}>
<span className={`${styles.tag} ${styles[variant]}`}>{label}</span>
<div className={styles.line} />
{count !== undefined && (
<span className={styles.count}>
{count} {label.toLowerCase()}{count !== 1 ? 's' : ''}
</span>
)}
</div>
{children}
</section>
)
}
@@ -0,0 +1,46 @@
.section {
margin-top: 40px;
margin-bottom: 8px;
}
.header {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 16px;
}
.tag {
font-size: 10px;
font-weight: 600;
letter-spacing: 0.15em;
text-transform: uppercase;
padding: 3px 10px;
border-radius: 3px;
border: 1px solid;
white-space: nowrap;
}
.releases {
color: var(--green);
border-color: var(--green-dim);
background: rgba(57, 211, 83, 0.06);
}
.experimental {
color: var(--amber);
border-color: var(--amber-dim);
background: rgba(240, 160, 48, 0.06);
}
.line {
flex: 1;
height: 1px;
background: var(--border);
}
.count {
font-size: 11px;
color: var(--text-dim);
white-space: nowrap;
}
+30
View File
@@ -0,0 +1,30 @@
import styles from './States.module.css'
export function LoadingState() {
return (
<div className={styles.box}>
<div className={styles.spinner} />
<p className={styles.label}>Fetching documentation index...</p>
</div>
)
}
export function ErrorState({ message }) {
return (
<div className={styles.box}>
<div className={styles.errorIcon}>⚠</div>
<p className={styles.errorMsg}>{message}</p>
<p className={styles.errorSub}>
Check that the gh-pages branch exists and is publicly accessible.
</p>
</div>
)
}
export function EmptyState({ label }) {
return (
<div className={`${styles.box} ${styles.empty}`}>
<p className={styles.label}>No {label} found.</p>
</div>
)
}
@@ -0,0 +1,47 @@
.box {
border: 1px solid var(--border);
border-radius: 6px;
padding: 48px;
text-align: center;
background: var(--bg2);
}
.empty {
padding: 24px;
}
.spinner {
width: 22px;
height: 22px;
border: 2px solid var(--border2);
border-top-color: var(--green);
border-radius: 50%;
animation: spin 0.75s linear infinite;
margin: 0 auto 14px;
}
.label {
font-size: 12px;
color: var(--text-dim);
}
.errorIcon {
font-size: 22px;
margin-bottom: 10px;
color: var(--red);
}
.errorMsg {
font-size: 13px;
color: var(--red);
margin-bottom: 6px;
}
.errorSub {
font-size: 11px;
color: var(--text-dim);
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@@ -0,0 +1,186 @@
import { useState, useEffect } from 'react'
import styles from './TerminalHeader.module.css'
import { PROJECT_NAME, REPO_NAME, LINKS, AUTHORS } from '../config'
function useGitHubProfile(username) {
const [profile, setProfile] = useState(null)
const [loading, setLoading] = useState(true)
useEffect(() => {
const cacheKey = 'gh-profile-' + username
// Check sessionStorage first — avoids hammering the API on every render
try {
const cached = sessionStorage.getItem(cacheKey)
if (cached) {
setProfile(JSON.parse(cached))
setLoading(false)
return
}
} catch (e) {}
fetch('https://api.github.com/users/' + username)
.then(r => {
if (!r.ok) throw new Error('HTTP ' + r.status)
return r.json()
})
.then(d => {
// Don't cache error responses like rate limit messages
if (!d.message) {
try { sessionStorage.setItem(cacheKey, JSON.stringify(d)) } catch (e) {}
}
setProfile(d)
setLoading(false)
})
.catch(() => setLoading(false))
}, [username])
return { profile, loading }
}
function AuthorTile({ username, active }) {
const { profile, loading } = useGitHubProfile(username)
const tileClass = styles.authorTile + (active ? ' ' + styles.authorTileActive : '')
if (loading) {
return (
<div className={tileClass}>
<div className={styles.authorAvatarSkeleton} />
<div className={styles.authorInfo}>
<div className={styles.authorSkeleton} style={{ width: '60px' }} />
<div className={styles.authorSkeleton} style={{ width: '80px', marginTop: '4px' }} />
<div className={styles.authorBioPlaceholder} />
</div>
</div>
)
}
if (!profile || profile.message) {
return (
<a
href={'https://github.com/' + username}
target="_blank"
rel="noopener noreferrer"
className={tileClass}
>
<div className={styles.authorAvatarSkeleton} />
<div className={styles.authorInfo}>
<span className={styles.authorName}>{username}</span>
<span className={styles.authorLogin}>@{username}</span>
<div className={styles.authorBioPlaceholder} />
</div>
</a>
)
}
return (
<a
href={profile.html_url}
target="_blank"
rel="noopener noreferrer"
className={tileClass}
>
<img
src={profile.avatar_url}
alt={profile.login}
className={styles.authorAvatar}
/>
<div className={styles.authorInfo}>
<span className={styles.authorName}>{profile.name || profile.login}</span>
<span className={styles.authorLogin}>@{profile.login}</span>
{profile.bio
? <span className={styles.authorBio}>{profile.bio}</span>
: <div className={styles.authorBioPlaceholder} />
}
</div>
</a>
)
}
function AuthorsTiles() {
const [active, setActive] = useState(0)
useEffect(() => {
if (AUTHORS.length <= 1) return
const t = setInterval(() => {
setActive(i => (i + 1) % AUTHORS.length)
}, 4000)
return () => clearInterval(t)
}, [])
return (
<div className={styles.authors}>
<div className={styles.outputLine}>
<span className={styles.chevron}>›</span> Authors:
</div>
<div className={styles.authorRow}>
{AUTHORS.map((username, i) => (
<AuthorTile
key={username}
username={username}
active={i === active}
/>
))}
</div>
</div>
)
}
export default function TerminalHeader() {
return (
<div className={styles.wrap}>
<div className={styles.bar}>
<div className={styles.dot + ' ' + styles.red} />
<div className={styles.dot + ' ' + styles.amber} />
<div className={styles.dot + ' ' + styles.green} />
<span className={styles.title}>javadoc-index — bash</span>
</div>
<div className={styles.body}>
<h1 className={styles.heading}>
{PROJECT_NAME}
</h1>
<div className={styles.promptLine}>
<span className={styles.prompt}>$</span>
<span className={styles.cmd}>browse-docs</span>
<span className={styles.arg}>{REPO_NAME}</span>
<span className={styles.flag}>--all-versions</span>
</div>
<div className={styles.outputLine}>
<span className={styles.chevron}>›</span> Fetching available documentation builds...
</div>
<div className={styles.outputLine}>
<span className={styles.chevron}>›</span> Found project links:
</div>
<div className={styles.links}>
{LINKS.map(function(l) {
return (
<a
key={l.tag}
href={l.href}
target="_blank"
rel="noopener noreferrer"
className={styles.link}
>
<span className={styles.linkTag} style={{ color: l.color, borderColor: l.color }}>
{l.tag}
</span>
<span className={styles.linkLabel}>{l.label}</span>
<span className={styles.linkArrow} style={{ color: l.color }}>↗</span>
</a>
)
})}
</div>
<AuthorsTiles />
<div className={styles.promptLine} style={{ marginTop: '16px' }}>
<span className={styles.prompt}>$</span>
<span className={styles.cursor} />
</div>
</div>
</div>
)
}
@@ -0,0 +1,303 @@
.wrap {
margin-bottom: 48px;
}
.bar {
display: flex;
align-items: center;
gap: 6px;
background: var(--bg3);
border: 1px solid var(--border2);
border-bottom: none;
border-radius: 8px 8px 0 0;
padding: 10px 16px;
}
.dot {
width: 12px;
height: 12px;
border-radius: 50%;
}
.red { background: #ff5f57; }
.amber { background: #febc2e; }
.green { background: #28c840; }
.title {
margin-left: 8px;
font-size: 11px;
color: var(--text-dim);
letter-spacing: 0.05em;
}
.body {
background: var(--bg2);
border: 1px solid var(--border2);
border-radius: 0 0 8px 8px;
padding: 16px 36px 36px;
}
/* ── Heading ── */
.heading {
font-family: 'IBM Plex Sans', sans-serif;
font-size: clamp(28px, 5vw, 52px);
font-weight: 300;
letter-spacing: -0.02em;
color: var(--text);
line-height: 1.05;
margin-bottom: 20px;
}
.heading strong {
font-weight: 600;
color: var(--green);
}
/* ── Prompt ── */
.promptLine {
display: flex;
align-items: baseline;
gap: 10px;
margin-bottom: 6px;
font-size: 13px;
flex-wrap: wrap;
}
.prompt { color: var(--green); font-weight: 600; }
.cmd { color: var(--text); }
.arg { color: var(--blue); }
.flag { color: var(--amber); }
/* ── Output lines ── */
.outputLine {
font-size: 12px;
color: var(--text-dim);
line-height: 1.8;
padding-left: 20px;
}
.chevron {
color: var(--text-mid);
margin-right: 4px;
}
/* ── Links ── */
.links {
display: flex;
flex-direction: column;
gap: 4px;
padding-left: 36px;
margin-top: 4px;
margin-bottom: 12px;
}
.link {
display: inline-flex;
align-items: center;
gap: 10px;
text-decoration: none;
padding: 3px 0;
width: fit-content;
transition: opacity 0.15s;
}
.link:hover { opacity: 0.8; }
.link:hover .linkLabel {
text-decoration: underline;
text-underline-offset: 3px;
}
.linkTag {
font-size: 9px;
font-weight: 600;
letter-spacing: 0.1em;
border: 1px solid;
border-radius: 2px;
padding: 1px 5px;
min-width: 28px;
text-align: center;
opacity: 0.9;
font-family: 'IBM Plex Mono', monospace;
}
.linkLabel {
font-size: 12px;
color: var(--text-mid);
font-family: 'IBM Plex Mono', monospace;
}
.linkArrow {
font-size: 11px;
opacity: 0.6;
transition: opacity 0.15s, transform 0.15s;
}
.link:hover .linkArrow {
opacity: 1;
transform: translate(2px, -2px);
}
/* ── Authors ── */
.authors {
margin-bottom: 8px;
}
.authorRow {
display: flex;
flex-direction: row;
gap: 8px;
padding-left: 36px;
margin-top: 6px;
flex-wrap: wrap;
}
/* ── Author tile ── */
.authorTile {
display: flex;
align-items: center;
gap: 10px;
background: var(--bg3);
border: 1px solid var(--border);
border-radius: 6px;
padding: 8px 12px;
text-decoration: none;
cursor: pointer;
/* width is dynamic — grows with content */
width: max-content;
min-width: 140px;
position: relative;
overflow: hidden;
transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.authorTile::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0;
height: 2px;
background: var(--green);
opacity: 0;
transition: opacity 0.2s;
}
.authorTileActive::before,
.authorTile:hover::before {
opacity: 1;
}
.authorTileActive {
border-color: var(--green-dim);
background: rgba(57, 211, 83, 0.04);
}
.authorTile:hover {
border-color: var(--border2);
background: #161b22;
transform: translateY(-1px);
}
/* ── Author content ── */
.authorAvatar {
width: 32px;
height: 32px;
border-radius: 50%;
border: 1px solid var(--border2);
flex-shrink: 0;
}
.authorAvatarSkeleton {
width: 32px;
height: 32px;
border-radius: 50%;
background: var(--border2);
flex-shrink: 0;
animation: shimmer 1.5s ease infinite;
}
.authorInfo {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.authorName {
font-size: 12px;
font-weight: 500;
color: var(--text);
font-family: 'IBM Plex Sans', sans-serif;
white-space: nowrap;
}
.authorLogin {
font-size: 10px;
color: var(--blue);
font-family: 'IBM Plex Mono', monospace;
white-space: nowrap;
}
/* Bio — always reserves vertical height, width animates open */
.authorBio {
display: block;
font-size: 10px;
color: var(--text-dim);
font-family: 'IBM Plex Sans', sans-serif;
margin-top: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
/* always reserve vertical space */
height: 14px;
/* collapsed horizontally */
width: 0;
opacity: 0;
transition: opacity 0.25s ease, width 0.3s ease;
}
.authorTileActive .authorBio,
.authorTile:hover .authorBio {
width: 200px;
opacity: 1;
}
/* Placeholder for loading/no-profile/no-bio states */
.authorBioPlaceholder {
height: 14px;
margin-top: 2px;
width: 0; /* never takes horizontal space, never expands */
}
.authorSkeleton {
height: 9px;
border-radius: 4px;
background: var(--border2);
animation: shimmer 1.5s ease infinite;
}
/* ── Cursor ── */
.cursor {
display: inline-block;
width: 8px;
height: 13px;
background: var(--green);
margin-left: 2px;
vertical-align: text-bottom;
animation: blink 1s step-end infinite;
}
/* ── Animations ── */
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}
@keyframes shimmer {
0%, 100% { opacity: 0.4; }
50% { opacity: 0.8; }
}
@media (max-width: 600px) {
.body { padding: 20px; }
.links { padding-left: 20px; }
.authorRow { padding-left: 20px; }
}
+38
View File
@@ -0,0 +1,38 @@
// ─── Project Configuration ───────────────────────────────────
// This is the ONLY file that should differ between projects.
// Everything else in the pages app is generic.
// ─────────────────────────────────────────────────────────────
export const PROJECT_NAME = 'CustomNPC+'
export const REPO_OWNER = 'KAMKEEL'
export const REPO_NAME = 'CustomNPC-Plus'
export const LINKS = [
{
tag: 'GH',
label: 'github.com/KAMKEEL/CustomNPC-Plus',
href: 'https://github.com/KAMKEEL/CustomNPC-Plus',
color: '#e6edf3',
},
{
tag: 'DC',
label: 'discord.gg/94qmjEDxkp',
href: 'https://discord.gg/94qmjEDxkp',
color: '#5865f2',
},
{
tag: 'CF',
label: 'curseforge.com/minecraft/mc-mods/customnpc-plus',
href: 'https://www.curseforge.com/minecraft/mc-mods/customnpc-plus',
color: '#f16436',
},
{
tag: 'MR',
label: 'modrinth.com/mod/customnpc-plus',
href: 'https://modrinth.com/mod/customnpc-plus/',
color: '#1bd96a',
},
]
// GitHub usernames — profiles are fetched at runtime
export const AUTHORS = ['kamkeel', 'c0508383', 'bigguy345', 'somehussar']
+50
View File
@@ -0,0 +1,50 @@
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #080b0f;
--bg2: #0d1117;
--bg3: #131920;
--border: #1e2936;
--border2: #253040;
--green: #39d353;
--green-dim: #1a6b2a;
--amber: #f0a030;
--amber-dim: #7a4e10;
--blue: #58a6ff;
--blue-dim: #1a3a6b;
--text: #cdd9e5;
--text-dim: #636e7b;
--text-mid: #8b949e;
--red: #f85149;
}
html, body {
height: 100%;
background: var(--bg);
color: var(--text);
font-family: 'IBM Plex Mono', monospace;
overflow-x: hidden;
}
/* Scanlines */
body::after {
content: '';
position: fixed;
inset: 0;
background: repeating-linear-gradient(
0deg,
transparent,
transparent 2px,
rgba(0,0,0,0.025) 2px,
rgba(0,0,0,0.025) 4px
);
pointer-events: none;
z-index: 9999;
}
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
+13
View File
@@ -0,0 +1,13 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'
import { PROJECT_NAME } from './config'
import './index.css'
document.title = `${PROJECT_NAME} — Javadoc Index`
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>
)
+94
View File
@@ -0,0 +1,94 @@
import { useState, useEffect } from 'react'
import { REPO_OWNER, REPO_NAME } from './config'
const BASE_PATH = `/${REPO_NAME}`
const API_BASE = `https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}`
// Cache bust on every page load — appends current timestamp to manifest URL
// so the browser never serves a stale manifest.json
async function fetchFromManifest() {
const bust = `?t=${Date.now()}`
const res = await fetch(`${BASE_PATH}/manifest.json${bust}`, {
cache: 'no-store', // tells browser not to cache this request at all
})
if (!res.ok) throw new Error('No manifest')
return res.json()
}
async function fetchFromGitHubAPI() {
const refRes = await fetch(`${API_BASE}/git/ref/heads/gh-pages`)
if (!refRes.ok) throw new Error('gh-pages branch not found')
const refData = await refRes.json()
const sha = refData.object.sha
const treeRes = await fetch(`${API_BASE}/git/trees/${sha}?recursive=1`)
if (!treeRes.ok) throw new Error('Could not fetch tree')
const treeData = await treeRes.json()
const commitsRes = await fetch(`${API_BASE}/commits?sha=gh-pages&per_page=100`)
const commits = commitsRes.ok ? await commitsRes.json() : []
const commitMap = {}
commits.forEach(c => {
const date = c.commit?.committer?.date || c.commit?.author?.date || ''
const hash = c.sha?.slice(0, 7) || ''
const msg = c.commit?.message || ''
const vMatch = msg.match(/releases\/([\d.]+)/)
if (vMatch) commitMap[`releases/${vMatch[1]}`] = { date, hash }
const eMatch = msg.match(/experimental\/([\w-]+)/)
if (eMatch) commitMap[`experimental/${eMatch[1]}`] = { date, hash }
})
const releaseDirs = new Set()
const experimentalDirs = new Set()
treeData.tree.forEach(item => {
if (item.type !== 'tree') return
const parts = item.path.split('/')
if (parts[0] === 'releases' && parts.length === 2) releaseDirs.add(parts[1])
if (parts[0] === 'experimental' && parts.length === 2) experimentalDirs.add(parts[1])
})
// Sort releases newest first, mark first as latest
const sortedReleases = [...releaseDirs]
.sort((a, b) => b.localeCompare(a, undefined, { numeric: true }))
const releases = sortedReleases.map((v, i) => {
const c = commitMap[`releases/${v}`] || {}
return {
id: v,
version: v,
path: `releases/${v}`,
date: c.date,
hash: c.hash,
isLatest: i === 0, // newest version is always latest
}
})
const experimental = [...experimentalDirs].sort().map(b => {
const c = commitMap[`experimental/${b}`] || {}
return { id: b, branch: b, path: `experimental/${b}`, date: c.date, hash: c.hash }
})
return { releases, experimental, source: 'api' }
}
export function useDocs() {
const [data, setData] = useState(null)
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)
useEffect(() => {
fetchFromManifest()
.then(d => { setData(d); setLoading(false) })
.catch(() =>
fetchFromGitHubAPI()
.then(d => { setData(d); setLoading(false) })
.catch(e => { setError(e.message); setLoading(false) })
)
}, [])
return { data, loading, error }
}
export { BASE_PATH, REPO_OWNER, REPO_NAME }
+12
View File
@@ -0,0 +1,12 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { REPO_NAME } from './src/config.js'
export default defineConfig({
plugins: [react()],
base: `/${REPO_NAME}/`,
build: {
outDir: '../../.github/pages-dist',
emptyOutDir: true,
}
})
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
# -----------------------------------------------
# doc-config.sh — shared config for javadoc deploy
#
# Sourced by:
# - resolve-doc-path.sh
# - javadoc.yml (via sanity-check job)
#
# ADD WHITELISTED BRANCHES HERE AND NOWHERE ELSE.
# main is always handled automatically.
# -----------------------------------------------
MAIN_BRANCH_NAME="master"
EXPERIMENTAL_WHITELIST=(
"dev"
# "new-branch"
)
+107
View File
@@ -0,0 +1,107 @@
#!/bin/bash
set -e
RELEASES=()
EXPERIMENTAL=()
# Collect releases
if [ -d "./releases" ]; then
for dir in ./releases/*/; do
[ -d "$dir" ] || continue
name=$(basename "$dir")
RELEASES+=("$name")
done
fi
# Collect experimental branches
if [ -d "./experimental" ]; then
for dir in ./experimental/*/; do
[ -d "$dir" ] || continue
name=$(basename "$dir")
EXPERIMENTAL+=("$name")
done
fi
# Sort releases in reverse semver order (newest first)
if [ ${#RELEASES[@]} -gt 0 ]; then
IFS=$'\n' RELEASES=($(sort -rV <<< "${RELEASES[*]}")); unset IFS
fi
# ── Store source commit metadata for this deploy ───────────────
# DEPLOY_PATH, SOURCE_HASH, SOURCE_DATE are passed in as env vars from the workflow
if [ -n "$DEPLOY_PATH" ] && [ -n "$SOURCE_HASH" ]; then
mkdir -p ".doc-meta"
META_KEY="${DEPLOY_PATH//\//_}"
cat > ".doc-meta/${META_KEY}.json" << JSON
{"hash":"${SOURCE_HASH}","date":"${SOURCE_DATE}"}
JSON
echo "Stored source metadata for $DEPLOY_PATH → $SOURCE_HASH @ $SOURCE_DATE"
fi
# ── Helper: get source commit hash + date for a path ──────────
get_commit_info() {
local path="$1"
# If this is the path we just deployed, use the injected source commit
if [ "$path" = "$DEPLOY_PATH" ] && [ -n "$SOURCE_HASH" ]; then
echo "${SOURCE_HASH} ${SOURCE_DATE}"
return
fi
# Try reading from stored metadata file (set by previous deploys)
local meta=".doc-meta/${path//\//_}.json"
if [ -f "$meta" ]; then
local hash date
hash=$(python3 -c "import json,sys; d=json.load(open('$meta')); print(d.get('hash',''))" 2>/dev/null || grep -o '"hash":"[^"]*"' "$meta" | cut -d'"' -f4)
date=$(python3 -c "import json,sys; d=json.load(open('$meta')); print(d.get('date',''))" 2>/dev/null || grep -o '"date":"[^"]*"' "$meta" | cut -d'"' -f4)
echo "${hash:-} ${date:-}"
return
fi
# Last resort: gh-pages git log (hash will be wrong but better than empty)
local hash date
hash=$(git log --oneline -1 -- "$path" 2>/dev/null | awk '{print $1}')
date=$(git log --format="%cI" -1 -- "$path" 2>/dev/null)
echo "${hash:-} ${date:-}"
}
# ── Build releases JSON ────────────────────────────────────────
RELEASES_JSON="["
for i in "${!RELEASES[@]}"; do
version="${RELEASES[$i]}"
read -r HASH DATE <<< "$(get_commit_info "releases/$version")"
if [ "$i" -eq 0 ]; then
IS_LATEST="true"
else
IS_LATEST="false"
fi
RELEASES_JSON+="{\"id\":\"${version}\",\"version\":\"${version}\",\"path\":\"releases/${version}\",\"date\":\"${DATE}\",\"isLatest\":${IS_LATEST}},"
done
RELEASES_JSON="${RELEASES_JSON%,}]"
# ── Build experimental JSON ────────────────────────────────────
EXPERIMENTAL_JSON="["
for branch in "${EXPERIMENTAL[@]}"; do
read -r HASH DATE <<< "$(get_commit_info "experimental/$branch")"
EXPERIMENTAL_JSON+="{\"id\":\"${branch}\",\"branch\":\"${branch}\",\"path\":\"experimental/${branch}\",\"hash\":\"${HASH}\",\"date\":\"${DATE}\"},"
done
EXPERIMENTAL_JSON="${EXPERIMENTAL_JSON%,}]"
# ── Write manifest.json ────────────────────────────────────────
cat > manifest.json << JSON
{
"releases": ${RELEASES_JSON},
"experimental": ${EXPERIMENTAL_JSON},
"generated": "$(date -u '+%Y-%m-%dT%H:%M:%SZ')",
"source": "manifest"
}
JSON
echo "manifest.json generated:"
cat manifest.json
echo ""
echo "Done."
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/doc-config.sh"
BRANCH="${GITHUB_REF#refs/heads/}"
SAFE_BRANCH="${BRANCH//\//-}"
if [ "$BRANCH" = "$MAIN_BRANCH_NAME" ]; then
# Version resolution order:
# -> check if gradle.properties has a `modVersion` tag. If it does, just grab it.
# -> check if it has the `version` tag. Grab it if it does
# -> check build.gradle for the version tag.
if [ -f "gradle.properties" ] && grep -q "^modVersion=" gradle.properties; then
VERSION=$(grep "^modVersion=" gradle.properties | cut -d'=' -f2 | tr -d '[:space:]')
elif [ -f "gradle.properties" ] && grep -q "^version=" gradle.properties; then
VERSION=$(grep "^version=" gradle.properties | cut -d'=' -f2 | tr -d '[:space:]')
elif [ -f "build.gradle" ]; then
VERSION=$(grep "^version" build.gradle | head -1 | sed "s/version\s*=\s*['\"]//;s/['\"].*//;s/\s//g")
elif [ -f "build.gradle.kts" ]; then
VERSION=$(grep "^version" build.gradle.kts | head -1 | sed "s/version\s*=\s*\"//;s/\".*//;s/\s//g")
else
echo "Could not find version. Defaulting to 'unknown'."
VERSION="unknown"
fi
echo "Resolved version: $VERSION"
# Only deploy to releases/<version> — isLatest is handled by generate-index.sh
echo "path=releases/$VERSION" >> $GITHUB_OUTPUT
echo "extra_path=" >> $GITHUB_OUTPUT
else
MATCHED=false
for ALLOWED in "${EXPERIMENTAL_WHITELIST[@]}"; do
if [ "$BRANCH" = "$ALLOWED" ]; then
MATCHED=true
break
fi
done
if [ "$MATCHED" = true ]; then
echo "path=experimental/$SAFE_BRANCH" >> $GITHUB_OUTPUT
echo "extra_path=" >> $GITHUB_OUTPUT
echo "Branch '$BRANCH' is whitelisted, deploying to experimental/$SAFE_BRANCH"
else
echo "path=" >> $GITHUB_OUTPUT
echo "extra_path=" >> $GITHUB_OUTPUT
echo "Branch '$BRANCH' is not whitelisted. Skipping deploy."
fi
fi
+2 -2
View File
@@ -24,8 +24,8 @@ jobs:
with:
fetch-depth: 0
- name: Initialize CNPC+ API submodule
run: git submodule update --init --recursive src/api
- name: Initialize submodules
run: git submodule update --init --recursive
- name: Checkout workflows repo
uses: actions/checkout@v4
+224
View File
@@ -0,0 +1,224 @@
name: Generate and Deploy Javadoc
on:
push:
branches:
- master
- '**'
delete:
workflow_dispatch:
inputs:
force_deploy:
description: 'Force redeploy Javadocs without a new commit'
required: false
default: 'true'
jobs:
sanity-check:
runs-on: ubuntu-latest
outputs:
should_deploy: ${{ steps.deploy_check.outputs.should_deploy }}
steps:
- uses: actions/checkout@v4
- name: Check for deploy tag
id: deploy_check
run: |
source .github/scripts/doc-config.sh
BRANCH="${GITHUB_REF#refs/heads/}"
# Always deploy on manual trigger
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "should_deploy=true" >> $GITHUB_OUTPUT
echo "Reason: workflow_dispatch"
exit 0
fi
# Main branch: only deploy if commit message contains [deploy-docs]
if [ "$BRANCH" = "$MAIN_BRANCH_NAME" ]; then
if echo "${{ github.event.head_commit.message }}" | grep -q "\[deploy-docs\]"; then
echo "should_deploy=true" >> $GITHUB_OUTPUT
echo "Reason: master branch with [deploy-docs] tag"
else
echo "should_deploy=false" >> $GITHUB_OUTPUT
echo "Reason: master branch without [deploy-docs] tag, skipping"
fi
exit 0
fi
# Experimental branches: only deploy if whitelisted
for ALLOWED in "${EXPERIMENTAL_WHITELIST[@]}"; do
if [ "$BRANCH" = "$ALLOWED" ]; then
echo "should_deploy=true" >> $GITHUB_OUTPUT
echo "Reason: branch '$BRANCH' is whitelisted"
exit 0
fi
done
echo "should_deploy=false" >> $GITHUB_OUTPUT
echo "Reason: branch '$BRANCH' is not whitelisted, skipping"
build-and-deploy-javadoc:
needs: sanity-check
if: needs.sanity-check.outputs.should_deploy == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout source branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Initialize submodules
run: git submodule update --init --recursive
- name: Setup JDK 8 (compile)
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
- name: Set up JDK 8 (Zulu)
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'zulu'
- name: Setup JDK 11 (javadoc)
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Extract convention plugin version
id: convention
run: |
VERSION=$(grep "id 'com.gtnewhorizons.gtnhsettingsconvention'" settings.gradle settings.gradle.kts 2>/dev/null | grep -o "version '[0-9]\+\.[0-9]\+\.[0-9]\+'" | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Detected convention version: $VERSION"
- name: Get source commit info
id: source_commit
run: |
echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "date=$(git log -1 --format='%cI')" >> $GITHUB_OUTPUT
- name: Cache Gradle wrapper
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache RFG
uses: actions/cache@v4
with:
path: |
build/rfg
build/tmp/.cache/expanded
build/tmp/deobfuscateMergedJarToSrg
key: ${{ runner.os }}-rfg-convention${{ steps.convention.outputs.version }}
restore-keys: |
${{ runner.os }}-rfg-
- name: Cache Node modules
uses: actions/cache@v4
with:
path: .github/pages/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('.github/pages/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Generate Javadoc
run: ./gradlew javadoc
- name: Get deploy path
id: deploy_path
run: bash .github/scripts/resolve-doc-path.sh
- name: Deploy to gh-pages
if: steps.deploy_path.outputs.path != ''
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/docs/javadoc
destination_dir: ${{ steps.deploy_path.outputs.path }}
keep_files: true
# Give GitHub a moment to settle after the peaceiris push
- name: Wait for gh-pages to settle
run: sleep 10
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages-index
- name: Generate manifest
run: |
cd gh-pages-index
SOURCE_HASH="${{ steps.source_commit.outputs.hash }}" \
SOURCE_DATE="${{ steps.source_commit.outputs.date }}" \
DEPLOY_PATH="${{ steps.deploy_path.outputs.path }}" \
bash ../.github/scripts/generate-index.sh
- name: Install page dependencies
run: npm ci --prefix .github/pages
- name: Build index page
run: |
mkdir -p .github/pages/public
cp gh-pages-index/manifest.json .github/pages/public/manifest.json
npm run build --prefix .github/pages
- name: Deploy index to gh-pages
run: |
cp -r .github/pages-dist/* gh-pages-index/
cd gh-pages-index
git config user.name "github-actions"
git config user.email "[email protected]"
git add -A
git commit -m "Regenerate index and manifest [skip ci]" || echo "Unchanged"
git push
cleanup-on-delete:
if: github.event_name == 'delete' && github.event.ref_type == 'branch'
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: 'gh-pages'
- name: Remove deleted branch docs
run: |
BRANCH="${{ github.event.ref }}"
SAFE="experimental/${BRANCH//\//-}"
if [ -d "./$SAFE" ]; then
rm -rf "./$SAFE"
META_KEY="${SAFE//\//_}"
rm -f ".doc-meta/${META_KEY}.json"
git config user.name "github-actions"
git config user.email "[email protected]"
git add -A
git commit -m "Remove docs for deleted branch: $BRANCH"
git push
else
echo "No docs found for $SAFE, skipping."
fi
+2
View File
@@ -45,4 +45,6 @@ src/main/resources/assets/customnpcs/api
df/
tmp/
src/test
node_modules
.github/pages-dist
-58
View File
@@ -1,58 +0,0 @@
# CNPC+ 1.11 Beta - The Scripting Update
🟡 **In Testing**
## Scripting:
- **Syntax Highlighting:**
> Full color-coded script editor. Keywords, types, variables, methods, strings, and comments are all distinct. Scope-aware coloring distinguishes local fields from globals and chained method calls.
- **Autocomplete:**
> Smart suggestions as you type. Context-aware for static vs instance access, shows method parameters, resolves chained calls, and suggests auto imports for classes. Frequently used members prioritized.
- **Error Detection:**
> Catch mistakes before running. Type mismatches, wrong arguments, missing methods, unused imports, duplicate definitions, and more -- all underlined with hover messages explaining the issue.
- **Hover Information:**
> Hover any symbol to see its type, documentation, and declaration. Works on methods, fields, classes, and even generics. Click to pin tooltips in place.
- **Script Editor Overhaul:**
> - **Line Numbers** - Gutter with current line highlighting.
> - **Go To Line** - CTRL+G to jump to any line.
> - **Search & Replace** - CTRL+F / CTRL+H with real-time highlighting.
> - **Go To Definition** - CTRL+Click to jump to any symbol.
> - **Smart Undo/Redo** - Word-level instead of character-level.
> - **Line Operations** - Duplicate, delete, move up/down.
> - **Comment Toggle** - CTRL+/ for selected lines.
> - **Rename** - Rename a symbol across all occurrences.
> - **Smooth Scrolling** - Eased scroll animation.
> - **Indent Guides** - Scope-highlighted vertical indent lines.
> - **Brace Matching** - Highlighted pairs, red for unclosed.
> - **Smart Brackets** - Auto-pairing for `{}`, `()`, `[]`, `""`, `''`.
> - **Fullscreen Mode** - Expand editor to fill the game window.
> - **Shortcut Overlay** - View all keyboard shortcuts at a glance.
- **Java Scripting (Janino):**
> Write scripts in real Java compiled at runtime. Name methods after hooks for automatic wiring. Language selector per tab to switch between Java and JavaScript. External `.java` file support.
- **Client-Side Scripting:**
> Run scripts on the client for responsive experiences. Server-controlled -- off by default, must be explicitly enabled. Script files sync automatically on login and reload.
- **Cloner Tab Overhaul:**
> Folder-based organization for saved NPCs, items, and entries. Full-width directory browser for large collections. Improved tab navigation.
- **Animation Improvements:**
> Data store for passing data across animation events and frames. New consumer-based task system for animation lifecycle. Expanded scripting API for animation control.
**Extras**
- Player Dialog Events now work like NPC Dialog Events.
- Attack speed configuration for linked items.
- Client-side balance prediction during Trader interactions.
- Right-click cycling on multi-option NPC buttons (Hair, Eyes, Fur, etc.).
- Fixed quest cooldown for MC Custom and RL Custom timer types.
- Fixed Bard music restarting when opening dialogs.
- Fixed NPC biome spawn settings not saving after editing.
- Fixed block waypoint issues.
- Fixed script config syncing between server and client.
-118
View File
@@ -1,118 +0,0 @@
# ✏️ CustomNPC+ 1.11 - The Scripting Update ✏️
---
The **Scripting Update** completely transforms how you write scripts in CNPC+! A brand new **Script Editor** with **syntax highlighting**, **autocomplete**, and **error detection** makes scripting feel like a real IDE. Write scripts in **Java** with the new Janino engine, enable **client-side scripting** for responsive experiences, and organize your Cloner with **folders**!
---
## Script Editor 📝
The script editor has been rebuilt from the ground up into a **full-featured code editor** right inside Minecraft.
### Writing Code
- **Syntax Highlighting** - Keywords, types, variables, methods, strings, and comments are all color-coded automatically. The editor understands your code -- local variables, global fields, and chained method calls each get their own color
- **Autocomplete** - Start typing and get smart suggestions for methods, fields, and classes. Suggestions know whether you're in a static or instance context, and frequently used members appear first
- **Auto Imports** - Type a class name and the editor suggests the correct import for you
- **Error Detection** - Catch mistakes before you even run your script! Wrong argument types, missing methods, type mismatches, unused imports, and more are all underlined with detailed error messages on hover
> Hover over any symbol to see its **full type information**, documentation, and declaration -- just like a desktop IDE.
---
### Navigation
- **Go To Line** - `CTRL+G` jumps to any line instantly
- **Search & Replace** - `CTRL+F` to search, `CTRL+H` to replace. All matches highlight in real-time
- **Go To Definition** - `CTRL+Click` any method, field, or type to jump straight to its definition
- **Fullscreen Mode** - Expand the editor to fill your entire game window for maximum workspace
### Editing
- **Undo/Redo** - Smart undo that works on whole words at a time, not individual characters
- **Line Operations** - Duplicate lines with `CTRL+D`, delete lines, and move lines up or down with shortcuts
- **Comment Toggle** - `CTRL+/` to comment or uncomment selected lines
- **Rename** - Rename a variable or method and every occurrence updates at once
- **Copy Whole Line** - Copy with nothing selected grabs the entire line
- **Triple Click** - Select an entire line instantly
### Visual Polish
- **Line Numbers** - A clean gutter with line numbers and current line highlighting
- **Smooth Scrolling** - Eased scroll animations for a polished feel
- **Indent Guides** - Vertical lines show your code's nesting depth, with the current scope highlighted in green
- **Brace Matching** - Matching `{}` braces light up, and unclosed braces turn red
- **Smart Brackets** - Typing `{` automatically creates the closing `}` with correct indentation. Same for `()`, `[]`, `""`, and `''`
- **Keyboard Shortcut Overlay** - Press a button to see all available shortcuts at a glance
---
## Java Scripting ☕
Write scripts in **real Java** instead of JavaScript! Powered by the **Janino** compiler, your Java code is compiled and runs natively.
- **Full Java Language** - Use classes, interfaces, enums, generics, lambdas, and everything you know from Java
- **Automatic Hook Resolution** - Just name your methods after the hook you want (e.g., `init`, `tick`, `interact`) and they're wired up automatically
- **Language Selector** - Each script tab has a dropdown to choose between JavaScript and Java. Mix and match across tabs
- **External Files** - Write `.java` scripts in an external editor and they're loaded automatically
> Java and JavaScript scripts coexist side by side. Pick whichever language fits your workflow!
---
## Client-Side Scripting 🖥️
Scripts can now run **on the client** for responsive, visual experiences!
- **Server Controlled** - Server owners decide whether client scripting is allowed. Players can't enable it on their own
- **Automatic Sync** - Script files are sent from the server to all connected clients on login, and re-synced whenever scripts are reloaded
- **Safe by Default** - Client scripting is off by default and must be explicitly enabled in the server config
> Client-side scripts open the door to custom UI effects, visual feedback, and client-only hooks -- all while the server stays in full control.
---
## Cloner Tab Overhaul 📂
The Cloner now supports **folders** for organizing your saved NPCs, items, and entries!
- **Folder System** - Create folders and subfolders to keep your cloner organized however you like
- **Full Screen Browser** - A new full-width directory view makes browsing large collections much easier
- **Improved Tabs** - Better tab navigation for switching between cloner categories
---
## Addon API Support 📘
Addon developers can now ship **type definitions** alongside their mods, giving scripters full autocomplete and documentation for addon APIs!
- **Automatic Loading** - Any mod can include API definitions and they'll appear in the script editor automatically
- **Patch Support** - Addons can extend existing CNPC+ types with new methods (e.g., a DBC addon adding `getDBCPlayer()` to the Player type)
- **Full Documentation** - Parameter names, return types, and descriptions all show up in autocomplete and hover info
> If you're a scripter using addons, you get autocomplete for their APIs with zero setup. If you're an addon developer, just include your definitions and everything works.
---
## Animation Improvements 🎬
- **Data Store** - Animations can now store and pass data across events and frames for more complex animation logic
- **Task System** - A new consumer-based system for reacting to animation lifecycle events, replacing the old approach
- **Expanded API** - More animation control exposed to the scripting API
---
## Additional Changes 🔧
- **Player Dialog Events** - Now work the same way as NPC Dialog Events for consistency
- **Linked Item Attack Speed** - Added attack speed configuration to linked items
- **Trader Balance Preview** - Client-side balance prediction shows your expected balance during trades
- **Right-Click Cycling** - Multi-option NPC buttons (Hair, Eyes, Fur, etc.) can now be right-clicked to cycle backwards
- **Quest Cooldown Fix** - Fixed cooldown not working for MC Custom and RL Custom timer types
- **Bard Music Fix** - Fixed music restarting or duplicating when opening dialogs
- **Biome Spawn Fix** - Fixed NPC biome spawn settings not saving after editing
- **Block Waypoint Fix** - Fixed issues with block waypoints
- **Script Config Fix** - Fixed script configuration not syncing properly between server and client
---
-81
View File
@@ -1,81 +0,0 @@
# CNPC+ 1.11 Ability System Beta
🟡 **In Testing**
## Ability Update: ⚒️
- **Phase-Based Execution:**
> All abilities follow a Wind-up → Active → Completion flow. Wind-up lets players react, Active deals the effect.
- **Melee Abilities:**
> - **Slam** - Leap and AOE on impact.
> - **Heavy Hit** - Single powerful strike with bonus knockback.
> - **Cutter** - Slashing cone arc attack.
> - **Shockwave** - AOE burst radiating from the caster.
- **Energy Orbs:**
> - **Orb** - Homing energy sphere.
> - **Dual Orb** - Two simultaneous homing orbs.
> - **Orb Barrage** - Rapid volley of orbs in sequence.
- **Energy Discs:**
> - **Disc** - Spinning flat projectile with optional boomerang.
> - **Dual Disc** - Two simultaneous discs.
- **Energy Beams:**
> - **Beam** - Sustained homing beam from caster to target.
> - **Dual Beam** - Two simultaneous beams.
- **Laser Shot:**
> Instant-fire projectile with no homing. Pure aim.
- **Projectile:**
> Standard projectile using classic Minecraft physics.
- **Movement Abilities:**
> - **Charge** - Rush forward in a line, damaging everything in path.
> - **Dash** - Quick directional movement without damage.
> - **Teleport** - Instant relocation to the target.
- **AOE Abilities:**
> - **Sweeper** - Wide rotational sweep around the caster.
> - **Vortex** - Pulls entities inward while dealing damage.
- **Telegraph System:**
> Visual ground indicators during wind-up. Supports Circle, Ring, Line, Cone, and Point shapes with color customization and warning phase transitions.
- **Energy Projectile Customization:**
> Modular data system for all energy projectiles: Anchor Point, Display Colors, Homing, Combat Stats, and Lifespan.
- **Ability Effects:**
> Abilities can apply potion effects on hit: Slowness, Weakness, Poison, Wither, Blindness, Nausea, Hunger, Mining Fatigue.
- **Ability Conditions:**
> Condition system controlling when abilities can execute based on target state and custom predicates.
- **Interruptible Wind-ups:**
> Abilities can be interrupted by damage during wind-up, forcing a configurable Dazed recovery state.
- **Movement & Rotation Locking:**
> Lock caster movement, rotation, or both during Wind-up, Active, or both phases.
- **Animation & Sound Integration:**
> Wind-up and Active animations with optional duration sync. Custom sound events per phase.
- **Player Abilities:**
> Players can unlock abilities, select one at a time, and share a universal cooldown.
- **Ability Preview:**
> Live preview in the ability editor GUI. Test telegraphs, animations, and projectiles on a dummy NPC.
- **Scripting API:**
> Full event support: Start, Execute, Interrupt, Complete, Hit (modifiable damage/knockback), and Tick events. Start, Execute, and Hit are cancelable.
- **Ability Commands:**
> `/kam ability list`, `types`, `info`, `delete`, `reload` for managing custom abilities.
**Extras**
- Global ability presets that update everywhere when edited.
- Weighted ability selection for NPC random usage.
- Configurable min/max range per ability.
- Reusable telegraph presets shared across abilities.
-199
View File
@@ -1,199 +0,0 @@
# ⚔️ CustomNPC+ 1.11 - Abilities ⚔️
---
The **Ability Update** introduces a full combat ability system to CNPC+! Give your NPCs powerful attacks with **visual telegraphs**, launch **energy projectiles** that home in on targets, and let players unlock abilities of their own!
---
## How Abilities Work 🎯
Every ability follows a **phase-based execution flow** that gives combat a readable, strategic feel.
**Phases:**
- **Wind-up** - The ability charges. Telegraphs appear, animations play, and observant players can react
- **Active** - The ability fires. Damage is dealt, projectiles launch, effects apply
- **Dazed** - Optional recovery state if the ability is interrupted during wind-up
**Core Configuration:**
- **Cooldown** - Time before the ability can be used again
- **Targeting Mode** - Aggro Target, Self, AOE on Self, or AOE on Target
- **Range** - Configurable min and max range for activation
- **Lock Movement** - Lock the caster's movement, rotation, or both during any phase
- **Interruptible** - Allow damage to interrupt wind-up and force a dazed state
- **Weight** - Priority weighting for NPC random ability selection
> Abilities support both **inline configuration** on individual NPCs and **global presets** that update everywhere when edited.
---
## Melee Abilities 🗡️
Close-range attacks that hit hard and punish positioning.
- **Slam** - Leap toward the target in an arc, dealing AOE damage on impact. Configurable radius, knockback, and leap height
- **Heavy Hit** - A single powerful melee strike with bonus knockback
- **Cutter** - A slashing arc attack in a cone. Configurable angle and reach
- **Shockwave** - An AOE burst radiating outward from the caster
> All melee abilities support configurable **damage**, **knockback**, and **potion effects** on hit.
---
## Energy Projectiles ✨
A brand new projectile system built from the ground up with full visual customization.
### Orbs
Homing energy spheres that track their target through the air.
- **Orb** - A single homing projectile
- **Dual Orb** - Fires two orbs simultaneously
- **Orb Barrage** - Fires a volley of orbs in rapid sequence
### Discs
Flat spinning projectiles with optional **boomerang** behavior.
- **Disc** - A single spinning disc with configurable radius and thickness
- **Dual Disc** - Fires two discs simultaneously
### Beams
Sustained energy beams that connect the caster to their target.
- **Beam** - A homing beam with configurable width and head size. Locks the caster in place during channeling
- **Dual Beam** - Fires two beams simultaneously
### Laser Shot
An **instant-fire** projectile with configurable width and speed. No homing — pure aim.
### Projectile
A standard projectile using classic Minecraft physics for a more traditional ranged attack.
### Energy Configuration
Every energy projectile shares a **modular data system** for deep customization:
- **Anchor Point** - Choose where the projectile spawns: Right Hand, Left Hand, Front, Center, Chest, or Above Head
- **Display** - Set core color, edge color, glow effect, transparency, and size
- **Homing** - Toggle homing, adjust turn rate and max tracking range
- **Combat** - Damage, knockback, vertical knockback, hit cooldown, and optional AOE splash
- **Lifespan** - Projectile speed, max age, and max travel distance
---
## Movement Abilities 💨
Abilities that reposition the caster in combat.
- **Charge** - Rush forward in a line, damaging all entities in the path. Configurable speed, hit width, and knockback
- **Dash** - A quick directional movement without dealing damage
- **Teleport** - Instantly relocate to the target's position
> **Charge** locks direction during wind-up, so the telegraph accurately shows the attack path.
---
## AOE Abilities 🌀
Area control abilities that dominate space.
- **Sweeper** - A wide rotational sweep attack around the caster with configurable radius and rotation speed
- **Vortex** - Creates a pulling force that drags nearby entities toward the center while dealing damage
---
## Telegraph System 📍
**Telegraphs** are visual ground indicators that warn players before an ability lands. They appear during the wind-up phase and disappear when the ability fires.
**Shapes:**
- **Circle** - Filled circle with configurable radius
- **Ring** - Donut shape with inner and outer radius
- **Line** - Rectangle along the attack direction
- **Cone** - Fan/wedge shape with configurable angle
- **Point** - Single point indicator
**Features:**
- **Color Customization** - Set ARGB colors for both the telegraph and its warning phase
- **Warning Phase** - Color shifts in the final ticks before the ability fires
- **Entity Tracking** - Telegraphs can follow a moving entity or stay at a fixed position
- **Smooth Interpolation** - Position updates are interpolated for clean visuals
> Telegraphs are saved as **reusable presets** and can be shared across multiple abilities.
---
## Animations & Sound 🎬
Abilities integrate directly with the animation and sound systems.
- **Wind-up Animation** - Plays during the charging phase
- **Active Animation** - Plays when the ability fires
- **Animation Sync** - Optionally sync wind-up duration to match animation length exactly
- **Sound Events** - Assign custom sounds to both wind-up and active phases
- **Phase Colors** - Visual color feedback on the caster during wind-up and active
> Many ability types include **built-in animation names** that work automatically when matching animations exist.
---
## Effects & Conditions ⚡
### Potion Effects
Abilities can apply **potion effects** to any entity they hit. Each effect has configurable type, duration, and amplifier.
**Available Effects:**
Slowness, Weakness, Poison, Wither, Blindness, Nausea, Hunger, Mining Fatigue
### Conditions
Abilities support a **condition system** that controls when they can be used. Conditions are evaluated before execution and can require specific target states, ranges, or custom predicates.
---
## Player Abilities 🧑
Players can unlock and use abilities too!
- **Unlock System** - Players receive abilities via scripting or commands
- **Ability Selection** - Choose one ability at a time from your unlocked list
- **Universal Cooldown** - Shared cooldown across all player abilities
---
## Scripting API 📜
Full scripting support for ability lifecycle events:
- **StartEvent** *(Cancelable)* - Fired when wind-up begins
- **ExecuteEvent** *(Cancelable)* - Fired when the ability activates
- **InterruptEvent** - Fired when wind-up is interrupted by damage
- **CompleteEvent** - Fired when the ability finishes
- **HitEvent** *(Cancelable)* - Fired on each entity hit. Damage and knockback values can be modified
- **TickEvent** - Fired every tick with current phase and tick count
> Scripts can cancel, modify damage, and react to every phase of ability execution.
---
## Ability Preview 🔎
The ability editor includes a **live preview system**. Test your telegraph shapes, animations, and projectile visuals directly in the GUI on a dummy NPC — no world effects applied.
---
## Ability Commands 💬
- `/kam ability list` - List all custom abilities
- `/kam ability types` - List all registered ability types
- `/kam ability info <name|uuid>` - View ability details
- `/kam ability delete <uuid>` - Delete a custom ability
- `/kam ability reload` - Reload abilities from disk
---
-54
View File
@@ -1,54 +0,0 @@
# CNPC+ 1.11 Beta - Market Update
## Auction Features: ⚒️
- **Built-in Currency System:**
> Fully configurable economy currency used across all Market features. Profile persistent across character slots with Vault support for Bukkit-compatible plugins.
- **Auction House:**
> Global player marketplace for listing items, bidding, and instant buyouts. Auctions last 24 hours by default.
- **Auction Bidding & Snipe Protection:**
> Competitive bidding with a 5% minimum bid increment. Snipe Protection extends auctions on last-second bids. Outbid players are automatically refunded.
- **Buyout System:**
> Instant purchase at the seller's Buyout Price. Highest bidder only pays the difference between their bid and the buyout.
- **My Trades:**
> Single screen for managing Active Listings, Active Bids, and Pending Claims. Players can cancel listings with a 10% penalty if bids exist.
- **Auction Notifications:**
> Real-time notifications for sales, outbids, and wins. Offline players receive a claim summary on login.
- **Trade Slots:**
> Limited slots (default 8, max 45) shared across listings, bids, and claims. Configurable via permissions.
- **Claim Expiration:**
> Uncollected claims expire after 20 days.
- **Item Blacklist:**
> Block items by registry name, wildcard pattern, mod, or NBT tag. Soulbound and Profile-Slotbound items are always blocked automatically.
- **Listing Fee & Sales Tax:**
> Configurable listing fee charged on creation and sales tax taken from successful sales.
- **Search & Sorting:**
> Search by item name or seller. Sort by newest, ending soon, price, or most bids.
- **Trader Stock System:**
> Limited stock with Global or Per-Player modes. Restock timers for MC Daily/Weekly, RL Daily/Weekly, or Custom intervals.
- **Trader Currency Trades:**
> Trades can require currency on top of item costs.
- **Auctioneer NPC Role:**
> New role that opens the Auction House on interaction. No configuration needed.
- **Auction Commands:**
> `/kam auction open` for players. Admin commands for listing view and player activity inspection.
**Extras**
- Auction logging for server admins (tracks creates, bids, buyouts, sales, expirations, cancellations, claims).
- Lifetime currency tracking per player (total earned and spent).
- Configurable starting balance and max balance cap.
- Blacklist bypass permission for admins.
-121
View File
@@ -1,121 +0,0 @@
# 🏪 CustomNPC+ 1.11 - Market Update 🏪
---
The **Market Update** brings a complete economy system to CNPC+! Create bustling marketplaces with **Traders** that have limited stock, or let players trade with each other through the brand new **Auction House**!
---
## Currency System 💰
CNPC+ now has a **built-in currency** used across all Market features!
- **Fully Configurable** - Name it Coins, Gold, Credits, whatever fits your world. Set a starting balance and max balance cap to shape your economy
- **Profile Persistent** - Currency carries across all your character slots
- **Vault Support** - Integrates seamlessly with Bukkit-compatible economy plugins if Vault is installed. Falls back to built-in currency otherwise
- **Lifetime Tracking** - Tracks total earned and spent per player
> Full Scripting API support for currency operations on players.
---
## Auction House 🏛️
A **global player marketplace** where players can list items, bid against each other, and purchase instantly! Search for items by name or seller, and sort by newest, ending soon, price, or most bids.
### Selling
List any item with a **Starting Price** for competitive bidding. Set an optional **Buyout Price** for players who want to skip the wait and buy immediately. Auctions last **24 hours** by default.
> A configurable **Listing Fee** is charged when creating auctions, and a **Sales Tax** is taken from successful sales.
### Bidding
Compete for items by placing bids! Each bid must be at least **5%** higher than the current bid. **Snipe Protection** extends auctions when last-second bids come in, giving everyone a fair shot. If you get outbid, your currency is **automatically refunded**.
### Buyout
See something you need right now? Hit **Buy Now** to purchase instantly at the seller's Buyout Price. If you're currently the highest bidder on an item, you only pay the **difference** between your bid and the buyout.
### My Trades
One screen to manage all your auction activity:
- **Active Listings** - Items you're currently selling
- **Active Bids** - Auctions you're competing in
- **Ready to Claim** - Won items and currency waiting for pickup
Players can **cancel** their own listings -- items are returned as a claim. If there are active bids on the listing, a **10% cancellation penalty** is charged.
> Claims expire after **20 days**. Make sure to collect your items and currency before they're gone!
### Notifications
Get notified immediately when your item sells, when you're outbid, or when you win an auction. Offline? You'll get a full **claim summary** when you log back in showing exactly what's waiting for you.
### Trade Slots
Every player gets a limited number of **Trade Slots** (default 8). Slots are shared across Active Listings, Active Bids, **and** Pending Claims -- so uncollected claims take up space. Pick up your claims to free slots for new listings and bids!
> Server owners can grant players more slots via permissions up to a maximum of 45.
---
## Item Blacklist 🚫
Server owners have full control over what items can be listed on the Auction House.
**Block by:**
- **Item** - Specific registry names like `minecraft:diamond_sword`
- **Wildcard** - Patterns like `minecraft:diamond*` to block all diamond items
- **Mod** - Block all items from a specific mod
- **NBT Tag** - Block items containing certain NBT data
> **Soulbound** and **Profile-Slotbound** items are always blocked automatically, regardless of blacklist settings. Bound items cannot be traded!
Manage the blacklist in-game with `/kam auction blacklist` commands, or configure it directly in the config file.
---
## Trader Enhancements 🛒
### Stock System
Traders now support **limited stock** with automatic restocking!
**Stock Modes:**
- **Global** - All players share the same stock pool
- **Per-Player** - Each player has their own purchase limits
**Restock Timers:**
- **MC Daily / Weekly** - Restock based on Minecraft time
- **RL Daily / Weekly** - Restock based on real-life time
- **Custom** - Set your own interval in MC ticks or real-time
Stock counts, out-of-stock status, and restock timers are all visible directly in the trade interface.
> Admins can manually reset stock or cooldowns via the Trader GUI.
### Currency Trades
Trades can now require **currency on top of items**. Combine material costs with coin costs for balanced economy progression!
---
## Auctioneer Role 🧑‍💼
New NPC role for the Auction House! Set the role on any NPC and players can access the full Auction House by interacting with them -- no extra configuration needed. The role respects the global Auction Enabled setting.
### Auction Commands
Players can also access the Auction House via command:
- `/kam auction open` - Opens the Auction House GUI
**Admin Commands:**
- `/kam auction list [page]` - View active auctions in chat
- `/kam auction view <player>` - View a player's auction activity
> Server owners can enable **auction logging** to track all auction activity (creates, bids, buyouts, sales, expirations, cancellations, and claims).
---
+98
View File
@@ -0,0 +1,98 @@
# CustomNPC+ 1.11 Changelog
## Ability System
- Phase-based abilities (Wind-up, Active, Dazed) with configurable cooldowns, targeting, range, interrupts, invulnerability, and magic damage
- **Melee:** Slam, Heavy Hit, Cutter
- **Energy Projectiles:** Orb, Disc, Beam, Laser Shot with variant system, homing, hit types (Single/Pierce/Multi), size interpolation, explosions
- **Barriers:** Dome, Wall, Shield with HP, reflection, damage absorption
- **Defensive:** Guard, Counter, Dodge
- **Movement:** Charge, Dash, Teleport
- **AOE:** Shockwave, Sweeper, Vortex
- **Hazards & Traps:** Persistent zones and proximity triggers with visual presets
- **Effect:** Healing, buffs, debuffs with target filtering (Allies/Enemies/All)
- **Custom Ability:** Blank-slate type with full script hooks and toggle modes
- Burst system, chained ability combos with concurrency, telegraph system (6 shapes)
- Per-phase animations and sound events
- Ability conditions: HP Threshold, Hit Count, Has Item, Quest Completed, Has Effect
- 12-slot player ability hotbar with HUD editor
- Full scripting API for ability and energy projectile lifecycle events
- Ability Extender system for custom hooks
- Live preview in editor
- Commands: `/kam ability list|types|prebuilts|info|delete|reload|give|remove|giveChain|removeChain|player`
## Auction House
- Global marketplace with bidding, buyout, and snipe protection
- Built-in currency system (configurable, profile-persistent, Vault support)
- Listing fees, sales tax, minimum prices
- My Trades panel with claim management (20-day expiry)
- Search/sort, notifications (online + offline summary)
- Trade slots (default 8, expandable via permissions)
- Item blacklist (by item, wildcard, mod, NBT; soulbound always blocked)
- Auctioneer NPC role
- Admin GUI and logging
- Cancelable scripting events: Create, Bid, Buyout, Cancel, Claim
## Script Editor
- Full code editor with syntax highlighting, autocomplete, error detection, and hover tooltips
- Go to Line, Search/Replace, Go to Definition, Fullscreen
- Undo/Redo, Duplicate Line, Comment Toggle, Rename, Move Lines
- Line numbers, smooth scrolling, indent guides, brace matching, smart brackets
## Java Scripting
- Write scripts in Java via Janino compiler with automatic hook resolution
- Per-tab language selector (mix Java and JavaScript)
- External `.java` file support
## Client-Side Scripting
- Server-controlled client script execution with auto-sync (off by default)
## Addon API Support
- Ship `.d.ts` type definitions for automatic script editor autocomplete
- Patch support for extending CNPC+ types, hot reload
## Traders
- Stock system: Global or Per-Player modes with configurable restock timers
- Currency trades (items + coins)
- Client-side balance preview
## Cloner
- Folder and subfolder organization for all categories
- Full-width directory browser, improved tabs, tag-based filtering
## Animations
- Data store for passing data across events/frames
- Consumer-based task system
- Expanded scripting API
## Animated Textures
- Frame-based animation for items, effect icons, ability hotbar, scripted GUIs
## NPC API
- `IHitboxData` (width/height scaling), `ITintData` (hurt tint, persistent tints)
- Scriptable behavior: sprint, swim, doors, fire reactions, tactical chance, walking range
- `ISound` (volume, pitch, repeat, position)
- Skin overlay `getColor()`/`setColor()`, knockback API
- Six overlays in singleplayer, script error reporting to console
## NPC Combat & Behavior
- Attack speed enforcement, passive faction protection
- Improved track speed, invalid texture fallback
## Other Changes
- Player Dialog Events match NPC Dialog Events
- Linked Item attack speed and scripting API
- Right-click cycling on multi-option buttons
- Legacy quest import (1.6.4), fullscreen/pannable GUIs, unified menu background
- Textfield CTRL shortcuts, `java.lang.reflect` banned in scripts
- Entity packet loss fix (invisible NPCs)
- Natural spawn GUI, runtime control, and despawn improvements
## Bug Fixes
- Script config sync, Bukkit integration
- Quest cooldown for MC/RL Custom timers, quest/dialog saving and categories
- Bard music restart on dialog open
- Spawner yaw, biome spawn persistence, NPC invisibility
- Track speed, set speed edge cases, spawn data, block waypoints, job spawner
- Hitbox scaling and collision
- Animation offsets, lookup failures, syncing, resync on teleport, registration names, double loading
- Mount movement jitter, dismount edge cases
+402 -65
View File
@@ -1,95 +1,432 @@
![CustomNPC+ Banner](images/logo_banner.png)
## 👋 Welcome to the CustomNPC+ Repository.
![](images/logo_banner.png)
# CustomNPC+
> CustomNPC+ is a [Minecraft](https://minecraft.net/) mod that allows you to add custom NPCs to your world. It is developed for creative and storytelling players who want to make their Minecraft worlds more in-depth and unique. CustomNPC+ is only a branch version of the **1.7.10** Forge version of the original (down below) and has no plans to add or update any other version. This is not an official version of CustomNPC.
**CustomNPC+** is a Minecraft 1.7.10 Forge mod that lets you create fully customizable NPCs with advanced AI, combat abilities, quests, dialogs, scripting, an economy system, and much more. Built for creative and storytelling players who want to transform their worlds into living RPG experiences.
----------------
> CustomNPC+ is a branch version of the original [CustomNPC](https://www.curseforge.com/minecraft/mc-mods/custom-npcs) by [Noppes](https://github.com/Noppes), developed with permission. This is not an official version of CustomNPC.
<a href="https://discord.gg/pQqRTvFeJ5"> <img src="https://img.shields.io/badge/KAMKEEL_Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white" width="400" height="60"> </a>
<a href="https://ko-fi.com/kamkeel"> <img src="https://img.shields.io/badge/Support_Me_|_Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white" alt="Support Me" width="400" height="60"> </a>
---
<a href="https://discord.gg/pQqRTvFeJ5"> <img src="images/Discord.png" width="400" height="60"> </a>
[![Download CustomNPC+](https://img.shields.io/badge/CustomNPC+-0081CB?style=for-the-badge&logo=material-ui&logoColor=white)](https://modrinth.com/mod/customnpc-plus)
[![Download MPM+](https://img.shields.io/badge/MorePlayerModels+-0081CB?style=for-the-badge&logo=material-ui&logoColor=white)](https://www.curseforge.com/minecraft/mc-mods/moreplayermodels-plus)
[![Download PluginMod](https://img.shields.io/badge/Plugin_Mod-0081CB?style=for-the-badge&logo=material-ui&logoColor=white)](https://github.com/KAMKEEL/Plugin-Mod)
----------------
---
### ❗ Notice
I am not the original creator of CustomNPC. The original creator is @[Noppes](https://github.com/Noppes). I have been permitted to update and develop my own branch version for 1.7.10. The original mod that is updated to the latest versions of Minecraft can be found on these links: [CurseForge](https://www.curseforge.com/minecraft/mc-mods/custom-npcs), [kodevelopment](http://www.kodevelopment.nl/minecraft/customnpcs)
## Installation
### ⬇️ Downloads
CustomNPC+ is a **replacement** for the original CustomNPC — not an add-on. Do not install both together. Simply drop CustomNPC+ into your client or server mods folder. All original CustomNPC features are preserved and expanded upon.
> Please **backup your world** before installing. Report any bugs on the [issue tracker](https://github.com/KAMKEEL/CustomNPC-Plus/issues).
### Downloads
- **Modrinth**: [Download](https://modrinth.com/mod/customnpc-plus)
- **CurseForge**: [Download](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
### 🔹 Installation
This mod is an ***update*** to CustomNPC and not an add-on. Do not install CustomNPC with CustomNPC-Plus. CustomNPC-Plus does not remove any functional features from the original mod. It expands upon CustomNPC with original features and backported features from newer versions. Simply drag CustomNPC-Plus into any client/server mods folder to utilize. Please **backup** before using as this could still have unforeseen errors. Report any bugs if found, thank you and enjoy.
---
### ❓ Features:
- Flying NPC (Smart Pathfinding)
- 1.8 Skin Support (64x64) (Alex/Steve64)
- Full URL64 Selector (Downloads FULL Size Images for Custom Mob Skins)
- Additional Parts: [Wings, Fins, Capes, Horns, Tail]
- Hide Body Parts [Arms, Legs, Head, Body]
- Custom Overlays
- Animation Maker
- Enhanced Cloner GUI (More Tabs, Filters, Tags)
- Markov Name Generator
- Dark Mode GUI (Link Below)
- 1.12 Scripting Features (Details below)
- Profile System (Multiple Character Slots)
- Quest Party System
- Item and Armor Attributes
- Magic System with Elemental Cycles
- Custom Effect Engine
- Scripted Blocks & Particles
- Compass Marks for Waypoints
- Custom Model Support
- Gecko & Dragon Block C Addons
<a href="https://ko-fi.com/kamkeel"> <img src="images/Kofi.png" width="400" height="60"> </a>
#### Scripting:
- CustomNPC+ Api: [API](https://github.com/KAMKEEL/CustomNPC-Plus-API)
- Java Doc: [kamkeel.github.io/CustomNPC-Plus](https://kamkeel.github.io/CustomNPC-Plus/)
- Scripted Items
- Player Overlays
- Script Timers
- Global Scripts
- Script Logging
- GUI Overlays
- Event Scripting
(We never remove script functionality, only add on existing functions)
> More betas with new features will continue to be released to supporters for **Early Access** to new content!
## 🔰 Skin Model Feature:
###### **Majority of these cape designs are taken from the internet with fair-usage.*
##### ❔ Please note all *local* skins in this version of CustomNPC, must match the model selected.
<img src="images/skinAnimation.gif" width="474" height="260"/>
---
## Feature Overview
### NPC Creation & Customization
Create NPCs with deep visual customization and lifelike behavior.
<img src="images/NPCEditor.gif" width="474" height="260"/>
- **Skin System** - 1.8 skin support (64x64), Alex & Steve64 models, full URL64 selector that downloads full-size images for custom skins
- **Body Parts** - Wings, fins, capes, horns, tails. Hide individual body parts (arms, legs, head, body)
- **Skin Overlays** - Layer additional textures on top of the base skin with color tinting and alpha control
- **Custom Models** - Support for custom model formats, plus Gecko and DBC addon model integration
- **Hitbox Scaling** - Independently scale NPC hitbox width and height
- **Tint System** - Control hurt flash color and apply persistent color tints
---
### NPC AI & Behavior
NPCs have a full AI system for combat, pathing, and interaction.
- **Flying NPCs** - Smart pathfinding in 3D space for flying entities
- **Combat AI** - Multiple tactical behaviors: attack, ranged attack, ambush, pounce, dodge-shoot, zigzag, stalk, orbit, sprint-to-target, and leap attacks
- **Movement Types** - Standing, wandering, and moving path modes
- **Pathfinding** - Ground, flying, and water navigation
- **Door Interaction** - NPCs can break, open, or ignore doors
- **Behavior Controls** - Configurable sprinting, swimming, fire reactions, tactical chance, and walking range
- **Attack Speed** - NPCs respect attack speed timing when dealing damage
- **Faction Awareness** - NPCs respond to faction standings. Passive faction NPCs are protected from damage
#### Flying NPCs:
<img src="images/FlyingNPC.gif" width="474" height="260"/>
#### Url64:
<img src="images/Url64Example.gif" width="474" height="260"/>
---
#### DarkMode + Cloner GUI:
<img src="images/ClonerGUI-DarkMode.png" width="474" height="260"/>
### NPC Roles & Jobs
## 🔗 Want to check out my other projects?
[Plugin Mod](https://github.com/KAMKEEL/Plugin-Mod) is a mod designed to add more aesthetic items for RPG and storytelling. It is compatible with CustomNPC+ and has many items intended to be used and wielded by created NPCs.
**Roles** give NPCs interactive functions — Trader, Follower, Bank, Transporter, Postman, Companion, Mount, and Auctioneer. **Jobs** give NPCs background tasks — Bard, Healer, Guard, Item Giver, Follower, Spawner, Conversation, and Chunk Loader.
[RPG Messenger](https://github.com/KAMKEEL/RPGMessenger) is a bukkit plugin designed to allow operators to create messagable NPCs for RPG Servers. Allows a 'RPG Controller' to reply quickly as NPCs, form groupchats, and messagable parties.
---
[CustomNPC+ Dark Mode](https://github.com/KAMKEEL/CustomNPC-Plus-Dark-Mode) is a resource pack for CustomNPC+ that alters all GUIs within the mod to a dark variant that is both clean and pleasing to look at.
### Dialog System
## Cloning / Compiling / Building
Create branching dialog trees for storytelling and player interaction.
git clone call `git submodule update --init --recursive`
<img src="images/Dialog.png" width="474" height="260"/>
Using IntelliJ, take the following steps:
1. Run `setupDecompWorkspace` under the `forgegradle` tab.
2. Refresh Gradle.
3. Run `genIntellijRuns` under the `other` tab to set up your Minecraft runs.
- **Dialog Trees** - Multi-level branching conversations with unlimited depth
- **Dialog Options** - Player choices that affect outcomes, trigger quests, or change faction standings
- **Dialog Images** - Display images alongside dialog text
- **Dialog Colors** - Customizable text and background colors
- **Categories** - Organize dialogs into categories for large projects
- **Availability Conditions** - Show or hide dialogs based on quests, factions, items, or custom conditions
- **Script Hooks** - Full scripting support for dialog open, close, and option events
or for Eclipse, run `gradlew setupDecompWorkspace eclipse` then import the project.
---
Mixin code will not work if you do not add `--tweakClass org.spongepowered.asm.launch.MixinTweaker --mixin customnpcs.mixins.json` to your program arguments.
### Quest System
A complete quest framework for RPG progression.
<img src="images/QuestMarks.png" width="474" height="260"/>
- **Quest Types** - Item collection, dialog completion, kill targets, reach locations, area kills, and fully manual (script-driven) quests
- **Quest Tracking** - On-screen HUD overlay showing active quest objectives
- **Categories** - Organize quests into categories
- **Rewards** - Configure item, XP, and currency rewards
- **Cooldowns** - Repeatable quests with MC time, real-time, or custom cooldown intervals
- **Party Quests** - Share quest objectives across party members with configurable sharing modes
- **Availability** - Control quest visibility based on completed quests, faction standing, dialogs, and more
- **Script Hooks** - Events for quest start, completion, turn-in, and custom quest objectives
---
### Ability System
A full combat ability system for both NPCs and players.
<img src="images/NPCAbilities.gif" width="474" height="260"/>
<img src="images/PlayerAbilities.gif" width="474" height="260"/>
**Melee Abilities** - Slam, Heavy Hit, Cutter
**Energy Projectiles** - Orbs, Discs, Beams, Laser Shots with full visual customization, homing, and hit types
**Energy Barriers** - Domes, Walls, Shields with HP, reflection, and damage absorption
**Defensive** - Guard, Counter, Dodge with configurable damage reduction and counter-attacks
**Movement** - Charge, Dash, Teleport
**AOE** - Shockwave, Sweeper, Vortex
**Hazards & Traps** - Persistent damage zones and proximity-triggered traps with visual presets
**Support** - Ability Effect for healing, buffs, and debuffs
**Key Features:**
- Phase-based execution (Wind-up, Active, Dazed) with visual telegraphs
- Burst system for rapid multi-fire
- Chained abilities for sequential combos
- Player ability hotbar (12 slots) with unlock system
- Full scripting API for every lifecycle event
- Live preview in the ability editor
---
### Auction House & Economy
A complete marketplace and economy system.
<img src="images/Auction.png" width="474" height="260"/>
- **Built-in Currency** - Configurable currency with starting balance, max cap, and Vault plugin integration
- **Auction House** - Global player marketplace with bidding, buyout, snipe protection, and notifications
- **Trade Slots** - Configurable per-player slot limits via permissions
- **Item Blacklist** - Block items by name, wildcard, mod, or NBT tag from being listed
- **Admin Tools** - Dedicated admin GUI for managing listings and creating server auctions
- **Scripting API** - Cancelable events for creates, bids, buyouts, cancels, and claims
**Trader Enhancements:**
- Limited stock with automatic restocking (MC time, real-time, or custom intervals)
- Global or per-player stock modes
- Currency costs on top of item trades
- Client-side balance preview
---
### Script Editor
A full-featured code editor built right into Minecraft.
<img src="images/ScriptEditor.gif" width="474" height="260"/>
- **Syntax Highlighting** - Color-coded keywords, types, variables, methods, strings, and comments
- **Autocomplete** - Smart suggestions with type awareness, static vs instance context, and auto-imports
- **Error Detection** - Real-time underlining of wrong argument types, missing methods, type mismatches, and unused imports
- **Hover Info** - Full type information, documentation, and JSDoc rendering on hover
- **Navigation** - Go to line, search & replace, go to definition, and fullscreen mode
- **Editing** - Smart undo/redo, duplicate lines, comment toggle, rename refactoring, smart bracket pairing
- **Visual** - Line numbers, smooth scrolling, indent guides, brace matching, resizable panels
---
### Scripting
Write scripts in **JavaScript** or **Java** to control every aspect of the mod.
- **Java Scripting** - Write real Java code compiled by the Janino engine. Full support for classes, generics, lambdas, and method references
- **JavaScript** - Full Nashorn-based JavaScript with ECMAScript 5.1 globals (Math, JSON, Date, Number)
- **Client-Side Scripting** - Run scripts on the client for responsive visual experiences (server-controlled)
- **154+ Script Hooks** - Events for NPCs, players, blocks, items, quests, dialogs, factions, abilities, auction, animations, and more
- **Script Types** - NPC, Player, Global, Block, Item, Linked Item, Effect, Ability, Recipe, and Forge Event scripts
- **Scripted Blocks** - Blocks with full script hooks for click, redstone, neighbor changes, and more
- **Scripted Items** - Items with use, attack, toss, pickup, and durability hooks
- **Custom GUIs** - Build custom interfaces with buttons, text fields, scroll panels, and slots via scripting
- **GUI Overlays** - Persistent on-screen overlays with labels, lines, and textured rectangles
- **Addon API** - Mods can ship `.d.ts` type definitions for full autocomplete in the editor
**Resources:**
- API Repository: [CustomNPC+ API](https://github.com/KAMKEEL/CustomNPC-Plus-API)
- Java Docs: [kamkeel.github.io/CustomNPC-Plus](https://kamkeel.github.io/CustomNPC-Plus/)
<img src="images/ScriptedBlock.png" width="474" height="260"/>
<img src="images/ScriptedParticle.png" width="474" height="260"/>
---
### Animation System
Create custom animations for NPCs directly in-game.
- **Animation Maker** - Visual editor for creating frame-based animations
- **Animation Parts** - Animate individual body parts with rotation, position, and scaling
- **Frame Events** - Script hooks for animation start, end, frame enter, and frame exit
- **Data Store** - Animations can store and pass data across events and frames
- **Task System** - Consumer-based callbacks for animation lifecycle
- **Built-in Animations** - Pre-made animations for abilities that work automatically
- **Multiple Registrations** - Register multiple animations under one common name
- **Animated Textures** - Frame-based animated textures for items, effects, and ability icons
<img src="images/AnimationMaker.gif" width="474" height="260"/>
---
### Custom Effects
Create custom status effects beyond vanilla potions.
- **Custom Icons** - Each effect gets its own texture, with support for animated icons
- **Script Hooks** - Events for effect apply, tick, and removal
- **Ability Integration** - Abilities can apply custom effects to targets
- **Condition System** - Check if entities have specific effects for ability or availability conditions
---
### Profile System
Multiple character slots on a single account.
- **Profile Slots** - Each slot stores separate quest progress, dialogs, factions, currency, abilities, and effects
- **Region Locking** - Lock profiles to specific areas
- **Soulbound Items** - Bind items to a specific player by UUID
- **Profile-Slotbound Items** - Bind items to a specific profile slot
---
### Party System
Group up with other players for cooperative gameplay.
- **Party Management** - Invite, kick, leave, disband, and transfer leadership
- **Quest Sharing** - Share quest objectives across party members
- **Ability Integration** - Party members are treated as allies for AOE ability targeting
- **Script Hooks** - Events for invites, kicks, leaves, disbands, and quest completion
<img src="images/PartySystem.png" width="474" height="260"/>
<img src="images/QuestParty.png" width="474" height="260"/>
---
### Faction System
Create factions to control NPC relationships and player reputation.
- **Faction Points** - Players earn or lose standing with factions through quests, combat, and scripting
- **Availability Conditions** - Gate dialogs, quests, and content behind faction thresholds
- **NPC Behavior** - NPCs react to players based on faction standing (friendly, neutral, hostile)
- **Passive Factions** - Passive faction NPCs are protected from damage
---
### HUD System
Customizable on-screen elements.
- **HUD Editor** - Drag and position HUD components to fit your screen
- **Ability Hotbar** - 12-slot bar with horizontal/vertical layout and configurable visible slots
- **Quest Tracking** - On-screen quest objective tracker
- **Compass** - Directional compass with quest and waypoint markers
- **Effect Bar** - Display active custom effects
<img src="images/HudSystem.png" width="474" height="260"/>
---
### Cloner & Organization
Save, organize, and reuse NPCs and content.
- **Cloner Tabs** - Save and load NPCs, items, and other content
- **Folder System** - Organize with folders and subfolders for animations, abilities, forms, auras, outlines, effects, and linked items
- **Quick Tags** - Tag-based filtering for fast searching
- **Full Screen Browser** - Wide directory view for large collections
<img src="images/ClonerTabs.png" width="474" height="260"/>
---
### Items & Blocks
A large library of custom items and decorative blocks.
**Weapons:** Battle Axe, Broadsword, Claw, Crossbow, Dagger, Staff, Glaive, Gun, Kunai, Scythe, Spear, Wand, Warhammer, Musket, and more
**Linked Items:** Create custom items with configurable attack speed, scripted behavior, animated textures, and item versioning
**Blocks:** Banners, barrels, beams, signs, campfires, candles, chairs, couches, crates, crystals, lanterns, mailboxes, pedestals, redstone blocks, and scripted blocks
**Crafting:** Carpentry Bench and Anvil with custom recipe support
<img src="images/VariousWeapons.png" width="474" height="260"/>
<img src="images/JappaTextures.png" width="474" height="260"/>
---
### Custom Models
Support for custom NPC models beyond the default humanoid. Import Blockbench models using the **Gecko Addon** (GeckoLib integration) or use **Armorer's Workshop** skins with the AW Addon.
<img src="images/GeckoAddon1.png" width="474" height="260"/>
<img src="images/GeckoAddon2.png" width="474" height="260"/>
---
### Addon Compatibility
CustomNPC+ has official addons that extend its functionality with other mods. Vault and Pixelmon are also supported natively for economy and scripting integration.
---
## Official CNPC+ Addons
### DBC Addon
Adds full compatibility between [Dragon Block C](https://www.curseforge.com/minecraft/mc-mods/dragon-block-c) and CustomNPC+. Extends abilities with ki-based attacks, adds DBC stat integration to conditions, and enables DBC model/animation support on NPCs.
[![CurseForge](https://img.shields.io/badge/CurseForge-F16436?style=flat-square&logo=curseforge&logoColor=white)](https://www.curseforge.com/minecraft/mc-mods/cnpc-dbc-addon)
[![Modrinth](https://img.shields.io/badge/Modrinth-00AF5C?style=flat-square&logo=modrinth&logoColor=white)](https://modrinth.com/mod/customnpc-plus-dbc-addon)
[![GitHub](https://img.shields.io/badge/GitHub-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/KAMKEEL/CustomNPC-DBC-Addon)
### Gecko Addon
Adds [GeckoLib](https://www.curseforge.com/minecraft/mc-mods/geckolib) support to CustomNPC+. Import Blockbench models directly into the mod and use them as custom NPC models with full animation support.
[![CurseForge](https://img.shields.io/badge/CurseForge-F16436?style=flat-square&logo=curseforge&logoColor=white)](https://www.curseforge.com/minecraft/mc-mods/cnpc-custom-model-addon)
[![Modrinth](https://img.shields.io/badge/Modrinth-00AF5C?style=flat-square&logo=modrinth&logoColor=white)](https://modrinth.com/mod/customnpc-plus-gecko-addon)
[![GitHub](https://img.shields.io/badge/GitHub-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/KAMKEEL/CustomNPC-Gecko-Addon)
### Armorer's Workshop Addon
Adds compatibility between [Armorer's Workshop](https://www.curseforge.com/minecraft/mc-mods/armorers-workshop) and CustomNPC+. Use Armorer's Workshop skins and equipment on NPCs with custom rotation, scaling, and animation support. Requires UniMixins.
[![CurseForge](https://img.shields.io/badge/CurseForge-F16436?style=flat-square&logo=curseforge&logoColor=white)](https://www.curseforge.com/minecraft/mc-mods/cnpc-armorers-workshop-addon)
[![Modrinth](https://img.shields.io/badge/Modrinth-00AF5C?style=flat-square&logo=modrinth&logoColor=white)](https://modrinth.com/mod/customnpc-plus-aw-addon)
---
## Other Projects
### MorePlayerModels+
An updated continuation of MorePlayerModels for 1.7.10 with backported GUIs, original parts and customizations, and permission support. Works alongside CustomNPC+. This is a replacement — do not install alongside the original MorePlayerModels.
[![CurseForge](https://img.shields.io/badge/CurseForge-F16436?style=flat-square&logo=curseforge&logoColor=white)](https://www.curseforge.com/minecraft/mc-mods/moreplayermodels-plus)
[![Modrinth](https://img.shields.io/badge/Modrinth-00AF5C?style=flat-square&logo=modrinth&logoColor=white)](https://modrinth.com/mod/moreplayermodels+)
[![GitHub](https://img.shields.io/badge/GitHub-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/KAMKEEL/MorePlayerModels-Plus)
### The Plugin Mod
Adds aesthetic weapons, artifacts, blocks, and apples for RPG and storytelling servers. Designed to pair with CustomNPC+ — use the included swords, spears, axes, medpacks, and decorative blocks to make your NPCs and worlds more diverse.
[![CurseForge](https://img.shields.io/badge/CurseForge-F16436?style=flat-square&logo=curseforge&logoColor=white)](https://www.curseforge.com/minecraft/mc-mods/the-plugin-mod)
[![Modrinth](https://img.shields.io/badge/Modrinth-00AF5C?style=flat-square&logo=modrinth&logoColor=white)](https://modrinth.com/mod/the-plugin-mod)
[![GitHub](https://img.shields.io/badge/GitHub-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/KAMKEEL/Plugin-Mod)
### HexText
Upgrades Minecraft's font renderer with full RGB hex color support, nested color spans, and animated text effects (glow, shake, wave). Works in signs, anvils, and chat. Requires UniMixins.
[![CurseForge](https://img.shields.io/badge/CurseForge-F16436?style=flat-square&logo=curseforge&logoColor=white)](https://www.curseforge.com/minecraft/mc-mods/hex-text)
[![Modrinth](https://img.shields.io/badge/Modrinth-00AF5C?style=flat-square&logo=modrinth&logoColor=white)](https://modrinth.com/mod/hex-text)
[![GitHub](https://img.shields.io/badge/GitHub-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/KAMKEEL/HexText)
### RPG Messenger
A Bukkit plugin for messageable NPCs, group chats, and RPG controller tools. Allows operators to create NPCs that players can message, and lets RPG controllers reply as NPCs in real-time.
[![GitHub](https://img.shields.io/badge/GitHub-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/KAMKEEL/RPGMessenger)
### CustomNPC+ Dark Mode
A resource pack that applies a clean dark theme to all CustomNPC+ GUIs.
[![GitHub](https://img.shields.io/badge/GitHub-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/KAMKEEL/CustomNPC-Plus-Dark-Mode)
---
## Configuration
CustomNPC+ has a modular configuration system:
| Config | Purpose |
|--------|---------|
| **Main** | Core mod settings |
| **Client** | Client-side display and UI preferences |
| **Script** | Scripting engine settings and client script toggle |
| **Market** | Currency, auction house, trader, and economy settings |
| **Energy** | Energy projectile settings (explosion block damage, dome item blacklist) |
| **Item** | Item and gun configuration |
| **Debug** | Debug logging and diagnostics |
| **Experimental** | Experimental features toggle |
---
## Building from Source
This project uses the [GTNH Gradle Convention](https://github.com/GTNewHorizons/ExampleMod1.7.10) build system with [RetroFuturaGradle](https://github.com/GTNewHorizons/RetroFuturaGradle).
```bash
git clone <repo-url>
git submodule update --init --recursive
./gradlew build
```
That's it. Submodules pull in the API sources, and `build` handles decompilation, compilation, and mixin embedding automatically.
**Run the game:**
```bash
./gradlew runClient # Launch client
./gradlew runServer # Launch server
```
**IDE Setup (IntelliJ):**
1. Import the project as a Gradle project
2. Run `./gradlew genIntellijRuns`
3. Add program arguments: `--tweakClass org.spongepowered.asm.launch.MixinTweaker --mixin customnpcs.mixins.json`
---
## Notice
I am not the original creator of CustomNPC. The original creator is [Noppes](https://github.com/Noppes). I have been permitted to update and develop my own branch version for 1.7.10. The original mod updated to the latest Minecraft versions can be found on [CurseForge](https://www.curseforge.com/minecraft/mc-mods/custom-npcs) and [kodevelopment](http://www.kodevelopment.nl/minecraft/customnpcs).
+41 -2
View File
@@ -6,7 +6,7 @@ plugins {
id "dts.typescript-generator"
}
version = "1.11-beta1"
version = "1.11.1"
group= "kamkeel.customnpc-plus"
archivesBaseName = "CustomNPC-Plus"
@@ -64,11 +64,50 @@ sourceSets.main.java {
// TypeScript plugin is applied above in the main plugins block
tasks.named("generateTypeScriptDefinitions").configure {
sourceDirectories = ['src/api/java']
sourceDirectories = ['src/api/java', 'src/main/java']
outputDirectory = "src/main/resources/assets/${project.property("modId")}/api"
apiPackages = ['noppes.npcs.api', 'net.minecraft'] as Set
cleanOutputFirst = true // Clean old generated files before regenerating
patchesDirectory = "dts-patches"
implementationPackages = [
'noppes.npcs.scripted',
'noppes.npcs.controllers.data',
'noppes.npcs.entity.data',
'noppes.npcs.quests',
'kamkeel.npcs.controllers.data'
] as Set
}
processResources.dependsOn generateTypeScriptDefinitions
sourcesJar.dependsOn generateTypeScriptDefinitions
// Javadoc configuration
javadoc {
options.encoding = 'UTF-8'
options.charSet = 'UTF-8'
options.docEncoding = 'UTF-8'
options.tags = [
'hookName:a:Hook Name:'
]
options.stylesheetFile = file('.github/javadoc/javadoc-theme.css')
options.header = file('.github/javadoc/javadoc-header.html').text.replaceAll('\\s+', ' ').trim()
options.addBooleanOption('-allow-script-in-comments', true)
options.footer = file('.github/javadoc/javadoc-footer.html').text.replaceAll('\\s+', ' ').trim()
// Only document the public API, not net.minecraft stubs
include 'noppes/npcs/api/**'
options.links(
'https://docs.oracle.com/en/java/javase/11/docs/api/'
)
javadocTool = javaToolchains.javadocToolFor {
languageVersion = JavaLanguageVersion.of(11)
}
}
// Modify the existing 'build' task to depend on 'updateAPI'
//tasks.apiClasses.dependsOn 'updateAPI'
+3 -3
View File
@@ -35,7 +35,7 @@
*/
def embedMixin = !project.hasProperty("nomixin");
dependencies {
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.8.44-GTNH:dev")
if (!project.hasProperty("noNashorn")) {
runtimeOnlyNonPublishable("curse.maven:Nashorn-374413:2924946")
}
@@ -43,8 +43,8 @@ dependencies {
// compileOnly(files("./tools/bukkit-api/spigot-api-ONLY.jar"))
// compileOnly(files("./tools/bukkit-api/Vault-1.4.1.jar"))
shadowImplementation(project.files("tools/standalone-JaninoLoader-1.0.1-ALPHA.jar"))
annotationProcessor(project.files("tools/standalone-JaninoLoader-1.0.1-ALPHA.jar"))
shadowImplementation(project.files("tools/standalone-JaninoLoader-1.0.2.jar"))
annotationProcessor(project.files("tools/standalone-JaninoLoader-1.0.2.jar"))
testImplementation("junit:junit:4.13.2")
+126
View File
@@ -0,0 +1,126 @@
/**
* ECMAScript 5.1 - Array type for working with ordered collections of elements.
* Supports static methods like Array.isArray() and instance methods like push(), map(), filter().
*
* ## How to Use
*
* ### Creating Arrays
* ```js
* var empty = []; // Empty array
* var nums = [1, 2, 3]; // Array with values
* var mixed = ["hello", 42, true]; // Mixed types
* var nested = [[1, 2], [3, 4]]; // Nested arrays
* ```
*
* ### Static Methods
* ```js
* Array.isArray([1, 2, 3]); // true
* Array.isArray("hello"); // false
* Array.isArray({length: 3}); // false
* ```
*
* ### Adding & Removing Elements
* ```js
* var arr = [1, 2, 3];
* arr.push(4); // [1, 2, 3, 4] — add to end
* arr.pop(); // [1, 2, 3] — remove from end
* arr.unshift(0); // [0, 1, 2, 3] — add to start
* arr.shift(); // [1, 2, 3] — remove from start
* arr.splice(1, 1, 99); // [1, 99, 3] — replace at index 1
* ```
*
* ### Searching & Iterating
* ```js
* var arr = [10, 20, 30, 20];
* arr.indexOf(20); // 1 (first match)
* arr.lastIndexOf(20); // 3 (last match)
* arr.forEach(function(val) { log(val); });
* var doubled = arr.map(function(v) { return v * 2; }); // [20, 40, 60, 40]
* var big = arr.filter(function(v) { return v > 15; }); // [20, 30, 20]
* ```
*
* ### Reducing & Testing
* ```js
* var sum = [1, 2, 3].reduce(function(acc, v) { return acc + v; }, 0); // 6
* var allPositive = [1, 2, 3].every(function(v) { return v > 0; }); // true
* var hasNeg = [1, -2, 3].some(function(v) { return v < 0; }); // true
* ```
*
* ### ❌ Common Mistakes
* ```js
* Array.push(1); // TypeError — push is an instance method
* var a = [3,1,2]; a.sort(); // Sorts as strings! Use compareFn for numbers
* a.sort(function(a, b) { return a - b; }); // Correct numeric sort: [1, 2, 3]
* ```
*/
export interface Array<T> {
/** Returns true if the given object is an array, false otherwise */
static isArray(arg: any): boolean;
/** The number of elements in the array */
length: number;
/** Combines two or more arrays and returns a new array without modifying the original */
concat(...items: T[]): T[];
/** Tests whether all elements in the array pass the provided test function */
every(callback: Java.java.util.function.Function<T, boolean>): boolean;
/** Creates a new array with all elements that pass the test implemented by the provided function */
filter(callback: Java.java.util.function.Function<T, boolean>): T[];
/** Executes a provided function once for each array element. Returns undefined */
forEach(callback: Java.java.util.function.Consumer<T>): void;
/** Returns the first index at which an element is found, or -1 if not present */
indexOf(searchElement: T): number;
indexOf(searchElement: T, fromIndex: number): number;
/** Joins all elements of an array into a string separated by the given separator */
join(separator: string): string;
/** Returns the last index at which an element is found, or -1 if not present */
lastIndexOf(searchElement: T): number;
lastIndexOf(searchElement: T, fromIndex: number): number;
/** Creates a new array with the results of calling a function on every element */
map(callback: Java.java.util.function.Function<T, any>): any[];
/** Removes and returns the last element from the array, modifying the original array */
pop(): T;
/** Adds one or more elements to the end of an array and returns the new length */
push(...items: T[]): number;
/** Applies a function against an accumulator and each element to reduce the array to a single value */
reduce(callback: Java.java.util.function.BiFunction<any, T, any>): any;
reduce(callback: Java.java.util.function.BiFunction<any, T, any>, initialValue: any): any;
/** Same as reduce() but processes the array from right to left */
reduceRight(callback: Java.java.util.function.BiFunction<any, T, any>): any;
reduceRight(callback: Java.java.util.function.BiFunction<any, T, any>, initialValue: any): any;
/** Reverses an array in place. The first element becomes the last, and vice versa */
reverse(): T[];
/** Removes and returns the first element from the array, modifying the original array */
shift(): T;
/** Returns a shallow copy of a portion of an array as a new array object */
slice(start: number, end: number): T[];
/** Tests whether at least one element in the array passes the test implemented by the provided function */
some(callback: Java.java.util.function.Function<T, boolean>): boolean;
/** Sorts the elements of an array in place and returns the sorted array */
sort(compareFn: Java.java.util.function.BiFunction<T, T, number>): T[];
/** Changes the contents of an array by removing or replacing existing elements and/or adding new ones */
splice(start: number, deleteCount: number, ...items: T[]): T[];
/** Returns a string representation of the array */
toString(): string;
/** Adds one or more elements to the beginning of an array and returns the new length */
unshift(...items: T[]): number;
}
+36
View File
@@ -0,0 +1,36 @@
/**
* ECMAScript 5.1 - Boolean type for true/false values.
* Booleans are the result of comparison and logical operations.
*
* ## How to Use
*
* ### Creating Booleans
* ```js
* var yes = true; // Boolean literal
* var no = false; // Boolean literal
* var fromExpr = (5 > 3); // true (comparison result)
* ```
*
* ### Boolean Methods
* ```js
* var b = true;
* b.toString(); // "true"
* b.valueOf(); // true (primitive value)
* ```
*
* ### Truthy & Falsy Values
* ```js
* // These are FALSY (evaluate to false):
* // false, 0, "", null, undefined, NaN
*
* // These are TRUTHY (evaluate to true):
* // true, any non-zero number, any non-empty string, objects, arrays
*
*/
export interface Boolean {
/** Returns the string "true" or "false" */
toString(): string;
/** Returns the primitive boolean value */
valueOf(): boolean;
}
+168
View File
@@ -0,0 +1,168 @@
/**
* ECMAScript 5.1 - Date type for working with dates and times.
* Create with `new Date()` or use static methods like Date.now() to get current timestamp.
*
* ## How to Use
*
* ### Creating Dates
* ```js
* var now = new Date(); // Current date & time
* var epoch = new Date(0); // Jan 1, 1970
* var specific = new Date(2024, 0, 15); // Jan 15, 2024 (months are 0-based!)
* var full = new Date(2024, 5, 15, 10, 30, 0); // Jun 15, 2024 10:30:00
* var fromStr = new Date("2024-01-15"); // Parse from ISO string
* ```
*
* ### Static Methods (no `new` needed)
* ```js
* var timestamp = Date.now(); // Current time in milliseconds
* var parsed = Date.parse("2024-01-15"); // Parse string to timestamp
* var utc = Date.UTC(2024, 0, 15); // UTC timestamp for Jan 15, 2024
* ```
*
* ### Common Mistakes
* ```js
* Date.now; // Returns the function, not the timestamp!
* Date.getMinutes(); // TypeError — instance method, not static
* new Date(2024, 1, 1); // Feb 1, not Jan 1 — months are 0-based!
* ```
*/
export interface Date {
/** Returns the current time as the number of milliseconds since 1970-01-01 00:00:00 UTC */
static now(): number;
/** Parses a date string and returns the number of milliseconds since 1970-01-01 00:00:00 UTC */
static parse(s: string): number;
/** Returns the number of milliseconds since 1970-01-01 00:00:00 UTC for the given UTC date/time components */
static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number, ms: number): number;
/** Returns the day of the month (1-31) in local time */
getDate(): number;
/** Returns the day of the week (0=Sunday, 6=Saturday) in local time */
getDay(): number;
/** Returns the year in local time */
getFullYear(): number;
/** Returns the hour (0-23) in local time */
getHours(): number;
/** Returns the milliseconds (0-999) in local time */
getMilliseconds(): number;
/** Returns the minutes (0-59) in local time */
getMinutes(): number;
/** Returns the month (0=January, 11=December) in local time */
getMonth(): number;
/** Returns the seconds (0-59) in local time */
getSeconds(): number;
/** Returns the number of milliseconds since 1970-01-01 00:00:00 UTC */
getTime(): number;
/** Returns the time zone offset in minutes between local time and UTC */
getTimezoneOffset(): number;
/** Returns the day of the month (1-31) in UTC */
getUTCDate(): number;
/** Returns the day of the week (0=Sunday, 6=Saturday) in UTC */
getUTCDay(): number;
/** Returns the year in UTC */
getUTCFullYear(): number;
/** Returns the hour (0-23) in UTC */
getUTCHours(): number;
/** Returns the milliseconds (0-999) in UTC */
getUTCMilliseconds(): number;
/** Returns the minutes (0-59) in UTC */
getUTCMinutes(): number;
/** Returns the month (0=January, 11=December) in UTC */
getUTCMonth(): number;
/** Returns the seconds (0-59) in UTC */
getUTCSeconds(): number;
/** Sets the day of the month and returns the new timestamp */
setDate(date: number): number;
/** Sets the year, and optionally month and date, then returns the new timestamp */
setFullYear(year: number, month: number, date: number): number;
/** Sets the hour, minutes, seconds, and milliseconds, then returns the new timestamp */
setHours(hour: number, min: number, sec: number, ms: number): number;
/** Sets the milliseconds and returns the new timestamp */
setMilliseconds(ms: number): number;
/** Sets the minutes, seconds, and milliseconds, then returns the new timestamp */
setMinutes(min: number, sec: number, ms: number): number;
/** Sets the month, and optionally date, then returns the new timestamp */
setMonth(month: number, date: number): number;
/** Sets the seconds and milliseconds, then returns the new timestamp */
setSeconds(sec: number, ms: number): number;
/** Sets the timestamp (milliseconds since epoch) and returns it */
setTime(time: number): number;
/** Sets the day of the month (UTC) and returns the new timestamp */
setUTCDate(date: number): number;
/** Sets the year, month, and date (UTC), then returns the new timestamp */
setUTCFullYear(year: number, month: number, date: number): number;
/** Sets the hour, minutes, seconds, and milliseconds (UTC), then returns the new timestamp */
setUTCHours(hour: number, min: number, sec: number, ms: number): number;
/** Sets the milliseconds (UTC) and returns the new timestamp */
setUTCMilliseconds(ms: number): number;
/** Sets the minutes, seconds, and milliseconds (UTC), then returns the new timestamp */
setUTCMinutes(min: number, sec: number, ms: number): number;
/** Sets the month and date (UTC), then returns the new timestamp */
setUTCMonth(month: number, date: number): number;
/** Sets the seconds and milliseconds (UTC), then returns the new timestamp */
setUTCSeconds(sec: number, ms: number): number;
/** Returns a string representation of the date portion in local time (e.g., "Mon Jan 01 2024") */
toDateString(): string;
/** Returns the date as an ISO 8601 string (e.g., "2024-01-01T00:00:00.000Z") */
toISOString(): string;
/** Returns a JSON representation of the date (typically an ISO 8601 string) */
toJSON(key: any): string;
/** Returns a localized string for the date portion (format depends on locale) */
toLocaleDateString(): string;
/** Returns a localized string for the entire date and time (format depends on locale) */
toLocaleString(): string;
/** Returns a localized string for the time portion (format depends on locale) */
toLocaleTimeString(): string;
/** Returns a string representation of the date and time in local time */
toString(): string;
/** Returns a string representation of the time portion in local time (e.g., "00:00:00 GMT+0000") */
toTimeString(): string;
/** Returns a string representation of the date and time in UTC (e.g., "Mon, 01 Jan 2024 00:00:00 GMT") */
toUTCString(): string;
/** Returns the primitive value of the date object (milliseconds since 1970-01-01 00:00:00 UTC) */
valueOf(): number;
}
+81
View File
@@ -0,0 +1,81 @@
/**
* ECMAScript 5.1 - Error base type for runtime errors.
* Throw Error objects to indicate failure conditions in your code.
*
* ## How to Use
*
* ### Creating & Throwing Errors
* ```js
* throw new Error("Something went wrong");
* throw new TypeError("Expected a string");
* throw new RangeError("Value out of range");
* ```
*
* ### Catching Errors
* ```js
* try {
* var result = riskyOperation();
* } catch (e) {
* log(e.name); // "Error", "TypeError", etc.
* log(e.message); // "Something went wrong"
* log(e.toString()); // "Error: Something went wrong"
* }
* ```
*
* ### Custom Error Messages
* ```js
* function divide(a, b) {
* if (b === 0) {
* throw new Error("Cannot divide by zero");
* }
* return a / b;
* }
* ```
*
* ### ❌ Common Mistakes
* ```js
* throw "Something went wrong"; // Works but no .name or .message properties
* Error("oops"); // Creates error but doesn't throw it!
* throw Error("oops"); // ✅ Works (with or without `new`)
* ```
*/
export interface Error {
/** The name of the error type (e.g., "Error", "TypeError", "RangeError") */
name: string;
/** A human-readable description of what went wrong */
message: string;
/** Returns a string representation of the error (typically "name: message") */
toString(): string;
}
/**
* EvalError - Thrown when eval() function is misused (rarely used in modern JavaScript)
*/
export interface EvalError extends Error {}
/**
* RangeError - Thrown when a numeric value is out of the acceptable range (e.g., array length < 0)
*/
export interface RangeError extends Error {}
/**
* ReferenceError - Thrown when trying to reference a variable that does not exist or is not in scope
*/
export interface ReferenceError extends Error {}
/**
* SyntaxError - Thrown when parsing invalid syntax (usually caught during compile/parse, not runtime)
*/
export interface SyntaxError extends Error {}
/**
* TypeError - Thrown when an operation is performed on a value of the wrong type (e.g., calling a non-function)
*/
export interface TypeError extends Error {}
/**
* URIError - Thrown by URI encoding/decoding functions when given invalid characters or sequences
*/
export interface URIError extends Error {}
+75
View File
@@ -0,0 +1,75 @@
/**
* ECMAScript 5.1 - Global functions available in the global scope.
* These are not on any specific object - call them directly (e.g., parseInt("42")).
*
* ## How to Use
*
* ### Parsing Numbers
* ```js
* parseInt("42"); // 42
* parseInt("42px"); // 42 (stops at non-digit)
* parseInt("0xFF", 16); // 255 (hexadecimal)
* parseInt("111", 2); // 7 (binary)
* parseFloat("3.14"); // 3.14
* parseFloat("3.14abc"); // 3.14 (stops at invalid char)
* ```
*
* ### Checking Special Values
* ```js
* isNaN(NaN); // true
* isNaN(42); // false
* isNaN("hello"); // true (cannot parse as number)
* isNaN("42"); // false (can parse as number)
* isFinite(42); // true
* isFinite(Infinity); // false
* isFinite(NaN); // false
* ```
*
* ### URI Encoding/Decoding
* ```js
* encodeURI("hello world"); // "hello%20world"
* decodeURI("hello%20world"); // "hello world"
* encodeURIComponent("a=1&b=2"); // "a%3D1%26b%3D2" (encodes & and =)
* decodeURIComponent("a%3D1%26b%3D2"); // "a=1&b=2"
* ```
*
* ### ❌ Common Mistakes
* ```js
* parseInt("08"); // Some engines treat as octal! Always specify radix
* parseInt("08", 10); // 8 ✅ — explicitly base-10
* parseInt(""); // NaN — empty string returns NaN, not 0
* parseFloat(""); // NaN
* isNaN(undefined); // true — coerces to NaN first
* ```
*/
export interface GlobalFunctions {
/** Evaluates JavaScript code in a string (use with caution - slow and potential security issues) */
static eval(x: any): any;
/** Parses a string and returns an integer. Stops parsing at the first non-digit character */
static parseInt(string: string): number;
/** Parses a string and returns an integer using the specified radix (base). Stops parsing at the first non-digit character */
static parseInt(string: string, radix: number): number;
/** Parses a string and returns a floating-point number. Stops parsing at the first invalid character */
static parseFloat(string: string): number;
/** Determines whether a value is NaN (not-a-number). The value is first coerced to a number before testing */
static isNaN(value: any): boolean;
/** Determines whether a value is a finite number. The value is first coerced to a number. Returns false for Infinity, -Infinity, and NaN */
static isFinite(value: any): boolean;
/** Decodes a URI by replacing encoded sequences like %20 with their original characters */
static decodeURI(encodedURI: string): string;
/** Decodes URI component by replacing ALL encoded sequences including those for reserved URI characters */
static decodeURIComponent(encodedURIComponent: string): string;
/** Encodes a URI by replacing special characters with %HH sequences (but preserves reserved characters like / : ?) */
static encodeURI(uri: string): string;
/** Encodes URI component by replacing ALL special characters including reserved ones with %HH sequences */
static encodeURIComponent(uriComponent: string): string;
}
+100
View File
@@ -0,0 +1,100 @@
/**
* ECMAScript 5.1 - JSON built-in object for parsing and serializing JSON data.
*
* ## How to Use
*
* JSON is a **static object** — use its methods directly, never with `new`.
*
* ### Parsing JSON Strings to Objects
* ```js
* var obj = JSON.parse('{"name": "Steve", "level": 5}');
* log(obj.name); // "Steve"
* log(obj.level); // 5
*
* var arr = JSON.parse('[1, 2, 3]');
* log(arr[0]); // 1
* ```
*
* ### Converting Objects to JSON Strings
* ```js
* var data = { name: "Steve", hp: 100 };
* var json = JSON.stringify(data); // '{"name":"Steve","hp":100}'
*
* // Pretty-printed with 2-space indent:
* var pretty = JSON.stringify(data, null, 2);
* // '{
* // "name": "Steve",
* // "hp": 100
* // }'
* ```
*
* ### Storing & Loading Data
* ```js
* // Save to NPC stored data:
* var inventory = { sword: 1, potion: 5 };
* npc.getStoredData().put("inv", JSON.stringify(inventory));
*
* // Load from NPC stored data:
* var raw = npc.getStoredData().get("inv");
* var loaded = JSON.parse(raw);
* log(loaded.potion); // 5
* ```
*
* ### ❌ Common Mistakes
* ```js
* new JSON(); // TypeError — JSON is not a constructor
* JSON.parse('{name: "Steve"}'); // SyntaxError — keys must be quoted
* JSON.parse("{'name': 'Steve'}"); // SyntaxError — must use double quotes
* JSON.parse('{"name": "Steve"}'); // ✅ Correct — double-quoted keys & values
* ```
*/
export interface JSON {
/**
* Parses a JSON string and returns the parsed value (object, array, string, number, boolean, or null).
* @param text - A valid JSON string to parse
* @returns The parsed JavaScript value
*/
static parse(text: string): any;
/**
* Parses a JSON string with a reviver function that transforms each parsed key-value pair.
* @param text - A valid JSON string to parse
* @param reviver - Function called for each key-value pair; receives the key and parsed value, returns the transformed value
* @returns The parsed JavaScript value after applying the reviver
*/
static parse(text: string, reviver: Java.java.util.function.BiFunction<string, any, any>): any;
/**
* Converts a JavaScript value to a JSON string.
* @param value - The value to serialize (object, array, string, number, boolean, or null)
* @returns A JSON-formatted string representation of the value
*/
static stringify(value: any): string;
/**
* Converts a JavaScript value to a JSON string, using a replacer function to filter or transform properties.
* @param value - The value to serialize
* @param replacer - Function called for each key-value pair; receives the key and value, returns the value to include (or undefined to omit)
* @param space - Optional indentation: a number of spaces (up to 10), or a string prefix per level
* @returns A JSON-formatted string representation of the value
*/
static stringify(value: any, replacer: Java.java.util.function.BiFunction<string, any, any>, space?: any): string;
/**
* Converts a JavaScript value to a JSON string, including only the specified properties.
* @param value - The value to serialize
* @param replacer - Array of property names to include in the output
* @param space - Optional indentation: a number of spaces (up to 10), or a string prefix per level
* @returns A JSON-formatted string representation of the value
*/
static stringify(value: any, replacer: string[], space?: any): string;
/**
* Converts a JavaScript value to a JSON string with optional pretty-printing.
* @param value - The value to serialize
* @param replacer - Pass null to include all properties
* @param space - Indentation: a number of spaces (up to 10), or a string prefix per level
* @returns A JSON-formatted string representation of the value
*/
static stringify(value: any, replacer: null, space: any): string;
}
+128
View File
@@ -0,0 +1,128 @@
/**
* ECMAScript 5.1 - Math built-in object providing mathematical constants and functions.
* All methods are static and called as Math.methodName(). No constructor.
*
* ## How to Use
*
* Math is a **static object** — use its methods directly, never with `new`.
*
* ### Basic Math Operations
* ```js
* var rounded = Math.floor(3.7); // 3
* var ceiling = Math.ceil(3.2); // 4
* var nearest = Math.round(3.5); // 4
* var absolute = Math.abs(-42); // 42
* ```
*
* ### Powers, Roots & Logarithms
* ```js
* var squared = Math.pow(2, 3); // 8
* var root = Math.sqrt(16); // 4
* var natural = Math.log(Math.E); // 1
* ```
*
* ### Random Numbers
* ```js
* var rand = Math.random(); // 0.0 to 0.999...
* // Random integer between 1 and 10:
* var dice = Math.floor(Math.random() * 10) + 1;
* ```
*
* ### Finding Min/Max
* ```js
* var biggest = Math.max(5, 10, 3); // 10
* var smallest = Math.min(5, 10, 3); // 3
* ```
*
* ### Trigonometry
* ```js
* var sine = Math.sin(Math.PI / 2); // 1
* var cosine = Math.cos(0); // 1
* var angle = Math.atan2(1, 1); // 0.785... (PI/4)
* ```
*
* ### ❌ Common Mistakes
* ```js
* new Math() // TypeError — Math is not a constructor
* Math() // TypeError — Math is not a function
* ```
*/
export interface Math {
/** Euler's number (~2.718), the base of natural logarithms */
static readonly E: number;
/** Natural logarithm of 2 (~0.693) */
static readonly LN2: number;
/** Natural logarithm of 10 (~2.303) */
static readonly LN10: number;
/** Base-2 logarithm of e (~1.443) */
static readonly LOG2E: number;
/** Base-10 logarithm of e (~0.434) */
static readonly LOG10E: number;
/** Ratio of a circle's circumference to its diameter (~3.14159) */
static readonly PI: number;
/** Square root of 0.5 (~0.707) */
static readonly SQRT1_2: number;
/** Square root of 2 (~1.414) */
static readonly SQRT2: number;
/** Returns the absolute value of a number */
static abs(x: number): number;
/** Returns the arccosine (in radians) of a number */
static acos(x: number): number;
/** Returns the arcsine (in radians) of a number */
static asin(x: number): number;
/** Returns the arctangent (in radians) of a number */
static atan(x: number): number;
/** Returns the arctangent of two numbers (y/x), with proper quadrant handling */
static atan2(y: number, x: number): number;
/** Returns the smallest integer greater than or equal to a number */
static ceil(x: number): number;
/** Returns the cosine (in radians) of a number */
static cos(x: number): number;
/** Returns e raised to the power of a number */
static exp(x: number): number;
/** Returns the largest integer less than or equal to a number */
static floor(x: number): number;
/** Returns the natural logarithm (base e) of a number */
static log(x: number): number;
/** Returns the largest of zero or more numbers */
static max(...values: number[]): number;
/** Returns the smallest of zero or more numbers */
static min(...values: number[]): number;
/** Returns base raised to the power of exponent */
static pow(x: number, y: number): number;
/** Returns a random number between 0 (inclusive) and 1 (exclusive) */
static random(): number;
/** Returns the value of a number rounded to the nearest integer */
static round(x: number): number;
/** Returns the sine (in radians) of a number */
static sin(x: number): number;
/** Returns the square root of a number */
static sqrt(x: number): number;
/** Returns the tangent (in radians) of a number */
static tan(x: number): number;
}
+74
View File
@@ -0,0 +1,74 @@
/**
* ECMAScript 5.1 - Number type for working with numeric values and constants.
* Access static constants like Number.MAX_VALUE or format numbers with instance methods.
*
* ## How to Use
*
* ### Number Constants
* ```js
* Number.MAX_VALUE; // ~1.79e+308 (largest representable number)
* Number.MIN_VALUE; // ~5e-324 (smallest positive number)
* Number.NaN; // NaN
* Number.POSITIVE_INFINITY; // Infinity
* Number.NEGATIVE_INFINITY; // -Infinity
* ```
*
* ### Formatting Numbers
* ```js
* var n = 3.14159;
* n.toFixed(2); // "3.14" (fixed decimal places)
* n.toFixed(0); // "3"
* n.toPrecision(4); // "3.142" (significant digits)
* n.toExponential(2); // "3.14e+0" (scientific notation)
* ```
*
* ### Converting to String
* ```js
* var n = 255;
* n.toString(); // "255" (base 10, default)
* n.toString(16); // "ff" (hexadecimal)
* n.toString(2); // "11111111" (binary)
* n.toString(8); // "377" (octal)
* ```
*
* ### ❌ Common Mistakes
* ```js
* Number.toFixed(2); // TypeError — instance method, not static
* (3).toFixed(2); // "3.00" ✅ — wrap literal in parentheses
* 3.toFixed(2); // SyntaxError — parser reads 3. as float
* ```
*/
export interface Number {
/** The largest representable number (~1.79e+308) */
static readonly MAX_VALUE: number;
/** The smallest representable positive number (~5e-324) */
static readonly MIN_VALUE: number;
/** Represents "Not a Number" (NaN) - the result of undefined or invalid arithmetic operations */
static readonly NaN: number;
/** Represents negative infinity, the result of overflow or division by zero */
static readonly NEGATIVE_INFINITY: number;
/** Represents positive infinity, the result of overflow or division by zero */
static readonly POSITIVE_INFINITY: number;
/** Formats the number using exponential notation with optional fractional digits */
toExponential(fractionDigits: number): string;
/** Formats the number as a fixed-point string with the specified number of fractional digits (0-20) */
toFixed(fractionDigits: number): string;
/** Returns a localized string representation of the number (format depends on locale) */
toLocaleString(): string;
/** Formats the number as a string with the specified number of significant digits (1-21) */
toPrecision(precision: number): string;
/** Converts the number to a string in the specified radix (base 2-36, default 10) */
toString(radix: number): string;
/** Returns the primitive numeric value of this Number object */
valueOf(): number;
}
+105
View File
@@ -0,0 +1,105 @@
/**
* ECMAScript 5.1 - Object type, the base type for all JavaScript objects.
* Use static methods like Object.keys() and Object.create() to manipulate object structure.
*
* ## How to Use
*
* ### Creating Objects
* ```js
* var obj = {}; // Empty object literal
* var person = { name: "Steve", age: 20 }; // Object with properties
* var child = Object.create(person); // Create with prototype
* ```
*
* ### Inspecting Objects
* ```js
* var obj = { a: 1, b: 2, c: 3 };
* Object.keys(obj); // ["a", "b", "c"]
* Object.getOwnPropertyNames(obj); // ["a", "b", "c"] (includes non-enumerable)
* obj.hasOwnProperty("a"); // true
* obj.hasOwnProperty("toString"); // false (inherited, not own)
* ```
*
* ### Freezing & Sealing
* ```js
* var config = { debug: false };
* Object.freeze(config); // Cannot modify, add, or delete properties
* config.debug = true; // Silently fails (or throws in strict mode)
* Object.isFrozen(config); // true
*
* var settings = { volume: 50 };
* Object.seal(settings); // Can modify values, but cannot add/delete
* settings.volume = 75; // ✅ Works
* settings.newProp = true; // Silently fails
* ```
*
* ### Property Descriptors
* ```js
* var obj = {};
* Object.defineProperty(obj, "id", {
* value: 42,
* writable: false, // Cannot be changed
* enumerable: true // Shows up in for-in / Object.keys
* });
* ```
*
* ### ❌ Common Mistakes
* ```js
* Object.keys(); // TypeError — needs an argument
* obj.keys(); // TypeError — keys is a static method
* Object.hasOwnProperty("a"); // Wrong — instance method on the object
* ```
*/
export interface Object {
/** Creates a new object with the specified prototype and optional property descriptors */
static create(proto: any, propertiesObject: any): any;
/** Defines or modifies multiple properties on an object and returns the modified object */
static defineProperties(obj: any, props: any): any;
/** Defines a new property on an object or modifies an existing property and returns the object */
static defineProperty(obj: any, prop: string, descriptor: any): any;
/** Prevents all modifications to an object (cannot add, modify, or delete properties) */
static freeze(obj: any): any;
/** Returns a property descriptor for a named property on an object, or undefined if not found */
static getOwnPropertyDescriptor(obj: any, prop: string): any;
/** Returns an array of all property names (both enumerable and non-enumerable) on an object */
static getOwnPropertyNames(obj: any): string[];
/** Returns the prototype object of the specified object */
static getPrototypeOf(obj: any): any;
/** Determines whether an object is extensible (can have new properties added to it) */
static isExtensible(obj: any): boolean;
/** Determines whether an object has been frozen (is immutable) */
static isFrozen(obj: any): boolean;
/** Determines whether an object is sealed (cannot add or delete properties) */
static isSealed(obj: any): boolean;
/** Returns an array of all enumerable property names on an object */
static keys(obj: any): string[];
/** Prevents new properties from being added to an object but allows modification of existing ones */
static preventExtensions(obj: any): any;
/** Prevents all modifications to an object except for reading and writing property values */
static seal(obj: any): any;
/** Determines whether an object has a property with the specified name (direct property, not inherited) */
hasOwnProperty(prop: string): boolean;
/** Determines whether an object is in the prototype chain of another object */
isPrototypeOf(obj: any): boolean;
/** Determines whether an object property is enumerable (would be included in a for-in loop) */
propertyIsEnumerable(prop: string): boolean;
/** Returns a localized string representation of the object (format depends on locale) */
toLocaleString(): string;
}
+94
View File
@@ -0,0 +1,94 @@
/**
* ECMAScript 5.1 - RegExp type for pattern matching and string manipulation.
* Create with the RegExp constructor or literal syntax: /pattern/flags
*
* ## How to Use
*
* ### Creating Regular Expressions
* ```js
* // Method 1: Regex literal (preferred)
* var re = /hello/;
* var reFlags = /hello/gi; // g=global, i=ignore case, m=multiline
*
* // Method 2: Constructor (useful for dynamic patterns)
* var re2 = new RegExp("hello");
* var re3 = new RegExp("hello", "gi");
* var dynamic = new RegExp(playerName); // Build pattern from variable
* ```
*
* ### Testing for Matches
* ```js
* /\d+/.test("abc123"); // true — contains digits
* /^\d+$/.test("abc123"); // false — not ALL digits
* /^\d+$/.test("12345"); // true — all digits
* /hello/i.test("Hello World"); // true — case insensitive
* ```
*
* ### Extracting Matches
* ```js
* var match = /\d+/.exec("abc123def"); // ["123"]
* var noMatch = /\d+/.exec("no digits"); // null
*
* // With capturing groups
* var result = /(\w+)@(\w+)/.exec("user@domain");
* // result[0] = "user@domain" (full match)
* // result[1] = "user" (first group)
* // result[2] = "domain" (second group)
* ```
*
* ### Using with String Methods
* ```js
* "abc123".match(/\d+/); // ["123"]
* "abc123".search(/\d/); // 3 (index of first digit)
* "abc123".replace(/\d+/, "NUM"); // "abcNUMdef"
* "a,b,,c".split(/,+/); // ["a", "b", "c"]
* ```
*
* ### RegExp Properties
* ```js
* var re = /hello/gi;
* re.source; // "hello"
* re.global; // true
* re.ignoreCase; // true
* re.multiline; // false
* re.lastIndex; // 0 (changes with global exec/test)
* ```
*
* ### ❌ Common Mistakes
* ```js
* RegExp.test("string"); // TypeError — test is an INSTANCE method!
* new RegExp.test("string"); // TypeError — incorrect syntax
* // ✅ CORRECT:
* /pattern/.test("string"); // Use on a regex instance
* new RegExp("pattern").test("string"); // Or create instance first
*
* // Double-escape backslashes in constructor strings:
* new RegExp("\d+"); // Wrong — \d becomes just d
* new RegExp("\\d+"); // ✅ Correct — \\d becomes \d
* ```
*/
export interface RegExp {
/** The pattern string that was used to create this regular expression */
source: string;
/** True if the 'g' (global) flag is set, affecting match behavior in exec() and test() */
global: boolean;
/** True if the 'i' (ignore case) flag is set, making pattern matching case-insensitive */
ignoreCase: boolean;
/** True if the 'm' (multiline) flag is set, affecting ^ and $ anchor behavior */
multiline: boolean;
/** The index at which to start searching in the string (used with 'g' flag in exec() loops) */
lastIndex: number;
/** Searches the string for a match and returns an array of matches or null if no match found */
exec(string: string): any[];
/** Tests whether the pattern matches the string, returning true or false */
test(string: string): boolean;
/** Returns a string representation of the regular expression (e.g., "/pattern/flags") */
toString(): string;
}
+82
View File
@@ -0,0 +1,82 @@
/**
* ECMAScript 5.1 - String type for working with text. Strings are immutable sequences of characters.
* Use String.fromCharCode() to create a string from character codes.
*
* ## How to Use
*
* ### Creating Strings
* ```js
* var greeting = "Hello, world!"; // String literal (double quotes)
* var name = 'Steve'; // String literal (single quotes)
* var fromCode = String.fromCharCode(65); // "A" (from char code)
* ```
*
* ### Searching & Checking
* ```js
* var str = "Hello, world!";
* str.indexOf("world"); // 7
* str.indexOf("missing"); // -1 (not found)
* str.lastIndexOf("l"); // 10
* str.search(/world/); // 7 (regex search)
* str.charAt(0); // "H"
* str.charCodeAt(0); // 72
* str.length; // 13
* ```
*
* ### Extracting & Transforming
* ```js
* var str = "Hello, world!";
* str.slice(7, 12); // "world"
* str.substring(0, 5); // "Hello"
* str.toUpperCase(); // "HELLO, WORLD!"
* str.toLowerCase(); // "hello, world!"
* str.trim(); // Removes leading/trailing whitespace
* str.replace("world", "NPC"); // "Hello, NPC!"
* str.replace(/l/g, "L"); // "HeLLo, worLd!" (regex with global flag)
* ```
*
* ### Splitting & Joining
* ```js
* "a,b,c".split(","); // ["a", "b", "c"]
* "hello".split(""); // ["h", "e", "l", "l", "o"]
* ["a", "b", "c"].join("-"); // "a-b-c" (Array.join, but related)
* "one two three".split(" ", 2); // ["one", "two"] (limit results)
* ```
*
* ### Pattern Matching
* ```js
* "abc123".match(/\d+/); // ["123"]
* "no numbers".match(/\d+/); // null
* "hello".concat(" ", "world"); // "hello world"
* ```
*
* ### ❌ Common Mistakes
* ```js
* str.replace("l", "L"); // Only replaces FIRST "l" — use /l/g for all
* String.charAt(0); // TypeError — instance method, not static
* "abc"[0]; // May not work in all engines — use charAt()
* ```
*/
export interface String {
/** The number of characters in the string */
length: number;
/** Creates a string from one or more Unicode character codes (e.g., String.fromCharCode(65, 66, 67) returns "ABC") */
static fromCharCode(...codes: number[]): string;
/** Returns the Unicode code point (0–65535) of the character at the specified index. Unlike Java's charAt() + cast, this returns the numeric code directly. */
charCodeAt(pos: number): number;
/** Tests the string against a regular expression and returns an array of matches, or null if no match found */
match(regexp: any): any[];
/**
* Replaces a pattern (string or RegExp object) with a replacement string.
* Unlike Java's replace/replaceAll which only accept String/CharSequence,
* this accepts a RegExp object as the first argument.
*/
replace(searchValue: any, replaceValue: any): string;
/** Returns the index of the first character that matches a regular expression, or -1 if not found */
search(regexp: any): number;
}
+1
Submodule gradle-plugins added at 19dc9a8361.
-9
View File
@@ -1,9 +0,0 @@
/.gradle
/build
/out
/bin
/.idea
/.vscode
/.settings
.project
.classpath
-94
View File
@@ -1,94 +0,0 @@
# dts-gradle-plugin
This repo contains the Gradle plugin for generating TypeScript `.d.ts` files for the CustomNPC-Plus API.
These files are used for the generation of auto-completion suggestions and type/interface documentation when scripting
in the Script Editor in-game.
### Implementation using JitPack
Add JitPack to the buildscript and depend on the plugin JAR. Using `main-SNAPSHOT` will build the latest `main` commit;
for reproducible builds use a tag or commit hash instead.
`settings.gradle`
```gradle
pluginManagement {
resolutionStrategy {
eachPlugin {
if(requested.id.toString() == "dts.typescript-generator") {
useModule("com.github.bigguy345:dts-gradle-plugin:main-SNAPSHOT")
}
}
}
repositories {
maven { url "https://jitpack.io" }
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}
```
`build.gradle`:
```gradle
plugins {
id 'dts.typescript-generator'
}
// ============================================================================
// TypeScript Definition Generation Task
// Generates .d.ts files from Java API sources for scripting IDE support
// ============================================================================
// TypeScript plugin is applied above in the main plugins block
tasks.named("generateTypeScriptDefinitions").configure {
// Source directories containing the Java API code
sourceDirectories = ['src/main/java']
// Packages in source directories to generate .d.ts files for
apiPackages = ['noppes.npcs.api'] as Set
// Output directory for the generated .d.ts files
// Must be within resources/assets/${modId}/api to be detected by CNPC+
outputDirectory = "src/main/resources/assets/${modId}/api"
// Whether to clean old generated files before regenerating
cleanOutputFirst = true
// Optional: copy external patch .d.ts files into assets/<modid>/api/patches
patchesDirectory = "dts-patches"
}
// Optional: To ensure definitions are generated on processing resources on jar build
// But in most cases, you may want to run the task manually when needed
// processResources.dependsOn generateTypeScriptDefinitions
```
---
## Patches (optional overrides)
Use `dts-patches/` to override or refine generated types. Files in this folder are copied to
`assets/<modid>/api/patches` after generation.
### Example: override `IPlayer.getDBCPlayer()` to return `IDBCAddon` instead of `IDBCPlayer`
File: `dts-patches/IPlayer.d.ts`
```ts
/**
* DBC Addon patch for IPlayer
* @javaFqn noppes.npcs.api.entity.IPlayer
*/
export interface IPlayer<T> {
getDBCPlayer(): IDBCAddon;
}
```
-50
View File
@@ -1,50 +0,0 @@
plugins {
id 'groovy-gradle-plugin'
id 'maven-publish'
}
group = 'dts'
version = '1.0.0'
repositories {
mavenCentral()
}
dependencies {
implementation gradleApi()
implementation localGroovy()
}
// Configure source sets if building as standalone
sourceSets {
main {
groovy {
srcDirs = ['src/main/groovy']
}
resources {
srcDirs = ['src/main/resources']
}
}
}
gradlePlugin {
plugins {
typescriptGenerator {
id = 'dts.typescript-generator'
implementationClass = 'dts.TypeScriptGeneratorPlugin'
displayName = 'TypeScript Definition Generator'
description = 'Generates TypeScript definition files from Java API sources'
}
}
}
publishing {
repositories {
mavenLocal()
}
}
// Handle duplicate resources
tasks.processResources {
duplicatesStrategy = 'include'
}
-1
View File
@@ -1 +0,0 @@
rootProject.name = 'dts-gradle-plugin'
@@ -1,175 +0,0 @@
package dts
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Optional
/**
* Gradle task that generates TypeScript definition (.d.ts) files from Java API sources.
*
* Usage in build.gradle:
*
* tasks.withType(GenerateTypeScriptTask).configureEach {
* sourceDirectories = ['src/api/java'] // Strings are converted to Files
* outputDirectory = 'src/main/resources/${modid}/api' // String converted to File
* apiPackages = ['noppes.npcs.api', 'kamkeel.npcdbc.api']
* }
*/
abstract class GenerateTypeScriptTask extends DefaultTask {
// Accept Object types (String or File) with @Internal annotation
@Internal
List<Object> sourceDirectories = []
@Internal
Object outputDirectory
@Input
Set<String> apiPackages = []
@Input
Boolean cleanOutputFirst = false
@Input
List<String> excludePatterns = []
@Internal
Object patchesDirectory
// Provide task input/output properties that Gradle can validate
@InputFiles
protected List<File> getResolvedSourceDirectories() {
return sourceDirectories.collect { obj ->
if (obj instanceof File) return obj
String pathStr = obj.toString()
if (pathStr.contains('${modid}')) {
String modid = project.archivesBaseName ?: 'mod'
pathStr = pathStr.replace('${modid}', modid)
}
File f = new File(pathStr)
if (!f.isAbsolute()) {
f = new File(project.projectDir, pathStr)
}
return f
}
}
@OutputDirectory
protected File getResolvedOutputDirectory() {
def obj = outputDirectory
if (obj instanceof File) return obj
String pathStr = obj.toString()
if (pathStr.contains('${modid}')) {
String modid = project.archivesBaseName ?: 'mod'
pathStr = pathStr.replace('${modid}', modid)
}
File f = new File(pathStr)
if (!f.isAbsolute()) {
f = new File(project.projectDir, pathStr)
}
return f
}
@Optional
@InputDirectory
protected File getResolvedDtsPatchesDirectory() {
if (patchesDirectory == null) return null
def obj = patchesDirectory
if (obj instanceof File) return obj
String pathStr = obj.toString()
if (pathStr.contains('${modid}')) {
String modid = project.archivesBaseName ?: 'mod'
pathStr = pathStr.replace('${modid}', modid)
}
File f = new File(pathStr)
if (!f.isAbsolute()) {
f = new File(project.projectDir, pathStr)
}
return f
}
/**
* Converts a value (String or File) to a File object.
* Supports special tokens like ${modid}.
*/
// conversion logic inlined into getters to avoid calling private helper at configuration time
GenerateTypeScriptTask() {
group = 'api'
description = 'Generates TypeScript definition files from Java API sources'
}
@TaskAction
void generate() {
List<File> srcDirs = getResolvedSourceDirectories()
File outDir = getResolvedOutputDirectory()
File patchesDir = getResolvedDtsPatchesDirectory()
logger.lifecycle("=".multiply(60))
logger.lifecycle("Generating TypeScript definitions...")
logger.lifecycle("=".multiply(60))
if (srcDirs.isEmpty()) {
logger.warn("No source directories specified!")
return
}
// Validate directories
srcDirs.each { dir ->
if (!dir.exists()) {
logger.warn("Source directory does not exist: ${dir}")
} else {
logger.lifecycle("Source: ${dir}")
}
}
logger.lifecycle("Output: ${outDir}")
logger.lifecycle("API Packages: ${apiPackages}")
// Clean output if requested
if (cleanOutputFirst && outDir.exists()) {
logger.lifecycle("Cleaning output directory...")
outDir.eachFileRecurse { file ->
if (file.name.endsWith('.d.ts') && !file.name.equals('minecraft-raw.d.ts') && !file.name.equals('forge-events-raw.d.ts')) {
file.delete()
}
}
}
// Create converter and process
JavaToTypeScriptConverter converter = new JavaToTypeScriptConverter(outDir, apiPackages)
List<File> validDirs = srcDirs.findAll { it.exists() }
if (validDirs.isEmpty()) {
logger.error("No valid source directories found!")
return
}
converter.processDirectories(validDirs, logger)
if (patchesDir != null) {
if (!patchesDir.exists()) {
logger.lifecycle("Patches directory does not exist: ${patchesDir}")
} else {
File patchOutputDir = new File(outDir, "patches")
if (patchOutputDir.exists()) {
patchOutputDir.deleteDir()
}
project.copy {
from patchesDir
into patchOutputDir
}
logger.lifecycle("Copied .d.ts patches to: ${patchOutputDir}")
}
}
logger.lifecycle("=".multiply(60))
logger.lifecycle("TypeScript definition generation complete!")
logger.lifecycle("=".multiply(60))
}
}
File diff suppressed because it is too large. Load diff
@@ -1,17 +0,0 @@
package dts
import org.gradle.api.Plugin
import org.gradle.api.Project
/**
* Gradle plugin for generating TypeScript definition files from Java API sources.
*/
class TypeScriptGeneratorPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
if (project.tasks.findByName('generateTypeScriptDefinitions') == null) {
project.tasks.register('generateTypeScriptDefinitions', GenerateTypeScriptTask)
}
}
}
@@ -1 +0,0 @@
implementation-class=dts.TypeScriptGeneratorPlugin
Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 337 KiB

After

Width:  |  Height:  |  Size: 337 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 787 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 227 KiB

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 MiB

+1 -1
Submodule src/api updated: f383fc3037...e7f363727e.
+1 -1
View File
@@ -142,7 +142,7 @@ public class CmdNpc extends ChMcLogger {
EntityCustomNpc npc = new EntityCustomNpc(pw);
if (args.length > 0)
npc.display.name = args[0];
npc.setPositionAndRotation(player.posX, player.posY, player.posZ, player.cameraYaw, player.cameraPitch);
npc.setPositionAndRotation(player.posX, player.posY, player.posZ, player.rotationYaw, 0);
npc.ais.startPos = new int[]{MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ)};
pw.spawnEntityInWorld(npc);
npc.setHealth(npc.getMaxHealth());
@@ -37,6 +37,15 @@ public class DBCAddon {
public void doDBCDamage(EntityNPCInterface npc, float attackStrength, Entity receiver) {
}
/**
* Returns the pre-calculated DBC attack damage of the current attacker,
* or the vanilla damage if DBC damage was not calculated.
* Used by Counter (PERCENT mode) to base counter damage on the full DBC attack, not vanilla base.
*/
public float getAttackerDBCDamage(float vanillaDamage) {
return vanillaDamage;
}
public boolean isKO(EntityNPCInterface npc, EntityPlayer player) {
return false;
}
@@ -0,0 +1,42 @@
package kamkeel.npcs.client.command;
import kamkeel.npcs.util.CNPCDebug;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
/**
* Client-only command to toggle debug logging.
* Registered via ClientCommandHandler so it runs entirely on the client
* without sending a packet to the server.
*/
public class CommandCNPCDebugger extends CommandBase {
@Override
public String getCommandName() {
return "cnpcdebugger";
}
@Override
public String getCommandUsage(ICommandSender sender) {
return "/cnpcdebugger <type> - Toggle client debug logging for a type (e.g. energy)";
}
@Override
public int getRequiredPermissionLevel() {
return 0;
}
@Override
public void processCommand(ICommandSender sender, String[] args) {
if (args.length == 0) {
sender.addChatMessage(new ChatComponentText("\u00A7cUsage: /cnpcdebugger <type>"));
return;
}
String type = args[0].toLowerCase();
boolean newState = CNPCDebug.toggleClient(type);
String stateText = newState ? "\u00A7aENABLED" : "\u00A7cDISABLED";
sender.addChatMessage(new ChatComponentText("\u00A77[CNPC+] \u00A7eClient debug '" + type + "' " + stateText));
}
}
@@ -1,273 +0,0 @@
package kamkeel.npcs.client.gui.components;
import noppes.npcs.client.gui.util.ModernColors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
/**
* A collapsible section header that can expand/collapse its content.
* Used in the editor panel to organize settings into groups.
*/
public class CollapsibleSection extends Gui {
// Identity
protected int id;
protected String title;
// State
protected boolean expanded = true;
protected boolean hovered = false;
// Layout
protected int x, y, width;
protected int headerHeight = 18;
protected int contentHeight = 0; // Set by owner based on content
protected int indent = 8;
protected int spacing = 4;
protected int topPadding = 4; // Padding between header and first content row
// Remove button
protected Runnable onRemove = null;
protected boolean hoveringRemoveBtn = false;
protected int removeBtnSize = 14;
// Icon
protected static final ResourceLocation X_ICON = new ResourceLocation("customnpcs", "textures/gui/auction/x_icon.png");
// Colors
protected int headerBg = ModernColors.SECTION_HEADER_BG;
protected int headerBgHover = ModernColors.SECTION_HEADER_HOVER;
protected int headerText = ModernColors.TEXT_LIGHT;
protected int arrowColor = ModernColors.SECTION_ARROW;
// Animation
protected float expandProgress = 1.0f; // 0 = collapsed, 1 = expanded
protected float animSpeed = 8.0f; // Units per second
protected long lastDrawTime = 0;
public CollapsibleSection(int id, String title) {
this.id = id;
this.title = title;
}
public CollapsibleSection(int id, String title, boolean expanded) {
this.id = id;
this.title = title;
this.expanded = expanded;
this.expandProgress = expanded ? 1.0f : 0.0f;
}
// === Layout ===
public void setPosition(int x, int y, int width) {
this.x = x;
this.y = y;
this.width = width;
}
public void setContentHeight(int height) {
this.contentHeight = height;
}
/**
* Get total height of this section (header + content if expanded).
*/
public int getTotalHeight() {
if (!expanded && expandProgress <= 0.01f) {
return headerHeight;
}
return headerHeight + topPadding + (int)(contentHeight * expandProgress) + spacing;
}
/**
* Get the Y position where content should start (after header + padding).
*/
public int getContentY() {
return y + headerHeight + topPadding;
}
/**
* Get the X position for indented content.
*/
public int getContentX() {
return x + indent;
}
/**
* Get the width available for content.
*/
public int getContentWidth() {
return width - indent;
}
// === Drawing ===
/**
* Draw the section header. Content is drawn by the owner.
* @return true if content should be drawn (expanded)
*/
public boolean draw(int mouseX, int mouseY) {
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
// Update animation with proper delta time
long currentTime = System.currentTimeMillis();
float deltaTime = lastDrawTime == 0 ? 0.016f : (currentTime - lastDrawTime) / 1000.0f;
lastDrawTime = currentTime;
float targetProgress = expanded ? 1.0f : 0.0f;
if (Math.abs(expandProgress - targetProgress) > 0.001f) {
float step = animSpeed * deltaTime;
if (expandProgress < targetProgress) {
expandProgress = Math.min(targetProgress, expandProgress + step);
} else {
expandProgress = Math.max(targetProgress, expandProgress - step);
}
} else {
expandProgress = targetProgress;
}
// Check hover
hovered = mouseX >= x && mouseX < x + width &&
mouseY >= y && mouseY < y + headerHeight;
// Draw header background
int bgColor = hovered ? headerBgHover : headerBg;
drawRect(x, y, x + width, y + headerHeight, bgColor);
// Draw expand/collapse arrow
String arrow = expanded ? "\u25BC" : "\u25B6"; // ▼ or ▶
fr.drawString(arrow, x + 4, y + (headerHeight - fr.FONT_HEIGHT) / 2, arrowColor);
// Draw title
int titleX = x + 14;
int titleEndX = x + width;
// Draw remove button if present
if (onRemove != null) {
int btnX = x + width - removeBtnSize - 4;
int btnY = y + (headerHeight - removeBtnSize) / 2;
titleEndX = btnX - 4;
hoveringRemoveBtn = mouseX >= btnX && mouseX < btnX + removeBtnSize &&
mouseY >= btnY && mouseY < btnY + removeBtnSize;
int btnBg = hoveringRemoveBtn ? 0xFFCC4444 : 0xFFAA3333;
drawRect(btnX, btnY, btnX + removeBtnSize, btnY + removeBtnSize, btnBg);
Minecraft.getMinecraft().getTextureManager().bindTexture(X_ICON);
GL11.glColor4f(1f, 1f, 1f, 1f);
GL11.glEnable(GL11.GL_BLEND);
int iconSize = removeBtnSize - 4;
int ix = btnX + 2;
int iy = btnY + 2;
Tessellator t = Tessellator.instance;
t.startDrawingQuads();
t.addVertexWithUV(ix, iy + iconSize, zLevel, 0, 1);
t.addVertexWithUV(ix + iconSize, iy + iconSize, zLevel, 1, 1);
t.addVertexWithUV(ix + iconSize, iy, zLevel, 1, 0);
t.addVertexWithUV(ix, iy, zLevel, 0, 0);
t.draw();
GL11.glDisable(GL11.GL_BLEND);
}
// Draw title (truncated if needed)
String displayTitle = fr.trimStringToWidth(title, titleEndX - titleX);
fr.drawString(displayTitle, titleX, y + (headerHeight - fr.FONT_HEIGHT) / 2, headerText);
// Return whether content should be drawn
return expanded || expandProgress > 0.01f;
}
/**
* Get the current expand progress for animation purposes.
* Can be used to clip content drawing during collapse animation.
*/
public float getExpandProgress() {
return expandProgress;
}
// === Interaction ===
/**
* Handle mouse click. Returns true if handled.
*/
public boolean mouseClicked(int mouseX, int mouseY, int button) {
if (button != 0) return false;
// Check if header was clicked
if (mouseX >= x && mouseX < x + width &&
mouseY >= y && mouseY < y + headerHeight) {
// Check remove button first
if (onRemove != null && hoveringRemoveBtn) {
onRemove.run();
return true;
}
// Otherwise toggle expand
toggle();
return true;
}
return false;
}
/**
* Toggle expanded state.
*/
public void toggle() {
expanded = !expanded;
}
/**
* Set expanded state.
*/
public void setExpanded(boolean expanded) {
this.expanded = expanded;
// Instant state change for programmatic changes
expandProgress = expanded ? 1.0f : 0.0f;
}
// === Getters/Setters ===
public int getId() { return id; }
public String getTitle() { return title; }
public boolean isExpanded() { return expanded; }
public boolean isHovered() { return hovered; }
public int getX() { return x; }
public int getY() { return y; }
public int getWidth() { return width; }
public int getHeaderHeight() { return headerHeight; }
public int getIndent() { return indent; }
public CollapsibleSection setTitle(String title) {
this.title = title;
return this;
}
public CollapsibleSection setHeaderHeight(int height) {
this.headerHeight = height;
return this;
}
public CollapsibleSection setIndent(int indent) {
this.indent = indent;
return this;
}
public CollapsibleSection setOnRemove(Runnable action) {
this.onRemove = action;
return this;
}
public CollapsibleSection setColors(int headerBg, int headerText, int arrow) {
this.headerBg = headerBg;
this.headerBgHover = ModernColors.lighten(headerBg, 0.1f);
this.headerText = headerText;
this.arrowColor = arrow;
return this;
}
}
@@ -1,381 +0,0 @@
package kamkeel.npcs.client.gui.components;
import noppes.npcs.client.gui.util.ModernColors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import noppes.npcs.client.gui.util.GuiNpcButton;
/**
* Modern styled button extending GuiNpcButton.
* Flat design matching the GuiModernScreen aesthetic with modern colors.
* Inherits hover text, icon support, and multi-value cycling from GuiNpcButton.
*/
public class ModernButton extends GuiNpcButton {
// Styling (can be customized per-button)
protected int bgColor = ModernColors.BUTTON_BG;
protected int bgColorHover = ModernColors.BUTTON_BG_HOVER;
protected int bgColorPressed = ModernColors.BUTTON_BG_PRESSED;
protected int bgColorDisabled = ModernColors.BUTTON_BG_DISABLED;
protected int borderColor = ModernColors.BUTTON_BORDER;
protected int borderColorHover = ModernColors.BUTTON_BORDER_HOVER;
protected int textColor = ModernColors.TEXT_WHITE;
protected int textColorDisabled = ModernColors.TEXT_DARK;
// Layout
protected int paddingX = 6;
protected int paddingY = 2;
protected int minWidth = 20;
protected int minHeight = 16;
// State
protected boolean pressed = false;
protected boolean hovered = false;
// Color button mode
protected boolean colorMode = false;
protected int displayColor = 0xFFFFFF;
// Multi-value support (like GuiNpcButton)
protected String[] values;
protected int valueIndex = 0;
/**
* Create a simple button with text.
*/
public ModernButton(int id, int x, int y, int width, int height, String text) {
super(id, x, y, width, height, text);
}
/**
* Create a button with minimum size based on text.
*/
public ModernButton(int id, int x, int y, String text) {
super(id, x, y, 60, 20, text);
fitToText(Minecraft.getMinecraft().fontRenderer);
}
/**
* Create a multi-value button (uses parent's display array).
*/
public ModernButton(int id, int x, int y, int width, int height, String[] values, int startIndex) {
super(id, x, y, width, height, values, startIndex);
// Also store in local values for modern methods
this.values = values;
this.valueIndex = startIndex;
}
// === Size Methods ===
/**
* Set button size.
*/
public ModernButton setSize(int w, int h) {
this.width = Math.max(minWidth, w);
this.height = Math.max(minHeight, h);
return this;
}
/**
* Set button bounds (position and size).
*/
public ModernButton setBounds(int x, int y, int w, int h) {
this.xPosition = x;
this.yPosition = y;
return setSize(w, h);
}
/**
* Auto-size button based on text width.
*/
public ModernButton fitToText(FontRenderer fr) {
if (fr == null) fr = Minecraft.getMinecraft().fontRenderer;
int textWidth = fr.getStringWidth(displayString);
this.width = Math.max(minWidth, textWidth + paddingX * 2);
this.height = Math.max(minHeight, fr.FONT_HEIGHT + paddingY * 2);
return this;
}
/**
* Set minimum dimensions.
*/
public ModernButton setMinSize(int minW, int minH) {
this.minWidth = minW;
this.minHeight = minH;
// Enforce minimums on current size
if (width < minWidth) width = minWidth;
if (height < minHeight) height = minHeight;
return this;
}
// === Style Methods ===
/**
* Set background color for normal state.
*/
public ModernButton setBackgroundColor(int color) {
this.bgColor = color;
return this;
}
/**
* Set all background colors at once.
*/
public ModernButton setBackgroundColors(int normal, int hover, int pressed, int disabled) {
this.bgColor = normal;
this.bgColorHover = hover;
this.bgColorPressed = pressed;
this.bgColorDisabled = disabled;
return this;
}
/**
* Set border color.
*/
public ModernButton setBorderColor(int color) {
this.borderColor = color;
this.borderColorHover = ModernColors.lighten(color, 0.2f);
return this;
}
/**
* Set text colors.
*/
public ModernButton setTextColors(int normal, int disabled) {
this.textColor = normal;
this.textColorDisabled = disabled;
return this;
}
/**
* Set padding around text.
*/
public ModernButton setPadding(int px, int py) {
this.paddingX = px;
this.paddingY = py;
return this;
}
// === Multi-Value Support (delegates to parent where appropriate) ===
/**
* Get current value index (for multi-value buttons).
* Uses parent's getValue() for consistency.
*/
@Override
public int getValue() {
return super.getValue();
}
/**
* Set current value index.
*/
public ModernButton setValue(int index) {
setDisplay(index);
if (values != null && index >= 0 && index < values.length) {
this.valueIndex = index;
}
return this;
}
/**
* Cycle to next value.
*/
public void nextValue() {
if (values != null && values.length > 0) {
valueIndex = (valueIndex + 1) % values.length;
setDisplay(valueIndex);
}
}
/**
* Cycle to previous value.
*/
public void prevValue() {
if (values != null && values.length > 0) {
valueIndex = (valueIndex - 1 + values.length) % values.length;
setDisplay(valueIndex);
}
}
// === Color Button Mode ===
public ModernButton setColorMode(int color) {
this.colorMode = true;
this.displayColor = color & 0xFFFFFF;
return this;
}
public void setColor(int color) {
this.displayColor = color & 0xFFFFFF;
}
public int getColor() {
return displayColor;
}
protected int getContrastColor(int bgColor) {
int r = (bgColor >> 16) & 0xFF;
int g = (bgColor >> 8) & 0xFF;
int b = bgColor & 0xFF;
double luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255.0;
return luminance > 0.5 ? 0x000000 : 0xFFFFFF;
}
// === Rendering ===
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (!this.visible) return;
FontRenderer fr = mc.fontRenderer;
hovered = mouseX >= xPosition && mouseY >= yPosition &&
mouseX < xPosition + width && mouseY < yPosition + height;
if (colorMode) {
drawColorButton(fr, mouseX, mouseY);
return;
}
// Determine colors based on state
int bg, border, text;
if (!enabled) {
bg = bgColorDisabled;
border = borderColor;
text = textColorDisabled;
} else if (pressed && hovered) {
bg = bgColorPressed;
border = borderColorHover;
text = textColor;
} else if (hovered) {
bg = bgColorHover;
border = borderColorHover;
text = textColor;
} else {
bg = bgColor;
border = borderColor;
text = textColor;
}
// Draw background
drawRect(xPosition, yPosition, xPosition + width, yPosition + height, bg);
// Draw border (1px)
drawHorizontalLine(xPosition, xPosition + width - 1, yPosition, border);
drawHorizontalLine(xPosition, xPosition + width - 1, yPosition + height - 1, border);
drawVerticalLine(xPosition, yPosition, yPosition + height - 1, border);
drawVerticalLine(xPosition + width - 1, yPosition, yPosition + height - 1, border);
// Draw text centered
String displayText = displayString;
int maxTextWidth = width - paddingX * 2;
if (fr.getStringWidth(displayText) > maxTextWidth) {
// Truncate with ellipsis
displayText = trimToWidth(fr, displayText, maxTextWidth - fr.getStringWidth("..")) + "..";
}
int textX = xPosition + (width - fr.getStringWidth(displayText)) / 2;
int textY = yPosition + (height - fr.FONT_HEIGHT) / 2;
// Draw shadow first for better readability
fr.drawString(displayText, textX + 1, textY + 1, ModernColors.darken(text, 0.6f));
fr.drawString(displayText, textX, textY, text);
}
/**
* Draw horizontal line (like Gui.drawHorizontalLine but public).
*/
protected void drawHorizontalLine(int x1, int x2, int y, int color) {
if (x2 < x1) {
int temp = x1;
x1 = x2;
x2 = temp;
}
drawRect(x1, y, x2 + 1, y + 1, color);
}
/**
* Draw vertical line.
*/
protected void drawVerticalLine(int x, int y1, int y2, int color) {
if (y2 < y1) {
int temp = y1;
y1 = y2;
y2 = temp;
}
drawRect(x, y1, x + 1, y2 + 1, color);
}
/**
* Trim text to fit within width.
*/
protected String trimToWidth(FontRenderer fr, String text, int maxWidth) {
if (fr.getStringWidth(text) <= maxWidth) return text;
StringBuilder sb = new StringBuilder();
for (char c : text.toCharArray()) {
if (fr.getStringWidth(sb.toString() + c) > maxWidth) break;
sb.append(c);
}
return sb.toString();
}
protected void drawColorButton(FontRenderer fr, int mouseX, int mouseY) {
int border = hovered ? ModernColors.INPUT_BORDER_FOCUSED : ModernColors.INPUT_BORDER;
drawRect(xPosition - 1, yPosition - 1, xPosition + width + 1, yPosition + height + 1, border);
drawRect(xPosition, yPosition, xPosition + width, yPosition + height, 0xFF000000 | displayColor);
if (!enabled) {
drawRect(xPosition, yPosition, xPosition + width, yPosition + height, 0x80000000);
}
String hex = String.format("%06X", displayColor & 0xFFFFFF);
int textColor = getContrastColor(displayColor);
int textX = xPosition + (width - fr.getStringWidth(hex)) / 2;
int textY = yPosition + (height - fr.FONT_HEIGHT) / 2;
fr.drawString(hex, textX, textY, textColor);
}
// === Mouse Handling ===
@Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
boolean result = super.mousePressed(mc, mouseX, mouseY);
if (result) {
pressed = true;
// Cycle value for multi-value buttons
if (values != null) {
nextValue();
}
}
return result;
}
@Override
public void mouseReleased(int mouseX, int mouseY) {
pressed = false;
super.mouseReleased(mouseX, mouseY);
}
/**
* Handle right-click for reverse cycling (multi-value buttons).
*/
public boolean mouseRightPressed(Minecraft mc, int mouseX, int mouseY) {
if (enabled && visible && hovered && values != null) {
prevValue();
return true;
}
return false;
}
// === State Accessors ===
public boolean isHovered() {
return hovered;
}
public boolean isPressed() {
return pressed;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
@@ -1,161 +0,0 @@
package kamkeel.npcs.client.gui.components;
import noppes.npcs.client.gui.util.ModernColors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
/**
* Modern styled checkbox component.
* Square box: hollow border when OFF, filled green when ON.
* Single click to toggle.
*/
public class ModernCheckbox extends Gui {
// Identity
protected int id;
protected String label;
// State
protected boolean value = false;
protected boolean enabled = true;
protected boolean hovered = false;
// Position/Size
protected int x, y;
protected int size = 14;
protected int labelGap = 6;
// Colors
protected int borderColor = ModernColors.INPUT_BORDER;
protected int borderColorHover = ModernColors.INPUT_BORDER_FOCUSED;
protected int fillOff = ModernColors.INPUT_BG;
protected int fillOn = ModernColors.ACCENT_GREEN;
protected int labelColor = ModernColors.TEXT_LIGHT;
protected int labelColorDisabled = ModernColors.TEXT_DARK;
public ModernCheckbox(int id, int x, int y, String label, boolean value) {
this.id = id;
this.x = x;
this.y = y;
this.label = label;
this.value = value;
}
public ModernCheckbox(int id, int x, int y, boolean value) {
this(id, x, y, null, value);
}
// === Drawing ===
public void draw(int mouseX, int mouseY) {
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
// Check hover on checkbox
hovered = enabled && mouseX >= x && mouseX < x + size &&
mouseY >= y && mouseY < y + size;
int border = !enabled ? ModernColors.INPUT_BORDER :
(hovered ? borderColorHover : borderColor);
// Draw border (hollow box outline)
drawRect(x, y, x + size, y + 1, border); // top
drawRect(x, y + size - 1, x + size, y + size, border); // bottom
drawRect(x, y, x + 1, y + size, border); // left
drawRect(x + size - 1, y, x + size, y + size, border); // right
// Fill interior
if (value) {
// Filled green when ON
int fill = enabled ? fillOn : ModernColors.darken(fillOn, 0.4f);
drawRect(x + 2, y + 2, x + size - 2, y + size - 2, fill);
} else {
// Dark background when OFF
int fill = enabled ? fillOff : ModernColors.INPUT_BG_DISABLED;
drawRect(x + 1, y + 1, x + size - 1, y + size - 1, fill);
}
// Draw label to the right
if (label != null && !label.isEmpty()) {
int labelY = y + (size - fr.FONT_HEIGHT) / 2;
int labelX = x + size + labelGap;
fr.drawString(label, labelX, labelY, enabled ? labelColor : labelColorDisabled);
}
}
// === Interaction ===
/**
* Handle mouse click. Returns true if handled.
*/
public boolean mouseClicked(int mouseX, int mouseY, int button) {
if (button != 0 || !enabled) return false;
// Check if checkbox was clicked
if (mouseX >= x && mouseX < x + size &&
mouseY >= y && mouseY < y + size) {
toggle();
return true;
}
return false;
}
/**
* Toggle the value.
*/
public void toggle() {
value = !value;
}
// === Getters/Setters ===
public int getId() { return id; }
public boolean getValue() { return value; }
public void setValue(boolean value) {
this.value = value;
}
public boolean isEnabled() { return enabled; }
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getLabel() { return label; }
public void setLabel(String label) {
this.label = label;
}
public void setPosition(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() { return x; }
public int getY() { return y; }
public int getSize() { return size; }
public ModernCheckbox setSize(int size) {
this.size = size;
return this;
}
/**
* Get total width including label.
*/
public int getTotalWidth(FontRenderer fr) {
if (label == null || label.isEmpty()) {
return size;
}
return size + labelGap + fr.getStringWidth(label);
}
public ModernCheckbox setColors(int borderColor, int fillOn) {
this.borderColor = borderColor;
this.fillOn = fillOn;
return this;
}
}
@@ -1,394 +0,0 @@
package kamkeel.npcs.client.gui.components;
import noppes.npcs.client.gui.util.ModernColors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.List;
/**
* Modern styled dropdown/select component.
* Allows selection from a list of options.
*/
public class ModernDropdown extends Gui {
// Static: track the currently expanded dropdown to ensure only one is open
protected static ModernDropdown activeDropdown = null;
// Identity
protected int id;
// Position/Size
protected int x, y, width, height;
// Options
protected List<String> options = new ArrayList<>();
protected int selectedIndex = 0;
// State
protected boolean expanded = false;
protected boolean enabled = true;
protected boolean hovered = false;
protected int hoveredOption = -1;
// Colors
protected int bgColor = ModernColors.INPUT_BG;
protected int bgColorHover = ModernColors.INPUT_BG_FOCUSED;
protected int borderColor = ModernColors.INPUT_BORDER;
protected int borderColorFocused = ModernColors.INPUT_BORDER_FOCUSED;
protected int textColor = ModernColors.TEXT_LIGHT;
protected int textColorDisabled = ModernColors.TEXT_DARK;
protected int dropdownBg = ModernColors.PANEL_BG_SOLID;
protected int optionHover = ModernColors.SELECTION_BG;
protected int arrowColor = ModernColors.TEXT_GRAY;
// Layout
protected int paddingX = 4;
protected int maxDropdownHeight = 120;
// Screen-space position for overlay rendering (to handle scroll offsets)
protected int screenX, screenY;
public ModernDropdown(int id, int x, int y, int width, int height) {
this.id = id;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
// === Drawing ===
/**
* Draw the dropdown. Use drawBase() + drawOverlay() for z-order control.
*/
public void draw(int mouseX, int mouseY) {
drawBase(mouseX, mouseY);
if (expanded) {
drawOverlay(mouseX, mouseY);
}
}
/**
* Draw only the base button (not the expanded dropdown).
* Call this first, then call drawOverlay() later for proper z-order.
*/
public void drawBase(int mouseX, int mouseY) {
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
// Check hover state
hovered = enabled && isInsideMain(mouseX, mouseY);
// Draw main button
int bg = !enabled ? ModernColors.INPUT_BG_DISABLED : (hovered || expanded ? bgColorHover : bgColor);
int border = expanded ? borderColorFocused : borderColor;
drawRect(x - 1, y - 1, x + width + 1, y + height + 1, border);
drawRect(x, y, x + width, y + height, bg);
// Draw selected text
String displayText = selectedIndex >= 0 && selectedIndex < options.size() ?
options.get(selectedIndex) : "";
displayText = fr.trimStringToWidth(displayText, width - paddingX * 2 - 12);
int textY = y + (height - fr.FONT_HEIGHT) / 2;
fr.drawString(displayText, x + paddingX, textY, enabled ? textColor : textColorDisabled);
// Draw arrow
String arrow = expanded ? "\u25B2" : "\u25BC"; // ▲ or ▼
int arrowX = x + width - paddingX - fr.getStringWidth(arrow);
fr.drawString(arrow, arrowX, textY, arrowColor);
}
/**
* Draw the expanded dropdown overlay. Call this AFTER all other components
* to ensure it renders on top.
*/
public void drawOverlay(int mouseX, int mouseY) {
if (!expanded) return;
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
drawDropdown(mouseX, mouseY, fr);
}
protected void drawDropdown(int mouseX, int mouseY, FontRenderer fr) {
int optionHeight = fr.FONT_HEIGHT + 4;
int dropdownHeight = Math.min(options.size() * optionHeight, maxDropdownHeight);
int dropdownY = y + height;
// Use scissor for scrolling if needed
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
int scale = sr.getScaleFactor();
// Draw dropdown background with border
drawRect(x - 1, dropdownY, x + width + 1, dropdownY + dropdownHeight + 1, borderColorFocused);
drawRect(x, dropdownY, x + width, dropdownY + dropdownHeight, dropdownBg);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor(x * scale, mc.displayHeight - (dropdownY + dropdownHeight) * scale,
width * scale, dropdownHeight * scale);
// Draw options
hoveredOption = -1;
for (int i = 0; i < options.size(); i++) {
int optY = dropdownY + i * optionHeight;
// Check hover
if (mouseX >= x && mouseX < x + width &&
mouseY >= optY && mouseY < optY + optionHeight) {
hoveredOption = i;
drawRect(x, optY, x + width, optY + optionHeight, optionHover);
}
// Draw text
String text = fr.trimStringToWidth(options.get(i), width - paddingX * 2);
int textCol = (i == selectedIndex) ? ModernColors.ACCENT_BLUE : textColor;
fr.drawString(text, x + paddingX, optY + 2, textCol);
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
}
// === Interaction ===
public boolean mouseClicked(int mouseX, int mouseY, int button) {
if (button != 0) return false;
if (!enabled) return false;
if (expanded) {
// Check if clicked on an option
if (hoveredOption >= 0) {
selectedIndex = hoveredOption;
expanded = false;
if (activeDropdown == this) activeDropdown = null;
return true;
}
// Clicked outside - close
expanded = false;
if (activeDropdown == this) activeDropdown = null;
return isInsideMain(mouseX, mouseY);
} else {
// Check if clicked on main button
if (isInsideMain(mouseX, mouseY)) {
// Close any other open dropdown first
if (activeDropdown != null && activeDropdown != this) {
activeDropdown.close();
}
activeDropdown = this;
expanded = true;
return true;
}
}
return false;
}
public boolean isInsideMain(int mouseX, int mouseY) {
return mouseX >= x && mouseX < x + width &&
mouseY >= y && mouseY < y + height;
}
public boolean isInsideDropdown(int mouseX, int mouseY) {
if (!expanded) return false;
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int optionHeight = fr.FONT_HEIGHT + 4;
int dropdownHeight = Math.min(options.size() * optionHeight, maxDropdownHeight);
int dropdownY = y + height;
return mouseX >= x && mouseX < x + width &&
mouseY >= dropdownY && mouseY < dropdownY + dropdownHeight;
}
public boolean isInside(int mouseX, int mouseY) {
return isInsideMain(mouseX, mouseY) || isInsideDropdown(mouseX, mouseY);
}
public void close() {
expanded = false;
if (activeDropdown == this) activeDropdown = null;
}
/**
* Close any currently active dropdown. Call this when clicking elsewhere
* in the UI to dismiss open dropdowns.
*/
public static void closeActiveDropdown() {
if (activeDropdown != null) {
activeDropdown.expanded = false;
activeDropdown = null;
}
}
/**
* Check if any dropdown is currently expanded.
*/
public static boolean hasActiveDropdown() {
return activeDropdown != null && activeDropdown.expanded;
}
// === Getters/Setters ===
public int getId() { return id; }
public int getSelectedIndex() { return selectedIndex; }
public void setSelectedIndex(int index) {
this.selectedIndex = Math.max(0, Math.min(index, options.size() - 1));
}
public String getSelectedValue() {
if (selectedIndex >= 0 && selectedIndex < options.size()) {
return options.get(selectedIndex);
}
return "";
}
public void setSelectedValue(String value) {
int idx = options.indexOf(value);
if (idx >= 0) {
selectedIndex = idx;
}
}
public List<String> getOptions() { return options; }
public void setOptions(List<String> options) {
this.options = options != null ? options : new ArrayList<>();
if (selectedIndex >= this.options.size()) {
selectedIndex = this.options.isEmpty() ? -1 : 0;
}
}
public void addOption(String option) {
options.add(option);
}
public void clearOptions() {
options.clear();
selectedIndex = -1;
}
public boolean isExpanded() { return expanded; }
public boolean isEnabled() { return enabled; }
public void setEnabled(boolean enabled) {
this.enabled = enabled;
if (!enabled) expanded = false;
}
public void setPosition(int x, int y) {
this.x = x;
this.y = y;
}
public void setBounds(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
/**
* Set screen-space position for overlay rendering (handles scroll offsets).
*/
public void setScreenPosition(int screenX, int screenY) {
this.screenX = screenX;
this.screenY = screenY;
}
/**
* Draw the expanded dropdown overlay in screen-space coordinates.
* Call this AFTER disabling scissor test and popping scroll translation.
*/
public void drawOverlayScreenSpace(int mouseX, int mouseY) {
if (!expanded) return;
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int optionHeight = fr.FONT_HEIGHT + 4;
int dropdownHeight = Math.min(options.size() * optionHeight, maxDropdownHeight);
int dropdownY = screenY + height;
// Draw dropdown background with border at screen position
drawRect(screenX - 1, dropdownY, screenX + width + 1, dropdownY + dropdownHeight + 1, borderColorFocused);
drawRect(screenX, dropdownY, screenX + width, dropdownY + dropdownHeight, dropdownBg);
// Draw options with screen-space hit detection
hoveredOption = -1;
for (int i = 0; i < options.size(); i++) {
int optY = dropdownY + i * optionHeight;
// Check hover using screen coordinates
if (mouseX >= screenX && mouseX < screenX + width &&
mouseY >= optY && mouseY < optY + optionHeight) {
hoveredOption = i;
drawRect(screenX, optY, screenX + width, optY + optionHeight, optionHover);
}
// Draw text
String text = fr.trimStringToWidth(options.get(i), width - paddingX * 2);
int textCol = (i == selectedIndex) ? ModernColors.ACCENT_BLUE : textColor;
fr.drawString(text, screenX + paddingX, optY + 2, textCol);
}
}
/**
* Handle mouse click using screen-space coordinates for expanded dropdown.
*/
public boolean mouseClickedScreenSpace(int mouseX, int mouseY, int button) {
if (button != 0 || !enabled) return false;
if (expanded) {
// Check if clicked on an option using screen coordinates
if (hoveredOption >= 0) {
selectedIndex = hoveredOption;
expanded = false;
if (activeDropdown == this) activeDropdown = null;
return true;
}
// Clicked outside - close
expanded = false;
if (activeDropdown == this) activeDropdown = null;
return isInsideMainScreenSpace(mouseX, mouseY);
} else {
// Check if clicked on main button using screen coordinates
if (isInsideMainScreenSpace(mouseX, mouseY)) {
// Close any other open dropdown first
if (activeDropdown != null && activeDropdown != this) {
activeDropdown.close();
}
activeDropdown = this;
expanded = true;
return true;
}
}
return false;
}
/**
* Check if mouse is inside the main dropdown button using screen coordinates.
*/
protected boolean isInsideMainScreenSpace(int mouseX, int mouseY) {
return mouseX >= screenX && mouseX < screenX + width &&
mouseY >= screenY && mouseY < screenY + height;
}
public int getX() { return x; }
public int getY() { return y; }
public int getWidth() { return width; }
public int getHeight() { return height; }
/**
* Get the height when expanded (for z-ordering).
*/
public int getExpandedHeight() {
if (!expanded) return height;
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int optionHeight = fr.FONT_HEIGHT + 4;
return height + Math.min(options.size() * optionHeight, maxDropdownHeight);
}
}
@@ -1,144 +0,0 @@
package kamkeel.npcs.client.gui.components;
import noppes.npcs.client.gui.util.ModernColors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
/**
* Modern styled label component.
* Supports single or multi-line text, alignment, and optional background.
*/
public class ModernLabel extends Gui {
// Identity
protected int id;
protected String text;
// Position/Size
protected int x, y;
protected int width = 0; // 0 = auto-width based on text
protected int height = 0;
// Alignment
public static final int ALIGN_LEFT = 0;
public static final int ALIGN_CENTER = 1;
public static final int ALIGN_RIGHT = 2;
protected int alignment = ALIGN_LEFT;
// Styling
protected int textColor = ModernColors.TEXT_LIGHT;
protected int bgColor = 0; // 0 = no background
protected int padding = 2;
protected boolean shadow = false;
public ModernLabel(int id, int x, int y, String text) {
this.id = id;
this.x = x;
this.y = y;
this.text = text;
}
public ModernLabel(int id, int x, int y, int width, String text) {
this.id = id;
this.x = x;
this.y = y;
this.width = width;
this.text = text;
}
// === Drawing ===
public void draw(int mouseX, int mouseY) {
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int textWidth = fr.getStringWidth(text);
int actualWidth = width > 0 ? width : textWidth + padding * 2;
int actualHeight = height > 0 ? height : fr.FONT_HEIGHT + padding * 2;
// Draw background if set
if (bgColor != 0) {
drawRect(x, y, x + actualWidth, y + actualHeight, bgColor);
}
// Calculate text position based on alignment
int textX;
switch (alignment) {
case ALIGN_CENTER:
textX = x + (actualWidth - textWidth) / 2;
break;
case ALIGN_RIGHT:
textX = x + actualWidth - textWidth - padding;
break;
default: // ALIGN_LEFT
textX = x + padding;
}
int textY = y + (actualHeight - fr.FONT_HEIGHT) / 2;
// Draw text
if (shadow) {
fr.drawStringWithShadow(text, textX, textY, textColor);
} else {
fr.drawString(text, textX, textY, textColor);
}
}
// === Getters/Setters ===
public int getId() { return id; }
public String getText() { return text; }
public void setText(String text) {
this.text = text;
}
public void setPosition(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() { return x; }
public int getY() { return y; }
public int getWidth() {
if (width > 0) return width;
return Minecraft.getMinecraft().fontRenderer.getStringWidth(text) + padding * 2;
}
public int getHeight() {
if (height > 0) return height;
return Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT + padding * 2;
}
public ModernLabel setSize(int width, int height) {
this.width = width;
this.height = height;
return this;
}
public ModernLabel setAlignment(int align) {
this.alignment = align;
return this;
}
public ModernLabel setColor(int color) {
this.textColor = color;
return this;
}
public ModernLabel setBackground(int color) {
this.bgColor = color;
return this;
}
public ModernLabel setShadow(boolean shadow) {
this.shadow = shadow;
return this;
}
public ModernLabel setPadding(int padding) {
this.padding = padding;
return this;
}
}
@@ -1,163 +0,0 @@
package kamkeel.npcs.client.gui.components;
import noppes.npcs.client.gui.util.ModernColors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
/**
* A button that displays selected item text and triggers selection on click.
* The parent handles opening the actual selection GUI.
*/
public class ModernSelectButton extends Gui {
// Identity
protected int id;
protected int slot = 0; // For multi-slot selections
// Position/Size
protected int x, y, width, height;
// Display
protected String displayText = "";
protected String placeholder = "Select...";
protected int selectedId = -1;
// State
protected boolean enabled = true;
protected boolean hovered = false;
// Colors
protected int bgColor = ModernColors.BUTTON_BG;
protected int bgColorHover = ModernColors.BUTTON_BG_HOVER;
protected int bgColorDisabled = ModernColors.BUTTON_BG_DISABLED;
protected int borderColor = ModernColors.BUTTON_BORDER;
protected int borderColorHover = ModernColors.BUTTON_BORDER_HOVER;
protected int textColor = ModernColors.TEXT_LIGHT;
protected int textColorDisabled = ModernColors.TEXT_DARK;
protected int placeholderColor = ModernColors.TEXT_DARK;
// Padding
protected int paddingX = 4;
public ModernSelectButton(int id, int x, int y, int width, int height) {
this.id = id;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public ModernSelectButton(int id, int x, int y, int width, int height, String placeholder) {
this(id, x, y, width, height);
this.placeholder = placeholder;
}
// === Drawing ===
public void draw(int mouseX, int mouseY) {
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
hovered = enabled && isInside(mouseX, mouseY);
// Background
int bg = !enabled ? bgColorDisabled : (hovered ? bgColorHover : bgColor);
int border = hovered ? borderColorHover : borderColor;
// Draw border
drawRect(x - 1, y - 1, x + width + 1, y + height + 1, border);
// Draw background
drawRect(x, y, x + width, y + height, bg);
// Draw text
String text = (displayText != null && !displayText.isEmpty()) ? displayText : placeholder;
text = fr.trimStringToWidth(text, width - paddingX * 2);
int textY = y + (height - fr.FONT_HEIGHT) / 2;
int textCol;
if (!enabled) {
textCol = textColorDisabled;
} else if (displayText != null && !displayText.isEmpty()) {
textCol = textColor;
} else {
textCol = placeholderColor;
}
fr.drawString(text, x + paddingX, textY, textCol);
}
// === Interaction ===
public boolean mouseClicked(int mouseX, int mouseY, int button) {
if (button != 0 || !enabled) return false;
return isInside(mouseX, mouseY);
}
public boolean isInside(int mouseX, int mouseY) {
return mouseX >= x && mouseX < x + width &&
mouseY >= y && mouseY < y + height;
}
// === Selection Management ===
public void setSelected(int id, String name) {
this.selectedId = id;
this.displayText = name;
}
public void clearSelection() {
this.selectedId = -1;
this.displayText = "";
}
public boolean hasSelection() {
return selectedId >= 0;
}
// === Getters/Setters ===
public int getId() { return id; }
public int getSlot() { return slot; }
public void setSlot(int slot) { this.slot = slot; }
public int getSelectedId() { return selectedId; }
public String getDisplayText() { return displayText; }
public void setDisplayText(String text) {
this.displayText = text;
}
public String getPlaceholder() { return placeholder; }
public void setPlaceholder(String placeholder) {
this.placeholder = placeholder;
}
public boolean isEnabled() { return enabled; }
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isHovered() { return hovered; }
public void setPosition(int x, int y) {
this.x = x;
this.y = y;
}
public void setBounds(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public int getX() { return x; }
public int getY() { return y; }
public int getWidth() { return width; }
public int getHeight() { return height; }
}
@@ -1,194 +0,0 @@
package kamkeel.npcs.client.gui.components;
import noppes.npcs.client.gui.util.ModernColors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
/**
* Modern toggle switch component.
* A sliding on/off switch with animation.
*/
public class ModernToggle extends Gui {
// Identity
protected int id;
protected String label;
// State
protected boolean value = false;
protected boolean enabled = true;
protected boolean hovered = false;
// Position
protected int x, y;
protected int toggleWidth = 36;
protected int toggleHeight = 16;
protected int labelGap = 6;
// Animation
protected float animProgress = 0; // 0 = off, 1 = on
protected float animSpeed = 0.25f;
// Colors
protected int trackOff = ModernColors.TOGGLE_OFF;
protected int trackOn = ModernColors.TOGGLE_ON;
protected int knobColor = ModernColors.TOGGLE_KNOB;
protected int labelColor = ModernColors.TEXT_LIGHT;
protected int labelColorDisabled = ModernColors.TEXT_DARK;
public ModernToggle(int id, int x, int y, String label, boolean value) {
this.id = id;
this.x = x;
this.y = y;
this.label = label;
this.value = value;
this.animProgress = value ? 1.0f : 0.0f;
}
// === Drawing ===
public void draw(int mouseX, int mouseY) {
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
// Update animation
float target = value ? 1.0f : 0.0f;
if (Math.abs(animProgress - target) > 0.01f) {
animProgress += (target - animProgress) * animSpeed;
} else {
animProgress = target;
}
// Check hover on toggle
hovered = enabled && mouseX >= x && mouseX < x + toggleWidth &&
mouseY >= y && mouseY < y + toggleHeight;
// Draw label first (to the left)
if (label != null && !label.isEmpty()) {
int labelY = y + (toggleHeight - fr.FONT_HEIGHT) / 2;
int labelX = x - labelGap - fr.getStringWidth(label);
fr.drawString(label, labelX, labelY, enabled ? labelColor : labelColorDisabled);
}
// Interpolate track color
int trackColor = ModernColors.blend(trackOff, trackOn, animProgress);
if (!enabled) {
trackColor = ModernColors.darken(trackColor, 0.4f);
}
// Draw track (rounded rectangle approximation)
int radius = toggleHeight / 2;
drawRect(x + radius, y, x + toggleWidth - radius, y + toggleHeight, trackColor);
drawCircle(x + radius, y + radius, radius, trackColor);
drawCircle(x + toggleWidth - radius, y + radius, radius, trackColor);
// Calculate knob position
int knobRadius = radius - 2;
int knobMinX = x + radius;
int knobMaxX = x + toggleWidth - radius;
int knobX = knobMinX + (int)((knobMaxX - knobMinX) * animProgress);
// Draw knob
int knob = enabled ? knobColor : ModernColors.darken(knobColor, 0.3f);
if (hovered) {
knob = ModernColors.lighten(knob, 0.1f);
}
drawCircle(knobX, y + radius, knobRadius, knob);
}
/**
* Draw a filled circle (approximation using rectangles).
*/
protected void drawCircle(int cx, int cy, int radius, int color) {
// Simple approximation - draw a series of horizontal lines
for (int dy = -radius; dy <= radius; dy++) {
int dx = (int) Math.sqrt(radius * radius - dy * dy);
drawRect(cx - dx, cy + dy, cx + dx, cy + dy + 1, color);
}
}
// === Interaction ===
/**
* Handle mouse click. Returns true if handled.
*/
public boolean mouseClicked(int mouseX, int mouseY, int button) {
if (button != 0 || !enabled) return false;
// Check if toggle was clicked
if (mouseX >= x && mouseX < x + toggleWidth &&
mouseY >= y && mouseY < y + toggleHeight) {
toggle();
return true;
}
return false;
}
/**
* Toggle the value.
*/
public void toggle() {
value = !value;
}
// === Getters/Setters ===
public int getId() { return id; }
public boolean getValue() { return value; }
public void setValue(boolean value) {
this.value = value;
// Don't reset animation - let it animate to new value
}
public void setValueImmediate(boolean value) {
this.value = value;
this.animProgress = value ? 1.0f : 0.0f;
}
public boolean isEnabled() { return enabled; }
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getLabel() { return label; }
public void setLabel(String label) {
this.label = label;
}
public void setPosition(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() { return x; }
public int getY() { return y; }
public int getWidth() { return toggleWidth; }
public int getHeight() { return toggleHeight; }
/**
* Get total width including label.
*/
public int getTotalWidth(FontRenderer fr) {
if (label == null || label.isEmpty()) {
return toggleWidth;
}
return toggleWidth + labelGap + fr.getStringWidth(label);
}
public ModernToggle setColors(int trackOff, int trackOn, int knob) {
this.trackOff = trackOff;
this.trackOn = trackOn;
this.knobColor = knob;
return this;
}
public ModernToggle setSize(int width, int height) {
this.toggleWidth = width;
this.toggleHeight = height;
return this;
}
}
@@ -1,295 +0,0 @@
package kamkeel.npcs.client.gui.components;
import noppes.npcs.client.gui.util.ModernColors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.List;
/**
* A scrollable panel component for containing other UI elements.
* Uses GL scissor for clipping content that overflows the panel bounds.
*/
public class ScrollPanel extends Gui {
// Position and size
protected int x, y, width, height;
// Scroll state
protected float scrollY = 0;
protected float targetScrollY = 0;
protected int contentHeight = 0;
protected float scrollSpeed = 0.3f; // Lerp speed
// Scrollbar
protected int scrollbarWidth = 6;
protected boolean showScrollbar = true;
protected boolean isDraggingScrollbar = false;
protected int dragStartY;
protected float dragStartScroll;
// Content elements (managed by owner, we just track height)
protected List<ScrollPanelElement> elements = new ArrayList<>();
// Colors
protected int backgroundColor = ModernColors.PANEL_BG_SOLID;
protected int scrollbarBg = ModernColors.SCROLLBAR_BG;
protected int scrollbarThumb = ModernColors.SCROLLBAR_THUMB;
protected int scrollbarThumbHover = ModernColors.SCROLLBAR_THUMB_HOVER;
// State
protected boolean hoveringScrollbar = false;
public ScrollPanel(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
// === Position/Size ===
public void setBounds(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public void setContentHeight(int height) {
this.contentHeight = height;
// Clamp scroll if content shrunk
float maxScroll = getMaxScroll();
if (scrollY > maxScroll) {
scrollY = maxScroll;
targetScrollY = maxScroll;
}
}
public void setBackgroundColor(int color) {
this.backgroundColor = color;
}
public void resetScroll() {
this.scrollY = 0;
this.targetScrollY = 0;
}
public int getContentHeight() {
return contentHeight;
}
public int getScrollY() {
return (int) scrollY;
}
public void setScrollY(float scroll) {
this.scrollY = Math.max(0, Math.min(scroll, getMaxScroll()));
this.targetScrollY = scrollY;
}
// === Drawing ===
/**
* Begin drawing the scroll panel. Call this before drawing content.
* Sets up GL scissor for clipping.
*/
public void beginDraw() {
// Update scroll animation
if (Math.abs(scrollY - targetScrollY) > 0.5f) {
scrollY += (targetScrollY - scrollY) * scrollSpeed;
} else {
scrollY = targetScrollY;
}
// Draw background
drawRect(x, y, x + width, y + height, backgroundColor);
// Set up scissor (convert to screen coordinates)
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
int scale = sr.getScaleFactor();
int scissorX = x * scale;
int scissorY = mc.displayHeight - (y + height) * scale;
int scissorW = (width - (needsScrollbar() ? scrollbarWidth : 0)) * scale;
int scissorH = height * scale;
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor(scissorX, scissorY, scissorW, scissorH);
// Translate for scroll offset
GL11.glPushMatrix();
GL11.glTranslatef(0, -scrollY, 0);
}
/**
* End drawing the scroll panel. Call this after drawing content.
* Disables GL scissor and draws scrollbar.
*/
public void endDraw(int mouseX, int mouseY) {
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_SCISSOR_TEST);
// Draw scrollbar if needed
if (needsScrollbar()) {
drawScrollbar(mouseX, mouseY);
}
}
/**
* Draw the scrollbar.
*/
protected void drawScrollbar(int mouseX, int mouseY) {
int sbX = x + width - scrollbarWidth;
int sbY = y;
int sbH = height;
// Track background
drawRect(sbX, sbY, sbX + scrollbarWidth, sbY + sbH, scrollbarBg);
// Calculate thumb size and position
float viewRatio = (float) height / contentHeight;
int thumbH = Math.max(20, (int) (sbH * viewRatio));
int maxThumbY = sbH - thumbH;
int thumbY = (int) (maxThumbY * (scrollY / getMaxScroll()));
// Check hover
hoveringScrollbar = mouseX >= sbX && mouseX < sbX + scrollbarWidth &&
mouseY >= sbY + thumbY && mouseY < sbY + thumbY + thumbH;
// Draw thumb
int thumbColor = (hoveringScrollbar || isDraggingScrollbar) ? scrollbarThumbHover : scrollbarThumb;
drawRect(sbX + 1, sbY + thumbY, sbX + scrollbarWidth - 1, sbY + thumbY + thumbH, thumbColor);
}
// === Scrolling ===
public boolean needsScrollbar() {
return showScrollbar && contentHeight > height;
}
public float getMaxScroll() {
return Math.max(0, contentHeight - height);
}
/**
* Handle mouse scroll wheel.
* @param delta Scroll wheel delta (positive = scroll up)
*/
public void mouseScrolled(int delta) {
if (!needsScrollbar()) return;
float scrollAmount = delta * 20;
targetScrollY = Math.max(0, Math.min(targetScrollY - scrollAmount, getMaxScroll()));
}
/**
* Handle mouse click. Returns true if handled.
*/
public boolean mouseClicked(int mouseX, int mouseY, int button) {
if (button != 0) return false;
// Check scrollbar click
if (needsScrollbar()) {
int sbX = x + width - scrollbarWidth;
if (mouseX >= sbX && mouseX < sbX + scrollbarWidth &&
mouseY >= y && mouseY < y + height) {
// Calculate thumb position
float viewRatio = (float) height / contentHeight;
int thumbH = Math.max(20, (int) (height * viewRatio));
int maxThumbY = height - thumbH;
int thumbY = (int) (maxThumbY * (scrollY / getMaxScroll()));
if (mouseY >= y + thumbY && mouseY < y + thumbY + thumbH) {
// Clicked on thumb - start dragging
isDraggingScrollbar = true;
dragStartY = mouseY;
dragStartScroll = scrollY;
} else {
// Clicked on track - jump to position
float clickRatio = (float) (mouseY - y - thumbH / 2) / (height - thumbH);
clickRatio = Math.max(0, Math.min(1, clickRatio));
targetScrollY = clickRatio * getMaxScroll();
}
return true;
}
}
return false;
}
/**
* Handle mouse drag.
*/
public void mouseDragged(int mouseX, int mouseY) {
if (isDraggingScrollbar) {
int deltaY = mouseY - dragStartY;
float viewRatio = (float) height / contentHeight;
int thumbH = Math.max(20, (int) (height * viewRatio));
int maxThumbY = height - thumbH;
float scrollDelta = (deltaY / (float) maxThumbY) * getMaxScroll();
scrollY = Math.max(0, Math.min(dragStartScroll + scrollDelta, getMaxScroll()));
targetScrollY = scrollY;
}
}
/**
* Handle mouse release.
*/
public void mouseReleased(int mouseX, int mouseY) {
isDraggingScrollbar = false;
}
/**
* Check if a point is inside the panel content area.
*/
public boolean isInside(int mouseX, int mouseY) {
return mouseX >= x && mouseX < x + width &&
mouseY >= y && mouseY < y + height;
}
/**
* Check if a point is inside the content area (excluding scrollbar).
*/
public boolean isInsideContent(int mouseX, int mouseY) {
int contentW = width - (needsScrollbar() ? scrollbarWidth : 0);
return mouseX >= x && mouseX < x + contentW &&
mouseY >= y && mouseY < y + height;
}
/**
* Transform a screen Y coordinate to content Y coordinate.
*/
public int toContentY(int screenY) {
return (int) (screenY + scrollY);
}
/**
* Transform a content Y coordinate to screen Y coordinate.
*/
public int toScreenY(int contentY) {
return (int) (contentY - scrollY);
}
// === Getters ===
public int getX() { return x; }
public int getY() { return y; }
public int getWidth() { return width; }
public int getHeight() { return height; }
public int getContentWidth() { return width - (needsScrollbar() ? scrollbarWidth : 0); }
// === Simple element interface ===
public interface ScrollPanelElement {
int getHeight();
void draw(int x, int y, int width, int mouseX, int mouseY);
}
}
@@ -1,428 +0,0 @@
package kamkeel.npcs.client.gui.modern;
import kamkeel.npcs.client.gui.components.ModernDropdown;
import kamkeel.npcs.client.gui.components.ScrollPanel;
import kamkeel.npcs.client.gui.modern.tabs.*;
import noppes.npcs.client.gui.util.ModernColors;
import noppes.npcs.client.gui.util.IDialogEditorListener;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import noppes.npcs.controllers.data.Dialog;
import java.util.ArrayList;
import java.util.List;
/**
* Complete dialog editor panel v2 with 5 tabs.
* Now refactored to use separate tab classes for better organization.
*
* Tabs:
* 0 - Text (title, dialog text)
* 1 - Options (6 option slots)
* 2 - Feedback (sound, visual options)
* 3 - Settings (quest, mail, command)
* 4 - Availability (requirements)
*/
public class DialogEditorPanel extends Gui {
// === Layout ===
protected int x, y, width, height;
protected int headerHeight = 22;
protected int tabBarHeight = 20;
protected int footerHeight = 24;
protected int padding = 4;
// === State ===
protected Dialog dialog;
protected boolean dirty = false;
protected int currentTab = 0;
// === Scroll Panel (replaces manual scroll logic) ===
protected ScrollPanel scrollPanel;
// === Tab Names ===
protected static final String[] TAB_NAMES = {"Text", "Options", "Feedback", "Settings", "Availability"};
// === Tabs ===
protected DialogTextTab textTab;
protected DialogOptionsTab optionsTab;
protected DialogFeedbackTab feedbackTab;
protected DialogSettingsTab settingsTab;
protected DialogAvailabilityTab availabilityTab;
protected DialogEditorTab[] tabs;
// === Tab hover ===
protected int hoveredTab = -1;
// === Listener ===
protected IDialogEditorListener listener;
// === Footer ===
protected boolean hoverTestBtn = false;
protected boolean hoverSaveBtn = false;
protected int saveBtnX, saveBtnY, saveBtnW, saveBtnH;
public DialogEditorPanel(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
initTabs();
initScrollPanel();
}
protected void initScrollPanel() {
int contentY = y + headerHeight + tabBarHeight;
int contentAreaH = height - headerHeight - tabBarHeight - footerHeight;
scrollPanel = new ScrollPanel(x, contentY, width, contentAreaH);
scrollPanel.setBackgroundColor(0); // Transparent - we draw our own background
}
protected int getScrollbarWidth() {
return scrollPanel != null ? 6 : 0;
}
// === Tab Initialization ===
protected void initTabs() {
textTab = new DialogTextTab(this);
optionsTab = new DialogOptionsTab(this);
feedbackTab = new DialogFeedbackTab(this);
settingsTab = new DialogSettingsTab(this);
availabilityTab = new DialogAvailabilityTab(this);
tabs = new DialogEditorTab[] {
textTab, optionsTab, feedbackTab, settingsTab, availabilityTab
};
}
// === Data Loading ===
public void setDialog(Dialog dialog) {
this.dialog = dialog;
this.dirty = false;
scrollPanel.resetScroll();
for (DialogEditorTab tab : tabs) {
tab.setDialog(dialog);
tab.loadFromDialog(dialog);
}
}
// === Data Saving ===
public void saveToDialog() {
if (dialog == null) return;
for (DialogEditorTab tab : tabs) {
tab.saveToDialog(dialog);
}
dirty = false;
}
// === Drawing ===
public void draw(int mouseX, int mouseY) {
if (dialog == null) {
drawNoSelection();
return;
}
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
// Background
drawRect(x, y, x + width, y + height, ModernColors.PANEL_BG_SOLID);
// Header
drawHeader(mouseX, mouseY, fr);
// Tab bar
drawTabBar(mouseX, mouseY, fr);
// Update screen positions for all dropdowns BEFORE scroll translation
updateDropdownScreenPositions();
// Draw scrollable content using ScrollPanel
int contentX = x + padding;
int contentW = width - padding * 2 - getScrollbarWidth();
int startY = y + headerHeight + tabBarHeight + padding;
scrollPanel.beginDraw();
// Draw current tab content
int contentHeight = tabs[currentTab].draw(contentX, contentW, startY,
mouseX, scrollPanel.toContentY(mouseY), fr);
// Update scroll panel's content height
scrollPanel.setContentHeight(contentHeight);
scrollPanel.endDraw(mouseX, mouseY);
// Draw expanded dropdowns in SCREEN SPACE (no translation!)
drawExpandedDropdownsScreenSpace(mouseX, mouseY);
// Footer
drawFooter(mouseX, mouseY, fr);
}
protected void drawNoSelection() {
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
drawRect(x, y, x + width, y + height, ModernColors.PANEL_BG_SOLID);
String msg = "Select a dialog to edit";
int msgW = fr.getStringWidth(msg);
fr.drawString(msg, x + (width - msgW) / 2, y + height / 2, ModernColors.TEXT_DARK);
}
protected void drawHeader(int mouseX, int mouseY, FontRenderer fr) {
drawRect(x, y, x + width, y + headerHeight, ModernColors.TOP_BAR_BG);
String title = dialog.title;
if (title.length() > 20) title = title.substring(0, 17) + "...";
if (dirty) title = "* " + title;
fr.drawString(title, x + padding, y + (headerHeight - fr.FONT_HEIGHT) / 2,
dirty ? ModernColors.DIRTY_INDICATOR : ModernColors.TEXT_WHITE);
String idStr = "#" + dialog.id;
int idW = fr.getStringWidth(idStr);
fr.drawString(idStr, x + width - padding - idW, y + (headerHeight - fr.FONT_HEIGHT) / 2,
ModernColors.TEXT_GRAY);
}
protected void drawTabBar(int mouseX, int mouseY, FontRenderer fr) {
int tabY = y + headerHeight;
int tabW = width / TAB_NAMES.length;
hoveredTab = -1;
for (int i = 0; i < TAB_NAMES.length; i++) {
int tabX = x + i * tabW;
boolean active = i == currentTab;
boolean hovered = mouseX >= tabX && mouseX < tabX + tabW &&
mouseY >= tabY && mouseY < tabY + tabBarHeight;
if (hovered) hoveredTab = i;
int bg = active ? ModernColors.BUTTON_BG_PRESSED : (hovered ? ModernColors.BUTTON_BG_HOVER : ModernColors.BUTTON_BG);
drawRect(tabX, tabY, tabX + tabW, tabY + tabBarHeight, bg);
String text = TAB_NAMES[i];
int textW = fr.getStringWidth(text);
fr.drawString(text, tabX + (tabW - textW) / 2, tabY + (tabBarHeight - fr.FONT_HEIGHT) / 2,
active ? ModernColors.TEXT_WHITE : ModernColors.TEXT_LIGHT);
if (active) {
drawRect(tabX, tabY + tabBarHeight - 2, tabX + tabW, tabY + tabBarHeight, ModernColors.ACCENT_BLUE);
}
}
}
protected void drawFooter(int mouseX, int mouseY, FontRenderer fr) {
int footerY = y + height - footerHeight;
drawRect(x, footerY, x + width, y + height, ModernColors.SECTION_HEADER_BG);
// Test button on the right
String testText = "Test";
int testW = fr.getStringWidth(testText) + 8;
int testH = footerHeight - 6;
int testX = x + width - testW - 6;
int testY = footerY + 3;
hoverTestBtn = mouseX >= testX && mouseX < testX + testW &&
mouseY >= testY && mouseY < testY + testH;
int testBg = hoverTestBtn ? ModernColors.BUTTON_BG_HOVER : ModernColors.BUTTON_BG;
drawRect(testX, testY, testX + testW, testY + testH, testBg);
drawRect(testX, testY, testX + testW, testY + 1, ModernColors.ACCENT_BLUE);
fr.drawString(testText, testX + 4, testY + (testH - fr.FONT_HEIGHT) / 2 + 1, ModernColors.TEXT_LIGHT);
// Save hint/button
String saveText = dirty ? "Ctrl+S to Save" : "No changes";
int saveW = fr.getStringWidth(saveText);
int saveX = x + (width - testW - 10 - saveW) / 2;
int saveY = footerY + (footerHeight - fr.FONT_HEIGHT) / 2;
saveBtnX = saveX - 4;
saveBtnY = saveY - 2;
saveBtnW = saveW + 8;
saveBtnH = fr.FONT_HEIGHT + 4;
hoverSaveBtn = dirty && mouseX >= saveBtnX && mouseX < saveBtnX + saveBtnW &&
mouseY >= saveBtnY && mouseY < saveBtnY + saveBtnH;
if (dirty && hoverSaveBtn) {
drawRect(saveBtnX, saveBtnY, saveBtnX + saveBtnW, saveBtnY + saveBtnH, ModernColors.BUTTON_BG_HOVER);
}
fr.drawString(saveText, saveX, saveY, dirty ? (hoverSaveBtn ? ModernColors.ACCENT_GREEN : ModernColors.ACCENT_ORANGE) : ModernColors.TEXT_DARK);
}
// === Dropdown Handling ===
protected void updateDropdownScreenPositions() {
for (ModernDropdown dropdown : getAllDropdowns()) {
int screenDropdownY = scrollPanel.toScreenY(dropdown.getY());
dropdown.setScreenPosition(dropdown.getX(), screenDropdownY);
}
}
protected void drawExpandedDropdownsScreenSpace(int mouseX, int mouseY) {
for (ModernDropdown dropdown : getAllDropdowns()) {
if (dropdown.isExpanded()) {
dropdown.drawOverlayScreenSpace(mouseX, mouseY);
}
}
}
protected List<ModernDropdown> getAllDropdowns() {
List<ModernDropdown> all = new ArrayList<>();
for (DialogEditorTab tab : tabs) {
all.addAll(tab.getDropdowns());
}
return all;
}
protected void closeAllDropdowns() {
for (ModernDropdown dropdown : getAllDropdowns()) {
dropdown.close();
}
}
// === Interaction ===
public boolean mouseClicked(int mouseX, int mouseY, int button) {
if (dialog == null) return false;
// Tab clicks
if (hoveredTab >= 0 && mouseY >= y + headerHeight && mouseY < y + headerHeight + tabBarHeight) {
currentTab = hoveredTab;
scrollPanel.resetScroll();
closeAllDropdowns();
return true;
}
// Footer clicks
int footerY = y + height - footerHeight;
if (mouseY >= footerY && mouseY < y + height) {
if (hoverTestBtn && listener != null) {
listener.onTestRequested();
return true;
}
if (hoverSaveBtn && dirty && listener != null) {
listener.onSaveRequested();
return true;
}
return true;
}
// Scrollbar - delegate to ScrollPanel
if (scrollPanel.mouseClicked(mouseX, mouseY, button)) {
return true;
}
// CHECK EXPANDED DROPDOWNS FIRST - delegate to current tab's field panel
if (tabs[currentTab].handleExpandedDropdownScreenClick(mouseX, mouseY, button)) {
markDirty();
return true;
}
// Adjust mouseY for scroll (for components inside scrollable content)
int adjMouseY = scrollPanel.toContentY(mouseY);
// Delegate to current tab
return tabs[currentTab].mouseClicked(mouseX, adjMouseY, button);
}
public boolean keyTyped(char c, int keyCode) {
if (dialog == null) return false;
return tabs[currentTab].keyTyped(c, keyCode);
}
public void mouseScrolled(int delta) {
scrollPanel.mouseScrolled(delta);
}
public void mouseReleased(int mouseX, int mouseY) {
scrollPanel.mouseReleased(mouseX, mouseY);
}
public void mouseDragged(int mouseX, int mouseY) {
scrollPanel.mouseDragged(mouseX, mouseY);
}
public void updateScreen() {
for (DialogEditorTab tab : tabs) {
tab.updateScreen();
}
}
// === Utility ===
public void markDirty() { dirty = true; }
public void clearDirty() { dirty = false; }
public boolean isDirty() { return dirty; }
public Dialog getDialog() { return dialog; }
public IDialogEditorListener getListener() { return listener; }
public boolean isInside(int mouseX, int mouseY) {
return mouseX >= x && mouseX < x + width && mouseY >= y && mouseY < y + height;
}
public void setBounds(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
// Update scroll panel bounds
int contentY = y + headerHeight + tabBarHeight;
int contentAreaH = height - headerHeight - tabBarHeight - footerHeight;
scrollPanel.setBounds(x, contentY, width, contentAreaH);
}
public void setListener(IDialogEditorListener listener) {
this.listener = listener;
}
/**
* Get available content height for tabs to use for sizing components.
*/
public int getAvailableContentHeight() {
return height - headerHeight - tabBarHeight - footerHeight;
}
// === Selection Callbacks ===
public void onQuestSelected(int slot, int questId, String questName) {
if (slot == 0) {
settingsTab.onQuestSelected(questId, questName);
} else {
availabilityTab.onQuestSelected(slot, questId, questName);
}
}
public void onDialogSelected(int slot, int dialogId, String dialogName) {
availabilityTab.onDialogSelected(slot, dialogId, dialogName);
}
public void onFactionSelected(int slot, int factionId, String factionName) {
availabilityTab.onFactionSelected(slot, factionId, factionName);
}
public void onSoundSelected(String soundPath) {
feedbackTab.onSoundSelected(soundPath);
}
public void onColorSelected(int slot, int color) {
if (slot >= 100) {
optionsTab.onColorSelected(slot, color);
} else {
feedbackTab.onColorSelected(slot, color);
}
}
public void onOptionDialogSelected(int optionSlot, int dialogId, String dialogName) {
optionsTab.onOptionDialogSelected(optionSlot, dialogId, dialogName);
}
}
@@ -1,215 +0,0 @@
package kamkeel.npcs.client.gui.modern;
import noppes.npcs.client.gui.util.ModernColors;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.GuiUtil;
import noppes.npcs.client.gui.util.ICustomScrollListener;
import noppes.npcs.client.gui.util.ISubGuiListener;
/**
* Abstract base class for fullscreen modern GUIs.
* Provides a configurable three-panel layout (left nav, center content, right actions)
* with percentage-based sizing, panel backgrounds/borders, and an optional resizable divider.
*
* Subclasses override abstract hooks to populate each panel region.
* Designed for reuse across Dialog Tree, Cloner, Quest Manager, etc.
*
* Renamed from GuiDirectory for the Modern GUI system.
*/
public abstract class GuiModernScreen extends GuiNPCInterface implements ICustomScrollListener, ISubGuiListener {
// ===== LAYOUT CONFIG (subclasses may override in constructor) =====
protected float leftPanelPercent = 0.20f;
protected float rightPanelPercent = 0.10f;
protected int minLeftPanelW = 80;
protected int minRightPanelW = 40;
protected int minCenterW = 100;
// ===== LAYOUT CONSTANTS =====
protected int pad = 10;
protected int topBarH = 24;
protected int gap = 4;
protected int btnH = 20;
// ===== PANEL COLORS (using ModernColors) =====
protected int panelBg = ModernColors.PANEL_BG;
protected int panelBorder = ModernColors.PANEL_BORDER;
protected int topBarBg = ModernColors.TOP_BAR_BG;
// ===== COMPUTED LAYOUT (populated by computeLayout) =====
protected int originX, originY, usableW, usableH;
protected int leftPanelW, rightPanelW;
protected int contentX, contentY, contentW, contentH;
protected int rightX;
// ===== OPTIONAL RESIZABLE DIVIDER (between left and center) =====
protected boolean enableDivider = false;
protected int dividerWidth = 5;
protected int dividerLineHeight = 20;
protected int minDividerPanelW = 50;
private int dividerOffset;
private boolean isDragging = false;
private int dragStartX;
// ===== CONSTRUCTOR =====
public GuiModernScreen() {
super();
closeOnEsc = true;
drawDefaultBackground = true;
}
// ===== LAYOUT COMPUTATION =====
protected void computeLayout() {
originX = pad;
originY = pad;
usableW = width - 2 * pad;
usableH = height - 2 * pad;
leftPanelW = Math.max(minLeftPanelW, (int)(usableW * leftPanelPercent));
rightPanelW = Math.max(minRightPanelW, (int)(usableW * rightPanelPercent));
if (rightPanelPercent <= 0) {
rightPanelW = 0;
}
int gapCount = rightPanelW > 0 ? 3 : 2;
contentW = usableW - leftPanelW - rightPanelW - gapCount * gap;
if (contentW < minCenterW) {
contentW = minCenterW;
}
contentX = originX + leftPanelW + gap;
contentY = originY + topBarH + gap;
contentH = usableH - topBarH - gap;
rightX = contentX + contentW + gap;
if (enableDivider && dividerOffset == 0) {
dividerOffset = leftPanelW;
}
}
// ===== INIT GUI =====
@Override
public void initGui() {
super.initGui();
computeLayout();
initTopBar(originY + 2);
initLeftPanel();
initCenterPanel();
if (rightPanelW > 0) {
initRightPanel(contentY + 4);
}
}
// ===== DRAWING =====
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawTopBar();
drawPanels();
super.drawScreen(mouseX, mouseY, partialTicks);
// Draw divider AFTER super.drawScreen() so it renders on top of GUI elements
if (enableDivider) {
drawDivider(mouseX, mouseY);
}
drawOverlay(mouseX, mouseY, partialTicks);
}
protected void drawTopBar() {
GuiUtil.drawRectD(originX, originY, originX + usableW, originY + topBarH, topBarBg);
}
protected void drawPanels() {
// Left nav panel border
GuiUtil.drawRectD(originX - 1, contentY - 1, originX + leftPanelW + 1, originY + usableH + 1, panelBorder);
// Right action panel border (if present)
if (rightPanelW > 0) {
GuiUtil.drawRectD(rightX - 1, contentY - 1, rightX + rightPanelW + 1, originY + usableH + 1, panelBorder);
}
}
protected void drawDivider(int mouseX, int mouseY) {
if (!enableDivider) return;
int divX = originX + dividerOffset;
int regionTop = contentY;
int regionHeight = contentH;
int handleTop = regionTop + (regionHeight - dividerLineHeight) / 2;
drawRect(divX + 1, handleTop, divX + dividerWidth - 1, handleTop + dividerLineHeight, 0xFF707070);
}
/** Override for extra drawing after super.drawScreen (e.g. status text) */
protected void drawOverlay(int mouseX, int mouseY, float partialTicks) {
}
// ===== DIVIDER MOUSE HANDLING =====
@Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
if (enableDivider && !hasSubGui()) {
int divX = originX + dividerOffset;
int regionTop = contentY;
int handleTop = regionTop + (contentH - dividerLineHeight) / 2;
int handleBottom = handleTop + dividerLineHeight;
if (mouseX >= divX && mouseX <= divX + dividerWidth &&
mouseY >= handleTop && mouseY <= handleBottom) {
isDragging = true;
resizingActive = true;
dragStartX = mouseX;
return;
}
}
super.mouseClicked(mouseX, mouseY, mouseButton);
}
@Override
public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
if (isDragging) {
int dx = mouseX - dragStartX;
dragStartX = mouseX;
dividerOffset += dx;
int maxOffset = (usableW - (rightPanelW > 0 ? rightPanelW + gap : 0)) - dividerWidth - minDividerPanelW;
dividerOffset = Math.max(minDividerPanelW, Math.min(dividerOffset, maxOffset));
onDividerMoved(dividerOffset);
return;
}
super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
}
@Override
protected void mouseMovedOrUp(int mouseX, int mouseY, int state) {
if (isDragging) {
isDragging = false;
resizingActive = false;
return;
}
super.mouseMovedOrUp(mouseX, mouseY, state);
}
/** Called when divider is dragged. Override to update scroll sizes. */
protected void onDividerMoved(int newOffset) {
}
// Accessors for divider offset
protected int getDividerOffset() {
return dividerOffset;
}
protected void setDividerOffset(int offset) {
this.dividerOffset = offset;
}
// ===== ABSTRACT HOOKS (subclass must implement) =====
/** Populate top bar buttons. topBtnY is the y-coordinate for the button row. */
protected abstract void initTopBar(int topBtnY);
/** Populate the left navigation panel (scrolls, search fields, buttons). */
protected abstract void initLeftPanel();
/** Populate the center content panel (main scroll list). */
protected abstract void initCenterPanel();
/** Populate the right action panel. startY is the first button y-coordinate. */
protected abstract void initRightPanel(int startY);
}
@@ -1,492 +0,0 @@
package kamkeel.npcs.client.gui.modern;
import kamkeel.npcs.client.gui.components.ModernButton;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.ModernColors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.opengl.GL11;
import java.util.*;
/**
* Abstract base class for modern styled two-column selectors (categories | items).
* Features draggable divider, search fields, and double-click selection.
*
* @param <C> Category type
* @param <I> Item type
*/
public abstract class ModernCategorySelector<C, I> extends ModernSubGuiInterface {
// Selected values
protected C selectedCategory;
protected I selectedItem;
// Data maps
protected HashMap<String, C> categoryData = new HashMap<>();
protected HashMap<String, I> itemData = new HashMap<>();
// Lists for display
protected List<String> filteredCategories = new ArrayList<>();
protected List<String> filteredItems = new ArrayList<>();
// Components
protected GuiNpcTextField catSearchField;
protected GuiNpcTextField itemSearchField;
protected ModernButton doneBtn;
protected ModernButton cancelBtn;
// Scroll state
protected int catScrollY = 0;
protected int itemScrollY = 0;
protected int selectedCatIndex = -1;
protected int selectedItemIndex = -1;
// Layout
protected int listY;
protected int listHeight;
protected int catListX, catListW;
protected int itemListX, itemListW;
protected int rowHeight = 14;
// Draggable divider
protected int dividerOffset;
protected boolean isDraggingDivider = false;
protected int dividerDragStartX;
protected int dividerWidth = 5;
protected int minColumnWidth = 80;
// Search strings
protected String catSearch = "";
protected String itemSearch = "";
// Button IDs
protected static final int ID_DONE = 100;
protected static final int ID_CANCEL = 101;
// Double-click tracking
protected long lastClickTime = 0;
protected int lastClickedIndex = -1;
public ModernCategorySelector() {
xSize = 420;
ySize = 280;
}
// ===== Abstract methods to be implemented by subclasses =====
/** Load all categories into categoryData map */
protected abstract void loadAllCategories();
/** Load items for a specific category into itemData map */
protected abstract void loadItemsForCategory(C category);
/** Get the display title for a category */
protected abstract String getCategoryTitle(C category);
/** Get the display title for an item */
protected abstract String getItemTitle(I item);
/** Get the ID of an item (for selection tracking) */
protected abstract int getItemId(I item);
/** Get the header title for the SubGui */
protected abstract String getHeaderTitle();
/** Get the column header for categories */
protected abstract String getCategoryColumnTitle();
/** Get the column header for items */
protected abstract String getItemColumnTitle();
/** Get the search placeholder for categories */
protected String getCategorySearchPlaceholder() {
return "Filter " + getCategoryColumnTitle().toLowerCase() + "...";
}
/** Get the search placeholder for items */
protected String getItemSearchPlaceholder() {
return "Filter " + getItemColumnTitle().toLowerCase() + "...";
}
// ===== Initialization =====
protected void loadData() {
categoryData.clear();
loadAllCategories();
filteredCategories = new ArrayList<>(categoryData.keySet());
Collections.sort(filteredCategories);
}
protected void loadItemsForSelectedCategory() {
itemData.clear();
if (selectedCategory != null) {
loadItemsForCategory(selectedCategory);
}
updateItemList();
}
@Override
public void initGui() {
super.initGui();
int contentY = getContentY() + 6;
int contentH = getContentHeight() - 6;
// Initialize divider offset if not set
if (dividerOffset == 0) {
dividerOffset = (xSize - 24) / 2; // Default 50/50 split
}
// Layout calculations with draggable divider
int pad = 8;
catListX = guiLeft + pad;
catListW = dividerOffset - pad;
itemListX = guiLeft + dividerOffset + dividerWidth;
itemListW = xSize - dividerOffset - dividerWidth - pad;
// Enforce minimum widths
if (catListW < minColumnWidth) {
catListW = minColumnWidth;
dividerOffset = catListW + pad;
itemListX = guiLeft + dividerOffset + dividerWidth;
itemListW = xSize - dividerOffset - dividerWidth - pad;
}
if (itemListW < minColumnWidth) {
itemListW = minColumnWidth;
dividerOffset = xSize - pad - dividerWidth - itemListW;
catListW = dividerOffset - pad;
itemListX = guiLeft + dividerOffset + dividerWidth;
}
// Search fields at top
int searchH = 18;
catSearchField = new GuiNpcTextField(0, catListX, contentY, catListW, searchH, catSearch);
itemSearchField = new GuiNpcTextField(1, itemListX, contentY, itemListW, searchH, itemSearch);
// List area below search
listY = contentY + searchH + 4;
listHeight = contentH - searchH - 36 - 8;
// Buttons at bottom
int btnY = guiTop + ySize - 32;
int btnWidth = 60;
int btnGap = 8;
cancelBtn = new ModernButton(ID_CANCEL, guiLeft + xSize - pad - btnWidth * 2 - btnGap, btnY, btnWidth, 20, "Cancel");
doneBtn = new ModernButton(ID_DONE, guiLeft + xSize - pad - btnWidth, btnY, btnWidth, 20, "Done");
doneBtn.setBackgroundColor(ModernColors.ACCENT_BLUE);
// Set initial selection indices
if (selectedCategory != null) {
selectedCatIndex = filteredCategories.indexOf(getCategoryTitle(selectedCategory));
}
if (selectedItem != null) {
selectedItemIndex = filteredItems.indexOf(getItemTitle(selectedItem));
}
}
protected void updateCategoryList() {
if (catSearch.isEmpty()) {
filteredCategories = new ArrayList<>(categoryData.keySet());
} else {
filteredCategories = new ArrayList<>();
String searchLower = catSearch.toLowerCase();
for (String name : categoryData.keySet()) {
if (name.toLowerCase().contains(searchLower)) {
filteredCategories.add(name);
}
}
}
Collections.sort(filteredCategories);
}
protected void updateItemList() {
if (itemSearch.isEmpty()) {
filteredItems = new ArrayList<>(itemData.keySet());
} else {
filteredItems = new ArrayList<>();
String searchLower = itemSearch.toLowerCase();
for (String name : itemData.keySet()) {
if (name.toLowerCase().contains(searchLower)) {
filteredItems.add(name);
}
}
}
Collections.sort(filteredItems);
}
// ===== Drawing =====
@Override
protected void drawContent(int mouseX, int mouseY, float partialTicks) {
// Draw column headers
int headerY = getContentY() - 2;
fontRendererObj.drawString(getCategoryColumnTitle(), catListX, headerY - 10, ModernColors.TEXT_LIGHT);
fontRendererObj.drawString(getItemColumnTitle(), itemListX, headerY - 10, ModernColors.TEXT_LIGHT);
// Draw search fields
catSearchField.draw(mouseX, mouseY);
itemSearchField.draw(mouseX, mouseY);
// Draw list backgrounds
drawRect(catListX, listY, catListX + catListW, listY + listHeight, ModernColors.INPUT_BG);
drawRect(itemListX, listY, itemListX + itemListW, listY + listHeight, ModernColors.INPUT_BG);
// Draw divider handle
int divX = guiLeft + dividerOffset;
int handleTop = listY + (listHeight - 20) / 2;
int handleColor = isDraggingDivider ? ModernColors.ACCENT_BLUE : 0xFF707070;
drawRect(divX + 1, handleTop, divX + dividerWidth - 1, handleTop + 20, handleColor);
// Draw category list
drawList(catListX, listY, catListW, listHeight, filteredCategories, selectedCatIndex,
catScrollY, mouseX, mouseY);
// Draw item list
drawList(itemListX, listY, itemListW, listHeight, filteredItems, selectedItemIndex,
itemScrollY, mouseX, mouseY);
// Draw selected item info
if (selectedItem != null) {
String info = "Selected: " + getItemTitle(selectedItem) + " (ID: " + getItemId(selectedItem) + ")";
int infoY = listY + listHeight + 4;
fontRendererObj.drawString(info, guiLeft + 8, infoY, ModernColors.TEXT_GRAY);
}
// Draw buttons
doneBtn.drawButton(mc, mouseX, mouseY);
cancelBtn.drawButton(mc, mouseX, mouseY);
}
protected void drawList(int x, int y, int w, int h, List<String> items, int selectedIdx,
int scrollY, int mouseX, int mouseY) {
// Set up scissor
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
int scale = sr.getScaleFactor();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor(x * scale, mc.displayHeight - (y + h) * scale, w * scale, h * scale);
int visibleRows = h / rowHeight;
int startIdx = scrollY / rowHeight;
int endIdx = Math.min(startIdx + visibleRows + 2, items.size());
for (int i = startIdx; i < endIdx; i++) {
int rowY = y + i * rowHeight - scrollY;
if (rowY + rowHeight < y || rowY > y + h) continue;
// Draw selection background
if (i == selectedIdx) {
drawRect(x, rowY, x + w, rowY + rowHeight, ModernColors.SELECTION_BG);
} else {
// Hover highlight
if (mouseX >= x && mouseX < x + w && mouseY >= rowY && mouseY < rowY + rowHeight) {
drawRect(x, rowY, x + w, rowY + rowHeight, ModernColors.HOVER_HIGHLIGHT);
}
}
// Draw text
String text = items.get(i);
String displayText = fontRendererObj.trimStringToWidth(text, w - 4);
int textColor = i == selectedIdx ? ModernColors.TEXT_WHITE : ModernColors.TEXT_LIGHT;
fontRendererObj.drawString(displayText, x + 2, rowY + 2, textColor);
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
// Draw scrollbar if needed
int totalHeight = items.size() * rowHeight;
if (totalHeight > h) {
int sbX = x + w - 4;
float viewRatio = (float) h / totalHeight;
int thumbH = Math.max(10, (int) (h * viewRatio));
float maxScroll = totalHeight - h;
int thumbY = maxScroll > 0 ? (int) ((scrollY / maxScroll) * (h - thumbH)) : 0;
drawRect(sbX, y, sbX + 4, y + h, ModernColors.SCROLLBAR_BG);
drawRect(sbX, y + thumbY, sbX + 4, y + thumbY + thumbH, ModernColors.SCROLLBAR_THUMB);
}
}
// ===== Interaction =====
@Override
public void updateScreen() {
super.updateScreen();
catSearchField.updateCursorCounter();
itemSearchField.updateCursorCounter();
}
@Override
public void mouseClicked(int mouseX, int mouseY, int button) {
super.mouseClicked(mouseX, mouseY, button);
// Check divider drag start
if (button == 0) {
int divX = guiLeft + dividerOffset;
if (mouseX >= divX && mouseX < divX + dividerWidth &&
mouseY >= listY && mouseY < listY + listHeight) {
isDraggingDivider = true;
dividerDragStartX = mouseX;
return;
}
}
// Check search field clicks
catSearchField.mouseClicked(mouseX, mouseY, button);
itemSearchField.mouseClicked(mouseX, mouseY, button);
// Check category list click
if (button == 0 && mouseX >= catListX && mouseX < catListX + catListW &&
mouseY >= listY && mouseY < listY + listHeight) {
int clickedIdx = (mouseY - listY + catScrollY) / rowHeight;
if (clickedIdx >= 0 && clickedIdx < filteredCategories.size()) {
selectedCatIndex = clickedIdx;
String catName = filteredCategories.get(clickedIdx);
selectedCategory = categoryData.get(catName);
selectedItem = null;
selectedItemIndex = -1;
itemScrollY = 0;
loadItemsForSelectedCategory();
}
}
// Check item list click
if (button == 0 && mouseX >= itemListX && mouseX < itemListX + itemListW &&
mouseY >= listY && mouseY < listY + listHeight) {
int clickedIdx = (mouseY - listY + itemScrollY) / rowHeight;
if (clickedIdx >= 0 && clickedIdx < filteredItems.size()) {
// Double-click detection
long now = System.currentTimeMillis();
if (clickedIdx == lastClickedIndex && now - lastClickTime < 400) {
// Double-click - confirm and close
confirm();
return;
}
lastClickedIndex = clickedIdx;
lastClickTime = now;
selectedItemIndex = clickedIdx;
String itemName = filteredItems.get(clickedIdx);
selectedItem = itemData.get(itemName);
}
}
// Check button clicks
if (doneBtn.mousePressed(mc, mouseX, mouseY)) {
confirm();
return;
}
if (cancelBtn.mousePressed(mc, mouseX, mouseY)) {
selectedItem = null;
close();
return;
}
}
@Override
public void mouseClickMove(int mouseX, int mouseY, int button, long timeSinceLastClick) {
if (isDraggingDivider) {
int dx = mouseX - dividerDragStartX;
dividerDragStartX = mouseX;
dividerOffset += dx;
// Enforce minimum widths
int pad = 8;
int minOffset = pad + minColumnWidth;
int maxOffset = xSize - pad - dividerWidth - minColumnWidth;
dividerOffset = Math.max(minOffset, Math.min(dividerOffset, maxOffset));
// Recalculate column widths
catListW = dividerOffset - pad;
itemListX = guiLeft + dividerOffset + dividerWidth;
itemListW = xSize - dividerOffset - dividerWidth - pad;
// Update search field widths
catSearchField.setBounds(catListX, catSearchField.getY(), catListW, 18);
itemSearchField.setBounds(itemListX, itemSearchField.getY(), itemListW, 18);
}
}
@Override
protected void mouseMovedOrUp(int mouseX, int mouseY, int state) {
isDraggingDivider = false;
super.mouseMovedOrUp(mouseX, mouseY, state);
}
@Override
public void handleMouseInput() {
super.handleMouseInput();
int delta = org.lwjgl.input.Mouse.getEventDWheel();
if (delta != 0) {
int mouseX = org.lwjgl.input.Mouse.getEventX() * width / mc.displayWidth;
int mouseY = height - org.lwjgl.input.Mouse.getEventY() * height / mc.displayHeight - 1;
int scrollAmount = delta > 0 ? -rowHeight * 2 : rowHeight * 2;
// Check which list is hovered
if (mouseX >= catListX && mouseX < catListX + catListW &&
mouseY >= listY && mouseY < listY + listHeight) {
int maxScroll = Math.max(0, filteredCategories.size() * rowHeight - listHeight);
catScrollY = Math.max(0, Math.min(catScrollY + scrollAmount, maxScroll));
}
if (mouseX >= itemListX && mouseX < itemListX + itemListW &&
mouseY >= listY && mouseY < listY + listHeight) {
int maxScroll = Math.max(0, filteredItems.size() * rowHeight - listHeight);
itemScrollY = Math.max(0, Math.min(itemScrollY + scrollAmount, maxScroll));
}
}
}
@Override
public void keyTyped(char typedChar, int keyCode) {
// Handle category search field
if (catSearchField.isFocused()) {
String prev = catSearchField.getText();
catSearchField.keyTyped(typedChar, keyCode);
String newText = catSearchField.getText();
if (!newText.equals(prev)) {
catSearch = newText;
updateCategoryList();
catScrollY = 0;
if (selectedCategory != null) {
selectedCatIndex = filteredCategories.indexOf(getCategoryTitle(selectedCategory));
}
}
}
// Handle item search field
if (itemSearchField.isFocused()) {
String prev = itemSearchField.getText();
itemSearchField.keyTyped(typedChar, keyCode);
String newText = itemSearchField.getText();
if (!newText.equals(prev)) {
itemSearch = newText;
updateItemList();
itemScrollY = 0;
if (selectedItem != null) {
selectedItemIndex = filteredItems.indexOf(getItemTitle(selectedItem));
}
}
}
// Handle ESC
super.keyTyped(typedChar, keyCode);
}
protected void confirm() {
close();
}
/**
* Get the selected item, or null if none selected.
*/
public I getSelectedItem() {
return selectedItem;
}
}
@@ -1,272 +0,0 @@
package kamkeel.npcs.client.gui.modern;
import kamkeel.npcs.client.gui.components.ModernButton;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.ModernColors;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.IResource;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
/**
* Modern styled color picker SubGui.
* Features color wheel selection, hex input field, and color preview swatch.
*/
public class ModernColorPicker extends ModernSubGuiInterface {
private static final ResourceLocation COLOR_WHEEL = new ResourceLocation("customnpcs:textures/gui/color.png");
// Current selected color (RGB without alpha)
public int color;
// Components
private GuiNpcTextField hexField;
private ModernButton doneBtn;
private ModernButton cancelBtn;
// Color wheel position
private int wheelX, wheelY;
private int wheelSize = 130; // Larger wheel
// Preview swatch position
private int previewX, previewY;
private int previewSize = 24; // Slightly smaller to fit better
// Button IDs
private static final int ID_DONE = 100;
private static final int ID_CANCEL = 101;
public ModernColorPicker(int initialColor) {
this.color = initialColor & 0xFFFFFF; // Strip alpha
xSize = 200; // Increased for comfortable layout
ySize = 250; // Increased for proper spacing between content and buttons
setHeaderTitle("Color Picker");
}
@Override
public void initGui() {
super.initGui();
// Calculate positions with more top padding
int contentY = getContentY() + 12;
int centerX = guiLeft + xSize / 2;
// Color wheel centered
wheelX = centerX - wheelSize / 2;
wheelY = contentY;
// Preview swatch and hex field below wheel with proper spacing
int fieldRowY = wheelY + wheelSize + 14;
previewX = guiLeft + 16; // Fixed left margin
previewY = fieldRowY;
// Hex field next to preview
hexField = new GuiNpcTextField(0, previewX + previewSize + 12, fieldRowY, 100, 18, getHexString());
hexField.setMaxStringLength(6);
// Buttons at bottom with proper margin
int btnY = guiTop + ySize - 32;
int btnWidth = 70; // Slightly wider buttons
int totalBtnWidth = btnWidth * 2 + 10;
int btnStartX = centerX - totalBtnWidth / 2;
cancelBtn = new ModernButton(ID_CANCEL, btnStartX, btnY, btnWidth, 20, "Cancel");
doneBtn = new ModernButton(ID_DONE, btnStartX + btnWidth + 10, btnY, btnWidth, 20, "Done");
// Use accent color for Done button
doneBtn.setBackgroundColor(ModernColors.ACCENT_BLUE);
}
@Override
protected void drawContent(int mouseX, int mouseY, float partialTicks) {
// Draw color wheel
mc.getTextureManager().bindTexture(COLOR_WHEEL);
GL11.glColor4f(1, 1, 1, 1);
drawTexturedModalRect(wheelX, wheelY, 0, 0, wheelSize, wheelSize);
// Draw preview swatch with border
drawRect(previewX - 1, previewY - 1, previewX + previewSize + 1, previewY + previewSize + 1, ModernColors.PANEL_BORDER);
drawRect(previewX, previewY, previewX + previewSize, previewY + previewSize, 0xFF000000 | color);
// Draw hex label
fontRendererObj.drawString("#", hexField.getX() - 10, hexField.getY() + 5, ModernColors.TEXT_LIGHT);
// Draw hex field
hexField.draw(mouseX, mouseY);
// Draw buttons
doneBtn.drawButton(mc, mouseX, mouseY);
cancelBtn.drawButton(mc, mouseX, mouseY);
}
@Override
public void updateScreen() {
super.updateScreen();
hexField.updateCursorCounter();
}
@Override
public void mouseClicked(int mouseX, int mouseY, int button) {
super.mouseClicked(mouseX, mouseY, button);
// Check hex field click
hexField.mouseClicked(mouseX, mouseY, button);
// Check color wheel click
if (button == 0 && isInsideWheel(mouseX, mouseY)) {
pickColorFromWheel(mouseX, mouseY);
}
// Check button clicks
if (doneBtn.mousePressed(mc, mouseX, mouseY)) {
close();
return;
}
if (cancelBtn.mousePressed(mc, mouseX, mouseY)) {
// Reset color to original? For now just close
close();
return;
}
}
@Override
protected void actionPerformed(GuiButton btn) {
super.actionPerformed(btn);
// Buttons handled in mouseClicked
}
@Override
public void keyTyped(char typedChar, int keyCode) {
// Handle hex field input
if (hexField.isFocused()) {
String prev = hexField.getText();
hexField.keyTyped(typedChar, keyCode);
String newText = hexField.getText();
// Only allow hex characters
if (!newText.equals(prev)) {
String filtered = filterHex(newText);
if (!filtered.equals(newText)) {
hexField.setText(filtered);
} else {
// Update color if valid
updateColorFromHex();
}
}
}
// Handle ESC
super.keyTyped(typedChar, keyCode);
}
/**
* Filter input to only allow hex characters.
*/
private String filterHex(String input) {
StringBuilder sb = new StringBuilder();
for (char c : input.toUpperCase().toCharArray()) {
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) {
sb.append(c);
}
}
return sb.toString();
}
/**
* Update color value from hex field text.
*/
private void updateColorFromHex() {
String hex = hexField.getText();
if (hex.isEmpty()) return;
try {
color = Integer.parseInt(hex, 16);
} catch (NumberFormatException e) {
// Invalid hex, ignore
}
}
/**
* Check if mouse is inside the color wheel area.
* Uses circular bounds for accurate detection.
*/
private boolean isInsideWheel(int mouseX, int mouseY) {
// First check rectangle bounds
if (mouseX < wheelX || mouseX >= wheelX + wheelSize ||
mouseY < wheelY || mouseY >= wheelY + wheelSize) {
return false;
}
// Then check circular bounds (wheel is circular)
int centerX = wheelX + wheelSize / 2;
int centerY = wheelY + wheelSize / 2;
int radius = wheelSize / 2;
int dx = mouseX - centerX;
int dy = mouseY - centerY;
return (dx * dx + dy * dy) <= (radius * radius);
}
/**
* Pick color from the wheel texture at clicked position.
* Uses the same 4x multiplier as the original SubGuiColorSelector
* since the texture is 480x480 and we display at variable size.
*/
private void pickColorFromWheel(int mouseX, int mouseY) {
InputStream stream = null;
try {
IResource resource = mc.getResourceManager().getResource(COLOR_WHEEL);
BufferedImage image = ImageIO.read(stream = resource.getInputStream());
// Calculate texture coordinates using the same ratio as original
// Original: draws 120x120, texture is 480x480, uses *4 multiplier
// We draw wheelSize x wheelSize, so scale proportionally
int texX = (mouseX - wheelX) * image.getWidth() / wheelSize;
int texY = (mouseY - wheelY) * image.getHeight() / wheelSize;
// Clamp to texture bounds
texX = Math.max(0, Math.min(texX, image.getWidth() - 1));
texY = Math.max(0, Math.min(texY, image.getHeight() - 1));
// Get pixel color, ignoring alpha and transparent pixels
int pixel = image.getRGB(texX, texY);
int alpha = (pixel >> 24) & 0xFF;
if (alpha > 0) {
color = pixel & 0xFFFFFF;
hexField.setText(getHexString());
}
} catch (IOException e) {
// Ignore errors
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
// Ignore
}
}
}
}
/**
* Get color as hex string (6 chars, uppercase).
*/
private String getHexString() {
String hex = Integer.toHexString(color).toUpperCase();
while (hex.length() < 6) {
hex = "0" + hex;
}
return hex;
}
/**
* Get the selected color.
*/
public int getColor() {
return color;
}
}
@@ -1,93 +0,0 @@
package kamkeel.npcs.client.gui.modern;
import noppes.npcs.controllers.DialogController;
import noppes.npcs.controllers.data.Dialog;
import noppes.npcs.controllers.data.DialogCategory;
/**
* Modern styled dialog selector SubGui.
* Features two-column layout (categories | dialogs) with draggable divider, search fields, and preview.
*/
public class ModernDialogSelector extends ModernCategorySelector<DialogCategory, Dialog> {
// Keep public field for backward compatibility
public Dialog selectedDialog;
public ModernDialogSelector(int dialogId) {
super();
setHeaderTitle("Select Dialog");
// Load dialog data
loadData();
// Find initial selection
if (dialogId > 0) {
selectedDialog = DialogController.Instance.dialogs.get(dialogId);
selectedItem = selectedDialog;
if (selectedDialog != null) {
selectedCategory = selectedDialog.category;
loadItemsForSelectedCategory();
}
}
}
@Override
protected void loadAllCategories() {
for (DialogCategory cat : DialogController.Instance.categories.values()) {
categoryData.put(cat.title, cat);
}
}
@Override
protected void loadItemsForCategory(DialogCategory category) {
if (category != null) {
for (Dialog d : category.dialogs.values()) {
itemData.put(d.title, d);
}
}
}
@Override
protected String getCategoryTitle(DialogCategory category) {
return category.title;
}
@Override
protected String getItemTitle(Dialog item) {
return item.title;
}
@Override
protected int getItemId(Dialog item) {
return item.id;
}
@Override
protected String getHeaderTitle() {
return "Select Dialog";
}
@Override
protected String getCategoryColumnTitle() {
return "Categories";
}
@Override
protected String getItemColumnTitle() {
return "Dialogs";
}
@Override
protected void confirm() {
// Sync with backward-compatible public field
selectedDialog = selectedItem;
super.confirm();
}
/**
* Get the selected dialog, or null if none selected.
*/
public Dialog getSelectedDialog() {
return selectedItem;
}
}
@@ -1,305 +0,0 @@
package kamkeel.npcs.client.gui.modern;
import kamkeel.npcs.client.gui.components.ModernButton;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.ModernColors;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import noppes.npcs.controllers.FactionController;
import noppes.npcs.controllers.data.Faction;
import org.lwjgl.opengl.GL11;
import java.util.*;
/**
* Modern styled faction selector SubGui.
* Features single-column layout with search field.
*/
public class ModernFactionSelector extends ModernSubGuiInterface {
// Selected value
public Faction selectedFaction;
// Data map
private HashMap<String, Faction> factionData = new HashMap<>();
// List for display
private List<String> filteredFactions = new ArrayList<>();
// Components
private GuiNpcTextField searchField;
private ModernButton doneBtn;
private ModernButton cancelBtn;
// Scroll state
private int scrollY = 0;
private int selectedIndex = -1;
// Layout
private int listX, listY;
private int listWidth, listHeight;
private int rowHeight = 16; // Slightly taller rows for faction color indicator
// Search string
private String searchText = "";
// Button IDs
private static final int ID_DONE = 100;
private static final int ID_CANCEL = 101;
// Double-click tracking
private long lastClickTime = 0;
private int lastClickedIndex = -1;
public ModernFactionSelector(int factionId) {
xSize = 280;
ySize = 260;
setHeaderTitle("Select Faction");
// Load faction data
loadData();
// Find initial selection
if (factionId >= 0) {
selectedFaction = FactionController.getInstance().factions.get(factionId);
}
}
private void loadData() {
factionData.clear();
for (Faction faction : FactionController.getInstance().factions.values()) {
factionData.put(faction.name, faction);
}
filteredFactions = new ArrayList<>(factionData.keySet());
Collections.sort(filteredFactions);
}
@Override
public void initGui() {
super.initGui();
int contentY = getContentY() + 6;
int contentH = getContentHeight() - 6;
int pad = 8;
listX = guiLeft + pad;
listWidth = xSize - pad * 2;
// Search field at top
int searchH = 18;
searchField = new GuiNpcTextField(0, listX, contentY, listWidth, searchH, searchText);
// List area below search
listY = contentY + searchH + 4;
listHeight = contentH - searchH - 36 - 8;
// Buttons at bottom
int btnY = guiTop + ySize - 32;
int btnWidth = 60;
int btnGap = 8;
cancelBtn = new ModernButton(ID_CANCEL, guiLeft + xSize - pad - btnWidth * 2 - btnGap, btnY, btnWidth, 20, "Cancel");
doneBtn = new ModernButton(ID_DONE, guiLeft + xSize - pad - btnWidth, btnY, btnWidth, 20, "Done");
doneBtn.setBackgroundColor(ModernColors.ACCENT_BLUE);
// Set initial selection index
if (selectedFaction != null) {
selectedIndex = filteredFactions.indexOf(selectedFaction.name);
}
}
private void updateList() {
if (searchText.isEmpty()) {
filteredFactions = new ArrayList<>(factionData.keySet());
} else {
filteredFactions = new ArrayList<>();
String searchLower = searchText.toLowerCase();
for (String name : factionData.keySet()) {
if (name.toLowerCase().contains(searchLower)) {
filteredFactions.add(name);
}
}
}
Collections.sort(filteredFactions);
}
@Override
protected void drawContent(int mouseX, int mouseY, float partialTicks) {
// Draw search field
searchField.draw(mouseX, mouseY);
// Draw list background
drawRect(listX, listY, listX + listWidth, listY + listHeight, ModernColors.INPUT_BG);
// Draw faction list
drawFactionList(mouseX, mouseY);
// Draw selected faction info
if (selectedFaction != null) {
String info = "Selected: " + selectedFaction.name + " (ID: " + selectedFaction.id + ")";
int infoY = listY + listHeight + 4;
fontRendererObj.drawString(info, guiLeft + 8, infoY, ModernColors.TEXT_GRAY);
}
// Draw buttons
doneBtn.drawButton(mc, mouseX, mouseY);
cancelBtn.drawButton(mc, mouseX, mouseY);
}
private void drawFactionList(int mouseX, int mouseY) {
// Set up scissor
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
int scale = sr.getScaleFactor();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor(listX * scale, mc.displayHeight - (listY + listHeight) * scale, listWidth * scale, listHeight * scale);
int visibleRows = listHeight / rowHeight;
int startIdx = scrollY / rowHeight;
int endIdx = Math.min(startIdx + visibleRows + 2, filteredFactions.size());
for (int i = startIdx; i < endIdx; i++) {
int rowY = listY + i * rowHeight - scrollY;
if (rowY + rowHeight < listY || rowY > listY + listHeight) continue;
String factionName = filteredFactions.get(i);
Faction faction = factionData.get(factionName);
// Draw selection background
if (i == selectedIndex) {
drawRect(listX, rowY, listX + listWidth, rowY + rowHeight, ModernColors.SELECTION_BG);
} else {
// Hover highlight
if (mouseX >= listX && mouseX < listX + listWidth && mouseY >= rowY && mouseY < rowY + rowHeight) {
drawRect(listX, rowY, listX + listWidth, rowY + rowHeight, ModernColors.HOVER_HIGHLIGHT);
}
}
// Draw faction color indicator
int colorBoxX = listX + 4;
int colorBoxY = rowY + 2;
int colorBoxSize = rowHeight - 4;
if (faction != null) {
drawRect(colorBoxX, colorBoxY, colorBoxX + colorBoxSize, colorBoxY + colorBoxSize, 0xFF000000 | faction.color);
}
// Draw text
String displayText = fontRendererObj.trimStringToWidth(factionName, listWidth - colorBoxSize - 12);
int textColor = i == selectedIndex ? ModernColors.TEXT_WHITE : ModernColors.TEXT_LIGHT;
fontRendererObj.drawString(displayText, colorBoxX + colorBoxSize + 4, rowY + 3, textColor);
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
// Draw scrollbar if needed
int totalHeight = filteredFactions.size() * rowHeight;
if (totalHeight > listHeight) {
int sbX = listX + listWidth - 4;
float viewRatio = (float) listHeight / totalHeight;
int thumbH = Math.max(10, (int) (listHeight * viewRatio));
float maxScroll = totalHeight - listHeight;
int thumbY = maxScroll > 0 ? (int) ((scrollY / maxScroll) * (listHeight - thumbH)) : 0;
drawRect(sbX, listY, sbX + 4, listY + listHeight, ModernColors.SCROLLBAR_BG);
drawRect(sbX, listY + thumbY, sbX + 4, listY + thumbY + thumbH, ModernColors.SCROLLBAR_THUMB);
}
}
@Override
public void updateScreen() {
super.updateScreen();
searchField.updateCursorCounter();
}
@Override
public void mouseClicked(int mouseX, int mouseY, int button) {
super.mouseClicked(mouseX, mouseY, button);
// Check search field click
searchField.mouseClicked(mouseX, mouseY, button);
// Check list click
if (button == 0 && mouseX >= listX && mouseX < listX + listWidth &&
mouseY >= listY && mouseY < listY + listHeight) {
int clickedIdx = (mouseY - listY + scrollY) / rowHeight;
if (clickedIdx >= 0 && clickedIdx < filteredFactions.size()) {
// Double-click detection
long now = System.currentTimeMillis();
if (clickedIdx == lastClickedIndex && now - lastClickTime < 400) {
// Double-click - confirm and close
confirm();
return;
}
lastClickedIndex = clickedIdx;
lastClickTime = now;
selectedIndex = clickedIdx;
String factionName = filteredFactions.get(clickedIdx);
selectedFaction = factionData.get(factionName);
}
}
// Check button clicks
if (doneBtn.mousePressed(mc, mouseX, mouseY)) {
confirm();
return;
}
if (cancelBtn.mousePressed(mc, mouseX, mouseY)) {
selectedFaction = null;
close();
return;
}
}
@Override
public void handleMouseInput() {
super.handleMouseInput();
int delta = org.lwjgl.input.Mouse.getEventDWheel();
if (delta != 0) {
int mouseX = org.lwjgl.input.Mouse.getEventX() * width / mc.displayWidth;
int mouseY = height - org.lwjgl.input.Mouse.getEventY() * height / mc.displayHeight - 1;
// Check if mouse is over list
if (mouseX >= listX && mouseX < listX + listWidth &&
mouseY >= listY && mouseY < listY + listHeight) {
int scrollAmount = delta > 0 ? -rowHeight * 2 : rowHeight * 2;
int maxScroll = Math.max(0, filteredFactions.size() * rowHeight - listHeight);
scrollY = Math.max(0, Math.min(scrollY + scrollAmount, maxScroll));
}
}
}
@Override
public void keyTyped(char typedChar, int keyCode) {
// Handle search field
if (searchField.isFocused()) {
String prev = searchField.getText();
searchField.keyTyped(typedChar, keyCode);
String newText = searchField.getText();
if (!newText.equals(prev)) {
searchText = newText;
updateList();
scrollY = 0;
if (selectedFaction != null) {
selectedIndex = filteredFactions.indexOf(selectedFaction.name);
}
}
}
// Handle ESC
super.keyTyped(typedChar, keyCode);
}
private void confirm() {
close();
}
/**
* Get the selected faction, or null if none selected.
*/
public Faction getSelectedFaction() {
return selectedFaction;
}
}
Loaded 100 of 774 files, more files were not shown because too many files have changed in this diff. Show more