Compare commits

...
161 Commits
Author SHA1 Message Date
Kam 1b36c23d66 ok 2023-06-06 18:40:12 -04:00
KAMKEEL 39b7f805b3 Original CNPC Branch 2022-02-05 18:02:35 -05:00
KAMKEEL 6d6daeb345 Update build.gradle 2022-02-02 19:26:24 -05:00
KAMKEEL 3844a26e8b Merge branch 'dev' 2022-02-02 19:25:29 -05:00
KAMKEEL 2a4ace286e Quick Patch 2022-02-02 19:25:17 -05:00
Kamron Vaswani 79ef0e07a1 Merge pull request #33 from c0508383/master
Removed println statement please forgive me oh god
2022-02-02 19:22:35 -05:00
luisc 7e0ff3c836 Removed println statement please forgive me oh god 2022-02-02 18:21:08 -06:00
KAMKEEL e3e55e4256 Merge branch 'dev' 2022-02-02 17:44:46 -05:00
KAMKEEL 0c4ead5752 Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2022-02-02 16:20:17 -05:00
KAMKEEL 5d39c5b356 Fixed Disable Block Error 2022-02-02 16:20:11 -05:00
Kamron Vaswani 19ccdd60d2 Merge pull request #32 from c0508383/master
Bug fixes & GUI rotations
2022-02-02 15:43:23 -05:00
luisc d3145f4868 Added config for how often a player's quests are checked for completion. 2022-02-02 07:53:42 -06:00
luisc 70536de655 Removed checkQuestCompleted from ScriptPlayer, now redundant with new quest checks that happen periodically. 2022-02-02 07:21:45 -06:00
luisc 1ebf747302 Optimized NBT access of player data when checking quest completion, player data variable is passed down to lower functions.
Player's quests are checked for completion every couple seconds now.
2022-02-02 07:18:33 -06:00
luisc 632e92f82e Added set/getPitch to ScriptEntity 2022-02-01 05:10:38 -06:00
luisc 90ca1a0200 Added isAirborne() function to ScriptEntity 2022-02-01 02:30:50 -06:00
luisc 9109c134c1 Added more general setMotion function with x y and z parameters. 2022-01-31 23:59:15 -06:00
luisc 1af875aea9 Fixed concurrent modification bug with NPC tasks. 2022-01-31 23:01:52 -06:00
luisc 7de585843d Added get/setHunger, and get/setSaturation functions for ScriptPlayer.
The player KeyPressed event now sends a list of keys that are currently pressed by the player.
2022-01-31 20:16:00 -06:00
luisc 67c83b1ce9 Added rotation for custom GUI lines, labels, and textured rectangles 2022-01-31 15:39:21 -06:00
Kamron Vaswani bc54e8cd7b Merge pull request #31 from c0508383/master
Increased NPC Inventory & Other Additions.
2022-01-31 16:27:15 -05:00
Kamron Vaswani 8675d22ebb Merge pull request #30 from PewDizinho/patch-1
Update README.md
2022-01-31 16:27:01 -05:00
luisc 83e13285f9 Added rotation to overlay components, and color codes to overlay labels 2022-01-31 14:51:06 -06:00
luisc 3be088c4cc Moved OpenGL lines to within the loop that renders each component, fixing some weird alpha errors. 2022-01-30 22:58:12 -06:00
luisc 54fadbe63f Implemented label, alpha, and formatting for Custom GUI labels. 2022-01-30 22:49:03 -06:00
luisc da3b04e78e Implemented MC chat formatting for color codes: &l, &m, &r, &o, and &k all affect overlay labels. 2022-01-30 22:41:55 -06:00
luisc e7a19264b2 Added alpha and style options for overlay labels. 2022-01-30 14:22:29 -06:00
luisc 966ab4bf72 Custom Overlays and GUIs now properly set alpha values for some components. 2022-01-30 13:29:00 -06:00
luisc e5e1aa1972 Made color and alpha components global among ScriptGui classes. 2022-01-30 05:20:45 -06:00
luisc be61bd4e17 Made color and alpha components global among ScriptOverlay classes. 2022-01-30 04:33:00 -06:00
luisc 534f716991 Implemented Scripted Overlays which stay on the player's screen. Overlays persist in the client, and can be removed from the screen as well. 2022-01-30 04:05:01 -06:00
luisc 8b24dad211 Added Custom GUI Lines, with configurable thickness & color. Draws a line between one point defined by (x1,y1), and another defined by (x2,y2) 2022-01-28 03:21:00 -06:00
PewDizinho 6974476d92 Update README.md 2022-01-27 14:36:20 -03:00
luisc fcaafe4b26 Fixed NBT issue with the new quest kill amounts. 2022-01-27 06:14:03 -06:00
luisc f876f13d77 Added 9 more slots for quest kill objectives, and an option for kill quests to progress only if a player kills an NPC with that name.
Added quest interface support to get and modify data from specific quest types.
2022-01-27 05:40:51 -06:00
luisc 989effb5c5 Added more a full inventory to NPCs, selectable on two tabs and double-point values for NPC droprates. 2022-01-27 03:50:36 -06:00
luisc f14337f1bb Added config for NPC sizes, default 100. 2022-01-25 14:54:15 -06:00
luisc eb45a6a959 Added several more dialog functions for the rest of the dialog options. 2022-01-25 14:44:24 -06:00
Kamron Vaswani a04f023d53 Merge pull request #28 from c0508383/master
Custom GUI fixes
2022-01-24 01:06:56 -05:00
luisc 092b3ce0c1 Fixed overloaded hurt(damage,entity) function not working when an entity is to be hurt by a player 2022-01-22 22:50:01 -06:00
KAMKEEL 971010bda8 Darken Screen Dialog Fix 2022-01-21 18:31:32 -05:00
luisc 06c730b166 Fixed scale & color issues for custom GUI textured rectangles. 2022-01-21 01:15:21 -06:00
luisc b9bc1e5ed7 Merge remote-tracking branch 'origin/master' 2022-01-20 20:27:39 -06:00
luisc 83756381e4 Added toggleable shadows and scaling to custom GUI labels. 2022-01-20 20:27:26 -06:00
Luis C.M 52f342302c Merge branch 'KAMKEEL:master' into master 2022-01-20 16:32:16 -06:00
luisc 0788b2750f Quick fix for custom GUI textured rectangles, now with working x and y offsets. 2022-01-20 00:15:21 -06:00
KAMKEEL 8a9defd3a1 Part Data Texture Fix for Upgrading from CNPC
Issue where already saved NPCs cannot locate texture if upgrading from CNPC to CNPC+
2022-01-19 18:21:12 -05:00
KAMKEEL dff71c5a98 Update 1.5-beta
💯
Starting new version
2022-01-18 00:20:50 -05:00
Kamron Vaswani cb72f6c50e Merge pull request #26 from c0508383/master
Compatibility fix pt.2
2022-01-15 23:54:55 -05:00
luisc dd22f604cc Compatibility fix for mods that initialize player or worldobj fields as null. 2022-01-15 22:52:27 -06:00
Kamron Vaswani 05e6a97721 Merge pull request #25 from c0508383/master
Compatibility fix for mods that initialize player or worldobj fields as null.
2022-01-15 23:50:33 -05:00
luisc f8a6fe3d75 Compatibility fix for mods that initialize player or worldobj fields as null. 2022-01-15 22:49:07 -06:00
KAMKEEL f9ab885ddd Update Version 1.4.2
Fixed Faction Dupe Glitch
Fixed Darken Screen not saving
2022-01-15 16:51:46 -05:00
Kamron Vaswani e0f77bdcff Merge pull request #24 from c0508383/master
Fixed a faction duplication glitch
2022-01-15 16:50:07 -05:00
luisc 6ff2678f26 Fixed a faction duplication glitch 2022-01-15 15:14:55 -06:00
KAMKEEL a1a0864692 Wrong Button ID Darken Screen 2022-01-15 15:24:37 -05:00
KAMKEEL b3098053ec Fixing Dark Screen not savning 2022-01-15 15:21:20 -05:00
KAMKEEL 2155566113 Hotfix 2022-01-15 04:45:51 -05:00
Kamron Vaswani 9d88da30cf Merge pull request #23 from c0508383/master
Hotfix to Custom GUI Labels for servers
2022-01-15 04:22:33 -05:00
luisc 24e8648a1d Merge remote-tracking branch 'origin/master' 2022-01-15 03:16:37 -06:00
luisc e1c283a19e Hotfix to Custom GUI labels for servers 2022-01-15 03:16:22 -06:00
Kamron Vaswani aba9dd250a Merge pull request #22 from c0508383/master
Added collision options for CNPCs.
2022-01-14 21:51:16 -05:00
KAMKEEL f508fbed1a 1.4
Fix Decimal Display
2022-01-14 21:48:15 -05:00
luisc 007660f16f Added collision options for CNPCs. 2022-01-14 19:07:41 -06:00
Kamron Vaswani e10aa09728 Merge pull request #21 from c0508383/master
Custom GUI slot fix & Custom Particle fix
2022-01-14 19:11:15 -05:00
luisc 4f38edc147 Limited config NpcNavRange to 96. Added darken screen option to dialogs. 2022-01-14 17:37:09 -06:00
luisc 6a6548845b Fixed textfield focus event running when textfield is unfocused 2022-01-14 16:50:13 -06:00
luisc 0aef0827ec Fixed scripted particles not spawning on some NPCs. Custom particle packets are now sent to all players. 2022-01-14 16:39:24 -06:00
luisc 791adfc1b4 Implemented textfield unfocused event 2022-01-14 16:09:27 -06:00
luisc 2874643c84 Fixed textured rectangles in custom GUIs not being placed relative to the GUIs' position. 2022-01-14 15:41:27 -06:00
luisc b0da137db5 Custom GUI slot fix 2022-01-14 15:06:25 -06:00
luisc c28a9156d5 Custom GUI slot fix 2022-01-14 15:06:04 -06:00
Kamron Vaswani 4ba6f3086f Merge pull request #20 from c0508383/master
Flight Fix and API update
2022-01-13 20:31:09 -05:00
luisc 555ceb741f Added a modifiable and toggleable flying height limit to NPCs 2022-01-13 05:28:20 -06:00
luisc 04def38b63 Added dialog events to scripted player events 2022-01-12 22:59:03 -06:00
luisc b024f800ae Added quest start, complete, and turnin events, and a faction points event to scripted player events. 2022-01-12 20:12:16 -06:00
luisc 8919a182c5 Added removeTags() function to ScriptItemStack and isCustomGUI function to ScriptContainer 2022-01-12 04:54:07 -06:00
luisc 6b9cfb9d25 Implemented custom GUIs. 2022-01-12 04:44:08 -06:00
luisc d50f51e208 Added handler support to NPC API. 2022-01-10 15:21:48 -06:00
luisc 69f96519dc Fixed forge events registering twice. 2022-01-10 12:37:26 -06:00
luisc 7808e4a433 getTag() and hasTag() functions from ScriptItemStack no longer write the item stack NBT tag on call. 2022-01-09 17:50:36 -06:00
luisc d74a1f2bee Added ScriptBlockPos functionality with get/setPos to ScriptEntity 2022-01-04 03:50:50 -06:00
luisc c3541df1dc Fix to getFormLevel() in ScriptDBCPlayer 2022-01-04 00:06:48 -06:00
luisc 32792e7d6f Added updateClient() function to ScriptNpc. 2022-01-03 21:30:38 -06:00
luisc 73db2da124 Fixed flying not working in small enclosed spaces. 2022-01-03 15:50:31 -06:00
luisc 6459e7fe2a Added solid render option for bodywear. 2022-01-02 18:13:01 -06:00
luisc a32db79a0b Added solid render option for bodywear 2021-12-30 08:27:04 -06:00
luisc de5f119fd7 Added setJob and setRole functions to ScriptNpc 2021-12-29 22:34:51 -06:00
luisc b330678104 Added several projectile functions to ScriptNpc. 2021-12-29 17:17:06 -06:00
luisc e6f97784ff Added get/setRotationType to ScriptNpc. Added get/setMotion for x, y, z components to ScriptEntity. Fixed an NPC wand crash. 2021-12-29 16:22:05 -06:00
luisc e676c808e3 Fixed getFormLevel not working when player form NBT is "pty". ScriptBlock now correctly sets its tile field, allowing players to access blocks as chests, crates, etc. 2021-12-26 21:08:35 -06:00
luisc e5edbe002e Registered forge events on both MinecraftForge.EVENT_BUS and FMLCommonHandler.instance().bus(). 2021-12-23 10:26:46 -06:00
luisc ce9b9fb59d Merge remote-tracking branch 'origin/master' 2021-12-22 03:34:06 -06:00
luisc c8f6a24baf Added command forge event 2021-12-22 03:33:50 -06:00
luisc 2743fa17d8 Added command forge event 2021-12-22 03:30:01 -06:00
KAMKEEL 5409e4e924 Beta 1.4 2021-12-21 23:57:35 -05:00
KAMKEEL 6573970840 Update build.gradle 2021-12-21 23:55:10 -05:00
KAMKEEL efdd1d6679 Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2021-12-21 23:52:54 -05:00
KAMKEEL 4cca8e562c Update Build Gradle 2021-12-21 23:51:36 -05:00
Kamron Vaswani 4c31236590 Merge pull request #18 from c0508383/master
December Pull Request
2021-12-21 23:51:07 -05:00
Kamron Vaswani b62149d5f6 Merge branch 'dev' into master 2021-12-21 23:50:51 -05:00
luisc ff810cbc8d Full console output is now shown again for script errors. 2021-12-20 17:03:54 -06:00
luisc 69d4fb20ff Modified client and server packet sending a little bit for player and forge scripts. 2021-12-20 16:57:05 -06:00
luisc 953f6e0459 Fixed server-side lag caused by player events. THIS IS BIG. 2021-12-18 08:34:30 -06:00
luisc 1a78b2dad7 Timers are only updated if a timer exists for a player. 2021-12-17 17:30:50 -06:00
luisc d46d0aba7e Player events and Forge events run in their own separate buses without redundant registering. 2021-12-17 15:14:52 -06:00
luisc 03ee733620 Forge tick events only run if they are in the starting phase. 2021-12-17 14:26:52 -06:00
luisc 7d94e0e210 Removed forge chunk and terrain gen events. 2021-12-17 08:25:02 -06:00
luisc f03516b00f Fixed console and console spam with scripted player events. 2021-12-17 08:10:21 -06:00
luisc 23384d1d67 Fixed some server-side lag caused by player events. Player ticks now execute every 10 MC ticks. 2021-12-16 21:54:05 -06:00
luisc 6bdc68337c Revert "Made player script implementation closer to that of 1.12."
This reverts commit 3a9789b3fd.
2021-12-16 04:05:05 -06:00
luisc 3a9789b3fd Made player script implementation closer to that of 1.12. 2021-12-16 02:53:17 -06:00
luisc 69b7a9aab4 Fixed errors in remove and clear functions for bonusAttribute in ScriptDBCPlayer 2021-12-15 06:46:27 -06:00
luisc 9d9c481bdd Added alternative bonusAttribute function for just get remove and clear, as well as dedicated functions for all bonus attribute functions. 2021-12-15 06:19:16 -06:00
luisc 98d2d943ae Added bonusAttribute function, which works the same as the command. 2021-12-15 05:43:07 -06:00
luisc e9a4471cd2 Added getSkills and setSkills functions to ScriptDBCPlayer 2021-12-15 03:19:34 -06:00
luisc 934d5a69d6 Added getFormLevel and setFormLevel to ScriptDBCPlayer 2021-12-15 03:14:48 -06:00
luisc 12cb6a2937 Added blocking() function to ScriptPlayer to check whether the player is blocking. 2021-12-15 00:02:27 -06:00
luisc cad275e845 Added isBlocking, set/getHairCode, set/getExtraCode, and getInventory functions to ScriptDBCPlayer 2021-12-14 21:41:57 -06:00
luisc 816445bccd Script error output shortened to just the error description and line number. 2021-12-13 22:51:33 -06:00
luisc cf91d8638f Fixed getDBCPlayer not returning a DBC Player instance. 2021-12-13 18:33:20 -06:00
luisc 03395ad750 Added getWorld() function to ScriptEntity. 2021-12-13 16:47:15 -06:00
luisc f2da93451f Re-added hasEnchant, addEnchant, setAttribute, getAttribute, hasAttribute, getLore, and setLore to ScriptItemStack after they were lost in a commit A LONG TIME AGO 2021-12-13 03:11:24 -06:00
luisc 00557df9a7 Fixed players being able to push NPCs around. 2021-12-13 00:16:06 -06:00
luisc 541958b630 Fixed "world" keyword in for NPC scripting and API.getIWorld not returning the same instance. 2021-12-12 23:43:44 -06:00
luisc eac3d2c214 Added getSpeed() and setSpeed(speed) functions to ScriptNpc 2021-12-12 23:10:55 -06:00
luisc ba0f21dc26 Revert "Added npc.setPoweredTexture(directory) and npc.getPoweredTexture() functions, along with a new powered texture resource."
This reverts commit ba4bf107b5.
2021-12-11 08:41:54 -06:00
luisc 743cdb9db7 Revert "Fixed powered texture not showing up when changing NPC model attributes."
This reverts commit 9560228ba8.
2021-12-11 08:38:38 -06:00
luisc fc1c16032f Added RGB and alpha powered texture modifiers:
setPoweredRGBA(r,g,b,alpha)
getPoweredR(),getPoweredG(),getPoweredB(),getPoweredAlpha()
2021-12-10 00:08:47 -06:00
luisc b7d2dab905 Added parameters for texture translation when the NPC is powered, namely npc.display.poweredTranslateX, poweredTranslateY, and poweredTranslateZ, which can all be changed by setPoweredXYZ(x,y,z), and gotten with getPoweredX(), getPoweredY(), and getPoweredZ(). 2021-12-09 23:37:04 -06:00
luisc 9560228ba8 Fixed powered texture not showing up when changing NPC model attributes. 2021-12-09 23:24:36 -06:00
luisc ba4bf107b5 Added npc.setPoweredTexture(directory) and npc.getPoweredTexture() functions, along with a new powered texture resource.
Sample code:
npc.setPoweredTexture("customnpcs:textures/entity/npc_armor.png");
2021-12-08 23:29:08 -06:00
luisc 81881e6e19 Reset aggro range to Integer.MAX_VALUE. Sustainable aggro ranges seem to correlate to client/server RAM, and people should decide what max range is suitable for their client/server. 2021-12-08 20:52:39 -06:00
luisc 909f69575a Set max aggro range to 100. 2021-12-08 20:46:02 -06:00
luisc 34f6f670eb Y velocity when calling entity.knockback() is no longer decreased drastically. 2021-12-08 17:48:35 -06:00
luisc 8c602c4d16 Adjusted floating: NPCs don't float when they're knocked back or hurt. 2021-12-08 17:43:27 -06:00
luisc d66f532643 Made entity field in FlyingMoveHelper final 2021-12-08 15:50:58 -06:00
luisc d37e986006 Fixed NPCs bobbing in the air when flying. 2021-12-08 15:34:41 -06:00
luisc 29db4bfe33 Fixed flying aggro range now working for larger aggro ranges 2021-12-08 06:25:28 -06:00
luisc 90eec7a57b Added GUI fields for setting flying properties of NPCs. Updated en_lang file to add GUI texts. 2021-12-08 05:26:32 -06:00
luisc 94c7df410b Added fly gravity for NPCs, configurable with npc.setFlyGravity(gravity) and npc.getFlyGravity() 2021-12-08 04:50:23 -06:00
luisc c2564de470 NPCs properly stay floating when not navigating and in the air. 2021-12-08 04:41:41 -06:00
luisc 2147bd00d0 Pathing classes for NPC flying added. NPCs can now follow tactical variants while flying, and their pathing is a LOT better. 2021-12-08 04:00:28 -06:00
luisc 922708bf97 Changed npc field in ScriptNpc to EntityNPCInterface 2021-12-07 23:52:57 -06:00
luisc 43b3241801 Implemented path navigator and move helper for flying NPCs (npc.getNavigator() and npc.getMoveHelper() used to return the default navigator and move helper, added override function).
Improved Flying AI getting stuck when trying to get over a block towards the enemy.
2021-12-07 03:57:57 -06:00
luisc 12333de3a1 knockback() function for ScriptEntity now *only* knocks the entity back instead of hitting it.
Flying NPC's get knocked back properly, and their vertical speed has been increased.

Flying NPC's vertical flying speed can be changed by npc.setFlySpeed(double speed) from ScriptNpc.
2021-12-06 00:10:10 -06:00
luisc 3cd1410c19 Added new ScriptDBCPlayer class for manipulating Dragon Block C attributes.
Flying NPCs no longer chase you down if you're dead, or if they're dead.
2021-12-05 15:04:03 -06:00
luisc 3c1bc30e44 Floor values are set for max health, combat regen, health regen, melee damage, and projectile damage when changing them now. 2021-12-04 12:46:53 -06:00
luisc cd5b4c0633 Removed shadow when rendering an NPC that shouldn't be visible to a specific player after using setVisibleTo(). 2021-12-03 21:54:13 -06:00
luisc f14bc107d3 Double clicking events in the hook list will now paste them into your code. More scripting functions added for NPCs. 2021-12-03 21:13:56 -06:00
luisc 547f5ab82d Container event spam when no container is open fixed. Fixed scripted player and forge events not launching after merging ScriptContainer and EventScriptContainer. 2021-12-03 18:17:52 -06:00
luisc 23686dc3b8 Enabled fly button in movement, and extended max values for several NPC attributes, converting some to floats and doubles.
NPCs fly with speed based on their movement speed now.
2021-12-03 00:49:10 -06:00
luisc 44d4e74279 Enabled fly button in movement, and set max value for fields as Integer.MAX_VALUE for various fields. 2021-12-01 18:46:48 -06:00
luisc 17eb612fb8 Fixed NPC Script GUI error not saving/accessing scripts correctly. 2021-12-01 17:42:48 -06:00
luisc 72869e6a78 Consolidated EventScriptContainer and ScriptContainer into a single ScriptContainer class. NPCs are now able to fly when ai.movementType == 1. 2021-12-01 15:31:05 -06:00
KAMKEEL e8dd3e7ddc V 1.3.2
This is just a small change to the way the
pedestal works.
2021-11-29 23:15:42 -05:00
KAMKEEL 3dd8a60702 Version Update 2021-11-29 22:28:54 -05:00
KAMKEEL 71c81bce27 Merge branch 'dev' 2021-11-29 22:26:48 -05:00
Kamron Vaswani f39ed1fd37 Merge pull request #15 from c0508383/master
Critical fix to NBT loading when loading entities into chunks from a …
2021-11-29 22:26:22 -05:00
luisc f3ebf86b1e Critical fix to NBT loading when loading entities into chunks from a different version. 2021-11-29 21:21:49 -06:00
KAMKEEL f64399e40d Create Scripting_Documentation.pdf 2021-11-28 23:48:16 -05:00
1094 changed files with 1257 additions and 27415 deletions

No files matched your search

-86
View File
@@ -1,86 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="CustomNPC-Plus-1.21" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="com.yourname.modid" external.system.module.version="1.2.1" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/api/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/api/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: :forgeSrc:1.7.10-10.13.4.1614-1.7.10" level="project" />
<orderEntry type="library" name="Gradle: net.minecraft:launchwrapper:1.12" level="project" />
<orderEntry type="library" name="Gradle: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" name="Gradle: org.ow2.asm:asm-debug-all:5.0.3" level="project" />
<orderEntry type="library" name="Gradle: com.typesafe.akka:akka-actor_2.11:2.3.3" level="project" />
<orderEntry type="library" name="Gradle: com.typesafe:config:1.2.1" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang:scala-actors-migration_2.11:1.1.0" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang:scala-compiler:2.11.1" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang:scala-library:2.11.1" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang:scala-parser-combinators_2.11:1.0.1" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang:scala-reflect:2.11.1" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang:scala-swing_2.11:1.0.1" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang:scala-xml_2.11:1.0.2" level="project" />
<orderEntry type="library" name="Gradle: net.sf.jopt-simple:jopt-simple:4.5" level="project" />
<orderEntry type="library" name="Gradle: lzma:lzma:0.0.1" level="project" />
<orderEntry type="library" name="Gradle: com.mojang:realms:1.3.5" level="project" />
<orderEntry type="library" name="Gradle: org.apache.commons:commons-compress:1.8.1" level="project" />
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpclient:4.3.3" level="project" />
<orderEntry type="library" name="Gradle: commons-logging:commons-logging:1.1.3" level="project" />
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:4.3.2" level="project" />
<orderEntry type="library" name="Gradle: java3d:vecmath:1.3.1" level="project" />
<orderEntry type="library" name="Gradle: net.sf.trove4j:trove4j:3.0.3" level="project" />
<orderEntry type="library" name="Gradle: com.ibm.icu:icu4j-core-mojang:51.2" level="project" />
<orderEntry type="library" name="Gradle: com.paulscode:codecjorbis:20101023" level="project" />
<orderEntry type="library" name="Gradle: com.paulscode:codecwav:20101023" level="project" />
<orderEntry type="library" name="Gradle: com.paulscode:libraryjavasound:20101123" level="project" />
<orderEntry type="library" name="Gradle: com.paulscode:librarylwjglopenal:20100824" level="project" />
<orderEntry type="library" name="Gradle: com.paulscode:soundsystem:20120107" level="project" />
<orderEntry type="library" name="Gradle: io.netty:netty-all:4.0.10.Final" level="project" />
<orderEntry type="library" name="Gradle: com.google.guava:guava:17.0" level="project" />
<orderEntry type="library" name="Gradle: org.apache.commons:commons-lang3:3.3.2" level="project" />
<orderEntry type="library" name="Gradle: commons-io:commons-io:2.4" level="project" />
<orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.9" level="project" />
<orderEntry type="library" name="Gradle: net.java.jinput:jinput:2.0.5" level="project" />
<orderEntry type="library" name="Gradle: net.java.jutils:jutils:1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.google.code.gson:gson:2.2.4" level="project" />
<orderEntry type="library" name="Gradle: com.mojang:authlib:1.5.16" level="project" />
<orderEntry type="library" name="Gradle: org.apache.logging.log4j:log4j-api:2.0-beta9" level="project" />
<orderEntry type="library" name="Gradle: org.apache.logging.log4j:log4j-core:2.0-beta9" level="project" />
<orderEntry type="library" name="Gradle: org.lwjgl.lwjgl:lwjgl:2.9.1" level="project" />
<orderEntry type="library" name="Gradle: org.lwjgl.lwjgl:lwjgl_util:2.9.1" level="project" />
<orderEntry type="library" name="Gradle: tv.twitch:twitch:5.16" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang:scala-actors:2.11.0" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang.modules:scala-xml_2.11:1.0.2" level="project" />
<orderEntry type="library" name="Gradle: org.scala-lang.modules:scala-parser-combinators_2.11:1.0.1" level="project" />
<orderEntry type="library" name="Gradle: net.java.jinput:jinput-platform:2.0.5:natives-linux" level="project" />
<orderEntry type="library" name="Gradle: net.java.jinput:jinput-platform:2.0.5:natives-windows" level="project" />
<orderEntry type="library" name="Gradle: net.java.jinput:jinput-platform:2.0.5:natives-osx" level="project" />
<orderEntry type="library" name="Gradle: tv.twitch:twitch-platform:5.16:natives-windows-32" level="project" />
<orderEntry type="library" name="Gradle: tv.twitch:twitch-platform:5.16:natives-windows-64" level="project" />
<orderEntry type="library" name="Gradle: tv.twitch:twitch-platform:5.16:natives-osx" level="project" />
<orderEntry type="library" name="Gradle: tv.twitch:twitch-external-platform:4.5:natives-windows-32" level="project" />
<orderEntry type="library" name="Gradle: tv.twitch:twitch-external-platform:4.5:natives-windows-64" level="project" />
<orderEntry type="library" name="Gradle: org.lwjgl.lwjgl:lwjgl-platform:2.9.1:natives-windows" level="project" />
<orderEntry type="library" name="Gradle: org.lwjgl.lwjgl:lwjgl-platform:2.9.1:natives-linux" level="project" />
<orderEntry type="library" name="Gradle: org.lwjgl.lwjgl:lwjgl-platform:2.9.1:natives-osx" level="project" />
<orderEntry type="module-library" scope="RUNTIME">
<library name="Gradle: C__Users_luisc__gradle_caches_minecraft_net_minecraftforge_forge_1_7_10_10_13_4_1614_1_7_10_start">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.4.1614-1.7.10/start" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="guava-31.0.1-jre" level="project" />
</component>
</module>
+37 -29
View File
@@ -1,43 +1,46 @@
## 👋 Welcome to the CustomNPC+ Repository.
![](images/logo.png) ![](images/logo.png)
Welcome to the CustomNPC+ Repository. > 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](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.
Link to CurseForge: [HERE](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus) Link to CurseForge: [HERE](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
#### Notice ### ❗ Notice
I am not the original creator of CustomNPC. The original creator is @[Noppes](https://github.com/Noppes). I have been permitted to update the 1.7.10 and post my results on GitHub. 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) I am not the original creator of CustomNPC. The original creator is @[Noppes](https://github.com/Noppes). I have been permitted to update the 1.7.10 and post my results on GitHub. 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)
#### First Release! V1.0 (Installation) ### 🔹 First Release! V1.0 (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. 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: ### ❓ Features:
- [x] More Wing Types - More Wing Types
- [x] More Fin Types - More Fin Types
- [x] More Capes* - More Capes*
- [x] More Overlays - More Overlays
- [x] Added Horns - Added Horns
- [x] Added Dolphin Tail - Added Dolphin Tail
- [x] Larger Clone GUI - Larger Clone GUI
- [x] More Clone Tabs - More Clone Tabs
- [x] Increased Resolution to Additional Body Parts - Increased Resolution to Additional Body Parts
- [x] ~~Update Local Skin Textures (64x64) [WIP]~~ - ~~Update Local Skin Textures (64x64) [WIP]~~
- [x] Added (New) Local 64x64 Skin Textures - Added (New) Local 64x64 Skin Textures
- [x] 1.8 Skins (64x64) - 1.8 Skins (64x64)
- [x] Alex Model (64x64) - Alex Model (64x64)
- [x] Fix Part Rendering - Fix Part Rendering
- [x] Backported GUI Features - Backported GUI Features
- [x] Backported New Part Models - Backported New Part Models
- [X] Custom Part Disabling - Custom Part Disabling
- [X] Markov Name Generator - Markov Name Generator
- [ ] Flying NPCS [WIP] - Flying NPCS
- Better Script Speeds
- Scripting Additions: [Documentation](https://github.com/PewDizinho/CustomNPCPlus-Script-Documentation)
--- Please Suggest New Features! --- Please Suggest New Features!
###### **Majority of these cape designs are taken from the internet with fair-usage.*
#### Skin Model Feature: ## 🔰 Skin Model Feature:
##### Please note all *local* skins in this version of CustomNPC, must match the model selected. ###### **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"/> <img src="images/skinAnimation.gif" width="474" height="260"/>
#### Scale/Puppet Reset: #### Scale/Puppet Reset:
@@ -47,6 +50,11 @@ This mod is an ***update*** to CustomNPC and not an add-on. Do not install Custo
<img src="images/Url64Example.gif" width="474" height="260"/> <img src="images/Url64Example.gif" width="474" height="260"/>
#### Want to check out my other mods? ## 🔗 Want to check out my other mods?
[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. [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.
[![Discord Badge](https://img.shields.io/badge/CustomNPC-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/rgeWsmQaKa)
[![Discord Badge](https://img.shields.io/badge/CustomNPC+-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/pQqRTvFeJ5)
[![Download CustomNPC+](https://img.shields.io/badge/Download⠀CustomNPC⠀Plus!-0081CB?style=for-the-badge&logo=material-ui&logoColor=white)](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
[![Download CustomNPC+](https://img.shields.io/badge/Download⠀Plugin⠀Mod!-0081CB?style=for-the-badge&logo=material-ui&logoColor=white)](https://github.com/KAMKEEL/Plugin-Mod)
Binary file not shown.
+3 -1
View File
@@ -17,7 +17,7 @@ buildscript {
apply plugin: 'forge' apply plugin: 'forge'
version = "1.3" version = "1.5.1-beta"
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "CustomNPC-Plus" archivesBaseName = "CustomNPC-Plus"
@@ -64,3 +64,5 @@ processResources
exclude 'mcmod.info' exclude 'mcmod.info'
} }
} }
sourceSets {main { output.resourcesDir = output.classesDir }}
@@ -1,19 +0,0 @@
package net.minecraft.block.properties;
import java.util.Collection;
/** This code is owned by Minecraft */
public interface IProperty<T extends Comparable<T>>
{
String getName();
Collection<T> getAllowedValues();
Class<T> getValueClass();
/**
* Get the name for the given value.
*/
String getName(T value);
}
@@ -1,23 +0,0 @@
package net.minecraft.block.state;
import com.google.common.collect.ImmutableMap;
import java.util.Collection;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
/** This code is owned by Minecraft */
public interface IBlockState
{
Collection<IProperty> getPropertyNames();
<T extends Comparable<T>> T getValue(IProperty<T> property);
<T extends Comparable<T>, V extends T> IBlockState withProperty(IProperty<T> property, V value);
<T extends Comparable<T>> IBlockState cycleProperty(IProperty<T> property);
ImmutableMap<IProperty, Comparable> getProperties();
Block getBlock();
}
-123
View File
@@ -1,123 +0,0 @@
package net.minecraft.util;
import com.google.common.base.Objects;
/** This code is owned by Minecraft */
public class Vec3i implements Comparable<Vec3i>
{
/** The Null vector constant (0, 0, 0) */
public static final Vec3i NULL_VECTOR = new Vec3i(0, 0, 0);
/** X coordinate */
private final int x;
/** Y coordinate */
private final int y;
/** Z coordinate */
private final int z;
public Vec3i(int xIn, int yIn, int zIn)
{
this.x = xIn;
this.y = yIn;
this.z = zIn;
}
public Vec3i(double xIn, double yIn, double zIn)
{
this(MathHelper.floor_double(xIn), MathHelper.floor_double(yIn), MathHelper.floor_double(zIn));
}
public boolean equals(Object p_equals_1_)
{
if (this == p_equals_1_)
{
return true;
}
else if (!(p_equals_1_ instanceof Vec3i))
{
return false;
}
else
{
Vec3i vec3i = (Vec3i)p_equals_1_;
return this.getX() != vec3i.getX() ? false : (this.getY() != vec3i.getY() ? false : this.getZ() == vec3i.getZ());
}
}
public int hashCode()
{
return (this.getY() + this.getZ() * 31) * 31 + this.getX();
}
public int compareTo(Vec3i p_compareTo_1_)
{
return this.getY() == p_compareTo_1_.getY() ? (this.getZ() == p_compareTo_1_.getZ() ? this.getX() - p_compareTo_1_.getX() : this.getZ() - p_compareTo_1_.getZ()) : this.getY() - p_compareTo_1_.getY();
}
/**
* Get the X coordinate
*/
public int getX()
{
return this.x;
}
/**
* Get the Y coordinate
*/
public int getY()
{
return this.y;
}
/**
* Get the Z coordinate
*/
public int getZ()
{
return this.z;
}
/**
* Calculate the cross product of this and the given Vector
*/
public Vec3i crossProduct(Vec3i vec)
{
return new Vec3i(this.getY() * vec.getZ() - this.getZ() * vec.getY(), this.getZ() * vec.getX() - this.getX() * vec.getZ(), this.getX() * vec.getY() - this.getY() * vec.getX());
}
/**
* Calculate squared distance to the given coordinates
*/
public double distanceSq(double toX, double toY, double toZ)
{
double d0 = (double)this.getX() - toX;
double d1 = (double)this.getY() - toY;
double d2 = (double)this.getZ() - toZ;
return d0 * d0 + d1 * d1 + d2 * d2;
}
/**
* Compute square of distance from point x, y, z to center of this Block
*/
public double distanceSqToCenter(double xIn, double yIn, double zIn)
{
double d0 = (double)this.getX() + 0.5D - xIn;
double d1 = (double)this.getY() + 0.5D - yIn;
double d2 = (double)this.getZ() + 0.5D - zIn;
return d0 * d0 + d1 * d1 + d2 * d2;
}
/**
* Calculate squared distance to the given Vector
*/
public double distanceSq(Vec3i to)
{
return this.distanceSq((double)to.getX(), (double)to.getY(), (double)to.getZ());
}
public String toString()
{
return Objects.toStringHelper(this).add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).toString();
}
}
@@ -1,406 +0,0 @@
package net.minecraft.util.math;
import com.google.common.collect.AbstractIterator;
import java.util.Iterator;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3;
import net.minecraft.util.Vec3i;
/** This code is owned by Minecraft */
public class BlockPos extends Vec3i{
/** The BlockPos with all coordinates 0 */
public static final BlockPos ORIGIN = new BlockPos(0, 0, 0);
private static final int NUM_X_BITS = 1 + 25;//MathHelper.calculateLogBaseTwo(MathHelper.roundUpToPowerOfTwo(30000000));
private static final int NUM_Z_BITS = NUM_X_BITS;
private static final int NUM_Y_BITS = 64 - NUM_X_BITS - NUM_Z_BITS;
private static final int Y_SHIFT = 0 + NUM_Z_BITS;
private static final int X_SHIFT = Y_SHIFT + NUM_Y_BITS;
private static final long X_MASK = (1L << NUM_X_BITS) - 1L;
private static final long Y_MASK = (1L << NUM_Y_BITS) - 1L;
private static final long Z_MASK = (1L << NUM_Z_BITS) - 1L;
public BlockPos(int x, int y, int z)
{
super(x, y, z);
}
public BlockPos(double x, double y, double z)
{
super(x, y, z);
}
public BlockPos(Entity source)
{
this(source.posX, source.posY, source.posZ);
}
public BlockPos(Vec3 source)
{
this(source.xCoord, source.yCoord, source.zCoord);
}
public BlockPos(Vec3i source)
{
this(source.getX(), source.getY(), source.getZ());
}
/**
* Add the given coordinates to the coordinates of this BlockPos
*/
public BlockPos add(double x, double y, double z)
{
return x == 0.0D && y == 0.0D && z == 0.0D ? this : new BlockPos((double)this.getX() + x, (double)this.getY() + y, (double)this.getZ() + z);
}
/**
* Add the given coordinates to the coordinates of this BlockPos
*/
public BlockPos add(int x, int y, int z)
{
return x == 0 && y == 0 && z == 0 ? this : new BlockPos(this.getX() + x, this.getY() + y, this.getZ() + z);
}
/**
* Add the given Vector to this BlockPos
*/
public BlockPos add(Vec3i vec)
{
return vec.getX() == 0 && vec.getY() == 0 && vec.getZ() == 0 ? this : new BlockPos(this.getX() + vec.getX(), this.getY() + vec.getY(), this.getZ() + vec.getZ());
}
/**
* Subtract the given Vector from this BlockPos
*/
public BlockPos subtract(Vec3i vec)
{
return vec.getX() == 0 && vec.getY() == 0 && vec.getZ() == 0 ? this : new BlockPos(this.getX() - vec.getX(), this.getY() - vec.getY(), this.getZ() - vec.getZ());
}
/**
* Offset this BlockPos 1 block up
*/
public BlockPos up()
{
return this.up(1);
}
/**
* Offset this BlockPos n blocks up
*/
public BlockPos up(int n)
{
return this.offset(EnumFacing.UP, n);
}
/**
* Offset this BlockPos 1 block down
*/
public BlockPos down()
{
return this.down(1);
}
/**
* Offset this BlockPos n blocks down
*/
public BlockPos down(int n)
{
return this.offset(EnumFacing.DOWN, n);
}
/**
* Offset this BlockPos 1 block in northern direction
*/
public BlockPos north()
{
return this.north(1);
}
/**
* Offset this BlockPos n blocks in northern direction
*/
public BlockPos north(int n)
{
return this.offset(EnumFacing.NORTH, n);
}
/**
* Offset this BlockPos 1 block in southern direction
*/
public BlockPos south()
{
return this.south(1);
}
/**
* Offset this BlockPos n blocks in southern direction
*/
public BlockPos south(int n)
{
return this.offset(EnumFacing.SOUTH, n);
}
/**
* Offset this BlockPos 1 block in western direction
*/
public BlockPos west()
{
return this.west(1);
}
/**
* Offset this BlockPos n blocks in western direction
*/
public BlockPos west(int n)
{
return this.offset(EnumFacing.WEST, n);
}
/**
* Offset this BlockPos 1 block in eastern direction
*/
public BlockPos east()
{
return this.east(1);
}
/**
* Offset this BlockPos n blocks in eastern direction
*/
public BlockPos east(int n)
{
return this.offset(EnumFacing.EAST, n);
}
/**
* Offset this BlockPos 1 block in the given direction
*/
public BlockPos offset(EnumFacing facing)
{
return this.offset(facing, 1);
}
/**
* Offsets this BlockPos n blocks in the given direction
*/
public BlockPos offset(EnumFacing facing, int n)
{
return n == 0 ? this : new BlockPos(this.getX() + facing.getFrontOffsetX() * n, this.getY() + facing.getFrontOffsetY() * n, this.getZ() + facing.getFrontOffsetZ() * n);
}
/**
* Calculate the cross product of this and the given Vector
*/
public BlockPos crossProduct(Vec3i vec)
{
return new BlockPos(this.getY() * vec.getZ() - this.getZ() * vec.getY(), this.getZ() * vec.getX() - this.getX() * vec.getZ(), this.getX() * vec.getY() - this.getY() * vec.getX());
}
/**
* Serialize this BlockPos into a long value
*/
public long toLong()
{
return ((long)this.getX() & X_MASK) << X_SHIFT | ((long)this.getY() & Y_MASK) << Y_SHIFT | ((long)this.getZ() & Z_MASK) << 0;
}
/**
* Create a BlockPos from a serialized long value (created by toLong)
*/
public static BlockPos fromLong(long serialized)
{
int i = (int)(serialized << 64 - X_SHIFT - NUM_X_BITS >> 64 - NUM_X_BITS);
int j = (int)(serialized << 64 - Y_SHIFT - NUM_Y_BITS >> 64 - NUM_Y_BITS);
int k = (int)(serialized << 64 - NUM_Z_BITS >> 64 - NUM_Z_BITS);
return new BlockPos(i, j, k);
}
public static Iterable<BlockPos> getAllInBox(BlockPos from, BlockPos to)
{
final BlockPos blockpos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ()));
final BlockPos blockpos1 = new BlockPos(Math.max(from.getX(), to.getX()), Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ()));
return new Iterable<BlockPos>()
{
public Iterator<BlockPos> iterator()
{
return new AbstractIterator<BlockPos>()
{
private BlockPos lastReturned = null;
protected BlockPos computeNext()
{
if (this.lastReturned == null)
{
this.lastReturned = blockpos;
return this.lastReturned;
}
else if (this.lastReturned.equals(blockpos1))
{
return (BlockPos)this.endOfData();
}
else
{
int i = this.lastReturned.getX();
int j = this.lastReturned.getY();
int k = this.lastReturned.getZ();
if (i < blockpos1.getX())
{
++i;
}
else if (j < blockpos1.getY())
{
i = blockpos.getX();
++j;
}
else if (k < blockpos1.getZ())
{
i = blockpos.getX();
j = blockpos.getY();
++k;
}
this.lastReturned = new BlockPos(i, j, k);
return this.lastReturned;
}
}
};
}
};
}
public static Iterable<BlockPos.MutableBlockPos> getAllInBoxMutable(BlockPos from, BlockPos to)
{
final BlockPos blockpos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ()));
final BlockPos blockpos1 = new BlockPos(Math.max(from.getX(), to.getX()), Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ()));
return new Iterable<BlockPos.MutableBlockPos>()
{
public Iterator<BlockPos.MutableBlockPos> iterator()
{
return new AbstractIterator<BlockPos.MutableBlockPos>()
{
private BlockPos.MutableBlockPos theBlockPos = null;
protected BlockPos.MutableBlockPos computeNext()
{
if (this.theBlockPos == null)
{
this.theBlockPos = new BlockPos.MutableBlockPos(blockpos.getX(), blockpos.getY(), blockpos.getZ());
return this.theBlockPos;
}
else if (this.theBlockPos.equals(blockpos1))
{
return (BlockPos.MutableBlockPos)this.endOfData();
}
else
{
int i = this.theBlockPos.getX();
int j = this.theBlockPos.getY();
int k = this.theBlockPos.getZ();
if (i < blockpos1.getX())
{
++i;
}
else if (j < blockpos1.getY())
{
i = blockpos.getX();
++j;
}
else if (k < blockpos1.getZ())
{
i = blockpos.getX();
j = blockpos.getY();
++k;
}
this.theBlockPos.x = i;
this.theBlockPos.y = j;
this.theBlockPos.z = k;
return this.theBlockPos;
}
}
};
}
};
}
/**
* Returns a version of this BlockPos that is guaranteed to be Immutable.
* In most cases this will return 'this', but if 'this' is an instance of
* MutableBlockPos it will return a new instance of BlockPos with the same values.
*
* When storing a parameter given to you for an extended period of time, make sure you
* use this in case the value is changed internally.
*
* @return An immutable BlockPos.
*/
public BlockPos getImmutable()
{
return this;
}
public static final class MutableBlockPos extends BlockPos
{
/** Mutable X Coordinate */
private int x;
/** Mutable Y Coordinate */
private int y;
/** Mutable Z Coordinate */
private int z;
public MutableBlockPos()
{
this(0, 0, 0);
}
public MutableBlockPos(int x_, int y_, int z_)
{
super(0, 0, 0);
this.x = x_;
this.y = y_;
this.z = z_;
}
/**
* Get the X coordinate
*/
public int getX()
{
return this.x;
}
/**
* Get the Y coordinate
*/
public int getY()
{
return this.y;
}
/**
* Get the Z coordinate
*/
public int getZ()
{
return this.z;
}
/**
* Set the values
*
* @param xIn The X value
* @param yIn The Y value
* @param zIn The Z value
*/
public BlockPos.MutableBlockPos set(int xIn, int yIn, int zIn)
{
this.x = xIn;
this.y = yIn;
this.z = zIn;
return this;
}
@Override public BlockPos getImmutable() { return new BlockPos(this); }
}
}
@@ -1,81 +0,0 @@
package nikedemos.markovnames;
import java.util.HashMap;
import java.util.Map;
public class HashMap2D<T1, T2, T3> {
public final Map<T1, Map<T2, T3>> mMap;
/*
https://stackoverflow.com/a/10299689/9355344
*/
public HashMap2D() {
mMap = new HashMap<T1, Map<T2, T3>>();
}
/**
* Associates the specified value with the specified keys in this map (optional operation). If the map previously
* contained a mapping for the key, the old value is replaced by the specified value.
*
* @param key1
* the first key
* @param key2
* the second key
* @param value
* the value to be set
* @return the value previously associated with (key1,key2), or <code>null</code> if none
* @see Map#put(Object, Object)
*/
public T3 put(T1 key1, T2 key2, T3 value) {
Map<T2, T3> map;
if (mMap.containsKey(key1)) {
map = mMap.get(key1);
} else {
map = new HashMap<T2, T3>();
mMap.put(key1, map);
}
return map.put(key2, value);
}
/**
* Returns the value to which the specified key is mapped, or <code>null</code> if this map contains no mapping for
* the key.
*
* @param key1
* the first key whose associated value is to be returned
* @param key2
* the second key whose associated value is to be returned
* @return the value to which the specified key is mapped, or <code>null</code> if this map contains no mapping for
* the key
* @see Map#get(Object)
*/
public T3 get(T1 key1, T2 key2) {
if (mMap.containsKey(key1)) {
return mMap.get(key1).get(key2);
} else {
return null;
}
}
/**
* Returns <code>true</code> if this map contains a mapping for the specified key
*
* @param key1
* the first key whose presence in this map is to be tested
* @param key2
* the second key whose presence in this map is to be tested
* @return Returns true if this map contains a mapping for the specified key
* @see Map#containsKey(Object)
*/
public boolean containsKeys(T1 key1, T2 key2) {
return mMap.containsKey(key1) && mMap.get(key1).containsKey(key2);
}
public void clear() {
mMap.clear();
}
}
@@ -1,53 +0,0 @@
package nikedemos.markovnames;
import nikedemos.markovnames.generators.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
public class Main {
public static final int GENDER_RANDOM=0;
public static final int GENDER_MALE=1;
public static final int GENDER_FEMALE=2;
public static HashMap<String, MarkovGenerator> GENERATORS = new HashMap<String, MarkovGenerator>();
public static void main(String[] args){
//all the generators neatly in one HashMap, so you can iterate or w/e
GENERATORS.put("ROMAN", new MarkovRoman(3));
GENERATORS.put("JAPANESE", new MarkovJapanese(4));
GENERATORS.put("SLAVIC", new MarkovSlavic(3));
GENERATORS.put("WELSH", new MarkovWelsh(3));
GENERATORS.put("SAAMI", new MarkovSaami(3));
GENERATORS.put("OLDNORSE", new MarkovOldNorse(4));
GENERATORS.put("ANCIENTGREEK", new MarkovAncientGreek(3));
GENERATORS.put("AZTEC", new MarkovAztec(3));
//iterate through generators, generate 5 male and 5 female names, move on to the next
Iterator<Entry<String, MarkovGenerator>> g = GENERATORS.entrySet().iterator();
while (g.hasNext()) {
Entry<String, MarkovGenerator> pair = (Entry<String, MarkovGenerator>) g.next();
System.out.println("==="+pair.getKey()+"===");
for (int i=0; i<16; i++)
{
if (i==0)
System.out.println("GENTLEMEN-----------");
int gender = i<8 ? 1 : 2;
String random_name = pair.getValue().fetch(gender);
System.out.println(random_name);
if (i==15) //extra padding
System.out.println("\n");
else if (i==7) //separate genders
System.out.println("LADIES--------------");
}
}
}
}
@@ -1,270 +0,0 @@
package nikedemos.markovnames;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
public class MarkovDictionary {
private Random rng;
private int sequenceLen = 3;
private HashMap2D<String, String, Integer> occurrences = new HashMap2D<String, String, Integer>();
public MarkovDictionary(String dictionary, int seqlen, Random rng) {
this.rng = rng;
try {
applyDictionary(dictionary, seqlen);
} catch (Exception e) {
e.printStackTrace();
}
}
public MarkovDictionary(String dictionary, int seqlen) {
this(dictionary, seqlen, new Random());
}
public MarkovDictionary(String dictionary) {
this(dictionary, 3, new Random()); // 3 is the default, anyway
}
public MarkovDictionary(String dictionary, Random rng) {
this(dictionary, 3, rng); // 3 is the default, anyway
}
// Blatantly copied from EnderIO:
// https://github.com/SleepyTrousers/EnderIO/blob/master/enderio-base/src/main/java/crazypants/enderio/base/config/recipes/RecipeFactory.java#L44-L57
// Thanks again for your help, Henry Loenwind!
private InputStream getResource(ResourceLocation resourceLocation) {
final ModContainer container = Loader.instance().activeModContainer();
if (container != null) {
final String resourcePath = String.format("/%s/%s/%s", "assets", resourceLocation.getResourceDomain(),
resourceLocation.getResourcePath());
InputStream resourceAsStream = null;
try {
resourceAsStream = container.getMod().getClass().getResourceAsStream(resourcePath);
} catch (Exception e) {
e.printStackTrace();
}
if (resourceAsStream != null) {
return resourceAsStream;
} else {
throw new RuntimeException("Could not find resource " + resourceLocation);
}
} else {
throw new RuntimeException("Failed to find current mod while looking for resource " + resourceLocation);
}
}
public String getCapitalized(String str) {
if (str == null || str.isEmpty())
return str;
char[] chars = str.toCharArray();
chars[0] = Character.toUpperCase(chars[0]);
return new String(chars);
}
public static String readFile(String path) throws IOException {
byte[] encoded = Files.readAllBytes(Paths.get(path));
return new String(encoded, StandardCharsets.UTF_8);
}
public void incrementSafe(String str1, String str2) {
// so for instance, "_DUP_AUX", "_TOTAL" will count how many "DUP" seqCurrs we have
if (occurrences.containsKeys(str1, str2))
{
int curr = occurrences.get(str1, str2).intValue();
occurrences.put(str1, str2, Integer.valueOf(curr + 1));
} else {
occurrences.put(str1, str2, Integer.valueOf(1));
}
}
public String generateWord() {
// let's pick the first element, from which further picking shall proceed.
// first, we need to know how many top-level sequences (sequenceLen length)
// strings
// we have. So just take into account those surrounded by "_" - and count them.
// From that we'll get the weights.
int allEntries = 0;
// first iteration: we count top level entries. There's just no other way.
Iterator<Entry<String, Map<String, Integer>>> i = occurrences.mMap.entrySet().iterator();
while (i.hasNext()) {
Entry<String, Map<String, Integer>> pair = (Entry<String, Map<String, Integer>>) i.next();
String k = pair.getKey();
if (k.startsWith("_[") && k.endsWith("_")) // dealing with meta entry here
{
allEntries += occurrences.get(k, "_TOTAL_");
}
}
if(allEntries == 0) {
return "Kamkeel"; //shouldnt happen
}
int topLevelEntries;
int randomNumber = rng.nextInt(allEntries);
// ok, so how does this weighted random work?
// easy. Check if the randomNumber is LESS than
// topLevelEntries variable for that entry (see below).
// If it is, break the while loop - we got our first element,
// from which we will go further. Just remember to
// remove the underscores at both ends!
Iterator<Entry<String, Map<String, Integer>>> it = occurrences.mMap.entrySet().iterator();
StringBuilder sequence = new StringBuilder("");
while (it.hasNext()) {
Entry<String, Map<String, Integer>> pair = (Entry<String, Map<String, Integer>>) it.next();
String k = pair.getKey();
if (k.startsWith("_[") && k.endsWith("_")) // dealing with meta entry here
{
topLevelEntries = occurrences.get(k, "_TOTAL_");
if (randomNumber < topLevelEntries) {
sequence.append(k.substring(1, sequenceLen + 1)); // removing the underscores
break;
} else {
// keep going
randomNumber -= topLevelEntries;
}
}
}
// great! now that we have the first element, time for some generic iterations.
// in a very similar manner. Basically - perform this loop till you encounter
// "]" at the end
StringBuilder word = new StringBuilder("");
word.append(sequence); // now we're gonna use firstElement to keep the sequence
while (sequence.charAt(sequence.length() - 1) != ']') {
// sequence is now your HashMap key for the 1st dimension.
// for that sequence:
// - get total elements that are not meta (not surrounded by underscores)
// and count their total occurrences
int subSize = 0;
Iterator<Entry<String, Integer>> j = occurrences.mMap.get(sequence.toString()).entrySet().iterator();
while (j.hasNext()) {
Entry<String, Integer> entry = j.next();
subSize += entry.getValue();
}
// and now, the last iterator, with a random, just like before
randomNumber = rng.nextInt(subSize);
Iterator<Entry<String, Integer>> k = occurrences.mMap.get(sequence.toString()).entrySet().iterator();
String chosen = "";
while (k.hasNext()) {
Entry<String, Integer> entry = k.next();
int occu = occurrences.get(sequence.toString(), entry.getKey());
if (randomNumber < occu) {
chosen = entry.getKey();
break;
} else { // keep going!
randomNumber -= occu;
}
}
// now, append the word...
word.append(chosen);
// delete the first character of the sequence,
// and also append it with chosen character.
// So if the Sequence is ABC, and chosen is D,
// it now becomes BCD.
sequence.delete(0, 1);
sequence.append(chosen);
// System.out.println("FINAL: "+sequence);
// System.out.println("CHOSEN: "+chosen);
}
// and now remove the square brackets surrounding it.
return this.getPost(word.substring(1, word.length() - 1));
}
public String getPost(String str) {
return getCapitalized(str);
}
public void applyDictionary(String dictionaryFile, int seqLen) throws IOException {
StringBuilder input = new StringBuilder();
ResourceLocation resource = new ResourceLocation("customnpcs:markovnames/" + dictionaryFile);
BufferedReader readIn = new BufferedReader(new InputStreamReader(getResource(resource), "UTF-8"));
// Thread.currentThread().getContextClassLoader().getResourceAsStream("path/to/resource/file.ext");
for (String line = readIn.readLine(); line != null; line = readIn.readLine()) {
input.append(line).append(" ");
}
readIn.close();
if (input.length() == 0) {
throw new RuntimeException("Resource was empty: + " + resource);
}
// if seqLen != this.sequenceLen, we must clear occurrences
if (this.sequenceLen != seqLen) {
sequenceLen = seqLen;
this.occurrences.clear();
}
String input_str = '[' + input.toString().toLowerCase().replaceAll("[\\t\\n\\r\\s]+", "][") + ']';
int maxCursorPos = input_str.length() - 1 - sequenceLen;
for (int i = 0; i <= maxCursorPos; i++) {
String seqCurr = input_str.substring(i, i + (sequenceLen)); // i plus 2 characters next to it
String seqNext = input_str.substring(i + sequenceLen, i + sequenceLen + 1); // next character after that
incrementSafe(seqCurr, seqNext);
// aux counters
StringBuilder meta = new StringBuilder("_").append(seqCurr).append("_");
// String aux1="_"+seqCurr+"_";
incrementSafe(meta.toString(), "_TOTAL_");
// String aux2="_"+seqNext+"_";
// incrementSafe(aux1, aux2);
// debug, feel free to uncomment
/*
* System.out.println("<"+seqCurr+"><"+seqNext+"> => "+occurrences.get(seqCurr,
* seqNext));
* System.out.println("<"+aux1+"><"+"_TOTAL_"+"> => "+occurrences.get(aux1,
* "_TOTAL_"));
* System.out.println("<"+aux1+"><"+aux2+"> => "+occurrences.get(aux1, aux2));
* System.out.println("");
*/
}
// by now, we should have
}
}
@@ -1,41 +0,0 @@
package nikedemos.markovnames;
import java.util.Random;
//used exclusively by the Spanish surname dictionary - because the capitalization is a little bit different
public class MarkovDictionarySPA extends MarkovDictionary {
public MarkovDictionarySPA(String dictionary, int seqlen, Random rng) {
super(dictionary, seqlen, rng);
// TODO Auto-generated constructor stub
}
@Override
public String getPost(String str) {
return getCapitalizedSPA(str);
}
public String getCapitalizedSPA(String str) {
// for spanish capitalization
String[] parts = str.split("#");
StringBuilder build = new StringBuilder("");
for (int p = 0; p < parts.length; p++) {
// capitalize this part, but only if it's not "de", "del", "la" or "los"
if (!parts[p].equals("de") && !parts[p].equals("del") && !parts[p].equals("la")
&& !parts[p].equals("los")) {
parts[p] = getCapitalized(parts[p]);
}
if (p > 0) // don't add spaces before the first part
build.append(" ");
build.append(parts[p]);
}
return build.toString();
}
}
@@ -1,58 +0,0 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovAncientGreek extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovAncientGreek(int seqlen, Random rng)
{
this.rng = rng;
this.markov = new MarkovDictionary("ancient_greek_male.txt",seqlen,rng);
this.markov2 = new MarkovDictionary("ancient_greek_female.txt",seqlen,rng);
}
public MarkovAncientGreek(int seqlen)
{
this(seqlen,new Random());
}
public MarkovAncientGreek()
{
this(3, new Random()); //3 seems best-suited for Welsh
}
@Override
public String fetch(int gender)
{
String seq1;
//check the gender.
//0 = random gender, 1 = male, 2 = female
//if there's no gender specified (0),
//now it's time to pick it at random
//
if (gender==0)
{
gender = rng.nextBoolean()==true? 1 : 2;
}
//now if it's 2 - a lady - feminize the 3 sequences
if (gender==2)
{
seq1 = markov2.generateWord();
}
else
{
seq1 = markov.generateWord();
}
return seq1;
}
}
@@ -1,31 +0,0 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovAztec extends MarkovGenerator {
public MarkovAztec(int seqlen, Random rng)
{
this.rng = rng;
this.markov = new MarkovDictionary("aztec_given.txt",seqlen,rng);
}
public MarkovAztec(int seqlen)
{
this(seqlen,new Random());
}
public MarkovAztec()
{
this(3, new Random()); //3 seems best-suited for Aztec
}
@Override
public String fetch(int gender) //Aztec names are genderless
{
return markov.generateWord();
}
}
@@ -1,40 +0,0 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
/* This implementation is made specifically for
* CustomNPCs, one of the best Minecraft mods ever...
* I'm a huge fan and would recommend it to anyone.
* Check it out if you haven't yet, at
* http://www.kodevelopment.nl/minecraft/category/customnpcs/
* Minecraft 1.12.2 Java Edition + Forge required.
* Also, you have to like cats, it's in CNPCs EULA, I'm quite sure
*/
public class MarkovCustomNPCsClassic extends MarkovGenerator {
public MarkovCustomNPCsClassic(int seqlen, Random rng)
{
this.rng = rng;
this.markov = new MarkovDictionary("customnpcs_classic.txt",seqlen,rng);
}
public MarkovCustomNPCsClassic(int seqlen)
{
this(seqlen,new Random());
}
public MarkovCustomNPCsClassic()
{
this(3, new Random());
}
@Override
public String fetch(int gender)
{
return markov.generateWord();
}
}
@@ -1,46 +0,0 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovGenerator {
public MarkovDictionary markov;
public Random rng;
public String name;
public String symbol;
public MarkovGenerator(int seqlen, Random rng)
{
this.rng = rng;
}
public MarkovGenerator(int seqlen)
{
this(seqlen, new Random());
}
public MarkovGenerator()
{
this(3, new Random());
}
public String fetch(int gender) {
return stylize(markov.generateWord());
}
public String fetch()
{
return fetch(0); //0 = random gender, 1 = male, 2 = female
}
public String stylize(String str)
{
return str;
}
public String feminize(String element, boolean flag) {
return element;
}
}
@@ -1,51 +0,0 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovJapanese extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovDictionary markov3;
public MarkovJapanese(int seqlen, Random rng) {
this.rng = rng;
this.markov = new MarkovDictionary("japanese_surnames.txt", seqlen, rng);
this.markov2 = new MarkovDictionary("japanese_given_male.txt", seqlen, rng);
this.markov3 = new MarkovDictionary("japanese_given_female.txt", seqlen, rng);
}
public MarkovJapanese(int seqlen) {
this(seqlen, new Random());
}
public MarkovJapanese() {
this(4, new Random()); // 4 seems best suited for Japanese
}
@Override
public String fetch(int gender) {
StringBuilder name = new StringBuilder(markov.generateWord());
name.append(" ");
// check the gender.
// 0 = random gender, 1 = male, 2 = female
// if there's no gender specified (0),
// now it's time to pick it at random
//
if (gender == 0) {
gender = rng.nextBoolean() == true ? 1 : 2;
}
if (gender == 2) {
name.append(markov3.generateWord());
}
else {
name.append(markov2.generateWord());
}
return name.toString();
}
}
@@ -1,32 +0,0 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovOldNorse extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovOldNorse(int seqlen, Random rng)
{
this.rng = rng;
this.markov = new MarkovDictionary("old_norse_bothgenders.txt",seqlen,rng);
}
public MarkovOldNorse(int seqlen)
{
this(seqlen,new Random());
}
public MarkovOldNorse()
{
this(4, new Random()); //4 seems best-suited for Old Norse
}
@Override
public String fetch(int gender) //Old Norse names are genderless
{
return markov.generateWord();
}
}
@@ -1,65 +0,0 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovRoman extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovDictionary markov3;
public MarkovRoman(int seqlen, Random rng) {
this.rng = rng;
this.markov = new MarkovDictionary("roman_praenomina.txt", seqlen, rng);
this.markov2 = new MarkovDictionary("roman_nomina.txt", seqlen, rng);
this.markov3 = new MarkovDictionary("roman_cognomina.txt", seqlen, rng);
}
public MarkovRoman(int seqlen) {
this(seqlen, new Random());
}
public MarkovRoman() {
this(3, new Random());
}
@Override
public String feminize(String element, boolean flag) {
// change "us" into "a" and "o" at the end into "a"
if (element.endsWith("us")) {
element = element.substring(0, element.length() - 2) + "a";
}
else if (element.endsWith("o")) {
element = element.substring(0, element.length() - 2) + "a";
}
return element;
}
@Override
public String fetch(int gender) {
String seq1 = markov.generateWord();
String seq2 = markov2.generateWord();
String seq3 = markov3.generateWord();
// check the gender.
// 0 = random gender, 1 = male, 2 = female
// if there's no gender specified (0),
// now it's time to pick it at random
//
if (gender == 0) {
gender = rng.nextBoolean() == true ? 1 : 2;
}
// now if it's 2 - a lady - feminize the 3 sequences
if (gender == 2) {
seq1 = feminize(seq1, false);
seq2 = feminize(seq2, false);
seq3 = feminize(seq3, true);
}
return (new StringBuilder(seq1).append(" ").append(seq2).append(" ").append(seq3).toString());
}
}
@@ -1,33 +0,0 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovSaami extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovSaami(int seqlen, Random rng)
{
this.rng = rng;
this.markov = new MarkovDictionary("saami_bothgenders.txt",seqlen,rng);
}
public MarkovSaami(int seqlen)
{
this(seqlen,new Random());
}
public MarkovSaami()
{
this(3, new Random()); //3 seems best-suited for Saami
}
@Override
public String fetch(int gender) //Saami names are genderless
{
return markov.generateWord();
}
}
@@ -1,59 +0,0 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovSlavic extends MarkovGenerator {
public MarkovSlavic(int seqlen, Random rng) {
this.rng = rng;
this.markov = new MarkovDictionary("slavic_given.txt", seqlen, rng);
}
public MarkovSlavic(int seqlen) {
this(seqlen, new Random());
}
public MarkovSlavic() {
this(3, new Random()); // 3 seems best-suited for Slavic
}
@Override
public String feminize(String element, boolean flag) {
// add "a" at the end, if there isn't one
String lastChar = element.substring(element.length() - 1);
if (element.endsWith("o")) {
element = element.substring(0, element.length() - 1) + "a";
}
else if (!lastChar.endsWith("a")) {
element += "a";
}
return element;
}
@Override
public String fetch(int gender) {
String seq1 = markov.generateWord();
// check the gender.
// 0 = random gender, 1 = male, 2 = female
// if there's no gender specified (0),
// now it's time to pick it at random
//
if (gender == 0) {
gender = rng.nextBoolean() == true ? 1 : 2;
}
// now if it's 2 - a lady - feminize the 3 sequences
if (gender == 2) {
seq1 = feminize(seq1, false);
}
return seq1;
}
}
@@ -1,52 +0,0 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import nikedemos.markovnames.MarkovDictionarySPA;
import java.util.Random;
public class MarkovSpanish extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovDictionary markov3;
public MarkovSpanish(int seqlen, Random rng) {
this.rng = rng;
this.markov = new MarkovDictionary("spanish_given_male.txt", seqlen, rng);
this.markov2 = new MarkovDictionary("spanish_given_female.txt", seqlen, rng);
this.markov3 = new MarkovDictionarySPA("spanish_surnames.txt", seqlen, rng);
}
public MarkovSpanish(int seqlen) {
this(seqlen, new Random());
}
public MarkovSpanish() {
this(3, new Random());
}
@Override
public String fetch(int gender) {
String giv = "";
String sur = markov3.generateWord();
// check the gender.
// 0 = random gender, 1 = male, 2 = female
// if there's no gender specified (0),
// now it's time to pick it at random
//
if (gender == 0) {
gender = rng.nextBoolean() == true ? 1 : 2;
}
if (gender == 1) {
giv = markov.generateWord();
}
else {
giv = markov2.generateWord();
}
return new StringBuilder(giv).append(" ").append(sur).toString();
}
}
@@ -1,50 +0,0 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovWelsh extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovWelsh(int seqlen, Random rng) {
this.rng = rng;
this.markov = new MarkovDictionary("welsh_male.txt", seqlen, rng);
this.markov2 = new MarkovDictionary("welsh_female.txt", seqlen, rng);
}
public MarkovWelsh(int seqlen) {
this(seqlen, new Random());
}
public MarkovWelsh() {
this(3, new Random()); // 3 seems best-suited for Welsh
}
@Override
public String fetch(int gender) {
String seq1;
// check the gender.
// 0 = random gender, 1 = male, 2 = female
// if there's no gender specified (0),
// now it's time to pick it at random
//
if (gender == 0) {
gender = rng.nextBoolean() == true ? 1 : 2;
}
// now if it's 2 - a lady - feminize the 3 sequences
if (gender == 2) {
seq1 = markov2.generateWord();
}
else {
seq1 = markov.generateWord();
}
return seq1;
}
}
+2 -20
View File
@@ -5,9 +5,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.stats.Achievement;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import noppes.npcs.blocks.tiles.TileNpcContainer; import noppes.npcs.blocks.tiles.TileNpcContainer;
import noppes.npcs.constants.EnumGuiType; import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.containers.ContainerCarpentryBench; import noppes.npcs.containers.ContainerCarpentryBench;
@@ -30,26 +28,19 @@ import noppes.npcs.containers.ContainerNPCTraderSetup;
import noppes.npcs.containers.ContainerNpcItemGiver; import noppes.npcs.containers.ContainerNpcItemGiver;
import noppes.npcs.containers.ContainerNpcQuestReward; import noppes.npcs.containers.ContainerNpcQuestReward;
import noppes.npcs.containers.ContainerNpcQuestTypeItem; import noppes.npcs.containers.ContainerNpcQuestTypeItem;
import noppes.npcs.controllers.PlayerData;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface; import noppes.npcs.entity.EntityNPCInterface;
import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.IGuiHandler;
import noppes.npcs.scripted.interfaces.IWorld;
public class CommonProxy implements IGuiHandler { public class CommonProxy implements IGuiHandler {
public boolean newVersionAvailable = false; public boolean newVersionAvailable = false;
public int revision = 1; public int revision = 4;
public void load() { public void load() {
CustomNpcs.Channel.register(new PacketHandlerServer()); CustomNpcs.Channel.register(new PacketHandlerServer());
CustomNpcs.ChannelPlayer.register(new PacketHandlerPlayer()); CustomNpcs.ChannelPlayer.register(new PacketHandlerPlayer());
} }
public PlayerData getPlayerData(EntityPlayer player) {
return null;
}
@Override @Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if(ID > EnumGuiType.values().length) if(ID > EnumGuiType.values().length)
@@ -151,8 +142,6 @@ public class CommonProxy implements IGuiHandler {
} }
public FakePlayer getCommandPlayer(IWorld world) { return null; }
public boolean hasClient() { public boolean hasClient() {
return false; return false;
} }
@@ -171,15 +160,8 @@ public class CommonProxy implements IGuiHandler {
} }
public void spawnParticle(String particle, double x, double y, double z, public void spawnParticle(String particle, double x, double y, double z,
double motionX, double motionY, double motionZ, float scale) { double motionX, double motionY, double motionZ, float scale) {
} }
public String getAchievementDesc(Achievement achievement) {
return "";
}
public boolean isGUIOpen(){
return false;
}
} }
+15 -60
View File
@@ -7,7 +7,11 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.network.FMLEventChannel; import cpw.mods.fml.common.network.FMLEventChannel;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.EntityRegistry;
@@ -22,7 +26,6 @@ import net.minecraft.entity.EntityList;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import nikedemos.markovnames.generators.*;
import noppes.npcs.config.ConfigLoader; import noppes.npcs.config.ConfigLoader;
import noppes.npcs.config.ConfigProp; import noppes.npcs.config.ConfigProp;
import noppes.npcs.controllers.BankController; import noppes.npcs.controllers.BankController;
@@ -40,7 +43,15 @@ import noppes.npcs.controllers.ServerCloneController;
import noppes.npcs.controllers.SpawnController; import noppes.npcs.controllers.SpawnController;
import noppes.npcs.controllers.TransportController; import noppes.npcs.controllers.TransportController;
import noppes.npcs.enchants.EnchantInterface; import noppes.npcs.enchants.EnchantInterface;
import noppes.npcs.entity.*; import noppes.npcs.entity.EntityChairMount;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityMagicProjectile;
import noppes.npcs.entity.EntityNPCGolem;
import noppes.npcs.entity.EntityNpcCrystal;
import noppes.npcs.entity.EntityNpcDragon;
import noppes.npcs.entity.EntityNpcPony;
import noppes.npcs.entity.EntityNpcSlime;
import noppes.npcs.entity.EntityProjectile;
import noppes.npcs.entity.old.EntityNPCDwarfFemale; import noppes.npcs.entity.old.EntityNPCDwarfFemale;
import noppes.npcs.entity.old.EntityNPCDwarfMale; import noppes.npcs.entity.old.EntityNPCDwarfMale;
import noppes.npcs.entity.old.EntityNPCElfFemale; import noppes.npcs.entity.old.EntityNPCElfFemale;
@@ -59,9 +70,8 @@ import noppes.npcs.entity.old.EntityNpcMonsterMale;
import noppes.npcs.entity.old.EntityNpcNagaFemale; import noppes.npcs.entity.old.EntityNpcNagaFemale;
import noppes.npcs.entity.old.EntityNpcNagaMale; import noppes.npcs.entity.old.EntityNpcNagaMale;
import noppes.npcs.entity.old.EntityNpcSkeleton; import noppes.npcs.entity.old.EntityNpcSkeleton;
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.3") @Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.7.10d")
public class CustomNpcs { public class CustomNpcs {
@ConfigProp(info = "Disable Chat Bubbles") @ConfigProp(info = "Disable Chat Bubbles")
@@ -140,8 +150,6 @@ public class CustomNpcs {
public static ConfigLoader Config; public static ConfigLoader Config;
public static final MarkovGenerator[] MARKOV_GENERATOR = new MarkovGenerator[10];
public CustomNpcs() { public CustomNpcs() {
instance = this; instance = this;
} }
@@ -176,9 +184,6 @@ public class CustomNpcs {
MinecraftForge.EVENT_BUS.register(new ServerEventsHandler()); MinecraftForge.EVENT_BUS.register(new ServerEventsHandler());
MinecraftForge.EVENT_BUS.register(new ScriptController()); MinecraftForge.EVENT_BUS.register(new ScriptController());
ScriptPlayerEventHandler scriptPlayerEventHandler = new ScriptPlayerEventHandler();
MinecraftForge.EVENT_BUS.register(scriptPlayerEventHandler);
FMLCommonHandler.instance().bus().register(scriptPlayerEventHandler.registerForgeEvents());
FMLCommonHandler.instance().bus().register(new ServerTickHandler()); FMLCommonHandler.instance().bus().register(new ServerTickHandler());
registerNpc(EntityNPCHumanMale.class, "npchumanmale"); registerNpc(EntityNPCHumanMale.class, "npchumanmale");
@@ -206,8 +211,6 @@ public class CustomNpcs {
registerNpc(EntityNPCGolem.class, "npcGolem"); registerNpc(EntityNPCGolem.class, "npcGolem");
registerNpc(EntityCustomNpc.class, "CustomNpc"); registerNpc(EntityCustomNpc.class, "CustomNpc");
registerNewEntity(EntityChairMount.class, "CustomNpcChairMount", 64, 10, false); registerNewEntity(EntityChairMount.class, "CustomNpcChairMount", 64, 10, false);
registerNewEntity(EntityProjectile.class, "throwableitem", 64, 3, true); registerNewEntity(EntityProjectile.class, "throwableitem", 64, 3, true);
registerNewEntity(EntityMagicProjectile.class, "magicprojectile", 64, 3, true); registerNewEntity(EntityMagicProjectile.class, "magicprojectile", 64, 3, true);
@@ -221,22 +224,6 @@ public class CustomNpcs {
PixelmonHelper.load(); PixelmonHelper.load();
} }
@EventHandler
public void load(FMLInitializationEvent ev) {
MARKOV_GENERATOR[0] = new MarkovRoman(3);
MARKOV_GENERATOR[1] = new MarkovJapanese(4);
MARKOV_GENERATOR[2] = new MarkovSlavic(3);
MARKOV_GENERATOR[3] = new MarkovWelsh(3);
MARKOV_GENERATOR[4] = new MarkovSaami(3);
MARKOV_GENERATOR[5] = new MarkovOldNorse(4);
MARKOV_GENERATOR[6] = new MarkovAncientGreek(3);
MARKOV_GENERATOR[7] = new MarkovAztec(3);
MARKOV_GENERATOR[8] = new MarkovCustomNPCsClassic(3);
MARKOV_GENERATOR[9] = new MarkovSpanish(3);
}
@EventHandler @EventHandler
public void setAboutToStart(FMLServerAboutToStartEvent event) { public void setAboutToStart(FMLServerAboutToStartEvent event) {
ChunkController.instance.clear(); ChunkController.instance.clear();
@@ -248,10 +235,7 @@ public class CustomNpcs {
new SpawnController(); new SpawnController();
new LinkedNpcController(); new LinkedNpcController();
ScriptController.Instance.loadStoredData(); ScriptController.Instance.loadStoredData();
ScriptController.Instance.loadForgeScripts();
ScriptController.Instance.loadPlayerScripts();
ScriptController.HasStart = false; ScriptController.HasStart = false;
WrapperNpcAPI.clearCache();
Set<String> names = Block.blockRegistry.getKeys(); Set<String> names = Block.blockRegistry.getKeys();
for(String name : names){ for(String name : names){
@@ -315,33 +299,4 @@ public class CustomNpcs {
return null; return null;
} }
public static File getWorldSaveDirectory(String s) {
try {
File dir = new File(".");
if (getServer() != null) {
if (!getServer().isDedicatedServer()) {
dir = new File(Minecraft.getMinecraft().mcDataDir, "saves");
}
dir = new File(new File(dir, getServer().getFolderName()), "customnpcs");
}
if (s != null) {
dir = new File(dir, s);
}
if (!dir.exists()) {
dir.mkdirs();
}
return dir;
} catch (Exception var2) {
LogWriter.error("Error getting worldsave", var2);
return null;
}
}
public static MinecraftServer getServer(){
return MinecraftServer.getServer();
}
} }
+1 -6
View File
@@ -13,7 +13,7 @@ import noppes.npcs.constants.EnumStandingType;
import noppes.npcs.entity.EntityNPCInterface; import noppes.npcs.entity.EntityNPCInterface;
public class DataAI { public class DataAI {
private EntityNPCInterface npc; private EntityNPCInterface npc;
public int onAttack = 0; //0:fight 1:panic 2:retreat 3:nothing public int onAttack = 0; //0:fight 1:panic 2:retreat 3:nothing
public int doorInteract = 2; public int doorInteract = 2;
@@ -33,9 +33,6 @@ public class DataAI {
public int useRangeMelee = 0; public int useRangeMelee = 0;
public int tacticalRadius = 8; public int tacticalRadius = 8;
// Fly Change
public int movementType = 0;
public EnumAnimation animationType = EnumAnimation.NONE; public EnumAnimation animationType = EnumAnimation.NONE;
public EnumStandingType standingType = EnumStandingType.RotateBody; public EnumStandingType standingType = EnumStandingType.RotateBody;
public EnumMovingType movingType = EnumMovingType.Standing; public EnumMovingType movingType = EnumMovingType.Standing;
@@ -96,7 +93,6 @@ public class DataAI {
setMovingPath(NBTTags.getIntegerArraySet(compound.getTagList("MovingPathNew",10))); setMovingPath(NBTTags.getIntegerArraySet(compound.getTagList("MovingPathNew",10)));
movingPos = compound.getInteger("MovingPos"); movingPos = compound.getInteger("MovingPos");
movingPattern = compound.getInteger("MovingPatern"); movingPattern = compound.getInteger("MovingPatern");
movementType = compound.getInteger("MovingType");
startPos = compound.getIntArray("StartPosNew"); startPos = compound.getIntArray("StartPosNew");
if (startPos == null || startPos.length != 3){ if (startPos == null || startPos.length != 3){
@@ -143,7 +139,6 @@ public class DataAI {
compound.setTag("MovingPathNew", NBTTags.nbtIntegerArraySet(movingPath)); compound.setTag("MovingPathNew", NBTTags.nbtIntegerArraySet(movingPath));
compound.setInteger("MovingPos", movingPos); compound.setInteger("MovingPos", movingPos);
compound.setInteger("MovingPatern", movingPattern); compound.setInteger("MovingPatern", movingPattern);
compound.setInteger("MovingType", movementType);
npc.setAvoidWater(avoidsWater); npc.setAvoidWater(avoidsWater);
+6 -104
View File
@@ -1,15 +1,8 @@
package noppes.npcs; package noppes.npcs;
import java.util.ArrayList;
import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.UUID;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.nbt.NBTUtil; import net.minecraft.nbt.NBTUtil;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.StringUtils; import net.minecraft.util.StringUtils;
@@ -26,40 +19,25 @@ public class DataDisplay {
public String name; public String name;
public String title = ""; public String title = "";
private int markovGeneratorId = 8; //roman,japanese,slavic,welsh,sami,oldnorse,ancientgreek,aztec,classic,spanish (0 - 9 inclusively) public byte skinType = 0; //0:normal, 1:player, 2:url
private int markovGender = 0; //0:random, 1:male, 2:female
public byte skinType = 0; //0:normal, 1:player, 2:url, 3:url64
public String url = ""; public String url = "";
public GameProfile playerProfile; public GameProfile playerProfile;
public String texture = "customnpcs:textures/entity/humanmale/Steve.png"; public String texture = "customnpcs:textures/entity/humanmale/Steve.png";;
public String cloakTexture = ""; public String cloakTexture = "";
public String glowTexture = ""; public String glowTexture = "";
public int visible = 0; //0:visible 1:Invisible 2:semi-invisible public int visible = 0;//0:visible 1:Invisible 2:semi-invisible
public int modelSize = 5; public int modelSize = 5;
public int showName = 0; public int showName = 0;
public int modelType = 0;
public boolean disableLivingAnimation = false; public boolean disableLivingAnimation = false;
public byte showBossBar = 0; public byte showBossBar = 0;
public ArrayList<UUID> invisibleToList = new ArrayList<>();
public DataDisplay(EntityNPCInterface npc){ public DataDisplay(EntityNPCInterface npc){
this.npc = npc; this.npc = npc;
/*
Implementing MarkovNames generator. You can blame this blunder on Nikedemos.
Please refer to nikedemos.markovnames.generators.MarkovCustomNPCsClassic.java
String[] names = { "Noppes", "Noppes", "Noppes", "Noppes", "Atesson", String[] names = { "Noppes", "Noppes", "Noppes", "Noppes", "Atesson",
"Rothcersul", "Achdranys", "Pegato", "Chald", "Gareld", "Rothcersul", "Achdranys", "Pegato", "Chald", "Gareld",
"Nalworche", "Ineald", "Tia'kim", "Torerod", "Turturdar", "Nalworche", "Ineald", "Tia'kim", "Torerod", "Turturdar",
@@ -80,24 +58,13 @@ public class DataDisplay {
"Embrera", "Eldamore", "Faolan", "Chim", "Nasu", "Kathrine", "Ariel", "Arei", "Demytrix", "Embrera", "Eldamore", "Faolan", "Chim", "Nasu", "Kathrine", "Ariel", "Arei", "Demytrix",
"Kora", "Ava", "Larson", "Leonardo", "Wyrl", "Sakiama", "Lambton", "Kederath", "Malus", "Riplette", "Kora", "Ava", "Larson", "Leonardo", "Wyrl", "Sakiama", "Lambton", "Kederath", "Malus", "Riplette",
"Andern", "Ezall", "Lucien", "Droco", "Cray", "Tymen", "Zenix", "Entranger", "Andern", "Ezall", "Lucien", "Droco", "Cray", "Tymen", "Zenix", "Entranger",
"Saenorath", "Chris", "Christine", "Marble", "Mable", "Ross", "Rose", "Xalgan ", "Kennet", "Kamkeel" "Saenorath", "Chris", "Christine", "Marble", "Mable", "Ross", "Rose", "Xalgan ", "Kennet"
}; };
name = names[new Random().nextInt(names.length)]; name = names[new Random().nextInt(names.length)];
*/
markovGeneratorId = new Random().nextInt(CustomNpcs.MARKOV_GENERATOR.length-1);
name = getRandomName();
}
public String getRandomName() {
return CustomNpcs.MARKOV_GENERATOR[markovGeneratorId].fetch(markovGender);
} }
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setString("Name", name); nbttagcompound.setString("Name", name);
nbttagcompound.setInteger("MarkovGeneratorId", markovGeneratorId);
nbttagcompound.setInteger("MarkovGender", markovGender);
nbttagcompound.setString("Title", title); nbttagcompound.setString("Title", title);
nbttagcompound.setString("SkinUrl", url); nbttagcompound.setString("SkinUrl", url);
nbttagcompound.setString("Texture", texture); nbttagcompound.setString("Texture", texture);
@@ -113,7 +80,6 @@ public class DataDisplay {
} }
nbttagcompound.setInteger("Size", modelSize); nbttagcompound.setInteger("Size", modelSize);
nbttagcompound.setInteger("modelType", modelType);
nbttagcompound.setInteger("ShowName", showName); nbttagcompound.setInteger("ShowName", showName);
nbttagcompound.setInteger("NpcVisible", visible); nbttagcompound.setInteger("NpcVisible", visible);
@@ -121,25 +87,14 @@ public class DataDisplay {
nbttagcompound.setBoolean("NoLivingAnimation", disableLivingAnimation); nbttagcompound.setBoolean("NoLivingAnimation", disableLivingAnimation);
nbttagcompound.setByte("BossBar", showBossBar); nbttagcompound.setByte("BossBar", showBossBar);
NBTTagList list = new NBTTagList();
for(UUID uuid : invisibleToList){
list.appendTag(new NBTTagString(uuid.toString()));
}
nbttagcompound.setTag("InvisibleToList", list);
return nbttagcompound; return nbttagcompound;
} }
public void readToNBT(NBTTagCompound nbttagcompound) { public void readToNBT(NBTTagCompound nbttagcompound) {
setName(nbttagcompound.getString("Name")); name = nbttagcompound.getString("Name");
setMarkovGeneratorId(nbttagcompound.getInteger("MarkovGeneratorId"));
setMarkovGender(nbttagcompound.getInteger("MarkovGender"));
title = nbttagcompound.getString("Title"); title = nbttagcompound.getString("Title");
url = nbttagcompound.getString("SkinUrl"); url = nbttagcompound.getString("SkinUrl");
int prevSkinType = skinType;
int prevSkinType = skinType;
skinType = nbttagcompound.getByte("UsingSkinUrl"); skinType = nbttagcompound.getByte("UsingSkinUrl");
this.playerProfile = null; this.playerProfile = null;
@@ -160,7 +115,6 @@ public class DataDisplay {
glowTexture = nbttagcompound.getString("GlowTexture"); glowTexture = nbttagcompound.getString("GlowTexture");
modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, 30); modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, 30);
modelType = nbttagcompound.getInteger("modelType");
showName = nbttagcompound.getInteger("ShowName"); showName = nbttagcompound.getInteger("ShowName");
visible = nbttagcompound.getInteger("NpcVisible"); visible = nbttagcompound.getInteger("NpcVisible");
@@ -168,13 +122,6 @@ public class DataDisplay {
disableLivingAnimation = nbttagcompound.getBoolean("NoLivingAnimation"); disableLivingAnimation = nbttagcompound.getBoolean("NoLivingAnimation");
showBossBar = nbttagcompound.getByte("BossBar"); showBossBar = nbttagcompound.getByte("BossBar");
invisibleToList.clear();
NBTTagList tagList = (NBTTagList)nbttagcompound.getTag("InvisibleToList");
for(int i = 0; i < tagList.tagCount(); i++){
String nbtTagString = tagList.getStringTagAt(i);
invisibleToList.add(UUID.fromString(nbtTagString));
}
if(prevSkinType != skinType || !texture.equals(prevTexture)) if(prevSkinType != skinType || !texture.equals(prevTexture))
npc.textureLocation = null; npc.textureLocation = null;
npc.textureGlowLocation = null; npc.textureGlowLocation = null;
@@ -205,49 +152,4 @@ public class DataDisplay {
return false; return false;
return showName == 0 || (showName == 2 && npc.isAttacking()); return showName == 0 || (showName == 2 && npc.isAttacking());
} }
public String getSkinTexture(){
return texture;
}
public void setSkinTexture(String texture){
if(this.texture.equals(texture))
return;
this.texture = texture;
npc.textureLocation = null;
skinType = 0;
npc.updateClient = true;
}
public String getName(){
return name;
}
public void setName(String name){
if(this.name.equals(name))
return;
this.name = name;
npc.updateClient = true;
}
public int getMarkovGender(){
return markovGender;
}
public void setMarkovGender(int gender) {
if(markovGender == gender)
return;
this.markovGender = ValueUtil.CorrectInt(gender, 0, 2);
}
public int getMarkovGeneratorId(){
return markovGeneratorId;
}
public void setMarkovGeneratorId(int id) {
if(markovGeneratorId == id)
return;
this.markovGeneratorId = ValueUtil.CorrectInt(id, 0, CustomNpcs.MARKOV_GENERATOR.length-1);
}
} }
+14 -11
View File
@@ -15,14 +15,12 @@ import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.controllers.ScriptController; import noppes.npcs.controllers.ScriptController;
import noppes.npcs.entity.EntityCustomNpc; import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface; import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.event.ScriptEvent; import noppes.npcs.scripted.ScriptEvent;
import noppes.npcs.scripted.entity.ScriptNpc; import noppes.npcs.scripted.ScriptNpc;
import noppes.npcs.scripted.ScriptWorld; import noppes.npcs.scripted.ScriptWorld;
import noppes.npcs.scripted.constants.EntityType; import noppes.npcs.scripted.constants.EntityType;
import noppes.npcs.scripted.constants.JobType; import noppes.npcs.scripted.constants.JobType;
import noppes.npcs.scripted.constants.RoleType; import noppes.npcs.scripted.constants.RoleType;
import noppes.npcs.scripted.interfaces.IWorld;
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
public class DataScript { public class DataScript {
public Map<Integer,ScriptContainer> scripts = new HashMap<Integer,ScriptContainer>(); public Map<Integer,ScriptContainer> scripts = new HashMap<Integer,ScriptContainer>();
@@ -35,7 +33,7 @@ public class DataScript {
public boolean enabled = false; public boolean enabled = false;
public ScriptNpc dummyNpc; public ScriptNpc dummyNpc;
public IWorld dummyWorld; public ScriptWorld dummyWorld;
public boolean clientNeedsUpdate = false; public boolean clientNeedsUpdate = false;
public boolean aiNeedsUpdate = false; public boolean aiNeedsUpdate = false;
public boolean hasInited = false; public boolean hasInited = false;
@@ -112,8 +110,18 @@ public class DataScript {
ob = ScriptController.Instance.getScriptForEntity((Entity)ob); ob = ScriptController.Instance.getScriptForEntity((Entity)ob);
script.engine.put(obs[i].toString(), ob); script.engine.put(obs[i].toString(), ob);
} }
try {
return callScript(script);
}
catch(Throwable e) {
script.errored = true;
script.appandConsole(e.getMessage());
return false;
}
}
return callScript(script); public boolean isEnabled(){
return enabled && ScriptController.HasStart && !npc.worldObj.isRemote && !scripts.isEmpty();
} }
private boolean callScript(ScriptContainer script){ private boolean callScript(ScriptContainer script){
@@ -123,7 +131,6 @@ public class DataScript {
ScriptEvent result = (ScriptEvent) engine.get("event"); ScriptEvent result = (ScriptEvent) engine.get("event");
if(result == null) if(result == null)
engine.put("event", result = new ScriptEvent()); engine.put("event", result = new ScriptEvent());
engine.put("API", new WrapperNpcAPI());
engine.put("EntityType", entities); engine.put("EntityType", entities);
engine.put("RoleType", roles); engine.put("RoleType", roles);
engine.put("JobType", jobs); engine.put("JobType", jobs);
@@ -140,10 +147,6 @@ public class DataScript {
return result.isCancelled(); return result.isCancelled();
} }
public boolean isEnabled(){
return enabled && ScriptController.HasStart && !npc.worldObj.isRemote && !scripts.isEmpty();
}
public void setWorld(World world) { public void setWorld(World world) {
if(world instanceof WorldServer) if(world instanceof WorldServer)
dummyWorld = new ScriptWorld((WorldServer) world); dummyWorld = new ScriptWorld((WorldServer) world);
-313
View File
@@ -1,313 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.world.WorldEvent;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.PlayerDataScript;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.*;
import noppes.npcs.scripted.event.*;
import noppes.npcs.scripted.event.PlayerEvent.ChatEvent;
import noppes.npcs.scripted.event.PlayerEvent.ContainerOpen;
import noppes.npcs.scripted.event.PlayerEvent.DamagedEntityEvent;
import noppes.npcs.scripted.event.PlayerEvent.KeyPressedEvent;
import noppes.npcs.scripted.event.PlayerEvent.LoginEvent;
import noppes.npcs.scripted.event.PlayerEvent.LogoutEvent;
import noppes.npcs.scripted.event.PlayerEvent.PickUpEvent;
import noppes.npcs.scripted.event.PlayerEvent.DropEvent;
import noppes.npcs.scripted.interfaces.IEntity;
import noppes.npcs.scripted.interfaces.IItemStack;
import noppes.npcs.scripted.interfaces.IWorld;
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
import noppes.npcs.constants.EnumScriptType;
import noppes.npcs.controllers.PlayerData;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
public class EventHooks {
public EventHooks() {
}
public static void onNPCTimer(EntityNPCInterface npc, int id) {
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
ScriptEventTimer scriptEvent = new ScriptEventTimer(id);
npc.script.callScript(EnumScriptType.TIMER, "event", scriptEvent);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerInit(PlayerDataScript handler) {
noppes.npcs.scripted.event.PlayerEvent.InitEvent event = new noppes.npcs.scripted.event.PlayerEvent.InitEvent(handler.getPlayer());
handler.callScript(EnumScriptType.INIT, event, "event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerTick(PlayerDataScript handler) {
noppes.npcs.scripted.event.PlayerEvent.UpdateEvent event = new noppes.npcs.scripted.event.PlayerEvent.UpdateEvent(handler.getPlayer());
handler.callScript(EnumScriptType.TICK, event, "event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onPlayerInteract(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.InteractEvent event) {
handler.callScript(EnumScriptType.INTERACT, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onStartUsingItem(PlayerDataScript handler, int duration, ItemStack item){
PlayerEvent.StartUsingItem event = new PlayerEvent.StartUsingItem(handler.getPlayer(), item, duration);
handler.callScript(EnumScriptType.START_USING_ITEM, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onUsingItem(PlayerDataScript handler, int duration, ItemStack item){
PlayerEvent.UsingItem event = new PlayerEvent.UsingItem(handler.getPlayer(), item, duration);
handler.callScript(EnumScriptType.USING_ITEM, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onStopUsingItem(PlayerDataScript handler, int duration, ItemStack item){
PlayerEvent.StopUsingItem event = new PlayerEvent.StopUsingItem(handler.getPlayer(), item, duration);
handler.callScript(EnumScriptType.STOP_USING_ITEM, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onFinishUsingItem(PlayerDataScript handler, int duration, ItemStack item){
PlayerEvent.FinishUsingItem event = new PlayerEvent.FinishUsingItem(handler.getPlayer(), item, duration);
handler.callScript(EnumScriptType.FINISH_USING_ITEM, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onPlayerDropItems(PlayerDataScript handler, ArrayList<EntityItem> entityItems) {
IItemStack[] items = new IItemStack[entityItems.size()];
for(int i = 0; i < entityItems.size(); i++){ items[i] = NpcAPI.Instance().getIItemStack(entityItems.get(i).getEntityItem()); }
DropEvent event = new DropEvent(handler.getPlayer(), items);
handler.callScript(EnumScriptType.DROP, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerPickupXP(PlayerDataScript handler, EntityXPOrb orb) {
PlayerEvent.PickupXPEvent event = new PlayerEvent.PickupXPEvent(handler.getPlayer(), orb);
handler.callScript(EnumScriptType.PICKUP_XP, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onPlayerToss(PlayerDataScript handler, EntityItem entityItem) {
PlayerEvent.TossEvent event = new PlayerEvent.TossEvent(handler.getPlayer(), NpcAPI.Instance().getIItemStack(entityItem.getEntityItem()));
handler.callScript(EnumScriptType.TOSS, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onPlayerPickUp(PlayerDataScript handler, EntityItem entityItem) {
PickUpEvent event = new PickUpEvent(handler.getPlayer(), new ScriptItemStack(entityItem.getEntityItem()));//NpcAPI.Instance().getIItemStack(entityItem.getEntityItem()));
handler.callScript(EnumScriptType.PICKUP, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerContainerOpen(PlayerDataScript handler, Container container) {
ContainerOpen event = new ContainerOpen(handler.getPlayer(), NpcAPI.Instance().getIContainer(container));
handler.callScript(EnumScriptType.CONTAINER_OPEN, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerUseHoe(PlayerDataScript handler, ItemStack hoe, int x, int y, int z) {
noppes.npcs.scripted.event.PlayerEvent.UseHoe event = new noppes.npcs.scripted.event.PlayerEvent.UseHoe(handler.getPlayer(), hoe, x, y, z);
handler.callScript(EnumScriptType.USE_HOE, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerSleep(PlayerDataScript handler, int x, int y, int z) {
noppes.npcs.scripted.event.PlayerEvent.Sleep event = new noppes.npcs.scripted.event.PlayerEvent.Sleep(handler.getPlayer(), x, y, z);
handler.callScript(EnumScriptType.SLEEP, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerWakeUp(PlayerDataScript handler, boolean setSpawn) {
noppes.npcs.scripted.event.PlayerEvent.WakeUp event = new noppes.npcs.scripted.event.PlayerEvent.WakeUp(handler.getPlayer(), setSpawn);
handler.callScript(EnumScriptType.WAKE_UP, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerDeath(PlayerDataScript handler, DamageSource source, Entity entity) {
noppes.npcs.scripted.event.PlayerEvent.DiedEvent event = new noppes.npcs.scripted.event.PlayerEvent.DiedEvent(handler.getPlayer(), source, entity);
handler.callScript(EnumScriptType.KILLED, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerKills(PlayerDataScript handler, EntityLivingBase entityLiving) {
noppes.npcs.scripted.event.PlayerEvent.KilledEntityEvent event = new noppes.npcs.scripted.event.PlayerEvent.KilledEntityEvent(handler.getPlayer(), entityLiving);
handler.callScript(EnumScriptType.KILLS, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onPlayerDamaged(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.DamagedEvent event) {
handler.callScript(EnumScriptType.DAMAGED, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onPlayerLightning(PlayerDataScript handler) {
PlayerEvent.LightningEvent event = new PlayerEvent.LightningEvent(handler.getPlayer());
handler.callScript(EnumScriptType.LIGHTNING, event, "event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onPlayerSound(PlayerDataScript handler, String name, float pitch, float volume) {
PlayerEvent.SoundEvent event = new PlayerEvent.SoundEvent(handler.getPlayer(), name, pitch, volume);
handler.callScript(EnumScriptType.PLAYSOUND, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerFall(PlayerDataScript handler, float distance) {
PlayerEvent.FallEvent event = new PlayerEvent.FallEvent(handler.getPlayer(),distance);
handler.callScript(EnumScriptType.FALL, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerJump(PlayerDataScript handler) {
PlayerEvent.JumpEvent event = new PlayerEvent.JumpEvent(handler.getPlayer());
handler.callScript(EnumScriptType.JUMP, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerLogin(PlayerDataScript handler) {
LoginEvent event = new LoginEvent(handler.getPlayer());
handler.callScript(EnumScriptType.LOGIN, event, "event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerAchievement(PlayerDataScript handler, String description) {
PlayerEvent.Achievement event = new PlayerEvent.Achievement(handler.getPlayer(), description);
handler.callScript(EnumScriptType.ACHIEVEMENT, event, "event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerFillBucket(PlayerDataScript handler, ItemStack current, ItemStack result) {
PlayerEvent.FillBucket event = new PlayerEvent.FillBucket(handler.getPlayer(), current, result);
handler.callScript(EnumScriptType.FILL_BUCKET, event, "event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerBonemeal(PlayerDataScript handler, int x, int y, int z, World world) {
PlayerEvent.Bonemeal event = new PlayerEvent.Bonemeal(handler.getPlayer(), x, y, z, world);
handler.callScript(EnumScriptType.BONEMEAL, event, "event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerRespawn(PlayerDataScript handler) {
PlayerEvent.RespawnEvent event = new PlayerEvent.RespawnEvent(handler.getPlayer());
handler.callScript(EnumScriptType.RESPAWN, event, "event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerLogout(PlayerDataScript handler) {
LogoutEvent event = new LogoutEvent(handler.getPlayer());
handler.callScript(EnumScriptType.LOGOUT, event, "event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerChat(PlayerDataScript handler, ChatEvent event) {
handler.callScript(EnumScriptType.CHAT, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onPlayerBowCharge(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.RangedChargeEvent event) {
handler.callScript(EnumScriptType.RANGED_CHARGE, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onPlayerRanged(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.RangedLaunchedEvent event) {
handler.callScript(EnumScriptType.RANGED_LAUNCHED, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onPlayerDamagedEntity(PlayerDataScript handler, DamagedEntityEvent event) {
handler.callScript(EnumScriptType.DAMAGED_ENTITY, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerChangeDim(PlayerDataScript handler, int fromDim, int toDim) {
PlayerEvent.ChangedDimension event = new PlayerEvent.ChangedDimension(handler.getPlayer(), fromDim, toDim);
handler.callScript(EnumScriptType.CHANGED_DIM, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerMouseClicked(EntityPlayerMP player, int button, int mouseWheel, boolean buttonDown) {
PlayerDataScript handler = PlayerData.get(player).scriptData;
PlayerEvent.MouseClickedEvent event = new PlayerEvent.MouseClickedEvent(handler.getPlayer(), button, mouseWheel, buttonDown);
handler.callScript(EnumScriptType.MOUSE_CLICKED, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerKeyPressed(EntityPlayerMP player, int button, boolean isCtrlPressed, boolean isShiftPressed, boolean isAltPressed, boolean isMetaPressed, boolean buttonDown) {
PlayerDataScript handler = PlayerData.get(player).scriptData;
KeyPressedEvent event = new KeyPressedEvent(handler.getPlayer(), button, isCtrlPressed, isAltPressed, isShiftPressed, isMetaPressed, buttonDown);
handler.callScript(EnumScriptType.KEY_PRESSED, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onPlayerTimer(PlayerData data, int id) {
PlayerDataScript handler = data.scriptData;
noppes.npcs.scripted.event.PlayerEvent.TimerEvent event = new noppes.npcs.scripted.event.PlayerEvent.TimerEvent(handler.getPlayer(), id);
handler.callScript(EnumScriptType.TIMER, event,"event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onPlayerBreak(PlayerDataScript handler, PlayerEvent.BreakEvent event) {
handler.callScript(EnumScriptType.BREAK_BLOCK, event,"event", event);
return WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onForgeEntityEvent(EntityEvent event) {
IEntity e = NpcAPI.Instance().getIEntity(event.entity);
onForgeEvent(new noppes.npcs.scripted.event.ForgeEvent.EntityEvent(event, e), event);
}
public static void onForgeWorldEvent(WorldEvent event) {
if(ScriptController.Instance.forgeScripts.isEnabled()) {
IWorld e = NpcAPI.Instance().getIWorld((WorldServer)event.world);
onForgeEvent(new noppes.npcs.scripted.event.ForgeEvent.WorldEvent(event, e), event);
}
}
public static void onForgeInit(ForgeDataScript handler) {
noppes.npcs.scripted.event.ForgeEvent.InitEvent event = new noppes.npcs.scripted.event.ForgeEvent.InitEvent();
handler.callScript("init", event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onForgeEvent(ForgeEvent ev, Event event) {
ForgeDataScript handler = ScriptController.Instance.forgeScripts;
if(handler.isEnabled()) {
String eventName = event.getClass().getName();
int i = eventName.lastIndexOf(".");
eventName = StringUtils.uncapitalize(eventName.substring(i + 1).replace("$", ""));
if(event.isCancelable()) {
ev.setCanceled(event.isCanceled());
}
handler.callScript(eventName, event);
WrapperNpcAPI.EVENT_BUS.post(ev);
if(event.isCancelable()) {
event.setCanceled(ev.isCanceled());
}
}
}
}
@@ -1,172 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
import javax.script.Compilable;
import javax.script.CompiledScript;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.constants.EnumScriptType;
import noppes.npcs.controllers.IScriptHandler;
import noppes.npcs.controllers.ScriptController;
public class EventScriptContainer {
public static EventScriptContainer Current;
//public String type = "init";
private static String CurrentType;
public String fullscript = "";
public String script = "";
public TreeMap<Long, String> console = new TreeMap();
private HashSet<String> unknownFunctions = new HashSet();
public boolean errored = false;
public List<String> scripts = new ArrayList();
public long lastCreated = 0L;
private String currentScriptLanguage = null;
public ScriptEngine engine = null;
private IScriptHandler handler = null;
private CompiledScript compScript = null;
private boolean init = false;
public EventScriptContainer(IScriptHandler handler) {
this.handler = handler;
}
public void readFromNBT(NBTTagCompound compound) {
this.script = compound.getString("Script");
//this.type = compound.getString("Type");
this.console = NBTTags.GetLongStringMap(compound.getTagList("Console", 10));
this.scripts = NBTTags.getStringList(compound.getTagList("ScriptList", 10));
this.lastCreated = 0L;
}
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setString("Script", this.script);
//compound.setString("Type", this.type);
compound.setTag("Console", NBTTags.NBTLongStringMap(this.console));
compound.setTag("ScriptList", NBTTags.nbtStringList(this.scripts));
return compound;
}
private String getFullCode() {
if(!this.init) {
this.fullscript = this.script;
if(!this.fullscript.isEmpty()) {
this.fullscript = this.fullscript + "\n";
}
Iterator var1 = this.scripts.iterator();
while(var1.hasNext()) {
String loc = (String)var1.next();
String code = (String)ScriptController.Instance.scripts.get(loc);
if(code != null && !code.isEmpty()) {
this.fullscript = this.fullscript + code + "\n";
}
}
}
return this.fullscript;
}
/*public void run(ScriptEngine engine){
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
engine.getContext().setWriter(pw);
engine.getContext().setErrorWriter(pw);
try {
if(compScript == null && engine instanceof Compilable)
compScript = ((Compilable)engine).compile(getFullCode());
if(compScript != null){
compScript.eval(engine.getContext());
}
else
engine.eval(getFullCode());
} catch (Exception e) {
errored = true;
appandConsole(e.getMessage());
}
appandConsole(sw.getBuffer().toString().trim());
}*/
public void run(EnumScriptType type, Event event) {
this.run((String)type.function, (Object)event);
}
public void run(String type, Object event) {
if (!this.errored && this.hasCode() && !this.unknownFunctions.contains(type)) {
this.setEngine(this.handler.getLanguage());
if (this.engine != null) {
if (ScriptController.Instance.lastLoaded > this.lastCreated) {
this.lastCreated = ScriptController.Instance.lastLoaded;
this.init = false;
}
String var3 = "lock";
synchronized("lock") {
Current = this;
CurrentType = type;
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
this.engine.getContext().setWriter(pw);
this.engine.getContext().setErrorWriter(pw);
try {
if (!this.init) {
this.engine.eval(this.getFullCode());
this.init = true;
}
((Invocable)this.engine).invokeFunction(type, new Object[]{event});
} catch (NoSuchMethodException var13) {
this.unknownFunctions.add(type);
} catch (Throwable var14) {
this.errored = true;
var14.printStackTrace(pw);
} finally {
this.appandConsole(sw.getBuffer().toString().trim());
pw.close();
Current = null;
}
}
}
}
}
public void appandConsole(String message) {
if (message != null && !message.isEmpty()) {
long time = System.currentTimeMillis();
if (this.console.containsKey(time)) {
message = (String)this.console.get(time) + "\n" + message;
}
this.console.put(time, message);
while(this.console.size() > 40) {
this.console.remove(this.console.firstKey());
}
}
}
public boolean hasCode() {
return !this.getFullCode().isEmpty();
}
public void setEngine(String scriptLanguage) {
if(currentScriptLanguage != null && currentScriptLanguage.equals(scriptLanguage))
return;
engine = ScriptController.Instance.getEngineByName(scriptLanguage.toLowerCase());
currentScriptLanguage = scriptLanguage;
}
}
@@ -28,17 +28,7 @@ public class ModelDataShared{
private HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>(); private HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
public byte breasts = 0; public byte breasts = 0;
// Enabled vs Disabled
public byte headwear = 2; public byte headwear = 2;
public byte bodywear = 0;
public byte armwear = 0;
public byte legwear = 0;
// Hide Body Parts [0: None, 1: Both, 2: Right, 3: Left],
public byte hideHead = 0;
public byte hideBody = 0;
public byte hideArms = 0;
public byte hideLegs = 0;
public NBTTagCompound writeToNBT(){ public NBTTagCompound writeToNBT(){
NBTTagCompound compound = new NBTTagCompound(); NBTTagCompound compound = new NBTTagCompound();
@@ -54,15 +44,6 @@ public class ModelDataShared{
compound.setTag("LegParts", legParts.writeToNBT()); compound.setTag("LegParts", legParts.writeToNBT());
compound.setByte("Headwear", headwear); compound.setByte("Headwear", headwear);
compound.setByte("Bodywear", bodywear);
compound.setByte("Armwear", armwear);
compound.setByte("Legwear", legwear);
compound.setByte("hideHead", hideHead);
compound.setByte("hideBody", hideBody);
compound.setByte("hideArms", hideArms);
compound.setByte("hideLegs", hideLegs);
compound.setByte("Breasts", breasts); compound.setByte("Breasts", breasts);
compound.setTag("ExtraData", extra); compound.setTag("ExtraData", extra);
@@ -88,15 +69,6 @@ public class ModelDataShared{
legParts.readFromNBT(compound.getCompoundTag("LegParts")); legParts.readFromNBT(compound.getCompoundTag("LegParts"));
headwear = compound.getByte("Headwear"); headwear = compound.getByte("Headwear");
bodywear = compound.getByte("Bodywear");
armwear = compound.getByte("Armwear");
legwear = compound.getByte("Legwear");
hideHead = compound.getByte("hideHead");
hideBody = compound.getByte("hideBody");
hideArms = compound.getByte("hideArms");
hideLegs = compound.getByte("hideLegs");
breasts = compound.getByte("Breasts"); breasts = compound.getByte("Breasts");
extra = compound.getCompoundTag("ExtraData"); extra = compound.getCompoundTag("ExtraData");
+4 -4
View File
@@ -55,7 +55,7 @@ public class ModelPartData {
this.texture = texture; this.texture = texture;
} }
else{ else{
this.texture = "customnpcs:textures/parts/"+ texture + ".png"; this.texture = "moreplayermodels:textures/"+ texture + ".png";
playerTexture = false; playerTexture = false;
} }
} }
@@ -67,9 +67,9 @@ public class ModelPartData {
public String getColor() { public String getColor() {
String str = Integer.toHexString(color); String str = Integer.toHexString(color);
while(str.length() < 6) while(str.length() < 6)
str = "0" + str; str = "0" + str;
return str; return str;
} }
} }
+7 -58
View File
@@ -1,13 +1,18 @@
package noppes.npcs; package noppes.npcs;
import java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Vector;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble; import net.minecraft.nbt.NBTTagDouble;
import net.minecraft.nbt.NBTTagInt;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import noppes.npcs.controllers.IScriptHandler;
public class NBTTags { public class NBTTags {
@@ -378,60 +383,4 @@ public class NBTTags {
return compound; return compound;
} }
public static TreeMap<Long, String> GetLongStringMap(NBTTagList tagList) {
TreeMap list = new TreeMap();
for(int i = 0; i < tagList.tagCount(); ++i) {
NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i);
list.put(Long.valueOf(nbttagcompound.getLong("Long")), nbttagcompound.getString("String"));
}
return list;
}
public static NBTTagList NBTLongStringMap(Map<Long, String> map) {
NBTTagList nbttaglist = new NBTTagList();
if(map == null) {
return nbttaglist;
} else {
Iterator var2 = map.keySet().iterator();
while(var2.hasNext()) {
long slot = ((Long)var2.next()).longValue();
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setLong("Long", slot);
nbttagcompound.setString("String", (String) map.get(Long.valueOf(slot)));
nbttaglist.appendTag(nbttagcompound);
}
return nbttaglist;
}
}
public static List<EventScriptContainer> GetScript(NBTTagList list, IScriptHandler handler) {
ArrayList scripts = new ArrayList();
for(int i = 0; i < list.tagCount(); ++i) {
NBTTagCompound compoundd = list.getCompoundTagAt(i);
EventScriptContainer script = new EventScriptContainer(handler);
script.readFromNBT(compoundd);
scripts.add(script);
}
return scripts;
}
public static NBTTagList NBTScript(List<EventScriptContainer> scripts) {
NBTTagList list = new NBTTagList();
Iterator var2 = scripts.iterator();
while(var2.hasNext()) {
EventScriptContainer script = (EventScriptContainer)var2.next();
NBTTagCompound compound = new NBTTagCompound();
script.writeToNBT(compound);
list.appendTag(compound);
}
return list;
}
} }
@@ -111,28 +111,6 @@ public class NoppesUtilPlayer {
player.worldObj.updateEntityWithOptionalForce(player, false); player.worldObj.updateEntityWithOptionalForce(player, false);
} }
public static void teleportPlayer(EntityPlayerMP player, double posX, double posY, double posZ, float yaw, float pitch, int dimension){
if(player.dimension != dimension){
int dim = player.dimension;
MinecraftServer server = MinecraftServer.getServer();
WorldServer wor = server.worldServerForDimension(dimension);
if(wor == null){
player.addChatMessage(new ChatComponentText("Broken transporter. Dimenion does not exist"));
return;
}
player.setLocationAndAngles(posX, posY, posZ, yaw, pitch);
server.getConfigurationManager().transferPlayerToDimension(player, dimension, new CustomTeleporter(wor));
player.playerNetServerHandler.setPlayerLocation(posX, posY, posZ, yaw, pitch);
if(!wor.playerEntities.contains(player))
wor.spawnEntityInWorld(player);
}
else{
player.playerNetServerHandler.setPlayerLocation(posX, posY, posZ, yaw, pitch);
}
player.worldObj.updateEntityWithOptionalForce(player, false);
}
private static void followerBuy(RoleFollower role,IInventory currencyInv,EntityPlayerMP player, EntityNPCInterface npc){ private static void followerBuy(RoleFollower role,IInventory currencyInv,EntityPlayerMP player, EntityNPCInterface npc){
ItemStack currency = currencyInv.getStackInSlot(0); ItemStack currency = currencyInv.getStackInSlot(0);
if(currency == null) if(currency == null)
@@ -397,7 +375,5 @@ public class NoppesUtilPlayer {
} }
} }
} }
public static void isGUIOpen(EntityPlayerMP player){
Server.sendData(player, EnumPacketClient.ISGUIOPEN);
}
} }
@@ -14,7 +14,6 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.server.CommandBlockLogic; import net.minecraft.command.server.CommandBlockLogic;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
@@ -22,8 +21,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -34,8 +31,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityCommandBlock; import net.minecraft.tileentity.TileEntityCommandBlock;
import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import noppes.npcs.constants.EnumGuiType; import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.constants.EnumPacketClient; import noppes.npcs.constants.EnumPacketClient;
@@ -72,7 +69,7 @@ import noppes.npcs.controllers.TransportLocation;
import noppes.npcs.entity.EntityDialogNpc; import noppes.npcs.entity.EntityDialogNpc;
import noppes.npcs.entity.EntityNPCInterface; import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.roles.RoleTransporter; import noppes.npcs.roles.RoleTransporter;
import noppes.npcs.scripted.event.ScriptEventDialog; import noppes.npcs.scripted.ScriptEventDialog;
public class NoppesUtilServer { public class NoppesUtilServer {
private static HashMap<String,Quest> editingQuests = new HashMap<String,Quest>(); private static HashMap<String,Quest> editingQuests = new HashMap<String,Quest>();
@@ -220,19 +217,6 @@ public class NoppesUtilServer {
logic.func_145755_a(executer.worldObj); logic.func_145755_a(executer.worldObj);
} }
public static void runCommand(World world, String name, String command) {
TileEntityCommandBlock tile = new TileEntityCommandBlock();
tile.setWorldObj(world.provider.worldObj);
tile.xCoord = 0;
tile.yCoord = 0;
tile.zCoord = 0;
CommandBlockLogic logic = tile.func_145993_a();
logic.func_145752_a(command);
logic.func_145754_b("@"+name);
logic.func_145755_a(world);
}
public static void consumeItemStack(int i, EntityPlayer player){ public static void consumeItemStack(int i, EntityPlayer player){
ItemStack item = player.inventory.getCurrentItem(); ItemStack item = player.inventory.getCurrentItem();
if(player.capabilities.isCreativeMode || item == null) if(player.capabilities.isCreativeMode || item == null)
@@ -307,22 +291,6 @@ public class NoppesUtilServer {
Server.sendAssociatedData(entity, EnumPacketClient.PARTICLE, entity.posX, entity.posY, entity.posZ, entity.height, entity.width, entity.yOffset, particle); Server.sendAssociatedData(entity, EnumPacketClient.PARTICLE, entity.posX, entity.posY, entity.posZ, entity.height, entity.width, entity.yOffset, particle);
} }
public static void spawnScriptedParticle(Entity entity, String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
float scale1, float scale2, float scaleRate, int scaleRateStart,
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
int entityID
){
Server.sendAssociatedData(entity, EnumPacketClient.SCRIPTED_PARTICLE,
directory, HEXcolor, amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
alpha1, alpha2, alphaRate, alphaRateStart,
entityID
);
}
public static void deleteNpc(EntityNPCInterface npc,EntityPlayer player) { public static void deleteNpc(EntityNPCInterface npc,EntityPlayer player) {
Server.sendAssociatedData(npc, EnumPacketClient.DELETE_NPC, npc.getEntityId()); Server.sendAssociatedData(npc, EnumPacketClient.DELETE_NPC, npc.getEntityId());
@@ -356,8 +324,7 @@ public class NoppesUtilServer {
Map<String,Integer> map = new HashMap<String,Integer>(); Map<String,Integer> map = new HashMap<String,Integer>();
if(type == EnumPlayerData.Players){ if(type == EnumPlayerData.Players){
File loc = PlayerDataController.instance.getSaveDir(); for(String username : PlayerDataController.instance.nameUUIDs.keySet()){
for(String username : PlayerDataController.instance.getUsernameData().keySet()){
map.put(username, 0); map.put(username, 0);
} }
} }
@@ -690,25 +657,4 @@ public class NoppesUtilServer {
} }
return null; return null;
} }
public static Entity GetDamageSourcee(DamageSource damagesource) {
Object entity = damagesource.getEntity();
if(entity == null) {
entity = damagesource.getSourceOfDamage();
}
if(entity instanceof EntityArrow && ((EntityArrow)entity).shootingEntity instanceof EntityLivingBase) {
entity = ((EntityArrow)entity).shootingEntity;
} else if(entity instanceof EntityThrowable) {
entity = ((EntityThrowable)entity).getThrower();
}
return (Entity)entity;
}
public static void isGUIOpen(ByteBuf buffer, EntityPlayer player) throws IOException {
PlayerData playerdata = PlayerDataController.instance.getPlayerData(player);
boolean isGUIOpen = buffer.readBoolean();
playerdata.setGUIOpen(isGUIOpen);
}
} }
@@ -22,7 +22,13 @@ import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.constants.EnumPlayerPacket; import noppes.npcs.constants.EnumPlayerPacket;
import noppes.npcs.constants.EnumRoleType; import noppes.npcs.constants.EnumRoleType;
import noppes.npcs.containers.ContainerMail; import noppes.npcs.containers.ContainerMail;
import noppes.npcs.controllers.*; import noppes.npcs.controllers.BankData;
import noppes.npcs.controllers.PlayerDataController;
import noppes.npcs.controllers.PlayerFactionData;
import noppes.npcs.controllers.PlayerMail;
import noppes.npcs.controllers.PlayerMailData;
import noppes.npcs.controllers.PlayerQuestController;
import noppes.npcs.controllers.PlayerQuestData;
import noppes.npcs.entity.EntityNPCInterface; import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.roles.RoleCompanion; import noppes.npcs.roles.RoleCompanion;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -61,31 +67,17 @@ public class PacketHandlerPlayer{
return; return;
NoppesUtilServer.sendOpenGui(player, EnumGuiType.CompanionInv, npc); NoppesUtilServer.sendOpenGui(player, EnumGuiType.CompanionInv, npc);
} }
else if(type == EnumPlayerPacket.KeyPressed) {
if(ScriptController.Instance.languages.isEmpty()) {
return;
}
EventHooks.onPlayerKeyPressed(player, buffer.readInt(), buffer.readBoolean(), buffer.readBoolean(), buffer.readBoolean(), buffer.readBoolean(), buffer.readBoolean());
}
else if(type == EnumPlayerPacket.MouseClicked) {
if(ScriptController.Instance.languages.isEmpty()) {
return;
}
EventHooks.onPlayerMouseClicked(player, buffer.readInt(), buffer.readInt(), buffer.readBoolean());
}
else if(type == EnumPlayerPacket.FollowerHire){ else if(type == EnumPlayerPacket.FollowerHire){
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
if(npc == null || npc.advanced.role != EnumRoleType.Follower) if(npc == null || npc.advanced.role != EnumRoleType.Follower)
return; return;
NoppesUtilPlayer.hireFollower(player, npc); NoppesUtilPlayer.hireFollower(player,npc);
} }
else if(type == EnumPlayerPacket.FollowerExtend){ else if(type == EnumPlayerPacket.FollowerExtend){
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
if(npc == null || npc.advanced.role != EnumRoleType.Follower) if(npc == null || npc.advanced.role != EnumRoleType.Follower)
return; return;
NoppesUtilPlayer.extendFollower(player, npc); NoppesUtilPlayer.extendFollower(player,npc);
Server.sendData(player, EnumPacketClient.GUI_DATA, npc.roleInterface.writeToNBT(new NBTTagCompound())); Server.sendData(player, EnumPacketClient.GUI_DATA, npc.roleInterface.writeToNBT(new NBTTagCompound()));
} }
else if(type == EnumPlayerPacket.FollowerState){ else if(type == EnumPlayerPacket.FollowerState){
@@ -132,17 +124,17 @@ public class PacketHandlerPlayer{
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
if(npc == null) if(npc == null)
return; return;
NoppesUtilPlayer.dialogSelected(buffer.readInt(), buffer.readInt(), player, npc); NoppesUtilPlayer.dialogSelected(buffer.readInt(),buffer.readInt(),player,npc);
} }
else if(type == EnumPlayerPacket.CheckQuestCompletion){ else if(type == EnumPlayerPacket.CheckQuestCompletion){
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData; PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
playerdata.checkQuestCompletion(player, null); playerdata.checkQuestCompletion(player,null);
} }
else if(type == EnumPlayerPacket.QuestLog){ else if(type == EnumPlayerPacket.QuestLog){
NoppesUtilPlayer.sendQuestLogData(player); NoppesUtilPlayer.sendQuestLogData(player);
} }
else if(type == EnumPlayerPacket.QuestCompletion){ else if(type == EnumPlayerPacket.QuestCompletion){
NoppesUtilPlayer.questCompletion(player, buffer.readInt()); NoppesUtilPlayer.questCompletion(player,buffer.readInt());
} }
else if(type == EnumPlayerPacket.FactionsGet){ else if(type == EnumPlayerPacket.FactionsGet){
PlayerFactionData data = PlayerDataController.instance.getPlayerData(player).factionData; PlayerFactionData data = PlayerDataController.instance.getPlayerData(player).factionData;
@@ -9,6 +9,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.passive.EntityVillager;
@@ -61,8 +62,6 @@ import noppes.npcs.controllers.SpawnController;
import noppes.npcs.controllers.SpawnData; import noppes.npcs.controllers.SpawnData;
import noppes.npcs.controllers.TransportController; import noppes.npcs.controllers.TransportController;
import noppes.npcs.controllers.TransportLocation; import noppes.npcs.controllers.TransportLocation;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.PlayerDataScript;
import noppes.npcs.entity.EntityCustomNpc; import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface; import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.roles.JobSpawner; import noppes.npcs.roles.JobSpawner;
@@ -89,19 +88,13 @@ public class PacketHandlerServer{
ItemStack item = player.inventory.getCurrentItem(); ItemStack item = player.inventory.getCurrentItem();
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
if(type == EnumPacketServer.IsGuiOpen) {
isGuiOpenPacket(buffer, player);
return;
}
if(type.needsNpc && npc == null){ if(type.needsNpc && npc == null){
} }
else if(type.hasPermission() && !CustomNpcsPermissions.Instance.hasPermission(player, type.permission)){ else if(type.hasPermission() && !CustomNpcsPermissions.Instance.hasPermission(player, type.permission)){
//player doesnt have permission to do this //player doesnt have permission todo this
} }
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave)) else if(item == null )
warn(player, "tried to use custom npcs without a tool in hand, probably a hacker"); warn(player, "tried to use custom npcs without a tool in hand, probably a hacker");
else if(item.getItem() == CustomItems.wand) else if(item.getItem() == CustomItems.wand)
wandPackets(type, buffer, player, npc); wandPackets(type, buffer, player, npc);
@@ -113,10 +106,6 @@ public class PacketHandlerServer{
clonePackets(type, buffer, player); clonePackets(type, buffer, player);
else if(item.getItem() == CustomItems.teleporter) else if(item.getItem() == CustomItems.teleporter)
featherPackets(type, buffer, player); featherPackets(type, buffer, player);
else if(type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
playerScriptPackets(type, buffer, player);
else if(type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave)
forgeScriptPackets(type, buffer, player);
else if(item.getItem() == CustomItems.scripter) else if(item.getItem() == CustomItems.scripter)
scriptPackets(type, buffer, player, npc); scriptPackets(type, buffer, player, npc);
else if(item.getItem() == Item.getItemFromBlock(CustomItems.waypoint) || item.getItem() == Item.getItemFromBlock(CustomItems.border) || item.getItem() == Item.getItemFromBlock(CustomItems.redstoneBlock)) else if(item.getItem() == Item.getItemFromBlock(CustomItems.waypoint) || item.getItem() == Item.getItemFromBlock(CustomItems.border) || item.getItem() == Item.getItemFromBlock(CustomItems.redstoneBlock))
@@ -126,10 +115,6 @@ public class PacketHandlerServer{
} }
} }
private void isGuiOpenPacket(ByteBuf buffer, EntityPlayerMP player) throws IOException {
NoppesUtilServer.isGUIOpen(buffer, player);
}
private void scriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws Exception { private void scriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws Exception {
if(type == EnumPacketServer.ScriptDataSave){ if(type == EnumPacketServer.ScriptDataSave){
npc.script.readFromNBT(Server.readNBT(buffer)); npc.script.readFromNBT(Server.readNBT(buffer));
@@ -143,30 +128,6 @@ public class PacketHandlerServer{
} }
} }
private void playerScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
NBTTagCompound compound;
if(type == EnumPacketServer.ScriptPlayerGet) {
PlayerDataScript data = ScriptController.Instance.playerScripts;
compound = data.writeToNBT(new NBTTagCompound());
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
} else if(type == EnumPacketServer.ScriptPlayerSave) {
ScriptController.Instance.setPlayerScripts(Server.readNBT(buffer));
}
}
private void forgeScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
NBTTagCompound compound;
if (type == EnumPacketServer.ScriptForgeGet) {
ForgeDataScript data = ScriptController.Instance.forgeScripts;
compound = data.writeToNBT(new NBTTagCompound());
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
Server.sendData(player, EnumPacketClient.GUI_DATA, new Object[]{compound});
} else if (type == EnumPacketServer.ScriptForgeSave) {
ScriptController.Instance.setForgeScripts(Server.readNBT(buffer));
}
}
private void featherPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException { private void featherPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
if(type == EnumPacketServer.DimensionsGet){ if(type == EnumPacketServer.DimensionsGet){
HashMap<String,Integer> map = new HashMap<String,Integer>(); HashMap<String,Integer> map = new HashMap<String,Integer>();
@@ -10,15 +10,12 @@ public class Resistances {
public float playermelee = 1f; public float playermelee = 1f;
public float explosion = 1f; public float explosion = 1f;
public boolean disableDamage = false;
public NBTTagCompound writeToNBT() { public NBTTagCompound writeToNBT() {
NBTTagCompound compound = new NBTTagCompound(); NBTTagCompound compound = new NBTTagCompound();
compound.setFloat("Knockback", knockback); compound.setFloat("Knockback", knockback);
compound.setFloat("Arrow", arrow); compound.setFloat("Arrow", arrow);
compound.setFloat("Melee", playermelee); compound.setFloat("Melee", playermelee);
compound.setFloat("Explosion", explosion); compound.setFloat("Explosion", explosion);
compound.setBoolean("disableDamage", disableDamage);
return compound; return compound;
} }
@@ -27,14 +24,9 @@ public class Resistances {
arrow = compound.getFloat("Arrow"); arrow = compound.getFloat("Arrow");
playermelee = compound.getFloat("Melee"); playermelee = compound.getFloat("Melee");
explosion = compound.getFloat("Explosion"); explosion = compound.getFloat("Explosion");
disableDamage = compound.getBoolean("disableDamage");
} }
public float applyResistance(DamageSource source, float damage) { public float applyResistance(DamageSource source, float damage) {
if(disableDamage){
return 0;
}
if(source.damageType.equals("arrow") || source.damageType.equals("thrown")){ if(source.damageType.equals("arrow") || source.damageType.equals("thrown")){
damage *= (2 - arrow); damage *= (2 - arrow);
} }
@@ -1,477 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs;
import com.google.common.reflect.ClassPath;
import com.google.common.reflect.ClassPath.ClassInfo;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Vector;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.EntityEvent.EntityConstructing;
import net.minecraftforge.event.entity.EntityStruckByLightningEvent;
import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.*;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.event.world.WorldEvent.PotentialSpawns;
import noppes.npcs.controllers.PlayerData;
import noppes.npcs.controllers.PlayerDataController;
import noppes.npcs.controllers.data.PlayerDataScript;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.event.ForgeEvent;
import noppes.npcs.controllers.PixelmonHelper;
import noppes.npcs.controllers.ScriptController;
import org.lwjgl.input.Mouse;
public class ScriptPlayerEventHandler {
public ScriptPlayerEventHandler() {
}
@SubscribeEvent
public void onServerTick(TickEvent.PlayerTickEvent event) {
if(event.side == Side.SERVER && event.phase == TickEvent.Phase.START) {
EntityPlayer player = event.player;
PlayerData data = PlayerData.get(player);
EventHooks.onPlayerTick(data.scriptData);
if(PlayerDataController.instance != null) {
PlayerDataController.instance.getPlayerData(player).scriptData = data.scriptData;
PlayerDataController.instance.getPlayerData(player).timers.update();
}
}
}
@SubscribeEvent
public void invoke(EntityInteractEvent event) {
if(!event.entityPlayer.worldObj.isRemote && event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
noppes.npcs.scripted.event.PlayerEvent.InteractEvent ev = new noppes.npcs.scripted.event.PlayerEvent.InteractEvent(handler.getPlayer(), 1, NpcAPI.Instance().getIEntity(event.target));
event.setCanceled(EventHooks.onPlayerInteract(handler, ev));
}
}
@SubscribeEvent
public void invoke(ArrowNockEvent event) {
if(!event.entityPlayer.worldObj.isRemote && event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
noppes.npcs.scripted.event.PlayerEvent.RangedChargeEvent ev = new noppes.npcs.scripted.event.PlayerEvent.RangedChargeEvent(handler.getPlayer());
EventHooks.onPlayerBowCharge(handler, ev);
}
}
@SubscribeEvent
public void invoke(ArrowLooseEvent event) {
if(!event.entityPlayer.worldObj.isRemote && event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
noppes.npcs.scripted.event.PlayerEvent.RangedLaunchedEvent ev = new noppes.npcs.scripted.event.PlayerEvent.RangedLaunchedEvent(handler.getPlayer(), event.bow, event.charge);
EventHooks.onPlayerRanged(handler, ev);
}
}
@SubscribeEvent
public void invoke(BlockEvent.BreakEvent event) {
if(!event.getPlayer().worldObj.isRemote && event.world instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.getPlayer()).scriptData;
noppes.npcs.scripted.event.PlayerEvent.BreakEvent ev = new noppes.npcs.scripted.event.PlayerEvent.BreakEvent(handler.getPlayer(), NpcAPI.Instance().getIBlock(event.world, new BlockPos(event.x,event.y,event.z)), event.getExpToDrop());
event.setCanceled(EventHooks.onPlayerBreak(handler, ev));
event.setExpToDrop(ev.exp);
}
}
@SubscribeEvent
public void invoke(PlayerUseItemEvent.Start event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
event.setCanceled(EventHooks.onStartUsingItem(handler, event.duration, event.item));
}
}
@SubscribeEvent
public void invoke(PlayerUseItemEvent.Tick event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
event.setCanceled(EventHooks.onUsingItem(handler, event.duration, event.item));
}
}
@SubscribeEvent
public void invoke(PlayerUseItemEvent.Stop event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
event.setCanceled(EventHooks.onStopUsingItem(handler, event.duration, event.item));
}
}
@SubscribeEvent
public void invoke(PlayerUseItemEvent.Finish event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
EventHooks.onFinishUsingItem(handler, event.duration, event.item);
}
}
@SubscribeEvent
public void invoke(PlayerDropsEvent event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
event.setCanceled(EventHooks.onPlayerDropItems(handler, event.drops));
}
}
@SubscribeEvent
public void invoke(PlayerPickupXpEvent event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
EventHooks.onPlayerPickupXP(handler, event.orb);
}
}
@SubscribeEvent
public void invoke(PlayerEvent.PlayerChangedDimensionEvent event) {
if(event.player.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.player).scriptData;
EventHooks.onPlayerChangeDim(handler, event.fromDim, event.toDim);
}
}
@SubscribeEvent
public void invoke(PlayerEvent.ItemPickupEvent event) {
if(event.player.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.player).scriptData;
EventHooks.onPlayerPickUp(handler, event.pickedUp);
}
}
@SubscribeEvent
public void invoke(PlayerOpenContainerEvent event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
EventHooks.onPlayerContainerOpen(handler, event.entityPlayer.openContainer);
}
}
@SubscribeEvent
public void invoke(UseHoeEvent event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
EventHooks.onPlayerUseHoe(handler, event.current, event.x, event.y, event.z);
}
}
@SubscribeEvent
public void invoke(PlayerSleepInBedEvent event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
EventHooks.onPlayerSleep(handler, event.x, event.y, event.z);
}
}
@SubscribeEvent
public void invoke(PlayerWakeUpEvent event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
EventHooks.onPlayerWakeUp(handler, event.setSpawn);
}
}
@SubscribeEvent
public void invoke(FillBucketEvent event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
EventHooks.onPlayerFillBucket(handler, event.current, event.result);
}
}
@SubscribeEvent
public void invoke(BonemealEvent event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
EventHooks.onPlayerBonemeal(handler, event.x, event.y, event.z, event.world);
}
}
@SubscribeEvent
public void invoke(AchievementEvent event) {
if(event.entityPlayer.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.entityPlayer).scriptData;
EventHooks.onPlayerAchievement(handler, CustomNpcs.proxy.getAchievementDesc(event.achievement));
}
}
@SubscribeEvent
public void invoke(ItemTossEvent event) {
if(event.player.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.player).scriptData;
EventHooks.onPlayerToss(handler, event.entityItem);
}
}
@SubscribeEvent
public void invoke(LivingFallEvent event) {
if(event.entityLiving.worldObj instanceof WorldServer) {
PlayerDataScript handler;
if (event.entityLiving instanceof EntityPlayer) {
handler = PlayerData.get((EntityPlayer)event.entityLiving).scriptData;
EventHooks.onPlayerFall(handler, event.distance);
}
}
}
@SubscribeEvent
public void invoke(LivingEvent.LivingJumpEvent event) {
if(event.entityLiving.worldObj instanceof WorldServer) {
PlayerDataScript handler;
if (event.entityLiving instanceof EntityPlayer) {
handler = PlayerData.get((EntityPlayer)event.entityLiving).scriptData;
EventHooks.onPlayerJump(handler);
}
}
}
@SubscribeEvent
public void invoke(EntityStruckByLightningEvent event) {
if(event.entity.worldObj instanceof WorldServer) {
PlayerDataScript handler;
if (event.entity instanceof EntityPlayer) {
handler = PlayerData.get((EntityPlayer)event.entity).scriptData;
EventHooks.onPlayerLightning(handler);
}
}
}
@SubscribeEvent
public void invoke(PlaySoundAtEntityEvent event) {
if(event.entity.worldObj instanceof WorldServer) {
PlayerDataScript handler;
if (event.entity instanceof EntityPlayer) {
handler = PlayerData.get((EntityPlayer)event.entity).scriptData;
EventHooks.onPlayerSound(handler,event.name,event.pitch,event.volume);
}
}
}
@SubscribeEvent
public void invoke(LivingDeathEvent event) {
if(event.entityLiving.worldObj instanceof WorldServer) {
Entity source = NoppesUtilServer.GetDamageSourcee(event.source);
PlayerDataScript handler;
if(event.entityLiving instanceof EntityPlayer) {
handler = PlayerData.get((EntityPlayer)event.entityLiving).scriptData;
EventHooks.onPlayerDeath(handler, event.source, source);
}
if(source instanceof EntityPlayer) {
handler = PlayerData.get((EntityPlayer)source).scriptData;
EventHooks.onPlayerKills(handler, event.entityLiving);
}
}
}
@SubscribeEvent
public void invoke(LivingHurtEvent event) {
if(event.entityLiving.worldObj instanceof WorldServer) {
Entity source = NoppesUtilServer.GetDamageSourcee(event.source);
PlayerDataScript handler;
if(event.entityLiving instanceof EntityPlayer) {
handler = PlayerData.get((EntityPlayer)event.entityLiving).scriptData;
noppes.npcs.scripted.event.PlayerEvent.DamagedEvent pevent = new noppes.npcs.scripted.event.PlayerEvent.DamagedEvent(handler.getPlayer(), source, event.ammount, event.source);
event.setCanceled(EventHooks.onPlayerDamaged(handler, pevent));
event.ammount = pevent.damage;
}
if(source instanceof EntityPlayer) {
handler = PlayerData.get((EntityPlayer)source).scriptData;
noppes.npcs.scripted.event.PlayerEvent.DamagedEntityEvent pevent1 = new noppes.npcs.scripted.event.PlayerEvent.DamagedEntityEvent(handler.getPlayer(), event.entityLiving, event.ammount, event.source);
event.setCanceled(EventHooks.onPlayerDamagedEntity(handler, pevent1));
event.ammount = pevent1.damage;
}
}
}
@SubscribeEvent
public void invoke(PlayerEvent.PlayerRespawnEvent event) {
if(event.player.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.player).scriptData;
EventHooks.onPlayerRespawn(handler);
}
}
@SubscribeEvent
public void invoke(PlayerEvent.PlayerLoggedInEvent event) {
if(event.player.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.player).scriptData;
EventHooks.onPlayerLogin(handler);
}
}
@SubscribeEvent
public void invoke(PlayerEvent.PlayerLoggedOutEvent event) {
if(event.player.worldObj instanceof WorldServer) {
PlayerDataScript handler = PlayerData.get(event.player).scriptData;
EventHooks.onPlayerLogout(handler);
}
}
@SubscribeEvent(
priority = EventPriority.HIGHEST
)
public void invoke(net.minecraftforge.event.ServerChatEvent event) {
if(event.player.worldObj instanceof WorldServer && !event.player.equals(EntityNPCInterface.chateventPlayer)) {
PlayerDataScript handler = PlayerData.get(event.player).scriptData;
String message = event.message;
noppes.npcs.scripted.event.PlayerEvent.ChatEvent ev = new noppes.npcs.scripted.event.PlayerEvent.ChatEvent(handler.getPlayer(), event.message);
EventHooks.onPlayerChat(handler, ev);
event.setCanceled(ev.isCanceled());
if(!message.equals(ev.message)) {
ChatComponentTranslation chat = new ChatComponentTranslation("", new Object[0]);
chat.appendSibling(ForgeHooks.newChatWithLinks(ev.message));
event.component = chat;
}
}
}
public ScriptPlayerEventHandler registerForgeEvents() {
ScriptPlayerEventHandler.ForgeEventHandler handler = new ScriptPlayerEventHandler.ForgeEventHandler();
try {
Method e = handler.getClass().getMethod("forgeEntity", new Class[]{Event.class});
Method register = FMLCommonHandler.instance().bus().getClass().getDeclaredMethod("register", new Class[]{Class.class, Object.class, Method.class, ModContainer.class});
register.setAccessible(true);
ArrayList list = new ArrayList();
list.addAll(ClassPath.from(this.getClass().getClassLoader()).getTopLevelClassesRecursive("cpw.mods.fml.common.gameevent"));
list.addAll(ClassPath.from(this.getClass().getClassLoader()).getTopLevelClassesRecursive("net.minecraftforge.event"));
Iterator e1 = list.iterator();
while(true) {
ClassInfo classLoader;
String classes;
do {
if(!e1.hasNext()) {
if(PixelmonHelper.Enabled) {
try {
Field e2 = ClassLoader.class.getDeclaredField("classes");
e2.setAccessible(true);
ClassLoader classLoader1 = Thread.currentThread().getContextClassLoader();
ArrayList classes1 = new ArrayList((Vector)e2.get(classLoader1));
Iterator infoClass1 = classes1.iterator();
while(infoClass1.hasNext()) {
Class c2 = (Class)infoClass1.next();
}
} catch (Exception var12) {
var12.printStackTrace();
}
return this;
}
return this;
}
classLoader = (ClassInfo)e1.next();
classes = classLoader.getName();
} while(classes.startsWith("net.minecraftforge.event.terraingen"));
Class infoClass = classLoader.load();
ArrayList c = new ArrayList(Arrays.asList(infoClass.getDeclaredClasses()));
if(c.isEmpty()) {
c.add(infoClass);
}
Iterator var10 = c.iterator();
while(var10.hasNext()) {
Class c1 = (Class)var10.next();
if(!EntityConstructing.class.isAssignableFrom(c1) && !PotentialSpawns.class.isAssignableFrom(c1) && !TickEvent.RenderTickEvent.class.isAssignableFrom(c1) && !TickEvent.ClientTickEvent.class.isAssignableFrom(c1) && !FMLNetworkEvent.ClientCustomPacketEvent.class.isAssignableFrom(c1) && !ItemTooltipEvent.class.isAssignableFrom(c1) && Event.class.isAssignableFrom(c1) && !Modifier.isAbstract(c1.getModifiers()) && Modifier.isPublic(c1.getModifiers())) {
register.invoke(FMLCommonHandler.instance().bus(), new Object[]{c1, handler, e, Loader.instance().activeModContainer()});
}
}
}
} catch (Exception var13) {
var13.printStackTrace();
return this;
}
}
public class ForgeEventHandler {
public ForgeEventHandler() {
}
@SubscribeEvent
public void forgeEntity(Event event) {
if(CustomNpcs.getServer() != null && ScriptController.Instance.forgeScripts.isEnabled()) {
if(event instanceof EntityEvent) {
EntityEvent ev2 = (EntityEvent)event;
if(ev2.entity != null && ev2.entity.worldObj instanceof WorldServer) {
EventHooks.onForgeEntityEvent(ev2);
}
} else if(event instanceof WorldEvent) {
WorldEvent ev1 = (WorldEvent)event;
if(ev1.world instanceof WorldServer) {
EventHooks.onForgeWorldEvent(ev1);
}
} else if(!(event instanceof TickEvent) || ((TickEvent)event).side != Side.CLIENT) {
if(event instanceof PlayerEvent) {
PlayerEvent ev = (PlayerEvent)event;
if(!(ev.player.worldObj instanceof WorldServer)) {
return;
}
}
EventHooks.onForgeEvent(new ForgeEvent(event), event);
}
}
}
}
/*@SubscribeEvent
public void forgeTick(TickEvent.ServerTickEvent event){
if(event.side == Side.SERVER && event.phase == TickEvent.Phase.START) {
EventHooks.onForgeEvent(new ForgeEvent(event), event);
}
}
@SubscribeEvent
public void forgeTick(TickEvent.WorldTickEvent event){
if(event.side == Side.SERVER && event.phase == TickEvent.Phase.START) {
EventHooks.onForgeEvent(new ForgeEvent(event), event);
}
}
@SubscribeEvent
public void forgeTick(TickEvent.PlayerTickEvent event){
if(event.side == Side.SERVER && event.phase == TickEvent.Phase.START) {
EventHooks.onForgeEvent(new ForgeEvent(event), event);
}
}*/
}
@@ -17,8 +17,8 @@ public class EntityAIJob extends EntityAIBase {
return npc.jobInterface.aiShouldExecute(); return npc.jobInterface.aiShouldExecute();
} }
public void startExecuting() @Override
{ public void startExecuting(){
npc.jobInterface.aiStartExecuting(); npc.jobInterface.aiStartExecuting();
} }
@@ -30,11 +30,13 @@ public class EntityAIJob extends EntityAIBase {
return npc.jobInterface.aiContinueExecute(); return npc.jobInterface.aiContinueExecute();
} }
public void updateTask() @Override
{ public void updateTask(){
npc.jobInterface.aiUpdateTask(); if(npc.jobInterface != null)
npc.jobInterface.aiUpdateTask();
} }
@Override
public void resetTask() { public void resetTask() {
if(npc.jobInterface != null) if(npc.jobInterface != null)
npc.jobInterface.resetTask(); npc.jobInterface.resetTask();
@@ -50,9 +50,6 @@ public class EntityAIWander extends EntityAIBase
else{ else{
this.xPosition = vec.xCoord; this.xPosition = vec.xCoord;
this.yPosition = vec.yCoord; this.yPosition = vec.yCoord;
// FLY CHANGE
if(entity.canFly())
this.yPosition = entity.getStartYPos() + entity.getRNG().nextFloat() * 0.75 * entity.ai.walkingRange;
this.zPosition = vec.zCoord; this.zPosition = vec.zCoord;
} }
} }
@@ -1,73 +0,0 @@
package noppes.npcs.ai.pathfinder;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.pathfinding.PathPoint;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.BlockPos;
import noppes.npcs.entity.EntityNPCInterface;
public class FlyNodeProcessor extends NodeProcessor{
public PathPoint getPathPointTo(Entity p_176161_1_)
{
return this.openPoint(MathHelper.floor_double(p_176161_1_.boundingBox.minX), MathHelper.floor_double(p_176161_1_.boundingBox.minY + 0.5D), MathHelper.floor_double(p_176161_1_.boundingBox.minZ));
}
public PathPoint getPathPointToCoords(Entity p_176160_1_, double p_176160_2_, double p_176160_4_, double p_176160_6_)
{
return this.openPoint(MathHelper.floor_double(p_176160_2_ - (double)(p_176160_1_.width / 2.0F)), MathHelper.floor_double(p_176160_4_ + 0.5D), MathHelper.floor_double(p_176160_6_ - (double)(p_176160_1_.width / 2.0F)));
}
public int findPathOptions(PathPoint[] p_176164_1_, Entity p_176164_2_, PathPoint p_176164_3_, PathPoint p_176164_4_, float p_176164_5_)
{
int i = 0;
EnumFacing[] aenumfacing = EnumFacing.values();
int j = aenumfacing.length;
for (int k = 0; k < j; ++k)
{
EnumFacing enumfacing = aenumfacing[k];
PathPoint pathpoint2 = this.getSafePoint(p_176164_2_, p_176164_3_.xCoord + enumfacing.getFrontOffsetX(), p_176164_3_.yCoord + enumfacing.getFrontOffsetY(), p_176164_3_.zCoord + enumfacing.getFrontOffsetZ());
if (pathpoint2 != null && !pathpoint2.isFirst && pathpoint2.distanceTo(p_176164_4_) < p_176164_5_)
{
p_176164_1_[i++] = pathpoint2;
}
}
return i;
}
private PathPoint getSafePoint(Entity p_176185_1_, int p_176185_2_, int p_176185_3_, int p_176185_4_)
{
int l = this.func_176186_b(p_176185_1_, p_176185_2_, p_176185_3_, p_176185_4_);
return l == -1 ? this.openPoint(p_176185_2_, p_176185_3_, p_176185_4_) : null;
}
private int func_176186_b(Entity entityIn, int x, int y, int z)
{
for (int i = x; i < x + this.entitySizeX; ++i)
{
for (int j = y; j < y + this.entitySizeY; ++j)
{
for (int k = z; k < z + this.entitySizeZ; ++k)
{
Block block = this.blockaccess.getBlock(i, j, k);
if(block.getMaterial() == Material.water && entityIn instanceof EntityNPCInterface && ((EntityNPCInterface)entityIn).ai.canSwim)
continue;
if (block.getMaterial() != Material.air)
{
return 0;
}
}
}
}
return -1;
}
}
@@ -1,67 +0,0 @@
package noppes.npcs.ai.pathfinder;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityMoveHelper;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import noppes.npcs.entity.EntityNPCInterface;
// Fly Change
public class FlyingMoveHelper extends EntityMoveHelper {
private EntityNPCInterface entity;
private int field_179928_h;
protected boolean update;
public double posX;
public double posY;
public double posZ;
public FlyingMoveHelper(EntityNPCInterface entity){
super(entity);
this.entity = entity;
}
public void onUpdateMoveHelper(){
if (this.update){
double d0 = this.posX - this.entity.posX;
double d1 = this.posY - this.entity.posY;
double d2 = this.posZ - this.entity.posZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (this.field_179928_h-- <= 0){
this.field_179928_h += this.entity.getRNG().nextInt(5) + 2;
d3 = (double) MathHelper.sqrt_double(d3);
if (d3 > 1 && this.func_179926_b(this.posX, this.posY, this.posZ, d3)){
double speed = entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() / 2.5;
this.entity.motionX += d0 / d3 * speed;
this.entity.motionY += d1 / d3 * speed;
this.entity.motionZ += d2 / d3 * speed;
this.entity.renderYawOffset = this.entity.rotationYaw = -((float)Math.atan2(this.entity.motionX, this.entity.motionZ)) * 180.0F / (float)Math.PI;
}
else{
this.update = false;
}
}
}
}
private boolean func_179926_b(double p_179926_1_, double p_179926_3_, double p_179926_5_, double p_179926_7_){
double d4 = (p_179926_1_ - this.entity.posX) / p_179926_7_;
double d5 = (p_179926_3_ - this.entity.posY) / p_179926_7_;
double d6 = (p_179926_5_ - this.entity.posZ) / p_179926_7_;
AxisAlignedBB axisalignedbb = this.entity.getBoundingBox();
for (int i = 1; (double)i < p_179926_7_; ++i){
axisalignedbb = axisalignedbb.offset(d4, d5, d6);
if (!this.entity.worldObj.getCollidingBoundingBoxes(this.entity, axisalignedbb).isEmpty()){
return false;
}
}
return true;
}
}
@@ -1,146 +0,0 @@
package noppes.npcs.ai.pathfinder;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.pathfinding.Path;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.pathfinding.PathFinder;
import net.minecraft.pathfinding.PathPoint;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
public class NPCPathFinder extends PathFinder
{
public IBlockAccess worldMap;
public Path path = new Path();
public NPCPathPoint[] pathOptions = new NPCPathPoint[32];
private final NodeProcessor nodeProcessor;
public NPCPathFinder(NodeProcessor nodeProcessorIn)
{
super(nodeProcessorIn.blockaccess, true, true, false, false);
this.nodeProcessor = nodeProcessorIn;
}
/**
* Creates a path from one entity to another within a minimum distance
*/
public PathEntity createEntityPathTo(Entity p_75856_1_, Entity p_75856_2_, float p_75856_3_)
{
return this.createEntityPathTo(p_75856_1_, p_75856_2_.posX, p_75856_2_.boundingBox.minY, p_75856_2_.posZ, p_75856_3_);
}
/**
* Creates a path from an entity to a specified location within a minimum distance
*/
public PathEntity createEntityPathTo(Entity p_75859_1_, int p_75859_2_, int p_75859_3_, int p_75859_4_, float p_75859_5_)
{
return this.createEntityPathTo(p_75859_1_, (double)((float)p_75859_2_ + 0.5F), (double)((float)p_75859_3_ + 0.5F), (double)((float)p_75859_4_ + 0.5F), p_75859_5_);
}
/**
* Internal implementation of creating a path from an entity to a point
*/
public PathEntity createEntityPathTo(Entity p_75857_1_, double p_75857_2_, double p_75857_4_, double p_75857_6_, float p_75857_8_)
{
this.path.clearPath();
this.nodeProcessor.initProcessor(worldMap, p_75857_1_);
NPCPathPoint pathpoint = (NPCPathPoint) this.nodeProcessor.getPathPointTo(p_75857_1_);
NPCPathPoint pathpoint1 = (NPCPathPoint) this.nodeProcessor.getPathPointToCoords(p_75857_1_, p_75857_2_, p_75857_4_, p_75857_6_);
PathEntity pathentity = this.addToPath(p_75857_1_, pathpoint, pathpoint1, p_75857_8_);
this.nodeProcessor.postProcess();
return pathentity;
}
public PathEntity addToPath(Entity entityIn, NPCPathPoint pathpointStart, NPCPathPoint pathpointEnd, float maxDistance)
{
pathpointStart.totalPathDistance = 0.0F;
pathpointStart.distanceToNext = pathpointStart.distanceToSquared(pathpointEnd);
pathpointStart.distanceToTarget = pathpointStart.distanceToNext;
this.path.clearPath();
this.path.addPoint(pathpointStart);
NPCPathPoint pathpoint = pathpointStart;
while (!this.path.isPathEmpty())
{
NPCPathPoint pathpoint1 = (NPCPathPoint) this.path.dequeue();
if (pathpoint1.equals(pathpointEnd))
{
return this.createEntityPath(pathpointStart, pathpointEnd);
}
if (pathpoint1.distanceToSquared(pathpointEnd) < pathpoint.distanceToSquared(pathpointEnd))
{
pathpoint = pathpoint1;
}
pathpoint1.isFirst = true;
int i = this.nodeProcessor.findPathOptions(this.pathOptions, entityIn, pathpoint1, pathpointEnd, maxDistance);
for (int j = 0; j < i; ++j)
{
NPCPathPoint pathpoint2 = (NPCPathPoint) this.pathOptions[j];
float f = pathpoint1.totalPathDistance + pathpoint1.distanceToSquared(pathpoint2);
if (f < maxDistance * 2.0F && (!pathpoint2.isAssigned() || f < pathpoint2.totalPathDistance))
{
pathpoint2.previous = pathpoint1;
pathpoint2.totalPathDistance = f;
pathpoint2.distanceToNext = pathpoint2.distanceToSquared(pathpointEnd);
if (pathpoint2.isAssigned())
{
this.path.changeDistance(pathpoint2, pathpoint2.totalPathDistance + pathpoint2.distanceToNext);
}
else
{
pathpoint2.distanceToTarget = pathpoint2.totalPathDistance + pathpoint2.distanceToNext;
this.path.addPoint(pathpoint2);
}
}
}
}
if (pathpoint == pathpointStart)
{
return null;
}
else
{
return this.createEntityPath(pathpointStart, pathpoint);
}
}
/**
* Returns a new PathEntity for a given start and end point
*/
private PathEntity createEntityPath(NPCPathPoint p_75853_1_, NPCPathPoint p_75853_2_)
{
int i = 1;
NPCPathPoint pathpoint2;
for (pathpoint2 = p_75853_2_; pathpoint2.previous != null; pathpoint2 = (NPCPathPoint) pathpoint2.previous)
{
++i;
}
NPCPathPoint[] apathpoint = new NPCPathPoint[i];
pathpoint2 = p_75853_2_;
--i;
for (apathpoint[i] = p_75853_2_; pathpoint2.previous != null; apathpoint[i] = pathpoint2)
{
pathpoint2 = (NPCPathPoint) pathpoint2.previous;
--i;
}
return new PathEntity(apathpoint);
}
}
@@ -1,23 +0,0 @@
package noppes.npcs.ai.pathfinder;
import net.minecraft.pathfinding.PathPoint;
import net.minecraft.util.MathHelper;
public class NPCPathPoint extends PathPoint
{
/** The index of this point in its assigned path */
public int index = -1;
/** The distance along the path to this point */
public float totalPathDistance;
/** The linear distance to the next point */
public float distanceToNext;
/** The distance to the target */
public float distanceToTarget;
public PathPoint previous;
public NPCPathPoint(int p_i2135_1_, int p_i2135_2_, int p_i2135_3_)
{
super(p_i2135_1_, p_i2135_2_,p_i2135_3_);
}
}
@@ -1,50 +0,0 @@
package noppes.npcs.ai.pathfinder;
import net.minecraft.entity.Entity;
import net.minecraft.pathfinding.PathPoint;
import net.minecraft.util.IntHashMap;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
public abstract class NodeProcessor
{
public IBlockAccess blockaccess;
public IntHashMap pointMap = new IntHashMap();
public int entitySizeX;
public int entitySizeY;
public int entitySizeZ;
public void initProcessor(IBlockAccess iblockaccessIn, Entity entityIn)
{
this.blockaccess = iblockaccessIn;
this.pointMap.clearMap();
this.entitySizeX = MathHelper.floor_float(entityIn.width + 1.0F);
this.entitySizeY = MathHelper.floor_float(entityIn.height + 1.0F);
this.entitySizeZ = MathHelper.floor_float(entityIn.width + 1.0F);
}
public void postProcess()
{
}
public PathPoint openPoint(int x, int y, int z)
{
int i = NPCPathPoint.makeHash(x, y, z);
NPCPathPoint pathpoint = (NPCPathPoint)this.pointMap.lookup(i);
if (pathpoint == null)
{
pathpoint = new NPCPathPoint(x, y, z);
this.pointMap.addKey(i, pathpoint);
}
return pathpoint;
}
public abstract PathPoint getPathPointTo(Entity entityIn);
public abstract PathPoint getPathPointToCoords(Entity entityIn, double x, double y, double target);
public abstract int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance);
}
@@ -1,25 +0,0 @@
package noppes.npcs.ai.pathfinder;
import net.minecraft.entity.EntityLiving;
import net.minecraft.pathfinding.PathFinder;
import net.minecraft.world.World;
public class PathNavigateFlying extends PathNavigateSwimmer {
public PathNavigateFlying(EntityLiving p_i45873_1_, World worldIn) {
super(p_i45873_1_, worldIn);
}
protected PathFinder func_179679_a()
{
return new NPCPathFinder(new FlyNodeProcessor());
}
/**
* If on ground or swimming and can swim
*/
protected boolean canNavigate()
{
return true;
}
}
@@ -1,299 +0,0 @@
package noppes.npcs.ai.pathfinder;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.init.Blocks;
import net.minecraft.pathfinding.PathFinder;
import net.minecraft.pathfinding.PathNavigate;
import net.minecraft.pathfinding.PathPoint;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import noppes.npcs.util.Vec3NPC;
public class PathNavigateGround extends PathNavigateNPC
{
protected WalkNodeProcessor nodeProcessor;
private boolean shouldAvoidSun;
public PathNavigateGround(EntityLiving entitylivingIn, World worldIn)
{
super(entitylivingIn, worldIn);
}
protected PathFinder getPathFinder()
{
this.nodeProcessor = new WalkNodeProcessor();
this.nodeProcessor.setEnterDoors(true);
return new NPCPathFinder(this.nodeProcessor);
}
/**
* If on ground or swimming and can swim
*/
protected boolean canNavigate()
{
return this.theEntity.onGround || this.getCanSwim() && this.isInLiquid() || this.theEntity.isRiding() && this.theEntity instanceof EntityZombie && this.theEntity.ridingEntity instanceof EntityChicken;
}
protected Vec3 getEntityPosition()
{
return new Vec3NPC(this.theEntity.posX, (double)this.getPathablePosY(), this.theEntity.posZ);
}
/**
* Gets the safe pathing Y position for the entity depending on if it can path swim or not
*/
private int getPathablePosY()
{
if (this.theEntity.isInWater() && this.getCanSwim())
{
int i = (int)this.theEntity.boundingBox.minY;
Block block = this.worldObj.getBlock(MathHelper.floor_double(this.theEntity.posX), i, MathHelper.floor_double(this.theEntity.posZ));
int j = 0;
while (block == Blocks.flowing_water || block == Blocks.water)
{
++i;
block = this.worldObj.getBlock(MathHelper.floor_double(this.theEntity.posX), i, MathHelper.floor_double(this.theEntity.posZ));
++j;
if (j > 16)
{
return (int)this.theEntity.boundingBox.minY;
}
}
return i;
}
else
{
return (int)(this.theEntity.boundingBox.minY + 0.5D);
}
}
/**
* Trims path data from the end to the first sun covered block
*/
protected void removeSunnyPath()
{
super.removeSunnyPath();
if (this.shouldAvoidSun)
{
if (this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.theEntity.posX), (int)(this.theEntity.boundingBox.minY + 0.5D), MathHelper.floor_double(this.theEntity.posZ)))
{
return;
}
for (int i = 0; i < this.currentPath.getCurrentPathLength(); ++i)
{
PathPoint pathpoint = this.currentPath.getPathPointFromIndex(i);
if (this.worldObj.canBlockSeeTheSky(pathpoint.xCoord, pathpoint.yCoord, pathpoint.zCoord))
{
this.currentPath.setCurrentPathLength(i - 1);
return;
}
}
}
}
/**
* Returns true when an entity of specified size could safely walk in a straight line between the two points. Args:
* pos1, pos2, entityXSize, entityYSize, entityZSize
*/
protected boolean isDirectPathBetweenPoints(Vec3 posVec31, Vec3 posVec32, int sizeX, int sizeY, int sizeZ)
{
int i = MathHelper.floor_double(posVec31.xCoord);
int j = MathHelper.floor_double(posVec31.zCoord);
double d0 = posVec32.xCoord - posVec31.xCoord;
double d1 = posVec32.zCoord - posVec31.zCoord;
double d2 = d0 * d0 + d1 * d1;
if (d2 < 1.0E-8D)
{
return false;
}
else
{
double d3 = 1.0D / Math.sqrt(d2);
d0 = d0 * d3;
d1 = d1 * d3;
sizeX = sizeX + 2;
sizeZ = sizeZ + 2;
if (!this.isSafeToStandAt(i, (int)posVec31.yCoord, j, sizeX, sizeY, sizeZ, posVec31, d0, d1))
{
return false;
}
else
{
sizeX = sizeX - 2;
sizeZ = sizeZ - 2;
double d4 = 1.0D / Math.abs(d0);
double d5 = 1.0D / Math.abs(d1);
double d6 = (double)(i * 1) - posVec31.xCoord;
double d7 = (double)(j * 1) - posVec31.zCoord;
if (d0 >= 0.0D)
{
++d6;
}
if (d1 >= 0.0D)
{
++d7;
}
d6 = d6 / d0;
d7 = d7 / d1;
int k = d0 < 0.0D ? -1 : 1;
int l = d1 < 0.0D ? -1 : 1;
int i1 = MathHelper.floor_double(posVec32.xCoord);
int j1 = MathHelper.floor_double(posVec32.zCoord);
int k1 = i1 - i;
int l1 = j1 - j;
while (k1 * k > 0 || l1 * l > 0)
{
if (d6 < d7)
{
d6 += d4;
i += k;
k1 = i1 - i;
}
else
{
d7 += d5;
j += l;
l1 = j1 - j;
}
if (!this.isSafeToStandAt(i, (int)posVec31.yCoord, j, sizeX, sizeY, sizeZ, posVec31, d0, d1))
{
return false;
}
}
return true;
}
}
}
/**
* Returns true when an entity could stand at a position, including solid blocks under the entire entity.
*/
private boolean isSafeToStandAt(int x, int y, int z, int sizeX, int sizeY, int sizeZ, Vec3 vec31, double p_179683_8_, double p_179683_10_)
{
int i = x - sizeX / 2;
int j = z - sizeZ / 2;
if (!this.isPositionClear(i, y, j, sizeX, sizeY, sizeZ, vec31, p_179683_8_, p_179683_10_))
{
return false;
}
else
{
for (int k = i; k < i + sizeX; ++k)
{
for (int l = j; l < j + sizeZ; ++l)
{
double d0 = (double)k + 0.5D - vec31.xCoord;
double d1 = (double)l + 0.5D - vec31.zCoord;
if (d0 * p_179683_8_ + d1 * p_179683_10_ >= 0.0D)
{
Block block = this.worldObj.getBlock(k, y - 1, l);
Material material = block.getMaterial();
if (material == Material.air)
{
return false;
}
if (material == Material.water && !this.theEntity.isInWater())
{
return false;
}
if (material == Material.lava)
{
return false;
}
}
}
}
return true;
}
}
/**
* Returns true if an entity does not collide with any solid blocks at the position.
*/
private boolean isPositionClear(int p_179692_1_, int p_179692_2_, int p_179692_3_, int p_179692_4_, int p_179692_5_, int p_179692_6_, Vec3 p_179692_7_, double p_179692_8_, double p_179692_10_)
{
for (BlockPos blockpos : BlockPos.getAllInBox(new BlockPos(p_179692_1_, p_179692_2_, p_179692_3_), new BlockPos(p_179692_1_ + p_179692_4_ - 1, p_179692_2_ + p_179692_5_ - 1, p_179692_3_ + p_179692_6_ - 1)))
{
double d0 = (double)blockpos.getX() + 0.5D - p_179692_7_.xCoord;
double d1 = (double)blockpos.getZ() + 0.5D - p_179692_7_.zCoord;
if (d0 * p_179692_8_ + d1 * p_179692_10_ >= 0.0D)
{
Block block = this.worldObj.getBlock(blockpos.getX(), blockpos.getY(), blockpos.getZ());
if (!block.getBlocksMovement(this.worldObj, blockpos.getX(), blockpos.getY(), blockpos.getZ()))
{
return false;
}
}
}
return true;
}
public void setAvoidsWater(boolean avoidsWater)
{
this.nodeProcessor.setAvoidsWater(avoidsWater);
}
public boolean getAvoidsWater()
{
return this.nodeProcessor.getAvoidsWater();
}
public void setBreakDoors(boolean canBreakDoors)
{
this.nodeProcessor.setBreakDoors(canBreakDoors);
}
public void setEnterDoors(boolean par1)
{
this.nodeProcessor.setEnterDoors(par1);
}
public boolean getEnterDoors()
{
return this.nodeProcessor.getEnterDoors();
}
public void setCanSwim(boolean canSwim)
{
this.nodeProcessor.setCanSwim(canSwim);
}
public boolean getCanSwim()
{
return this.nodeProcessor.getCanSwim();
}
public void setAvoidSun(boolean par1)
{
this.shouldAvoidSun = par1;
}
}
@@ -1,88 +0,0 @@
package noppes.npcs.ai.pathfinder;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.init.Blocks;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.pathfinding.PathNavigate;
import net.minecraft.pathfinding.PathPoint;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class PathNavigateNPC extends PathNavigate
{
protected EntityLiving theEntity;
protected World worldObj;
/** The PathEntity being followed. */
protected PathEntity currentPath;
/** Time, in number of ticks, following the current path */
protected int totalTicks;
/** The time when the last position check was done (to detect successful movement) */
protected int ticksAtLastPos;
/** Coordinates of the entity's position last time a check was done (part of monitoring getting 'stuck') */
protected Vec3 lastPosCheck = Vec3.createVectorHelper(0.0D, 0.0D, 0.0D);
public PathNavigateNPC(EntityLiving p_i1671_1_, World p_i1671_2_)
{
super(p_i1671_1_, p_i1671_2_);
this.theEntity = p_i1671_1_;
this.worldObj = p_i1671_2_;
}
/** Gets Current Path of NPC **/
public PathEntity getPath()
{
return this.currentPath;
}
/** Returns true if the entity is in water or lava, false otherwise **/
protected boolean isInLiquid()
{
return this.theEntity.isInWater() || this.theEntity.handleLavaMovement();
}
/** Trims path data from the end to the first sun covered block **/
protected void removeSunnyPath()
{
if (!this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.theEntity.posX), (int)(this.theEntity.boundingBox.minY + 0.5D), MathHelper.floor_double(this.theEntity.posZ)))
{
for (int i = 0; i < this.currentPath.getCurrentPathLength(); ++i)
{
PathPoint pathpoint = this.currentPath.getPathPointFromIndex(i);
if (this.worldObj.canBlockSeeTheSky(pathpoint.xCoord, pathpoint.yCoord, pathpoint.zCoord))
{
this.currentPath.setCurrentPathLength(i - 1);
return;
}
}
}
}
/**
* Checks if entity haven't been moved when last checked and if so, clears current {@link
* net.minecraft.pathfinding.PathEntity}
*/
protected void checkForStuck(Vec3 positionVec3)
{
if (this.totalTicks - this.ticksAtLastPos > 100)
{
if (positionVec3.squareDistanceTo(this.lastPosCheck) < 2.25D)
{
this.clearPathEntity();
}
this.ticksAtLastPos = this.totalTicks;
this.lastPosCheck = positionVec3;
}
}
}
@@ -1,80 +0,0 @@
package noppes.npcs.ai.pathfinder;
import net.minecraft.entity.EntityLiving;
import net.minecraft.pathfinding.PathFinder;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import noppes.npcs.ai.pathfinder.NPCPathFinder;
import noppes.npcs.ai.pathfinder.PathNavigateNPC;
import noppes.npcs.ai.pathfinder.SwimNodeProcessor;
import noppes.npcs.util.Vec3NPC;
public class PathNavigateSwimmer extends PathNavigateNPC
{
public PathNavigateSwimmer(EntityLiving entitylivingIn, World worldIn)
{
super(entitylivingIn, worldIn);
}
protected PathFinder getPathFinder()
{
return new NPCPathFinder(new SwimNodeProcessor());
}
/**
* If on ground or swimming and can swim
*/
protected boolean canNavigate()
{
return this.isInLiquid();
}
protected Vec3 getEntityPosition()
{
return new Vec3NPC(this.theEntity.posX, this.theEntity.posY + (double)this.theEntity.height * 0.5D, this.theEntity.posZ);
}
protected void pathFollow()
{
Vec3 vec3 = this.getEntityPosition();
float f = this.theEntity.width * this.theEntity.width;
int i = 6;
if (vec3.squareDistanceTo(this.currentPath.getVectorFromIndex(this.theEntity, this.currentPath.getCurrentPathIndex())) < (double)f)
{
this.currentPath.incrementPathIndex();
}
for (int j = Math.min(this.currentPath.getCurrentPathIndex() + i, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j)
{
Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, j);
if (vec31.squareDistanceTo(vec3) <= 36.0D && this.isDirectPathBetweenPoints(vec3, vec31, 0, 0, 0))
{
this.currentPath.setCurrentPathIndex(j);
break;
}
}
this.checkForStuck(vec3);
}
/**
* Trims path data from the end to the first sun covered block
*/
protected void removeSunnyPath()
{
super.removeSunnyPath();
}
/**
* Returns true when an entity of specified size could safely walk in a straight line between the two points. Args:
* pos1, pos2, entityXSize, entityYSize, entityZSize
*/
protected boolean isDirectPathBetweenPoints(Vec3 posVec31, Vec3 posVec32, int sizeX, int sizeY, int sizeZ)
{
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(posVec31, new Vec3NPC(posVec32.xCoord, posVec32.yCoord + (double)this.theEntity.height * 0.5D, posVec32.zCoord), false, true, false);
return movingobjectposition == null || movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.MISS;
}
}
@@ -1,93 +0,0 @@
package noppes.npcs.ai.pathfinder;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.pathfinding.PathPoint;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
public class SwimNodeProcessor extends NodeProcessor
{
public void initProcessor(IBlockAccess iblockaccessIn, Entity entityIn)
{
super.initProcessor(iblockaccessIn, entityIn);
}
/**
* This method is called when all nodes have been processed and PathEntity is created.
* {@link net.minecraft.world.pathfinder.WalkNodeProcessor WalkNodeProcessor} uses this to change its field {@link
* net.minecraft.world.pathfinder.WalkNodeProcessor#avoidsWater avoidsWater}
*/
public void postProcess()
{
super.postProcess();
}
/**
* Returns given entity's position as PathPoint
*/
public PathPoint getPathPointTo(Entity entityIn)
{
return this.openPoint(MathHelper.floor_double(entityIn.boundingBox.minX), MathHelper.floor_double(entityIn.boundingBox.minY + 0.5D), MathHelper.floor_double(entityIn.boundingBox.minZ));
}
/**
* Returns PathPoint for given coordinates
*/
public PathPoint getPathPointToCoords(Entity entityIn, double x, double y, double target)
{
return this.openPoint(MathHelper.floor_double(x - (double)(entityIn.width / 2.0F)), MathHelper.floor_double(y + 0.5D), MathHelper.floor_double(target - (double)(entityIn.width / 2.0F)));
}
public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance)
{
int i = 0;
for (EnumFacing enumfacing : EnumFacing.values())
{
PathPoint pathpoint = this.getSafePoint(entityIn, currentPoint.xCoord + enumfacing.getFrontOffsetX(), currentPoint.yCoord + enumfacing.getFrontOffsetY(), currentPoint.zCoord + enumfacing.getFrontOffsetZ());
if (pathpoint != null && !pathpoint.isFirst && pathpoint.distanceTo(targetPoint) < maxDistance)
{
pathOptions[i++] = pathpoint;
}
}
return i;
}
/**
* Returns a point that the entity can safely move to
*/
private PathPoint getSafePoint(Entity entityIn, int x, int y, int z)
{
int i = this.func_176186_b(entityIn, x, y, z);
return i == -1 ? this.openPoint(x, y, z) : null;
}
private int func_176186_b(Entity entityIn, int x, int y, int z)
{
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int i = x; i < x + this.entitySizeX; ++i)
{
for (int j = y; j < y + this.entitySizeY; ++j)
{
for (int k = z; k < z + this.entitySizeZ; ++k)
{
Block block = this.blockaccess.getBlock(i, j, k);
if (block.getMaterial() != Material.water)
{
return 0;
}
}
}
}
return -1;
}
}
@@ -1,303 +0,0 @@
package noppes.npcs.ai.pathfinder;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.pathfinding.PathPoint;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
public class WalkNodeProcessor extends NodeProcessor
{
private boolean canEnterDoors;
private boolean canBreakDoors;
private boolean avoidsWater;
private boolean canSwim;
private boolean shouldAvoidWater;
public void initProcessor(IBlockAccess iblockaccessIn, Entity entityIn)
{
super.initProcessor(iblockaccessIn, entityIn);
this.shouldAvoidWater = this.avoidsWater;
}
/**
* This method is called when all nodes have been processed and PathEntity is created.
* {@link noppes.npcs.ai.pathfinder.WalkNodeProcessor WalkNodeProcessor} uses this to change its field {@link
* noppes.npcs.ai.pathfinder.WalkNodeProcessor#avoidsWater avoidsWater}
*/
public void postProcess()
{
super.postProcess();
this.avoidsWater = this.shouldAvoidWater;
}
/**
* Returns given entity's position as PathPoint
*/
public PathPoint getPathPointTo(Entity entityIn)
{
int i;
if (this.canSwim && entityIn.isInWater())
{
i = (int)entityIn.boundingBox.minY;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ));
for (Block block = this.blockaccess.getBlock(blockpos$mutableblockpos.getX(), blockpos$mutableblockpos.getY(), blockpos$mutableblockpos.getZ()); block == Blocks.flowing_water || block == Blocks.water; block = this.blockaccess.getBlock(blockpos$mutableblockpos.getX(), blockpos$mutableblockpos.getY(), blockpos$mutableblockpos.getZ()))
{
++i;
blockpos$mutableblockpos.set(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ));
}
this.avoidsWater = false;
}
else
{
i = MathHelper.floor_double(entityIn.boundingBox.minY + 0.5D);
}
return this.openPoint(MathHelper.floor_double(entityIn.boundingBox.minX), i, MathHelper.floor_double(entityIn.boundingBox.minZ));
}
/**
* Returns PathPoint for given coordinates
*/
public PathPoint getPathPointToCoords(Entity entityIn, double x, double y, double target)
{
return this.openPoint(MathHelper.floor_double(x - (double)(entityIn.width / 2.0F)), MathHelper.floor_double(y), MathHelper.floor_double(target - (double)(entityIn.width / 2.0F)));
}
public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance)
{
int i = 0;
int j = 0;
if (this.getVerticalOffset(entityIn, currentPoint.xCoord, currentPoint.yCoord + 1, currentPoint.zCoord) == 1)
{
j = 1;
}
PathPoint pathpoint = this.getSafePoint(entityIn, currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord + 1, j);
PathPoint pathpoint1 = this.getSafePoint(entityIn, currentPoint.xCoord - 1, currentPoint.yCoord, currentPoint.zCoord, j);
PathPoint pathpoint2 = this.getSafePoint(entityIn, currentPoint.xCoord + 1, currentPoint.yCoord, currentPoint.zCoord, j);
PathPoint pathpoint3 = this.getSafePoint(entityIn, currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord - 1, j);
if (pathpoint != null && !pathpoint.isFirst && pathpoint.distanceTo(targetPoint) < maxDistance)
{
pathOptions[i++] = pathpoint;
}
if (pathpoint1 != null && !pathpoint1.isFirst && pathpoint1.distanceTo(targetPoint) < maxDistance)
{
pathOptions[i++] = pathpoint1;
}
if (pathpoint2 != null && !pathpoint2.isFirst && pathpoint2.distanceTo(targetPoint) < maxDistance)
{
pathOptions[i++] = pathpoint2;
}
if (pathpoint3 != null && !pathpoint3.isFirst && pathpoint3.distanceTo(targetPoint) < maxDistance)
{
pathOptions[i++] = pathpoint3;
}
return i;
}
/**
* Returns a point that the entity can safely move to
*/
private PathPoint getSafePoint(Entity entityIn, int x, int y, int z, int p_176171_5_)
{
PathPoint pathpoint = null;
int i = this.getVerticalOffset(entityIn, x, y, z);
if (i == 2)
{
return this.openPoint(x, y, z);
}
else
{
if (i == 1)
{
pathpoint = this.openPoint(x, y, z);
}
if (pathpoint == null && p_176171_5_ > 0 && i != -3 && i != -4 && this.getVerticalOffset(entityIn, x, y + p_176171_5_, z) == 1)
{
pathpoint = this.openPoint(x, y + p_176171_5_, z);
y += p_176171_5_;
}
if (pathpoint != null)
{
int j = 0;
int k;
for (k = 0; y > 0; pathpoint = this.openPoint(x, y, z))
{
k = this.getVerticalOffset(entityIn, x, y - 1, z);
if (this.avoidsWater && k == -1)
{
return null;
}
if (k != 1)
{
break;
}
if (j++ >= entityIn.getMaxSafePointTries())
{
return null;
}
--y;
if (y <= 0)
{
return null;
}
}
if (k == -2)
{
return null;
}
}
return pathpoint;
}
}
/**
* Checks if an entity collides with blocks at a position.
* Returns 1 if clear, 0 for colliding with any solid block, -1 for water(if avoids water),
* -2 for lava, -3 for fence and wall, -4 for closed trapdoor, 2 if otherwise clear except for open trapdoor or
* water(if not avoiding)
*/
private int getVerticalOffset(Entity entityIn, int x, int y, int z)
{
return func_176170_a(this.blockaccess, entityIn, x, y, z, this.entitySizeX, this.entitySizeY, this.entitySizeZ, this.avoidsWater, this.canBreakDoors, this.canEnterDoors);
}
public static int func_176170_a(IBlockAccess blockaccessIn, Entity entityIn, int x, int y, int z, int sizeX, int sizeY, int sizeZ, boolean avoidWater, boolean breakDoors, boolean enterDoors)
{
boolean flag = false;
BlockPos blockpos = new BlockPos(entityIn);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int i = x; i < x + sizeX; ++i)
{
for (int j = y; j < y + sizeY; ++j)
{
for (int k = z; k < z + sizeZ; ++k)
{
blockpos$mutableblockpos.set(i, j, k);
Block block = blockaccessIn.getBlock(blockpos$mutableblockpos.getX(), blockpos$mutableblockpos.getY(), blockpos$mutableblockpos.getZ());
if (block.getMaterial() != Material.air)
{
if (block != Blocks.trapdoor)
{
if (block != Blocks.flowing_water && block != Blocks.water)
{
if (!enterDoors && block instanceof BlockDoor && block.getMaterial() == Material.wood)
{
return 0;
}
}
else
{
if (avoidWater)
{
return -1;
}
flag = true;
}
}
else
{
flag = true;
}
if (entityIn.worldObj.getBlock(blockpos$mutableblockpos.getX(), blockpos$mutableblockpos.getY(), blockpos$mutableblockpos.getZ()) instanceof BlockRailBase)
{
if (!(entityIn.worldObj.getBlock(blockpos.getX(), blockpos.getY(), blockpos.getZ()) instanceof BlockRailBase) && !(entityIn.worldObj.getBlock(blockpos.down().getX(), blockpos.down().getY(), blockpos.down().getZ()) instanceof BlockRailBase))
{
return -3;
}
}
else if (!block.getBlocksMovement(blockaccessIn, blockpos$mutableblockpos.getX(), blockpos$mutableblockpos.getY(), blockpos$mutableblockpos.getZ()) && (!breakDoors || !(block instanceof BlockDoor) || block.getMaterial() != Material.wood))
{
if (block instanceof BlockFence || block instanceof BlockFenceGate || block instanceof BlockWall)
{
return -3;
}
if (block == Blocks.trapdoor)
{
return -4;
}
Material material = block.getMaterial();
if (material != Material.lava)
{
return 0;
}
if (!entityIn.handleLavaMovement())
{
return -2;
}
}
}
}
}
}
return flag ? 2 : 1;
}
public void setEnterDoors(boolean canEnterDoorsIn)
{
this.canEnterDoors = canEnterDoorsIn;
}
public void setBreakDoors(boolean canBreakDoorsIn)
{
this.canBreakDoors = canBreakDoorsIn;
}
public void setAvoidsWater(boolean avoidsWaterIn)
{
this.avoidsWater = avoidsWaterIn;
}
public void setCanSwim(boolean canSwimIn)
{
this.canSwim = canSwimIn;
}
public boolean getEnterDoors()
{
return this.canEnterDoors;
}
public boolean getCanSwim()
{
return this.canSwim;
}
public boolean getAvoidsWater()
{
return this.avoidsWater;
}
}
@@ -21,14 +21,12 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.stats.Achievement;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ReportedException; import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.FakePlayer;
import noppes.npcs.CommonProxy; import noppes.npcs.CommonProxy;
import noppes.npcs.CustomNpcs; import noppes.npcs.CustomNpcs;
import noppes.npcs.LogWriter; import noppes.npcs.LogWriter;
@@ -64,7 +62,16 @@ import noppes.npcs.client.controllers.PresetController;
import noppes.npcs.client.fx.EntityElementalStaffFX; import noppes.npcs.client.fx.EntityElementalStaffFX;
import noppes.npcs.client.fx.EntityEnderFX; import noppes.npcs.client.fx.EntityEnderFX;
import noppes.npcs.client.fx.EntityRainbowFX; import noppes.npcs.client.fx.EntityRainbowFX;
import noppes.npcs.client.gui.*; import noppes.npcs.client.gui.GuiBorderBlock;
import noppes.npcs.client.gui.GuiMerchantAdd;
import noppes.npcs.client.gui.GuiNpcDimension;
import noppes.npcs.client.gui.GuiNpcMobSpawner;
import noppes.npcs.client.gui.GuiNpcMobSpawnerMounter;
import noppes.npcs.client.gui.GuiNpcPather;
import noppes.npcs.client.gui.GuiNpcRedstoneBlock;
import noppes.npcs.client.gui.GuiNpcRemoteEditor;
import noppes.npcs.client.gui.GuiNpcWaypoint;
import noppes.npcs.client.gui.GuiScript;
import noppes.npcs.client.gui.global.GuiNPCManageBanks; import noppes.npcs.client.gui.global.GuiNPCManageBanks;
import noppes.npcs.client.gui.global.GuiNPCManageDialogs; import noppes.npcs.client.gui.global.GuiNPCManageDialogs;
import noppes.npcs.client.gui.global.GuiNPCManageFactions; import noppes.npcs.client.gui.global.GuiNPCManageFactions;
@@ -98,9 +105,19 @@ import noppes.npcs.client.gui.roles.GuiNpcFollowerSetup;
import noppes.npcs.client.gui.roles.GuiNpcItemGiver; import noppes.npcs.client.gui.roles.GuiNpcItemGiver;
import noppes.npcs.client.gui.roles.GuiNpcTraderSetup; import noppes.npcs.client.gui.roles.GuiNpcTraderSetup;
import noppes.npcs.client.gui.roles.GuiNpcTransporter; import noppes.npcs.client.gui.roles.GuiNpcTransporter;
import noppes.npcs.client.gui.script.GuiScriptGlobal; import noppes.npcs.client.model.ModelNPCGolem;
import noppes.npcs.client.model.*; import noppes.npcs.client.model.ModelNpcCrystal;
import noppes.npcs.client.renderer.*; import noppes.npcs.client.model.ModelNpcDragon;
import noppes.npcs.client.model.ModelNpcSlime;
import noppes.npcs.client.model.ModelSkirtArmor;
import noppes.npcs.client.renderer.NpcItemRenderer;
import noppes.npcs.client.renderer.RenderCustomNpc;
import noppes.npcs.client.renderer.RenderNPCHumanMale;
import noppes.npcs.client.renderer.RenderNPCPony;
import noppes.npcs.client.renderer.RenderNpcCrystal;
import noppes.npcs.client.renderer.RenderNpcDragon;
import noppes.npcs.client.renderer.RenderNpcSlime;
import noppes.npcs.client.renderer.RenderProjectile;
import noppes.npcs.client.renderer.blocks.BlockBannerRenderer; import noppes.npcs.client.renderer.blocks.BlockBannerRenderer;
import noppes.npcs.client.renderer.blocks.BlockBarrelRenderer; import noppes.npcs.client.renderer.blocks.BlockBarrelRenderer;
import noppes.npcs.client.renderer.blocks.BlockBeamRenderer; import noppes.npcs.client.renderer.blocks.BlockBeamRenderer;
@@ -144,10 +161,15 @@ import noppes.npcs.containers.ContainerNPCTraderSetup;
import noppes.npcs.containers.ContainerNpcItemGiver; import noppes.npcs.containers.ContainerNpcItemGiver;
import noppes.npcs.containers.ContainerNpcQuestReward; import noppes.npcs.containers.ContainerNpcQuestReward;
import noppes.npcs.containers.ContainerNpcQuestTypeItem; import noppes.npcs.containers.ContainerNpcQuestTypeItem;
import noppes.npcs.controllers.PlayerData; import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.*; import noppes.npcs.entity.EntityNPCGolem;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.entity.EntityNpcCrystal;
import noppes.npcs.entity.EntityNpcDragon;
import noppes.npcs.entity.EntityNpcPony;
import noppes.npcs.entity.EntityNpcSlime;
import noppes.npcs.entity.EntityProjectile;
import noppes.npcs.scripted.interfaces.IWorld;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import tconstruct.client.tabs.InventoryTabFactions; import tconstruct.client.tabs.InventoryTabFactions;
@@ -176,10 +198,7 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityNpcDragon.class, new RenderNpcDragon(new ModelNpcDragon(0.0F), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityNpcDragon.class, new RenderNpcDragon(new ModelNpcDragon(0.0F), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityNpcSlime.class, new RenderNpcSlime(new ModelNpcSlime(16), new ModelNpcSlime(0), 0.25F)); RenderingRegistry.registerEntityRenderingHandler(EntityNpcSlime.class, new RenderNpcSlime(new ModelNpcSlime(16), new ModelNpcSlime(0), 0.25F));
RenderingRegistry.registerEntityRenderingHandler(EntityProjectile.class, new RenderProjectile()); RenderingRegistry.registerEntityRenderingHandler(EntityProjectile.class, new RenderProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntityCustomNpc.class, new RenderCustomNpc()); RenderingRegistry.registerEntityRenderingHandler(EntityCustomNpc.class, new RenderCustomNpc());
RenderingRegistry.registerEntityRenderingHandler(EntityNPCGolem.class, new RenderNPCHumanMale( RenderingRegistry.registerEntityRenderingHandler(EntityNPCGolem.class, new RenderNPCHumanMale(
new ModelNPCGolem(0), new ModelNPCGolem(1F), new ModelNPCGolem(0.5F))); new ModelNPCGolem(0), new ModelNPCGolem(1F), new ModelNPCGolem(0.5F)));
FMLCommonHandler.instance().bus().register(new ClientTickHandler()); FMLCommonHandler.instance().bus().register(new ClientTickHandler());
@@ -228,21 +247,17 @@ public class ClientProxy extends CommonProxy {
ClientCloneController.Instance = new ClientCloneController(); ClientCloneController.Instance = new ClientCloneController();
MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
if(CustomNpcs.InventoryGuiEnabled){ if(CustomNpcs.InventoryGuiEnabled){
MinecraftForge.EVENT_BUS.register(new TabRegistry()); MinecraftForge.EVENT_BUS.register(new TabRegistry());
if (TabRegistry.getTabList().size() < 2){ if (TabRegistry.getTabList().size() < 2){
TabRegistry.registerTab(new InventoryTabVanilla()); TabRegistry.registerTab(new InventoryTabVanilla());
} }
TabRegistry.registerTab(new InventoryTabFactions()); TabRegistry.registerTab(new InventoryTabFactions());
TabRegistry.registerTab(new InventoryTabQuests()); TabRegistry.registerTab(new InventoryTabQuests());
} }
}
public FakePlayer getCommandPlayer(IWorld world) {
return (FakePlayer)(new EntityCustomNpc(world.getMCWorld())).getFakePlayer();
} }
private void createFolders() { private void createFolders() {
@@ -275,20 +290,6 @@ public class ClientProxy extends CommonProxy {
((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new CustomNpcResourceListener()); ((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new CustomNpcResourceListener());
} }
public static PlayerData playerData = new PlayerData();
@Override
public PlayerData getPlayerData(EntityPlayer player) {
if (player.getUniqueID() == Minecraft.getMinecraft().thePlayer.getUniqueID()) {
if (playerData.player != player) {
playerData.player = player;
}
return playerData;
} else {
return null;
}
}
@Override @Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
@@ -300,8 +301,6 @@ public class ClientProxy extends CommonProxy {
return getGui(npc, gui, container, x, y, z); return getGui(npc, gui, container, x, y, z);
} }
private GuiScreen getGui(EntityNPCInterface npc, EnumGuiType gui, Container container, int x, int y, int z) { private GuiScreen getGui(EntityNPCInterface npc, EnumGuiType gui, Container container, int x, int y, int z) {
if (gui == EnumGuiType.MainMenuDisplay){ if (gui == EnumGuiType.MainMenuDisplay){
if(npc != null) if(npc != null)
@@ -346,7 +345,7 @@ public class ClientProxy extends CommonProxy {
return new GuiNPCManageQuest(npc); return new GuiNPCManageQuest(npc);
else if(gui == EnumGuiType.ManageBanks) else if(gui == EnumGuiType.ManageBanks)
return new GuiNPCManageBanks(npc,(ContainerManageBanks) container); return new GuiNPCManageBanks(npc,(ContainerManageBanks) container);
else if (gui == EnumGuiType.MainMenuGlobal) else if (gui == EnumGuiType.MainMenuGlobal)
return new GuiNPCGlobalMainMenu(npc); return new GuiNPCGlobalMainMenu(npc);
@@ -393,9 +392,6 @@ public class ClientProxy extends CommonProxy {
else if(gui == EnumGuiType.NpcRemote && Minecraft.getMinecraft().currentScreen == null) else if(gui == EnumGuiType.NpcRemote && Minecraft.getMinecraft().currentScreen == null)
return new GuiNpcRemoteEditor(); return new GuiNpcRemoteEditor();
else if(gui == EnumGuiType.ScriptEvent && Minecraft.getMinecraft().currentScreen == null)
return new GuiScriptGlobal();
else if(gui == EnumGuiType.PlayerMailman) else if(gui == EnumGuiType.PlayerMailman)
return new GuiMailmanWrite((ContainerMail) container, x == 1, y == 1); return new GuiMailmanWrite((ContainerMail) container, x == 1, y == 1);
@@ -486,18 +482,18 @@ public class ClientProxy extends CommonProxy {
if(string.equals("Spell")){ if(string.equals("Spell")){
int color = (Integer) ob[0]; int color = (Integer) ob[0];
int number = (Integer) ob[1]; int number = (Integer) ob[1];
for(int i = 0; i < number; i++){ for(int i = 0; i < number; i++){
Random rand = player.worldObj.rand; Random rand = player.worldObj.rand;
double x = (rand.nextDouble() - 0.5D) * (double)player.width; double x = (rand.nextDouble() - 0.5D) * (double)player.width;
double y = player.getEyeHeight(); double y = player.getEyeHeight();
double z = (rand.nextDouble() - 0.5D) * (double)player.width; double z = (rand.nextDouble() - 0.5D) * (double)player.width;
double f = (rand.nextDouble() - 0.5D) * 2D; double f = (rand.nextDouble() - 0.5D) * 2D;
double f1 = -rand.nextDouble(); double f1 = -rand.nextDouble();
double f2 = (rand.nextDouble() - 0.5D) * 2D; double f2 = (rand.nextDouble() - 0.5D) * 2D;
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityElementalStaffFX(player, x, y, z, f, f1, f2, color)); Minecraft.getMinecraft().effectRenderer.addEffect(new EntityElementalStaffFX(player, x, y, z, f, f1, f2, color));
} }
} }
else if(string.equals("ModelData")){ else if(string.equals("ModelData")){
ModelData data = (ModelData) ob[0]; ModelData data = (ModelData) ob[0];
@@ -514,18 +510,18 @@ public class ClientProxy extends CommonProxy {
} }
else if(particles.type == 1){ else if(particles.type == 1){
for(int i = 0; i < 2; i++){ for(int i = 0; i < 2; i++){
double x = player.posX + (rand.nextDouble() - 0.5D) * 0.9; double x = player.posX + (rand.nextDouble() - 0.5D) * 0.9;
double y = (player.posY + rand.nextDouble() * 1.9) - 0.25D - height; double y = (player.posY + rand.nextDouble() * 1.9) - 0.25D - height;
double z = player.posZ + (rand.nextDouble() - 0.5D) * 0.9; double z = player.posZ + (rand.nextDouble() - 0.5D) * 0.9;
double f = (rand.nextDouble() - 0.5D) * 2D; double f = (rand.nextDouble() - 0.5D) * 2D;
double f1 = -rand.nextDouble(); double f1 = -rand.nextDouble();
double f2 = (rand.nextDouble() - 0.5D) * 2D; double f2 = (rand.nextDouble() - 0.5D) * 2D;
minecraft.effectRenderer.addEffect(new EntityRainbowFX(player.worldObj, x, y, z, f, f1, f2)); minecraft.effectRenderer.addEffect(new EntityRainbowFX(player.worldObj, x, y, z, f, f1, f2));
} }
} }
} }
} }
@@ -553,9 +549,9 @@ public class ClientProxy extends CommonProxy {
try{ try{
if(location == null) if(location == null)
return; return;
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
if(location != null) if(location != null)
texturemanager.bindTexture((ResourceLocation) location); texturemanager.bindTexture((ResourceLocation) location);
} }
catch(NullPointerException ex){ catch(NullPointerException ex){
@@ -567,7 +563,7 @@ public class ClientProxy extends CommonProxy {
@Override @Override
public void spawnParticle(String particle, double x, double y, double z, public void spawnParticle(String particle, double x, double y, double z,
double motionX, double motionY, double motionZ, float scale) { double motionX, double motionY, double motionZ, float scale) {
RenderGlobal render = Minecraft.getMinecraft().renderGlobal; RenderGlobal render = Minecraft.getMinecraft().renderGlobal;
@@ -575,23 +571,14 @@ public class ClientProxy extends CommonProxy {
if(fx == null) if(fx == null)
return; return;
if (particle.equals("flame")){ if (particle.equals("flame")){
ObfuscationReflectionHelper.setPrivateValue(EntityFlameFX.class, (EntityFlameFX)fx, scale, 0); ObfuscationReflectionHelper.setPrivateValue(EntityFlameFX.class, (EntityFlameFX)fx, scale, 0);
} }
else if (particle.equals("smoke")){ else if (particle.equals("smoke")){
ObfuscationReflectionHelper.setPrivateValue(EntitySmokeFX.class, (EntitySmokeFX)fx, scale, 0); ObfuscationReflectionHelper.setPrivateValue(EntitySmokeFX.class, (EntitySmokeFX)fx, scale, 0);
} }
} }
@Override
public String getAchievementDesc(Achievement achievement) {
return achievement.getDescription();
}
@Override
public boolean isGUIOpen(){
return Minecraft.getMinecraft().currentScreen != null;
}
public static class FontContainer { public static class FontContainer {
private StringCache textFont = null; private StringCache textFont = null;
@@ -605,11 +592,11 @@ public class ClientProxy extends CommonProxy {
textFont = new StringCache(); textFont = new StringCache();
textFont.setDefaultFont("Arial", fontSize, true); textFont.setDefaultFont("Arial", fontSize, true);
useCustomFont = !fontType.equalsIgnoreCase("minecraft"); useCustomFont = !fontType.equalsIgnoreCase("minecraft");
try { try {
if(!useCustomFont || fontType.isEmpty() || fontType.equalsIgnoreCase("default")) if(!useCustomFont || fontType.isEmpty() || fontType.equalsIgnoreCase("default"))
textFont.setCustomFont(new ResourceLocation("customnpcs","OpenSans.ttf"), fontSize, true); textFont.setCustomFont(new ResourceLocation("customnpcs","OpenSans.ttf"), fontSize, true);
else else
textFont.setDefaultFont(fontType, fontSize, true); textFont.setDefaultFont(fontType, fontSize, true);
} catch (Exception e) { } catch (Exception e) {
LogWriter.info("Failed loading font so using Arial"); LogWriter.info("Failed loading font so using Arial");
} }
@@ -14,15 +14,11 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent; import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
public class ClientTickHandler{ public class ClientTickHandler{
private World prevWorld; private World prevWorld;
private boolean otherContainer = false; private boolean otherContainer = false;
private int buttonPressed = -1;
private long buttonTime = 0L;
private final int[] ignoreKeys = new int[]{157, 29, 54, 42, 184, 56, 220, 219};
@SubscribeEvent(priority = EventPriority.LOWEST) @SubscribeEvent(priority = EventPriority.LOWEST)
public void onClientTick(TickEvent.ClientTickEvent event){ public void onClientTick(TickEvent.ClientTickEvent event){
@@ -45,14 +41,6 @@ public class ClientTickHandler{
} }
} }
@SubscribeEvent
public void onMouse(InputEvent.MouseInputEvent event){
if(Mouse.getEventButton() == -1 && Mouse.getDWheel() == 0)
return;
NoppesUtilPlayer.sendData(EnumPlayerPacket.MouseClicked, new Object[]{Mouse.getEventButton(),Mouse.getEventDWheel(),Mouse.isButtonDown(Mouse.getEventButton())});
}
@SubscribeEvent @SubscribeEvent
public void onKey(InputEvent.KeyInputEvent event){ public void onKey(InputEvent.KeyInputEvent event){
if(ClientProxy.QuestLog.isPressed()){ if(ClientProxy.QuestLog.isPressed()){
@@ -62,37 +50,6 @@ public class ClientTickHandler{
else if(mc.currentScreen instanceof GuiQuestLog) else if(mc.currentScreen instanceof GuiQuestLog)
mc.setIngameFocus(); mc.setIngameFocus();
} }
int key = Keyboard.getEventKey();
long time = Keyboard.getEventNanoseconds();
if(Keyboard.getEventKeyState()) {
if(!this.isIgnoredKey(key)) {
this.buttonTime = time;
}
}
if(time-this.buttonTime == 0 || !Keyboard.getEventKeyState()) {
boolean isCtrlPressed = Keyboard.isKeyDown(157) || Keyboard.isKeyDown(29);
boolean isShiftPressed = Keyboard.isKeyDown(54) || Keyboard.isKeyDown(42);
boolean isAltPressed = Keyboard.isKeyDown(184) || Keyboard.isKeyDown(56);
boolean isMetaPressed = Keyboard.isKeyDown(220) || Keyboard.isKeyDown(219);
boolean keyDown = Keyboard.isKeyDown(key);
NoppesUtilPlayer.sendData(EnumPlayerPacket.KeyPressed, new Object[]{Integer.valueOf(key), Boolean.valueOf(isCtrlPressed), Boolean.valueOf(isShiftPressed), Boolean.valueOf(isAltPressed), Boolean.valueOf(isMetaPressed), Boolean.valueOf(keyDown)});
}
} }
private boolean isIgnoredKey(int key) {
int[] var2 = this.ignoreKeys;
int var3 = var2.length;
for(int var4 = 0; var4 < var3; ++var4) {
int i = var2[var4];
if(i == key) {
return true;
}
}
return false;
}
} }
@@ -6,14 +6,12 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Vector; import java.util.Vector;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@@ -23,7 +21,6 @@ import net.minecraft.world.World;
import noppes.npcs.CustomNpcs; import noppes.npcs.CustomNpcs;
import noppes.npcs.NoppesUtilPlayer; import noppes.npcs.NoppesUtilPlayer;
import noppes.npcs.Server; import noppes.npcs.Server;
import noppes.npcs.client.fx.EntityCustomFX;
import noppes.npcs.client.gui.player.GuiDialogInteract; import noppes.npcs.client.gui.player.GuiDialogInteract;
import noppes.npcs.client.gui.player.GuiQuestCompletion; import noppes.npcs.client.gui.player.GuiQuestCompletion;
import noppes.npcs.client.gui.util.GuiContainerNPCInterface; import noppes.npcs.client.gui.util.GuiContainerNPCInterface;
@@ -70,57 +67,6 @@ public class NoppesUtil {
} }
} }
public static void spawnScriptedParticle(ByteBuf buffer){
Minecraft minecraft = Minecraft.getMinecraft();
String directory = Server.readString(buffer);
int HEXcolor = buffer.readInt();
int amount = buffer.readInt();
int maxAge = buffer.readInt();
double x = buffer.readDouble();
double y = buffer.readDouble();
double z = buffer.readDouble();
double motionX = buffer.readDouble();
double motionY = buffer.readDouble();
double motionZ = buffer.readDouble();
float gravity = buffer.readFloat();
float scale1 = buffer.readFloat();
float scale2 = buffer.readFloat();
float scaleRate = buffer.readFloat();
int scaleRateStart = buffer.readInt();
float alpha1 = buffer.readFloat();
float alpha2 = buffer.readFloat();
float alphaRate = buffer.readFloat();
int alphaRateStart = buffer.readInt();
int entityID = buffer.readInt();
World worldObj = Minecraft.getMinecraft().theWorld;
Entity entity = worldObj.getEntityByID(entityID);
if(entity == null)
return;
EntityCustomFX fx = new EntityCustomFX(
entity,
directory, HEXcolor,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
alpha1, alpha2, alphaRate, alphaRateStart,
maxAge
);
for(int i = 0; i < amount; i++){
minecraft.effectRenderer.addEffect(fx);
}
}
public static void clickSound() { public static void clickSound() {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
} }
@@ -291,7 +237,4 @@ public class NoppesUtil {
CustomNpcs.proxy.openGui(x, y, z, EnumGuiType.Waypoint, player); CustomNpcs.proxy.openGui(x, y, z, EnumGuiType.Waypoint, player);
} }
public static void isGUIOpen(boolean isGUIOpen) {
Client.sendData(EnumPacketServer.IsGuiOpen, isGUIOpen);
}
} }
@@ -151,9 +151,6 @@ public class PacketHandlerClient extends PacketHandlerServer{
EnumGuiType gui = EnumGuiType.values()[buffer.readInt()]; EnumGuiType gui = EnumGuiType.values()[buffer.readInt()];
CustomNpcs.proxy.openGui(NoppesUtil.getLastNpc(), gui, buffer.readInt(), buffer.readInt(), buffer.readInt()); CustomNpcs.proxy.openGui(NoppesUtil.getLastNpc(), gui, buffer.readInt(), buffer.readInt(), buffer.readInt());
} }
else if(type == EnumPacketClient.SCRIPTED_PARTICLE){
NoppesUtil.spawnScriptedParticle(buffer);
}
else if(type == EnumPacketClient.PARTICLE){ else if(type == EnumPacketClient.PARTICLE){
NoppesUtil.spawnParticle(buffer); NoppesUtil.spawnParticle(buffer);
} }
@@ -254,10 +251,8 @@ public class PacketHandlerClient extends PacketHandlerServer{
player.addChatMessage(new ChatComponentTranslation("Current font is %s", ClientProxy.Font.getName())); player.addChatMessage(new ChatComponentTranslation("Current font is %s", ClientProxy.Font.getName()));
} }
} }
else if(type == EnumPacketClient.ISGUIOPEN){
boolean isGUIOpen = Minecraft.getMinecraft().currentScreen != null;
NoppesUtil.isGUIOpen(isGUIOpen);
}
} }
} }
@@ -1,22 +1,10 @@
package noppes.npcs.client.controllers; package noppes.npcs.client.controllers;
import java.util.Map;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import net.minecraft.block.BlockJukebox;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.audio.SoundHandler; import net.minecraft.client.audio.SoundHandler;
import net.minecraft.client.audio.SoundManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemRecord;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import noppes.npcs.client.AssetsBrowser;
public class MusicController { public class MusicController {
@@ -1,162 +0,0 @@
package noppes.npcs.client.fx;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.ClientProxy;
import org.lwjgl.Sys;
import org.lwjgl.opengl.GL11;
public class EntityCustomFX extends EntityFX {
private Entity entity;
private final ResourceLocation location;
private static final ResourceLocation resource = new ResourceLocation("textures/particle/particles.png");
private boolean move = true;
private float startX = 0, startY = 0, startZ = 0;
public float scale1 = 1.0F;
public float scale2 = 1.0F;
public float scaleRate = 1.0F;
public int scaleRateStart = 0;
public float alpha1 = 1.0F;
public float alpha2 = 0;
public float alphaRate = 0.0F;
public int alphaRateStart = 0;
public EntityCustomFX(Entity entity, String directory, int HEXColor, double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
float scale1, float scale2, float scaleRate, int scaleRateStart,
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
int age) {
super(entity.worldObj, x, y, z, motionX, motionY, motionZ);
this.scale1 = scale1;
this.scale2 = scale2;
this.scaleRate = Math.abs(scaleRate);
this.scaleRateStart = scaleRateStart;
particleScale = scale1;
if(scale1 > scale2)
this.scaleRate *= -1;
this.alpha1 = alpha1;
this.alpha2 = alpha2;
this.alphaRate = Math.abs(alphaRate);
this.alphaRateStart = alphaRateStart;
particleAlpha = alpha1;
if(alpha1 > alpha2)
this.alphaRate *= -1;
particleGravity = gravity/0.04F;
particleMaxAge = age;
this.motionX = motionX;
this.motionY = motionY;
this.motionZ = motionZ;
this.entity = entity;
noClip = true;
particleRed = (HEXColor >> 16 & 255) / 255f;
particleGreen = (HEXColor >> 8 & 255) / 255f;
particleBlue = (HEXColor & 255) / 255f;
if(Math.floor(Math.random()*3) == 1){
move = false;
this.startX = (float) entity.posX;
this.startY = (float) entity.posY;
this.startZ = (float) entity.posZ;
}
location = new ResourceLocation(directory);
}
@Override
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
if(move){
startX = (float)(entity.prevPosX + (entity.posX - entity.prevPosX) * (double)par2);
startY = (float)(entity.prevPosY + (entity.posY - entity.prevPosY) * (double)par2);
startZ = (float)(entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)par2);
}
Tessellator tessellator = Tessellator.instance;
tessellator.draw();
float scale = this.scaleRate / (float)particleMaxAge;
if((this.scaleRate < 0 && particleScale+scale < this.scale2) || (this.scaleRate > 0 && particleScale+scale > this.scale2))
particleScale = this.scale2;
else if(particleAge >= this.scaleRateStart)
particleScale += scale;
float alpha = this.alphaRate / (float)particleMaxAge;
if((this.alphaRate < 0 && particleAlpha+alpha < this.alpha2) || (this.alphaRate > 0 && particleAlpha+alpha > this.alpha2))
particleAlpha = this.alpha2;
else if(particleAge >= this.alphaRateStart)
particleAlpha += alpha;
ClientProxy.bindTexture(location);
float f = 0.0f;
float f1 = 1.0f;
float f2 = 0.0f;
float f3 = 1.0f;
float f4 = 0.1F * particleScale;
float f5 = (float)(((prevPosX + (posX - prevPosX) * (double)par2) - interpPosX) + startX);
float f6 = (float)(((prevPosY + (posY - prevPosY) * (double)par2) - interpPosY) + startY);
float f7 = (float)(((prevPosZ + (posZ - prevPosZ) * (double)par2) - interpPosZ) + startZ);
tessellator.startDrawingQuads();
tessellator.setBrightness(240);
par1Tessellator.setColorOpaque_F(1, 1, 1);
par1Tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha);
par1Tessellator.addVertexWithUV(f5 - par3 * f4 - par6 * f4, f6 - par4 * f4, f7 - par5 * f4 - par7 * f4, f1, f3);
par1Tessellator.addVertexWithUV((f5 - par3 * f4) + par6 * f4, f6 + par4 * f4, (f7 - par5 * f4) + par7 * f4, f1, f2);
par1Tessellator.addVertexWithUV(f5 + par3 * f4 + par6 * f4, f6 + par4 * f4, f7 + par5 * f4 + par7 * f4, f, f2);
par1Tessellator.addVertexWithUV((f5 + par3 * f4) - par6 * f4, f6 - par4 * f4, (f7 + par5 * f4) - par7 * f4, f, f3);
/*
Minecraft minecraft = Minecraft.getMinecraft();
EntityPlayer player = minecraft.thePlayer;
double yaw = (player.rotationYaw/180)*Math.PI;
double pitch = (player.rotationPitch/180)*Math.PI;
double angle = Minecraft.getMinecraft().theWorld.getWorldTime()%360;
double angleRad = (angle/180)*Math.PI;
double angleX = Math.sin(yaw)*Math.cos(pitch);
if(Math.abs(angleX) < 0.0001){
angleX = 0.0D;
}
double angleY = Math.sin(pitch);
if(Math.abs(angleY) < 0.0001){
angleY = 0.0D;
}
double angleZ = -Math.cos(yaw)*Math.cos(pitch);
if(Math.abs(angleZ) < 0.0001){
angleZ = 0.0D;
}
double translateX = 0;
double translateY = 0;
double translateZ = 0;
*/
GL11.glPushMatrix();
GL11.glColor4f(1, 1, 1, 1.0F);
//GL11.glTranslated(translateX,translateY,translateZ);
//GL11.glRotated(angle, angleX, angleY, angleZ);
tessellator.draw();
ClientProxy.bindTexture(resource);
tessellator.startDrawingQuads();
GL11.glPopMatrix();
}
public int getFXLayer(){
return 0;
}
}
@@ -1,103 +0,0 @@
package noppes.npcs.client.gui;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import noppes.npcs.EventScriptContainer;
import noppes.npcs.client.gui.util.GuiCustomScroll;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.SubGuiInterface;
public class EventGuiScriptList extends SubGuiInterface{
private GuiCustomScroll scroll1;
private GuiCustomScroll scroll2;
private EventScriptContainer container;
private List<String> scripts;
public EventGuiScriptList(List<String> scripts, EventScriptContainer container){
this.container = container;
setBackground("menubg.png");
xSize = 346;
ySize = 216;
if(scripts == null)
scripts = new ArrayList<String>();
this.scripts = scripts;
}
@Override
public void initGui(){
super.initGui();
if(scroll1 == null){
scroll1 = new GuiCustomScroll(this,0);
scroll1.setSize(140, 180);
}
scroll1.guiLeft = guiLeft + 4;
scroll1.guiTop = guiTop + 14;
this.addScroll(scroll1);
addLabel(new GuiNpcLabel(1, "script.availableScripts", guiLeft + 4, guiTop + 4));
if(scroll2 == null){
scroll2 = new GuiCustomScroll(this,1);
scroll2.setSize(140, 180);
}
scroll2.guiLeft = guiLeft + 200;
scroll2.guiTop = guiTop + 14;
this.addScroll(scroll2);
addLabel(new GuiNpcLabel(2, "script.loadedScripts", guiLeft + 200, guiTop + 4));
List<String> temp = new ArrayList<String>(scripts);
temp.removeAll(container.scripts);
scroll1.setList(temp);
scroll2.setList(container.scripts);
addButton(new GuiNpcButton(1, guiLeft + 145, guiTop + 40, 55, 20, ">"));
addButton(new GuiNpcButton(2, guiLeft + 145, guiTop + 62, 55, 20, "<"));
addButton(new GuiNpcButton(3, guiLeft + 145, guiTop + 90, 55, 20, ">>"));
addButton(new GuiNpcButton(4, guiLeft + 145, guiTop + 112, 55, 20, "<<"));
addButton(new GuiNpcButton(66, guiLeft + 260, guiTop + 194, 60, 20, "gui.done"));
}
protected void actionPerformed(GuiButton guibutton){
GuiNpcButton button = (GuiNpcButton) guibutton;
if(button.id == 1){
if(scroll1.hasSelected()){
container.scripts.add(scroll1.getSelected());
scroll1.selected = -1;
scroll1.selected = -1;
initGui();
}
}
if(button.id == 2){
if(scroll2.hasSelected()){
container.scripts.remove(scroll2.getSelected());
scroll2.selected = -1;
initGui();
}
}
if(button.id == 3){
container.scripts.clear();
for(String script : scripts){
container.scripts.add(script);
}
scroll1.selected = -1;
scroll1.selected = -1;
initGui();
}
if(button.id == 4){
container.scripts.clear();
scroll1.selected = -1;
scroll1.selected = -1;
initGui();
}
if(button.id == 66){
close();
}
}
@Override
public void save() {
}
}
@@ -39,7 +39,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
public GuiNpcMobSpawner(int i, int j, int k) { public GuiNpcMobSpawner(int i, int j, int k) {
super(); super();
xSize = 384; xSize = 256;
posX = i; posX = i;
posY = j; posY = j;
@@ -56,7 +56,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
if(scroll == null){ if(scroll == null){
scroll = new GuiCustomScroll(this,0); scroll = new GuiCustomScroll(this,0);
scroll.setSize(293, 188); scroll.setSize(165, 188);
} }
else else
scroll.clear(); scroll.clear();
@@ -64,7 +64,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
scroll.guiTop = guiTop + 26; scroll.guiTop = guiTop + 26;
addScroll(scroll); addScroll(scroll);
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 4, 293, 20, search)); addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 4, 165, 20, search));
GuiMenuTopButton button; GuiMenuTopButton button;
addTopButton(button = new GuiMenuTopButton(3,guiLeft + 4, guiTop - 17, "spawner.clones")); addTopButton(button = new GuiMenuTopButton(3,guiLeft + 4, guiTop - 17, "spawner.clones"));
@@ -74,38 +74,28 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
addTopButton(button = new GuiMenuTopButton(5, button, "gui.server")); addTopButton(button = new GuiMenuTopButton(5, button, "gui.server"));
button.active = showingClones == 2; button.active = showingClones == 2;
addButton(new GuiNpcButton(1, guiLeft + 298, guiTop + 6, 82, 20, "item.monsterPlacer.name")); addButton(new GuiNpcButton(1, guiLeft + 170, guiTop + 6, 82, 20, "item.monsterPlacer.name"));
addButton(new GuiNpcButton(2, guiLeft + 298, guiTop + 100, 82, 20, "spawner.mobspawner")); addButton(new GuiNpcButton(2, guiLeft + 170, guiTop + 100, 82, 20, "spawner.mobspawner"));
if(showingClones == 0 || showingClones == 2){ if(showingClones == 0 || showingClones == 2){
addSideButton(new GuiMenuSideButton(21,guiLeft - 69, this.guiTop + 2, 70,22, "Tab 1"));
addSideButton(new GuiMenuSideButton(22,guiLeft - 69, this.guiTop + 23, 70,22, "Tab 2"));
addSideButton(new GuiMenuSideButton(23,guiLeft - 69, this.guiTop + 44, 70,22, "Tab 3"));
addSideButton(new GuiMenuSideButton(24,guiLeft - 69, this.guiTop + 65, 70,22, "Tab 4"));
addSideButton(new GuiMenuSideButton(25,guiLeft - 69, this.guiTop + 86, 70,22, "Tab 5"));
addSideButton(new GuiMenuSideButton(26,guiLeft - 69, this.guiTop + 107, 70,22, "Tab 6"));
addSideButton(new GuiMenuSideButton(27,guiLeft - 69, this.guiTop + 128, 70,22, "Tab 7"));
addSideButton(new GuiMenuSideButton(28,guiLeft - 69, this.guiTop + 149, 70,22, "Tab 8"));
addSideButton(new GuiMenuSideButton(29,guiLeft - 69, this.guiTop + 170, 70,22, "Tab 9"));
addSideButton(new GuiMenuSideButton(21,guiLeft - 90, this.guiTop + 2, 90,22, "1")); addButton(new GuiNpcButton(6, guiLeft + 170, guiTop + 30, 82, 20, "gui.remove"));
addSideButton(new GuiMenuSideButton(22,guiLeft - 90, this.guiTop + 23, 90,22, "2"));
addSideButton(new GuiMenuSideButton(23,guiLeft - 90, this.guiTop + 44, 90,22, "3"));
addSideButton(new GuiMenuSideButton(24,guiLeft - 90, this.guiTop + 65, 90,22, "4"));
addSideButton(new GuiMenuSideButton(25,guiLeft - 90, this.guiTop + 86, 90,22, "5"));
addSideButton(new GuiMenuSideButton(26,guiLeft - 90, this.guiTop + 107, 45,22, "6"));
addSideButton(new GuiMenuSideButton(27,guiLeft - 45, this.guiTop + 107, 45,22, "7"));
addSideButton(new GuiMenuSideButton(28,guiLeft - 90, this.guiTop + 128, 45,22, "8"));
addSideButton(new GuiMenuSideButton(29,guiLeft - 45, this.guiTop + 128, 45,22, "9"));
addSideButton(new GuiMenuSideButton(30,guiLeft - 90, this.guiTop + 149, 45,22, "10"));
addSideButton(new GuiMenuSideButton(31,guiLeft - 45, this.guiTop + 149, 45,22, "11"));
addSideButton(new GuiMenuSideButton(32,guiLeft - 90, this.guiTop + 170, 45,22, "12"));
addSideButton(new GuiMenuSideButton(33,guiLeft - 45, this.guiTop + 170, 45,22, "13"));
addSideButton(new GuiMenuSideButton(34,guiLeft - 90, this.guiTop + 191, 45,22, "14"));
addSideButton(new GuiMenuSideButton(35,guiLeft - 45, this.guiTop + 191, 45,22, "15"));
addButton(new GuiNpcButton(6, guiLeft + 298, guiTop + 190, 82, 20, "gui.remove"));
getSideButton(20 + activeTab).active = true; getSideButton(20 + activeTab).active = true;
showClones(); showClones();
} }
else{ else
showEntities(); showEntities();
}
} }
private void showEntities() { private void showEntities() {
@@ -129,6 +119,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
Client.sendData(EnumPacketServer.CloneList, activeTab); Client.sendData(EnumPacketServer.CloneList, activeTab);
return; return;
} }
ArrayList<String> list = new ArrayList<String>(); ArrayList<String> list = new ArrayList<String>();
this.list = ClientCloneController.Instance.getClones(activeTab); this.list = ClientCloneController.Instance.getClones(activeTab);
scroll.setList(getSearchList()); scroll.setList(getSearchList());
@@ -44,7 +44,7 @@ public class GuiNpcMobSpawnerAdd extends GuiNPCInterface implements GuiYesNoCall
addLabel(new GuiNpcLabel(1, "Tab", guiLeft + 10, guiTop + 50)); addLabel(new GuiNpcLabel(1, "Tab", guiLeft + 10, guiTop + 50));
addButton(new GuiNpcButton(2, guiLeft + 40, guiTop + 45, 20, 20, new String[]{"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"}, tab - 1)); addButton(new GuiNpcButton(2, guiLeft + 40, guiTop + 45, 20, 20, new String[]{"1","2","3","4","5","6","7","8","9"}, tab - 1));
addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 95, new String[]{"Client side", "Server side"}, serverSide?1:0)); addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 95, new String[]{"Client side", "Server side"}, serverSide?1:0));
@@ -82,21 +82,15 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
addButton(new GuiNpcButton(2, guiLeft + 170, guiTop + 50, 82, 20, "spawner.mountplayer")); addButton(new GuiNpcButton(2, guiLeft + 170, guiTop + 50, 82, 20, "spawner.mountplayer"));
if(showingClones == 0 || showingClones == 2){ if(showingClones == 0 || showingClones == 2){
addSideButton(new GuiMenuSideButton(21,guiLeft - 90, this.guiTop + 2, 90,22, "1")); addSideButton(new GuiMenuSideButton(21,guiLeft - 69, this.guiTop + 2, 70,22, "Tab 1"));
addSideButton(new GuiMenuSideButton(22,guiLeft - 90, this.guiTop + 23, 90,22, "2")); addSideButton(new GuiMenuSideButton(22,guiLeft - 69, this.guiTop + 23, 70,22, "Tab 2"));
addSideButton(new GuiMenuSideButton(23,guiLeft - 90, this.guiTop + 44, 90,22, "3")); addSideButton(new GuiMenuSideButton(23,guiLeft - 69, this.guiTop + 44, 70,22, "Tab 3"));
addSideButton(new GuiMenuSideButton(24,guiLeft - 90, this.guiTop + 65, 90,22, "4")); addSideButton(new GuiMenuSideButton(24,guiLeft - 69, this.guiTop + 65, 70,22, "Tab 4"));
addSideButton(new GuiMenuSideButton(25,guiLeft - 90, this.guiTop + 86, 90,22, "5")); addSideButton(new GuiMenuSideButton(25,guiLeft - 69, this.guiTop + 86, 70,22, "Tab 5"));
addSideButton(new GuiMenuSideButton(26,guiLeft - 45, this.guiTop + 107, 45,22, "6")); addSideButton(new GuiMenuSideButton(26,guiLeft - 69, this.guiTop + 107, 70,22, "Tab 6"));
addSideButton(new GuiMenuSideButton(27,guiLeft - 90, this.guiTop + 107, 45,22, "7")); addSideButton(new GuiMenuSideButton(27,guiLeft - 69, this.guiTop + 128, 70,22, "Tab 7"));
addSideButton(new GuiMenuSideButton(28,guiLeft - 45, this.guiTop + 128, 45,22, "8")); addSideButton(new GuiMenuSideButton(28,guiLeft - 69, this.guiTop + 149, 70,22, "Tab 8"));
addSideButton(new GuiMenuSideButton(29,guiLeft - 90, this.guiTop + 128, 45,22, "9")); addSideButton(new GuiMenuSideButton(29,guiLeft - 69, this.guiTop + 170, 70,22, "Tab 9"));
addSideButton(new GuiMenuSideButton(30,guiLeft - 45, this.guiTop + 149, 45,22, "10"));
addSideButton(new GuiMenuSideButton(31,guiLeft - 90, this.guiTop + 149, 45,22, "11"));
addSideButton(new GuiMenuSideButton(32,guiLeft - 45, this.guiTop + 170, 45,22, "12"));
addSideButton(new GuiMenuSideButton(33,guiLeft - 90, this.guiTop + 170, 45,22, "13"));
addSideButton(new GuiMenuSideButton(34,guiLeft - 45, this.guiTop + 191, 45,22, "14"));
addSideButton(new GuiMenuSideButton(35,guiLeft - 90, this.guiTop + 191, 45,22, "15"));
getSideButton(20 + activeTab).active = true; getSideButton(20 + activeTab).active = true;
showClones(); showClones();
@@ -60,21 +60,15 @@ public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiDat
addButton(new GuiNpcButton(0, guiLeft + 171, guiTop + 80, 80, 20, "gui.done")); addButton(new GuiNpcButton(0, guiLeft + 171, guiTop + 80, 80, 20, "gui.done"));
addButton(new GuiNpcButton(1, guiLeft + 171, guiTop + 103, 80, 20, "gui.cancel")); addButton(new GuiNpcButton(1, guiLeft + 171, guiTop + 103, 80, 20, "gui.cancel"));
addSideButton(new GuiMenuSideButton(21,guiLeft - 90, this.guiTop + 2, 90,22, "1")); addSideButton(new GuiMenuSideButton(21,guiLeft - 69, this.guiTop + 2, 70,22, "Tab 1"));
addSideButton(new GuiMenuSideButton(22,guiLeft - 90, this.guiTop + 23, 90,22, "2")); addSideButton(new GuiMenuSideButton(22,guiLeft - 69, this.guiTop + 23, 70,22, "Tab 2"));
addSideButton(new GuiMenuSideButton(23,guiLeft - 90, this.guiTop + 44, 90,22, "3")); addSideButton(new GuiMenuSideButton(23,guiLeft - 69, this.guiTop + 44, 70,22, "Tab 3"));
addSideButton(new GuiMenuSideButton(24,guiLeft - 90, this.guiTop + 65, 90,22, "4")); addSideButton(new GuiMenuSideButton(24,guiLeft - 69, this.guiTop + 65, 70,22, "Tab 4"));
addSideButton(new GuiMenuSideButton(25,guiLeft - 90, this.guiTop + 86, 90,22, "5")); addSideButton(new GuiMenuSideButton(25,guiLeft - 69, this.guiTop + 86, 70,22, "Tab 5"));
addSideButton(new GuiMenuSideButton(26,guiLeft - 45, this.guiTop + 107, 45,22, "6")); addSideButton(new GuiMenuSideButton(26,guiLeft - 69, this.guiTop + 107, 70,22, "Tab 6"));
addSideButton(new GuiMenuSideButton(27,guiLeft - 90, this.guiTop + 107, 45,22, "7")); addSideButton(new GuiMenuSideButton(27,guiLeft - 69, this.guiTop + 128, 70,22, "Tab 7"));
addSideButton(new GuiMenuSideButton(28,guiLeft - 45, this.guiTop + 128, 45,22, "8")); addSideButton(new GuiMenuSideButton(28,guiLeft - 69, this.guiTop + 149, 70,22, "Tab 8"));
addSideButton(new GuiMenuSideButton(29,guiLeft - 90, this.guiTop + 128, 45,22, "9")); addSideButton(new GuiMenuSideButton(29,guiLeft - 69, this.guiTop + 170, 70,22, "Tab 9"));
addSideButton(new GuiMenuSideButton(30,guiLeft - 45, this.guiTop + 149, 45,22, "10"));
addSideButton(new GuiMenuSideButton(31,guiLeft - 90, this.guiTop + 149, 45,22, "11"));
addSideButton(new GuiMenuSideButton(32,guiLeft - 45, this.guiTop + 170, 45,22, "12"));
addSideButton(new GuiMenuSideButton(33,guiLeft - 90, this.guiTop + 170, 45,22, "13"));
addSideButton(new GuiMenuSideButton(34,guiLeft - 45, this.guiTop + 191, 45,22, "14"));
addSideButton(new GuiMenuSideButton(35,guiLeft - 90, this.guiTop + 191, 45,22, "15"));
getSideButton(20 + activeTab).active = true; getSideButton(20 + activeTab).active = true;
showClones(); showClones();
@@ -71,7 +71,6 @@ public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCall
list.add("script.collide"); list.add("script.collide");
list.add("script.kills"); list.add("script.kills");
list.add("script.dialog_closed"); list.add("script.dialog_closed");
list.add("script.timer");
if(showScript){ if(showScript){
addLabel(new GuiNpcLabel(0, "script.hooks", guiLeft + 4, guiTop + 5)); addLabel(new GuiNpcLabel(0, "script.hooks", guiLeft + 4, guiTop + 5));
@@ -29,9 +29,6 @@ public class SubGuiNpcMovement extends SubGuiInterface implements ITextfieldList
this.addLabel(new GuiNpcLabel(0, "movement.type", guiLeft + 4, y + 5)); this.addLabel(new GuiNpcLabel(0, "movement.type", guiLeft + 4, y + 5));
this.addButton(new GuiNpcButton(0, guiLeft + 80, y, 100, 20, EnumMovingType.names(), ai.movingType.ordinal())); this.addButton(new GuiNpcButton(0, guiLeft + 80, y, 100, 20, EnumMovingType.names(), ai.movingType.ordinal()));
// Fly Change
// this.addButton(new GuiNpcButton(15, guiLeft + 80, y += 22, 100, 20, new String[]{"movement.ground","movement.flying"}, ai.movementType));
if(ai.movingType == EnumMovingType.Wandering){ if(ai.movingType == EnumMovingType.Wandering){
addTextField(new GuiNpcTextField(4,this, guiLeft + 100, y += 22, 40, 20, ai.walkingRange + "")); addTextField(new GuiNpcTextField(4,this, guiLeft + 100, y += 22, 40, 20, ai.walkingRange + ""));
getTextField(4).numbersOnly = true; getTextField(4).numbersOnly = true;
@@ -144,9 +141,6 @@ public class SubGuiNpcMovement extends SubGuiInterface implements ITextfieldList
else if (button.id == 13) { else if (button.id == 13) {
ai.stopAndInteract = button.getValue() == 1; ai.stopAndInteract = button.getValue() == 1;
} }
else if (button.id == 15) {
ai.movementType = button.getValue();
}
else if(button.id == 66){ else if(button.id == 66){
close(); close();
} }
@@ -1,63 +0,0 @@
package noppes.npcs.client.gui;
import net.minecraft.client.gui.GuiButton;
import noppes.npcs.DataDisplay;
import noppes.npcs.client.gui.mainmenu.GuiNpcDisplay;
import noppes.npcs.client.gui.util.*;
public class SubGuiNpcName extends SubGuiInterface implements ITextfieldListener {
private DataDisplay display;
public SubGuiNpcName(DataDisplay display){
this.display = display;
setBackground("menubg.png");
xSize = 256;
ySize = 216;
closeOnEsc = true;
}
@Override
public void initGui(){
super.initGui();
int y = guiTop + 4;
addButton(new GuiNpcButton(66, guiLeft + xSize - 24, y, 20, 20, "X"));
addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 4, y += 50, 226, 20, display.name));
this.addButton(new GuiButtonBiDirectional(1, guiLeft + 4, y += 22 , 200, 20, new String[] {"markov.roman.name", "markov.japanese.name", "markov.slavic.name", "markov.welsh.name", "markov.sami.name", "markov.oldNorse.name", "markov.ancientGreek.name", "markov.aztec.name", "markov.classicCNPCs.name", "markov.spanish.name"}, display.getMarkovGeneratorId()));
this.addButton(new GuiButtonBiDirectional(2, guiLeft + 64, y += 22 , 120, 20, new String[] {"markov.gender.either", "markov.gender.male", "markov.gender.female"}, display.getMarkovGender()));
addLabel(new GuiNpcLabel(2,"markov.gender.name", guiLeft + 5, y + 5));
addButton(new GuiNpcButton(3, guiLeft + 4, y += 42, 70, 20, "markov.generate"));
}
@Override
public void unFocused(GuiNpcTextField textfield) {
if(textfield.id == 0){
if(!textfield.isEmpty())
display.setName(textfield.getText());
else
textfield.setText(display.getName());
}
}
@Override
protected void actionPerformed(GuiButton guibutton){
GuiNpcButton button = (GuiNpcButton) guibutton;
if(button.id == 1) {
display.setMarkovGeneratorId(button.getValue());
}
if(button.id == 2) {
display.setMarkovGender(button.getValue());
}
if(button.id == 3) {
String name = display.getRandomName();
display.setName(name);
getTextField(0).setText(name);
((GuiNpcDisplay)parent).nameText.setText(name);
}
if(button.id == 66){
close();
}
}
}
@@ -35,11 +35,7 @@ public class SubGuiNpcResistanceProperties extends SubGuiInterface implements IS
addLabel(new GuiNpcLabel(3,"stats.explosion", guiLeft + 4, guiTop + 81)); addLabel(new GuiNpcLabel(3,"stats.explosion", guiLeft + 4, guiTop + 81));
addSlider(new GuiNpcSlider(this, 3, guiLeft + 94, guiTop + 76, (int)(resistances.explosion * 100 - 100) + "%", resistances.explosion / 2)); addSlider(new GuiNpcSlider(this, 3, guiLeft + 94, guiTop + 76, (int)(resistances.explosion * 100 - 100) + "%", resistances.explosion / 2));
if(resistances.disableDamage){ addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
addLabel(new GuiNpcLabel(4,"stats.disabletrue", guiLeft + 4, guiTop + 103));
}
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
} }
protected void actionPerformed(GuiButton guibutton) protected void actionPerformed(GuiButton guibutton)
@@ -10,9 +10,14 @@ import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.GuiNPCTextures; import noppes.npcs.client.gui.GuiNPCTextures;
import noppes.npcs.client.gui.GuiNpcTextureCloaks; import noppes.npcs.client.gui.GuiNpcTextureCloaks;
import noppes.npcs.client.gui.GuiNpcTextureOverlays; import noppes.npcs.client.gui.GuiNpcTextureOverlays;
import noppes.npcs.client.gui.SubGuiNpcName;
import noppes.npcs.client.gui.model.GuiCreationScreen; import noppes.npcs.client.gui.model.GuiCreationScreen;
import noppes.npcs.client.gui.util.*; import noppes.npcs.client.gui.util.GuiHoverText;
import noppes.npcs.client.gui.util.GuiNPCInterface2;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.constants.EnumPacketServer; import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.entity.EntityCustomNpc; import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface; import noppes.npcs.entity.EntityNPCInterface;
@@ -20,7 +25,6 @@ import noppes.npcs.entity.EntityNPCInterface;
public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListener, IGuiData{ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListener, IGuiData{
private DataDisplay display; private DataDisplay display;
public GuiNpcTextField nameText;
public GuiNpcDisplay(EntityNPCInterface npc) { public GuiNpcDisplay(EntityNPCInterface npc) {
super(npc,1); super(npc,1);
@@ -31,20 +35,9 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
public void initGui(){ public void initGui(){
super.initGui(); super.initGui();
int y = guiTop + 4; int y = guiTop + 4;
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 5, y + 5));
// Old Implementation addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 50, y, 200, 20, display.name));
// addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 5, y + 5)); this.addButton(new GuiNpcButton(0, guiLeft + 253, y , 110, 20, new String[]{"display.show","display.hide","display.showAttacking"} ,display.showName));
// addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 50, y, 200, 20, display.name));
// this.addButton(new GuiNpcButton(0, guiLeft + 253, y , 110, 20, new String[]{"display.show","display.hide","display.showAttacking"} ,display.showName));
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 5, y + 5));
nameText = new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 50, y, 206, 20, display.name);
addTextField(nameText);
this.addButton(new GuiNpcButton(0, guiLeft + 253+52, y , 110, 20, new String[]{"display.show","display.hide","display.showAttacking"} ,display.showName));
this.addButton(new GuiNpcButton(14, guiLeft + 259, y , 20, 20, Character.toString('\u21bb')));
this.addButton(new GuiNpcButton(15, guiLeft + 259 + 22, y , 20, 20, Character.toString('\u22EE')));
y+=23; y+=23;
addLabel(new GuiNpcLabel(11,"gui.title", guiLeft + 5, y + 5)); addLabel(new GuiNpcLabel(11,"gui.title", guiLeft + 5, y + 5));
@@ -63,7 +56,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
addLabel(new GuiNpcLabel(4,"display.texture", guiLeft + 5, y + 5)); addLabel(new GuiNpcLabel(4,"display.texture", guiLeft + 5, y + 5));
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 80, y, 200, 20, display.skinType == 0?display.texture:display.url)); addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 80, y, 200, 20, display.skinType == 0?display.texture:display.url));
this.addButton(new GuiNpcButton(3, guiLeft + 325, y, 38, 20, "mco.template.button.select")); this.addButton(new GuiNpcButton(3, guiLeft + 325, y, 38, 20, "mco.template.button.select"));
this.addButton(new GuiNpcButton(2, guiLeft + 283, y, 40, 20, new String[]{"display.texture","display.player", "display.url", "display.urlSix"},display.skinType)); this.addButton(new GuiNpcButton(2, guiLeft + 283, y, 40, 20, new String[]{"display.texture","display.player", "display.url"},display.skinType));
getButton(3).setEnabled(display.skinType == 0); getButton(3).setEnabled(display.skinType == 0);
if(display.skinType == 1 && display.playerProfile != null) if(display.skinType == 1 && display.playerProfile != null)
getTextField(3).setText(display.playerProfile.getName()); getTextField(3).setText(display.playerProfile.getName());
@@ -80,9 +73,9 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
y+=23; y+=23;
addLabel(new GuiNpcLabel(5,"display.livingAnimation", guiLeft + 5, y + 5)); addLabel(new GuiNpcLabel(5,"display.livingAnimation", guiLeft + 5, y + 5));
this.addButton(new GuiNpcButton(5, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no"}, display.disableLivingAnimation?1:0)); this.addButton(new GuiNpcButton(5, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no"},display.disableLivingAnimation?1:0));
y+=23; y+=23;
addLabel(new GuiNpcLabel(7,"display.visible", guiLeft + 5, y + 5)); addLabel(new GuiNpcLabel(7,"display.visible", guiLeft + 5, y + 5));
this.addButton(new GuiNpcButton(7, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no","gui.partly"}, display.visible)); this.addButton(new GuiNpcButton(7, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no","gui.partly"}, display.visible));
@@ -90,7 +83,8 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
addLabel(new GuiNpcLabel(10,"display.bossbar", guiLeft + 5, y + 5)); addLabel(new GuiNpcLabel(10,"display.bossbar", guiLeft + 5, y + 5));
this.addButton(new GuiNpcButton(10, guiLeft + 120, y, 110, 20, new String[]{"display.hide","display.show","display.showAttacking"}, display.showBossBar)); this.addButton(new GuiNpcButton(10, guiLeft + 120, y, 110, 20, new String[]{"display.hide","display.show","display.showAttacking"}, display.showBossBar));
} //addExtra(new GuiHoverText(0, "testing", guiLeft, guiTop));
}
@Override @Override
public void unFocused(GuiNpcTextField textfield){ public void unFocused(GuiNpcTextField textfield){
@@ -104,10 +98,8 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
display.modelSize = textfield.getInteger(); display.modelSize = textfield.getInteger();
} }
else if(textfield.id == 3){ else if(textfield.id == 3){
// SKIN CHANGE if(display.skinType == 2)
if(display.skinType == 2 || display.skinType == 3){
display.url = textfield.getText(); display.url = textfield.getText();
}
else if(display.skinType == 1){ else if(display.skinType == 1){
if(!textfield.isEmpty()){ if(!textfield.isEmpty()){
display.playerProfile = new GameProfile(null, textfield.getText()); display.playerProfile = new GameProfile(null, textfield.getText());
@@ -141,11 +133,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
} }
if(button.id == 2){ if(button.id == 2){
display.skinType = (byte) button.getValue(); display.skinType = (byte) button.getValue();
// System.out.println("Skin Type set to:" + display.skinType); display.url = "";
// SKIN CHANGE
if (display.skinType != 3){
display.url = "";
}
display.playerProfile = null; display.playerProfile = null;
initGui(); initGui();
} }
@@ -158,9 +146,6 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
else if(button.id == 7){ else if(button.id == 7){
display.visible = button.getValue(); display.visible = button.getValue();
} }
// else if(button.id == 300){
// display.squareTexture = (byte)button.getValue();
// }
else if(button.id == 8){ else if(button.id == 8){
NoppesUtil.openGUI(player, new GuiNpcTextureCloaks(npc, this)); NoppesUtil.openGUI(player, new GuiNpcTextureCloaks(npc, this));
} }
@@ -170,14 +155,6 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
else if(button.id == 10){ else if(button.id == 10){
display.showBossBar = (byte)button.getValue(); display.showBossBar = (byte)button.getValue();
} }
else if(button.id == 14){
String name = display.getRandomName();
display.setName(name);
getTextField(0).setText(name);
}
else if(button.id == 15){
setSubGui(new SubGuiNpcName(display));
}
} }
@Override @Override
@@ -46,6 +46,7 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener,
addButton(new GuiNpcButton(0,guiLeft + 82, y+=22, 56, 20, "selectServer.edit")); addButton(new GuiNpcButton(0,guiLeft + 82, y+=22, 56, 20, "selectServer.edit"));
addLabel(new GuiNpcLabel(2,"stats.respawn", guiLeft + 5, y + 5)); addLabel(new GuiNpcLabel(2,"stats.respawn", guiLeft + 5, y + 5));
this.addButton(new GuiNpcButton(2, guiLeft + 82, y+=22, 56, 20, "selectServer.edit")); this.addButton(new GuiNpcButton(2, guiLeft + 82, y+=22, 56, 20, "selectServer.edit"));
addLabel(new GuiNpcLabel(5,"stats.meleeproperties", guiLeft + 5, y + 5)); addLabel(new GuiNpcLabel(5,"stats.meleeproperties", guiLeft + 5, y + 5));
this.addButton(new GuiNpcButton(3, guiLeft + 82, y+=22, 56, 20, "selectServer.edit")); this.addButton(new GuiNpcButton(3, guiLeft + 82, y+=22, 56, 20, "selectServer.edit"));
@@ -53,13 +54,11 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener,
this.addButton(new GuiNpcButton(9, guiLeft + 217, y, 56, 20, "selectServer.edit")); this.addButton(new GuiNpcButton(9, guiLeft + 217, y, 56, 20, "selectServer.edit"));
addLabel(new GuiNpcLabel(7,"stats.projectileproperties", guiLeft + 140, y + 5)); addLabel(new GuiNpcLabel(7,"stats.projectileproperties", guiLeft + 140, y + 5));
this.addButton(new GuiNpcButton(15, guiLeft + 82, y+=34, 56, 20, "selectServer.edit")); this.addButton(new GuiNpcButton(15, guiLeft + 82, y+=34, 56, 20, "selectServer.edit"));
addLabel(new GuiNpcLabel(15,"potion.resistance", guiLeft + 5, y + 5)); addLabel(new GuiNpcLabel(15,"potion.resistance", guiLeft + 5, y + 5));
this.addButton(new GuiNpcButton(21, guiLeft + 217, y, 56, 20, new String[]{"gui.no","gui.yes"}, this.stats.resistances.disableDamage? 1:0));
addLabel(new GuiNpcLabel(21,"stats.disabledamage", guiLeft + 140, y + 5));
addButton(new GuiNpcButton(4,guiLeft + 82, y+=34, 56, 20, new String[]{"gui.no","gui.yes"} ,npc.isImmuneToFire()? 1:0)); addButton(new GuiNpcButton(4,guiLeft + 82, y+=34, 56, 20, new String[]{"gui.no","gui.yes"} ,npc.isImmuneToFire()? 1:0));
addLabel(new GuiNpcLabel(10,"stats.fireimmune", guiLeft + 5, y + 5)); addLabel(new GuiNpcLabel(10,"stats.fireimmune", guiLeft + 5, y + 5));
addButton(new GuiNpcButton(5,guiLeft + 217, y, 56, 20, new String[]{"gui.no","gui.yes"} ,stats.canDrown? 1:0)); addButton(new GuiNpcButton(5,guiLeft + 217, y, 56, 20, new String[]{"gui.no","gui.yes"} ,stats.canDrown? 1:0));
addLabel(new GuiNpcLabel(11,"stats.candrown", guiLeft + 140, y + 5)); addLabel(new GuiNpcLabel(11,"stats.candrown", guiLeft + 140, y + 5));
@@ -135,9 +134,6 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener,
else if (button.id == 18) { else if (button.id == 18) {
stats.potionImmune = ((GuiNpcButtonYesNo)guibutton).getBoolean(); stats.potionImmune = ((GuiNpcButtonYesNo)guibutton).getBoolean();
} }
else if(button.id == 21){
stats.resistances.disableDamage = ((GuiNpcButton)guibutton).getValue() == 1;
}
} }
@Override @Override
public void save() { public void save() {
@@ -33,7 +33,6 @@ import noppes.npcs.controllers.PixelmonHelper;
import noppes.npcs.entity.EntityCustomNpc; import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityFakeLiving; import noppes.npcs.entity.EntityFakeLiving;
import noppes.npcs.entity.EntityNPCInterface; import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.Sys;
public class GuiCreationScreen extends GuiModelInterface implements ICustomScrollListener{ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrollListener{
@@ -111,9 +110,6 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
addButton(new GuiNpcButton(7, guiLeft + 50, y += 22, 50, 20, "selectServer.edit")); addButton(new GuiNpcButton(7, guiLeft + 50, y += 22, 50, 20, "selectServer.edit"));
addLabel(new GuiNpcLabel(4, "Legs", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(4, "Legs", guiLeft, y + 5, 0xFFFFFF));
addButton(new GuiNpcButton(250, guiLeft + 50, y += 22, 50, 20, new String[]{"Default","Steve64","Alex"}, this.npc.display.modelType));
addLabel(new GuiNpcLabel(250, "Model", guiLeft, y + 5, 0xFFFFFF));
addButton(new GuiNpcButton(44, guiLeft + 310, guiTop + 14, 80, 20, "Save Model")); addButton(new GuiNpcButton(44, guiLeft + 310, guiTop + 14, 80, 20, "Save Model"));
addButton(new GuiNpcButton(45, guiLeft + 310, guiTop + 36, 80, 20, "Load Model")); addButton(new GuiNpcButton(45, guiLeft + 310, guiTop + 36, 80, 20, "Load Model"));
@@ -252,7 +248,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
} }
if(button.id == 1){ if(button.id == 1){
this.mc.displayGuiScreen(new GuiEntitySelection(this, playerdata, npc)); this.mc.displayGuiScreen(new GuiEntitySelection(this, playerdata,npc));
} }
if(button.id == 4){ if(button.id == 4){
@@ -267,27 +263,6 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
if(button.id == 7){ if(button.id == 7){
this.mc.displayGuiScreen(new GuiModelLegs(this, npc)); this.mc.displayGuiScreen(new GuiModelLegs(this, npc));
} }
// New Button for Changing Models
// URL Swapper
if(button.id == 250){
if(npc.display.modelType == 0){
if (npc.display.skinType == 2){
npc.display.skinType = 3;
}
npc.display.modelType = 1;
}
else if(npc.display.modelType == 1){
npc.display.modelType = 2;
}
else {
if (npc.display.skinType == 3){
npc.display.skinType = 2;
}
npc.display.modelType = 0;
}
}
if(button.id == 8){ if(button.id == 8){
this.mc.displayGuiScreen(new GuiModelScale(this, playerdata, npc)); this.mc.displayGuiScreen(new GuiModelScale(this, playerdata, npc));
} }
@@ -46,9 +46,8 @@ public class GuiEntitySelection extends GuiNPCInterface
list.add("CustomNPC"); list.add("CustomNPC");
Collections.sort(list,String.CASE_INSENSITIVE_ORDER); Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
slot = new GuiNPCStringSlot(list,this,false,18); slot = new GuiNPCStringSlot(list,this,false,18);
if(playerdata.getEntityClass() != null){ if(playerdata.getEntityClass() != null)
slot.selected = (String) EntityList.classToStringMapping.get(playerdata.getEntityClass()); slot.selected = (String) EntityList.classToStringMapping.get(playerdata.getEntityClass());
}
else{ else{
slot.selected = "CustomNPC"; slot.selected = "CustomNPC";
} }
@@ -120,7 +119,6 @@ public class GuiEntitySelection extends GuiNPCInterface
playerdata.setEntityClass(parent.data.get(slot.selected)); playerdata.setEntityClass(parent.data.get(slot.selected));
EntityLivingBase entity = playerdata.getEntity(npc); EntityLivingBase entity = playerdata.getEntity(npc);
if(entity != null){ if(entity != null){
npc.display.modelType = 0;
RendererLivingEntity render = (RendererLivingEntity) RenderManager.instance.getEntityRenderObject(entity); RendererLivingEntity render = (RendererLivingEntity) RenderManager.instance.getEntityRenderObject(entity);
npc.display.texture = NPCRendererHelper.getTexture(render,entity); npc.display.texture = NPCRendererHelper.getTexture(render,entity);
} }
@@ -10,9 +10,7 @@ import noppes.npcs.entity.EntityCustomNpc;
public class GuiModelArms extends GuiModelInterface{ public class GuiModelArms extends GuiModelInterface{
private final String[] arrArm = new String[]{"gui.no","Both","Right","Left"}; private final String[] arrParticles = new String[]{"gui.no","Both","Left","Right"};
private final String[] arrArmwear = new String[]{"gui.no","Both","Left","Right"};
private final String[] arrClaws = new String[]{"gui.no","Both","Left","Right"};
private GuiScreen parent; private GuiScreen parent;
public GuiModelArms(GuiScreen parent, EntityCustomNpc npc){ public GuiModelArms(GuiScreen parent, EntityCustomNpc npc){
@@ -26,16 +24,8 @@ public class GuiModelArms extends GuiModelInterface{
super.initGui(); super.initGui();
int y = guiTop + 20; int y = guiTop + 20;
addButton(new GuiNpcButton(30, guiLeft + 50, y += 22, 70, 20, arrArm, playerdata.hideArms));
addLabel(new GuiNpcLabel(30, "Hide", guiLeft, y + 5, 0xFFFFFF));
if (npc.display.modelType == 1 || npc.display.modelType == 2) {
addButton(new GuiNpcButton(8, guiLeft + 50, y += 22, 70, 20, arrArmwear, playerdata.armwear));
addLabel(new GuiNpcLabel(8, "Armwear", guiLeft, y + 5, 0xFFFFFF));
}
ModelPartData claws = playerdata.getPartData("claws"); ModelPartData claws = playerdata.getPartData("claws");
addButton(new GuiNpcButton(0, guiLeft + 50, y += 22, 70, 20, arrClaws, claws == null?0:claws.type + 1)); addButton(new GuiNpcButton(0, guiLeft + 50, y += 22, 70, 20, arrParticles, claws == null?0:claws.type + 1));
addLabel(new GuiNpcLabel(0, "Claws", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(0, "Claws", guiLeft, y + 5, 0xFFFFFF));
if(claws != null) if(claws != null)
addButton(new GuiNpcButton(10, guiLeft + 122, y, 40, 20, claws.getColor())); addButton(new GuiNpcButton(10, guiLeft + 122, y, 40, 20, claws.getColor()));
@@ -47,12 +37,6 @@ public class GuiModelArms extends GuiModelInterface{
super.actionPerformed(btn); super.actionPerformed(btn);
GuiNpcButton button = (GuiNpcButton) btn; GuiNpcButton button = (GuiNpcButton) btn;
if(button.id == 8){
playerdata.armwear = (byte) button.getValue();
}
if(button.id == 30){
playerdata.hideArms = (byte) button.getValue();
}
if(button.id == 0){ if(button.id == 0){
if(button.getValue() == 0) if(button.getValue() == 0)
playerdata.removePart("claws"); playerdata.removePart("claws");
@@ -11,14 +11,10 @@ import noppes.npcs.entity.EntityCustomNpc;
public class GuiModelBody extends GuiModelInterface{ public class GuiModelBody extends GuiModelInterface{
private GuiScreen parent; private GuiScreen parent;
private final String[] arrBody = new String[]{"gui.no","gui.yes"}; private final String[] arrWing = new String[]{"gui.no","Player","Type1","Type2","Type3"};
private final String[] arrBodywear = new String[]{"gui.no","gui.yes"};
private final String[] arrWing = new String[]{"gui.no","Player","Type1","Type2","Type3","Type4","Type5","Type6","Type7","Type8","Type9",
"Type10","Type11","Type12","Type13"};
private final String[] arrBreasts = new String[]{"gui.no","Type1","Type2","Type3"}; private final String[] arrBreasts = new String[]{"gui.no","Type1","Type2","Type3"};
private final String[] arrParticles = new String[]{"gui.no","Player","Type1", "Type2", "Rainbow", "Type3", "Type4", "Type5", "Type6", "Type7"}; private final String[] arrParticles = new String[]{"gui.no","Player","Type1","Type2", "Rainbow"};
private final String[] arrfins = new String[]{"gui.no","Player","Type1","Type2","Type3","Type4","Type5","Type6"}; private final String[] arrfins = new String[]{"gui.no","Player","Type1"};
private final String[] arrskirt = new String[]{"gui.no","Player","Type1"};
public GuiModelBody(GuiScreen parent, EntityCustomNpc npc){ public GuiModelBody(GuiScreen parent, EntityCustomNpc npc){
super(npc); super(npc);
@@ -29,17 +25,7 @@ public class GuiModelBody extends GuiModelInterface{
@Override @Override
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
int y = guiTop + 20; int y = guiTop + 20;
addButton(new GuiNpcButton(30, guiLeft + 50, y += 22, 70, 20, arrBody, playerdata.hideBody));
addLabel(new GuiNpcLabel(30, "Hide", guiLeft, y + 5, 0xFFFFFF));
if (npc.display.modelType == 1 || npc.display.modelType == 2) {
addButton(new GuiNpcButton(8, guiLeft + 50, y += 22, 70, 20, arrBodywear, playerdata.bodywear));
addLabel(new GuiNpcLabel(8, "Bodywear", guiLeft, y + 5, 0xFFFFFF));
}
addButton(new GuiNpcButton(1, guiLeft + 50, y += 22, 70, 20, arrBreasts, playerdata.breasts)); addButton(new GuiNpcButton(1, guiLeft + 50, y += 22, 70, 20, arrBreasts, playerdata.breasts));
addLabel(new GuiNpcLabel(1, "Breasts", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(1, "Breasts", guiLeft, y + 5, 0xFFFFFF));
@@ -61,56 +47,13 @@ public class GuiModelBody extends GuiModelInterface{
if(fin != null) if(fin != null)
addButton(new GuiNpcButton(13, guiLeft + 122, y, 40, 20, fin.getColor())); addButton(new GuiNpcButton(13, guiLeft + 122, y, 40, 20, fin.getColor()));
ModelPartData skirt = playerdata.getPartData("skirt");
addButton(new GuiNpcButton(4, guiLeft + 50, y += 22, 70, 20, arrskirt, getSkirtindex(skirt)));
addLabel(new GuiNpcLabel(4, "Skirt", guiLeft, y + 5, 0xFFFFFF));
if(skirt != null)
addButton(new GuiNpcButton(14, guiLeft + 122, y, 40, 20, skirt.getColor()));
} }
private int getFinIndex(ModelPartData fin) { private int getFinIndex(ModelPartData fin) {
if(fin == null) if(fin == null)
return 0; return 0;
if(fin.type == 0){ return fin.playerTexture?1:2;
if(fin.playerTexture)
return 1;
if(fin.texture.contains("1"))
return 2;
if(fin.texture.contains("2"))
return 3;
if(fin.texture.contains("3"))
return 4;
if(fin.texture.contains("4"))
return 5;
if(fin.texture.contains("5"))
return 6;
if(fin.texture.contains("6"))
return 7;
}
return 0;
}
private int getSkirtindex(ModelPartData skirt) {
if(skirt == null)
return 0;
if(skirt.type == 0){
if(skirt.playerTexture)
return 1;
if(skirt.texture.contains("1"))
return 2;
if(skirt.texture.contains("2"))
return 3;
if(skirt.texture.contains("3"))
return 4;
if(skirt.texture.contains("4"))
return 5;
if(skirt.texture.contains("5"))
return 6;
if(skirt.texture.contains("6"))
return 7;
}
return 0;
} }
private int getParticleIndex(ModelPartData particles) { private int getParticleIndex(ModelPartData particles) {
@@ -123,16 +66,6 @@ public class GuiModelBody extends GuiModelInterface{
return 2; return 2;
if(particles.texture.contains("2")) if(particles.texture.contains("2"))
return 3; return 3;
if(particles.texture.contains("3"))
return 5;
if(particles.texture.contains("4"))
return 6;
if(particles.texture.contains("5"))
return 7;
if(particles.texture.contains("6"))
return 8;
if(particles.texture.contains("7"))
return 9;
} }
if(particles.type == 1){ if(particles.type == 1){
return 4; return 4;
@@ -173,66 +106,23 @@ public class GuiModelBody extends GuiModelInterface{
particles.setTexture("particle/type2", 0); particles.setTexture("particle/type2", 0);
if(value == 4) if(value == 4)
particles.setTexture("", 1); particles.setTexture("", 1);
if(value == 5)
particles.setTexture("particle/type3", 0);
if(value == 6)
particles.setTexture("particle/type4", 0);
if(value == 7)
particles.setTexture("particle/type5", 0);
if(value == 8)
particles.setTexture("particle/type6", 0);
if(value == 9)
particles.setTexture("particle/type7", 0);
} }
initGui(); initGui();
} }
if(button.id == 3){ if(button.id == 3){
int value = button.getValue(); int value = button.getValue();
if(value == 0) if(value == 0)
playerdata.removePart("fin"); playerdata.removePart("fin");
else{ else{
ModelPartData particles = playerdata.getOrCreatePart("fin"); ModelPartData particles = playerdata.getOrCreatePart("fin");
if(value == 1) if(value == 1)
particles.setTexture("", 0); particles.setTexture("", 0);
if(value == 2) if(value == 2)
particles.setTexture("fin/fin1", 0); particles.setTexture("fin/fin1", 0);
if(value == 3) }
particles.setTexture("fin/fin2", 0); initGui();
if(value == 4)
particles.setTexture("fin/fin3", 0);
if(value == 5)
particles.setTexture("fin/fin4", 0);
if(value == 6)
particles.setTexture("fin/fin5", 0);
if(value == 7)
particles.setTexture("fin/fin6", 0);
}
initGui();
} }
if(button.id == 4){
int value = button.getValue();
if(value == 0)
playerdata.removePart("skirt");
else{
ModelPartData skirt = playerdata.getOrCreatePart("skirt");
if(value == 1)
skirt.setTexture("", 0);
if(value == 2)
skirt.setTexture("skirt/skirt1", 0);
}
initGui();
}
if(button.id == 8){
playerdata.bodywear = (byte) button.getValue();
}
if(button.id == 30){
playerdata.hideBody = (byte) button.getValue();
}
if(button.id == 11){ if(button.id == 11){
this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("wings"), npc)); this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("wings"), npc));
} }
@@ -242,9 +132,6 @@ public class GuiModelBody extends GuiModelInterface{
if(button.id == 13){ if(button.id == 13){
this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("fin"), npc)); this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("fin"), npc));
} }
if(button.id == 14){
this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("skirt"), npc));
}
} }
@Override @Override
@@ -12,15 +12,13 @@ public class GuiModelHead extends GuiModelInterface{
private GuiScreen parent; private GuiScreen parent;
private final String[] arrHead = new String[]{"gui.no","gui.yes"};
private final String[] arrHeadwear = new String[]{"gui.no","gui.yes","Solid"}; private final String[] arrHeadwear = new String[]{"gui.no","gui.yes","Solid"};
private final String[] arrHair = new String[]{"gui.no","Player","Long","Thin","Stylish","Ponytail"}; private final String[] arrHair = new String[]{"gui.no","Player","Long","Thin","Stylish","Ponytail"};
private final String[] arrBeard = new String[]{"gui.no","Player","Standard","Viking","Long","Short"}; private final String[] arrBeard = new String[]{"gui.no","Player","Standard","Viking","Long","Short"};
private final String[] arrMohawk = new String[]{"gui.no","Type1","Type2","Type3"}; private final String[] arrMohawk = new String[]{"gui.no","Type1"};
private final String[] arrSnout = new String[]{"gui.no","Player Small","Player Medium", "Player Large", "Player Bunny", private final String[] arrSnout = new String[]{"gui.no","Player Small","Player Medium", "Player Large", "Player Bunny",
"Small1", "Medium1", "Large1", "Bunny1", "Beak1"}; "Small1", "Medium1", "Large1", "Bunny1"};
private final String[] arrEars = new String[]{"gui.no","Player","Player Bunny","Bunny","Type1"}; private final String[] arrEars = new String[]{"gui.no","Player","Player Bunny","Bunny","Type1"};
private final String[] arrHorns = new String[]{"gui.no", "Player Bull", "Player Antlers", "Player AntennasB", "Player AntennasF", "Bull", "Antlers", "AntennasB", "AntennasF" };
public GuiModelHead(GuiScreen parent, EntityCustomNpc npc){ public GuiModelHead(GuiScreen parent, EntityCustomNpc npc){
super(npc); super(npc);
@@ -30,52 +28,42 @@ public class GuiModelHead extends GuiModelInterface{
@Override @Override
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
int y = guiTop + 20; int y = guiTop + 20;
addButton(new GuiNpcButton(30, guiLeft + 50, y += 22, 70, 20, arrHead, playerdata.hideHead)); addButton(new GuiNpcButton(0, guiLeft + 50, y += 22, 70, 20, arrHeadwear, playerdata.headwear));
addLabel(new GuiNpcLabel(30, "Hide", guiLeft, y + 5, 0xFFFFFF));
addButton(new GuiNpcButton(0, guiLeft + 50, y += 22, 70, 20, arrHeadwear, playerdata.headwear));
addLabel(new GuiNpcLabel(0, "Headwear", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(0, "Headwear", guiLeft, y + 5, 0xFFFFFF));
ModelPartData hair = playerdata.getPartData("hair"); ModelPartData hair = playerdata.getPartData("hair");
addButton(new GuiNpcButton(1, guiLeft + 50, y += 22, 70, 20, arrHair, hair == null ? 0 : hair.type + 1)); addButton(new GuiNpcButton(1, guiLeft + 50, y += 22, 70, 20, arrHair, hair == null?0:hair.type + 1));
addLabel(new GuiNpcLabel(1, "Hair", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(1, "Hair", guiLeft, y + 5, 0xFFFFFF));
if (hair != null) if(hair != null)
addButton(new GuiNpcButton(11, guiLeft + 122, y, 40, 20, hair.getColor())); addButton(new GuiNpcButton(11, guiLeft + 122, y, 40, 20, hair.getColor()));
ModelPartData mohawk = playerdata.getPartData("mohawk"); ModelPartData mohawk = playerdata.getPartData("mohawk");
addButton(new GuiNpcButton(2, guiLeft + 50, y += 22, 70, 20, arrMohawk, mohawk == null ? 0 : mohawk.type)); addButton(new GuiNpcButton(2, guiLeft + 50, y += 22, 70, 20, arrMohawk, mohawk == null?0:mohawk.type));
addLabel(new GuiNpcLabel(2, "Mohawk", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(2, "Mohawk", guiLeft, y + 5, 0xFFFFFF));
if (mohawk != null) if(mohawk != null)
addButton(new GuiNpcButton(12, guiLeft + 122, y, 40, 20, mohawk.getColor())); addButton(new GuiNpcButton(12, guiLeft + 122, y, 40, 20, mohawk.getColor()));
ModelPartData beard = playerdata.getPartData("beard"); ModelPartData beard = playerdata.getPartData("beard");
addButton(new GuiNpcButton(3, guiLeft + 50, y += 22, 70, 20, arrBeard, beard == null ? 0 : beard.type + 1)); addButton(new GuiNpcButton(3, guiLeft + 50, y += 22, 70, 20, arrBeard, beard == null?0:beard.type + 1));
addLabel(new GuiNpcLabel(3, "Beard", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(3, "Beard", guiLeft, y + 5, 0xFFFFFF));
if (beard != null) if(beard != null)
addButton(new GuiNpcButton(13, guiLeft + 122, y, 40, 20, beard.getColor())); addButton(new GuiNpcButton(13, guiLeft + 122, y, 40, 20, beard.getColor()));
ModelPartData snout = playerdata.getPartData("snout"); ModelPartData snout = playerdata.getPartData("snout");
addButton(new GuiNpcButton(4, guiLeft + 50, y += 22, 70, 20, arrSnout, snout == null ? 0 : snout.type + (snout.playerTexture ? 1 : 5))); addButton(new GuiNpcButton(4, guiLeft + 50, y += 22, 70, 20, arrSnout, snout == null?0:snout.type + (snout.playerTexture?1:5)));
addLabel(new GuiNpcLabel(4, "Snout", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(4, "Snout", guiLeft, y + 5, 0xFFFFFF));
if (snout != null) if(snout != null)
addButton(new GuiNpcButton(14, guiLeft + 122, y, 40, 20, snout.getColor())); addButton(new GuiNpcButton(14, guiLeft + 122, y, 40, 20, snout.getColor()));
ModelPartData ears = playerdata.getPartData("ears"); ModelPartData ears = playerdata.getPartData("ears");
addButton(new GuiNpcButton(5, guiLeft + 50, y += 22, 70, 20, arrEars, getEars(ears))); addButton(new GuiNpcButton(5, guiLeft + 50, y += 22, 70, 20, arrEars, getEars(ears)));
addLabel(new GuiNpcLabel(5, "Ears", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(5, "Ears", guiLeft, y + 5, 0xFFFFFF));
if (ears != null) if(ears != null)
addButton(new GuiNpcButton(15, guiLeft + 122, y, 40, 20, ears.getColor())); addButton(new GuiNpcButton(15, guiLeft + 122, y, 40, 20, ears.getColor()));
ModelPartData horns = playerdata.getPartData("horns");
y += 22;addButton(new GuiNpcButton(6, guiLeft + 50, y, 70, 20, arrHorns, getHorns(horns)));
addLabel(new GuiNpcLabel(6, "Horns", guiLeft, y + 5, 16777215));
if (horns != null) {
addButton(new GuiNpcButton(16, guiLeft + 122, y, 40, 20, horns.getColor()));
}
} }
@@ -94,15 +82,6 @@ public class GuiModelHead extends GuiModelInterface{
return 0; return 0;
} }
private int getHorns(ModelPartData data) {
if (data == null)
return 0;
if (data.playerTexture) {
return data.type + 1;
}
return data.type + 5;
}
@Override @Override
protected void actionPerformed(GuiButton btn) { protected void actionPerformed(GuiButton btn) {
super.actionPerformed(btn); super.actionPerformed(btn);
@@ -112,10 +91,6 @@ public class GuiModelHead extends GuiModelInterface{
playerdata.headwear = (byte) button.getValue(); playerdata.headwear = (byte) button.getValue();
} }
if(button.id == 30){
playerdata.hideHead = (byte) button.getValue();
}
if(button.id == 1){ if(button.id == 1){
if(button.getValue() == 0) if(button.getValue() == 0)
playerdata.removePart("hair"); playerdata.removePart("hair");
@@ -149,28 +124,26 @@ public class GuiModelHead extends GuiModelInterface{
initGui(); initGui();
} }
if(button.id == 4){ if(button.id == 4){
if(button.getValue() == 0) if(button.getValue() == 0)
playerdata.removePart("snout"); playerdata.removePart("snout");
else if(button.getValue() < 5){ else if(button.getValue() < 5){
ModelPartData data = playerdata.getOrCreatePart("snout"); ModelPartData data = playerdata.getOrCreatePart("snout");
data.type = (byte) (button.getValue() - 1); data.type = (byte) (button.getValue() - 1);
} }
else{ else{
ModelPartData data = playerdata.getOrCreatePart("snout"); ModelPartData data = playerdata.getOrCreatePart("snout");
byte type = 0; byte type = 0;
if(button.displayString.startsWith("Medium")) if(button.displayString.startsWith("Medium"))
type = 1; type = 1;
if(button.displayString.startsWith("Large")) if(button.displayString.startsWith("Large"))
type = 2; type = 2;
if(button.displayString.startsWith("Bunny")) if(button.displayString.startsWith("Bunny"))
type = 3; type = 3;
if(button.displayString.startsWith("Beak")) data.setTexture("snout/" + button.displayString.toLowerCase(), type);
type = 4; }
data.setTexture("snout/" + button.displayString.toLowerCase(), type); initGui();
} }
initGui();
}
if(button.id == 5){ if(button.id == 5){
int value = button.getValue(); int value = button.getValue();
@@ -190,26 +163,6 @@ public class GuiModelHead extends GuiModelInterface{
initGui(); initGui();
} }
if(button.id == 6){
int value = button.getValue();
if(value == 0)
playerdata.removePart("horns");
else{
ModelPartData data = playerdata.getOrCreatePart("horns");
if(value <= 4)
data.setTexture("", value - 1);
if(value == 5)
data.setTexture("horns/bull", 0);
if(value == 6)
data.setTexture("horns/antlers", 1);
if(value == 7)
data.setTexture("horns/antennas", 2);
if(value == 8)
data.setTexture("horns/antennas", 3);
}
initGui();
}
if(button.id == 11){ if(button.id == 11){
this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("hair"), npc)); this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("hair"), npc));
} }
@@ -225,9 +178,6 @@ public class GuiModelHead extends GuiModelInterface{
if(button.id == 15){ if(button.id == 15){
this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("ears"), npc)); this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("ears"), npc));
} }
if(button.id == 16){
this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("horns"), npc));
}
} }
@Override @Override
@@ -11,10 +11,8 @@ import noppes.npcs.entity.EntityCustomNpc;
public class GuiModelLegs extends GuiModelInterface{ public class GuiModelLegs extends GuiModelInterface{
private GuiScreen parent; private GuiScreen parent;
private final String[] arrLeg = new String[]{"gui.no","Both","Right","Left"}; private final String[] arrLegs = new String[]{"gui.no","Player","Player Naga","Spider","Horse","Naga", "Mermaid","Digitigrade"};
private final String[] arrLegwear = new String[]{"gui.no","Both","Left","Right"}; private final String[] arrTail = new String[]{"gui.no","Player", "Player Dragon","Cat","Wolf","Horse","Dragon", "Squirrel"};
private final String[] arrLegs = new String[]{"gui.no","Player","Player Naga","Spider","Horse","Naga", "Mermaid", "Mermaid 2", "Digitigrade"};
private final String[] arrTail = new String[]{"gui.no","Player", "Player Dragon","Cat","Wolf","Horse","Dragon", "Squirrel", "Fin", "Rodent", "Feather"};
public GuiModelLegs(GuiScreen parent, EntityCustomNpc npc){ public GuiModelLegs(GuiScreen parent, EntityCustomNpc npc){
super(npc); super(npc);
this.parent = parent; this.parent = parent;
@@ -26,15 +24,7 @@ public class GuiModelLegs extends GuiModelInterface{
super.initGui(); super.initGui();
int y = guiTop + 20; int y = guiTop + 20;
addButton(new GuiNpcButton(30, guiLeft + 50, y += 22, 70, 20, arrLeg, playerdata.hideLegs)); addButton(new GuiNpcButton(1, guiLeft + 50, y += 22, 70, 20, arrLegs, getNagaIndex(playerdata.legParts)));
addLabel(new GuiNpcLabel(30, "Hide", guiLeft, y + 5, 0xFFFFFF));
if (npc.display.modelType == 1 || npc.display.modelType == 2) {
addButton(new GuiNpcButton(8, guiLeft + 50, y += 22, 70, 20, arrLegwear, playerdata.legwear));
addLabel(new GuiNpcLabel(8, "Legwear", guiLeft, y + 5, 0xFFFFFF));
}
addButton(new GuiNpcButton(1, guiLeft + 50, y += 22, 70, 20, arrLegs, getLegIndex(playerdata.legParts)));
addLabel(new GuiNpcLabel(1, "Legs", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(1, "Legs", guiLeft, y + 5, 0xFFFFFF));
if(playerdata.legParts.type > 0) if(playerdata.legParts.type > 0)
addButton(new GuiNpcButton(11, guiLeft + 122, y, 40, 20, playerdata.legParts.getColor())); addButton(new GuiNpcButton(11, guiLeft + 122, y, 40, 20, playerdata.legParts.getColor()));
@@ -45,40 +35,33 @@ public class GuiModelLegs extends GuiModelInterface{
if(tail != null) if(tail != null)
addButton(new GuiNpcButton(12, guiLeft + 122, y, 40, 20, tail.getColor())); addButton(new GuiNpcButton(12, guiLeft + 122, y, 40, 20, tail.getColor()));
} }
private int getNagaIndex(ModelPartData data) {
private int getLegIndex(ModelPartData data) {
if(!data.playerTexture && data.type == 1) if(!data.playerTexture && data.type == 1)
return 5; return 5;
if(data.type == 4) if(data.type == 4)
return 6; return 6;
if(data.type == 5) if(data.type == 5)
return 8; return 7;
return data.type + 1; return data.type + 1;
} }
private int getTailIndex(ModelPartData data){ private int getTailIndex(ModelPartData data){
if(data == null) if(data == null)
return 0; return 0;
if(data.playerTexture && data.type == 0) if(data.playerTexture && data.type == 0)
return 1; return 1;
if(data.type == 0 && data.texture.contains("tail1")) if(data.type == 0 && data.texture.contains("tail1"))
return 3; return 3;
if(data.type == 0 && data.texture.contains("tail2")) if(data.type == 0 && data.texture.contains("tail2"))
return 4; return 4;
if(data.playerTexture && data.type == 1) if(data.playerTexture && data.type == 1)
return 2; return 2;
if(data.type == 1) if(data.type == 1)
return 6; return 6;
if(data.type == 2) if(data.type == 2)
return 5; return 5;
if(data.type == 3) if(data.type == 3)
return 7; return 7;
if(data.type == 4)
return 8;
if(data.type == 5)
return 9;
if(data.type == 6)
return 10;
return 0; return 0;
} }
@@ -88,12 +71,6 @@ public class GuiModelLegs extends GuiModelInterface{
super.actionPerformed(btn); super.actionPerformed(btn);
GuiNpcButton button = (GuiNpcButton) btn; GuiNpcButton button = (GuiNpcButton) btn;
if(button.id == 8){
playerdata.legwear = (byte) button.getValue();
}
if(button.id == 30){
playerdata.hideLegs = (byte) button.getValue();
}
if(button.id == 1){ if(button.id == 1){
ModelPartData data = playerdata.legParts; ModelPartData data = playerdata.legParts;
int value = button.getValue() - 1; int value = button.getValue() - 1;
@@ -107,53 +84,40 @@ public class GuiModelLegs extends GuiModelInterface{
if(value == 3) if(value == 3)
data.setTexture("legs/horse1", 3); data.setTexture("legs/horse1", 3);
if(value == 4) if(value == 4)
if (npc.display.modelType == 1 || npc.display.modelType == 2){ data.setTexture("legs/naga1", 1);
data.setTexture("legs/naga2", 1);
}
else{
data.setTexture("legs/naga1", 1);
}
if(value == 5) if(value == 5)
data.setTexture("legs/mermaid1", 4); data.setTexture("legs/mermaid1", 4);
if(value == 6) if(value == 6)
data.setTexture("legs/mermaid1", 6);
if(value == 7)
data.setTexture("", 5); data.setTexture("", 5);
initGui(); initGui();
} }
if(button.id == 2){ if(button.id == 2){
int value = button.getValue(); int value = button.getValue();
if(value == 0) if(value == 0)
playerdata.removePart("tail"); playerdata.removePart("tail");
else{ else{
ModelPartData data = playerdata.getOrCreatePart("tail"); ModelPartData data = playerdata.getOrCreatePart("tail");
if(value == 1) if(value == 1)
data.setTexture("", 0); data.setTexture("", 0);
if(value == 2) if(value == 2)
data.setTexture("", 1); data.setTexture("", 1);
if(value == 3) if(value == 3)
data.setTexture("tail/tail1", 0); data.setTexture("tail/tail1", 0);
if(value == 4) if(value == 4)
data.setTexture("tail/tail2", 0); data.setTexture("tail/tail2", 0);
if(value == 5) if(value == 5)
data.setTexture("tail/horse1", 2); data.setTexture("tail/horse1", 2);
if(value == 6) if(value == 6)
data.setTexture("tail/dragon1", 1); data.setTexture("tail/dragon1", 1);
if(value == 7) if(value == 7)
data.setTexture("tail/squirrel1", 3); data.setTexture("tail/squirrel1", 3);
if(value == 8)
data.setTexture("tail/fin1", 4);
if(value == 9)
data.setTexture("tail/rodent1", 5);
if(value == 10)
data.setTexture("tail/feather1", 6);
} }
initGui(); initGui();
} }
if(button.id == 11){ if(button.id == 11){
this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.legParts, npc)); this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.legParts, npc));
} }
@@ -15,11 +15,6 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{
private GuiScreen parent; private GuiScreen parent;
private int type = 0; private int type = 0;
private GuiNpcSlider scaleWidth;
private GuiNpcSlider scaleHeight;
private GuiNpcSlider scaleDepth;
public GuiModelScale(GuiScreen parent, ModelData data, EntityCustomNpc npc){ public GuiModelScale(GuiScreen parent, ModelData data, EntityCustomNpc npc){
super(npc); super(npc);
this.parent = parent; this.parent = parent;
@@ -72,69 +67,29 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{
addButton(new GuiNpcButton(3, guiLeft + 110, y , 60, 20, "Edit")); addButton(new GuiNpcButton(3, guiLeft + 110, y , 60, 20, "Edit"));
y += 24; y += 24;
} }
} }
private void drawSlider(int y, ModelPartConfig config){ private void drawSlider(int y, ModelPartConfig config){
y += 15; y += 15;
addLabel(new GuiNpcLabel(10, "Width", guiLeft - 25, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(10, "Width", guiLeft, y + 5, 0xFFFFFF));
scaleWidth = new GuiNpcSlider(this, 10, guiLeft + 50, y, config.scaleX - 0.5f); addSlider(new GuiNpcSlider(this, 10, guiLeft + 50, y, config.scaleX - 0.5f));
addSlider(scaleWidth);
addButton(new GuiNpcButton(170, guiLeft + 8, y, 40, 20, "Reset"));
y += 22; y += 22;
addLabel(new GuiNpcLabel(11, "Height", guiLeft - 25, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(11, "Height", guiLeft, y + 5, 0xFFFFFF));
scaleHeight = new GuiNpcSlider(this, 11, guiLeft + 50, y, config.scaleY - 0.5f); addSlider(new GuiNpcSlider(this, 11, guiLeft + 50, y, config.scaleY - 0.5f));
addSlider(scaleHeight);
addButton(new GuiNpcButton(171, guiLeft + 8, y, 40, 20, "Reset"));
y += 22; y += 22;
addLabel(new GuiNpcLabel(12, "Depth", guiLeft - 25, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(12, "Depth", guiLeft, y + 5, 0xFFFFFF));
scaleDepth = new GuiNpcSlider(this, 12, guiLeft + 50, y, config.scaleZ - 0.5f); addSlider(new GuiNpcSlider(this, 12, guiLeft + 50, y, config.scaleZ - 0.5f));
addSlider(scaleDepth);
addButton(new GuiNpcButton(172, guiLeft + 8, y, 40, 20, "Reset"));
} }
@Override @Override
protected void actionPerformed(GuiButton btn) { protected void actionPerformed(GuiButton btn) {
super.actionPerformed(btn); super.actionPerformed(btn);
if(btn.id < 4){ if(btn.id < 4){
type = btn.id; type = btn.id;
initGui(); initGui();
} }
else{
// Resetting Type
ModelPartConfig config = playerdata.head;
if(type == 1)
config = playerdata.body;
else if(type == 2)
config = playerdata.arms;
else if(type == 3)
config = playerdata.legs;
if(btn.id == 170){
config.scaleX = 1.0f;
scaleWidth.sliderValue = 0.5f;
int percent = (int) (50 + scaleWidth.sliderValue * 100);
scaleWidth.setString(percent + "%");
npc.updateHitbox();
}
else if(btn.id == 171){
config.scaleY = 1.0f;
scaleHeight.sliderValue = 0.5f;
int percent = (int) (50 + scaleHeight.sliderValue * 100);
scaleHeight.setString(percent + "%");
npc.updateHitbox();
}
else if(btn.id == 172){
config.scaleZ = 1.0f;
scaleDepth.sliderValue = 0.5f;
int percent = (int) (50 + scaleDepth.sliderValue * 100);
scaleDepth.setString(percent + "%");
npc.updateHitbox();
}
}
} }
@Override @Override
@@ -240,7 +240,7 @@ public class GuiMailmanWrite extends GuiContainerNPCInterface implements ITextfi
*/ */
public void keyTyped(char par1, int par2) public void keyTyped(char par1, int par2)
{ {
if(!GuiNpcTextField.isFieldActive() && canEdit) if(!GuiNpcTextField.isActive() && canEdit)
this.keyTypedInBook(par1, par2); this.keyTypedInBook(par1, par2);
else else
super.keyTyped(par1, par2); super.keyTyped(par1, par2);
@@ -10,8 +10,10 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World; import net.minecraft.world.World;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.util.GuiCustomScroll; import noppes.npcs.client.gui.util.GuiCustomScroll;
import noppes.npcs.client.gui.util.ICustomScrollListener; import noppes.npcs.client.gui.util.ICustomScrollListener;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.GuiNpcButton; import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel; import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField; import noppes.npcs.client.gui.util.GuiNpcTextField;
@@ -82,7 +84,7 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
addScroll(scroll); addScroll(scroll);
this.addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 140, 98, 20, "gui.back")); this.addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 140, 98, 20, "gui.back"));
scroll.visible = GuiNpcTextField.isFieldActive(); scroll.visible = GuiNpcTextField.isActive();
} }
protected void actionPerformed(GuiButton guibutton) { protected void actionPerformed(GuiButton guibutton) {
@@ -94,7 +96,7 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
public void mouseClicked(int i, int j, int k) public void mouseClicked(int i, int j, int k)
{ {
super.mouseClicked(i, j, k); super.mouseClicked(i, j, k);
scroll.visible = GuiNpcTextField.isFieldActive(); scroll.visible = GuiNpcTextField.isActive();
} }
public void save() { public void save() {
} }
@@ -23,10 +23,6 @@ public class GuiNpcPuppet extends GuiModelInterface implements ISliderListener{
private JobPuppet job; private JobPuppet job;
private PartConfig part; private PartConfig part;
private GuiNpcSlider rotateX;
private GuiNpcSlider rotateY;
private GuiNpcSlider rotateZ;
public GuiNpcPuppet(GuiScreen parent, EntityCustomNpc npc){ public GuiNpcPuppet(GuiScreen parent, EntityCustomNpc npc){
super(npc); super(npc);
this.parent = parent; this.parent = parent;
@@ -122,20 +118,14 @@ public class GuiNpcPuppet extends GuiModelInterface implements ISliderListener{
addButton(new GuiNpcButton(29, guiLeft + 100, y , 80, 20, new String[]{"gui.enabled","gui.disabled"}, config.disabled?1:0)); addButton(new GuiNpcButton(29, guiLeft + 100, y , 80, 20, new String[]{"gui.enabled","gui.disabled"}, config.disabled?1:0));
y += 22; y += 22;
addLabel(new GuiNpcLabel(10, "X", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(10, "X", guiLeft, y + 5, 0xFFFFFF));
rotateX = new GuiNpcSlider(this, 10, guiLeft + 50, y, config.rotationX + 0.5f); addSlider(new GuiNpcSlider(this, 10, guiLeft + 50, y, config.rotationX + 0.5f));
addSlider(rotateX);
addButton(new GuiNpcButton(170, guiLeft + 8, y, 40, 20, "Reset"));
y += 22; y += 22;
addLabel(new GuiNpcLabel(11, "Y", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(11, "Y", guiLeft, y + 5, 0xFFFFFF));
rotateY = new GuiNpcSlider(this, 11, guiLeft + 50, y, config.rotationY + 0.5f); addSlider(new GuiNpcSlider(this, 11, guiLeft + 50, y, config.rotationY + 0.5f));
addSlider(rotateY);
addButton(new GuiNpcButton(171, guiLeft + 8, y, 40, 20, "Reset"));
y += 22; y += 22;
addLabel(new GuiNpcLabel(12, "Z", guiLeft, y + 5, 0xFFFFFF)); addLabel(new GuiNpcLabel(12, "Z", guiLeft, y + 5, 0xFFFFFF));
rotateZ = new GuiNpcSlider(this, 12, guiLeft + 50, y, config.rotationZ + 0.5f); addSlider(new GuiNpcSlider(this, 12, guiLeft + 50, y, config.rotationZ + 0.5f));
addSlider(rotateZ); }
addButton(new GuiNpcButton(172, guiLeft + 8, y, 40, 20, "Reset"));
}
@Override @Override
@@ -161,29 +151,6 @@ public class GuiNpcPuppet extends GuiModelInterface implements ISliderListener{
if(btn.id == 32){ if(btn.id == 32){
job.whileAttacking = button.getValue() == 0; job.whileAttacking = button.getValue() == 0;
} }
if(btn.id == 170 || btn.id == 171 || btn.id == 172){
if(btn.id == 170){
System.out.println(part.rotationX);
System.out.println(rotateX.sliderValue);
part.rotationX = 0.0f;
rotateX.sliderValue = 0.5f;
int percent = (int) ((rotateX.sliderValue) * 360);
rotateX.setString(percent + "%");
}
else if(btn.id == 171){
part.rotationY = 0.0f;
rotateY.sliderValue = 0.5f;
int percent = (int) ((rotateY.sliderValue) * 360);
rotateY.setString(percent + "%");
}
else{
part.rotationZ = 0.0f;
rotateZ.sliderValue = 0.5f;
int percent = (int) ((rotateZ.sliderValue) * 360);
rotateZ.setString(percent + "%");
}
npc.updateHitbox();
}
} }
@Override @Override
@@ -1,111 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs.client.gui.script;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import noppes.npcs.EventScriptContainer;
import noppes.npcs.client.gui.util.GuiCustomScroll;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.SubGuiInterface;
public class EventGuiScriptList extends SubGuiInterface {
private GuiCustomScroll scroll1;
private GuiCustomScroll scroll2;
private EventScriptContainer container;
private List<String> scripts;
public EventGuiScriptList(List<String> scripts, EventScriptContainer container) {
this.container = container;
this.setBackground("menubg.png");
this.xSize = 346;
this.ySize = 216;
if(scripts == null) {
scripts = new ArrayList();
}
this.scripts = (List)scripts;
}
public void initGui() {
super.initGui();
if(this.scroll1 == null) {
this.scroll1 = new GuiCustomScroll(this, 0);
this.scroll1.setSize(140, 180);
}
this.scroll1.guiLeft = this.guiLeft + 4;
this.scroll1.guiTop = this.guiTop + 14;
this.addScroll(this.scroll1);
this.addLabel(new GuiNpcLabel(1, "script.availableScripts", this.guiLeft + 4, this.guiTop + 4));
if(this.scroll2 == null) {
this.scroll2 = new GuiCustomScroll(this, 1);
this.scroll2.setSize(140, 180);
}
this.scroll2.guiLeft = this.guiLeft + 200;
this.scroll2.guiTop = this.guiTop + 14;
this.addScroll(this.scroll2);
this.addLabel(new GuiNpcLabel(2, "script.loadedScripts", this.guiLeft + 200, this.guiTop + 4));
ArrayList temp = new ArrayList(this.scripts);
temp.removeAll(this.container.scripts);
this.scroll1.setList(temp);
this.scroll2.setList(this.container.scripts);
this.addButton(new GuiNpcButton(1, this.guiLeft + 145, this.guiTop + 40, 55, 20, ">"));
this.addButton(new GuiNpcButton(2, this.guiLeft + 145, this.guiTop + 62, 55, 20, "<"));
this.addButton(new GuiNpcButton(3, this.guiLeft + 145, this.guiTop + 90, 55, 20, ">>"));
this.addButton(new GuiNpcButton(4, this.guiLeft + 145, this.guiTop + 112, 55, 20, "<<"));
this.addButton(new GuiNpcButton(66, this.guiLeft + 260, this.guiTop + 194, 60, 20, "gui.done"));
}
protected void actionPerformed(GuiButton guibutton) {
GuiNpcButton button = (GuiNpcButton)guibutton;
if(button.id == 1 && this.scroll1.hasSelected()) {
this.container.scripts.add(this.scroll1.getSelected());
this.scroll1.selected = -1;
this.scroll1.selected = -1;
this.initGui();
}
if(button.id == 2 && this.scroll2.hasSelected()) {
this.container.scripts.remove(this.scroll2.getSelected());
this.scroll2.selected = -1;
this.initGui();
}
if(button.id == 3) {
this.container.scripts.clear();
Iterator var3 = this.scripts.iterator();
while(var3.hasNext()) {
String script = (String)var3.next();
this.container.scripts.add(script);
}
this.scroll1.selected = -1;
this.scroll1.selected = -1;
this.initGui();
}
if(button.id == 4) {
this.container.scripts.clear();
this.scroll1.selected = -1;
this.scroll1.selected = -1;
this.initGui();
}
if(button.id == 66) {
this.close();
}
}
public void save() {
}
}
@@ -1,30 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package noppes.npcs.client.gui.script;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.data.ForgeDataScript;
public class GuiScriptForge extends GuiScriptInterface {
private ForgeDataScript script = new ForgeDataScript();
public GuiScriptForge() {
this.handler = this.script;
Client.sendData(EnumPacketServer.ScriptForgeGet);
}
public void setGuiData(NBTTagCompound compound) {
this.script.readFromNBT(compound);
super.setGuiData(compound);
}
public void save() {
super.save();
Client.sendData(EnumPacketServer.ScriptForgeSave, script.writeToNBT(new NBTTagCompound()));
}
}
@@ -1,55 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package noppes.npcs.client.gui.script;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.GuiNpcButton;
import org.lwjgl.opengl.GL11;
public class GuiScriptGlobal extends GuiNPCInterface {
private final ResourceLocation resource = new ResourceLocation("customnpcs", "textures/gui/smallbg.png");
public GuiScriptGlobal() {
this.xSize = 176;
this.ySize = 222;
this.drawDefaultBackground = false;
this.title = "";
}
public void initGui() {
super.initGui();
this.addButton(new GuiNpcButton(0, this.guiLeft + 38, this.guiTop + 20, 100, 20, "Players"));
this.addButton(new GuiNpcButton(1, this.guiLeft + 38, this.guiTop + 50, 100, 20, "Forge"));
}
public void drawScreen(int i, int j, float f) {
this.drawDefaultBackground();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(this.resource);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
super.drawScreen(i, j, f);
}
protected void actionPerformed(GuiButton guibutton) {
if (guibutton.id == 0) {
this.displayGuiScreen(new GuiScriptPlayers());
}
if (guibutton.id == 1) {
this.displayGuiScreen(new GuiScriptForge());
}
}
public void keyTyped(char c, int i) {
if (i == 1 || this.isInventoryKey(i)) {
this.close();
}
}
public void save() {
}
}
@@ -1,441 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs.client.gui.script;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.*;
import java.util.Map.Entry;
import com.google.common.reflect.ClassPath;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiConfirmOpenLink;
import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.client.gui.GuiYesNoCallback;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.world.WorldEvent;
import noppes.npcs.EventScriptContainer;
import noppes.npcs.NoppesStringUtils;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.swing.GuiJTextArea;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.controllers.IScriptHandler;
import noppes.npcs.controllers.PixelmonHelper;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.PlayerDataScript;
import org.apache.commons.lang3.StringUtils;
public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallback, IGuiData, ITextChangeListener, ICustomScrollListener, IJTextAreaListener, ITextfieldListener {
private int activeTab = 0;
public IScriptHandler handler;
public Map<String, List<String>> languages = new HashMap();
private int scriptLimit = 1;
public GuiScriptInterface() {
this.drawDefaultBackground = true;
this.closeOnEsc = true;
this.xSize = 420;
this.setBackground("menubg.png");
}
public void initGui() {
//this.xSize = (int)((double)this.width * 0.88D);
this.ySize = (int)((double)this.xSize * 0.56D);
if((double)this.ySize > (double)this.height * 0.95D) {
this.ySize = (int)((double)this.height * 0.95D);
this.xSize = (int)((double)this.ySize / 0.56D);
}
this.bgScale = (float)this.xSize / 400.0F;
super.initGui();
this.guiTop += 10;
int yoffset = (int)((double)this.ySize * 0.02D);
GuiMenuTopButton top;
this.addTopButton(top = new GuiMenuTopButton(0, this.guiLeft + 4, this.guiTop - 17, "gui.settings"));
int topXoffset = 0;
int topYoffset = 0;
for(int ta = 0; ta < this.handler.getScripts().size(); ++ta) {
if(ta%20 == 0 && ta > 0) {
topYoffset -= 20;
topXoffset -= top.width+20*22;
}
this.addTopButton(top = new GuiMenuTopButton(ta + 1, top.xPosition+top.width + topXoffset, top.yPosition + topYoffset, ta + 1 + ""));
topXoffset = 0;
topYoffset = 0;
scriptLimit = ta + 2;
}
if(this.handler.getScripts().size() < 100)
this.addTopButton(new GuiMenuTopButton(scriptLimit, top.xPosition+top.width, top.yPosition, "+"));
top = this.getTopButton(this.activeTab);
if(top == null) {
this.activeTab = 0;
top = this.getTopButton(0);
}
top.active = true;
if(this.activeTab > 0) {
List<String> hookList = new ArrayList<String>();
GuiCustomScroll hooks = new GuiCustomScroll(this, 1);
hooks.allowUserInput = false;
hooks.setSize(108, 198);
hooks.guiLeft = guiLeft - 110;
hooks.guiTop = guiTop + 14;
if(handler instanceof PlayerDataScript) {
hookList.add("init");
hookList.add("tick");
hookList.add("interact");
hookList.add("damagedEntity");
hookList.add("damaged");
hookList.add("kills");
hookList.add("killed");
hookList.add("drop");
hookList.add("respawn");
hookList.add("breakBlock");
hookList.add("chat");
hookList.add("login");
hookList.add("logout");
hookList.add("keyPressed");
hookList.add("mouseClicked");
hookList.add("toss");
hookList.add("pickUp");
hookList.add("pickupXP");
hookList.add("rangedCharge");
hookList.add("rangedLaunched");
hookList.add("timer");
hookList.add("startItem");
hookList.add("usingItem");
hookList.add("stopItem");
hookList.add("finishItem");
hookList.add("containerOpen");
hookList.add("useHoe");
hookList.add("bonemeal");
hookList.add("fillBucket");
hookList.add("jump");
hookList.add("fall");
hookList.add("wakeUp");
hookList.add("sleep");
hookList.add("playSound");
hookList.add("lightning");
hookList.add("changedDim");
}
else if(handler instanceof ForgeDataScript) {
hooks.setSize(238, 198);
hooks.guiLeft = guiLeft - 240;
hookList.add("init");
ArrayList<ClassPath.ClassInfo> list = new ArrayList();
try {
list.addAll(ClassPath.from(this.getClass().getClassLoader()).getTopLevelClassesRecursive("cpw.mods.fml.common.event"));
list.addAll(ClassPath.from(this.getClass().getClassLoader()).getTopLevelClassesRecursive("cpw.mods.fml.common.gameevent"));
list.addAll(ClassPath.from(this.getClass().getClassLoader()).getTopLevelClassesRecursive("net.minecraftforge.event"));
} catch (IOException e) {
e.printStackTrace();
}
for(ClassPath.ClassInfo e1 : list){
ClassPath.ClassInfo classLoader = e1;
Class infoClass = classLoader.load();
ArrayList c = new ArrayList(Arrays.asList(infoClass.getDeclaredClasses()));
if(c.isEmpty()) {
c.add(infoClass);
}
Iterator var10 = c.iterator();
while(var10.hasNext()) {
Class c1 = (Class) var10.next();
if (!EntityEvent.EntityConstructing.class.isAssignableFrom(c1) && !WorldEvent.PotentialSpawns.class.isAssignableFrom(c1) && !TickEvent.RenderTickEvent.class.isAssignableFrom(c1) && !TickEvent.ClientTickEvent.class.isAssignableFrom(c1) && !FMLNetworkEvent.ClientCustomPacketEvent.class.isAssignableFrom(c1) && !ItemTooltipEvent.class.isAssignableFrom(c1) && Event.class.isAssignableFrom(c1) && !Modifier.isAbstract(c1.getModifiers()) && Modifier.isPublic(c1.getModifiers())) {
String eventName = c1.getName();
int i = eventName.lastIndexOf(".");
eventName = StringUtils.uncapitalize(eventName.substring(i + 1).replace("$", ""));
hookList.add(eventName);
}
}
}
}
hooks.setUnsortedList(hookList);
addScroll(hooks);
GuiNpcLabel hookLabel = new GuiNpcLabel(0, "script.hooks", hooks.guiLeft, guiTop + 5);
hookLabel.color = 0xaaaaaa;
addLabel(hookLabel);
EventScriptContainer var7 = (EventScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
GuiNpcTextArea left = new GuiNpcTextArea(2, this, this.guiLeft + yoffset, this.guiTop + yoffset, this.xSize - 110 - yoffset, (int)((double)this.ySize * 0.96D) - yoffset * 2, var7 == null?"":var7.script);
this.addTextField(left);
int left1 = this.guiLeft + this.xSize - 104;
this.addButton(new GuiNpcButton(102, left1, this.guiTop + yoffset, 60, 20, "gui.clear"));
this.addButton(new GuiNpcButton(101, left1 + 61, this.guiTop + yoffset, 60, 20, "gui.paste"));
this.addButton(new GuiNpcButton(100, left1, this.guiTop + 21 + yoffset, 60, 20, "gui.copy"));
this.addButton(new GuiNpcButton(105, left1 + 61, this.guiTop + 21 + yoffset, 60, 20, "gui.remove"));
this.addButton(new GuiNpcButton(107, left1, this.guiTop + 66 + yoffset, 80, 20, "script.loadscript"));
GuiCustomScroll scroll = (new GuiCustomScroll(this, 0)).setUnselectable();
scroll.setSize(100, (int)((double)this.ySize * 0.54D) - yoffset * 2);
scroll.guiLeft = left1;
scroll.guiTop = this.guiTop + 88 + yoffset;
if(var7 != null) {
scroll.setList(var7.scripts);
}
this.addScroll(scroll);
} else {
GuiNpcTextArea var8 = new GuiNpcTextArea(2, this, this.guiLeft + 4 + yoffset, this.guiTop + 6 + yoffset, this.xSize - 160 - yoffset, (int)((float)this.ySize * 0.92F) - yoffset * 2, this.getConsoleText());
var8.enabled = false;
this.addTextField(var8);
int var9 = this.guiLeft + this.xSize - 150;
this.addButton(new GuiNpcButton(100, var9, this.guiTop + 125, 60, 20, "gui.copy"));
this.addButton(new GuiNpcButton(102, var9, this.guiTop + 146, 60, 20, "gui.clear"));
this.addLabel(new GuiNpcLabel(1, "script.language", var9, this.guiTop + 15));
this.addButton(new GuiNpcButton(103, var9 + 60, this.guiTop + 10, 80, 20, (String[])this.languages.keySet().toArray(new String[this.languages.keySet().size()]), this.getScriptIndex()));
this.getButton(103).enabled = this.languages.size() > 0;
this.addLabel(new GuiNpcLabel(2, "gui.enabled", var9, this.guiTop + 36));
this.addButton(new GuiNpcButton(104, var9 + 60, this.guiTop + 31, 50, 20, new String[]{"gui.no", "gui.yes"}, this.handler.getEnabled()?1:0));
if(this.player.worldObj.isRemote) {
this.addButton(new GuiNpcButton(106, var9, this.guiTop + 55, 150, 20, "script.openfolder"));
}
this.addButton(new GuiNpcButton(109, var9, this.guiTop + 78, 80, 20, "gui.website"));
this.addButton(new GuiNpcButton(112, var9 + 81, this.guiTop + 78, 80, 20, "gui.forum"));
this.addButton(new GuiNpcButton(110, var9, this.guiTop + 99, 80, 20, "script.apidoc"));
this.addButton(new GuiNpcButton(111, var9 + 81, this.guiTop + 99, 80, 20, "script.apisrc"));
}
this.xSize = 420;
this.ySize = 256;
}
@Override
public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
//this.handler.getScripts().get(this.activeTab - 1).setType(scroll.getSelected().replace("playerscript.",""));
}
@Override
public void unFocused(GuiNpcTextField textfield) {
/*if(textfield.id == 1){
this.handler.getScripts().get(this.activeTab - 1).setType(textfield.getText());
}*/
}
/*private int getScriptHook(EventScriptContainer eventScriptContainer, List<String> list) {
for(String s : list) {
if (s.replace("playerscript.", "").equals(eventScriptContainer.type)) {
return list.indexOf(s);
}
}
return 0;
}*/
private String getConsoleText() {
Map<Long, String> map = this.handler.getConsoleText();
StringBuilder builder = new StringBuilder();
Iterator var3 = map.entrySet().iterator();
while(var3.hasNext()) {
Entry<Long, String> entry = (Entry)var3.next();
builder.insert(0, new Date((Long)entry.getKey()) + (String)entry.getValue() + "\n");
}
return builder.toString();
}
private int getScriptIndex() {
int i = 0;
for(Iterator var2 = this.languages.keySet().iterator(); var2.hasNext(); ++i) {
String language = (String)var2.next();
if(language.equalsIgnoreCase(this.handler.getLanguage())) {
return i;
}
}
return 0;
}
public void confirmClicked(boolean flag, int i) {
if(flag) {
if(i == 0) {
this.openLink("http://www.kodevelopment.nl/minecraft/customnpcs/scripting");
}
if(i == 1) {
this.openLink("http://www.kodevelopment.nl/customnpcs/api/");
}
if(i == 2) {
this.openLink("http://www.kodevelopment.nl/minecraft/customnpcs/scripting");
}
if(i == 3) {
this.openLink("http://www.minecraftforge.net/forum/index.php/board,122.0.html");
}
if(i == 10) {
this.handler.getScripts().remove(this.activeTab - 1);
this.activeTab = 0;
}
}
this.displayGuiScreen(this);
}
@Override
protected void actionPerformed(GuiButton guibutton) {
if(guibutton.id >= 0 && guibutton.id < scriptLimit) {
this.setScript();
this.activeTab = guibutton.id;
this.initGui();
}
if(guibutton.id == scriptLimit) {
this.handler.getScripts().add(new EventScriptContainer(this.handler));
this.activeTab = this.handler.getScripts().size();
this.initGui();
}
if(guibutton.id == 109) {
this.displayGuiScreen(new GuiConfirmOpenLink(this, "http://www.kodevelopment.nl/minecraft/customnpcs/scripting", 0, true));
}
if(guibutton.id == 110) {
this.displayGuiScreen(new GuiConfirmOpenLink(this, "http://www.kodevelopment.nl/customnpcs/api/", 1, true));
}
if(guibutton.id == 111) {
this.displayGuiScreen(new GuiConfirmOpenLink(this, "https://github.com/Noppes/CustomNPCsAPI", 2, true));
}
if(guibutton.id == 112) {
this.displayGuiScreen(new GuiConfirmOpenLink(this, "http://www.minecraftforge.net/forum/index.php/board,122.0.html", 3, true));
}
if(guibutton.id == 100) {
NoppesStringUtils.setClipboardContents((this.getTextField(2)).getText());
}
if(guibutton.id == 101) {
(this.getTextField(2)).setText(NoppesStringUtils.getClipboardContents());
}
EventScriptContainer container;
if(guibutton.id == 102) {
if(this.activeTab > 0) {
container = (EventScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
container.script = "";
} else {
this.handler.clearConsole();
}
this.initGui();
}
if(guibutton.id == 103) {
this.handler.setLanguage(((GuiNpcButton)guibutton).displayString);
}
if(guibutton.id == 104) {
this.handler.setEnabled((((GuiNpcButton)guibutton).getValue() == 1));
}
if(guibutton.id == 105) {
GuiYesNo container1 = new GuiYesNo(this, "", ((GuiNpcButton)guibutton).displayString, 10);
this.displayGuiScreen(container1);
}
if(guibutton.id == 106) {
NoppesUtil.openFolder(ScriptController.Instance.dir);
}
if(guibutton.id == 107) {
container = (EventScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
if(container == null) {
this.handler.getScripts().add(container = new EventScriptContainer(this.handler));
}
this.setSubGui(new EventGuiScriptList((List)this.languages.get(this.handler.getLanguage()), container));
}
if(guibutton.id == 108) {
container = (EventScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
if(container != null) {
this.setScript();
this.AWTWindow = new GuiJTextArea(container.script).setListener(this);
}
}
}
private void setScript() {
if(this.activeTab > 0) {
EventScriptContainer container = (EventScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
if(container == null) {
this.handler.getScripts().add(container = new EventScriptContainer(this.handler));
}
String text = (this.getTextField(2)).getText();
text = text.replace("\r\n", "\n");
text = text.replace("\r", "\n");
container.script = text;
}
}
public void setGuiData(NBTTagCompound compound) {
NBTTagList data = compound.getTagList("Languages", 10);
HashMap languages = new HashMap();
for(int i = 0; i < data.tagCount(); ++i) {
NBTTagCompound comp = data.getCompoundTagAt(i);
ArrayList scripts = new ArrayList();
NBTTagList list = comp.getTagList("Scripts", 8);
for(int j = 0; j < list.tagCount(); ++j) {
scripts.add(list.getStringTagAt(j));
}
languages.put(comp.getString("Language"), scripts);
}
this.languages = languages;
this.initGui();
}
public void save() {
this.setScript();
}
public void textUpdate(String text) {
EventScriptContainer container = (EventScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
if(container != null) {
container.script = text;
}
}
@Override
public void saveText(String text) {
EventScriptContainer container = handler.getScripts().get(activeTab);
if(container != null)
container.script = text;
initGui();
}
}
@@ -1,37 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package noppes.npcs.client.gui.script;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.data.PlayerDataScript;
public class GuiScriptPlayers extends GuiScriptInterface {
private PlayerDataScript script = new PlayerDataScript((EntityPlayer)null);
public GuiScriptPlayers() {
this.handler = this.script;
Client.sendData(EnumPacketServer.ScriptPlayerGet);
}
public void setGuiData(NBTTagCompound compound) {
this.script.readFromNBT(compound);
super.setGuiData(compound);
}
public void save() {
super.save();
Client.sendData(EnumPacketServer.ScriptPlayerSave, script.writeToNBT(new NBTTagCompound()));
}
public void close() {
super.close();
ScriptController.Instance.playerScripts.errored.clear();
}
}
@@ -109,7 +109,7 @@ public abstract class GuiContainerNPCInterface extends GuiContainer
for(GuiNpcTextField tf : new ArrayList<GuiNpcTextField>(textfields.values())) for(GuiNpcTextField tf : new ArrayList<GuiNpcTextField>(textfields.values()))
tf.textboxKeyTyped(c, i); tf.textboxKeyTyped(c, i);
if (closeOnEsc && (i == 1 || i == mc.gameSettings.keyBindInventory.getKeyCode() && !GuiNpcTextField.isFieldActive())) if (closeOnEsc && (i == 1 || i == mc.gameSettings.keyBindInventory.getKeyCode() && !GuiNpcTextField.isActive()))
close(); close();
} }
} }
@@ -280,7 +280,4 @@ public class GuiCustomScroll extends GuiScreen
return this; return this;
} }
public boolean isMouseOver(int x, int y) {
return x >= this.guiLeft && x <= this.guiLeft + this.xSize && y >= this.guiTop && y <= this.guiTop + this.ySize;
}
} }
@@ -144,7 +144,7 @@ public abstract class GuiNPCInterface extends GuiScreen
for(GuiNpcTextField tf : textfields.values()) for(GuiNpcTextField tf : textfields.values())
tf.textboxKeyTyped(c, i); tf.textboxKeyTyped(c, i);
if (closeOnEsc && (i == 1 || !GuiNpcTextField.isFieldActive() && isInventoryKey(i))){ if (closeOnEsc && (i == 1 || !GuiNpcTextField.isActive() && isInventoryKey(i))){
close(); close();
} }
} }
@@ -24,14 +24,6 @@ public class GuiNpcSlider extends GuiButton {
listener = (ISliderListener) parent; listener = (ISliderListener) parent;
} }
public GuiNpcSlider(GuiScreen parent, int id, int xPos, int yPos, int width, int height, String displayString, float sliderValue) {
super(id, xPos, yPos, width, height, NoppesStringUtils.translate(displayString));
this.id = id;
this.sliderValue = sliderValue;
if(parent instanceof ISliderListener)
listener = (ISliderListener) parent;
}
public GuiNpcSlider(GuiScreen parent, int id, int xPos, int yPos, float sliderValue) { public GuiNpcSlider(GuiScreen parent, int id, int xPos, int yPos, float sliderValue) {
this(parent, id, xPos, yPos, "", sliderValue); this(parent, id, xPos, yPos, "", sliderValue);
if(listener != null) if(listener != null)
@@ -15,7 +15,7 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
public class GuiNpcTextArea extends GuiNpcTextField implements IGui{ public class GuiNpcTextArea extends GuiNpcTextField{
public boolean inMenu = true; public boolean inMenu = true;
public boolean numbersOnly = false; public boolean numbersOnly = false;
private int posX,posY,width,height; private int posX,posY,width,height;
@@ -307,24 +307,4 @@ public class GuiNpcTextArea extends GuiNpcTextField implements IGui{
} }
drawTexturedModalRect(x, y, width, 11, 5, 1); drawTexturedModalRect(x, y, width, 11, 5, 1);
} }
@Override
public int getID() {
return 0;
}
@Override
public void drawScreen(int var1, int var2) {
}
@Override
public void updateScreen() {
}
@Override
public boolean isActive() {
return isFieldActive();
}
} }
@@ -27,7 +27,7 @@ public class GuiNpcTextField extends GuiTextField{
listener = (ITextfieldListener) parent; listener = (ITextfieldListener) parent;
} }
public static boolean isFieldActive(){ public static boolean isActive(){
return activeTextfield != null; return activeTextfield != null;
} }
@@ -1,473 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs.client.gui.util;
import java.awt.Font;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.ChatAllowedCharacters;
import net.minecraftforge.client.GuiIngameForge;
import noppes.npcs.CustomNpcs;
import noppes.npcs.NoppesStringUtils;
import noppes.npcs.client.gui.util.TextContainer.LineData;
import noppes.npcs.config.TrueTypeFont;
import org.lwjgl.input.Mouse;
public class GuiTextArea extends Gui implements IGui, IKeyListener, IMouseListener {
public int id;
public int x;
public int y;
public int width;
public int height;
private int cursorCounter;
private ITextChangeListener listener;
private static TrueTypeFont font;
public String text = null;
private TextContainer container = null;
public boolean active = false;
public boolean enabled = true;
public boolean visible = true;
public boolean clicked = false;
public boolean doubleClicked = false;
public boolean clickScrolling = false;
private int startSelection;
private int endSelection;
private int cursorPosition;
private int scrolledLine = 0;
private boolean enableCodeHighlighting = false;
private static final char colorChar = '\uffff';
public List<GuiTextArea.UndoData> undoList = new ArrayList();
public List<GuiTextArea.UndoData> redoList = new ArrayList();
public boolean undoing = false;
private long lastClicked = 0L;
public GuiTextArea(int id, int x, int y, int width, int height, String text) {
this.id = id;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.undoing = true;
this.setText(text);
this.undoing = false;
font.setSpecial('\uffff');
}
public void drawScreen(int xMouse, int yMouse) {
if(this.visible) {
drawRect(this.x - 1, this.y - 1, this.x + this.width + 1, this.y + this.height + 1, -6250336);
drawRect(this.x, this.y, this.x + this.width, this.y + this.height, -16777216);
this.container.visibleLines = this.height / this.container.lineHeight;
int startBracket;
if(this.clicked) {
this.clicked = Mouse.isButtonDown(0);
startBracket = this.getSelectionPos(xMouse, yMouse);
if(startBracket != this.cursorPosition) {
if(this.doubleClicked) {
this.startSelection = this.endSelection = this.cursorPosition;
this.doubleClicked = false;
}
this.setCursor(startBracket, true);
}
} else if(this.doubleClicked) {
this.doubleClicked = false;
}
if(this.clickScrolling) {
this.clickScrolling = Mouse.isButtonDown(0);
startBracket = this.container.linesCount - this.container.visibleLines;
this.scrolledLine = Math.min(Math.max((int)(1.0F * (float)startBracket * (float)(yMouse - this.y) / (float)this.height), 0), startBracket);
}
startBracket = 0;
int endBracket = 0;
if(this.endSelection - this.startSelection == 1 || this.startSelection == this.endSelection && this.startSelection < this.text.length()) {
char list = this.text.charAt(this.startSelection);
int wordHightLight = 0;
if(list == 123) {
wordHightLight = this.findClosingBracket(this.text.substring(this.startSelection), '{', '}');
} else if(list == 91) {
wordHightLight = this.findClosingBracket(this.text.substring(this.startSelection), '[', ']');
} else if(list == 40) {
wordHightLight = this.findClosingBracket(this.text.substring(this.startSelection), '(', ')');
} else if(list == 125) {
wordHightLight = this.findOpeningBracket(this.text.substring(0, this.startSelection + 1), '{', '}');
} else if(list == 93) {
wordHightLight = this.findOpeningBracket(this.text.substring(0, this.startSelection + 1), '[', ']');
} else if(list == 41) {
wordHightLight = this.findOpeningBracket(this.text.substring(0, this.startSelection + 1), '(', ')');
}
if(wordHightLight != 0) {
startBracket = this.startSelection;
endBracket = this.startSelection + wordHightLight;
}
}
ArrayList var15 = new ArrayList(this.container.lines);
String var18 = null;
if(this.startSelection != this.endSelection) {
Matcher sbSize = this.container.regexWord.matcher(this.text);
while(sbSize.find()) {
if(sbSize.start() == this.startSelection && sbSize.end() == this.endSelection) {
var18 = this.text.substring(this.startSelection, this.endSelection);
}
}
}
int var16;
for(var16 = 0; var16 < var15.size(); ++var16) {
LineData posX = (LineData)var15.get(var16);
String posY = posX.text;
int w = posY.length();
int yPos;
int posX1;
int posY1;
if(startBracket != endBracket) {
if(startBracket >= posX.start && startBracket < posX.end) {
yPos = font.width(posY.substring(0, startBracket - posX.start));
posX1 = font.width(posY.substring(0, startBracket - posX.start + 1)) + 1;
posY1 = this.y + 1 + (var16 - this.scrolledLine) * this.container.lineHeight;
drawRect(this.x + 1 + yPos, posY1, this.x + 1 + posX1, posY1 + this.container.lineHeight + 1, -1728001024);
}
if(endBracket >= posX.start && endBracket < posX.end) {
yPos = font.width(posY.substring(0, endBracket - posX.start));
posX1 = font.width(posY.substring(0, endBracket - posX.start + 1)) + 1;
posY1 = this.y + 1 + (var16 - this.scrolledLine) * this.container.lineHeight;
drawRect(this.x + 1 + yPos, posY1, this.x + 1 + posX1, posY1 + this.container.lineHeight + 1, -1728001024);
}
}
if(var16 >= this.scrolledLine && var16 < this.scrolledLine + this.container.visibleLines) {
if(var18 != null) {
Matcher var20 = this.container.regexWord.matcher(posY);
while(var20.find()) {
if(posY.substring(var20.start(), var20.end()).equals(var18)) {
posX1 = font.width(posY.substring(0, var20.start()));
posY1 = font.width(posY.substring(0, var20.end())) + 1;
int posY2 = this.y + 1 + (var16 - this.scrolledLine) * this.container.lineHeight;
drawRect(this.x + 1 + posX1, posY2, this.x + 1 + posY1, posY2 + this.container.lineHeight + 1, -1728033792);
}
}
}
if(this.startSelection != this.endSelection && this.endSelection > posX.start && this.startSelection <= posX.end && this.startSelection < posX.end) {
yPos = font.width(posY.substring(0, Math.max(this.startSelection - posX.start, 0)));
posX1 = font.width(posY.substring(0, Math.min(this.endSelection - posX.start, w))) + 1;
posY1 = this.y + 1 + (var16 - this.scrolledLine) * this.container.lineHeight;
drawRect(this.x + 1 + yPos, posY1, this.x + 1 + posX1, posY1 + this.container.lineHeight + 1, -1728052993);
}
yPos = this.y + (var16 - this.scrolledLine) * this.container.lineHeight + 1;
font.draw(posX.getFormattedString(), (float)(this.x + 1), (float)yPos, -2039584);
if(this.active && this.isEnabled() && this.cursorCounter / 6 % 2 == 0 && this.cursorPosition >= posX.start && this.cursorPosition < posX.end) {
posX1 = this.x + font.width(posY.substring(0, this.cursorPosition - posX.start));
drawRect(posX1 + 1, yPos, posX1 + 2, yPos + 1 + this.container.lineHeight, -3092272);
}
}
}
if(this.hasVerticalScrollbar()) {
Minecraft.getMinecraft().renderEngine.bindTexture(GuiCustomScroll.resource);
var16 = Math.max((int)(1.0F * (float)this.container.visibleLines / (float)this.container.linesCount * (float)this.height), 2);
int var17 = this.x + this.width - 6;
int var19 = (int)((float)this.y + 1.0F * (float)this.scrolledLine / (float)this.container.linesCount * (float)(this.height - 4)) + 1;
drawRect(var17, var19, var17 + 5, var19 + var16, -2039584);
}
}
}
private int findClosingBracket(String str, char s, char e) {
int found = 0;
char[] chars = str.toCharArray();
for(int i = 0; i < chars.length; ++i) {
char c = chars[i];
if(c == s) {
++found;
} else if(c == e) {
--found;
if(found == 0) {
return i;
}
}
}
return 0;
}
private int findOpeningBracket(String str, char s, char e) {
int found = 0;
char[] chars = str.toCharArray();
for(int i = chars.length - 1; i >= 0; --i) {
char c = chars[i];
if(c == e) {
++found;
} else if(c == s) {
--found;
if(found == 0) {
return i - chars.length + 1;
}
}
}
return 0;
}
private int getSelectionPos(int xMouse, int yMouse) {
xMouse -= this.x + 1;
yMouse -= this.y + 1;
ArrayList list = new ArrayList(this.container.lines);
for(int i = 0; i < list.size(); ++i) {
LineData data = (LineData)list.get(i);
if(i >= this.scrolledLine && i < this.scrolledLine + this.container.visibleLines) {
int yPos = (i - this.scrolledLine) * this.container.lineHeight;
if(yMouse >= yPos && yMouse < yPos + this.container.lineHeight) {
int lineWidth = 0;
char[] chars = data.text.toCharArray();
for(int j = 1; j <= chars.length; ++j) {
int w = font.width(data.text.substring(0, j));
if(xMouse < lineWidth + (w - lineWidth) / 2) {
return data.start + j - 1;
}
lineWidth = w;
}
return data.end - 1;
}
}
}
return this.container.text.length();
}
public int getID() {
return this.id;
}
public void keyTyped(char c, int i) {
if(this.active && this.isEnabled()) {
if(i == 15) {
this.addText(" ");
}
if(i == 28) {
this.addText(Character.toString('\n') + this.getIndentCurrentLine());
}
if(ChatAllowedCharacters.isAllowedCharacter(c)) {
this.addText(Character.toString(c));
}
}
}
private String getIndentCurrentLine() {
Iterator var1 = this.container.lines.iterator();
LineData data;
do {
if(!var1.hasNext()) {
return "";
}
data = (LineData)var1.next();
} while(this.cursorPosition <= data.start || this.cursorPosition > data.end);
int i;
for(i = 0; i < data.text.length() && data.text.charAt(i) == 32; ++i) {
;
}
return data.text.substring(0, i);
}
private void setCursor(int i, boolean select) {
i = Math.min(Math.max(i, 0), this.text.length());
if(i != this.cursorPosition) {
if(!select) {
this.endSelection = this.startSelection = this.cursorPosition = i;
} else {
int diff = this.cursorPosition - i;
if(this.cursorPosition == this.startSelection) {
this.startSelection -= diff;
} else if(this.cursorPosition == this.endSelection) {
this.endSelection -= diff;
}
if(this.startSelection > this.endSelection) {
int j = this.endSelection;
this.endSelection = this.startSelection;
this.startSelection = j;
}
this.cursorPosition = i;
}
}
}
private void addText(String s) {
this.setText(this.getSelectionBeforeText() + s + this.getSelectionAfterText());
this.endSelection = this.startSelection = this.cursorPosition = this.startSelection + s.length();
}
private int cursorUp() {
for(int i = 0; i < this.container.lines.size(); ++i) {
LineData data = (LineData)this.container.lines.get(i);
if(this.cursorPosition >= data.start && this.cursorPosition < data.end) {
if(i == 0) {
return 0;
}
int var10000 = this.cursorPosition - data.start;
return this.getSelectionPos(this.x + 1 + font.width(data.text.substring(0, this.cursorPosition - data.start)), this.y + 1 + (i - 1 - this.scrolledLine) * this.container.lineHeight);
}
}
return 0;
}
private int cursorDown() {
for(int i = 0; i < this.container.lines.size(); ++i) {
LineData data = (LineData)this.container.lines.get(i);
if(this.cursorPosition >= data.start && this.cursorPosition < data.end) {
int var10000 = this.cursorPosition - data.start;
return this.getSelectionPos(this.x + 1 + font.width(data.text.substring(0, this.cursorPosition - data.start)), this.y + 1 + (i + 1 - this.scrolledLine) * this.container.lineHeight);
}
}
return this.text.length();
}
public String getSelectionBeforeText() {
return this.startSelection == 0?"":this.text.substring(0, this.startSelection);
}
public String getSelectionAfterText() {
return this.text.substring(this.endSelection);
}
public boolean mouseClicked(int xMouse, int yMouse, int mouseButton) {
this.active = xMouse >= this.x && xMouse < this.x + this.width && yMouse >= this.y && yMouse < this.y + this.height;
if(this.active) {
this.startSelection = this.endSelection = this.cursorPosition = this.getSelectionPos(xMouse, yMouse);
this.clicked = mouseButton == 0;
this.doubleClicked = false;
long time = System.currentTimeMillis();
if(this.clicked && this.container.linesCount * this.container.lineHeight > this.height && xMouse > this.x + this.width - 8) {
this.clicked = false;
this.clickScrolling = true;
} else if(time - this.lastClicked < 500L) {
this.doubleClicked = true;
Matcher m = this.container.regexWord.matcher(this.text);
while(m.find()) {
if(this.cursorPosition > m.start() && this.cursorPosition < m.end()) {
this.startSelection = m.start();
this.endSelection = m.end();
break;
}
}
}
this.lastClicked = time;
}
return this.active;
}
public void updateScreen() {
++this.cursorCounter;
int k2 = Mouse.getDWheel();
if(k2 != 0) {
this.scrolledLine += k2 > 0?-1:1;
this.scrolledLine = Math.max(Math.min(this.scrolledLine, this.container.linesCount - this.height / this.container.lineHeight), 0);
}
}
public void setText(String text) {
text = text.replace("\r", "");
if(this.text == null || !this.text.equals(text)) {
if(this.listener != null) {
this.listener.textUpdate(text);
}
if(!this.undoing) {
this.undoList.add(new GuiTextArea.UndoData(this.text, this.cursorPosition));
this.redoList.clear();
}
this.text = text;
this.container = new TextContainer(text);
this.container.init(font, this.width, this.height);
if(this.enableCodeHighlighting) {
this.container.formatCodeText();
}
if(this.scrolledLine > this.container.linesCount - this.container.visibleLines) {
this.scrolledLine = Math.max(0, this.container.linesCount - this.container.visibleLines);
}
}
}
public String getText() {
return this.text;
}
public boolean isEnabled() {
return this.enabled && this.visible;
}
public boolean hasVerticalScrollbar() {
return this.container.visibleLines < this.container.linesCount;
}
public void enableCodeHighlighting() {
this.enableCodeHighlighting = true;
this.container.formatCodeText();
}
public void setListener(ITextChangeListener listener) {
this.listener = listener;
}
public boolean isActive() {
return this.active;
}
static {
font = new TrueTypeFont(new Font("Arial Unicode MS", 0, CustomNpcs.FontSize), 1.0F);
}
class UndoData {
public String text;
public int cursorPosition;
public UndoData(String text, int cursorPosition) {
this.text = text;
this.cursorPosition = cursorPosition;
}
}
}
@@ -1,16 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs.client.gui.util;
public interface IGui {
int getID();
void drawScreen(int var1, int var2);
void updateScreen();
boolean isActive();
}
@@ -1,10 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs.client.gui.util;
public interface IKeyListener {
void keyTyped(char var1, int var2);
}
@@ -1,10 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs.client.gui.util;
public interface IMouseListener {
boolean mouseClicked(int var1, int var2, int var3);
}
@@ -1,10 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package noppes.npcs.client.gui.util;
public interface ITextChangeListener {
void textUpdate(String var1);
}
@@ -1,225 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs.client.gui.util;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import noppes.npcs.config.TrueTypeFont;
public class TextContainer {
private static final char colorChar = '\uffff';
private static final Comparator<TextContainer.MarkUp> MarkUpComparator = (o1, o2) -> {
return o1.start > o2.start?1:(o1.start < o2.start?-1:0);
};
public final Pattern regexString = Pattern.compile("([\"\'])(?:(?=(\\\\?))\\2.)*?\\1", 8);
public final Pattern regexFunction = Pattern.compile("\\b(if|else|switch|with|for|while|in|var|const|let|throw|then|function|continue|break|foreach|return|try|catch|finally|do|this|typeof|instanceof|new)(?=[^\\w])");
public final Pattern regexWord = Pattern.compile("[\\p{L}-]+|\\n|$");
public final Pattern regexNumber = Pattern.compile("\\b-?(?:0[xX][\\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?(?:[fFbBdDlLsS])?|NaN|null|Infinity|unidentified|true|false)\\b");
public final Pattern regexComment = Pattern.compile("\\/\\*[\\s\\S]*?(?:\\*\\/|$)|\\/\\/.*|#.*");
public String text;
public List<TextContainer.MarkUp> makeup = new ArrayList();
public List<TextContainer.LineData> lines = new ArrayList();
private TrueTypeFont font;
public int lineHeight;
public int totalHeight;
public int visibleLines = 1;
public int linesCount;
public TextContainer(String text) {
this.text = text;
text.replaceAll("\\r?\\n|\\r", "\n");
double l = 1.0D;
}
public void init(TrueTypeFont font, int width, int height) {
this.font = font;
this.lineHeight = font.height(this.text);
if(this.lineHeight == 0) {
this.lineHeight = 12;
}
String[] split = this.text.split("\n");
int totalChars = 0;
String[] var6 = split;
int var7 = split.length;
for(int var8 = 0; var8 < var7; ++var8) {
String l = var6[var8];
StringBuilder line = new StringBuilder();
Matcher m = this.regexWord.matcher(l);
for(int i = 0; m.find(); i = m.start()) {
String word = l.substring(i, m.start());
if(font.width(line + word) > width - 10) {
this.lines.add(new TextContainer.LineData(line.toString(), totalChars, totalChars + line.length()));
totalChars += line.length();
line = new StringBuilder();
}
line.append(word);
}
this.lines.add(new TextContainer.LineData(line.toString(), totalChars, totalChars + line.length() + 1));
totalChars += line.length() + 1;
}
this.linesCount = this.lines.size();
this.totalHeight = this.linesCount * this.lineHeight;
this.visibleLines = Math.max(height / this.lineHeight, 1);
}
public void formatCodeText() {
TextContainer.MarkUp markup = null;
for(int start = 0; (markup = this.getNextMatching(start)) != null; start = markup.end) {
this.makeup.add(markup);
}
}
private TextContainer.MarkUp getNextMatching(int start) {
TextContainer.MarkUp markup = null;
String s = this.text.substring(start);
Matcher matcher = this.regexNumber.matcher(s);
if(matcher.find()) {
markup = new TextContainer.MarkUp(matcher.start(), matcher.end(), '6', 0);
}
matcher = this.regexFunction.matcher(s);
TextContainer.MarkUp markup2;
if(matcher.find()) {
markup2 = new TextContainer.MarkUp(matcher.start(), matcher.end(), '2', 0);
if(this.compareMarkUps(markup, markup2)) {
markup = markup2;
}
}
matcher = this.regexString.matcher(s);
if(matcher.find()) {
markup2 = new TextContainer.MarkUp(matcher.start(), matcher.end(), '4', 7);
if(this.compareMarkUps(markup, markup2)) {
markup = markup2;
}
}
matcher = this.regexComment.matcher(s);
if(matcher.find()) {
markup2 = new TextContainer.MarkUp(matcher.start(), matcher.end(), '8', 7);
if(this.compareMarkUps(markup, markup2)) {
markup = markup2;
}
}
if(markup != null) {
markup.start += start;
markup.end += start;
}
return markup;
}
public boolean compareMarkUps(TextContainer.MarkUp mu1, TextContainer.MarkUp mu2) {
return mu1 == null?true:mu1.start > mu2.start;
}
public void addMakeUp(int start, int end, char c, int level) {
if(this.removeConflictingMarkUp(start, end, level)) {
this.makeup.add(new TextContainer.MarkUp(start, end, c, level));
}
}
private boolean removeConflictingMarkUp(int start, int end, int level) {
ArrayList conflicting = new ArrayList();
Iterator var5 = this.makeup.iterator();
while(true) {
TextContainer.MarkUp m;
do {
if(!var5.hasNext()) {
this.makeup.removeAll(conflicting);
return true;
}
m = (TextContainer.MarkUp)var5.next();
} while((start < m.start || start > m.end) && (end < m.start || end > m.end) && (start >= m.start || end <= m.start));
if(level < m.level || level == m.level && m.start <= start) {
return false;
}
conflicting.add(m);
}
}
public String getFormattedString() {
StringBuilder builder = new StringBuilder(this.text);
Iterator var2 = this.makeup.iterator();
while(var2.hasNext()) {
TextContainer.MarkUp entry = (TextContainer.MarkUp)var2.next();
builder.insert(entry.start, Character.toString('\uffff') + Character.toString(entry.c));
builder.insert(entry.end, Character.toString('\uffff') + Character.toString('r'));
}
return builder.toString();
}
class MarkUp {
public int start;
public int end;
public int level;
public char c;
public MarkUp(int start, int end, char c, int level) {
this.start = start;
this.end = end;
this.c = c;
this.level = level;
}
}
class LineData {
public String text;
public int start;
public int end;
public LineData(String text, int start, int end) {
this.text = text;
this.start = start;
this.end = end;
}
public String getFormattedString() {
StringBuilder builder = new StringBuilder(this.text);
int found = 0;
Iterator var3 = TextContainer.this.makeup.iterator();
while(var3.hasNext()) {
TextContainer.MarkUp entry = (TextContainer.MarkUp)var3.next();
if(entry.start >= this.start && entry.start < this.end) {
builder.insert(entry.start - this.start + found * 2, Character.toString('\uffff') + Character.toString(entry.c));
++found;
}
if(entry.start < this.start && entry.end > this.start) {
builder.insert(0, Character.toString('\uffff') + Character.toString(entry.c));
++found;
}
if(entry.end >= this.start && entry.end < this.end) {
builder.insert(entry.end - this.start + found * 2, Character.toString('\uffff') + Character.toString('r'));
++found;
}
}
return builder.toString();
}
}
}
@@ -8,15 +8,24 @@ import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import noppes.npcs.CustomItems;
import noppes.npcs.ModelPartConfig; import noppes.npcs.ModelPartConfig;
import noppes.npcs.ModelPartData; import noppes.npcs.ModelPartData;
import noppes.npcs.client.ClientProxy; import noppes.npcs.client.ClientProxy;
import noppes.npcs.client.model.animation.AniCrawling; import noppes.npcs.client.model.animation.AniCrawling;
import noppes.npcs.client.model.animation.AniHug; import noppes.npcs.client.model.animation.AniHug;
import noppes.npcs.client.model.part.*; import noppes.npcs.client.model.part.ModelBeard;
import noppes.npcs.client.model.part.ModelBreasts;
import noppes.npcs.client.model.part.ModelClaws;
import noppes.npcs.client.model.part.ModelEars;
import noppes.npcs.client.model.part.ModelFin;
import noppes.npcs.client.model.part.ModelHair;
import noppes.npcs.client.model.part.ModelHeadwear;
import noppes.npcs.client.model.part.ModelLegs;
import noppes.npcs.client.model.part.ModelMohawk;
import noppes.npcs.client.model.part.ModelSnout;
import noppes.npcs.client.model.part.ModelTail;
import noppes.npcs.client.model.part.ModelWings;
import noppes.npcs.client.model.util.ModelPartInterface; import noppes.npcs.client.model.util.ModelPartInterface;
import noppes.npcs.client.model.util.ModelScaleRenderer; import noppes.npcs.client.model.util.ModelScaleRenderer;
import noppes.npcs.constants.EnumAnimation; import noppes.npcs.constants.EnumAnimation;
@@ -35,26 +44,12 @@ public class ModelMPM extends ModelNPCMale{
private ModelPartInterface snout; private ModelPartInterface snout;
private ModelPartInterface ears; private ModelPartInterface ears;
private ModelPartInterface fin; private ModelPartInterface fin;
private ModelPartInterface skirt;
private ModelPartInterface horns;
private ModelPartInterface clawsR; private ModelPartInterface clawsR;
private ModelPartInterface clawsL; private ModelPartInterface clawsL;
// New
public ModelRenderer bipedBodywear;
public ModelRenderer bipedRightArmwear;
public ModelRenderer bipedLeftArmwear;
public ModelRenderer bipedRightLegWear;
public ModelRenderer bipedLeftLegWear;
private ModelLegs legs; private ModelLegs legs;
private ModelScaleRenderer headwear; private ModelScaleRenderer headwear;
// private ModelScaleRenderer bodywear;
// private ModelScaleRenderer armwear;
// private ModelScaleRenderer legwear;
private ModelTail tail; private ModelTail tail;
public ModelBase entityModel; public ModelBase entityModel;
public EntityLivingBase entity; public EntityLivingBase entity;
@@ -62,214 +57,75 @@ public class ModelMPM extends ModelNPCMale{
public boolean currentlyPlayerTexture; public boolean currentlyPlayerTexture;
public boolean isArmor; public boolean isArmor;
public float alpha = 1; public float alpha = 1;
// Check Legacy Code for Old Version
// Updated False = 64x32 Skin
// Steve 64x64 and Alex 64x64
public ModelMPM(float par1, boolean arms) {
super(par1, arms);
isArmor = par1 > 0;
float par2 = 0;
this.bipedCloak = new ModelRenderer(this, 0, 0);
this.bipedCloak.setTextureSize(64,32);
this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, par1);
this.bipedEars = new ModelRenderer(this, 24, 0);
this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, par1);
this.bipedHead = (new ModelScaleRenderer(this, 0, 0));
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1);
this.bipedHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedHeadwear = (new ModelScaleRenderer(this, 32, 0));
this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F);
this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedBody = (new ModelScaleRenderer(this, 16, 16));
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1);
this.bipedBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
// New Extension
this.bipedBodywear = (new ModelScaleRenderer(this, 16, 32));
this.bipedBodywear.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1 + 0.5F);
this.bipedBody.addChild(this.bipedBodywear);
// this.bipedBodywear.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
// Steve 64x64 Model or Alex 64x64 Model
if (arms){
// Alex Version
this.bipedRightArm = (new ModelScaleRenderer(this, 40, 16));
this.bipedRightArm.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, par1);
// this.bipedRightArm.setRotationPoint(-5.0F, 2.5F + par2, 0.0F);
this.bipedLeftArm = new ModelScaleRenderer(this, 32, 48);
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, par1);
this.bipedLeftArm.setRotationPoint(5.0F, 2.5F + par2, 0.0F);
this.bipedRightArmwear = (new ModelScaleRenderer(this, 40, 32));
this.bipedRightArmwear.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, par1 + 0.25F);
this.bipedRightArm.addChild(this.bipedRightArmwear);
// this.bipedRightArmWear.setRotationPoint(-5.0F, 2.5F + par2, 0.0F);
this.bipedLeftArmwear = new ModelScaleRenderer(this, 48, 48);
this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, par1 + 0.25F);
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
// this.bipedLeftArmWear.setRotationPoint(5.0F, 2.5F + par2, 0.0F);
}
else{
// Steve Version
this.bipedRightArm = (new ModelScaleRenderer(this, 40, 16));
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F);
this.bipedLeftArm = new ModelScaleRenderer(this, 32, 48);
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
this.bipedRightArmwear = (new ModelScaleRenderer(this, 40, 32));
this.bipedRightArmwear.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
this.bipedRightArm.addChild(this.bipedRightArmwear);
//this.bipedRightArmWear.setRotationPoint(-5.0F, 2.0F + par2, 0.0F);
this.bipedLeftArmwear = new ModelScaleRenderer(this, 48, 48);
this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
//this.bipedLeftArmWear.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
}
this.bipedRightLeg = (new ModelScaleRenderer(this, 0, 16));
this.bipedRightLeg.addBox(-2.08F, 0.0F, -2.0F, 4, 12, 4, par1);
this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + par2, 0.0F);
this.bipedLeftLeg = new ModelScaleRenderer(this, 16, 48);
this.bipedLeftLeg.addBox(-1.92F, 0.0F, -2.0F, 4, 12, 4, par1);
this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + par2, 0.0F);
this.bipedRightLegWear = (new ModelScaleRenderer(this, 0, 32));
this.bipedRightLegWear.addBox(-2.08F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
this.bipedRightLeg.addChild(this.bipedRightLegWear);
// this.bipedRightLegWear.setRotationPoint(-1.9F, 12.0F + par2, 0.0F);
this.bipedLeftLegWear = new ModelScaleRenderer(this, 0, 48);
this.bipedLeftLegWear.addBox(-1.92F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
this.bipedLeftLeg.addChild(this.bipedLeftLegWear);
headwear = new ModelHeadwear(this);
legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg, 64, 64);
// bodywear = new ModelBodywear(this);
this.bipedBody.addChild(breasts = new ModelBreasts(this, 64, 64));
if(!isArmor){
this.bipedHead.addChild(ears = new ModelEars(this));
this.bipedHead.addChild(mohawk = new ModelMohawk(this));
this.bipedHead.addChild(hair = new ModelHair(this));
this.bipedHead.addChild(beard = new ModelBeard(this));
// Completed
this.bipedHead.addChild(snout = new ModelSnout(this));
this.bipedHead.addChild(horns = new ModelHorns(this));
// Completed
tail = new ModelTail(this);
this.bipedBody.addChild(wings = new ModelWings(this));
this.bipedBody.addChild(fin = new ModelFin(this));
// Fix This
this.bipedBody.addChild(skirt = new ModelSkirt(this));
this.bipedLeftArm.addChild(clawsL = new ModelClaws(this, false));
this.bipedRightArm.addChild(clawsR = new ModelClaws(this, true));
}
}
// Steve 64x32
public ModelMPM(float par1) { public ModelMPM(float par1) {
super(par1); super(par1);
isArmor = par1 > 0; isArmor = par1 > 0;
float par2 = 0; float par2 = 0;
this.bipedCloak = new ModelRenderer(this, 0, 0);
this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, par1);
this.bipedEars = new ModelRenderer(this, 24, 0);
this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, par1);
this.bipedHead = new ModelScaleRenderer(this, 0, 0);
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1);
this.bipedHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedHeadwear = new ModelScaleRenderer(this, 32, 0);
this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F);
this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedBody = new ModelScaleRenderer(this, 16, 16);
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1);
this.bipedBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedRightArm = new ModelScaleRenderer(this, 40, 16);
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F);
this.bipedLeftArm = new ModelScaleRenderer(this, 40, 16);
this.bipedLeftArm.mirror = true;
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
this.bipedRightLeg = new ModelScaleRenderer(this, 0, 16);
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + par2, 0.0F);
this.bipedLeftLeg = new ModelScaleRenderer(this, 0, 16);
this.bipedLeftLeg.mirror = true;
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + par2, 0.0F);
this.bipedCloak = new ModelRenderer(this, 0, 0); headwear = new ModelHeadwear(this);
this.bipedCloak.setTextureSize(64,32); legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg);
this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, par1);
this.bipedEars = new ModelRenderer(this, 24, 0); breasts = new ModelBreasts(this);
this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, par1); this.bipedBody.addChild(breasts);
this.bipedHead = (new ModelScaleRenderer(this, 0, 0));
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1);
this.bipedHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedHeadwear = (new ModelScaleRenderer(this, 32, 0));
this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F);
this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedBody = (new ModelScaleRenderer(this, 16, 16));
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1);
this.bipedBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
this.bipedRightArm = new ModelScaleRenderer(this, 40, 16);
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F);
this.bipedLeftArm = new ModelScaleRenderer(this, 40, 16);
this.bipedLeftArm.mirror = true;
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
this.bipedRightLeg = new ModelScaleRenderer(this, 0, 16);
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + par2, 0.0F);
this.bipedLeftLeg = new ModelScaleRenderer(this, 0, 16);
this.bipedLeftLeg.mirror = true;
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + par2, 0.0F);
// Body
this.bipedBodywear = (new ModelScaleRenderer(this, 0, 0));
this.bipedBody.addChild(this.bipedBodywear);
// Arms
this.bipedRightArmwear = (new ModelScaleRenderer(this, 0, 0));
this.bipedRightArm.addChild(this.bipedRightArmwear);
this.bipedLeftArmwear = new ModelScaleRenderer(this, 0, 0);
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
// Legs
this.bipedRightLegWear = (new ModelScaleRenderer(this, 0, 0));
this.bipedRightLeg.addChild(this.bipedRightLegWear);
this.bipedLeftLegWear = new ModelScaleRenderer(this, 0, 0);
this.bipedLeftLeg.addChild(this.bipedLeftLegWear);
headwear = new ModelHeadwear(this, true);
legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg, 64, 32);
this.bipedBody.addChild(breasts = new ModelBreasts(this, 64, 32));
if(!isArmor){ if(!isArmor){
this.bipedHead.addChild(ears = new ModelEars(this)); ears = new ModelEars(this);
this.bipedHead.addChild(mohawk = new ModelMohawk(this)); this.bipedHead.addChild(ears);
this.bipedHead.addChild(hair = new ModelHair(this));
this.bipedHead.addChild(beard = new ModelBeard(this));
// Completed mohawk = new ModelMohawk(this);
this.bipedHead.addChild(snout = new ModelSnout(this)); this.bipedHead.addChild(mohawk);
this.bipedHead.addChild(horns = new ModelHorns(this));
hair = new ModelHair(this);
this.bipedHead.addChild(hair);
beard = new ModelBeard(this);
this.bipedHead.addChild(beard);
snout = new ModelSnout(this);
this.bipedHead.addChild(snout);
// Completed
tail = new ModelTail(this); tail = new ModelTail(this);
this.bipedBody.addChild(wings = new ModelWings(this)); wings = new ModelWings(this);
this.bipedBody.addChild(fin = new ModelFin(this)); this.bipedBody.addChild(wings);
// Fix This fin = new ModelFin(this);
this.bipedBody.addChild(skirt = new ModelSkirt(this)); this.bipedBody.addChild(fin);
this.bipedLeftArm.addChild(clawsL = new ModelClaws(this, false));
this.bipedRightArm.addChild(clawsR = new ModelClaws(this, true)); clawsL = new ModelClaws(this, false);
this.bipedLeftArm.addChild(clawsL);
clawsR = new ModelClaws(this, true);
this.bipedRightArm.addChild(clawsR);
} }
} }
@@ -285,20 +141,15 @@ public class ModelMPM extends ModelNPCMale{
ears.setData(entity.modelData, entity); ears.setData(entity.modelData, entity);
clawsL.setData(entity.modelData, entity); clawsL.setData(entity.modelData, entity);
clawsR.setData(entity.modelData, entity); clawsR.setData(entity.modelData, entity);
skirt.setData(entity.modelData, entity);
horns.setData(entity.modelData, entity);
} }
breasts.setData(entity.modelData, entity); breasts.setData(entity.modelData, entity);
legs.setData(entity); legs.setData(entity);
} }
@Override @Override
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7){ public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7){
EntityCustomNpc npc = (EntityCustomNpc) par1Entity; EntityCustomNpc npc = (EntityCustomNpc) par1Entity;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if(npc.scriptInvisibleToPlayer(Minecraft.getMinecraft().thePlayer) && (player.getHeldItem() == null || player.getHeldItem().getItem() != CustomItems.wand))
return;
if(entityModel != null){ if(entityModel != null){
if(!isArmor){ if(!isArmor){
@@ -316,172 +167,150 @@ public class ModelMPM extends ModelNPCMale{
} }
} }
else{ else{
alpha = npc.isInvisible() && !npc.isInvisibleToPlayer(player) ? 0.15f : 1; alpha = npc.isInvisible() && !npc.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer)?0.15f:1;
setPlayerData(npc);
currentlyPlayerTexture = true;
setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
if(npc.advanced.job == EnumJobType.Puppet){
JobPuppet job = (JobPuppet) npc.jobInterface;
if(job.isActive()){
float pi = (float) Math.PI;
setPlayerData(npc); if(!job.head.disabled){
currentlyPlayerTexture = true; bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = job.head.rotationX * pi;
setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY = job.head.rotationY * pi;
if(npc.advanced.job == EnumJobType.Puppet){ bipedHeadwear.rotateAngleZ = bipedHead.rotateAngleZ = job.head.rotationZ * pi;
JobPuppet job = (JobPuppet) npc.jobInterface; }
if(job.isActive()){
float pi = (float) Math.PI;
if(!job.head.disabled){ if(!job.body.disabled){
bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = job.head.rotationX * pi; bipedBody.rotateAngleX = job.body.rotationX * pi;
bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY = job.head.rotationY * pi; bipedBody.rotateAngleY = job.body.rotationY * pi;
bipedHeadwear.rotateAngleZ = bipedHead.rotateAngleZ = job.head.rotationZ * pi; bipedBody.rotateAngleZ = job.body.rotationZ * pi;
} }
if(!job.body.disabled){ if(!job.larm.disabled){
bipedBody.rotateAngleX = job.body.rotationX * pi; bipedLeftArm.rotateAngleX = job.larm.rotationX * pi;
bipedBody.rotateAngleY = job.body.rotationY * pi; bipedLeftArm.rotateAngleY = job.larm.rotationY * pi;
bipedBody.rotateAngleZ = job.body.rotationZ * pi; bipedLeftArm.rotateAngleZ = job.larm.rotationZ * pi;
}
if(!job.larm.disabled){ if(!npc.display.disableLivingAnimation){
bipedLeftArm.rotateAngleX = job.larm.rotationX * pi; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
bipedLeftArm.rotateAngleY = job.larm.rotationY * pi; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F;
bipedLeftArm.rotateAngleZ = job.larm.rotationZ * pi; }
}
if(!npc.display.disableLivingAnimation){ if(!job.rarm.disabled){
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; bipedRightArm.rotateAngleX = job.rarm.rotationX * pi;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; bipedRightArm.rotateAngleY = job.rarm.rotationY * pi;
} bipedRightArm.rotateAngleZ = job.rarm.rotationZ * pi;
}
if(!job.rarm.disabled){ if(!npc.display.disableLivingAnimation){
bipedRightArm.rotateAngleX = job.rarm.rotationX * pi; this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
bipedRightArm.rotateAngleY = job.rarm.rotationY * pi; this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F;
bipedRightArm.rotateAngleZ = job.rarm.rotationZ * pi; }
}
if(!npc.display.disableLivingAnimation){ if(!job.rleg.disabled){
this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; bipedRightLeg.rotateAngleX = job.rleg.rotationX * pi;
this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; bipedRightLeg.rotateAngleY = job.rleg.rotationY * pi;
} bipedRightLeg.rotateAngleZ = job.rleg.rotationZ * pi;
} }
if(!job.rleg.disabled){ if(!job.lleg.disabled){
bipedRightLeg.rotateAngleX = job.rleg.rotationX * pi; bipedLeftLeg.rotateAngleX = job.lleg.rotationX * pi;
bipedRightLeg.rotateAngleY = job.rleg.rotationY * pi; bipedLeftLeg.rotateAngleY = job.lleg.rotationY * pi;
bipedRightLeg.rotateAngleZ = job.rleg.rotationZ * pi; bipedLeftLeg.rotateAngleZ = job.lleg.rotationZ * pi;
} }
}
if(!job.lleg.disabled){ }
bipedLeftLeg.rotateAngleX = job.lleg.rotationX * pi; renderHead(npc, par7);
bipedLeftLeg.rotateAngleY = job.lleg.rotationY * pi; renderArms(npc, par7,false);
bipedLeftLeg.rotateAngleZ = job.lleg.rotationZ * pi; renderBody(npc, par7);
} renderLegs(npc, par7);
}
}
renderHead(npc, par7);
renderArms(npc, par7,false);
renderBody(npc, par7);
renderLegs(npc, par7);
} }
} }
@Override @Override
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity)
{ {
EntityCustomNpc npc = (EntityCustomNpc) entity; EntityCustomNpc npc = (EntityCustomNpc) entity;
isRiding = npc.isRiding(); isRiding = npc.isRiding();
if(isSneak && (npc.currentAnimation == EnumAnimation.CRAWLING || npc.currentAnimation == EnumAnimation.LYING)) if(isSneak && (npc.currentAnimation == EnumAnimation.CRAWLING || npc.currentAnimation == EnumAnimation.LYING))
isSneak = false; isSneak = false;
this.bipedBody.rotationPointX = 0;
// Body Rotations this.bipedBody.rotationPointY = 0;
this.bipedBody.rotationPointX = 0; this.bipedBody.rotationPointZ = 0;
this.bipedBody.rotationPointY = 0;
this.bipedBody.rotationPointZ = 0;
this.bipedBody.rotateAngleX = 0; this.bipedBody.rotateAngleX = 0;
this.bipedBody.rotateAngleY = 0; this.bipedBody.rotateAngleY = 0;
this.bipedBody.rotateAngleZ = 0; this.bipedBody.rotateAngleZ = 0;
this.bipedBodywear.rotationPointX = 0;
this.bipedBodywear.rotationPointY = 0;
this.bipedBodywear.rotationPointZ = 0;
this.bipedBodywear.rotateAngleX = 0;
this.bipedBodywear.rotateAngleY = 0;
this.bipedBodywear.rotateAngleZ = 0;
// Head Rotations
this.bipedHead.rotateAngleZ = 0; this.bipedHead.rotateAngleZ = 0;
this.bipedHeadwear.rotateAngleZ = 0; this.bipedHeadwear.rotateAngleZ = 0;
// Leg Rotations
this.bipedLeftLeg.rotateAngleX = 0; this.bipedLeftLeg.rotateAngleX = 0;
this.bipedLeftLeg.rotateAngleY = 0; this.bipedLeftLeg.rotateAngleY = 0;
this.bipedLeftLeg.rotateAngleZ = 0; this.bipedLeftLeg.rotateAngleZ = 0;
this.bipedRightLeg.rotateAngleX = 0; this.bipedRightLeg.rotateAngleX = 0;
this.bipedRightLeg.rotateAngleY = 0; this.bipedRightLeg.rotateAngleY = 0;
this.bipedRightLeg.rotateAngleZ = 0; this.bipedRightLeg.rotateAngleZ = 0;
// Arm Rotations
this.bipedLeftArm.rotationPointY = 2; this.bipedLeftArm.rotationPointY = 2;
this.bipedLeftArm.rotationPointZ = 0; this.bipedLeftArm.rotationPointZ = 0;
this.bipedRightArm.rotationPointY = 2; this.bipedRightArm.rotationPointY = 2;
this.bipedRightArm.rotationPointZ = 0; this.bipedRightArm.rotationPointZ = 0;
super.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); super.setRotationAngles(par1, par2, par3, par4, par5, par6, entity);
if(!isArmor){ if(!isArmor){
hair.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); hair.setRotationAngles(par1, par2, par3, par4, par5, par6, entity);
beard.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); beard.setRotationAngles(par1, par2, par3, par4, par5, par6, entity);
wings.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); wings.setRotationAngles(par1, par2, par3, par4, par5, par6, entity);
tail.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); tail.setRotationAngles(par1, par2, par3, par4, par5, par6, entity);
skirt.setRotationAngles(par1, par2, par3, par4, par5, par6, entity);
} }
legs.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); legs.setRotationAngles(par1, par2, par3, par4, par5, par6, entity);
if(isSleeping(entity)){ if(isSleeping(entity)){
if(bipedHead.rotateAngleX < 0){ if(bipedHead.rotateAngleX < 0){
bipedHead.rotateAngleX = 0; bipedHead.rotateAngleX = 0;
bipedHeadwear.rotateAngleX = 0; bipedHeadwear.rotateAngleX = 0;
} }
} }
else if(npc.currentAnimation == EnumAnimation.CRY) else if(npc.currentAnimation == EnumAnimation.CRY)
bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = 0.7f; bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = 0.7f;
else if(npc.currentAnimation == EnumAnimation.HUG){
AniHug.setRotationAngles(par1, par2, par3, par4, par5, par6, entity, this);
}
else if(npc.currentAnimation == EnumAnimation.CRAWLING)
AniCrawling.setRotationAngles(par1, par2, par3, par4, par5, par6, entity, this);
else if(npc.currentAnimation == EnumAnimation.WAVING){
bipedRightArm.rotateAngleX = -0.1f;
bipedRightArm.rotateAngleY = 0;
bipedRightArm.rotateAngleZ = (float) (Math.PI - 1f - Math.sin(entity.ticksExisted * 0.27f) * 0.5f );
}
else if(isSneak)
this.bipedBody.rotateAngleX = 0.5F / npc.modelData.body.scaleY;
else if(npc.currentAnimation == EnumAnimation.HUG){
AniHug.setRotationAngles(par1, par2, par3, par4, par5, par6, entity, this);
}
else if(npc.currentAnimation == EnumAnimation.CRAWLING) }
AniCrawling.setRotationAngles(par1, par2, par3, par4, par5, par6, entity, this);
else if(npc.currentAnimation == EnumAnimation.WAVING){ public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
bipedRightArm.rotateAngleX = -0.1f; {
bipedRightArm.rotateAngleY = 0;
bipedRightArm.rotateAngleZ = (float) (Math.PI - 1f - Math.sin(entity.ticksExisted * 0.27f) * 0.5f );
}
else if(isSneak){
this.bipedBody.rotateAngleX = 0.5F / npc.modelData.body.scaleY;
}
}
public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
{
if(entityModel != null){ if(entityModel != null){
entityModel.setLivingAnimations(entity, par2, par3, par4); entityModel.setLivingAnimations(entity, par2, par3, par4);
} }
else{ else{
EntityCustomNpc npc = (EntityCustomNpc) par1EntityLivingBase; EntityCustomNpc npc = (EntityCustomNpc) par1EntityLivingBase;
if(!isArmor){ if(!isArmor){
ModelPartData partData = npc.modelData.getPartData("tail"); ModelPartData partData = npc.modelData.getPartData("tail");
if(partData != null) if(partData != null)
tail.setLivingAnimations(partData, par1EntityLivingBase, par2, par3, par4); tail.setLivingAnimations(partData, par1EntityLivingBase, par2, par3, par4);
} }
} }
} }
public void loadPlayerTexture(EntityCustomNpc npc){ public void loadPlayerTexture(EntityCustomNpc npc){
if(!isArmor && !currentlyPlayerTexture){ if(!isArmor && !currentlyPlayerTexture){
ClientProxy.bindTexture(npc.textureLocation); ClientProxy.bindTexture(npc.textureLocation);
currentlyPlayerTexture = true; currentlyPlayerTexture = true;
} }
} }
private void renderHead(EntityCustomNpc entity, float f) { private void renderHead(EntityCustomNpc entity, float f) {
loadPlayerTexture(entity); loadPlayerTexture(entity);
@@ -490,15 +319,11 @@ public class ModelMPM extends ModelNPCMale{
float z = 0; float z = 0;
GL11.glPushMatrix(); GL11.glPushMatrix();
if(entity.currentAnimation == EnumAnimation.DANCING){ if(entity.currentAnimation == EnumAnimation.DANCING){
float dancing = entity.ticksExisted / 4f; float dancing = entity.ticksExisted / 4f;
GL11.glTranslatef((float)Math.sin(dancing) * 0.075F, (float)Math.abs(Math.cos(dancing)) * 0.125F - 0.02F, (float)(-Math.abs(Math.cos(dancing))) * 0.075F); GL11.glTranslatef((float)Math.sin(dancing) * 0.075F, (float)Math.abs(Math.cos(dancing)) * 0.125F - 0.02F, (float)(-Math.abs(Math.cos(dancing))) * 0.075F);
} }
ModelPartConfig head = entity.modelData.head; ModelPartConfig head = entity.modelData.head;
// Hide Head
((ModelScaleRenderer)this.bipedHead).isHidden = entity.modelData.hideHead == 1;
if(bipedHeadwear.showModel && !bipedHeadwear.isHidden){ if(bipedHeadwear.showModel && !bipedHeadwear.isHidden){
if(entity.modelData.headwear == 1 || isArmor){ if(entity.modelData.headwear == 1 || isArmor){
((ModelScaleRenderer)this.bipedHeadwear).setConfig(head,x,y,z); ((ModelScaleRenderer)this.bipedHeadwear).setConfig(head,x,y,z);
@@ -528,19 +353,12 @@ public class ModelMPM extends ModelNPCMale{
float z = 0; float z = 0;
GL11.glPushMatrix(); GL11.glPushMatrix();
if(entity.currentAnimation == EnumAnimation.DANCING){ if(entity.currentAnimation == EnumAnimation.DANCING){
float dancing = entity.ticksExisted / 4f; float dancing = entity.ticksExisted / 4f;
GL11.glTranslatef((float)Math.sin(dancing) * 0.015F, 0.0F, 0.0F); GL11.glTranslatef((float)Math.sin(dancing) * 0.015F, 0.0F, 0.0F);
} }
ModelPartConfig body = entity.modelData.body; ModelPartConfig body = entity.modelData.body;
// Hide Body
((ModelScaleRenderer)this.bipedBody).isHidden = entity.modelData.hideBody == 1;
// Hide Bodywear
((ModelScaleRenderer)this.bipedBodywear).isHidden = entity.modelData.bodywear != 1;
((ModelScaleRenderer)this.bipedBody).setConfig(body,x,y,z); ((ModelScaleRenderer)this.bipedBody).setConfig(body,x,y,z);
((ModelScaleRenderer)this.bipedBody).render(f); ((ModelScaleRenderer)this.bipedBody).render(f);
GL11.glPopMatrix(); GL11.glPopMatrix();
@@ -556,46 +374,10 @@ public class ModelMPM extends ModelNPCMale{
GL11.glPushMatrix(); GL11.glPushMatrix();
if(entity.currentAnimation == EnumAnimation.DANCING){ if(entity.currentAnimation == EnumAnimation.DANCING){
float dancing = entity.ticksExisted / 4f; float dancing = entity.ticksExisted / 4f;
GL11.glTranslatef((float)Math.sin(dancing) * 0.025F, (float)Math.abs(Math.cos(dancing)) * 0.125F - 0.02F, 0.0F); GL11.glTranslatef((float)Math.sin(dancing) * 0.025F, (float)Math.abs(Math.cos(dancing)) * 0.125F - 0.02F, 0.0F);
} }
// Hide Arms
if(entity.modelData.hideArms == 1){
((ModelScaleRenderer)this.bipedRightArm).isHidden = true;
((ModelScaleRenderer)this.bipedLeftArm).isHidden = true;
}
else if(entity.modelData.hideArms == 2){
((ModelScaleRenderer)this.bipedRightArm).isHidden = true;
((ModelScaleRenderer)this.bipedLeftArm).isHidden = false;
}
else if(entity.modelData.hideArms == 3){
((ModelScaleRenderer)this.bipedRightArm).isHidden = false;
((ModelScaleRenderer)this.bipedLeftArm).isHidden = true;
}
else{
((ModelScaleRenderer)this.bipedRightArm).isHidden = false;
((ModelScaleRenderer)this.bipedLeftArm).isHidden = false;
}
// Hide Armwear
if(entity.modelData.armwear == 1){
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = false;
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = false;
}
else if(entity.modelData.armwear == 2){
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = true;
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = false;
}
else if(entity.modelData.armwear == 3){
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = false;
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = true;
}
else{
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = true;
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = true;
}
if(!bo){ if(!bo){
((ModelScaleRenderer)this.bipedLeftArm).setConfig(arms,-x,y,z); ((ModelScaleRenderer)this.bipedLeftArm).setConfig(arms,-x,y,z);
@@ -619,44 +401,6 @@ public class ModelMPM extends ModelNPCMale{
float z = 0; float z = 0;
GL11.glPushMatrix(); GL11.glPushMatrix();
// Hide Legs
if(entity.modelData.hideLegs == 1){
((ModelScaleRenderer)this.bipedRightLeg).isHidden = true;
((ModelScaleRenderer)this.bipedLeftLeg).isHidden = true;
}
else if(entity.modelData.hideLegs == 2){
((ModelScaleRenderer)this.bipedRightLeg).isHidden = true;
((ModelScaleRenderer)this.bipedLeftLeg).isHidden = false;
}
else if(entity.modelData.hideLegs == 3){
((ModelScaleRenderer)this.bipedRightLeg).isHidden = false;
((ModelScaleRenderer)this.bipedLeftLeg).isHidden = true;
}
else{
((ModelScaleRenderer)this.bipedRightLeg).isHidden = false;
((ModelScaleRenderer)this.bipedLeftLeg).isHidden = false;
}
// Hide Legwear
if(entity.modelData.legwear == 1){
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = false;
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = false;
}
else if(entity.modelData.legwear == 2){
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = true;
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = false;
}
else if(entity.modelData.legwear == 3){
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = false;
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = true;
}
else{
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = true;
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = true;
}
this.legs.setConfig(legs,x,y,z); this.legs.setConfig(legs,x,y,z);
this.legs.render(f); this.legs.render(f);
if(!isArmor){ if(!isArmor){
@@ -666,22 +410,22 @@ public class ModelMPM extends ModelNPCMale{
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
@Override @Override
public ModelRenderer getRandomModelBox(Random par1Random) public ModelRenderer getRandomModelBox(Random par1Random)
{ {
int random = par1Random.nextInt(5); int random = par1Random.nextInt(5);
switch(random){ switch(random){
case 0: case 0:
return bipedRightLeg; return bipedRightLeg;
case 1: case 1:
return bipedHead; return bipedHead;
case 2: case 2:
return bipedLeftArm; return bipedLeftArm;
case 3: case 3:
return bipedRightArm; return bipedRightArm;
case 4: case 4:
return bipedLeftLeg; return bipedLeftLeg;
} }
return bipedBody; return bipedBody;
} }
} }
@@ -8,7 +8,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import noppes.npcs.CustomNpcs; import noppes.npcs.CustomNpcs;
import noppes.npcs.client.model.util.ModelScaleRenderer;
import noppes.npcs.constants.EnumAnimation; import noppes.npcs.constants.EnumAnimation;
import noppes.npcs.entity.EntityNPCInterface; import noppes.npcs.entity.EntityNPCInterface;
@@ -22,95 +21,21 @@ public class ModelNPCMale extends ModelBiped
public float animationTick; public float animationTick;
public float dancingTicks; public float dancingTicks;
public ModelNPCMale(float f) public ModelNPCMale(float f)
{ {
init(f, 0.0F); init(f, 0.0F);
} }
public ModelNPCMale(float f, boolean arms)
{
super(f, 0.0F, 64, 64);
init(f, 0.0F, arms);
}
@Override @Override
public void setLivingAnimations(EntityLivingBase par1EntityLiving, float f6, float f5, float par9){ public void setLivingAnimations(EntityLivingBase par1EntityLiving, float f6, float f5, float par9){
animationTick += par9; animationTick += par9;
dancingTicks = CustomNpcs.ticks / 3.978873F; dancingTicks = CustomNpcs.ticks / 3.978873F;
} }
// 64x64 Skin
public void init(float f, float f1, boolean arms)
{
heldItemLeft = 0;
heldItemRight = 0;
isSneak = false;
aimedBow = false;
// Changed
bipedCloak = new ModelRenderer(this, 0, 0);
bipedCloak.setTextureSize(64, 32);
bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, f);
// Same
bipedEars = new ModelRenderer(this, 24, 0);
bipedEars.setTextureSize(64, 32); // NEW LINE
bipedEars.addBox(-3F, -6F, -1F, 6, 6, 1, f);
bipedHead = new ModelRenderer(this, 0, 0);
bipedHead.addBox(-4F, -8F, -4F, 8, 8, 8, f);
bipedHead.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
bipedHeadwear = new ModelRenderer(this, 32, 0);
bipedHeadwear.addBox(-4F, -8F, -4F, 8, 8, 8, f + 0.5F);
bipedHeadwear.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
bipedBody = new ModelRenderer(this, 16, 16);
bipedBody.addBox(-4F, 0.0F, -2F, 8, 12, 4, f);
bipedBody.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
if (arms){
// Alex Version
bipedRightArm = (new ModelScaleRenderer(this, 40, 16));
bipedRightArm.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, f);
bipedRightArm.setRotationPoint(-5.0F, 2.5F + f1, 0.0F);
bipedLeftArm = new ModelScaleRenderer(this, 32, 48);
bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, f);
bipedLeftArm.setRotationPoint(5.0F, 2.5F + f1, 0.0F);
}
else{
// Steve Version
bipedRightArm = new ModelRenderer(this, 40, 16);
bipedRightArm.addBox(-3F, -2F, -2F, 4, 12, 4, f);
bipedRightArm.setRotationPoint(-5F, 2.0F + f1, 0.0F);
bipedLeftArm = new ModelRenderer(this, 32, 48);
bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, f);
bipedLeftArm.setRotationPoint(5.0F, 2.0F + f1, 0.0F);
}
bipedRightLeg = new ModelRenderer(this, 0, 16);
bipedRightLeg.addBox(-2F, 0.0F, -2F, 4, 12, 4, f);
bipedRightLeg.setRotationPoint(-2F, 12F + f1, 0.0F);
bipedLeftLeg = new ModelRenderer(this, 16, 48);
bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, f);
bipedLeftLeg.setRotationPoint(1.9F, 12.0F + f1, 0.0F);
}
// 64x32
public void init(float f, float f1) public void init(float f, float f1)
{ {
heldItemLeft = 0; heldItemLeft = 0;
heldItemRight = 0; heldItemRight = 0;
isSneak = false; isSneak = false;
aimedBow = false; aimedBow = false;
bipedCloak = new ModelRenderer(this, 0, 0); bipedCloak = new ModelRenderer(this, 0, 0);
bipedCloak.textureHeight = 32; bipedCloak.textureHeight = 32;
bipedCloak.addBox(-5F, 0.0F, -1F, 10, 16, 1, f); bipedCloak.addBox(-5F, 0.0F, -1F, 10, 16, 1, f);
@@ -145,78 +70,75 @@ public class ModelNPCMale extends ModelBiped
} }
@Override @Override
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7){ public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7){
setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
if(!isDancing){ if(!isDancing){
bipedHead.render(par7); bipedHead.render(par7);
bipedBody.render(par7); bipedBody.render(par7);
bipedRightArm.render(par7); bipedRightArm.render(par7);
bipedLeftArm.render(par7); bipedLeftArm.render(par7);
bipedRightLeg.render(par7); bipedRightLeg.render(par7);
bipedLeftLeg.render(par7); bipedLeftLeg.render(par7);
bipedHeadwear.render(par7); bipedHeadwear.render(par7);
} }
else{ else{
renderHead(par1Entity, par7); renderHead(par1Entity, par7);
renderArms(par1Entity, par7); renderArms(par1Entity, par7);
renderBody(par1Entity, par7); renderBody(par1Entity, par7);
renderLegs(par1Entity, par7); renderLegs(par1Entity, par7);
} }
} }
public void renderHead(Entity entityliving,float par7){ public void renderHead(Entity entityliving,float par7){
if(isDancing){ if(isDancing){
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.075F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, (float)(-Math.abs(Math.cos(dancingTicks))) * 0.075F); GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.075F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, (float)(-Math.abs(Math.cos(dancingTicks))) * 0.075F);
bipedHead.render(par7); bipedHead.render(par7);
bipedHeadwear.render(par7); bipedHeadwear.render(par7);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
else{ else{
bipedHead.render(par7); bipedHead.render(par7);
bipedHeadwear.render(par7); bipedHeadwear.render(par7);
} }
} }
public void renderLeftArm(Entity entityliving,float par7){ public void renderLeftArm(Entity entityliving,float par7){
if(isDancing){ if(isDancing){
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.025F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, 0.0F); GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.025F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, 0.0F);
bipedLeftArm.render(par7); bipedLeftArm.render(par7);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
else{ else{
bipedLeftArm.render(par7); bipedLeftArm.render(par7);
} }
} }
public void renderArms(Entity entity,float par7){ public void renderArms(Entity entity,float par7){
renderLeftArm(entity,par7); renderLeftArm(entity,par7);
renderRightArm(entity,par7); renderRightArm(entity,par7);
} }
public void renderRightArm(Entity entityliving,float par7){ public void renderRightArm(Entity entityliving,float par7){
if(isDancing){ if(isDancing){
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.025F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, 0.0F); GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.025F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, 0.0F);
bipedRightArm.render(par7); bipedRightArm.render(par7);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
else{ else{
bipedRightArm.render(par7); bipedRightArm.render(par7);
} }
} }
public void renderBody(Entity entityliving,float par7){ public void renderBody(Entity entityliving,float par7){
if(isDancing){ if(isDancing){
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.015F, 0.0F, 0.0F); GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.015F, 0.0F, 0.0F);
bipedBody.render(par7); bipedBody.render(par7);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
else{ else{
bipedBody.render(par7); bipedBody.render(par7);
} }
} }
public void renderLegs(Entity entityliving,float par7){ public void renderLegs(Entity entityliving,float par7){
bipedRightLeg.render(par7); bipedRightLeg.render(par7);
@@ -225,12 +147,12 @@ public class ModelNPCMale extends ModelBiped
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity)
{ {
EntityNPCInterface npc = (EntityNPCInterface) entity; EntityNPCInterface npc = (EntityNPCInterface) entity;
isRiding = npc.isRiding(); isRiding = npc.isRiding();
if(isSneak && (npc.currentAnimation == EnumAnimation.CRAWLING || npc.currentAnimation == EnumAnimation.LYING)) if(isSneak && (npc.currentAnimation == EnumAnimation.CRAWLING || npc.currentAnimation == EnumAnimation.LYING))
isSneak = false; isSneak = false;
bipedHead.rotateAngleY = par4 / (180F / (float)Math.PI); bipedHead.rotateAngleY = par4 / (180F / (float)Math.PI);
bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI); bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI);
bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY; bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY;
@@ -347,9 +269,9 @@ public class ModelNPCMale extends ModelBiped
public void setRotation(ModelRenderer model, float x, float y, float z) public void setRotation(ModelRenderer model, float x, float y, float z)
{ {
model.rotateAngleX = x; model.rotateAngleX = x;
model.rotateAngleY = y; model.rotateAngleY = y;
model.rotateAngleZ = z; model.rotateAngleZ = z;
} }
public void renderCloak(float f) public void renderCloak(float f)
@@ -357,9 +279,9 @@ public class ModelNPCMale extends ModelBiped
bipedCloak.render(f); bipedCloak.render(f);
} }
public boolean isSleeping(Entity entity) { public boolean isSleeping(Entity entity) {
if(entity instanceof EntityPlayer && ((EntityPlayer)entity).isPlayerSleeping()) if(entity instanceof EntityPlayer && ((EntityPlayer)entity).isPlayerSleeping())
return true; return true;
return ((EntityNPCInterface)entity).currentAnimation == EnumAnimation.LYING; return ((EntityNPCInterface)entity).currentAnimation == EnumAnimation.LYING;
} }
} }
@@ -1,72 +0,0 @@
package noppes.npcs.client.model.part;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import noppes.npcs.client.model.util.Model2DRenderer;
import noppes.npcs.client.model.util.ModelScaleRenderer;
public class ModelBodywear extends ModelScaleRenderer{
public ModelBodywear(ModelBase base) {
super(base);
float scaler = 0.81f;
float thick = 0.65f;
float x = -0.10f;
float y = 12.76f;
float z = -0.5f;
float z1 = 0.27f;
Model2DRenderer front = new Model2DRenderer(base, 20, 36, 8, 12, 64, 64);
front.setRotationPoint(-4.588f, 0 + y, -2.302f + z);
front.setScale(scaler);
front.setThickness(thick);
setRotation(front, 0, 0, 0);
this.addChild(front);
Model2DRenderer back = new Model2DRenderer(base, 32, 36, 8, 12, 64, 64);
back.setRotationPoint(4.588f, 0 + y, 2.302f);
back.setScale(scaler);
back.setThickness(thick);
setRotation(back, 0, (float)(Math.PI), 0);
this.addChild(back);
Model2DRenderer right = new Model2DRenderer(base, 28, 36, 4, 12, 64, 64);
right.setRotationPoint(3.9425f, 0 + y, 2.29695f);
right.setScale(scaler);
right.setThickness(thick);
setRotation(right, 0, (float)(Math.PI/2f), 0);
this.addChild(right);
Model2DRenderer left = new Model2DRenderer(base, 16, 36, 4, 12, 64, 64);
left.setRotationPoint(-3.9425f, 0 + y, -2.29695f + z);
left.setScale(scaler);
left.setThickness(thick);
setRotation(left, 0, (float)(Math.PI/-2f), 0);
this.addChild(left);
Model2DRenderer top = new Model2DRenderer(base, 20, 32, 8, 4, 64, 64);
top.setRotationPoint(-4.588f, -13.0f + y, -2.29695f);
top.setScale(scaler/3);
top.setThickness(thick);
setRotation(top, (float)(Math.PI / -2), 0, 0);
this.addChild(top);
Model2DRenderer bottom = new Model2DRenderer(base, 28, 32, 8, 4, 64, 64);
bottom.setRotationPoint(-4.588f, -0.65f + y, -2.29695f);
bottom.setScale(scaler/3);
bottom.setThickness(thick);
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
this.addChild(bottom);
}
public void setRotation(ModelRenderer model, float x, float y, float z) {
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}
@@ -12,22 +12,19 @@ public class ModelBreasts extends ModelPartInterface {
private ModelRenderer breasts2; private ModelRenderer breasts2;
private ModelRenderer breasts3; private ModelRenderer breasts3;
public ModelBreasts(ModelMPM base, int width, int height) { public ModelBreasts(ModelMPM base) {
super(base); super(base);
breasts = new Model2DRenderer(base, 20f, 22, 8, 3, width, height); breasts = new Model2DRenderer(base, 20f, 22, 8, 3, 64, 32);
breasts.setTextureSize(width, height);
breasts.setRotationPoint(-3.6F, 5.2f, -3f); breasts.setRotationPoint(-3.6F, 5.2f, -3f);
breasts.setScale(0.17f, 0.19f); breasts.setScale(0.17f, 0.19f);
breasts.setThickness(1); breasts.setThickness(1);
this.addChild(breasts); this.addChild(breasts);
breasts2 = new ModelRenderer(base); breasts2 = new ModelRenderer(base);
breasts2.setTextureSize(width, height);
this.addChild(breasts2); this.addChild(breasts2);
Model2DRenderer bottom = new Model2DRenderer(base, 20f, 22, 8, 4, width, height); Model2DRenderer bottom = new Model2DRenderer(base, 20f, 22, 8, 4, 64, 32);
bottom.setTextureSize(width, height);
bottom.setRotationPoint(-3.6F, 5f, -3.1f); bottom.setRotationPoint(-3.6F, 5f, -3.1f);
bottom.setScale(0.225f, 0.20f); bottom.setScale(0.225f, 0.20f);
bottom.setThickness(2f); bottom.setThickness(2f);
@@ -35,65 +32,56 @@ public class ModelBreasts extends ModelPartInterface {
breasts2.addChild(bottom); breasts2.addChild(bottom);
breasts3 = new ModelRenderer(base); breasts3 = new ModelRenderer(base);
breasts3.setTextureSize(width, height);
this.addChild(breasts3); this.addChild(breasts3);
Model2DRenderer right = new Model2DRenderer(base, 20f, 22, 3, 2, width, height); Model2DRenderer right = new Model2DRenderer(base, 20f, 22, 3, 2, 64, 32);
right.setTextureSize(width, height);
right.setRotationPoint(-3.8F, 5.3f, -3.6f); right.setRotationPoint(-3.8F, 5.3f, -3.6f);
right.setScale(0.12f, 0.14f); right.setScale(0.12f, 0.14f);
right.setThickness(1.75f); right.setThickness(1.75f);
breasts3.addChild(right); breasts3.addChild(right);
Model2DRenderer right2 = new Model2DRenderer(base, 20f, 22, 3, 1, width, height); Model2DRenderer right2 = new Model2DRenderer(base, 20f, 22, 3, 1, 64, 32);
right2.setTextureSize(width, height);
right2.setRotationPoint(-3.8F, 4.1f, -3.14f); right2.setRotationPoint(-3.8F, 4.1f, -3.14f);
right2.setScale(0.06f, 0.07f); right2.setScale(0.06f, 0.07f);
right2.setThickness(1.75f); right2.setThickness(1.75f);
right2.rotateAngleX = (float) (Math.PI / 9); right2.rotateAngleX = (float) (Math.PI / 9);
breasts3.addChild(right2); breasts3.addChild(right2);
Model2DRenderer right3 = new Model2DRenderer(base, 20f, 24, 3, 1, width, height); Model2DRenderer right3 = new Model2DRenderer(base, 20f, 24, 3, 1, 64, 32);
right3.setTextureSize(width, height);
right3.setRotationPoint(-3.8F, 5.3f, -3.6f); right3.setRotationPoint(-3.8F, 5.3f, -3.6f);
right3.setScale(0.06f, 0.07f); right3.setScale(0.06f, 0.07f);
right3.setThickness(1.75f); right3.setThickness(1.75f);
right3.rotateAngleX = (float) (-Math.PI / 9); right3.rotateAngleX = (float) (-Math.PI / 9);
breasts3.addChild(right3); breasts3.addChild(right3);
Model2DRenderer right4 = new Model2DRenderer(base, 23f, 22, 1, 2, width, height); Model2DRenderer right4 = new Model2DRenderer(base, 23f, 22, 1, 2, 64, 32);
right4.setTextureSize(width, height);
right4.setRotationPoint(-1.8f, 5.3f, -3.14f); right4.setRotationPoint(-1.8f, 5.3f, -3.14f);
right4.setScale(0.12f, 0.14f); right4.setScale(0.12f, 0.14f);
right4.setThickness(1.75f); right4.setThickness(1.75f);
right4.rotateAngleY = (float) (Math.PI / 9); right4.rotateAngleY = (float) (Math.PI / 9);
breasts3.addChild(right4); breasts3.addChild(right4);
Model2DRenderer left = new Model2DRenderer(base, 25f, 22, 3, 2, width, height); Model2DRenderer left = new Model2DRenderer(base, 25f, 22, 3, 2, 64, 32);
left.setTextureSize(width, height);
left.setRotationPoint(0.8F, 5.3f, -3.6f); left.setRotationPoint(0.8F, 5.3f, -3.6f);
left.setScale(0.12f, 0.14f); left.setScale(0.12f, 0.14f);
left.setThickness(1.75f); left.setThickness(1.75f);
breasts3.addChild(left); breasts3.addChild(left);
Model2DRenderer left2 = new Model2DRenderer(base, 25f, 22, 3, 1, width, height); Model2DRenderer left2 = new Model2DRenderer(base, 25f, 22, 3, 1, 64, 32);
left2.setTextureSize(width, height);
left2.setRotationPoint(0.8F, 4.1f, -3.18f); left2.setRotationPoint(0.8F, 4.1f, -3.18f);
left2.setScale(0.06f, 0.07f); left2.setScale(0.06f, 0.07f);
left2.setThickness(1.75f); left2.setThickness(1.75f);
left2.rotateAngleX = (float) (Math.PI / 9); left2.rotateAngleX = (float) (Math.PI / 9);
breasts3.addChild(left2); breasts3.addChild(left2);
Model2DRenderer left3 = new Model2DRenderer(base, 25f, 24, 3, 1, width, height); Model2DRenderer left3 = new Model2DRenderer(base, 25f, 24, 3, 1, 64, 32);
left3.setTextureSize(width, height);
left3.setRotationPoint(0.8F, 5.3f, -3.6f); left3.setRotationPoint(0.8F, 5.3f, -3.6f);
left3.setScale(0.06f, 0.07f); left3.setScale(0.06f, 0.07f);
left3.setThickness(1.75f); left3.setThickness(1.75f);
left3.rotateAngleX = (float) (-Math.PI / 9); left3.rotateAngleX = (float) (-Math.PI / 9);
breasts3.addChild(left3); breasts3.addChild(left3);
Model2DRenderer left4 = new Model2DRenderer(base, 24f, 22, 1, 2, width, height); Model2DRenderer left4 = new Model2DRenderer(base, 24f, 22, 1, 2, 64, 32);
left4.setTextureSize(width, height);
left4.setRotationPoint(0.8f, 5.3f, -3.6f); left4.setRotationPoint(0.8f, 5.3f, -3.6f);
left4.setScale(0.12f, 0.14f); left4.setScale(0.12f, 0.14f);
left4.setThickness(1.75f); left4.setThickness(1.75f);
Loaded 100 of 1094 files, more files were not shown because too many files have changed in this diff. Show more