mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-24 19:54:26 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37e9d5f899 | ||
|
|
09423427a0 | ||
|
|
f213cab261 | ||
|
|
bf78c1be0f | ||
|
|
ff5e7de1be | ||
|
|
01339e7baf | ||
|
|
62ee42a23d | ||
|
|
a8a0528275 | ||
|
|
0e9ddd75b6 | ||
|
|
0c25d7ec1c | ||
|
|
b3a5854ff1 | ||
|
|
7000b525f3 | ||
|
|
9bcb8133bb | ||
|
|
9d727499df | ||
|
|
075e3fdb41 | ||
|
|
5befe141bd | ||
|
|
895d20335f | ||
|
|
1ce5b7b302 | ||
|
|
7c4965d368 | ||
|
|
a0adf0d7bd | ||
|
|
2ec6e5b753 | ||
|
|
130ac26879 | ||
|
|
cbf99be297 | ||
|
|
dc42beee15 | ||
|
|
b49402f8bd | ||
|
|
8df94aaf67 | ||
|
|
ed5cfad00d | ||
|
|
a9961ed740 | ||
|
|
6700030890 | ||
|
|
02b44953cb | ||
|
|
b8c3e9bef2 | ||
|
|
5b361d779f | ||
|
|
6df7d3643f | ||
|
|
e7ed34a591 | ||
|
|
a6cd55fcea | ||
|
|
13b153d922 | ||
|
|
f77a2ff101 | ||
|
|
49fab85291 | ||
|
|
6f1914c002 | ||
|
|
d1901dcf0c | ||
|
|
204e7a9c15 | ||
|
|
892d11b89b | ||
|
|
b965d2e097 | ||
|
|
3c1d7e6689 | ||
|
|
99298226f7 | ||
|
|
0306cff24e | ||
|
|
b77d98eba5 | ||
|
|
44f4301239 | ||
|
|
b82177d8d9 | ||
|
|
eb77ae3b99 | ||
|
|
2b1449b5f3 | ||
|
|
221f00ccf4 | ||
|
|
cf82314181 | ||
|
|
ee33a57323 | ||
|
|
ae1f33d327 | ||
|
|
60dbcc7146 | ||
|
|
0b7bd2f009 | ||
|
|
8e247f8232 | ||
|
|
92097769d9 | ||
|
|
13953edaaf | ||
|
|
9db86d0870 | ||
|
|
8d21291e7b | ||
|
|
88eb96e784 | ||
|
|
78978bda92 | ||
|
|
314bc462f0 | ||
|
|
b04ac96690 | ||
|
|
97c97cf939 | ||
|
|
d4a62b1334 | ||
|
|
ceac11d251 | ||
|
|
f2faf3513d | ||
|
|
515a6e8550 | ||
|
|
142fbe51e2 | ||
|
|
e0360f9a6e | ||
|
|
f5bae9099d | ||
|
|
241120c32a | ||
|
|
9ff341bd17 | ||
|
|
dd5ca106bc | ||
|
|
3cba19cea2 | ||
|
|
6859b2da47 | ||
|
|
fa7fb7f734 | ||
|
|
6f7ea7340c | ||
|
|
1183f7d91b | ||
|
|
9e7e3c8e5d | ||
|
|
0c07260999 | ||
|
|
8a4c9f6f6b | ||
|
|
6ea7244a25 | ||
|
|
809b1f269c | ||
|
|
6ee79f181f | ||
|
|
110a7c71fb | ||
|
|
f7c0f2bdf9 | ||
|
|
8cd4cfd82c | ||
|
|
745bebaf73 | ||
|
|
e1c4c2b786 | ||
|
|
d08e4fc925 | ||
|
|
a6c0acdbcf | ||
|
|
bad130b937 | ||
|
|
b25a598580 | ||
|
|
e2e7b660d9 | ||
|
|
7e88ebb696 | ||
|
|
05926667c6 | ||
|
|
5ed264f3bd | ||
|
|
9c8ae316ff | ||
|
|
8ed683800f | ||
|
|
ed97534e67 | ||
|
|
dd14f3ded0 | ||
|
|
d95f2476f9 | ||
|
|
6f7e2e8b18 | ||
|
|
e38e592acb | ||
|
|
de6fb94562 | ||
|
|
96c621fb14 | ||
|
|
8e389a66b9 | ||
|
|
f56358f4f9 | ||
|
|
960c60f5c7 | ||
|
|
f5de82bb4e | ||
|
|
e9fbc4ad8d | ||
|
|
dfa8ca7533 | ||
|
|
2bd5f25410 | ||
|
|
3ec10e9c49 | ||
|
|
ee72d22593 | ||
|
|
f7d62f6cdd | ||
|
|
8ca2cc58f0 | ||
|
|
adec63c763 | ||
|
|
e6786a985e | ||
|
|
9b82769d22 | ||
|
|
867a8a3d82 | ||
|
|
2c6fb0d15b | ||
|
|
6e1e9c189d | ||
|
|
6d187fdada | ||
|
|
6914f670bd | ||
|
|
aced231b55 | ||
|
|
996969bd2c | ||
|
|
2fe39c98fc | ||
|
|
99aa6bf7c1 | ||
|
|
1e8d578222 | ||
|
|
660573d891 | ||
|
|
f828e96674 | ||
|
|
2031d462bd | ||
|
|
0d3418af47 | ||
|
|
5d738987b2 | ||
|
|
36cd81e6e4 | ||
|
|
17566031d7 | ||
|
|
a3de45cd55 | ||
|
|
a7b9043021 | ||
|
|
c27cdf7950 | ||
|
|
8b0431340c | ||
|
|
a10e427c1c | ||
|
|
116dc23f2b | ||
|
|
09f36bb56c | ||
|
|
e102e652ae | ||
|
|
81b4715dca | ||
|
|
406a8012fc | ||
|
|
0ceb5dc3e2 | ||
|
|
0cabe6b623 | ||
|
|
22a768b8c2 | ||
|
|
864ce6befc | ||
|
|
947314787f | ||
|
|
fc9e85c35a | ||
|
|
7b1b304f75 | ||
|
|
ef4ec4aca0 | ||
|
|
319d7b0503 | ||
|
|
ffd25430c9 | ||
|
|
c30a9014f8 | ||
|
|
f9a4fc0d54 | ||
|
|
7dc5cc5e8c | ||
|
|
d3551dda36 | ||
|
|
53070b47c4 | ||
|
|
c4b9a5ca21 | ||
|
|
9d68a5e079 | ||
|
|
aa02580c28 | ||
|
|
fcfc01b2ab | ||
|
|
30b3f55e7c | ||
|
|
ac87f2c2c2 | ||
|
|
abb2d13e6e | ||
|
|
cc2e8805d8 | ||
|
|
81c752c483 | ||
|
|
df45247c89 | ||
|
|
6882838cf8 | ||
|
|
8842fdfbf6 | ||
|
|
41c4fc66d0 | ||
|
|
0943299384 | ||
|
|
f8b182008c | ||
|
|
270a9cbd46 | ||
|
|
a9f2fe4a0e | ||
|
|
214f0a4c00 | ||
|
|
69154bec24 | ||
|
|
2c349cb34c | ||
|
|
573aab23e5 | ||
|
|
89efe67f44 | ||
|
|
33e5071b11 | ||
|
|
418d345293 | ||
|
|
8ef4276865 | ||
|
|
f2190b350d | ||
|
|
1fc7c8ea50 | ||
|
|
a2af8ca0b2 | ||
|
|
eb11170a9b | ||
|
|
6714daa60a | ||
|
|
6e74bc0597 | ||
|
|
de4b169754 | ||
|
|
7b239ea6bd | ||
|
|
87949b62fa | ||
|
|
7bd14b06dd | ||
|
|
5d6da34717 | ||
|
|
44c0ecc3fd | ||
|
|
3df8acfaee | ||
|
|
545cece3e4 | ||
|
|
0f619d710a | ||
|
|
aba24fc93c | ||
|
|
9a6cf94c73 | ||
|
|
49edeee673 | ||
|
|
84433df94b | ||
|
|
8753c97a8e | ||
|
|
f52af0b19d | ||
|
|
891a3101c9 | ||
|
|
4302ac4a2b | ||
|
|
f91e62ee0f | ||
|
|
f27599075a | ||
|
|
84286794aa | ||
|
|
39a40c9603 | ||
|
|
7fdfd14174 | ||
|
|
c818f6ee4e | ||
|
|
c8d676c764 | ||
|
|
45217f3afc | ||
|
|
80352741b9 | ||
|
|
e3405d22e9 | ||
|
|
586c451f06 | ||
|
|
2c012f2693 | ||
|
|
f7576ffc90 | ||
|
|
b04a35efc4 | ||
|
|
6a5d84b9aa | ||
|
|
58aaaa158a | ||
|
|
f5aa6b58db | ||
|
|
6913cadc79 | ||
|
|
9a77e2f146 | ||
|
|
992e6fd169 | ||
|
|
f0b33cf913 | ||
|
|
2ef93dd35f | ||
|
|
df069c82c2 | ||
|
|
e58b494979 | ||
|
|
57bd628357 | ||
|
|
fd7f550316 | ||
|
|
f5cf78e1fb | ||
|
|
fe780d69ee | ||
|
|
29935a1c6d | ||
|
|
46d668f44c | ||
|
|
19e14983aa | ||
|
|
22a4082890 | ||
|
|
c12bb6508c | ||
|
|
daada3cb8a | ||
|
|
fb09c8c39e | ||
|
|
c16a90424a | ||
|
|
9eb2052bdb | ||
|
|
4976e059f5 | ||
|
|
cc0c83835c | ||
|
|
f788257b7d | ||
|
|
7db4d2649b | ||
|
|
b0c2dff2fe | ||
|
|
4cd6ac6b51 | ||
|
|
bfb771211f | ||
|
|
5b84a01c74 | ||
|
|
377e18a445 | ||
|
|
23916e88d8 | ||
|
|
e003e375db | ||
|
|
33dd07d941 | ||
|
|
daf06e8d55 | ||
|
|
d2612657c3 | ||
|
|
ae4b95731b | ||
|
|
e33d3fc5e4 | ||
|
|
fc94b851c1 | ||
|
|
c2d0b5322d | ||
|
|
1207a592d7 | ||
|
|
116c3db201 | ||
|
|
dc678bee86 | ||
|
|
8b89711403 | ||
|
|
3250a9e02b | ||
|
|
d28a523c49 | ||
|
|
58e129e0df | ||
|
|
f165e5172c | ||
|
|
5eeefedf6e | ||
|
|
23cfe66ecb | ||
|
|
5b589768f6 | ||
|
|
9b330007fd | ||
|
|
397620f36e | ||
|
|
0db96f9040 | ||
|
|
de6375c4cb | ||
|
|
79e13dfade | ||
|
|
b8dc090db8 | ||
|
|
0ddcd15162 | ||
|
|
bcfd44d8fe | ||
|
|
cacb4ebf85 | ||
|
|
e65ba59b8e | ||
|
|
354c9808e4 | ||
|
|
cfca59a48e | ||
|
|
30d73f91cf | ||
|
|
112305f059 | ||
|
|
45f006b7bf | ||
|
|
60ed5ab607 | ||
|
|
c90a5d9713 | ||
|
|
1a47b68621 | ||
|
|
0787a71197 | ||
|
|
6a7ce1bb5b | ||
|
|
60f8645c84 | ||
|
|
e558292360 | ||
|
|
74b0114555 | ||
|
|
667486fd71 | ||
|
|
78357165a2 | ||
|
|
9c7767312d | ||
|
|
1ddc316230 | ||
|
|
b8a3740ad2 | ||
|
|
96caf6e033 | ||
|
|
07175758a7 | ||
|
|
9f02d118cd | ||
|
|
d149b018e9 | ||
|
|
5e5bf2eb1c | ||
|
|
f504424fd2 | ||
|
|
cb143be559 | ||
|
|
3884b662fd | ||
|
|
7ff568b1be | ||
|
|
755dcbab03 | ||
|
|
bab359ea2b | ||
|
|
0d36c19c22 | ||
|
|
46ea214b64 | ||
|
|
17c6fe9728 | ||
|
|
e2c8550dc1 | ||
|
|
564a6ab6ba | ||
|
|
477cf03f1b | ||
|
|
4e5a12690e | ||
|
|
8f206ba500 | ||
|
|
f61001d32a | ||
|
|
9797a52af1 | ||
|
|
be18e756fc | ||
|
|
bda76bafe6 | ||
|
|
569c7790fc | ||
|
|
3e6e28d857 | ||
|
|
91bcd43942 | ||
|
|
54d53041ac | ||
|
|
1d94e5f1e7 | ||
|
|
adb581ea64 | ||
|
|
8e3440bc73 | ||
|
|
074f3ee88b | ||
|
|
816873dcd8 | ||
|
|
29f529a711 | ||
|
|
8f62daba3e | ||
|
|
c35c3cbb1d | ||
|
|
8905f5f42e | ||
|
|
974bf2ca66 | ||
|
|
4c2f033a04 | ||
|
|
26a1ad1dba | ||
|
|
5388a56b53 | ||
|
|
95f559c36b | ||
|
|
352a79d94c | ||
|
|
b203a244ec | ||
|
|
309f912f10 | ||
|
|
0772f427ef | ||
|
|
6897512a01 | ||
|
|
a1a382b67f | ||
|
|
3b69da5ef6 | ||
|
|
cbc0b82356 | ||
|
|
1aee4c06fc | ||
|
|
7f407c3c44 | ||
|
|
06ff9fc482 | ||
|
|
42c29f1d47 | ||
|
|
3573b7e71e | ||
|
|
25eafab3b1 | ||
|
|
d7d43f74b9 | ||
|
|
c3b3fc8370 | ||
|
|
4d17df936a | ||
|
|
6779bbc93f | ||
|
|
f29de8aaa3 | ||
|
|
9dfd562841 | ||
|
|
8b07aa41cd | ||
|
|
4375222a67 | ||
|
|
d87a37e017 | ||
|
|
6b0da818c6 | ||
|
|
a5903c24b9 | ||
|
|
780d382b3f | ||
|
|
94127e5fa4 | ||
|
|
5f595fa7b6 | ||
|
|
01848e82c8 | ||
|
|
c9ebeea7f9 | ||
|
|
bfb262a487 | ||
|
|
76761c4f3d | ||
|
|
1ac1cbcc2a | ||
|
|
0b5ffce55f | ||
|
|
a1c036c4bf | ||
|
|
ddbf84bc74 | ||
|
|
54d89bab39 | ||
|
|
c146a973f0 | ||
|
|
f98a1af2b2 | ||
|
|
0750f12a32 | ||
|
|
aed45fc119 | ||
|
|
928232fdd2 | ||
|
|
49f93dfce2 | ||
|
|
763a388947 | ||
|
|
83a13b96c4 | ||
|
|
ed284eb658 | ||
|
|
c522c08ac5 | ||
|
|
0b809e8210 | ||
|
|
bc6cc35fd6 | ||
|
|
2656081b1a | ||
|
|
06b938069a | ||
|
|
7ba95807e7 | ||
|
|
3b11ddb4b4 | ||
|
|
cfd724edf6 | ||
|
|
0db7ef8e66 | ||
|
|
235ddaa1ea | ||
|
|
d6ed069862 | ||
|
|
99403257f5 | ||
|
|
4346992f14 | ||
|
|
c9426682c0 | ||
|
|
6e92f08851 | ||
|
|
ef01b700da | ||
|
|
7564498cdf | ||
|
|
b4cb69000e | ||
|
|
e89e4d4c2b | ||
|
|
ff3b9131cf | ||
|
|
2e745fbda1 | ||
|
|
27b80037bd | ||
|
|
58afabc43b | ||
|
|
ad689440aa | ||
|
|
de92c6055d | ||
|
|
3bb1b4fcb0 | ||
|
|
695dfce7d0 | ||
|
|
28a1650c05 | ||
|
|
bb5b3f5f00 | ||
|
|
612a2d7593 | ||
|
|
d2611385de | ||
|
|
7b3dd8e7bd | ||
|
|
3c856458c4 | ||
|
|
51263a9f82 | ||
|
|
b167755cc0 | ||
|
|
d638c98d81 | ||
|
|
1df7819931 | ||
|
|
828d03a0cb | ||
|
|
7d4a59d45a | ||
|
|
5e8c234ac7 | ||
|
|
1ac0b3b0a3 | ||
|
|
25dcc975df | ||
|
|
699b24e467 | ||
|
|
8d52e9356c | ||
|
|
a82a06fe4d | ||
|
|
dbe956d973 | ||
|
|
2588f14105 | ||
|
|
5c81f3dd2e | ||
|
|
678ee8fc02 | ||
|
|
c950dcfa5a | ||
|
|
bb7b33bf95 | ||
|
|
4f553a9ee4 | ||
|
|
343721c87a | ||
|
|
74ed9d9de9 | ||
|
|
c0ad318573 | ||
|
|
037711893d | ||
|
|
1d6499ea48 | ||
|
|
5d520837b1 | ||
|
|
a895c8bd24 | ||
|
|
73ceeab907 | ||
|
|
808de24db4 | ||
|
|
cfac349265 | ||
|
|
3d498814f9 | ||
|
|
a47af08d0f | ||
|
|
51a556db23 | ||
|
|
6f33b9df92 | ||
|
|
7a715ef308 | ||
|
|
718a867411 | ||
|
|
3945e7ffb8 | ||
|
|
3152cf2379 | ||
|
|
958aeea46a | ||
|
|
68600d7d00 | ||
|
|
57920b02b7 | ||
|
|
8e6f5b10d1 |
No files matched your search
@@ -1,21 +1,54 @@
|
|||||||
MIT License
|
CustomNPC+ is distributed under a reasonably open license. You probably want to have a read through this if you want to do something with it other than just play.
|
||||||
|
|
||||||
Copyright (c) 2021 KAMKEEL
|
You are completely free and have the right to Use, Share and Adapt the mod. These rights can not be removed from you as long as follow the license terms.
|
||||||
|
If you simply wish to play with the mod and do nothing else, go for it, this license is of no use to you.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
TL;DR
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
> You CAN
|
||||||
in the Software without restriction, including without limitation the rights
|
-- Fork and modify the code.
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
-- Submit Pull Requests to this repository.
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
-- Copy portions of this code for use in other projects.
|
||||||
furnished to do so, subject to the following conditions:
|
-- Write your own code that uses this code as a dependency. (addon mods!)
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
> You CANNOT
|
||||||
copies or substantial portions of the Software.
|
-- Redistribute this in its entirety as source or compiled code.
|
||||||
|
-- Create or distribute code which contains 50% or more Functionally Equivalent Statements* from this repository.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
> You MUST
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
-- Maintain a visible repository of your code which is inspired by, derived from, or copied from this code. Basically, if you use it, pay it forward. You keep rights to your OWN code, but you still must make your source visible.
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
General Clauses
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
Clauses that apply in general to any of the uses that follow.
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
- Personal Permission Clause
|
||||||
SOFTWARE.
|
I will only give personal permission if I, KAMKEEL, am directly asked. If personal permission is given this does not imply endorsement.
|
||||||
|
- Waive Clause
|
||||||
|
All restrictive clauses in this license can be ignored with personal permission. Read the above clause.
|
||||||
|
- Extensive Clause
|
||||||
|
This license applies to CustomNPC+, the CustomNPC+ website, the legacy CustomNPC+ website and all other code, assets or binaries found on this website or the github repository unless otherwise indicated.
|
||||||
|
- Informal Clause
|
||||||
|
This license will not hold up in court. I have no intention of suing anyone for breaking it, the worst that can happen to you if you do is that I'll get annoyed and ask you to rectify your mistake. If you use a public distribution platform (such as CurseForge) it's also possible your project will get taken down. Breaking the license also makes you a jerk, and you don't want to be a jerk, do you?
|
||||||
|
|
||||||
|
If you want to Distribute CustomNPC+
|
||||||
|
"Distribution" refers to making available binaries, assets, or source of the mod available from the original sources as part of your modpack or otherwise.
|
||||||
|
- Attribution Clause
|
||||||
|
You must give appropriate credit to KAMKEEL as the creator of CustomNPC+ or the parts of it you're using. Noppes can also be credit as the original Mod Author. If you do any alterations the fact that you do so should also be indicated. A link back is optional but it would be cool if you would do so.
|
||||||
|
- Redistribution Clause
|
||||||
|
You may not redistribute the enitirity of the source code provided, unless heavy modifications are made to it as a whole. More than 50% of the code cannot be redistributed unless direct permission is provided from either KAMKEEL or Noppes.
|
||||||
|
- Non-Monetary Clause
|
||||||
|
You may not charge for access to the distribution itself or gain money through it, this includes any type of inline advertisement, such as url shorteners (adf.ly or otherwise) or ads in your service slowing the download down. This includes restricting any amount of access behind a paywall. Charging for ingame goods such as mod items or cosmetic features on a server does not count as distribution and falls purely under the Mojang Terms of Service.
|
||||||
|
|
||||||
|
If you want to Feature CustomNPC+
|
||||||
|
"Featuring" refers to using CustomNPC+ in an environment where you do not distribute binaries, assets, or source. An example would be a YouTube Let's Play.
|
||||||
|
- Thief Clause
|
||||||
|
You must not claim that you made CustomNPC+. Giving appropriate credit to KAMKEEL as the creator of CustomNPC+ makes you cooler, but you don't have to do it if you don't want to.
|
||||||
|
|
||||||
|
If you want to Use CustomNPC+ Code or Assets
|
||||||
|
Usage of code or assets falls under the Extensive Clause.
|
||||||
|
- External Clause
|
||||||
|
Certain parts of the codebase are indicated to be licensed under alternative licenses. You must obey those licenses.
|
||||||
|
- Attribution Clause
|
||||||
|
You must give appropriate credit to KAMKEEL as the creator of CustomNPC+ or the parts of it you're using. Noppes can also be credit as the original Mod Author. If you do any alterations the fact that you do so should also be indicated. A link back is optional but it would be cool if you would do so.
|
||||||
|
- Copyleft Clause
|
||||||
|
Your project must be open source (have its source visible and allow for redistribution and modification) and include a clause similar to this one in its license.
|
||||||
|
- API Clause
|
||||||
|
Any of the other clauses under this section do not apply to any CustomNPC+ API code (the subdirectory src/api or https://github.com/KAMKEEL/CustomNPC-Plus-API). However, if CustomNPC+ API code is used, it must be included verbatim as it was obtained.
|
||||||
@@ -1,38 +1,43 @@
|
|||||||
|
|
||||||
## 👋 Welcome to the CustomNPC+ Repository.
|
## 👋 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.
|
||||||
|
|
||||||
**CurseForge**: [Download](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
|
----------------
|
||||||
|
|
||||||
[](https://discord.gg/pQqRTvFeJ5)
|
<a href="https://discord.gg/pQqRTvFeJ5"> <img src="https://img.shields.io/badge/KAMKEEL_Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white" width="400" height="60"> </a>
|
||||||
[](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
|
<a href="https://ko-fi.com/kamkeel"> <img src="https://img.shields.io/badge/Support_Me_|_Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white" alt="Support Me" width="400" height="60"> </a>
|
||||||
[](https://www.curseforge.com/minecraft/mc-mods/moreplayermodels-plus)
|
|
||||||
|
[](https://modrinth.com/mod/customnpc-plus)
|
||||||
|
[](https://www.curseforge.com/minecraft/mc-mods/moreplayermodels-plus)
|
||||||
[](https://github.com/KAMKEEL/Plugin-Mod)
|
[](https://github.com/KAMKEEL/Plugin-Mod)
|
||||||
<a href="https://ko-fi.com/kamkeel"> <img src="https://i.imgur.com/zvdVbeW.png" alt="Support Me" width="180" height="27"> </a>
|
|
||||||
|
|
||||||
|
----------------
|
||||||
|
|
||||||
### ❗ 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 and develop my own branch version for 1.7.10. The original mod that is updated to the latest versions of Minecraft can be found on these links: [CurseForge](https://www.curseforge.com/minecraft/mc-mods/custom-npcs), [kodevelopment](http://www.kodevelopment.nl/minecraft/customnpcs)
|
||||||
|
|
||||||
|
### ⬇️ Downloads
|
||||||
|
|
||||||
|
- **Modrinth**: [Download](https://modrinth.com/mod/customnpc-plus)
|
||||||
|
- **CurseForge**: [Download](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
|
||||||
|
|
||||||
### 🔹 Installation
|
### 🔹 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:
|
||||||
- Flying NPC (Smart Pathfinding)
|
- Flying NPC (Smart Pathfinding)
|
||||||
- 1.8 Skin Support (64x64) (3D Bodywear)
|
- 1.8 Skin Support (64x64) (Alex/Steve64)
|
||||||
- Full URL64 Selector (Downloads FULL Size Images for Custom Mob Skins)
|
- Full URL64 Selector (Downloads FULL Size Images for Custom Mob Skins)
|
||||||
- Alex Model (64x64)
|
|
||||||
- Additional Parts: [Wings, Fins, Capes, Horns, Tail]
|
- Additional Parts: [Wings, Fins, Capes, Horns, Tail]
|
||||||
- Hide Body Parts [Arms, Legs, Head, Body]
|
- Hide Body Parts [Arms, Legs, Head, Body]
|
||||||
- Custom Overlays
|
- Custom Overlays
|
||||||
- Updated Cloner GUI (with more Tabs!)
|
- Animation Maker
|
||||||
|
- Enhanced Cloner GUI (More Tabs, Filters, Tags)
|
||||||
- Markov Name Generator
|
- Markov Name Generator
|
||||||
- Backported GUI Features
|
|
||||||
- Dark Mode GUI (Link Below)
|
- Dark Mode GUI (Link Below)
|
||||||
- 1.12 Scripting Features (Details below)
|
- 1.12 Scripting Features (Details below)
|
||||||
- Script Logging (See Config)
|
|
||||||
|
|
||||||
#### Scripting:
|
#### Scripting:
|
||||||
- CustomNPC+ Api: [API](https://github.com/KAMKEEL/CustomNPC-Plus-API)
|
- CustomNPC+ Api: [API](https://github.com/KAMKEEL/CustomNPC-Plus-API)
|
||||||
@@ -41,7 +46,9 @@ This mod is an ***update*** to CustomNPC and not an add-on. Do not install Custo
|
|||||||
- Player Overlays
|
- Player Overlays
|
||||||
- Script Timers
|
- Script Timers
|
||||||
- Global Scripts
|
- Global Scripts
|
||||||
|
- Script Logging
|
||||||
- GUI Overlays
|
- GUI Overlays
|
||||||
|
- Event Scripting
|
||||||
(We never remove script functionality, only add on existing functions)
|
(We never remove script functionality, only add on existing functions)
|
||||||
|
|
||||||
## 🔰 Skin Model Feature:
|
## 🔰 Skin Model Feature:
|
||||||
|
|||||||
+7
-4
@@ -34,7 +34,7 @@ configurations {
|
|||||||
|
|
||||||
apply plugin: 'forge'
|
apply plugin: 'forge'
|
||||||
|
|
||||||
version = "1.7"
|
version = "1.8.4"
|
||||||
group= "com.kamkeel.customnpc-plus" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
group= "com.kamkeel.customnpc-plus" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
archivesBaseName = "CustomNPC-Plus"
|
archivesBaseName = "CustomNPC-Plus"
|
||||||
|
|
||||||
@@ -89,8 +89,6 @@ processResources
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {main { output.resourcesDir = output.classesDir }}
|
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from sourceSets.api.output
|
from sourceSets.api.output
|
||||||
|
|
||||||
@@ -113,7 +111,7 @@ def refMapForYourConfig = 'customnpcs.refmap.json'
|
|||||||
def relativePathToMixinAP = 'tools/mixin-0.8-SNAPSHOT.jar'
|
def relativePathToMixinAP = 'tools/mixin-0.8-SNAPSHOT.jar'
|
||||||
|
|
||||||
if(!embedMixin){
|
if(!embedMixin){
|
||||||
version += "+nomixin"
|
version += "-nomixin"
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -197,6 +195,11 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task deobfJar(type: Jar) {
|
||||||
|
classifier = 'dev'
|
||||||
|
from sourceSets.main.output
|
||||||
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
ext.refMap = refMapForYourConfig
|
ext.refMap = refMapForYourConfig
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 775 KiB |
File renamed without changes.
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
+1
-1
Submodule src/api updated: 3f8d6e5581...8c61d07b10.
@@ -3,6 +3,7 @@ package foxz.command;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import jdk.nashorn.internal.runtime.regexp.joni.Config;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockIce;
|
import net.minecraft.block.BlockIce;
|
||||||
import net.minecraft.block.BlockLeavesBase;
|
import net.minecraft.block.BlockLeavesBase;
|
||||||
@@ -10,6 +11,7 @@ import net.minecraft.block.BlockVine;
|
|||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import noppes.npcs.CustomNpcs;
|
import noppes.npcs.CustomNpcs;
|
||||||
import noppes.npcs.Server;
|
import noppes.npcs.Server;
|
||||||
|
import noppes.npcs.config.ConfigMain;
|
||||||
import noppes.npcs.constants.EnumPacketClient;
|
import noppes.npcs.constants.EnumPacketClient;
|
||||||
import noppes.npcs.controllers.ChunkController;
|
import noppes.npcs.controllers.ChunkController;
|
||||||
import foxz.commandhelper.ChMcLogger;
|
import foxz.commandhelper.ChMcLogger;
|
||||||
@@ -37,19 +39,22 @@ public class CmdConfig extends ChMcLogger {
|
|||||||
)
|
)
|
||||||
public boolean leavesdecay(String[] args){
|
public boolean leavesdecay(String[] args){
|
||||||
if(args.length == 0){
|
if(args.length == 0){
|
||||||
sendmessage("LeavesDecay: " + CustomNpcs.LeavesDecayEnabled);
|
sendmessage("LeavesDecay: " + ConfigMain.LeavesDecayEnabled);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
CustomNpcs.LeavesDecayEnabled = Boolean.parseBoolean(args[0]);
|
ConfigMain.LeavesDecayEnabled = Boolean.parseBoolean(args[0]);
|
||||||
CustomNpcs.Config.updateConfig();
|
ConfigMain.LeavesDecayEnabledProperty.set(ConfigMain.LeavesDecayEnabled);
|
||||||
|
if(ConfigMain.config.hasChanged()){
|
||||||
|
ConfigMain.config.save();
|
||||||
|
}
|
||||||
Set<String> names = Block.blockRegistry.getKeys();
|
Set<String> names = Block.blockRegistry.getKeys();
|
||||||
for(String name : names){
|
for(String name : names){
|
||||||
Block block = (Block) Block.blockRegistry.getObject(name);
|
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||||
if(block instanceof BlockLeavesBase){
|
if(block instanceof BlockLeavesBase){
|
||||||
block.setTickRandomly(CustomNpcs.LeavesDecayEnabled);
|
block.setTickRandomly(ConfigMain.LeavesDecayEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendmessage("LeavesDecay is now " + CustomNpcs.LeavesDecayEnabled);
|
sendmessage("LeavesDecay is now " + ConfigMain.LeavesDecayEnabled);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -62,19 +67,22 @@ public class CmdConfig extends ChMcLogger {
|
|||||||
)
|
)
|
||||||
public boolean vinegrowth(String[] args){
|
public boolean vinegrowth(String[] args){
|
||||||
if(args.length == 0){
|
if(args.length == 0){
|
||||||
sendmessage("VineGrowth: " + CustomNpcs.VineGrowthEnabled);
|
sendmessage("VineGrowth: " + ConfigMain.VineGrowthEnabled);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
CustomNpcs.VineGrowthEnabled = Boolean.parseBoolean(args[0]);
|
ConfigMain.VineGrowthEnabled = Boolean.parseBoolean(args[0]);
|
||||||
CustomNpcs.Config.updateConfig();
|
ConfigMain.VineGrowthEnabledProperty.set(ConfigMain.VineGrowthEnabled);
|
||||||
|
if(ConfigMain.config.hasChanged()){
|
||||||
|
ConfigMain.config.save();
|
||||||
|
}
|
||||||
Set<String> names = Block.blockRegistry.getKeys();
|
Set<String> names = Block.blockRegistry.getKeys();
|
||||||
for(String name : names){
|
for(String name : names){
|
||||||
Block block = (Block) Block.blockRegistry.getObject(name);
|
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||||
if(block instanceof BlockVine){
|
if(block instanceof BlockVine){
|
||||||
block.setTickRandomly(CustomNpcs.VineGrowthEnabled);
|
block.setTickRandomly(ConfigMain.VineGrowthEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendmessage("VineGrowth is now " + CustomNpcs.VineGrowthEnabled);
|
sendmessage("VineGrowth is now " + ConfigMain.VineGrowthEnabled);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -87,19 +95,22 @@ public class CmdConfig extends ChMcLogger {
|
|||||||
)
|
)
|
||||||
public boolean icemelts(String[] args){
|
public boolean icemelts(String[] args){
|
||||||
if(args.length == 0){
|
if(args.length == 0){
|
||||||
sendmessage("IceMelts: " + CustomNpcs.IceMeltsEnabled);
|
sendmessage("IceMelts: " + ConfigMain.IceMeltsEnabled);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
CustomNpcs.IceMeltsEnabled = Boolean.parseBoolean(args[0]);
|
ConfigMain.IceMeltsEnabled = Boolean.parseBoolean(args[0]);
|
||||||
CustomNpcs.Config.updateConfig();
|
ConfigMain.IceMeltsEnabledProperty.set(ConfigMain.IceMeltsEnabled);
|
||||||
|
if(ConfigMain.config.hasChanged()){
|
||||||
|
ConfigMain.config.save();
|
||||||
|
}
|
||||||
Set<String> names = Block.blockRegistry.getKeys();
|
Set<String> names = Block.blockRegistry.getKeys();
|
||||||
for(String name : names){
|
for(String name : names){
|
||||||
Block block = (Block) Block.blockRegistry.getObject(name);
|
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||||
if(block instanceof BlockIce){
|
if(block instanceof BlockIce){
|
||||||
block.setTickRandomly(CustomNpcs.IceMeltsEnabled);
|
block.setTickRandomly(ConfigMain.IceMeltsEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendmessage("IceMelts is now " + CustomNpcs.IceMeltsEnabled);
|
sendmessage("IceMelts is now " + ConfigMain.IceMeltsEnabled);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -112,12 +123,15 @@ public class CmdConfig extends ChMcLogger {
|
|||||||
)
|
)
|
||||||
public boolean guns(String[] args){
|
public boolean guns(String[] args){
|
||||||
if(args.length == 0){
|
if(args.length == 0){
|
||||||
sendmessage("GunsEnabled: " + CustomNpcs.GunsEnabled);
|
sendmessage("GunsEnabled: " + ConfigMain.GunsEnabled);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
CustomNpcs.GunsEnabled = Boolean.parseBoolean(args[0]);
|
ConfigMain.GunsEnabled = Boolean.parseBoolean(args[0]);
|
||||||
CustomNpcs.Config.updateConfig();
|
ConfigMain.GunsEnabledProperty.set(ConfigMain.GunsEnabled);
|
||||||
sendmessage("GunsEnabled is now " + CustomNpcs.GunsEnabled);
|
if(ConfigMain.config.hasChanged()){
|
||||||
|
ConfigMain.config.save();
|
||||||
|
}
|
||||||
|
sendmessage("GunsEnabled is now " + ConfigMain.GunsEnabled);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -147,24 +161,27 @@ public class CmdConfig extends ChMcLogger {
|
|||||||
)
|
)
|
||||||
public boolean chunkloaders(String[] args){
|
public boolean chunkloaders(String[] args){
|
||||||
if(args.length == 0){
|
if(args.length == 0){
|
||||||
sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + CustomNpcs.ChunkLoaders);
|
sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + ConfigMain.ChunkLoaders);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
try{
|
try{
|
||||||
CustomNpcs.ChunkLoaders = Integer.parseInt(args[0]);
|
ConfigMain.ChunkLoaders = Integer.parseInt(args[0]);
|
||||||
}
|
}
|
||||||
catch(NumberFormatException ex){
|
catch(NumberFormatException ex){
|
||||||
sendmessage("Didnt get a number");
|
sendmessage("Didnt get a number");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CustomNpcs.Config.updateConfig();
|
|
||||||
|
ConfigMain.ChunkLoadersProperty.set(ConfigMain.ChunkLoaders);
|
||||||
int size = ChunkController.instance.size();
|
if(ConfigMain.config.hasChanged()){
|
||||||
if(size > CustomNpcs.ChunkLoaders){
|
ConfigMain.config.save();
|
||||||
ChunkController.instance.unload(size - CustomNpcs.ChunkLoaders);
|
|
||||||
sendmessage(size - CustomNpcs.ChunkLoaders + " chunksloaders unloaded");
|
|
||||||
}
|
}
|
||||||
sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + CustomNpcs.ChunkLoaders);
|
int size = ChunkController.instance.size();
|
||||||
|
if(size > ConfigMain.ChunkLoaders){
|
||||||
|
ChunkController.instance.unload(size - ConfigMain.ChunkLoaders);
|
||||||
|
sendmessage(size - ConfigMain.ChunkLoaders + " chunksloaders unloaded");
|
||||||
|
}
|
||||||
|
sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + ConfigMain.ChunkLoaders);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class CmdDialog extends ChMcLogger {
|
|||||||
}
|
}
|
||||||
for(PlayerData playerdata : data){
|
for(PlayerData playerdata : data){
|
||||||
playerdata.dialogData.dialogsRead.add(diagid);
|
playerdata.dialogData.dialogsRead.add(diagid);
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ public class CmdDialog extends ChMcLogger {
|
|||||||
}
|
}
|
||||||
for(PlayerData playerdata : data){
|
for(PlayerData playerdata : data){
|
||||||
playerdata.dialogData.dialogsRead.remove(diagid);
|
playerdata.dialogData.dialogsRead.remove(diagid);
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,173 +41,170 @@ import foxz.commandhelper.permissions.PlayerOnly;
|
|||||||
)
|
)
|
||||||
public class CmdNoppes extends ChMcLogger {
|
public class CmdNoppes extends ChMcLogger {
|
||||||
|
|
||||||
public CmdFaction cmdfaction = new CmdFaction(ctorParm);
|
public CmdFaction cmdfaction = new CmdFaction(ctorParm);
|
||||||
public CmdNpc cmdnpc= new CmdNpc(ctorParm);
|
public CmdNpc cmdnpc = new CmdNpc(ctorParm);
|
||||||
public static Map<String,Class<?>> SlayMap = new LinkedHashMap<String,Class<?>>();
|
public static Map<String, Class<?>> SlayMap = new LinkedHashMap<String, Class<?>>();
|
||||||
|
|
||||||
public CmdNoppes(Object sender) {
|
public CmdNoppes(Object sender) {
|
||||||
super(sender);
|
super(sender);
|
||||||
|
|
||||||
SlayMap.clear();
|
SlayMap.clear();
|
||||||
|
|
||||||
SlayMap.put("all",EntityLivingBase.class);
|
SlayMap.put("all", EntityLivingBase.class);
|
||||||
SlayMap.put("mobs",EntityMob.class);
|
SlayMap.put("mobs", EntityMob.class);
|
||||||
SlayMap.put("animals", EntityAnimal.class);
|
SlayMap.put("animals", EntityAnimal.class);
|
||||||
SlayMap.put("items", EntityItem.class);
|
SlayMap.put("items", EntityItem.class);
|
||||||
SlayMap.put("xporbs", EntityXPOrb.class);
|
SlayMap.put("xporbs", EntityXPOrb.class);
|
||||||
SlayMap.put("npcs", EntityNPCInterface.class);
|
SlayMap.put("npcs", EntityNPCInterface.class);
|
||||||
|
|
||||||
HashMap<String,Class<?>> list = new HashMap<String,Class<?>>(EntityList.stringToClassMapping);
|
HashMap<String, Class<?>> list = new HashMap<String, Class<?>>(EntityList.stringToClassMapping);
|
||||||
for(String name : list.keySet()){
|
for (String name : list.keySet()) {
|
||||||
Class<?> cls = list.get(name);
|
Class<?> cls = list.get(name);
|
||||||
if(EntityNPCInterface.class.isAssignableFrom(cls))
|
if (EntityNPCInterface.class.isAssignableFrom(cls))
|
||||||
continue;
|
continue;
|
||||||
if(!EntityLivingBase.class.isAssignableFrom(cls))
|
if (!EntityLivingBase.class.isAssignableFrom(cls))
|
||||||
continue;
|
continue;
|
||||||
SlayMap.put(name.toLowerCase(), list.get(name));
|
SlayMap.put(name.toLowerCase(), list.get(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
SlayMap.remove("monster");
|
SlayMap.remove("monster");
|
||||||
SlayMap.remove("mob");
|
SlayMap.remove("mob");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SubCommand(
|
@SubCommand(
|
||||||
name = "faction",
|
name = "faction",
|
||||||
desc = "Faction operations",
|
desc = "Faction operations",
|
||||||
usage = "<player> <faction> <command>",
|
usage = "<player> <faction> <command>",
|
||||||
permissions = {OpOnly.class, ParamCheck.class}
|
permissions = {OpOnly.class, ParamCheck.class}
|
||||||
)
|
)
|
||||||
public Boolean faction(String[] args) {
|
public Boolean faction(String[] args) {
|
||||||
String playername = args[0];
|
String playername = args[0];
|
||||||
String factionname = args[1];
|
String factionname = args[1];
|
||||||
|
|
||||||
cmdfaction.data = getPlayersData(playername);
|
cmdfaction.data = getPlayersData(playername);
|
||||||
if (cmdfaction.data.isEmpty()) {
|
if (cmdfaction.data.isEmpty()) {
|
||||||
sendmessage(String.format("Unknow player '%s'", playername));
|
sendmessage(String.format("Unknow player '%s'", playername));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try{
|
try {
|
||||||
cmdfaction.selectedFaction = FactionController.getInstance().get(Integer.parseInt(factionname));
|
cmdfaction.selectedFaction = FactionController.getInstance().get(Integer.parseInt(factionname));
|
||||||
}
|
} catch (NumberFormatException e) {
|
||||||
catch(NumberFormatException e){
|
cmdfaction.selectedFaction = FactionController.getInstance().getFactionFromName(factionname); // get faction data
|
||||||
cmdfaction.selectedFaction = FactionController.getInstance().getFactionFromName(factionname); // get faction data
|
}
|
||||||
}
|
if (cmdfaction.selectedFaction == null) {
|
||||||
if (cmdfaction.selectedFaction == null) {
|
sendmessage(String.format("Unknow facion '%s", factionname));
|
||||||
sendmessage(String.format("Unknow facion '%s", factionname));
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
args = Arrays.copyOfRange(args, 2, args.length);
|
||||||
args = Arrays.copyOfRange(args, 2, args.length);
|
cmdfaction.processCommand(this.pcParam, args);
|
||||||
cmdfaction.processCommand(this.pcParam, args);
|
|
||||||
|
for (PlayerData playerdata : cmdfaction.data) {
|
||||||
for(PlayerData playerdata : cmdfaction.data){
|
playerdata.save();
|
||||||
playerdata.savePlayerDataOnFile();
|
}
|
||||||
}
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
@SubCommand(
|
||||||
@SubCommand(
|
desc = "NPC manipulations",
|
||||||
desc="NPC manipulations",
|
usage = "<npc> <command>",
|
||||||
usage="<npc> <command>",
|
permissions = {OpOnly.class, ParamCheck.class}
|
||||||
permissions={OpOnly.class,ParamCheck.class}
|
)
|
||||||
)
|
public boolean npc(String[] args) {
|
||||||
public boolean npc(String[] args){
|
String npcname = args[0].replace("%", " ");
|
||||||
String npcname=args[0].replace("%", " ");
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
args = Arrays.copyOfRange(args, 1, args.length);
|
if (args[0].equalsIgnoreCase("create")) {
|
||||||
if(args[0].equalsIgnoreCase("create")){
|
cmdnpc.processCommand(this.pcParam, new String[]{args[0], npcname});
|
||||||
cmdnpc.processCommand(this.pcParam, new String[]{args[0], npcname});
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
int x = pcParam.getPlayerCoordinates().posX;
|
||||||
int x = pcParam.getPlayerCoordinates().posX;
|
int y = pcParam.getPlayerCoordinates().posY;
|
||||||
int y = pcParam.getPlayerCoordinates().posY;
|
int z = pcParam.getPlayerCoordinates().posZ;
|
||||||
int z = pcParam.getPlayerCoordinates().posZ;
|
List<EntityNPCInterface> list = getNearbeEntityFromPlayer(EntityNPCInterface.class, pcParam.getEntityWorld(), x, y, z, 80);
|
||||||
List<EntityNPCInterface> list = getNearbeEntityFromPlayer(EntityNPCInterface.class, pcParam.getEntityWorld(), x, y, z, 80);
|
EntityNPCInterface closest = null;
|
||||||
EntityNPCInterface closest = null;
|
for (EntityNPCInterface npc : list) {
|
||||||
for (EntityNPCInterface npc : list) {
|
String name = npc.display.name.replace(" ", "_");
|
||||||
String name = npc.display.name.replace(" ", "_");
|
if (name.equalsIgnoreCase(npcname)) {
|
||||||
if (name.equalsIgnoreCase(npcname)){
|
if (closest == null || closest.getDistanceSq(x, y, z) > npc.getDistanceSq(x, y, z))
|
||||||
if(closest == null || closest.getDistanceSq(x, y, z) > npc.getDistanceSq(x, y, z))
|
closest = npc;
|
||||||
closest = npc;
|
}
|
||||||
}
|
}
|
||||||
}
|
if (closest != null) {
|
||||||
if(closest != null){
|
cmdnpc.selectedNpc = closest;
|
||||||
cmdnpc.selectedNpc=closest;
|
cmdnpc.processCommand(this.pcParam, args);
|
||||||
cmdnpc.processCommand(this.pcParam, args);
|
cmdnpc.selectedNpc = null;
|
||||||
cmdnpc.selectedNpc = null;
|
} else
|
||||||
}
|
sendmessage(String.format("NPC '%s' was not found", npcname));
|
||||||
else
|
return true;
|
||||||
sendmessage(String.format("NPC '%s' was not found",npcname));
|
}
|
||||||
return true;
|
|
||||||
}
|
@SubCommand(
|
||||||
|
name = "slay",
|
||||||
@SubCommand(
|
desc = "Kills given entity within range. Also has all, mobs, animal options. Can have multiple types",
|
||||||
name = "slay",
|
usage = "<type>.. [range]",
|
||||||
desc = "Kills given entity within range. Also has all, mobs, animal options. Can have multiple types",
|
permissions = {PlayerOnly.class, OpOnly.class, ParamCheck.class}
|
||||||
usage = "<type>.. [range]",
|
)
|
||||||
permissions = {PlayerOnly.class, OpOnly.class, ParamCheck.class}
|
public Boolean slay(String[] args) {
|
||||||
)
|
EntityPlayerMP player = (EntityPlayerMP) pcParam;
|
||||||
public Boolean slay(String[] args) {
|
|
||||||
EntityPlayerMP player = (EntityPlayerMP) pcParam;
|
|
||||||
ArrayList<Class<?>> toDelete = new ArrayList<Class<?>>();
|
ArrayList<Class<?>> toDelete = new ArrayList<Class<?>>();
|
||||||
boolean deleteNPCs = false;
|
boolean deleteNPCs = false;
|
||||||
for(String delete : args){
|
for (String delete : args) {
|
||||||
delete = delete.toLowerCase();
|
delete = delete.toLowerCase();
|
||||||
Class<?> cls = SlayMap.get(delete);
|
Class<?> cls = SlayMap.get(delete);
|
||||||
if(cls != null)
|
if (cls != null)
|
||||||
toDelete.add(cls);
|
toDelete.add(cls);
|
||||||
if(delete.equals("mobs")){
|
if (delete.equals("mobs")) {
|
||||||
toDelete.add(EntityGhast.class);
|
toDelete.add(EntityGhast.class);
|
||||||
toDelete.add(EntityDragon.class);
|
toDelete.add(EntityDragon.class);
|
||||||
}
|
}
|
||||||
if(delete.equals("npcs"))
|
if (delete.equals("npcs"))
|
||||||
deleteNPCs = true;
|
deleteNPCs = true;
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int range = 120;
|
int range = 120;
|
||||||
try{
|
try {
|
||||||
range = Integer.parseInt(args[args.length - 1]);
|
range = Integer.parseInt(args[args.length - 1]);
|
||||||
}
|
} catch (NumberFormatException ex) {
|
||||||
catch(NumberFormatException ex){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
AxisAlignedBB box = player.boundingBox.expand(range, range, range);
|
AxisAlignedBB box = player.boundingBox.expand(range, range, range);
|
||||||
List<Entity> list = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, box);
|
List<Entity> list = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, box);
|
||||||
|
|
||||||
for(Entity entity : list){
|
for (Entity entity : list) {
|
||||||
if(entity instanceof EntityPlayer)
|
if (entity instanceof EntityPlayer)
|
||||||
continue;
|
continue;
|
||||||
if(entity instanceof EntityTameable && ((EntityTameable)entity).isTamed())
|
if (entity instanceof EntityTameable && ((EntityTameable) entity).isTamed())
|
||||||
continue;
|
continue;
|
||||||
if(entity instanceof EntityNPCInterface && !deleteNPCs)
|
if (entity instanceof EntityNPCInterface && !deleteNPCs)
|
||||||
continue;
|
continue;
|
||||||
if(delete(entity,toDelete))
|
if (delete(entity, toDelete))
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if(toDelete.contains(EntityXPOrb.class)){
|
if (toDelete.contains(EntityXPOrb.class)) {
|
||||||
list = player.worldObj.getEntitiesWithinAABB(EntityXPOrb.class, box);
|
list = player.worldObj.getEntitiesWithinAABB(EntityXPOrb.class, box);
|
||||||
for(Entity entity : list){
|
for (Entity entity : list) {
|
||||||
entity.isDead = true;
|
entity.isDead = true;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(toDelete.contains(EntityItem.class)){
|
if (toDelete.contains(EntityItem.class)) {
|
||||||
list = player.worldObj.getEntitiesWithinAABB(EntityItem.class, box);
|
list = player.worldObj.getEntitiesWithinAABB(EntityItem.class, box);
|
||||||
for(Entity entity : list){
|
for (Entity entity : list) {
|
||||||
entity.isDead = true;
|
entity.isDead = true;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.addChatMessage(new ChatComponentTranslation(count + " entities deleted"));
|
player.addChatMessage(new ChatComponentTranslation(count + " entities deleted"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean delete(Entity entity, ArrayList<Class<?>> toDelete) {
|
private boolean delete(Entity entity, ArrayList<Class<?>> toDelete) {
|
||||||
for(Class<?> delete : toDelete){
|
for (Class<?> delete : toDelete) {
|
||||||
if(delete == EntityAnimal.class && (entity instanceof EntityHorse)){
|
if (delete == EntityAnimal.class && (entity instanceof EntityHorse)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(delete.isAssignableFrom(entity.getClass())){
|
if (delete.isAssignableFrom(entity.getClass())) {
|
||||||
entity.isDead = true;
|
entity.isDead = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -215,53 +212,17 @@ public class CmdNoppes extends ChMcLogger {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List addTabCompletion(ICommandSender par1, String[] args) {
|
public List addTabCompletion(ICommandSender par1, String[] args) {
|
||||||
if(args[0].equalsIgnoreCase("slay")){
|
if (args[0].equalsIgnoreCase("slay")) {
|
||||||
return CommandBase.getListOfStringsMatchingLastWord(args, SlayMap.keySet().toArray(new String[SlayMap.size()]));
|
return CommandBase.getListOfStringsMatchingLastWord(args, SlayMap.keySet().toArray(new String[SlayMap.size()]));
|
||||||
}
|
}
|
||||||
if(args[0].equalsIgnoreCase("npc") && args.length == 3){
|
if (args[0].equalsIgnoreCase("npc") && args.length == 3) {
|
||||||
return cmdnpc.addTabCompletion(par1, Arrays.copyOfRange(args, 1, args.length));
|
return cmdnpc.addTabCompletion(par1, Arrays.copyOfRange(args, 1, args.length));
|
||||||
}
|
}
|
||||||
if(args[0].equalsIgnoreCase("faction") && args.length == 4){
|
if (args[0].equalsIgnoreCase("faction") && args.length == 4) {
|
||||||
return CommandBase.getListOfStringsMatchingLastWord(args, new String[]{"add", "subtract", "set", "reset", "drop", "create"});
|
return CommandBase.getListOfStringsMatchingLastWord(args, new String[]{"add", "subtract", "set", "reset", "drop", "create"});
|
||||||
}
|
}
|
||||||
return super.addTabCompletion(par1, args);
|
return super.addTabCompletion(par1, args);
|
||||||
}
|
}
|
||||||
//<editor-fold desc="--- FoxZ fork (keep it pls)">
|
}
|
||||||
// @SubCommand(
|
|
||||||
// desc = "Save AltPlayerInv",
|
|
||||||
// usage = "{player} {inv}",
|
|
||||||
// permissions={OpOnly.class}
|
|
||||||
// )
|
|
||||||
// public boolean sapi(String[] args) {
|
|
||||||
// EntityPlayer p = getOnlinePlayer(args[0]);
|
|
||||||
// sendmessage(String.format("noppes.sapi:%s %s", args[0], args[1]));
|
|
||||||
// if (p == null) {
|
|
||||||
// sendmessage("noppes.sapi:unkow " + args[0]);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// savePlayerAltInv(p, args[1]);
|
|
||||||
// sendmessage("noppes.sapi:saved");
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @SubCommand(
|
|
||||||
// desc = "Load AltPlayerInv",
|
|
||||||
// usage = "{player} {inv}",
|
|
||||||
// permissions={OpOnly.class}
|
|
||||||
// )
|
|
||||||
// public boolean lapi(String[] args) {
|
|
||||||
// EntityPlayer p = getOnlinePlayer(args[0]);
|
|
||||||
// sendmessage(String.format("noppes.lapi:%s %s", args[0], args[1]));
|
|
||||||
// if (p == null) {
|
|
||||||
// sendmessage("noppes.sapi:unknow " + args[0]);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// loadPlayerAltInv(p, args[1]);
|
|
||||||
// sendmessage("noppes.lapi:loaded");
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//</editor-fold>
|
|
||||||
}
|
|
||||||
@@ -56,7 +56,7 @@ public class CmdQuest extends ChMcLogger{
|
|||||||
continue;
|
continue;
|
||||||
QuestData questdata = new QuestData(quest);
|
QuestData questdata = new QuestData(quest);
|
||||||
playerdata.questData.activeQuests.put(questid, questdata);
|
playerdata.questData.activeQuests.put(questid, questdata);
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
if(playerdata.player != null){
|
if(playerdata.player != null){
|
||||||
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
|
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
|
||||||
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
|
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
|
||||||
@@ -93,7 +93,7 @@ public class CmdQuest extends ChMcLogger{
|
|||||||
}
|
}
|
||||||
for(PlayerData playerdata : data){
|
for(PlayerData playerdata : data){
|
||||||
playerdata.questData.finishedQuests.put(questid, System.currentTimeMillis());
|
playerdata.questData.finishedQuests.put(questid, System.currentTimeMillis());
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ public class CmdQuest extends ChMcLogger{
|
|||||||
}
|
}
|
||||||
for(PlayerData playerdata : data){
|
for(PlayerData playerdata : data){
|
||||||
playerdata.questData.activeQuests.remove(questid);
|
playerdata.questData.activeQuests.remove(questid);
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ public class CmdQuest extends ChMcLogger{
|
|||||||
for(PlayerData playerdata : data){
|
for(PlayerData playerdata : data){
|
||||||
playerdata.questData.activeQuests.remove(questid);
|
playerdata.questData.activeQuests.remove(questid);
|
||||||
playerdata.questData.finishedQuests.remove(questid);
|
playerdata.questData.finishedQuests.remove(questid);
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package foxz.command;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandBase;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import noppes.npcs.api.ICommand;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ScriptedCommand extends CommandBase implements ICommand {
|
||||||
|
private String commandName;
|
||||||
|
private int permissionLevel;
|
||||||
|
private String commandUsage;
|
||||||
|
private ArrayList<String> aliases;
|
||||||
|
|
||||||
|
public ScriptedCommand(String commandName, int permissionLevel) {
|
||||||
|
this.commandName = commandName;
|
||||||
|
this.permissionLevel = permissionLevel;
|
||||||
|
this.commandUsage = "";
|
||||||
|
this.aliases = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommandName(String commandName) {
|
||||||
|
this.commandName = commandName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommandUsage(String commandUsage) {
|
||||||
|
this.commandUsage = commandUsage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissionLevel(int permissionLevel) {
|
||||||
|
this.permissionLevel = permissionLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return this.commandName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandUsage(ICommandSender p_71518_1_) {
|
||||||
|
return this.commandUsage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCommandUsage() {
|
||||||
|
return this.commandUsage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRequiredPermissionLevel()
|
||||||
|
{
|
||||||
|
return this.permissionLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPermissionLevel() { return this.getRequiredPermissionLevel(); }
|
||||||
|
|
||||||
|
public List<?> getCommandAliases() {
|
||||||
|
return this.aliases;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getAliases() {
|
||||||
|
return this.aliases.toArray(new String[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAliases(String... aliases) {
|
||||||
|
this.aliases.addAll(Arrays.asList(aliases));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasAlias(String alias) {
|
||||||
|
return this.aliases.contains(alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAlias(String alias) {
|
||||||
|
this.aliases.remove(alias);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import noppes.npcs.controllers.AnimationController;
|
||||||
|
import noppes.npcs.controllers.PlayerDataController;
|
||||||
|
import noppes.npcs.controllers.data.Animation;
|
||||||
|
import noppes.npcs.controllers.data.PlayerData;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AnimationCommand extends CommandKamkeelBase {
|
||||||
|
|
||||||
|
public Animation selectedAnimation;
|
||||||
|
public List<PlayerData> data;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "animation";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Animation operations";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsage() {
|
||||||
|
return "<player> <subcommand>";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean runSubCommands(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
String playername = args[0];
|
||||||
|
|
||||||
|
data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
throw new CommandException("Unknown player: " + playername);
|
||||||
|
}
|
||||||
|
|
||||||
|
processSubCommand(sender, args[1], Arrays.copyOfRange(args, 2, args.length));
|
||||||
|
data.get(0).animationData.updateClient();
|
||||||
|
data.get(0).save();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(desc = "enable animation")
|
||||||
|
public void on(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
data.get(0).animationData.setEnabled(true);
|
||||||
|
sendMessage(sender, String.format("Animations enabled for Player %s", data.get(0).player.getCommandSenderName()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Set animation",
|
||||||
|
usage = "<animation>"
|
||||||
|
)
|
||||||
|
public void set(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
if(args.length != 1){
|
||||||
|
throw new CommandException("Please include the animation name:" + "<player> set <animation name>");
|
||||||
|
}
|
||||||
|
String animationName = args[0];
|
||||||
|
selectedAnimation = AnimationController.getInstance().getAnimationFromName(animationName);
|
||||||
|
if (selectedAnimation == null) {
|
||||||
|
throw new CommandException("Unknown animation: " + animationName);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.get(0).animationData.setAnimation(selectedAnimation);
|
||||||
|
sendMessage(sender, String.format("Animation %s set for Player %s", selectedAnimation.getName(), data.get(0).player.getCommandSenderName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(desc = "disable animation")
|
||||||
|
public void off(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
data.get(0).animationData.setEnabled(false);
|
||||||
|
sendMessage(sender, String.format("Animations disabled for Player %s", data.get(0).player.getCommandSenderName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(desc = "play animation")
|
||||||
|
public void clear(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
data.get(0).animationData.setEnabled(false);
|
||||||
|
data.get(0).animationData.setAnimation(null);
|
||||||
|
sendMessage(sender, String.format("Animations cleared for Player %s", data.get(0).player.getCommandSenderName()));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,340 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import foxz.utils.Utils;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.command.CommandBase;
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityList;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldServer;
|
||||||
|
import noppes.npcs.controllers.ServerCloneController;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
public class CloneCommand extends CommandKamkeelBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "clone";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Clone operation (server side)";
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Add NPC(s) to clone storage",
|
||||||
|
usage = "<npc> <tab> [clonedname]",
|
||||||
|
permission = 4
|
||||||
|
)
|
||||||
|
public void add(ICommandSender sender, String[] args) {
|
||||||
|
int tab = 0;
|
||||||
|
try{
|
||||||
|
tab = Integer.parseInt(args[1]);
|
||||||
|
if(tab < 0 || tab > 15){
|
||||||
|
sendError(sender, "Tab must be within 1-15");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(NumberFormatException ex){
|
||||||
|
sendError(sender, String.format("Tab is not a number: %s", args[1]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int x = sender.getPlayerCoordinates().posX;
|
||||||
|
int y = sender.getPlayerCoordinates().posY;
|
||||||
|
int z = sender.getPlayerCoordinates().posZ;
|
||||||
|
List<EntityNPCInterface> list = getEntities(EntityNPCInterface.class, sender.getEntityWorld(), x, y, z, 80);
|
||||||
|
for (EntityNPCInterface npc : list) {
|
||||||
|
if (npc.display.getName().equalsIgnoreCase(args[0])) {
|
||||||
|
String name = npc.display.getName();
|
||||||
|
if (args.length > 2) {
|
||||||
|
name = args[2];
|
||||||
|
}
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
if(!npc.writeToNBTOptional(compound))
|
||||||
|
return;
|
||||||
|
ServerCloneController.Instance.addClone(compound, name, tab);
|
||||||
|
sendResult(sender, String.format("Added NPC \u00A7e%s\u00A77 to Tab \u00A7b%d\u00A77", name, tab));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "List NPC from clone storage",
|
||||||
|
usage = "<tab>",
|
||||||
|
permission = 2
|
||||||
|
)
|
||||||
|
public void list(ICommandSender sender, String[] args) {
|
||||||
|
sendMessage(sender, "--- Stored NPCs --- (server side)");
|
||||||
|
int tab = 0;
|
||||||
|
try{
|
||||||
|
tab = Integer.parseInt(args[1]);
|
||||||
|
if(tab < 0 || tab > 15){
|
||||||
|
sendError(sender, "Tab must be within 1-15");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(NumberFormatException ex){
|
||||||
|
sendError(sender, String.format("Tab is not a number: %s", args[1]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String name : ServerCloneController.Instance.getClones(tab)) {
|
||||||
|
sendMessage(sender, name);
|
||||||
|
}
|
||||||
|
sendMessage(sender, "------------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Remove NPC from clone storage",
|
||||||
|
usage = "<name> <tab>",
|
||||||
|
permission = 4
|
||||||
|
)
|
||||||
|
public void del(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
String nametodel = args[0];
|
||||||
|
int tab = 0;
|
||||||
|
try{
|
||||||
|
tab = Integer.parseInt(args[1]);
|
||||||
|
if(tab < 0 || tab > 15){
|
||||||
|
sendError(sender, String.format("Tab must be within 1-15"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(NumberFormatException ex){
|
||||||
|
sendError(sender, String.format("Tab is not a number: %s", args[1]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean deleted = false;
|
||||||
|
for(String name : ServerCloneController.Instance.getClones(tab)){
|
||||||
|
if(nametodel.equalsIgnoreCase(name)){
|
||||||
|
ServerCloneController.Instance.removeClone(name, tab);
|
||||||
|
deleted = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ServerCloneController.Instance.removeClone(nametodel, tab)) {
|
||||||
|
sendError(sender, String.format("NPC '%s' was not found", nametodel));
|
||||||
|
} else {
|
||||||
|
sendResult(sender, String.format("Removed NPC \u00A7e%s\u00A77 from Tab \u00A7b%d\u00A77", nametodel, tab));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Spawn cloned NPC",
|
||||||
|
usage = "<name> <tab> [[world:]x,y,z]] [newname]",
|
||||||
|
permission = 2
|
||||||
|
)
|
||||||
|
public void spawn(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
String name = args[0].replaceAll("%", " "); // if name of npc separed by space, user must use % in place of space
|
||||||
|
int tab = 0;
|
||||||
|
try{
|
||||||
|
tab = Integer.parseInt(args[1]);
|
||||||
|
if(tab < 0 || tab > 15){
|
||||||
|
sendError(sender, String.format("Tab must be within 1-15"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(NumberFormatException ex){
|
||||||
|
sendError(sender, String.format("Tab is not a number: %s", args[1]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String newname=null;
|
||||||
|
NBTTagCompound compound = ServerCloneController.Instance.getCloneData(sender, name, tab);
|
||||||
|
if(compound == null){
|
||||||
|
sendError(sender, "Unknown npc");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
World world = sender.getEntityWorld();
|
||||||
|
double posX = sender.getPlayerCoordinates().posX;
|
||||||
|
double posY = sender.getPlayerCoordinates().posY;
|
||||||
|
double posZ = sender.getPlayerCoordinates().posZ;
|
||||||
|
|
||||||
|
if(args.length > 2){
|
||||||
|
String location = args[2];
|
||||||
|
String[] par;
|
||||||
|
if (location.contains(":")){
|
||||||
|
par = location.split(":");
|
||||||
|
location = par[1];
|
||||||
|
world = Utils.getWorld(par[0]);
|
||||||
|
if (world == null){
|
||||||
|
sendError(sender, String.format("'%s' is an unknown world", par[0]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (location.contains(",")){
|
||||||
|
par = location.split(",");
|
||||||
|
if (par.length != 3){
|
||||||
|
sendError(sender, "Location need be x,y,z");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
posX = CommandBase.func_110666_a(sender, posX, par[0]);
|
||||||
|
posY = CommandBase.func_110665_a(sender, posY, par[1].trim(), 0, 0);
|
||||||
|
posZ = CommandBase.func_110666_a(sender, posZ, par[2]);
|
||||||
|
} catch(NumberFormatException ex){
|
||||||
|
sendError(sender, "Location should be in numbers");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (args.length > 3){
|
||||||
|
newname = args[3];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newname = location;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (posX == 0 && posY == 0 && posZ == 0){//incase it was called from the console and not pos was given
|
||||||
|
sendError(sender, "Location needed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity entity = EntityList.createEntityFromNBT(compound, world);
|
||||||
|
entity.setPosition(posX + 0.5, posY + 1, posZ + 0.5);
|
||||||
|
if(entity instanceof EntityNPCInterface){
|
||||||
|
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||||
|
npc.ai.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)};
|
||||||
|
if(newname != null && !newname.isEmpty())
|
||||||
|
npc.display.name = newname.replaceAll("%", " "); // like name, newname must use % in place of space to keep a logical way
|
||||||
|
}
|
||||||
|
world.spawnEntityInWorld(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Spawn cloned NPC",
|
||||||
|
usage = "<name> <tab> [[world:]x,y,z]] [newname]",
|
||||||
|
permission = 2
|
||||||
|
)
|
||||||
|
public void grid(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
String name = args[0].replaceAll("%", " "); // if name of npc separed by space, user must use % in place of space
|
||||||
|
int tab = 0;
|
||||||
|
try{
|
||||||
|
tab = Integer.parseInt(args[1]);
|
||||||
|
if(tab < 0 || tab > 15){
|
||||||
|
sendError(sender, String.format("Tab must be within 1-15"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(NumberFormatException ex){
|
||||||
|
sendError(sender, String.format("Tab is not a number: %s", args[1]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int width, height;
|
||||||
|
try{
|
||||||
|
width = Integer.parseInt(args[2]);
|
||||||
|
height = Integer.parseInt(args[3]);
|
||||||
|
}
|
||||||
|
catch(NumberFormatException ex){
|
||||||
|
sendError(sender, "length or width was not a number");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String newname=null;
|
||||||
|
NBTTagCompound compound = ServerCloneController.Instance.getCloneData(sender, name, tab);
|
||||||
|
if(compound == null){
|
||||||
|
sendError(sender, "Unknown npc");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
World world = sender.getEntityWorld();
|
||||||
|
double posX = sender.getPlayerCoordinates().posX;
|
||||||
|
double posY = sender.getPlayerCoordinates().posY;
|
||||||
|
double posZ = sender.getPlayerCoordinates().posZ;
|
||||||
|
|
||||||
|
if(args.length > 4){
|
||||||
|
String location = args[4];
|
||||||
|
String[] par;
|
||||||
|
if (location.contains(":")){
|
||||||
|
par = location.split(":");
|
||||||
|
location = par[1];
|
||||||
|
world = Utils.getWorld(par[0]);
|
||||||
|
if (world == null){
|
||||||
|
sendError(sender, String.format("'%s' is an unknown world", par[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (location.contains(",")){
|
||||||
|
par = location.split(",");
|
||||||
|
if (par.length != 3){
|
||||||
|
sendError(sender, "Location need be x,y,z");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
posX = CommandBase.func_110666_a(sender, posX, par[0]);
|
||||||
|
posY = CommandBase.func_110665_a(sender, posY, par[1].trim(), 0, 0);
|
||||||
|
posZ = CommandBase.func_110666_a(sender, posZ, par[2]);
|
||||||
|
} catch(NumberFormatException ex){
|
||||||
|
sendError(sender, "Location should be in numbers");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (args.length > 5){
|
||||||
|
newname = args[5];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newname = location;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (posX == 0 && posY == 0 && posZ == 0){//incase it was called from the console and not pos was given
|
||||||
|
sendError(sender, "Location needed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int x = 0; x < width; x++){
|
||||||
|
for(int z = 0; z < height; z++){
|
||||||
|
Entity entity = EntityList.createEntityFromNBT(compound, world);
|
||||||
|
int xx = MathHelper.floor_double(posX) + x;
|
||||||
|
int yy = Math.max(MathHelper.floor_double(posY) - 2, 1);
|
||||||
|
int zz = MathHelper.floor_double(posZ) + z;
|
||||||
|
|
||||||
|
for(int y = 0; y < 10; y++){
|
||||||
|
Block b = world.getBlock(xx, yy + y, zz);
|
||||||
|
Block b2 = world.getBlock(xx, yy + y + 1, zz);
|
||||||
|
if(b != null && (b2 == null || b2.getCollisionBoundingBoxFromPool(world, xx, yy + y + 1, zz) == null)){
|
||||||
|
yy += y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entity.setPosition(posX + 0.5 + x, yy + 1, posZ + 0.5 + z);
|
||||||
|
if(entity instanceof EntityNPCInterface){
|
||||||
|
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||||
|
npc.ai.startPos = new int[]{xx, yy, zz};
|
||||||
|
if(newname != null && !newname.isEmpty())
|
||||||
|
npc.display.name = newname.replaceAll("%", " "); // like name, newname must use % in place of space to keep a logical way
|
||||||
|
}
|
||||||
|
world.spawnEntityInWorld(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public World getWorld(String t){
|
||||||
|
WorldServer[] ws=MinecraftServer.getServer().worldServers;
|
||||||
|
for (WorldServer w:ws){
|
||||||
|
if (w!=null){
|
||||||
|
if ((w.provider.dimensionId + "").equalsIgnoreCase(t)){
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends Entity> List<T> getEntities(Class<? extends T> cls, World world, int x, int y, int z, int range) {
|
||||||
|
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, range, range);
|
||||||
|
List<T> list = world.getEntitiesWithinAABB(cls, bb);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import kamkeel.developer.Developer;
|
||||||
|
import net.minecraft.command.CommandBase;
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import noppes.npcs.CustomNpcsPermissions;
|
||||||
|
import noppes.npcs.scripted.CustomNPCsException;
|
||||||
|
|
||||||
|
public class CommandKamkeel extends CommandBase{
|
||||||
|
|
||||||
|
public Map<String, CommandKamkeelBase> map = new HashMap<String, CommandKamkeelBase>();
|
||||||
|
public HelpCommand help = new HelpCommand(this);
|
||||||
|
|
||||||
|
public CommandKamkeel(){
|
||||||
|
registerCommand(help);
|
||||||
|
registerCommand(new ScriptCommand());
|
||||||
|
registerCommand(new SlayCommand());
|
||||||
|
registerCommand(new QuestCommand());
|
||||||
|
registerCommand(new DialogCommand());
|
||||||
|
registerCommand(new FactionCommand());
|
||||||
|
registerCommand(new NpcCommand());
|
||||||
|
registerCommand(new CloneCommand());
|
||||||
|
registerCommand(new ConfigCommand());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerCommand(CommandKamkeelBase command){
|
||||||
|
String name = command.getCommandName().toLowerCase();
|
||||||
|
if(map.containsKey(name))
|
||||||
|
throw new CustomNPCsException("Already a subcommand with the name: " + name);
|
||||||
|
map.put(name, command);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "kamkeel";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandUsage(ICommandSender sender) {
|
||||||
|
return "Use as /kamkeel subcommand";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
if(args.length == 0){
|
||||||
|
help.processCommand(sender, args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandKamkeelBase command = getCommand(args);
|
||||||
|
if(command == null)
|
||||||
|
throw new CommandException("Unknown command " + args[0]);
|
||||||
|
|
||||||
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
|
if(command.subcommands.isEmpty() || !command.runSubCommands()){
|
||||||
|
if(!canSendCommand(sender, command))
|
||||||
|
throw new CommandException("You are not allowed to use this command: " + command);
|
||||||
|
command.canRun(sender, command.getUsage(), args);
|
||||||
|
command.processCommand(sender, args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length == 0){
|
||||||
|
help.processCommand(sender, new String[]{command.getCommandName()});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
command.processSubCommand(sender, args[0], Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List addTabCompletionOptions(ICommandSender sender, String[] args){
|
||||||
|
if(args.length == 1)
|
||||||
|
return CommandBase.getListOfStringsMatchingLastWord(args, map.keySet().toArray(new String[map.size()]));
|
||||||
|
CommandKamkeelBase command = getCommand(args);
|
||||||
|
if(command == null)
|
||||||
|
return null;
|
||||||
|
if(args.length == 2 && command.runSubCommands())
|
||||||
|
return CommandBase.getListOfStringsMatchingLastWord(args, command.subcommands.keySet().toArray(new String[command.subcommands.keySet().size()]));
|
||||||
|
String[] useArgs = command.getUsage().split(" ");
|
||||||
|
if(command.runSubCommands()) {
|
||||||
|
Method m = command.subcommands.get(args[1].toLowerCase());
|
||||||
|
if(m != null) {
|
||||||
|
useArgs = m.getAnnotation(CommandKamkeelBase.SubCommand.class).usage().split(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(args.length <= useArgs.length + 2) {
|
||||||
|
if(args.length - 3 >= 0){
|
||||||
|
String usage = useArgs[args.length - 3];
|
||||||
|
if(usage.equals("<player>") || usage.equals("[player]")) {
|
||||||
|
return CommandBase.getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return command.addTabCompletionOptions(sender, Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommandKamkeelBase getCommand(String[] args){
|
||||||
|
if(args.length == 0)
|
||||||
|
return null;
|
||||||
|
return map.get(args[0].toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRequiredPermissionLevel(){
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCommandPermission(String command){
|
||||||
|
return "cnpc.kamkeel." + command.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUniversalPermission(){
|
||||||
|
return "cnpc.kamkeel.*";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean canSendCommand(ICommandSender sender, CommandKamkeelBase command){
|
||||||
|
if(sender.canCommandSenderUseCommand(command.getRequiredPermissionLevel(), getUniversalPermission())){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sender.canCommandSenderUseCommand(command.getRequiredPermissionLevel(), getCommandPermission(command.getCommandName()))){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sender instanceof EntityPlayer){
|
||||||
|
return CustomNpcsPermissions.hasCustomPermission((EntityPlayer) sender, getCommandPermission(command.getCommandName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import kamkeel.developer.Developer;
|
||||||
|
import net.minecraft.command.CommandBase;
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.util.ChatComponentTranslation;
|
||||||
|
import noppes.npcs.CustomNpcsPermissions;
|
||||||
|
|
||||||
|
public abstract class CommandKamkeelBase extends CommandBase{
|
||||||
|
public Map<String, Method> subcommands = new HashMap<String, Method>();
|
||||||
|
|
||||||
|
public CommandKamkeelBase(){
|
||||||
|
for (Method m : this.getClass().getDeclaredMethods()) {
|
||||||
|
SubCommand sc = m.getAnnotation(SubCommand.class);
|
||||||
|
if (sc != null) {
|
||||||
|
String name = sc.name();
|
||||||
|
if (name.equals(""))
|
||||||
|
name = m.getName();
|
||||||
|
subcommands.put(name.toLowerCase(), m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandUsage(ICommandSender sender) {
|
||||||
|
return getDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract String getDescription();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Should return a string in the format of <arg> <arg2> <arg3> [arg4] where <> is a required parameter and [] optional
|
||||||
|
*/
|
||||||
|
public String getUsage(){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean runSubCommands(){
|
||||||
|
return !subcommands.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void sendMessage(ICommandSender sender, String message, Object... obs) {
|
||||||
|
sender.addChatMessage(new ChatComponentTranslation(message, obs));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void sendResult(ICommandSender sender, String message, Object... obs) {
|
||||||
|
sender.addChatMessage(new ChatComponentTranslation("\u00A76[\u00A7eCNPC+\u00A76]\u00A77 " + message, obs));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void sendError(ICommandSender sender, String message, Object... obs) {
|
||||||
|
sender.addChatMessage(new ChatComponentTranslation("\u00A76[\u00A7eCNPC+\u00A76]\u00A74 Error:\u00A7c " + message, obs));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Retention(value = RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface SubCommand {
|
||||||
|
|
||||||
|
String name() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Should return a string in the format of <arg> <arg2> <arg3> [arg4] where <> is a required parameter and [] optional
|
||||||
|
*/
|
||||||
|
String usage() default "";
|
||||||
|
|
||||||
|
String desc();
|
||||||
|
|
||||||
|
int permission() default 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void processSubCommand(ICommandSender sender, String command, String[] args) throws CommandException {
|
||||||
|
Method m = subcommands.get(command.toLowerCase());
|
||||||
|
if(m == null)
|
||||||
|
throw new CommandException("Unknown subcommand " + command);
|
||||||
|
|
||||||
|
SubCommand sc = m.getAnnotation(SubCommand.class);
|
||||||
|
if(!canSendCommand(sender, sc, command))
|
||||||
|
throw new CommandException("You are not allowed to use this command: " + command);
|
||||||
|
|
||||||
|
canRun(sender, sc.usage(), args);
|
||||||
|
try {
|
||||||
|
m.invoke(this, sender, args);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void canRun(ICommandSender sender, String usage, String[] args) throws CommandException{
|
||||||
|
String[] np = usage.split(" ");
|
||||||
|
List<String> required = new ArrayList<String>();
|
||||||
|
for(int i = 0; i < np.length; i++){
|
||||||
|
String command = np[i];
|
||||||
|
if(command.startsWith("<")){
|
||||||
|
required.add(command);
|
||||||
|
}
|
||||||
|
if(command.equals("<player>") && args.length > i){
|
||||||
|
CommandBase.getPlayer(sender, args[i]); //throws PlayerNotFoundException if no player is found
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (args.length < required.size()) {
|
||||||
|
throw new CommandException("Missing parameter: " + required.get(args.length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRequiredPermissionLevel(){
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubCommandPermission(String subCommand){
|
||||||
|
return "cnpc.kamkeel." + getCommandName().toLowerCase() + "." + subCommand.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubUniversalPermission(){
|
||||||
|
return "cnpc.kamkeel." + getCommandName().toLowerCase() + "*";
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canSendCommand(ICommandSender sender, SubCommand command, String subCommand){
|
||||||
|
if(sender.canCommandSenderUseCommand(command.permission(), getSubUniversalPermission())){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sender.canCommandSenderUseCommand(command.permission(), getSubCommandPermission(subCommand))){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sender instanceof EntityPlayer){
|
||||||
|
return CustomNpcsPermissions.hasCustomPermission((EntityPlayer) sender, getSubCommandPermission(subCommand));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockIce;
|
||||||
|
import net.minecraft.block.BlockLeavesBase;
|
||||||
|
import net.minecraft.block.BlockVine;
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import noppes.npcs.CustomNpcs;
|
||||||
|
import noppes.npcs.Server;
|
||||||
|
import noppes.npcs.config.ConfigMain;
|
||||||
|
import noppes.npcs.constants.EnumPacketClient;
|
||||||
|
import noppes.npcs.controllers.ChunkController;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class ConfigCommand extends CommandKamkeelBase {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "config";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Some config things you can set";
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Disable/Enable the natural leaves decay",
|
||||||
|
usage = "[true/false]",
|
||||||
|
permission = 4
|
||||||
|
)
|
||||||
|
public void leavesdecay(ICommandSender sender, String[] args){
|
||||||
|
if(args.length == 0){
|
||||||
|
sendResult(sender, "LeavesDecay: \u00A7c" + ConfigMain.LeavesDecayEnabled);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ConfigMain.LeavesDecayEnabled = Boolean.parseBoolean(args[0]);
|
||||||
|
ConfigMain.LeavesDecayEnabledProperty.set(ConfigMain.LeavesDecayEnabled);
|
||||||
|
if(ConfigMain.config.hasChanged()){
|
||||||
|
ConfigMain.config.save();
|
||||||
|
}
|
||||||
|
Set<ResourceLocation> names = Block.blockRegistry.getKeys();
|
||||||
|
for(ResourceLocation name : names){
|
||||||
|
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||||
|
if(block instanceof BlockLeavesBase){
|
||||||
|
block.setTickRandomly(ConfigMain.LeavesDecayEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sendResult(sender, "LeavesDecay is now \u00A7c" + ConfigMain.LeavesDecayEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Disable/Enable the vines growing",
|
||||||
|
usage = "[true/false]",
|
||||||
|
permission = 4
|
||||||
|
)
|
||||||
|
public void vinegrowth(ICommandSender sender, String[] args){
|
||||||
|
if(args.length == 0){
|
||||||
|
sendResult(sender, "VineGrowth: \u00A7c" + ConfigMain.VineGrowthEnabled);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ConfigMain.VineGrowthEnabled = Boolean.parseBoolean(args[0]);
|
||||||
|
ConfigMain.VineGrowthEnabledProperty.set(ConfigMain.VineGrowthEnabled);
|
||||||
|
if(ConfigMain.config.hasChanged()){
|
||||||
|
ConfigMain.config.save();
|
||||||
|
}
|
||||||
|
Set<ResourceLocation> names = Block.blockRegistry.getKeys();
|
||||||
|
for(ResourceLocation name : names){
|
||||||
|
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||||
|
if(block instanceof BlockVine){
|
||||||
|
block.setTickRandomly(ConfigMain.VineGrowthEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sendResult(sender, "VineGrowth is now \u00A7c" + ConfigMain.VineGrowthEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Disable/Enable the ice melting",
|
||||||
|
usage = "[true/false]",
|
||||||
|
permission = 4
|
||||||
|
)
|
||||||
|
public void icemelts(ICommandSender sender, String[] args){
|
||||||
|
if(args.length == 0){
|
||||||
|
sendResult(sender, "IceMelts: \u00A7c" + ConfigMain.IceMeltsEnabled);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ConfigMain.IceMeltsEnabled = Boolean.parseBoolean(args[0]);
|
||||||
|
ConfigMain.IceMeltsEnabledProperty.set(ConfigMain.IceMeltsEnabled);
|
||||||
|
if(ConfigMain.config.hasChanged()){
|
||||||
|
ConfigMain.config.save();
|
||||||
|
}
|
||||||
|
Set<ResourceLocation> names = Block.blockRegistry.getKeys();
|
||||||
|
for(ResourceLocation name : names){
|
||||||
|
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||||
|
if(block instanceof BlockIce){
|
||||||
|
block.setTickRandomly(ConfigMain.IceMeltsEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sendResult(sender, "IceMelts is now \u00A7c" + ConfigMain.IceMeltsEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Disable/Enable guns shooting",
|
||||||
|
usage = "[true/false]",
|
||||||
|
permission = 4
|
||||||
|
)
|
||||||
|
public void guns(ICommandSender sender, String[] args){
|
||||||
|
if(args.length == 0){
|
||||||
|
sendResult(sender, "GunsEnabled: \u00A7c" + ConfigMain.GunsEnabled);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ConfigMain.GunsEnabled = Boolean.parseBoolean(args[0]);
|
||||||
|
ConfigMain.GunsEnabledProperty.set(ConfigMain.GunsEnabled);
|
||||||
|
if(ConfigMain.config.hasChanged()){
|
||||||
|
ConfigMain.config.save();
|
||||||
|
}
|
||||||
|
sendResult(sender, "GunsEnabled is now \u00A7c" + ConfigMain.GunsEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Freezes/Unfreezes npcs",
|
||||||
|
usage = "[true/false]",
|
||||||
|
permission = 4
|
||||||
|
)
|
||||||
|
public void freezenpcs(ICommandSender sender, String[] args){
|
||||||
|
if(args.length == 0){
|
||||||
|
sendResult(sender, "Frozen NPCs: \u00A7c" + CustomNpcs.FreezeNPCs);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
CustomNpcs.FreezeNPCs = Boolean.parseBoolean(args[0]);
|
||||||
|
sendResult(sender, "FrozenNPCs is now \u00A7c" + CustomNpcs.FreezeNPCs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Set number of active chunkloaders",
|
||||||
|
usage = "<number>",
|
||||||
|
permission = 4
|
||||||
|
)
|
||||||
|
public void chunkloaders(ICommandSender sender, String[] args) throws CommandException{
|
||||||
|
if(args.length == 0){
|
||||||
|
sendResult(sender, "ChunkLoaders: \u00A7c" + ChunkController.instance.size() + "\u00A77/\u00A7c" + ConfigMain.ChunkLoaders);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
try{
|
||||||
|
ConfigMain.ChunkLoaders = Integer.parseInt(args[0]);
|
||||||
|
}
|
||||||
|
catch(NumberFormatException ex){
|
||||||
|
sendError(sender, "Did not get a number: " + args[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConfigMain.ChunkLoadersProperty.set(ConfigMain.ChunkLoaders);
|
||||||
|
if(ConfigMain.config.hasChanged()){
|
||||||
|
ConfigMain.config.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
int size = ChunkController.instance.size();
|
||||||
|
if(size > ConfigMain.ChunkLoaders){
|
||||||
|
ChunkController.instance.unload(size - ConfigMain.ChunkLoaders);
|
||||||
|
sendResult(sender, size - ConfigMain.ChunkLoaders + " chunksloaders unloaded");
|
||||||
|
}
|
||||||
|
sendResult(sender, "ChunkLoaders: \u00A7c" + ChunkController.instance.size() + "\u00A77/\u00A7c" + ConfigMain.ChunkLoaders);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Get/Set font",
|
||||||
|
usage = "[type] [size]",
|
||||||
|
permission = 4
|
||||||
|
)
|
||||||
|
public void font(ICommandSender sender, String[] args){
|
||||||
|
if(!(sender instanceof EntityPlayerMP))
|
||||||
|
return;
|
||||||
|
int size = 18;
|
||||||
|
if(args.length > 1){
|
||||||
|
try{
|
||||||
|
size = Integer.parseInt(args[args.length - 1]);
|
||||||
|
args = Arrays.copyOfRange(args, 0, args.length - 1);
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String font = "";
|
||||||
|
for(int i = 0; i < args.length; i++){
|
||||||
|
font += " " + args[i];
|
||||||
|
}
|
||||||
|
Server.sendData((EntityPlayerMP)sender, EnumPacketClient.CONFIG, 0, font.trim(), size);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandBase;
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import noppes.npcs.NoppesUtilServer;
|
||||||
|
import noppes.npcs.client.EntityUtil;
|
||||||
|
import noppes.npcs.controllers.DialogController;
|
||||||
|
|
||||||
|
import noppes.npcs.controllers.PlayerDataController;
|
||||||
|
import noppes.npcs.controllers.data.Dialog;
|
||||||
|
import noppes.npcs.controllers.data.DialogOption;
|
||||||
|
import noppes.npcs.controllers.data.PlayerData;
|
||||||
|
import noppes.npcs.entity.EntityDialogNpc;
|
||||||
|
|
||||||
|
public class DialogCommand extends CommandKamkeelBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "dialog";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Dialog operations";
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "force read",
|
||||||
|
usage = "<player> <dialog>"
|
||||||
|
)
|
||||||
|
public void read(ICommandSender sender, String args[]) throws CommandException{
|
||||||
|
String playername=args[0];
|
||||||
|
int diagid;
|
||||||
|
try {
|
||||||
|
diagid = Integer.parseInt(args[1]);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
sendError(sender, "DialogID must be an integer: " + args[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
sendError(sender, "Unknown player: " + playername);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
playerdata.dialogData.dialogsRead.add(diagid);
|
||||||
|
playerdata.save();
|
||||||
|
sendResult(sender, String.format("Forced Read for Dialog \u00A7e%d\u00A77 for Player '\u00A7b%s\u00A77'", diagid, playerdata.playername));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "force unread dialog",
|
||||||
|
usage = "<player> <dialog>"
|
||||||
|
)
|
||||||
|
public void unread(ICommandSender sender, String args[]) throws CommandException{
|
||||||
|
String playername=args[0];
|
||||||
|
int diagid;
|
||||||
|
try {
|
||||||
|
diagid = Integer.parseInt(args[1]);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
sendError(sender, "DialogID must be an integer: " + args[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
sendError(sender, "Unknown player: " + playername);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
playerdata.dialogData.dialogsRead.remove(diagid);
|
||||||
|
playerdata.save();
|
||||||
|
sendResult(sender, String.format("Forced Unread for Dialog \u00A7e%d\u00A77 for Player '\u00A7b%s\u00A77'", diagid, playerdata.playername));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@SubCommand(
|
||||||
|
desc="reload dialogs from disk",
|
||||||
|
permission = 4
|
||||||
|
)
|
||||||
|
public void reload(ICommandSender sender, String args[]){
|
||||||
|
new DialogController();
|
||||||
|
sendResult(sender, "Dialogs Reloaded");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc="show dialog",
|
||||||
|
usage="<player> <dialog> <name>"
|
||||||
|
)
|
||||||
|
public void show(ICommandSender sender, String args[]) throws CommandException{
|
||||||
|
EntityPlayer player = CommandBase.getPlayer(sender, args[0]);
|
||||||
|
if(player == null){
|
||||||
|
sendError(sender, "Unknown player: " + args[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int diagid;
|
||||||
|
try {
|
||||||
|
diagid = Integer.parseInt(args[1]);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
sendError(sender, "DialogID must be an integer: " + args[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Dialog dialog = DialogController.instance.dialogs.get(diagid);
|
||||||
|
if(dialog == null){
|
||||||
|
sendError(sender, "Unknown dialog id: " + args[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityDialogNpc npc = new EntityDialogNpc(sender.getEntityWorld());
|
||||||
|
npc.display.setName(args[2]);
|
||||||
|
EntityUtil.Copy(player, npc);
|
||||||
|
DialogOption option = new DialogOption();
|
||||||
|
option.dialogId = diagid;
|
||||||
|
option.title = dialog.title;
|
||||||
|
npc.dialogs.put(0, option);
|
||||||
|
NoppesUtilServer.openDialog(player, npc, dialog, 0);
|
||||||
|
sendResult(sender, String.format("Displayed Dialog \u00A7e%d\u00A77 to Player '\u00A7b%s\u00A77'", diagid, player.getCommandSenderName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandBase;
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import noppes.npcs.controllers.FactionController;
|
||||||
|
import noppes.npcs.controllers.PlayerDataController;
|
||||||
|
import noppes.npcs.controllers.data.Faction;
|
||||||
|
import noppes.npcs.controllers.data.PlayerData;
|
||||||
|
import noppes.npcs.controllers.data.PlayerFactionData;
|
||||||
|
|
||||||
|
public class FactionCommand extends CommandKamkeelBase {
|
||||||
|
|
||||||
|
public Faction selectedFaction;
|
||||||
|
public List<PlayerData> data;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "faction";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Faction operations";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsage() {
|
||||||
|
return "<player> <faction> <command>";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean runSubCommands(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
String playername = args[0];
|
||||||
|
String factionname = args[1];
|
||||||
|
|
||||||
|
data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
sendError(sender, "Unknown player: " + playername);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
selectedFaction = FactionController.getInstance().getFaction(Integer.parseInt(factionname));
|
||||||
|
}
|
||||||
|
catch(NumberFormatException e){
|
||||||
|
selectedFaction = FactionController.getInstance().getFactionFromName(factionname);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedFaction == null) {
|
||||||
|
sendError(sender, "Unknown faction: " + factionname);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
processSubCommand(sender, args[2], Arrays.copyOfRange(args, 3, args.length));
|
||||||
|
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
playerdata.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Add points",
|
||||||
|
usage = "<points>"
|
||||||
|
)
|
||||||
|
public void add(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
int points;
|
||||||
|
try {
|
||||||
|
points = Integer.parseInt(args[0]);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
sendError(sender, "Must be an integer: " + args[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int factionid = this.selectedFaction.id;
|
||||||
|
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
PlayerFactionData playerfactiondata = playerdata.factionData;
|
||||||
|
playerfactiondata.increasePoints(factionid, points, playerdata.player);
|
||||||
|
sendResult(sender, String.format("Added Points \u00A7a%d\u00A77, Faction \u00A7e%s (%d)\u00A77 for Player \u00A7b%s\u00A77", points, this.selectedFaction.getName(), this.selectedFaction.id, playerdata.playername));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Substract points",
|
||||||
|
usage = "<points>"
|
||||||
|
)
|
||||||
|
public void subtract(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
int points;
|
||||||
|
try {
|
||||||
|
points = Integer.parseInt(args[0]);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
sendError(sender, "Must be an integer: " + args[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int factionid = this.selectedFaction.id;
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
PlayerFactionData playerfactiondata = playerdata.factionData;
|
||||||
|
playerfactiondata.increasePoints(factionid, -points, playerdata.player);
|
||||||
|
sendResult(sender, String.format("Subtracted Points \u00A7a%d\u00A77, Faction \u00A7e%s (%d)\u00A77 for Player \u00A7b%s\u00A77", points, this.selectedFaction.getName(), this.selectedFaction.id, playerdata.playername));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(desc = "Reset points to default")
|
||||||
|
public void reset(ICommandSender sender, String[] args) {
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
playerdata.factionData.factionData.put(this.selectedFaction.id, this.selectedFaction.defaultPoints);
|
||||||
|
sendResult(sender, String.format("Reset Faction \u00A7e%s (%d)\u00A77 for Player \u00A7b%s\u00A77", this.selectedFaction.getName(), this.selectedFaction.id, playerdata.playername));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Set points",
|
||||||
|
usage = "<points>"
|
||||||
|
)
|
||||||
|
public void set(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
int points;
|
||||||
|
try {
|
||||||
|
points = Integer.parseInt(args[0]);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
sendError(sender, "Must be an integer: " + args[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
PlayerFactionData playerfactiondata = playerdata.factionData;
|
||||||
|
playerfactiondata.factionData.put(this.selectedFaction.id, points);
|
||||||
|
sendResult(sender, String.format("Set Points \u00A7a%d\u00A77, Faction \u00A7e%s (%d)\u00A77 for Player \u00A7b%s\u00A77", points, this.selectedFaction.getName(), this.selectedFaction.id, playerdata.playername));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(desc = "Drop relationship")
|
||||||
|
public void drop(ICommandSender sender, String[] args){
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
playerdata.factionData.factionData.remove(this.selectedFaction.id);
|
||||||
|
sendResult(sender, String.format("Dropped Faction \u00A7e%s (%d)\u00A77 from Player \u00A7b%s\u00A77", this.selectedFaction.getName(), this.selectedFaction.id, playerdata.playername));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List addTabCompletionOptions(ICommandSender par1, String[] args) {
|
||||||
|
if(args.length == 3){
|
||||||
|
return CommandBase.getListOfStringsMatchingLastWord(args, new String[]{"add", "subtract", "set", "reset", "drop", "create"});
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.util.ChatComponentTranslation;
|
||||||
|
|
||||||
|
public class HelpCommand extends CommandKamkeelBase{
|
||||||
|
private CommandKamkeel parent;
|
||||||
|
|
||||||
|
public HelpCommand(CommandKamkeel parent){
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "help";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "help [command]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
if(args.length == 0){
|
||||||
|
sendMessage(sender, "\u00A78------ \u00A7cKamkeel Commands \u00A78------");
|
||||||
|
for(Entry<String, CommandKamkeelBase> entry : parent.map.entrySet()){
|
||||||
|
sendMessage(sender, "\u00A77> " + "\u00A7e" + entry.getKey() + "\u00A78: \u00A77" + entry.getValue().getCommandUsage(sender));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandKamkeelBase command = parent.getCommand(args);
|
||||||
|
if(command == null){
|
||||||
|
sendError(sender, "Unknown command " + args[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(command.subcommands.isEmpty()){
|
||||||
|
sender.addChatMessage(new ChatComponentTranslation(command.getCommandUsage(sender)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Method m = null;
|
||||||
|
if(args.length > 1){
|
||||||
|
m = command.subcommands.get(args[1].toLowerCase());
|
||||||
|
}
|
||||||
|
if(m == null){
|
||||||
|
sendMessage(sender, "\u00A78------ \u00A7a" + command.getCommandName().toUpperCase() + " SubCommands \u00A78------");
|
||||||
|
sendMessage(sender, "\u00A77Usage: \u00A76" + command.getUsage());
|
||||||
|
for(Entry<String, Method> entry : command.subcommands.entrySet()){
|
||||||
|
sender.addChatMessage(new ChatComponentTranslation("\u00A77> " + "\u00A7e" + entry.getKey() + "\u00A78: \u00A77" + entry.getValue().getAnnotation(SubCommand.class).desc()));
|
||||||
|
}
|
||||||
|
sender.addChatMessage(new ChatComponentTranslation("\u00A78Permission:\u00A77 " + CommandKamkeel.getCommandPermission(command.getCommandName())));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
sendMessage(sender, "\u00A78------ \u00A7b" + command.getCommandName().toUpperCase() + "." + args[1].toUpperCase() + " Command \u00A78------");
|
||||||
|
SubCommand sc = m.getAnnotation(SubCommand.class);
|
||||||
|
sender.addChatMessage(new ChatComponentTranslation("\u00A77" + sc.desc()));
|
||||||
|
if(!sc.usage().isEmpty())
|
||||||
|
sender.addChatMessage(new ChatComponentTranslation("\u00A77Usage: \u00A76" + sc.usage()));
|
||||||
|
sender.addChatMessage(new ChatComponentTranslation("\u00A78Permission:\u00A77 " + getSubCommandPermission(args[1])));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,230 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandBase;
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.command.PlayerNotFoundException;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import noppes.npcs.NoppesUtilServer;
|
||||||
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
|
import noppes.npcs.entity.EntityCustomNpc;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
import noppes.npcs.roles.RoleCompanion;
|
||||||
|
import noppes.npcs.roles.RoleFollower;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
|
public class NpcCommand extends CommandKamkeelBase {
|
||||||
|
|
||||||
|
public EntityNPCInterface selectedNpc;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "npc";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "NPC operation";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsage() {
|
||||||
|
return "<name> <command>";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean runSubCommands(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
String npcname = args[0].replace("%", " ");
|
||||||
|
String command = args[1];
|
||||||
|
args = Arrays.copyOfRange(args, 2, args.length);
|
||||||
|
if(command.equalsIgnoreCase("create")){
|
||||||
|
args = ArrayUtils.add(args, 0, npcname);
|
||||||
|
processSubCommand(sender, command, args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int x = sender.getPlayerCoordinates().posX;
|
||||||
|
int y = sender.getPlayerCoordinates().posY;
|
||||||
|
int z = sender.getPlayerCoordinates().posZ;
|
||||||
|
List<EntityNPCInterface> list = getEntities(EntityNPCInterface.class, sender.getEntityWorld(), x, y, z, 80);
|
||||||
|
for (EntityNPCInterface npc : list) {
|
||||||
|
String name = npc.display.getName().replace(" ", "_");
|
||||||
|
if (name.equalsIgnoreCase(npcname)){
|
||||||
|
if(selectedNpc == null || selectedNpc.getDistanceSq(x, y, z) > npc.getDistanceSq(x, y, z))
|
||||||
|
selectedNpc = npc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(selectedNpc == null){
|
||||||
|
sendError(sender, "Npc " + npcname + " was not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
processSubCommand(sender, command, args);
|
||||||
|
selectedNpc = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Set Home (respawn place)",
|
||||||
|
usage = "[x] [y] [z]"
|
||||||
|
)
|
||||||
|
public void home(ICommandSender sender, String[] args) {
|
||||||
|
double posX = sender.getPlayerCoordinates().posX;
|
||||||
|
double posY = sender.getPlayerCoordinates().posY;
|
||||||
|
double posZ = sender.getPlayerCoordinates().posZ;
|
||||||
|
|
||||||
|
if(args.length == 3){
|
||||||
|
posX = CommandBase.func_110666_a(sender, selectedNpc.posX, args[0]);
|
||||||
|
posY = CommandBase.func_110665_a(sender, selectedNpc.posY, args[1].trim(), 0, 0);
|
||||||
|
posZ = CommandBase.func_110666_a(sender, selectedNpc.posZ, args[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedNpc.ai.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)};
|
||||||
|
sendResult(sender, String.format("Set NPC \u00A7e%s\u00A77 Home to \u00A7b[%.1f] [%.1f] [%.1f]\u00A77", selectedNpc.display.name, posX, posY, posZ));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Set NPC visibility",
|
||||||
|
usage = "[true/false/semi]"
|
||||||
|
)
|
||||||
|
public void visible(ICommandSender sender, String[] args){
|
||||||
|
if(args.length < 1)
|
||||||
|
return;
|
||||||
|
boolean bo = args[0].equalsIgnoreCase("true");
|
||||||
|
boolean semi = args[0].equalsIgnoreCase("semi");
|
||||||
|
|
||||||
|
int current = selectedNpc.display.visible;
|
||||||
|
if(semi)
|
||||||
|
selectedNpc.display.visible = 2;
|
||||||
|
else if(bo)
|
||||||
|
selectedNpc.display.visible = 0;
|
||||||
|
else
|
||||||
|
selectedNpc.display.visible = 1;
|
||||||
|
|
||||||
|
String[] list = new String[]{"True", "False", "Semi"};
|
||||||
|
|
||||||
|
if(current != selectedNpc.display.visible)
|
||||||
|
selectedNpc.updateClient = true;
|
||||||
|
|
||||||
|
sendResult(sender, String.format("Set NPC \u00A7e%s\u00A77 Visibility to \u00A7b%s\u00A77", selectedNpc.display.name, list[selectedNpc.display.visible]));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(desc = "Delete an NPC")
|
||||||
|
public void delete(ICommandSender sender, String[] args){
|
||||||
|
selectedNpc.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Sets the owner of an follower/companion",
|
||||||
|
usage = "[player]"
|
||||||
|
)
|
||||||
|
public void owner(ICommandSender sender, String[] args){
|
||||||
|
if(args.length < 1){
|
||||||
|
EntityPlayer player = null;
|
||||||
|
if(selectedNpc.roleInterface instanceof RoleFollower)
|
||||||
|
player = ((RoleFollower)selectedNpc.roleInterface).owner;
|
||||||
|
|
||||||
|
if(selectedNpc.roleInterface instanceof RoleCompanion)
|
||||||
|
player = ((RoleCompanion)selectedNpc.roleInterface).owner;
|
||||||
|
|
||||||
|
if(player == null)
|
||||||
|
sendResult(sender, String.format("NPC \u00A7e%s\u00A77 Owner: \u00A7b%s\u00A77", selectedNpc.display.name, "NULL"));
|
||||||
|
else
|
||||||
|
sendResult(sender, String.format("NPC \u00A7e%s\u00A77 Owner: \u00A7b%s\u00A77", selectedNpc.display.name, player.getDisplayName()));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
EntityPlayerMP player = null;
|
||||||
|
try {
|
||||||
|
player = CommandBase.getPlayer(sender, args[0]);
|
||||||
|
} catch (PlayerNotFoundException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
if(selectedNpc.roleInterface instanceof RoleFollower)
|
||||||
|
((RoleFollower)selectedNpc.roleInterface).setOwner(player);
|
||||||
|
|
||||||
|
if(selectedNpc.roleInterface instanceof RoleCompanion)
|
||||||
|
((RoleCompanion)selectedNpc.roleInterface).setOwner(player);
|
||||||
|
|
||||||
|
if(player == null)
|
||||||
|
sendResult(sender, String.format("NPC \u00A7e%s\u00A77 Owner: \u00A7b%s\u00A77", selectedNpc.display.name, "NULL"));
|
||||||
|
else
|
||||||
|
sendResult(sender, String.format("NPC \u00A7e%s\u00A77 Owner: \u00A7b%s\u00A77", selectedNpc.display.name, player.getDisplayName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Set NPC name",
|
||||||
|
usage = "[name]"
|
||||||
|
)
|
||||||
|
public void name(ICommandSender sender, String[] args){
|
||||||
|
if(args.length < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
String name = args[0];
|
||||||
|
for(int i = 1; i < args.length; i++){
|
||||||
|
name += " " + args[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
sendResult(sender, String.format("NPC \u00A7e%s\u00A77 Name set to \u00A7b%s\u00A77", selectedNpc.display.name, name));
|
||||||
|
|
||||||
|
if(!selectedNpc.display.getName().equals(name)){
|
||||||
|
selectedNpc.display.setName(name);
|
||||||
|
selectedNpc.updateClient = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Creates an NPC",
|
||||||
|
usage = "[name]"
|
||||||
|
)
|
||||||
|
public void create(ICommandSender sender, String[] args) {
|
||||||
|
EntityPlayerMP player = (EntityPlayerMP) sender;
|
||||||
|
World pw = player.getEntityWorld();
|
||||||
|
EntityCustomNpc npc = new EntityCustomNpc(pw);
|
||||||
|
if(args.length > 0)
|
||||||
|
npc.display.name = args[0];
|
||||||
|
npc.setPositionAndRotation(player.posX, player.posY, player.posZ, player.cameraYaw, player.cameraPitch);
|
||||||
|
npc.ai.startPos = new int[]{MathHelper.floor_double(player.posX),MathHelper.floor_double(player.posY),MathHelper.floor_double(player.posZ)};
|
||||||
|
pw.spawnEntityInWorld(npc);
|
||||||
|
npc.setHealth(npc.getMaxHealth());
|
||||||
|
NoppesUtilServer.sendOpenGui(player, EnumGuiType.MainMenuDisplay, npc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List addTabCompletionOptions(ICommandSender par1, String[] args) {
|
||||||
|
if(args.length == 2){
|
||||||
|
return CommandBase.getListOfStringsMatchingLastWord(args, new String[]{"create", "home", "visible", "delete", "owner", "name"});
|
||||||
|
}
|
||||||
|
if(args.length == 3 && args[1].equalsIgnoreCase("owner")){
|
||||||
|
return CommandBase.getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRequiredPermissionLevel(){
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends Entity> List<T> getEntities(Class<? extends T> cls, World world, int x, int y, int z, int range) {
|
||||||
|
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, range, range);
|
||||||
|
List<T> list = world.getEntitiesWithinAABB(cls, bb);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import noppes.npcs.Server;
|
||||||
|
import noppes.npcs.constants.EnumPacketClient;
|
||||||
|
import noppes.npcs.constants.EnumQuestRepeat;
|
||||||
|
import noppes.npcs.controllers.PlayerDataController;
|
||||||
|
import noppes.npcs.controllers.QuestController;
|
||||||
|
import noppes.npcs.controllers.data.PlayerData;
|
||||||
|
import noppes.npcs.controllers.data.Quest;
|
||||||
|
import noppes.npcs.controllers.data.QuestData;
|
||||||
|
|
||||||
|
public class QuestCommand extends CommandKamkeelBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "quest";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Quest operations";
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Start a quest",
|
||||||
|
usage = "<player> <quest>"
|
||||||
|
)
|
||||||
|
public void start(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
String playername = args[0];
|
||||||
|
int questid;
|
||||||
|
try {
|
||||||
|
questid = Integer.parseInt(args[1]);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
sendError(sender, "QuestID must be an integer: " + args[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||||
|
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
sendError(sender, "Unknown player: " + playername);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Quest quest = QuestController.instance.quests.get(questid);
|
||||||
|
if (quest == null){
|
||||||
|
sendError(sender, "Unknown QuestID: " + questid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
QuestData questdata = new QuestData(quest);
|
||||||
|
playerdata.questData.activeQuests.put(questid, questdata);
|
||||||
|
playerdata.save();
|
||||||
|
if(playerdata.player != null && questdata.sendAlerts){
|
||||||
|
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
|
||||||
|
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
|
||||||
|
}
|
||||||
|
sendResult(sender, String.format("Started Quest \u00A7e%d\u00A77 for Player '\u00A7b%s\u00A77'", questid, playerdata.playername));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Finish a quest",
|
||||||
|
usage = "<player> <quest>"
|
||||||
|
)
|
||||||
|
public void finish(ICommandSender sender, String args[]) throws CommandException{
|
||||||
|
String playername=args[0];
|
||||||
|
int questid;
|
||||||
|
try {
|
||||||
|
questid = Integer.parseInt(args[1]);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ex) {
|
||||||
|
sendError(sender, "QuestID must be an integer: " + args[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
sendError(sender, String.format("Unknown player '%s'", playername));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Quest quest = QuestController.instance.quests.get(questid);
|
||||||
|
if (quest == null){
|
||||||
|
sendError(sender, "Unknown QuestID: " + questid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
if(playerdata.questData.activeQuests.containsKey(questid)){
|
||||||
|
playerdata.questData.activeQuests.remove(questid);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(quest.repeat == EnumQuestRepeat.RLDAILY || quest.repeat == EnumQuestRepeat.RLWEEKLY)
|
||||||
|
playerdata.questData.finishedQuests.put(quest.id, System.currentTimeMillis());
|
||||||
|
else
|
||||||
|
playerdata.questData.finishedQuests.put(quest.id, sender.getEntityWorld().getTotalWorldTime());
|
||||||
|
|
||||||
|
playerdata.save();
|
||||||
|
if(playerdata.player != null){
|
||||||
|
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.MESSAGE, "quest.completed", quest.title);
|
||||||
|
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.CHAT, "quest.completed", ": ", quest.title);
|
||||||
|
}
|
||||||
|
sendResult(sender, String.format("Finished Quest \u00A7e%d\u00A77 for Player '\u00A7b%s\u00A77'", questid, playerdata.playername));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Stop a started quest",
|
||||||
|
usage = "<player> <quest>"
|
||||||
|
)
|
||||||
|
public void stop(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
String playername=args[0];
|
||||||
|
int questid;
|
||||||
|
try {
|
||||||
|
questid = Integer.parseInt(args[1]);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
sendError(sender, "QuestID must be an integer: " + args[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
sendError(sender, String.format("Unknown player '%s'", playername));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Quest quest = QuestController.instance.quests.get(questid);
|
||||||
|
if (quest == null){
|
||||||
|
sendError(sender, "Unknown QuestID: " + questid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
playerdata.questData.activeQuests.remove(questid);
|
||||||
|
playerdata.save();
|
||||||
|
sendResult(sender, String.format("Stopped Quest \u00A7e%d\u00A77 for Player '\u00A7b%s\u00A77'", questid, playerdata.playername));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc = "Removes a quest from finished and active quests",
|
||||||
|
usage = "<player> <quest>"
|
||||||
|
)
|
||||||
|
public void remove(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
String playername=args[0];
|
||||||
|
int questid;
|
||||||
|
try {
|
||||||
|
questid = Integer.parseInt(args[1]);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
sendError(sender, "QuestID must be an integer: " + args[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
sendError(sender, String.format("Unknown player '%s'", playername));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Quest quest = QuestController.instance.quests.get(questid);
|
||||||
|
if (quest == null){
|
||||||
|
sendError(sender, String.format("Unknown QuestID"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(PlayerData playerdata : data){
|
||||||
|
playerdata.questData.activeQuests.remove(questid);
|
||||||
|
playerdata.questData.finishedQuests.remove(questid);
|
||||||
|
playerdata.save();
|
||||||
|
sendResult(sender, String.format("Removed Quest \u00A7e%d\u00A77 for Player '\u00A7b%s\u00A77'", questid, playerdata.playername));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubCommand(
|
||||||
|
desc="reload quests from disk",
|
||||||
|
permission = 4
|
||||||
|
)
|
||||||
|
public void reload(ICommandSender sender, String args[]){
|
||||||
|
new QuestController();
|
||||||
|
QuestController.instance.load();
|
||||||
|
sendResult(sender, "Quests Reloaded");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import noppes.npcs.controllers.ScriptController;
|
||||||
|
|
||||||
|
|
||||||
|
public class ScriptCommand extends CommandKamkeelBase {
|
||||||
|
|
||||||
|
@SubCommand(desc = "Reload scripts data and folders.")
|
||||||
|
public Boolean reload(ICommandSender sender, String args[]) {
|
||||||
|
ScriptController.Instance.loadCategories();
|
||||||
|
|
||||||
|
if(ScriptController.Instance.loadPlayerScripts())
|
||||||
|
sendResult(sender, "Reload player scripts successfully");
|
||||||
|
else
|
||||||
|
sendError(sender, "Failed reloading player scripts");
|
||||||
|
|
||||||
|
if(ScriptController.Instance.loadForgeScripts())
|
||||||
|
sendResult(sender, "Reload forge scripts successfully");
|
||||||
|
else
|
||||||
|
sendError(sender, "Failed reloading forge scripts");
|
||||||
|
|
||||||
|
if(ScriptController.Instance.loadStoredData())
|
||||||
|
sendResult(sender, "Reload stored data successfully");
|
||||||
|
else
|
||||||
|
sendError(sender, "Failed reloading stored data");
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "script";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Commands for scripts";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
package kamkeel.command;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandBase;
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityList;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.boss.EntityDragon;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.item.EntityXPOrb;
|
||||||
|
import net.minecraft.entity.monster.EntityGhast;
|
||||||
|
import net.minecraft.entity.monster.EntityMob;
|
||||||
|
import net.minecraft.entity.passive.EntityAnimal;
|
||||||
|
import net.minecraft.entity.passive.EntityHorse;
|
||||||
|
import net.minecraft.entity.passive.EntityTameable;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
public class SlayCommand extends CommandKamkeelBase {
|
||||||
|
public Map<String, Class<?>> SlayMap = new LinkedHashMap<String, Class<?>>();
|
||||||
|
|
||||||
|
public SlayCommand(){
|
||||||
|
SlayMap.clear();
|
||||||
|
|
||||||
|
SlayMap.put("all",EntityLivingBase.class);
|
||||||
|
SlayMap.put("mobs",EntityMob.class);
|
||||||
|
SlayMap.put("animals", EntityAnimal.class);
|
||||||
|
SlayMap.put("items", EntityItem.class);
|
||||||
|
SlayMap.put("xporbs", EntityXPOrb.class);
|
||||||
|
SlayMap.put("npcs", EntityNPCInterface.class);
|
||||||
|
|
||||||
|
HashMap<String,Class<?>> list = new HashMap<String,Class<?>>(EntityList.stringToClassMapping);
|
||||||
|
for(String name : list.keySet()){
|
||||||
|
Class<?> cls = list.get(name);
|
||||||
|
if(EntityNPCInterface.class.isAssignableFrom(cls))
|
||||||
|
continue;
|
||||||
|
if(!EntityLivingBase.class.isAssignableFrom(cls))
|
||||||
|
continue;
|
||||||
|
SlayMap.put(name.toLowerCase(), list.get(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
SlayMap.remove("monster");
|
||||||
|
SlayMap.remove("mob");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "slay";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Kills given entity within range. Tab to see options.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsage(){
|
||||||
|
return "<type>.. [range]";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
EntityPlayerMP player = (EntityPlayerMP) sender;
|
||||||
|
ArrayList<Class<?>> toDelete = new ArrayList<Class<?>>();
|
||||||
|
boolean deleteNPCs = false;
|
||||||
|
for(String delete : args){
|
||||||
|
delete = delete.toLowerCase();
|
||||||
|
Class<?> cls = SlayMap.get(delete);
|
||||||
|
if(cls != null)
|
||||||
|
toDelete.add(cls);
|
||||||
|
if(delete.equals("mobs")){
|
||||||
|
toDelete.add(EntityGhast.class);
|
||||||
|
toDelete.add(EntityDragon.class);
|
||||||
|
}
|
||||||
|
if(delete.equals("npcs"))
|
||||||
|
deleteNPCs = true;
|
||||||
|
}
|
||||||
|
int count = 0;
|
||||||
|
int range = 120;
|
||||||
|
try{
|
||||||
|
range = Integer.parseInt(args[args.length - 1]);
|
||||||
|
}
|
||||||
|
catch(NumberFormatException ex){
|
||||||
|
|
||||||
|
}
|
||||||
|
AxisAlignedBB box = player.boundingBox.expand(range, range, range);
|
||||||
|
List<? extends Entity> list = sender.getEntityWorld().getEntitiesWithinAABB(EntityLivingBase.class, box);
|
||||||
|
|
||||||
|
for(Entity entity : list){
|
||||||
|
if(entity instanceof EntityPlayer)
|
||||||
|
continue;
|
||||||
|
if(entity instanceof EntityTameable && ((EntityTameable)entity).isTamed())
|
||||||
|
continue;
|
||||||
|
if(entity instanceof EntityNPCInterface && !deleteNPCs)
|
||||||
|
continue;
|
||||||
|
if(delete(entity,toDelete))
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if(toDelete.contains(EntityXPOrb.class)){
|
||||||
|
list = sender.getEntityWorld().getEntitiesWithinAABB(EntityXPOrb.class, box);
|
||||||
|
for(Entity entity : list){
|
||||||
|
entity.isDead = true;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(toDelete.contains(EntityItem.class)){
|
||||||
|
list = sender.getEntityWorld().getEntitiesWithinAABB(EntityItem.class, box);
|
||||||
|
for(Entity entity : list){
|
||||||
|
entity.isDead = true;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sendResult(sender, count + " entities deleted");
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean delete(Entity entity, ArrayList<Class<?>> toDelete) {
|
||||||
|
for(Class<?> delete : toDelete){
|
||||||
|
if(delete == EntityAnimal.class && (entity instanceof EntityHorse)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(delete.isAssignableFrom(entity.getClass())){
|
||||||
|
entity.isDead = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List addTabCompletionOptions(ICommandSender sender, String[] args){
|
||||||
|
return CommandBase.getListOfStringsMatchingLastWord(args, SlayMap.keySet().toArray(new String[SlayMap.size()]));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package kamkeel.developer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class Developer {
|
||||||
|
|
||||||
|
public static HashSet<UUID> Universal = new HashSet<>();
|
||||||
|
public static HashSet<UUID> ScriptUser = new HashSet<>();
|
||||||
|
public static HashSet<UUID> WandUser = new HashSet<>();
|
||||||
|
public static HashSet<UUID> QuestMaker = new HashSet<>();
|
||||||
|
public static Developer instance;
|
||||||
|
|
||||||
|
public Developer(){
|
||||||
|
instance = this;
|
||||||
|
// Temp for testing
|
||||||
|
Universal.add(UUID.fromString("29cc52dd-2c50-4e8f-a388-be6c497cf0b4"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasUniversal(UUID uuid){
|
||||||
|
if(Universal == null){
|
||||||
|
Universal = new HashSet<>();
|
||||||
|
}
|
||||||
|
return Universal.contains(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasScriptUser(UUID uuid){
|
||||||
|
if(ScriptUser == null){
|
||||||
|
ScriptUser = new HashSet<>();
|
||||||
|
}
|
||||||
|
return ScriptUser.contains(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasWandUser(UUID uuid){
|
||||||
|
return WandUser.contains(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasQuestMaker(UUID uuid){
|
||||||
|
return QuestMaker.contains(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package noppes.npcs;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import noppes.npcs.api.handler.data.IAnimationData;
|
||||||
|
import noppes.npcs.api.handler.data.IAnimation;
|
||||||
|
import noppes.npcs.constants.EnumPacketClient;
|
||||||
|
import noppes.npcs.controllers.data.Animation;
|
||||||
|
import noppes.npcs.controllers.data.PlayerData;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
public class AnimationData implements IAnimationData {
|
||||||
|
//Server-side: DataDisplay, PlayerData
|
||||||
|
//Client-side: DataDisplay, EntityPlayer
|
||||||
|
public Object parent;
|
||||||
|
|
||||||
|
public Animation animation;
|
||||||
|
public boolean allowAnimation = false;
|
||||||
|
|
||||||
|
public AnimationData(Object parent){
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateClient() {
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
compound = this.writeToNBT(compound);
|
||||||
|
compound.setTag("Animation",this.animation == null ? new NBTTagCompound() : this.animation.writeToNBT());
|
||||||
|
if (parent instanceof PlayerData) {
|
||||||
|
Server.sendToAll(EnumPacketClient.UPDATE_ANIMATIONS, compound, ((PlayerData) parent).player.getCommandSenderName());
|
||||||
|
} else if (parent instanceof DataDisplay) {
|
||||||
|
compound.setInteger("EntityId",((DataDisplay) parent).npc.getEntityId());
|
||||||
|
Server.sendAssociatedData(((DataDisplay) parent).npc, EnumPacketClient.UPDATE_ANIMATIONS, compound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
if (!this.allowAnimation || this.animation == null || this.animation.currentFrame == this.animation.frames.size() || animation.currentFrame() == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (this.parent instanceof DataDisplay) {
|
||||||
|
EntityNPCInterface npc = ((DataDisplay)this.parent).npc;
|
||||||
|
if (!npc.isEntityAlive())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return animation.whileAttacking && npc.isAttacking() || animation.whileMoving && npc.isWalking() || animation.whileStanding && !npc.isWalking();
|
||||||
|
} else {
|
||||||
|
EntityPlayer player;
|
||||||
|
if (this.parent instanceof PlayerData) {
|
||||||
|
player = ((PlayerData) this.parent).player;
|
||||||
|
} else {
|
||||||
|
player = (EntityPlayer) this.parent;
|
||||||
|
}
|
||||||
|
if (!player.isEntityAlive())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
boolean moving = Math.sqrt(player.motionX*player.motionX + player.motionY*player.motionY + player.motionZ*player.motionZ) != 0.0D;
|
||||||
|
|
||||||
|
return animation.whileAttacking && player.getLastAttackerTime() - player.ticksExisted < 20 || animation.whileMoving && moving || animation.whileStanding && !moving;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||||
|
compound.setBoolean("AllowAnimation", allowAnimation);
|
||||||
|
return compound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readFromNBT(NBTTagCompound compound) {
|
||||||
|
this.allowAnimation = compound.getBoolean("AllowAnimation");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
this.allowAnimation = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean enabled() {
|
||||||
|
return this.allowAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnimation(IAnimation animation) {
|
||||||
|
this.animation = (Animation) animation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IAnimation getAnimation() {
|
||||||
|
return animation;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.IGuiHandler;
|
||||||
import net.minecraft.client.model.ModelBiped;
|
import net.minecraft.client.model.ModelBiped;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -9,13 +10,12 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.stats.Achievement;
|
import net.minecraft.stats.Achievement;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.FakePlayer;
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
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.*;
|
import noppes.npcs.containers.*;
|
||||||
import noppes.npcs.controllers.data.PlayerData;
|
import noppes.npcs.controllers.data.PlayerData;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import cpw.mods.fml.common.network.IGuiHandler;
|
|
||||||
import noppes.npcs.api.IWorld;
|
|
||||||
|
|
||||||
public class CommonProxy implements IGuiHandler {
|
public class CommonProxy implements IGuiHandler {
|
||||||
|
|
||||||
|
|||||||
@@ -1,79 +1,23 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockDispenser;
|
import net.minecraft.block.BlockDispenser;
|
||||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||||
import net.minecraft.dispenser.IBlockSource;
|
import net.minecraft.dispenser.IBlockSource;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.*;
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
import net.minecraft.item.Item.ToolMaterial;
|
||||||
import net.minecraft.item.ItemArmor;
|
|
||||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraft.item.ItemFlintAndSteel;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraftforge.common.util.EnumHelper;
|
import net.minecraftforge.common.util.EnumHelper;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import noppes.npcs.blocks.BlockBanner;
|
import noppes.npcs.blocks.*;
|
||||||
import noppes.npcs.blocks.BlockBarrel;
|
import noppes.npcs.blocks.tiles.*;
|
||||||
import noppes.npcs.blocks.BlockBeam;
|
import noppes.npcs.config.ConfigMain;
|
||||||
import noppes.npcs.blocks.BlockBigSign;
|
|
||||||
import noppes.npcs.blocks.BlockBlood;
|
|
||||||
import noppes.npcs.blocks.BlockBook;
|
|
||||||
import noppes.npcs.blocks.BlockBorder;
|
|
||||||
import noppes.npcs.blocks.BlockCampfire;
|
|
||||||
import noppes.npcs.blocks.BlockCandle;
|
|
||||||
import noppes.npcs.blocks.BlockCarpentryBench;
|
|
||||||
import noppes.npcs.blocks.BlockChair;
|
|
||||||
import noppes.npcs.blocks.BlockCouchWood;
|
|
||||||
import noppes.npcs.blocks.BlockCouchWool;
|
|
||||||
import noppes.npcs.blocks.BlockCrate;
|
|
||||||
import noppes.npcs.blocks.BlockCrystal;
|
|
||||||
import noppes.npcs.blocks.BlockLamp;
|
|
||||||
import noppes.npcs.blocks.BlockMailbox;
|
|
||||||
import noppes.npcs.blocks.BlockNpcRedstone;
|
|
||||||
import noppes.npcs.blocks.BlockPedestal;
|
|
||||||
import noppes.npcs.blocks.BlockPlaceholder;
|
|
||||||
import noppes.npcs.blocks.BlockShelf;
|
|
||||||
import noppes.npcs.blocks.BlockSign;
|
|
||||||
import noppes.npcs.blocks.BlockStool;
|
|
||||||
import noppes.npcs.blocks.BlockTable;
|
|
||||||
import noppes.npcs.blocks.BlockTallLamp;
|
|
||||||
import noppes.npcs.blocks.BlockTombstone;
|
|
||||||
import noppes.npcs.blocks.BlockWallBanner;
|
|
||||||
import noppes.npcs.blocks.BlockWaypoint;
|
|
||||||
import noppes.npcs.blocks.BlockWeaponRack;
|
|
||||||
import noppes.npcs.blocks.tiles.TileBanner;
|
|
||||||
import noppes.npcs.blocks.tiles.TileBarrel;
|
|
||||||
import noppes.npcs.blocks.tiles.TileBeam;
|
|
||||||
import noppes.npcs.blocks.tiles.TileBigSign;
|
|
||||||
import noppes.npcs.blocks.tiles.TileBlockAnvil;
|
|
||||||
import noppes.npcs.blocks.tiles.TileBook;
|
|
||||||
import noppes.npcs.blocks.tiles.TileBorder;
|
|
||||||
import noppes.npcs.blocks.tiles.TileCampfire;
|
|
||||||
import noppes.npcs.blocks.tiles.TileCandle;
|
|
||||||
import noppes.npcs.blocks.tiles.TileChair;
|
|
||||||
import noppes.npcs.blocks.tiles.TileCouchWood;
|
|
||||||
import noppes.npcs.blocks.tiles.TileCouchWool;
|
|
||||||
import noppes.npcs.blocks.tiles.TileCrate;
|
|
||||||
import noppes.npcs.blocks.tiles.TileLamp;
|
|
||||||
import noppes.npcs.blocks.tiles.TileMailbox;
|
|
||||||
import noppes.npcs.blocks.tiles.TilePedestal;
|
|
||||||
import noppes.npcs.blocks.tiles.TileRedstoneBlock;
|
|
||||||
import noppes.npcs.blocks.tiles.TileShelf;
|
|
||||||
import noppes.npcs.blocks.tiles.TileSign;
|
|
||||||
import noppes.npcs.blocks.tiles.TileStool;
|
|
||||||
import noppes.npcs.blocks.tiles.TileTable;
|
|
||||||
import noppes.npcs.blocks.tiles.TileTallLamp;
|
|
||||||
import noppes.npcs.blocks.tiles.TileTombstone;
|
|
||||||
import noppes.npcs.blocks.tiles.TileWallBanner;
|
|
||||||
import noppes.npcs.blocks.tiles.TileWaypoint;
|
|
||||||
import noppes.npcs.blocks.tiles.TileWeaponRack;
|
|
||||||
import noppes.npcs.constants.EnumNpcToolMaterial;
|
import noppes.npcs.constants.EnumNpcToolMaterial;
|
||||||
import noppes.npcs.items.*;
|
import noppes.npcs.items.*;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
|
|
||||||
public class CustomItems {
|
public class CustomItems {
|
||||||
|
|
||||||
@@ -261,7 +205,7 @@ public class CustomItems {
|
|||||||
GameRegistry.registerTileEntity(TileWaypoint.class, "TileWaypoint");
|
GameRegistry.registerTileEntity(TileWaypoint.class, "TileWaypoint");
|
||||||
GameRegistry.registerTileEntity(TileBanner.class, "TileNPCBanner");
|
GameRegistry.registerTileEntity(TileBanner.class, "TileNPCBanner");
|
||||||
|
|
||||||
if(!CustomNpcs.DisableExtraBlock){
|
if(!ConfigMain.DisableExtraBlock){
|
||||||
GameRegistry.registerTileEntity(TileWallBanner.class, "TileNPCWallBanner");
|
GameRegistry.registerTileEntity(TileWallBanner.class, "TileNPCWallBanner");
|
||||||
GameRegistry.registerTileEntity(TileTallLamp.class, "TileNPCTallLamp");
|
GameRegistry.registerTileEntity(TileTallLamp.class, "TileNPCTallLamp");
|
||||||
GameRegistry.registerTileEntity(TileChair.class, "TileNPCChair");
|
GameRegistry.registerTileEntity(TileChair.class, "TileNPCChair");
|
||||||
@@ -324,7 +268,7 @@ public class CustomItems {
|
|||||||
|
|
||||||
((ItemNpcBlock)Item.getItemFromBlock(carpentyBench)).names = new String[]{"tile.npcCarpentyBench", "tile.anvil"};
|
((ItemNpcBlock)Item.getItemFromBlock(carpentyBench)).names = new String[]{"tile.npcCarpentyBench", "tile.anvil"};
|
||||||
|
|
||||||
if(!CustomNpcs.DisableExtraBlock){
|
if(!ConfigMain.DisableExtraBlock){
|
||||||
blood = new BlockBlood().setBlockName("npcBloodBlock").setBlockTextureName("customnpcs:npcBloodBlock").setCreativeTab(tabBlocks);
|
blood = new BlockBlood().setBlockName("npcBloodBlock").setBlockTextureName("customnpcs:npcBloodBlock").setCreativeTab(tabBlocks);
|
||||||
banner = new BlockBanner().setBlockName("npcBanner").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks);
|
banner = new BlockBanner().setBlockName("npcBanner").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks);
|
||||||
wallBanner = new BlockWallBanner().setBlockName("npcWallBanner").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks);
|
wallBanner = new BlockWallBanner().setBlockName("npcWallBanner").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks);
|
||||||
@@ -413,7 +357,7 @@ public class CustomItems {
|
|||||||
clarinet = new ItemMusicClarinet().setUnlocalizedName("npcClarinet").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcClarinet");
|
clarinet = new ItemMusicClarinet().setUnlocalizedName("npcClarinet").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcClarinet");
|
||||||
|
|
||||||
|
|
||||||
if(!CustomNpcs.DisableExtraItems){
|
if(!ConfigMain.DisableExtraItems){
|
||||||
tabArmor = new CreativeTabNpcs("cnpcsa");
|
tabArmor = new CreativeTabNpcs("cnpcsa");
|
||||||
tabWeapon = new CreativeTabNpcs("cnpcsw");
|
tabWeapon = new CreativeTabNpcs("cnpcsw");
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ 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;
|
||||||
import foxz.command.CommandNoppes;
|
import foxz.command.CommandNoppes;
|
||||||
|
import kamkeel.command.CommandKamkeel;
|
||||||
|
import kamkeel.developer.Developer;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockIce;
|
import net.minecraft.block.BlockIce;
|
||||||
import net.minecraft.block.BlockLeavesBase;
|
import net.minecraft.block.BlockLeavesBase;
|
||||||
@@ -16,14 +18,13 @@ import net.minecraft.block.BlockVine;
|
|||||||
import net.minecraft.client.Minecraft;
|
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.player.EntityPlayer;
|
|
||||||
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 nikedemos.markovnames.generators.*;
|
||||||
import noppes.npcs.config.ConfigLoader;
|
import noppes.npcs.config.ConfigMain;
|
||||||
import noppes.npcs.config.ConfigProp;
|
import noppes.npcs.config.LoadConfiguration;
|
||||||
import noppes.npcs.constants.EnumScriptType;
|
import noppes.npcs.config.legacy.LegacyConfig;
|
||||||
import noppes.npcs.controllers.*;
|
import noppes.npcs.controllers.*;
|
||||||
import noppes.npcs.enchants.EnchantInterface;
|
import noppes.npcs.enchants.EnchantInterface;
|
||||||
import noppes.npcs.entity.*;
|
import noppes.npcs.entity.*;
|
||||||
@@ -35,165 +36,23 @@ import java.util.ArrayList;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.7")
|
@Mod(modid = "customnpcs", name = "CustomNPC+", version = "1.8.4")
|
||||||
public class CustomNpcs {
|
public class CustomNpcs {
|
||||||
|
|
||||||
@ConfigProp(info = "Disable Chat Bubbles")
|
|
||||||
public static boolean EnableChatBubbles = true;
|
|
||||||
|
|
||||||
private static int NewEntityStartId = 0;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Enables/Disables ALL scripting. You can still see and write code in the scripter, but these scripts won't run. True by default")
|
|
||||||
public static boolean ScriptingEnabled = true;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Enables/Disables the use of the the ECMA6 Javascript standard instead of ECMA5.1." +
|
|
||||||
"\nEnabling this adds many more features to JS in scripts. Only use if on Java 8 or higher." +
|
|
||||||
"\nNot all ECMA 6 language is supported through this functionality.")
|
|
||||||
public static boolean ScriptingECMA6 = false;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Enables global player event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.")
|
|
||||||
public static boolean GlobalPlayerScripts = true;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Enables global forge event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.")
|
|
||||||
public static boolean GlobalForgeScripts = true;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Enables global NPC scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. False by default, use with caution!")
|
|
||||||
public static boolean GlobalNPCScripts = false;
|
|
||||||
|
|
||||||
@ConfigProp(info = "If scripts are too long (>65535 characters), they normally won't be saved in NBT data.\n" +
|
|
||||||
"This config adds additional compound tags to scripts that need it, so you can store much larger scripts!\n" +
|
|
||||||
"Every additional compound tag adds 65535 more characters to your script length limit. Use incrementally, with caution.")
|
|
||||||
public static int ExpandedScriptLimit = 2;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Enables if Player Information (WAND-USE) should be printed to CustomNPCs Logs. IF on Server \n" +
|
|
||||||
"Logs will only be present SERVER-SIDE only in CustomNPCs-latest, -1, -2, and -3")
|
|
||||||
public static boolean PlayerLogging = false;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Enables if Scripting Information should be printed to CustomNPCs Logs. IF on Server \n" +
|
|
||||||
"Logs will only be present SERVER-SIDE only in CustomNPCs-latest, -1, -2, and -3")
|
|
||||||
public static boolean ScriptLogging = false;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Amount of Messages marked as SPAM [5, 3000]. Lower Number means MORE accurate messages \n" +
|
|
||||||
"This frequency will determine if the log will print a line with [SPAM] to warn the console.")
|
|
||||||
public static int ScriptFrequency = 20;
|
|
||||||
|
|
||||||
@ConfigProp(info = "IN Milliseconds 1s = 1000s. If a recent LOG of the same event is SENT within this threshold it will be ignored.")
|
|
||||||
public static int ScriptIgnoreTime = 2000;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Comma separated list of NPC Script Types that will omit these from the logs,\n" +
|
|
||||||
"INIT,TICK,INTERACT,DIALOG,DAMAGED,KILLED,ATTACK,TARGET,COLLIDE,KILLS,DIALOG_CLOSE,TIMER")
|
|
||||||
public static String ScriptLogIgnoreType = "TICK";
|
|
||||||
|
|
||||||
@ConfigProp(info = "Navigation search range for NPCs. Not recommended to increase if you have a slow pc or on a server. Minimum of 16, maximum of 96.")
|
|
||||||
public static int NpcNavRange = 32;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Size limit for NPCs. Default 100, larger sizes may cause lag on clients and servers that can't take it!")
|
|
||||||
public static int NpcSizeLimit = 100;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Set to true if you want the dialog command option to be able to use op commands like tp etc")
|
|
||||||
public static boolean NpcUseOpCommands = false;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Client sided! Determines where tracking quest info shows up on the screen based on a number from 0 to 8. Default: 3")
|
|
||||||
public static int TrackingInfoAlignment = 3;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Client sided! Offsets the tracking info GUI by this amount in the X direction.")
|
|
||||||
public static int TrackingInfoX = 0;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Client sided! Offsets the tracking info GUI by this amount in the Y direction.")
|
|
||||||
public static int TrackingInfoY = 0;
|
|
||||||
|
|
||||||
@ConfigProp
|
|
||||||
public static boolean InventoryGuiEnabled = true;
|
|
||||||
|
|
||||||
@ConfigProp
|
|
||||||
public static boolean DisableExtraItems = false;
|
|
||||||
@ConfigProp
|
|
||||||
public static boolean DisableExtraBlock = false;
|
|
||||||
|
|
||||||
public static long ticks;
|
|
||||||
|
|
||||||
@SidedProxy(clientSide = "noppes.npcs.client.ClientProxy", serverSide = "noppes.npcs.CommonProxy")
|
@SidedProxy(clientSide = "noppes.npcs.client.ClientProxy", serverSide = "noppes.npcs.CommonProxy")
|
||||||
public static CommonProxy proxy;
|
public static CommonProxy proxy;
|
||||||
|
|
||||||
@ConfigProp(info = "Enables CustomNpcs startup update message")
|
public static File Dir;
|
||||||
public static boolean EnableUpdateChecker = true;
|
|
||||||
|
|
||||||
|
private static int NewEntityStartId = 0;
|
||||||
|
public static long ticks;
|
||||||
public static CustomNpcs instance;
|
public static CustomNpcs instance;
|
||||||
|
|
||||||
public static boolean FreezeNPCs = false;
|
public static boolean FreezeNPCs = false;
|
||||||
|
|
||||||
@ConfigProp(info = "Only ops can create and edit npcs")
|
|
||||||
public static boolean OpsOnly = false;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Only ops can see and edit scripts")
|
|
||||||
public static boolean ScriptOpsOnly = false;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Comma separated list of player UUIDs that can see and edit scripts. If ScriptsOpsOnly is true,\n" +
|
|
||||||
"ops and players with these IDs can see and edit scripts. Example:\n" +
|
|
||||||
"b876ec32-e396-476b-a115-8438d83c67d4,069a79f4-44e9-4726-a5be-fca90e38aaf5,be951074-c7ea-4f02-a725-bf017bc88650\n" +
|
|
||||||
"Get a player's UUID from a site like NameMC or the API IPlayer.getUniqueID() function!\n" +
|
|
||||||
"If left empty and ScriptsOpsOnly is false, anyone can see and edit scripts with a scripter.")
|
|
||||||
public static String ScriptDevIDs = "";
|
|
||||||
|
|
||||||
@ConfigProp(info = "Default interact line. Leave empty to not have one")
|
|
||||||
public static String DefaultInteractLine = "Hello @p";
|
|
||||||
|
|
||||||
@ConfigProp
|
|
||||||
public static boolean DisableEnchants = false;
|
|
||||||
@ConfigProp(info = "Start Id for enchants. IDs can only range from 0-256")
|
|
||||||
public static int EnchantStartId = 100;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Number of chunk loading npcs that can be active at the same time")
|
|
||||||
public static int ChunkLoaders = 20;
|
|
||||||
|
|
||||||
@ConfigProp(info = "The maximum number of images any dialog can hold.")
|
|
||||||
public static int DialogImageLimit = 10;
|
|
||||||
|
|
||||||
@ConfigProp(info = "The maximum number of images any dialog can hold.")
|
|
||||||
public static int SkinOverlayLimit = 10;
|
|
||||||
|
|
||||||
public static File Dir;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Set to false if you want to disable guns")
|
|
||||||
public static boolean GunsEnabled = true;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Enables leaves decay")
|
|
||||||
public static boolean LeavesDecayEnabled = true;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Enables Vine Growth")
|
|
||||||
public static boolean VineGrowthEnabled = true;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Enables Ice Melting")
|
|
||||||
public static boolean IceMeltsEnabled = true;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Normal players can use soulstone on animals")
|
|
||||||
public static boolean SoulStoneAnimals = true;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Normal players can use soulstone on villagers")
|
|
||||||
public static boolean SoulStoneVillagers = false;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Normal players can use soulstone on all npcs")
|
|
||||||
public static boolean SoulStoneNPCs = false;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Normal players can use soulstone on friendly npcs")
|
|
||||||
public static boolean SoulStoneFriendlyNPCs = false;
|
|
||||||
|
|
||||||
@ConfigProp(info="When set to Minecraft it will use minecrafts font, when Default it will use OpenSans. Can only use fonts installed on your PC")
|
|
||||||
public static String FontType = "Default";
|
|
||||||
|
|
||||||
@ConfigProp(info="Font size for custom fonts (doesn't work with minecrafts font)")
|
|
||||||
public static int FontSize = 18;
|
|
||||||
|
|
||||||
@ConfigProp(info = "Enables Overlay Mixins for Conflicts relating to Optifine or other Skin Renderers. If crashes occur, please disable.")
|
|
||||||
public static boolean EntityRendererMixin = true;
|
|
||||||
|
|
||||||
public static FMLEventChannel Channel;
|
public static FMLEventChannel Channel;
|
||||||
public static FMLEventChannel ChannelPlayer;
|
public static FMLEventChannel ChannelPlayer;
|
||||||
|
|
||||||
public static ConfigLoader Config;
|
|
||||||
|
|
||||||
public static ArrayList<UUID> ScriptDevs = new ArrayList<>();
|
|
||||||
|
|
||||||
public static final MarkovGenerator[] MARKOV_GENERATOR = new MarkovGenerator[10];
|
public static final MarkovGenerator[] MARKOV_GENERATOR = new MarkovGenerator[10];
|
||||||
|
|
||||||
public static boolean InitIgnore = false;
|
public static boolean InitIgnore = false;
|
||||||
@@ -209,6 +68,12 @@ public class CustomNpcs {
|
|||||||
public static boolean DialogCloseIgnore = false;
|
public static boolean DialogCloseIgnore = false;
|
||||||
public static boolean TimerIgnore = false;
|
public static boolean TimerIgnore = false;
|
||||||
|
|
||||||
|
public static String configPath;
|
||||||
|
public static String legacyPath;
|
||||||
|
public static boolean legacyExist;
|
||||||
|
|
||||||
|
public static LegacyConfig legacyConfig;
|
||||||
|
|
||||||
public CustomNpcs() {
|
public CustomNpcs() {
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
@@ -228,99 +93,22 @@ public class CustomNpcs {
|
|||||||
Dir = new File(dir, "customnpcs");
|
Dir = new File(dir, "customnpcs");
|
||||||
Dir.mkdir();
|
Dir.mkdir();
|
||||||
|
|
||||||
Config = new ConfigLoader(this.getClass(), new File(dir, "config"), "CustomNpcs");
|
configPath = ev.getModConfigurationDirectory() + File.separator + "CustomNpcPlus";
|
||||||
Config.loadConfig();
|
legacyPath = ev.getModConfigurationDirectory() + "/CustomNpcs.cfg";
|
||||||
|
|
||||||
try {
|
File configDir = new File(configPath);
|
||||||
ScriptDevs.clear();
|
if(!configDir.exists()){
|
||||||
String[] uuidStrings = ScriptDevIDs.split(",");
|
// Convert Legacy Config to New Config if NO Config Folder Exists
|
||||||
for (String s : uuidStrings) {
|
File legacyFile = new File(legacyPath);
|
||||||
ScriptDevs.add(UUID.fromString(s));
|
if(legacyFile.exists()){
|
||||||
|
System.out.println("Loading Legacy Config");
|
||||||
|
legacyExist = true;
|
||||||
|
legacyConfig = new LegacyConfig();
|
||||||
|
legacyConfig.init();
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {}
|
|
||||||
|
|
||||||
if (NpcNavRange < 16) {
|
|
||||||
NpcNavRange = 16;
|
|
||||||
}
|
}
|
||||||
if (NpcNavRange > 96) {
|
configPath += File.separator;
|
||||||
NpcNavRange = 96;
|
LoadConfiguration.init(configPath);
|
||||||
}
|
|
||||||
|
|
||||||
if(NpcSizeLimit < 1)
|
|
||||||
NpcSizeLimit = 1;
|
|
||||||
|
|
||||||
if (DialogImageLimit < 0) {
|
|
||||||
DialogImageLimit = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SkinOverlayLimit < 0) {
|
|
||||||
SkinOverlayLimit = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TrackingInfoAlignment < 0)
|
|
||||||
TrackingInfoAlignment = 0;
|
|
||||||
if (TrackingInfoAlignment > 8)
|
|
||||||
TrackingInfoAlignment = 8;
|
|
||||||
|
|
||||||
if (ExpandedScriptLimit < 0)
|
|
||||||
ExpandedScriptLimit = 0;
|
|
||||||
|
|
||||||
if (ScriptFrequency < 5)
|
|
||||||
ScriptFrequency = 5;
|
|
||||||
if (ScriptFrequency > 3000)
|
|
||||||
ScriptFrequency = 3000;
|
|
||||||
|
|
||||||
if (ScriptIgnoreTime < 0)
|
|
||||||
ScriptIgnoreTime = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] ignoreTypes = ScriptLogIgnoreType.split(",");
|
|
||||||
for (String s : ignoreTypes) {
|
|
||||||
EnumScriptType type = EnumScriptType.valueOfIgnoreCase(s);
|
|
||||||
if(type != null){
|
|
||||||
switch (type){
|
|
||||||
case INIT:
|
|
||||||
InitIgnore = true;
|
|
||||||
break;
|
|
||||||
case TICK:
|
|
||||||
TickIgnore = true;
|
|
||||||
break;
|
|
||||||
case INTERACT:
|
|
||||||
InteractIgnore = true;
|
|
||||||
break;
|
|
||||||
case DIALOG:
|
|
||||||
DialogIgnore = true;
|
|
||||||
break;
|
|
||||||
case DAMAGED:
|
|
||||||
DamagedIgnore = true;
|
|
||||||
break;
|
|
||||||
case KILLED:
|
|
||||||
KilledIgnore = true;
|
|
||||||
break;
|
|
||||||
case ATTACK:
|
|
||||||
AttackIgnore = true;
|
|
||||||
break;
|
|
||||||
case TARGET:
|
|
||||||
TargetIgnore = true;
|
|
||||||
break;
|
|
||||||
case COLLIDE:
|
|
||||||
CollideIgnore = true;
|
|
||||||
break;
|
|
||||||
case KILLS:
|
|
||||||
KillsIgnore = true;
|
|
||||||
break;
|
|
||||||
case DIALOG_CLOSE:
|
|
||||||
DialogCloseIgnore = true;
|
|
||||||
break;
|
|
||||||
case TIMER:
|
|
||||||
TimerIgnore = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception ignored) {}
|
|
||||||
|
|
||||||
EnchantInterface.load();
|
EnchantInterface.load();
|
||||||
CustomItems.load();
|
CustomItems.load();
|
||||||
@@ -379,6 +167,7 @@ public class CustomNpcs {
|
|||||||
ForgeChunkManager.setForcedChunkLoadingCallback(this, new ChunkController());
|
ForgeChunkManager.setForcedChunkLoadingCallback(this, new ChunkController());
|
||||||
|
|
||||||
new CustomNpcsPermissions();
|
new CustomNpcsPermissions();
|
||||||
|
new Developer();
|
||||||
|
|
||||||
PixelmonHelper.load();
|
PixelmonHelper.load();
|
||||||
}
|
}
|
||||||
@@ -405,13 +194,15 @@ public class CustomNpcs {
|
|||||||
new QuestController();
|
new QuestController();
|
||||||
new PlayerDataController();
|
new PlayerDataController();
|
||||||
new FactionController();
|
new FactionController();
|
||||||
|
new TagController();
|
||||||
new TransportController();
|
new TransportController();
|
||||||
new GlobalDataController();
|
new GlobalDataController();
|
||||||
new SpawnController();
|
new SpawnController();
|
||||||
new LinkedNpcController();
|
new LinkedNpcController();
|
||||||
|
new AnimationController();
|
||||||
ScriptController.Instance.loadStoredData();
|
ScriptController.Instance.loadStoredData();
|
||||||
ScriptController.Instance.loadForgeScripts();
|
ScriptController.Instance.loadForgeScripts();
|
||||||
ScriptController.Instance.loadNPCScripts();
|
ScriptController.Instance.loadGlobalNPCScripts();
|
||||||
ScriptController.Instance.loadPlayerScripts();
|
ScriptController.Instance.loadPlayerScripts();
|
||||||
ScriptController.HasStart = false;
|
ScriptController.HasStart = false;
|
||||||
NpcAPI.clearCache();
|
NpcAPI.clearCache();
|
||||||
@@ -420,13 +211,13 @@ public class CustomNpcs {
|
|||||||
for(String name : names){
|
for(String name : names){
|
||||||
Block block = (Block) Block.blockRegistry.getObject(name);
|
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||||
if(block instanceof BlockLeavesBase){
|
if(block instanceof BlockLeavesBase){
|
||||||
block.setTickRandomly(LeavesDecayEnabled);
|
block.setTickRandomly(ConfigMain.LeavesDecayEnabled);
|
||||||
}
|
}
|
||||||
if(block instanceof BlockVine){
|
if(block instanceof BlockVine){
|
||||||
block.setTickRandomly(VineGrowthEnabled);
|
block.setTickRandomly(ConfigMain.VineGrowthEnabled);
|
||||||
}
|
}
|
||||||
if(block instanceof BlockIce){
|
if(block instanceof BlockIce){
|
||||||
block.setTickRandomly(IceMeltsEnabled);
|
block.setTickRandomly(ConfigMain.IceMeltsEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -440,17 +231,22 @@ public class CustomNpcs {
|
|||||||
QuestController.instance.load();
|
QuestController.instance.load();
|
||||||
ScriptController.HasStart = true;
|
ScriptController.HasStart = true;
|
||||||
ServerCloneController.Instance = new ServerCloneController();
|
ServerCloneController.Instance = new ServerCloneController();
|
||||||
|
ServerTagMapController.Instance = new ServerTagMapController();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void stopped(FMLServerStoppedEvent event){
|
public void stopped(FMLServerStoppedEvent event){
|
||||||
ServerCloneController.Instance = null;
|
ServerCloneController.Instance = null;
|
||||||
GlobalDataController.instance.saveData();
|
GlobalDataController.instance.saveData();
|
||||||
|
ScriptController.Instance.saveForgeScripts();
|
||||||
|
ScriptController.Instance.savePlayerScripts();
|
||||||
|
ScriptController.Instance.saveGlobalNpcScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void serverstart(FMLServerStartingEvent event) {
|
public void serverstart(FMLServerStartingEvent event) {
|
||||||
event.registerServerCommand(new CommandNoppes());
|
event.registerServerCommand(new CommandNoppes());
|
||||||
|
event.registerServerCommand(new CommandKamkeel());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerNpc(Class<? extends Entity> cl, String name) {
|
private void registerNpc(Class<? extends Entity> cl, String name) {
|
||||||
@@ -508,11 +304,4 @@ public class CustomNpcs {
|
|||||||
public static MinecraftServer getServer(){
|
public static MinecraftServer getServer(){
|
||||||
return MinecraftServer.getServer();
|
return MinecraftServer.getServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isScriptDev(EntityPlayer player) {
|
|
||||||
if(CustomNpcs.ScriptOpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile()) ||
|
|
||||||
ScriptDevs.contains(player.getUniqueID())){
|
|
||||||
return true;
|
|
||||||
} else return ScriptDevIDs.isEmpty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,15 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
|
import kamkeel.developer.Developer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import noppes.npcs.CustomNpcsPermissions.Permission;
|
|
||||||
import noppes.npcs.constants.EnumPacketServer;
|
|
||||||
|
|
||||||
|
|
||||||
public class CustomNpcsPermissions{
|
public class CustomNpcsPermissions{
|
||||||
@@ -38,6 +34,7 @@ public class CustomNpcsPermissions{
|
|||||||
public static final Permission GLOBAL_TRANSPORT = new Permission("customnpcs.global.transport");
|
public static final Permission GLOBAL_TRANSPORT = new Permission("customnpcs.global.transport");
|
||||||
public static final Permission GLOBAL_RECIPE = new Permission("customnpcs.global.recipe");
|
public static final Permission GLOBAL_RECIPE = new Permission("customnpcs.global.recipe");
|
||||||
public static final Permission GLOBAL_NATURALSPAWN = new Permission("customnpcs.global.naturalspawn");
|
public static final Permission GLOBAL_NATURALSPAWN = new Permission("customnpcs.global.naturalspawn");
|
||||||
|
public static final Permission GLOBAL_TAG = new Permission("customnpcs.global.tag");
|
||||||
|
|
||||||
public static final Permission SPAWNER_MOB = new Permission("customnpcs.spawner.mob");
|
public static final Permission SPAWNER_MOB = new Permission("customnpcs.spawner.mob");
|
||||||
public static final Permission SPAWNER_CREATE = new Permission("customnpcs.spawner.create");
|
public static final Permission SPAWNER_CREATE = new Permission("customnpcs.spawner.create");
|
||||||
@@ -78,12 +75,29 @@ public class CustomNpcsPermissions{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasPermission(EntityPlayer player, Permission permission){
|
public static boolean hasPermission(EntityPlayer player, Permission permission){
|
||||||
if(Instance.bukkit != null){
|
if(player != null){
|
||||||
return Instance.bukkitPermission(player.getCommandSenderName(), permission.name);
|
if(Developer.instance.hasUniversal(player.getUniqueID())){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(permission != null){
|
||||||
|
if(Instance.bukkit != null){
|
||||||
|
return Instance.bukkitPermission(player.getCommandSenderName(), permission.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasCustomPermission(EntityPlayer player, String permission){
|
||||||
|
if(Developer.instance.hasUniversal(player.getUniqueID())){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(Instance.bukkit != null){
|
||||||
|
return Instance.bukkitPermission(player.getCommandSenderName(), permission);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean bukkitPermission(String username, String permission) {
|
private boolean bukkitPermission(String username, String permission) {
|
||||||
try {
|
try {
|
||||||
Object player = getPlayer.invoke(null, username);
|
Object player = getPlayer.invoke(null, username);
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes;
|
import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
@@ -12,6 +9,9 @@ import noppes.npcs.constants.EnumNavType;
|
|||||||
import noppes.npcs.constants.EnumStandingType;
|
import noppes.npcs.constants.EnumStandingType;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DataAI {
|
public class DataAI {
|
||||||
private EntityNPCInterface npc;
|
private EntityNPCInterface npc;
|
||||||
|
|
||||||
@@ -256,8 +256,8 @@ public class DataAI {
|
|||||||
return npc.getDistanceSq(pos[0] + 0.5, pos[1], pos[2] + 0.5);
|
return npc.getDistanceSq(pos[0] + 0.5, pos[1], pos[2] + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWalkingSpeed(int speed){
|
public void setWalkingSpeed(double speed){
|
||||||
this.moveSpeed = speed;
|
this.moveSpeed = (int)speed;
|
||||||
npc.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(npc.getSpeed());
|
npc.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(npc.getSpeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.nbt.NBTTagString;
|
||||||
import noppes.npcs.constants.EnumJobType;
|
import noppes.npcs.constants.EnumJobType;
|
||||||
import noppes.npcs.constants.EnumRoleType;
|
import noppes.npcs.constants.EnumRoleType;
|
||||||
import noppes.npcs.controllers.GlobalDataController;
|
import noppes.npcs.controllers.GlobalDataController;
|
||||||
@@ -12,21 +11,11 @@ import noppes.npcs.controllers.data.FactionOptions;
|
|||||||
import noppes.npcs.controllers.data.Line;
|
import noppes.npcs.controllers.data.Line;
|
||||||
import noppes.npcs.controllers.data.Lines;
|
import noppes.npcs.controllers.data.Lines;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import noppes.npcs.roles.JobBard;
|
import noppes.npcs.roles.*;
|
||||||
import noppes.npcs.roles.JobChunkLoader;
|
|
||||||
import noppes.npcs.roles.JobConversation;
|
import java.util.HashMap;
|
||||||
import noppes.npcs.roles.JobFollower;
|
import java.util.HashSet;
|
||||||
import noppes.npcs.roles.JobGuard;
|
import java.util.UUID;
|
||||||
import noppes.npcs.roles.JobHealer;
|
|
||||||
import noppes.npcs.roles.JobItemGiver;
|
|
||||||
import noppes.npcs.roles.JobPuppet;
|
|
||||||
import noppes.npcs.roles.JobSpawner;
|
|
||||||
import noppes.npcs.roles.RoleBank;
|
|
||||||
import noppes.npcs.roles.RoleCompanion;
|
|
||||||
import noppes.npcs.roles.RoleFollower;
|
|
||||||
import noppes.npcs.roles.RolePostman;
|
|
||||||
import noppes.npcs.roles.RoleTrader;
|
|
||||||
import noppes.npcs.roles.RoleTransporter;
|
|
||||||
|
|
||||||
public class DataAdvanced {
|
public class DataAdvanced {
|
||||||
|
|
||||||
@@ -46,6 +35,7 @@ public class DataAdvanced {
|
|||||||
|
|
||||||
private EntityNPCInterface npc;
|
private EntityNPCInterface npc;
|
||||||
public FactionOptions factions = new FactionOptions();
|
public FactionOptions factions = new FactionOptions();
|
||||||
|
public HashSet<UUID> tagUUIDs = new HashSet<>();
|
||||||
|
|
||||||
public EnumRoleType role = EnumRoleType.None;
|
public EnumRoleType role = EnumRoleType.None;
|
||||||
public EnumJobType job = EnumJobType.None;
|
public EnumJobType job = EnumJobType.None;
|
||||||
@@ -92,6 +82,14 @@ public class DataAdvanced {
|
|||||||
compound.setBoolean("RefuseSoulStone", refuseSoulStone);
|
compound.setBoolean("RefuseSoulStone", refuseSoulStone);
|
||||||
compound.setString("SoulStonePlayerName", soulStonePlayerName);
|
compound.setString("SoulStonePlayerName", soulStonePlayerName);
|
||||||
compound.setInteger("MinFactionPointsToSoulStone", minFactionPointsToSoulStone);
|
compound.setInteger("MinFactionPointsToSoulStone", minFactionPointsToSoulStone);
|
||||||
|
|
||||||
|
if(tagUUIDs.size() > 0){
|
||||||
|
NBTTagList nbtTagList = new NBTTagList();
|
||||||
|
for (UUID uuid : tagUUIDs) {
|
||||||
|
nbtTagList.appendTag(new NBTTagString(uuid.toString()));
|
||||||
|
}
|
||||||
|
compound.setTag("TagUUIDs", nbtTagList);
|
||||||
|
}
|
||||||
|
|
||||||
return compound;
|
return compound;
|
||||||
}
|
}
|
||||||
@@ -127,6 +125,13 @@ public class DataAdvanced {
|
|||||||
refuseSoulStone = compound.getBoolean("RefuseSoulStone");
|
refuseSoulStone = compound.getBoolean("RefuseSoulStone");
|
||||||
soulStonePlayerName = compound.getString("SoulStonePlayerName");
|
soulStonePlayerName = compound.getString("SoulStonePlayerName");
|
||||||
minFactionPointsToSoulStone = compound.getInteger("MinFactionPointsToSoulStone");
|
minFactionPointsToSoulStone = compound.getInteger("MinFactionPointsToSoulStone");
|
||||||
|
|
||||||
|
if(compound.hasKey("TagUUIDs")){
|
||||||
|
NBTTagList nbtTagList = compound.getTagList("TagUUIDs",8);
|
||||||
|
for (int i = 0; i < nbtTagList.tagCount(); i++) {
|
||||||
|
tagUUIDs.add(UUID.fromString(nbtTagList.getStringTagAt(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<Integer, DialogOption> getDialogs(NBTTagList tagList) {
|
private HashMap<Integer, DialogOption> getDialogs(NBTTagList tagList) {
|
||||||
@@ -236,8 +241,6 @@ public class DataAdvanced {
|
|||||||
npc.jobInterface = new JobConversation(npc);
|
npc.jobInterface = new JobConversation(npc);
|
||||||
else if (job == EnumJobType.ChunkLoader && !(npc.jobInterface instanceof JobChunkLoader))
|
else if (job == EnumJobType.ChunkLoader && !(npc.jobInterface instanceof JobChunkLoader))
|
||||||
npc.jobInterface = new JobChunkLoader(npc);
|
npc.jobInterface = new JobChunkLoader(npc);
|
||||||
else if (job == EnumJobType.Puppet && !(npc.jobInterface instanceof JobPuppet))
|
|
||||||
npc.jobInterface = new JobPuppet(npc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasWorldLines() {
|
public boolean hasWorldLines() {
|
||||||
|
|||||||
@@ -1,24 +1,26 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.util.*;
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import com.mojang.authlib.properties.Property;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.nbt.NBTTagString;
|
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;
|
||||||
|
import noppes.npcs.config.ConfigMain;
|
||||||
import noppes.npcs.controllers.data.SkinOverlay;
|
import noppes.npcs.controllers.data.SkinOverlay;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import noppes.npcs.entity.data.DataSkinOverlays;
|
import noppes.npcs.entity.data.DataSkinOverlays;
|
||||||
import noppes.npcs.util.ValueUtil;
|
import noppes.npcs.util.ValueUtil;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import java.util.ArrayList;
|
||||||
import com.mojang.authlib.GameProfile;
|
import java.util.Random;
|
||||||
import com.mojang.authlib.properties.Property;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DataDisplay {
|
public class DataDisplay {
|
||||||
EntityNPCInterface npc;
|
public EntityNPCInterface npc;
|
||||||
|
|
||||||
public String name;
|
public String name;
|
||||||
public String title = "";
|
public String title = "";
|
||||||
@@ -37,6 +39,8 @@ public class DataDisplay {
|
|||||||
public DataSkinOverlays skinOverlayData;
|
public DataSkinOverlays skinOverlayData;
|
||||||
public long overlayRenderTicks = 0;
|
public long overlayRenderTicks = 0;
|
||||||
|
|
||||||
|
public AnimationData animationData;
|
||||||
|
|
||||||
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
|
||||||
@@ -61,6 +65,7 @@ public class DataDisplay {
|
|||||||
markovGeneratorId = new Random().nextInt(CustomNpcs.MARKOV_GENERATOR.length-1);
|
markovGeneratorId = new Random().nextInt(CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||||
skinOverlayData = new DataSkinOverlays(npc);
|
skinOverlayData = new DataSkinOverlays(npc);
|
||||||
name = getRandomName();
|
name = getRandomName();
|
||||||
|
animationData = new AnimationData(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRandomName() {
|
public String getRandomName() {
|
||||||
@@ -80,6 +85,8 @@ public class DataDisplay {
|
|||||||
|
|
||||||
nbttagcompound = skinOverlayData.writeToNBT(nbttagcompound);
|
nbttagcompound = skinOverlayData.writeToNBT(nbttagcompound);
|
||||||
|
|
||||||
|
nbttagcompound = animationData.writeToNBT(nbttagcompound);
|
||||||
|
|
||||||
if (this.playerProfile != null)
|
if (this.playerProfile != null)
|
||||||
{
|
{
|
||||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||||
@@ -154,9 +161,11 @@ public class DataDisplay {
|
|||||||
|
|
||||||
skinOverlayData.readFromNBT(nbttagcompound);
|
skinOverlayData.readFromNBT(nbttagcompound);
|
||||||
|
|
||||||
modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE);
|
animationData.readFromNBT(nbttagcompound);
|
||||||
if(modelSize > CustomNpcs.NpcSizeLimit)
|
|
||||||
modelSize = CustomNpcs.NpcSizeLimit;
|
modelSize = ValueUtil.clamp(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE);
|
||||||
|
if(modelSize > ConfigMain.NpcSizeLimit)
|
||||||
|
modelSize = ConfigMain.NpcSizeLimit;
|
||||||
|
|
||||||
modelType = nbttagcompound.getInteger("modelType");
|
modelType = nbttagcompound.getInteger("modelType");
|
||||||
|
|
||||||
@@ -244,7 +253,7 @@ public class DataDisplay {
|
|||||||
public void setMarkovGender(int gender) {
|
public void setMarkovGender(int gender) {
|
||||||
if(markovGender == gender)
|
if(markovGender == gender)
|
||||||
return;
|
return;
|
||||||
this.markovGender = ValueUtil.CorrectInt(gender, 0, 2);
|
this.markovGender = ValueUtil.clamp(gender, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMarkovGeneratorId(){
|
public int getMarkovGeneratorId(){
|
||||||
@@ -254,7 +263,7 @@ public class DataDisplay {
|
|||||||
public void setMarkovGeneratorId(int id) {
|
public void setMarkovGeneratorId(int id) {
|
||||||
if(markovGeneratorId == id)
|
if(markovGeneratorId == id)
|
||||||
return;
|
return;
|
||||||
this.markovGeneratorId = ValueUtil.CorrectInt(id, 0, CustomNpcs.MARKOV_GENERATOR.length-1);
|
this.markovGeneratorId = ValueUtil.clamp(id, 0, CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
@@ -16,6 +13,9 @@ import net.minecraft.util.DamageSource;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class DataInventory implements IInventory{
|
public class DataInventory implements IInventory{
|
||||||
public HashMap<Integer,ItemStack> items = new HashMap<Integer,ItemStack>();
|
public HashMap<Integer,ItemStack> items = new HashMap<Integer,ItemStack>();
|
||||||
public HashMap<Integer,Double> dropchance = new HashMap<Integer,Double>();
|
public HashMap<Integer,Double> dropchance = new HashMap<Integer,Double>();
|
||||||
|
|||||||
@@ -136,10 +136,10 @@ public class DataStats {
|
|||||||
|
|
||||||
rangedRange = compound.getInteger("MaxFiringRange");
|
rangedRange = compound.getInteger("MaxFiringRange");
|
||||||
fireRate = compound.getInteger("FireRate");
|
fireRate = compound.getInteger("FireRate");
|
||||||
minDelay = ValueUtil.CorrectInt(compound.getInteger("minDelay"), 1, 9999);
|
minDelay = ValueUtil.clamp(compound.getInteger("minDelay"), 1, 9999);
|
||||||
maxDelay = ValueUtil.CorrectInt(compound.getInteger("maxDelay"), 1, 9999);
|
maxDelay = ValueUtil.clamp(compound.getInteger("maxDelay"), 1, 9999);
|
||||||
burstCount = compound.getInteger("BurstCount");
|
burstCount = compound.getInteger("BurstCount");
|
||||||
shotCount = ValueUtil.CorrectInt(compound.getInteger("ShotCount"), 1, 10);
|
shotCount = ValueUtil.clamp(compound.getInteger("ShotCount"), 1, 10);
|
||||||
accuracy = compound.getInteger("Accuracy");
|
accuracy = compound.getInteger("Accuracy");
|
||||||
|
|
||||||
pDamage = compound.getFloat("pDamage");
|
pDamage = compound.getFloat("pDamage");
|
||||||
@@ -178,7 +178,7 @@ public class DataStats {
|
|||||||
public float getAttackStrength(){
|
public float getAttackStrength(){
|
||||||
return attackStrength;
|
return attackStrength;
|
||||||
}
|
}
|
||||||
public void setAttackStrength(float strength){
|
public void setAttackStrength(double strength){
|
||||||
attackStrength = (float)(Math.floor(strength));
|
attackStrength = (float)(Math.floor(strength));
|
||||||
npc.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(attackStrength);
|
npc.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(attackStrength);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,33 +15,29 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
|||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.event.entity.EntityEvent;
|
import net.minecraftforge.event.entity.EntityEvent;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
import noppes.npcs.api.IPos;
|
|
||||||
import noppes.npcs.api.IWorld;
|
import noppes.npcs.api.IWorld;
|
||||||
import noppes.npcs.controllers.*;
|
|
||||||
import noppes.npcs.controllers.data.*;
|
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
|
||||||
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.api.entity.IEntity;
|
import noppes.npcs.api.entity.IEntity;
|
||||||
import noppes.npcs.api.entity.IPlayer;
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.entity.IProjectile;
|
||||||
import noppes.npcs.api.gui.ICustomGui;
|
import noppes.npcs.api.gui.ICustomGui;
|
||||||
import noppes.npcs.api.handler.data.INaturalSpawn;
|
import noppes.npcs.api.gui.IItemSlot;
|
||||||
import noppes.npcs.api.item.IItemCustom;
|
import noppes.npcs.api.item.IItemCustom;
|
||||||
import noppes.npcs.api.item.IItemStack;
|
import noppes.npcs.api.item.IItemStack;
|
||||||
import noppes.npcs.scripted.NpcAPI;
|
import noppes.npcs.client.gui.custom.components.CustomGuiSlot;
|
||||||
import noppes.npcs.constants.EnumScriptType;
|
import noppes.npcs.constants.EnumScriptType;
|
||||||
|
import noppes.npcs.controllers.CustomGuiController;
|
||||||
|
import noppes.npcs.controllers.ScriptContainer;
|
||||||
|
import noppes.npcs.controllers.ScriptController;
|
||||||
|
import noppes.npcs.controllers.data.*;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
import noppes.npcs.entity.EntityProjectile;
|
||||||
|
import noppes.npcs.scripted.NpcAPI;
|
||||||
|
import noppes.npcs.scripted.event.*;
|
||||||
|
import noppes.npcs.scripted.event.PlayerEvent.*;
|
||||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -124,7 +120,7 @@ public class EventHooks {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
noppes.npcs.scripted.event.NpcEvent.InitEvent event = new noppes.npcs.scripted.event.NpcEvent.InitEvent(npc.wrappedNPC);
|
noppes.npcs.scripted.event.NpcEvent.InitEvent event = new noppes.npcs.scripted.event.NpcEvent.InitEvent(npc.wrappedNPC);
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.INIT, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.INIT, event);
|
||||||
npc.script.callScript(EnumScriptType.INIT, event);
|
npc.script.callScript(EnumScriptType.INIT, event);
|
||||||
NpcAPI.EVENT_BUS.post(event);
|
NpcAPI.EVENT_BUS.post(event);
|
||||||
npc.advanced.soulStoneInit = false;
|
npc.advanced.soulStoneInit = false;
|
||||||
@@ -135,7 +131,7 @@ public class EventHooks {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
noppes.npcs.scripted.event.NpcEvent.UpdateEvent event = new noppes.npcs.scripted.event.NpcEvent.UpdateEvent(npc.wrappedNPC);
|
noppes.npcs.scripted.event.NpcEvent.UpdateEvent event = new noppes.npcs.scripted.event.NpcEvent.UpdateEvent(npc.wrappedNPC);
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TICK, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TICK, event);
|
||||||
npc.script.callScript(EnumScriptType.TICK, event);
|
npc.script.callScript(EnumScriptType.TICK, event);
|
||||||
NpcAPI.EVENT_BUS.post(event);
|
NpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
@@ -145,7 +141,7 @@ public class EventHooks {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
NpcEvent.DialogEvent event = new NpcEvent.DialogEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
NpcEvent.DialogEvent event = new NpcEvent.DialogEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DIALOG, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DIALOG, event);
|
||||||
npc.script.callScript(EnumScriptType.DIALOG, event, "player", event.getPlayer(), "dialog", event.getDialogId(), "option", event.getOptionId(), "dialogObj", event.getDialog());
|
npc.script.callScript(EnumScriptType.DIALOG, event, "player", event.getPlayer(), "dialog", event.getDialogId(), "option", event.getOptionId(), "dialogObj", event.getDialog());
|
||||||
|
|
||||||
return NpcAPI.EVENT_BUS.post(event);
|
return NpcAPI.EVENT_BUS.post(event);
|
||||||
@@ -156,7 +152,7 @@ public class EventHooks {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
NpcEvent.DialogClosedEvent event = new NpcEvent.DialogClosedEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
NpcEvent.DialogClosedEvent event = new NpcEvent.DialogClosedEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DIALOG_CLOSE, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DIALOG_CLOSE, event);
|
||||||
npc.script.callScript(EnumScriptType.DIALOG_CLOSE, event, "player", event.getPlayer(), "dialog", event.getDialogId(), "option", event.getOptionId(), "dialogObj", event.getDialog());
|
npc.script.callScript(EnumScriptType.DIALOG_CLOSE, event, "player", event.getPlayer(), "dialog", event.getDialogId(), "option", event.getOptionId(), "dialogObj", event.getDialog());
|
||||||
|
|
||||||
NpcAPI.EVENT_BUS.post(event);
|
NpcAPI.EVENT_BUS.post(event);
|
||||||
@@ -167,7 +163,7 @@ public class EventHooks {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
NpcEvent.InteractEvent event = new NpcEvent.InteractEvent(npc.wrappedNPC,player);
|
NpcEvent.InteractEvent event = new NpcEvent.InteractEvent(npc.wrappedNPC,player);
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.INTERACT, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.INTERACT, event);
|
||||||
boolean result = npc.script.callScript(EnumScriptType.INTERACT, event, "player", player);
|
boolean result = npc.script.callScript(EnumScriptType.INTERACT, event, "player", player);
|
||||||
NpcAPI.EVENT_BUS.post(event);
|
NpcAPI.EVENT_BUS.post(event);
|
||||||
return result;
|
return result;
|
||||||
@@ -177,7 +173,7 @@ public class EventHooks {
|
|||||||
if(npc == null || npc.wrappedNPC == null)
|
if(npc == null || npc.wrappedNPC == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.ATTACK_MELEE, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.ATTACK_MELEE, event);
|
||||||
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
||||||
return NpcAPI.EVENT_BUS.post(event);
|
return NpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
@@ -186,7 +182,7 @@ public class EventHooks {
|
|||||||
if(npc == null || npc.wrappedNPC == null)
|
if(npc == null || npc.wrappedNPC == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.RANGED_LAUNCHED, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.RANGED_LAUNCHED, event);
|
||||||
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
||||||
return NpcAPI.EVENT_BUS.post(event);
|
return NpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
@@ -196,7 +192,7 @@ public class EventHooks {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
NpcEvent.KilledEntityEvent event = new NpcEvent.KilledEntityEvent(npc.wrappedNPC,entity);
|
NpcEvent.KilledEntityEvent event = new NpcEvent.KilledEntityEvent(npc.wrappedNPC,entity);
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.KILLS, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.KILLS, event);
|
||||||
npc.script.callScript(EnumScriptType.KILLS, event, "target", entity);
|
npc.script.callScript(EnumScriptType.KILLS, event, "target", entity);
|
||||||
NpcAPI.EVENT_BUS.post(event);
|
NpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
@@ -205,17 +201,27 @@ public class EventHooks {
|
|||||||
if(npc == null || npc.wrappedNPC == null)
|
if(npc == null || npc.wrappedNPC == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TARGET, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TARGET, event);
|
||||||
npc.script.callScript(EnumScriptType.TARGET, event);
|
npc.script.callScript(EnumScriptType.TARGET, event);
|
||||||
return NpcAPI.EVENT_BUS.post(event);
|
return NpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean onNPCTargetLost(EntityNPCInterface npc, EntityLivingBase prevtarget, EntityLivingBase newTarget) {
|
||||||
|
if(npc.script.isClient())
|
||||||
|
return false;
|
||||||
|
NpcEvent.TargetLostEvent event = new NpcEvent.TargetLostEvent(npc.wrappedNPC, prevtarget, newTarget);
|
||||||
|
|
||||||
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TARGET_LOST, event);
|
||||||
|
npc.script.callScript(EnumScriptType.TARGET_LOST, event);
|
||||||
|
return NpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
public static void onNPCCollide(EntityNPCInterface npc, Entity entity){
|
public static void onNPCCollide(EntityNPCInterface npc, Entity entity){
|
||||||
if(npc == null || npc.wrappedNPC == null)
|
if(npc == null || npc.wrappedNPC == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NpcEvent.CollideEvent event = new NpcEvent.CollideEvent(npc.wrappedNPC,entity);
|
NpcEvent.CollideEvent event = new NpcEvent.CollideEvent(npc.wrappedNPC,entity);
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.COLLIDE, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.COLLIDE, event);
|
||||||
npc.script.callScript(EnumScriptType.COLLIDE, event, "entity", entity);
|
npc.script.callScript(EnumScriptType.COLLIDE, event, "entity", entity);
|
||||||
NpcAPI.EVENT_BUS.post(event);
|
NpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
@@ -224,7 +230,7 @@ public class EventHooks {
|
|||||||
if(npc == null || npc.wrappedNPC == null)
|
if(npc == null || npc.wrappedNPC == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DAMAGED, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DAMAGED, event);
|
||||||
npc.script.callScript(EnumScriptType.DAMAGED, event);
|
npc.script.callScript(EnumScriptType.DAMAGED, event);
|
||||||
return NpcAPI.EVENT_BUS.post(event);
|
return NpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
@@ -233,7 +239,7 @@ public class EventHooks {
|
|||||||
if(npc == null || npc.wrappedNPC == null)
|
if(npc == null || npc.wrappedNPC == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.KILLED, event);
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.KILLED, event);
|
||||||
npc.script.callScript(EnumScriptType.KILLED, event);
|
npc.script.callScript(EnumScriptType.KILLED, event);
|
||||||
return NpcAPI.EVENT_BUS.post(event);
|
return NpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
@@ -243,8 +249,29 @@ public class EventHooks {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
|
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
|
||||||
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TIMER, event);
|
||||||
npc.script.callScript(EnumScriptType.TIMER, event);
|
npc.script.callScript(EnumScriptType.TIMER, event);
|
||||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TIMER, event);
|
NpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onProjectileTick(EntityProjectile projectile) {
|
||||||
|
ProjectileEvent.UpdateEvent event = new ProjectileEvent.UpdateEvent((IProjectile) NpcAPI.Instance().getIEntity(projectile));
|
||||||
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.PROJECTILE_TICK, event);
|
||||||
|
for(ScriptContainer script : projectile.scripts) {
|
||||||
|
if(script.isValid()) {
|
||||||
|
script.run(EnumScriptType.PROJECTILE_TICK, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onProjectileImpact(EntityProjectile projectile, ProjectileEvent.ImpactEvent event) {
|
||||||
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.PROJECTILE_IMPACT, event);
|
||||||
|
for(ScriptContainer script : projectile.scripts) {
|
||||||
|
if(script.isValid()) {
|
||||||
|
script.run(EnumScriptType.PROJECTILE_IMPACT, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
NpcAPI.EVENT_BUS.post(event);
|
NpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,7 +549,7 @@ public class EventHooks {
|
|||||||
handler.callScript(EnumScriptType.CNPC_NATURAL_SPAWN, event);
|
handler.callScript(EnumScriptType.CNPC_NATURAL_SPAWN, event);
|
||||||
return NpcAPI.EVENT_BUS.post(event);
|
return NpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onCustomGuiButton(IPlayer player, ICustomGui gui, int buttonId) {
|
public static void onCustomGuiButton(IPlayer player, ICustomGui gui, int buttonId) {
|
||||||
@@ -530,13 +557,13 @@ public class EventHooks {
|
|||||||
CustomGuiController.onButton(event);
|
CustomGuiController.onButton(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onCustomGuiSlot(IPlayer player, ICustomGui gui, int slotId) {
|
public static void onCustomGuiSlot(IPlayer player, ICustomGui gui, int slotId, ItemStack stack, IItemSlot slot) {
|
||||||
CustomGuiEvent.SlotEvent event = new CustomGuiEvent.SlotEvent(player, gui, slotId, player.getOpenContainer().getSlot(slotId));
|
CustomGuiEvent.SlotEvent event = new CustomGuiEvent.SlotEvent(player, gui, slotId, stack, slot);
|
||||||
CustomGuiController.onSlotChange(event);
|
CustomGuiController.onSlotChange(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean onCustomGuiSlotClicked(IPlayer player, ICustomGui gui, int slotId, int dragType, int clickType) {
|
public static boolean onCustomGuiSlotClicked(IPlayer player, ICustomGui gui, int slotId, IItemSlot slot, int dragType, int clickType) {
|
||||||
CustomGuiEvent.SlotClickEvent event = new CustomGuiEvent.SlotClickEvent(player, gui, slotId, player.getOpenContainer().getSlot(slotId), dragType, clickType);
|
CustomGuiEvent.SlotClickEvent event = new CustomGuiEvent.SlotClickEvent(player, gui, slotId, slot, player.getOpenContainer().getSlot(slotId), dragType, clickType);
|
||||||
return CustomGuiController.onSlotClick(event);
|
return CustomGuiController.onSlotClick(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,15 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
|
import noppes.npcs.config.ConfigDebug;
|
||||||
import noppes.npcs.constants.EnumScriptType;
|
import noppes.npcs.constants.EnumScriptType;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.ConsoleHandler;
|
import java.util.logging.*;
|
||||||
import java.util.logging.Formatter;
|
|
||||||
import java.util.logging.Handler;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.LogRecord;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import java.util.logging.StreamHandler;
|
|
||||||
|
|
||||||
public class LogWriter {
|
public class LogWriter {
|
||||||
private final static String name = "CustomNPCs";
|
private final static String name = "CustomNPCs";
|
||||||
@@ -170,7 +161,7 @@ public class LogWriter {
|
|||||||
long secondsSinceFirst = TimeUnit.MILLISECONDS.toSeconds(new Date().getTime() - stamp.makeDate.getTime());
|
long secondsSinceFirst = TimeUnit.MILLISECONDS.toSeconds(new Date().getTime() - stamp.makeDate.getTime());
|
||||||
long millisecSinceLast = TimeUnit.MILLISECONDS.toMillis(stamp.recentDate.getTime() - stamp.makeDate.getTime());
|
long millisecSinceLast = TimeUnit.MILLISECONDS.toMillis(stamp.recentDate.getTime() - stamp.makeDate.getTime());
|
||||||
|
|
||||||
double frequency = (float)CustomNpcs.ScriptFrequency / 60;
|
double frequency = (float) ConfigDebug.ScriptFrequency / 60;
|
||||||
// Reset Log if 2 Minutes Pass
|
// Reset Log if 2 Minutes Pass
|
||||||
if (secondsSinceFirst > 120) {
|
if (secondsSinceFirst > 120) {
|
||||||
LogWriter.script(message);
|
LogWriter.script(message);
|
||||||
@@ -184,7 +175,7 @@ public class LogWriter {
|
|||||||
stamp.recentDate = new Date();
|
stamp.recentDate = new Date();
|
||||||
}
|
}
|
||||||
// IF event occurs to QUICKLY Ignore.
|
// IF event occurs to QUICKLY Ignore.
|
||||||
else if (millisecSinceLast < CustomNpcs.ScriptIgnoreTime){
|
else if (millisecSinceLast < ConfigDebug.ScriptIgnoreTime){
|
||||||
stamp.recentDate = new Date();
|
stamp.recentDate = new Date();
|
||||||
}
|
}
|
||||||
else if(secondsSinceFirst > 10 && (double)stamp.counter / secondsSinceFirst > frequency){
|
else if(secondsSinceFirst > 10 && (double)stamp.counter / secondsSinceFirst > frequency){
|
||||||
|
|||||||
@@ -1,203 +0,0 @@
|
|||||||
package noppes.npcs;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import net.minecraft.entity.EntityAgeable;
|
|
||||||
import net.minecraft.entity.EntityLiving;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.entity.passive.EntityBat;
|
|
||||||
import net.minecraft.entity.passive.EntityHorse;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
|
|
||||||
public class ModelDataShared{
|
|
||||||
public ModelPartConfig arms = new ModelPartConfig();
|
|
||||||
public ModelPartConfig body = new ModelPartConfig();
|
|
||||||
public ModelPartConfig legs = new ModelPartConfig();
|
|
||||||
public ModelPartConfig head = new ModelPartConfig();
|
|
||||||
|
|
||||||
public ModelPartData legParts = new ModelPartData();
|
|
||||||
|
|
||||||
public Class<? extends EntityLivingBase> entityClass;
|
|
||||||
public EntityLivingBase entity;
|
|
||||||
|
|
||||||
public NBTTagCompound extra = new NBTTagCompound();
|
|
||||||
|
|
||||||
private HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
|
|
||||||
public byte breasts = 0;
|
|
||||||
|
|
||||||
// Enabled vs Disabled
|
|
||||||
public byte headwear = 2;
|
|
||||||
public byte bodywear = 0;
|
|
||||||
public byte armwear = 0;
|
|
||||||
public byte legwear = 0;
|
|
||||||
|
|
||||||
// Solid or normal arm/legwear [0: None, 1: Both, 2: Right, 3: Left]
|
|
||||||
public byte solidArmwear = 0;
|
|
||||||
public byte solidLegwear = 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(){
|
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
|
||||||
|
|
||||||
if(entityClass != null)
|
|
||||||
compound.setString("EntityClass", entityClass.getCanonicalName());
|
|
||||||
|
|
||||||
compound.setTag("ArmsConfig", arms.writeToNBT());
|
|
||||||
compound.setTag("BodyConfig", body.writeToNBT());
|
|
||||||
compound.setTag("LegsConfig", legs.writeToNBT());
|
|
||||||
compound.setTag("HeadConfig", head.writeToNBT());
|
|
||||||
|
|
||||||
compound.setTag("LegParts", legParts.writeToNBT());
|
|
||||||
|
|
||||||
compound.setByte("Headwear", headwear);
|
|
||||||
compound.setByte("Bodywear", bodywear);
|
|
||||||
compound.setByte("Armwear", armwear);
|
|
||||||
compound.setByte("Legwear", legwear);
|
|
||||||
|
|
||||||
compound.setByte("SolidArmwear", solidArmwear);
|
|
||||||
compound.setByte("SolidLegwear", solidLegwear);
|
|
||||||
|
|
||||||
compound.setByte("hideHead", hideHead);
|
|
||||||
compound.setByte("hideBody", hideBody);
|
|
||||||
compound.setByte("hideArms", hideArms);
|
|
||||||
compound.setByte("hideLegs", hideLegs);
|
|
||||||
|
|
||||||
compound.setByte("Breasts", breasts);
|
|
||||||
compound.setTag("ExtraData", extra);
|
|
||||||
|
|
||||||
NBTTagList list = new NBTTagList();
|
|
||||||
for(String name : parts.keySet()){
|
|
||||||
NBTTagCompound item = parts.get(name).writeToNBT();
|
|
||||||
item.setString("PartName", name);
|
|
||||||
list.appendTag(item);
|
|
||||||
}
|
|
||||||
compound.setTag("Parts", list);
|
|
||||||
|
|
||||||
return compound;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
|
||||||
setEntityClass(compound.getString("EntityClass"));
|
|
||||||
|
|
||||||
arms.readFromNBT(compound.getCompoundTag("ArmsConfig"));
|
|
||||||
body.readFromNBT(compound.getCompoundTag("BodyConfig"));
|
|
||||||
legs.readFromNBT(compound.getCompoundTag("LegsConfig"));
|
|
||||||
head.readFromNBT(compound.getCompoundTag("HeadConfig"));
|
|
||||||
|
|
||||||
legParts.readFromNBT(compound.getCompoundTag("LegParts"));
|
|
||||||
|
|
||||||
headwear = compound.getByte("Headwear");
|
|
||||||
bodywear = compound.getByte("Bodywear");
|
|
||||||
armwear = compound.getByte("Armwear");
|
|
||||||
legwear = compound.getByte("Legwear");
|
|
||||||
|
|
||||||
solidArmwear = compound.getByte("SolidArmwear");
|
|
||||||
solidLegwear = compound.getByte("SolidLegwear");
|
|
||||||
|
|
||||||
hideHead = compound.getByte("hideHead");
|
|
||||||
hideBody = compound.getByte("hideBody");
|
|
||||||
hideArms = compound.getByte("hideArms");
|
|
||||||
hideLegs = compound.getByte("hideLegs");
|
|
||||||
|
|
||||||
breasts = compound.getByte("Breasts");
|
|
||||||
extra = compound.getCompoundTag("ExtraData");
|
|
||||||
|
|
||||||
HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
|
|
||||||
NBTTagList list = compound.getTagList("Parts", 10);
|
|
||||||
for (int i = 0; i < list.tagCount(); i++) {
|
|
||||||
NBTTagCompound item = list.getCompoundTagAt(i);
|
|
||||||
ModelPartData part = new ModelPartData();
|
|
||||||
part.readFromNBT(item);
|
|
||||||
parts.put(item.getString("PartName"), part);
|
|
||||||
}
|
|
||||||
this.parts = parts;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void readPartsFromNBT(NBTTagCompound compound){
|
|
||||||
legParts.readFromNBT(compound.getCompoundTag("LegParts"));
|
|
||||||
|
|
||||||
HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
|
|
||||||
NBTTagList list = compound.getTagList("Parts", 10);
|
|
||||||
for (int i = 0; i < list.tagCount(); i++) {
|
|
||||||
NBTTagCompound item = list.getCompoundTagAt(i);
|
|
||||||
ModelPartData part = new ModelPartData();
|
|
||||||
part.readFromNBT(item);
|
|
||||||
parts.put(item.getString("PartName"), part);
|
|
||||||
}
|
|
||||||
this.parts = parts;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setEntityClass(String string) {
|
|
||||||
entityClass = null;
|
|
||||||
entity = null;
|
|
||||||
try {
|
|
||||||
Class<?> cls = Class.forName(string);
|
|
||||||
if (EntityLivingBase.class.isAssignableFrom(cls))
|
|
||||||
entityClass = cls.asSubclass(EntityLivingBase.class);
|
|
||||||
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEntityClass(Class<? extends EntityLivingBase> entityClass){
|
|
||||||
this.entityClass = entityClass;
|
|
||||||
entity = null;
|
|
||||||
extra = new NBTTagCompound();
|
|
||||||
if(entityClass == EntityHorse.class)
|
|
||||||
extra.setInteger("Type", -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Class<? extends EntityLivingBase> getEntityClass(){
|
|
||||||
return entityClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float offsetY() {
|
|
||||||
if(entity == null)
|
|
||||||
return -getBodyY();
|
|
||||||
return entity.height - 1.8f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearEntity() {
|
|
||||||
entity = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ModelPartData getPartData(String type){
|
|
||||||
return parts.get(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removePart(String type) {
|
|
||||||
parts.remove(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModelPartData getOrCreatePart(String type) {
|
|
||||||
ModelPartData part = parts.get(type);
|
|
||||||
if(part == null)
|
|
||||||
parts.put(type, part = new ModelPartData());
|
|
||||||
return part;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getBodyY(){
|
|
||||||
if(legParts.type == 3)
|
|
||||||
return (0.9f - body.scaleY) * 0.75f + getLegsY();
|
|
||||||
if(legParts.type == 3)
|
|
||||||
return (0.5f - body.scaleY) * 0.75f + getLegsY();
|
|
||||||
return (1 - body.scaleY) * 0.75f + getLegsY();
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getLegsY() {
|
|
||||||
if(legParts.type == 3)
|
|
||||||
return (0.87f - legs.scaleY) * 1f;
|
|
||||||
return (1 - legs.scaleY) * 0.75f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -10,6 +8,8 @@ import net.minecraft.nbt.NBTTagList;
|
|||||||
import noppes.npcs.controllers.ScriptContainer;
|
import noppes.npcs.controllers.ScriptContainer;
|
||||||
import noppes.npcs.controllers.data.IScriptHandler;
|
import noppes.npcs.controllers.data.IScriptHandler;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class NBTTags {
|
public class NBTTags {
|
||||||
|
|
||||||
public static HashMap<Integer, ItemStack> getItemStackList(
|
public static HashMap<Integer, ItemStack> getItemStackList(
|
||||||
@@ -144,7 +144,7 @@ public class NBTTags {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tagList
|
* @param tagList
|
||||||
* @param arraySize if an int array is not this length a new int array with this length is made
|
* @param arrayLength if an int array is not this length a new int array with this length is made
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static HashMap<String, int[]> getStringIntegerArrayMap(NBTTagList tagList, int arrayLength) {
|
public static HashMap<String, int[]> getStringIntegerArrayMap(NBTTagList tagList, int arrayLength) {
|
||||||
@@ -476,7 +476,7 @@ public class NBTTags {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<ScriptContainer> GetScript(NBTTagList list, IScriptHandler handler) {
|
public static List<ScriptContainer> GetScriptOld(NBTTagList list, IScriptHandler handler) {
|
||||||
ArrayList scripts = new ArrayList();
|
ArrayList scripts = new ArrayList();
|
||||||
|
|
||||||
for(int i = 0; i < list.tagCount(); ++i) {
|
for(int i = 0; i < list.tagCount(); ++i) {
|
||||||
@@ -489,6 +489,19 @@ public class NBTTags {
|
|||||||
return scripts;
|
return scripts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<ScriptContainer> GetScript(NBTTagCompound compound, IScriptHandler handler) {
|
||||||
|
ArrayList<ScriptContainer> scripts = new ArrayList<>();
|
||||||
|
|
||||||
|
for(int i = 0; i < compound.getInteger("TotalScripts"); ++i) {
|
||||||
|
NBTTagCompound containerCompound = compound.getCompoundTag("Tab"+i);
|
||||||
|
ScriptContainer script = new ScriptContainer(handler);
|
||||||
|
script.readFromNBT(containerCompound);
|
||||||
|
scripts.add(script);
|
||||||
|
}
|
||||||
|
|
||||||
|
return scripts;
|
||||||
|
}
|
||||||
|
|
||||||
public static NBTTagList NBTScript(List<ScriptContainer> scripts) {
|
public static NBTTagList NBTScript(List<ScriptContainer> scripts) {
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagList list = new NBTTagList();
|
||||||
Iterator var2 = scripts.iterator();
|
Iterator var2 = scripts.iterator();
|
||||||
|
|||||||
@@ -1,24 +1,22 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.*;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityList;
|
||||||
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.*;
|
import net.minecraft.world.ChunkCoordIntPair;
|
||||||
|
import net.minecraft.world.ChunkPosition;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraftforge.event.ForgeEventFactory;
|
import net.minecraftforge.event.ForgeEventFactory;
|
||||||
@@ -29,6 +27,8 @@ import noppes.npcs.entity.EntityNPCInterface;
|
|||||||
import noppes.npcs.scripted.NpcAPI;
|
import noppes.npcs.scripted.NpcAPI;
|
||||||
import noppes.npcs.scripted.event.CustomNPCsEvent;
|
import noppes.npcs.scripted.event.CustomNPCsEvent;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class NPCSpawning {
|
public class NPCSpawning {
|
||||||
private static Set<ChunkCoordIntPair> eligibleChunksForSpawning = Sets.newHashSet();
|
private static Set<ChunkCoordIntPair> eligibleChunksForSpawning = Sets.newHashSet();
|
||||||
|
|
||||||
@@ -78,13 +78,9 @@ public class NPCSpawning {
|
|||||||
|
|
||||||
x += world.rand.nextInt(b1) - world.rand.nextInt(b1);
|
x += world.rand.nextInt(b1) - world.rand.nextInt(b1);
|
||||||
z += world.rand.nextInt(b1) - world.rand.nextInt(b1);
|
z += world.rand.nextInt(b1) - world.rand.nextInt(b1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Block block = world.getBlock(x, y, z);
|
|
||||||
|
|
||||||
String name = world.getBiomeGenForCoords(x, z).biomeName;
|
String name = world.getBiomeGenForCoords(x, z).biomeName;
|
||||||
SpawnData data = SpawnController.instance.getRandomSpawnData(name, block.getMaterial() == Material.air);
|
SpawnData data = SpawnController.instance.getRandomSpawnData(name, world.provider.dimensionId);
|
||||||
if (data == null || !canCreatureTypeSpawnAtLocation(data, world, x, y, z) || world.getClosestPlayer(x, y, z, 24.0D) != null)
|
if (data == null || !canCreatureTypeSpawnAtLocation(data, world, x, y, z) || world.getClosestPlayer(x, y, z, 24.0D) != null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -115,7 +111,7 @@ public class NPCSpawning {
|
|||||||
public static void performWorldGenSpawning(World world, int x, int z, Random rand){
|
public static void performWorldGenSpawning(World world, int x, int z, Random rand){
|
||||||
BiomeGenBase biome = world.getBiomeGenForCoords(x + 8, z + 8);
|
BiomeGenBase biome = world.getBiomeGenForCoords(x + 8, z + 8);
|
||||||
while (rand.nextFloat() < biome.getSpawningChance()){
|
while (rand.nextFloat() < biome.getSpawningChance()){
|
||||||
SpawnData data = SpawnController.instance.getRandomSpawnData(biome.biomeName, true);
|
SpawnData data = SpawnController.instance.getRandomSpawnData(biome.biomeName, world.provider.dimensionId);
|
||||||
if(data == null)
|
if(data == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -153,7 +149,7 @@ public class NPCSpawning {
|
|||||||
EntityLiving entityliving;
|
EntityLiving entityliving;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
NBTTagCompound[] allCompoundList = new NBTTagCompound[]{data.compound1,data.compound2,data.compound3,data.compound4,data.compound5};
|
NBTTagCompound[] allCompoundList = data.spawnCompounds.values().toArray(new NBTTagCompound[0]);
|
||||||
ArrayList<Entity> entities = new ArrayList<>();
|
ArrayList<Entity> entities = new ArrayList<>();
|
||||||
for (NBTTagCompound compound : allCompoundList) {
|
for (NBTTagCompound compound : allCompoundList) {
|
||||||
Entity entity;
|
Entity entity;
|
||||||
|
|||||||
@@ -1,19 +1,14 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.awt.Toolkit;
|
|
||||||
import java.awt.datatransfer.Clipboard;
|
|
||||||
import java.awt.datatransfer.ClipboardOwner;
|
|
||||||
import java.awt.datatransfer.DataFlavor;
|
|
||||||
import java.awt.datatransfer.StringSelection;
|
|
||||||
import java.awt.datatransfer.Transferable;
|
|
||||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.datatransfer.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class NoppesStringUtils {
|
public class NoppesStringUtils {
|
||||||
|
|
||||||
final static int[] illegalChars = {34, 60, 62, 124, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47};
|
final static int[] illegalChars = {34, 60, 62, 124, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47};
|
||||||
@@ -43,6 +38,7 @@ public class NoppesStringUtils {
|
|||||||
|
|
||||||
}
|
}
|
||||||
text = text.replace("&", Character.toChars(167)[0] + "");
|
text = text.replace("&", Character.toChars(167)[0] + "");
|
||||||
|
text = text.replace("%","%%");
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
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.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@@ -21,10 +15,10 @@ import net.minecraft.server.MinecraftServer;
|
|||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import noppes.npcs.constants.EnumOptionType;
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
import noppes.npcs.constants.EnumPacketClient;
|
import noppes.npcs.api.handler.data.IQuestObjective;
|
||||||
import noppes.npcs.constants.EnumPlayerPacket;
|
import noppes.npcs.api.item.IItemStack;
|
||||||
import noppes.npcs.constants.EnumRoleType;
|
import noppes.npcs.constants.*;
|
||||||
import noppes.npcs.containers.ContainerNPCBankInterface;
|
import noppes.npcs.containers.ContainerNPCBankInterface;
|
||||||
import noppes.npcs.containers.ContainerNPCFollower;
|
import noppes.npcs.containers.ContainerNPCFollower;
|
||||||
import noppes.npcs.containers.ContainerNPCFollowerHire;
|
import noppes.npcs.containers.ContainerNPCFollowerHire;
|
||||||
@@ -32,14 +26,13 @@ import noppes.npcs.controllers.*;
|
|||||||
import noppes.npcs.controllers.data.*;
|
import noppes.npcs.controllers.data.*;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import noppes.npcs.roles.RoleFollower;
|
import noppes.npcs.roles.RoleFollower;
|
||||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
import noppes.npcs.scripted.NpcAPI;
|
||||||
import noppes.npcs.scripted.ScriptSound;
|
import noppes.npcs.scripted.ScriptSound;
|
||||||
import noppes.npcs.scripted.event.DialogEvent;
|
import noppes.npcs.scripted.event.DialogEvent;
|
||||||
import noppes.npcs.scripted.event.QuestEvent;
|
import noppes.npcs.scripted.event.QuestEvent;
|
||||||
import noppes.npcs.api.entity.IPlayer;
|
|
||||||
import noppes.npcs.api.handler.data.IQuestObjective;
|
import java.io.IOException;
|
||||||
import noppes.npcs.api.item.IItemStack;
|
import java.util.*;
|
||||||
import noppes.npcs.scripted.NpcAPI;
|
|
||||||
|
|
||||||
public class NoppesUtilPlayer {
|
public class NoppesUtilPlayer {
|
||||||
|
|
||||||
@@ -92,7 +85,7 @@ public class NoppesUtilPlayer {
|
|||||||
MinecraftServer server = MinecraftServer.getServer();
|
MinecraftServer server = MinecraftServer.getServer();
|
||||||
WorldServer wor = server.worldServerForDimension(dimension);
|
WorldServer wor = server.worldServerForDimension(dimension);
|
||||||
if(wor == null){
|
if(wor == null){
|
||||||
player.addChatMessage(new ChatComponentText("Broken transporter. Dimenion does not exist"));
|
player.addChatMessage(new ChatComponentText("Broken transporter. Dimension does not exist"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.setLocationAndAngles(posX, posY, posZ, player.rotationYaw, player.rotationPitch);
|
player.setLocationAndAngles(posX, posY, posZ, player.rotationYaw, player.rotationPitch);
|
||||||
@@ -304,22 +297,65 @@ public class NoppesUtilPlayer {
|
|||||||
else
|
else
|
||||||
Server.sendData(player, EnumPacketClient.GUI_CLOSE);
|
Server.sendData(player, EnumPacketClient.GUI_CLOSE);
|
||||||
}
|
}
|
||||||
public static void sendTrackedQuestData(EntityPlayerMP player, Quest trackedQuest) {
|
|
||||||
Quest quest = (Quest) PlayerDataController.instance.getPlayerData(player).questData.trackedQuest;
|
public static void updateQuestLogData(ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||||
if (quest == null || trackedQuest == null || quest.id != trackedQuest.id) {
|
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||||
return;
|
|
||||||
|
NBTTagCompound compound = Server.readNBT(buffer);
|
||||||
|
HashMap<String,String> questAlerts = NBTTags.getStringStringMap(compound.getTagList("Alerts", 10));
|
||||||
|
for (Map.Entry<String,String> entry : questAlerts.entrySet()) {
|
||||||
|
Quest quest = getQuestFromStringKey(entry.getKey());
|
||||||
|
if (quest != null) {
|
||||||
|
playerData.questData.activeQuests.get(quest.id).sendAlerts = Boolean.parseBoolean(entry.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
String trackedQuestString = Server.readString(buffer);
|
||||||
compound.setTag("Quest",trackedQuest.writeToNBT(new NBTTagCompound()));
|
Quest trackedQuest = getQuestFromStringKey(trackedQuestString);
|
||||||
compound.setString("CategoryName", trackedQuest.getCategory().getName());
|
if (trackedQuest != null) {
|
||||||
compound.setString("TurnInNPC", trackedQuest.getNpcName());
|
playerData.questData.trackQuest(trackedQuest);
|
||||||
NBTTagList nbtTagList = new NBTTagList();
|
} else {
|
||||||
for (IQuestObjective objective : trackedQuest.questInterface.getObjectives(player)) {
|
playerData.questData.untrackQuest();
|
||||||
nbtTagList.appendTag(new NBTTagString(objective.getText()));
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Quest getQuestFromStringKey(String string) {
|
||||||
|
if (string != null && string.contains(":")) {
|
||||||
|
String[] splitString = string.split(":");
|
||||||
|
if(splitString.length < 2){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String categoryName = splitString[0];
|
||||||
|
String questName = splitString[1];
|
||||||
|
|
||||||
|
for (QuestCategory category : QuestController.instance.categories.values()) {
|
||||||
|
if (category.title.equals(categoryName)) {
|
||||||
|
for (Quest quest : category.quests.values()) {
|
||||||
|
if (quest.title.equals(questName)) {
|
||||||
|
return quest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendTrackedQuestData(EntityPlayerMP player) {
|
||||||
|
Quest trackedQuest = (Quest) PlayerDataController.instance.getPlayerData(player).questData.getTrackedQuest();
|
||||||
|
if(trackedQuest != null){
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
compound.setTag("Quest",trackedQuest.writeToNBT(new NBTTagCompound()));
|
||||||
|
compound.setString("CategoryName", trackedQuest.getCategory().getName());
|
||||||
|
compound.setString("TurnInNPC", trackedQuest.getNpcName());
|
||||||
|
NBTTagList nbtTagList = new NBTTagList();
|
||||||
|
for (IQuestObjective objective : trackedQuest.questInterface.getObjectives(player)) {
|
||||||
|
nbtTagList.appendTag(new NBTTagString(objective.getText()));
|
||||||
|
}
|
||||||
|
compound.setTag("ObjectiveList",nbtTagList);
|
||||||
|
|
||||||
|
Server.sendData(player, EnumPacketClient.OVERLAY_QUEST_TRACKING, compound);
|
||||||
}
|
}
|
||||||
compound.setTag("ObjectiveList",nbtTagList);
|
|
||||||
Server.sendData(player, EnumPacketClient.OVERLAY_QUEST_TRACKING, compound);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendQuestLogData(EntityPlayerMP player) {
|
public static void sendQuestLogData(EntityPlayerMP player) {
|
||||||
@@ -330,31 +366,33 @@ public class NoppesUtilPlayer {
|
|||||||
data.setData(player);
|
data.setData(player);
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, data.writeNBT());
|
Server.sendData(player, EnumPacketClient.GUI_DATA, data.writeNBT());
|
||||||
}
|
}
|
||||||
public static void questCompletion(EntityPlayerMP player, int questId) {
|
public static boolean questCompletion(EntityPlayerMP player, int questId) {
|
||||||
if(player == null)
|
if(player == null)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||||
PlayerQuestData questData = playerData.questData;
|
PlayerQuestData questData = playerData.questData;
|
||||||
QuestData data = questData.activeQuests.get(questId);
|
QuestData data = questData.activeQuests.get(questId);
|
||||||
|
|
||||||
if(data == null)
|
if (data == null)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if(!data.quest.questInterface.isCompleted(playerData))
|
if (!data.quest.questInterface.isCompleted(playerData))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
|
if (data.quest.completion == EnumQuestCompletion.Instant) {
|
||||||
|
EventHooks.onQuestFinished(player, data.quest);
|
||||||
|
}
|
||||||
|
|
||||||
QuestEvent.QuestTurnedInEvent event = new QuestEvent.QuestTurnedInEvent((IPlayer) NpcAPI.Instance().getIEntity(player), data.quest);
|
QuestEvent.QuestTurnedInEvent event = new QuestEvent.QuestTurnedInEvent((IPlayer) NpcAPI.Instance().getIEntity(player), data.quest);
|
||||||
if (event.isCancelled())
|
|
||||||
return;
|
|
||||||
event.expReward = data.quest.rewardExp;
|
|
||||||
|
|
||||||
|
event.expReward = data.quest.rewardExp;
|
||||||
List<IItemStack> list = new ArrayList();
|
List<IItemStack> list = new ArrayList();
|
||||||
Iterator var8 = data.quest.rewardItems.items.values().iterator();
|
Iterator var8 = data.quest.rewardItems.items.values().iterator();
|
||||||
|
|
||||||
while(var8.hasNext()) {
|
while(var8.hasNext()) {
|
||||||
ItemStack item = (ItemStack)var8.next();
|
ItemStack item = (ItemStack)var8.next();
|
||||||
if (item.stackSize > 0) {
|
if (item != null && item.stackSize > 0) {
|
||||||
IItemStack iStack = NpcAPI.Instance().getIItemStack(item);
|
IItemStack iStack = NpcAPI.Instance().getIItemStack(item);
|
||||||
if (iStack != null){
|
if (iStack != null){
|
||||||
list.add(iStack);
|
list.add(iStack);
|
||||||
@@ -369,9 +407,11 @@ public class NoppesUtilPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EventHooks.onQuestTurnedIn(event);
|
EventHooks.onQuestTurnedIn(event);
|
||||||
|
if (event.isCancelled())
|
||||||
|
return false;
|
||||||
|
|
||||||
IItemStack[] var12 = event.itemRewards;
|
IItemStack[] var12 = event.itemRewards;
|
||||||
int var14 = var12.length;
|
int var14 = var12.length;
|
||||||
|
|
||||||
for(int var10 = 0; var10 < var14; ++var10) {
|
for(int var10 = 0; var10 < var14; ++var10) {
|
||||||
IItemStack item = var12[var10];
|
IItemStack item = var12[var10];
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
@@ -382,7 +422,6 @@ public class NoppesUtilPlayer {
|
|||||||
data.quest.questInterface.handleComplete(player);
|
data.quest.questInterface.handleComplete(player);
|
||||||
if(data.quest.rewardExp > 0){
|
if(data.quest.rewardExp > 0){
|
||||||
player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 0.5F * ((player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.7F + 1.8F));
|
player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 0.5F * ((player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.7F + 1.8F));
|
||||||
|
|
||||||
player.addExperience(data.quest.rewardExp);
|
player.addExperience(data.quest.rewardExp);
|
||||||
}
|
}
|
||||||
data.quest.factionOptions.addPoints(player);
|
data.quest.factionOptions.addPoints(player);
|
||||||
@@ -395,7 +434,16 @@ public class NoppesUtilPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlayerQuestController.setQuestFinished(data.quest, player);
|
PlayerQuestController.setQuestFinished(data.quest, player);
|
||||||
if(data.quest.hasNewQuest()) PlayerQuestController.addActiveQuest(data.quest.getNextQuest(), player);
|
if (data.quest.hasNewQuest()) {
|
||||||
|
QuestData nextQuest = new QuestData(data.quest.getNextQuest());
|
||||||
|
nextQuest.sendAlerts = data.quest.id != data.quest.getNextQuest().id || data.sendAlerts;
|
||||||
|
PlayerQuestController.addActiveQuest(nextQuest, player);
|
||||||
|
questData.trackQuest(nextQuest.quest);
|
||||||
|
}
|
||||||
|
|
||||||
|
playerData.save();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean compareItems(ItemStack item, ItemStack item2, boolean ignoreDamage, boolean ignoreNBT){
|
public static boolean compareItems(ItemStack item, ItemStack item2, boolean ignoreDamage, boolean ignoreNBT){
|
||||||
@@ -501,6 +549,13 @@ public class NoppesUtilPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void playSoundTo(EntityPlayerMP player, ScriptSound sound) {
|
||||||
|
NBTTagCompound compound = sound.writeToNBT();
|
||||||
|
if (sound.sourceEntity == null || player.worldObj.provider.dimensionId == sound.sourceEntity.getDimension()) {
|
||||||
|
Server.sendData(player, EnumPacketClient.PLAY_SOUND_TO_NO_ID, compound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void stopSoundFor(EntityPlayerMP player, int id) {
|
public static void stopSoundFor(EntityPlayerMP player, int id) {
|
||||||
Server.sendData(player, EnumPacketClient.STOP_SOUND_FOR, id);
|
Server.sendData(player, EnumPacketClient.STOP_SOUND_FOR, id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,7 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
|
import foxz.utils.Utils;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.zip.GZIPOutputStream;
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -36,44 +24,29 @@ import net.minecraft.util.ChatComponentTranslation;
|
|||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
import noppes.npcs.constants.EnumPacketClient;
|
import noppes.npcs.constants.EnumPacketClient;
|
||||||
import noppes.npcs.constants.EnumPlayerData;
|
import noppes.npcs.constants.EnumPlayerData;
|
||||||
import noppes.npcs.constants.EnumRoleType;
|
import noppes.npcs.constants.EnumRoleType;
|
||||||
import noppes.npcs.containers.ContainerManageBanks;
|
import noppes.npcs.containers.ContainerManageBanks;
|
||||||
import noppes.npcs.containers.ContainerManageRecipes;
|
import noppes.npcs.containers.ContainerManageRecipes;
|
||||||
import noppes.npcs.controllers.data.Bank;
|
import noppes.npcs.controllers.*;
|
||||||
import noppes.npcs.controllers.BankController;
|
import noppes.npcs.controllers.data.*;
|
||||||
import noppes.npcs.controllers.data.Dialog;
|
|
||||||
import noppes.npcs.controllers.data.DialogCategory;
|
|
||||||
import noppes.npcs.controllers.DialogController;
|
|
||||||
import noppes.npcs.controllers.data.DialogOption;
|
|
||||||
import noppes.npcs.controllers.data.Faction;
|
|
||||||
import noppes.npcs.controllers.FactionController;
|
|
||||||
import noppes.npcs.controllers.data.PlayerBankData;
|
|
||||||
import noppes.npcs.controllers.data.PlayerData;
|
|
||||||
import noppes.npcs.controllers.PlayerDataController;
|
|
||||||
import noppes.npcs.controllers.data.PlayerDialogData;
|
|
||||||
import noppes.npcs.controllers.data.PlayerFactionData;
|
|
||||||
import noppes.npcs.controllers.PlayerQuestController;
|
|
||||||
import noppes.npcs.controllers.data.PlayerQuestData;
|
|
||||||
import noppes.npcs.controllers.data.PlayerTransportData;
|
|
||||||
import noppes.npcs.controllers.data.Quest;
|
|
||||||
import noppes.npcs.controllers.data.QuestCategory;
|
|
||||||
import noppes.npcs.controllers.QuestController;
|
|
||||||
import noppes.npcs.controllers.data.RecipeCarpentry;
|
|
||||||
import noppes.npcs.controllers.RecipeController;
|
|
||||||
import noppes.npcs.controllers.ServerCloneController;
|
|
||||||
import noppes.npcs.controllers.data.TransportCategory;
|
|
||||||
import noppes.npcs.controllers.TransportController;
|
|
||||||
import noppes.npcs.controllers.data.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.NpcAPI;
|
import noppes.npcs.scripted.NpcAPI;
|
||||||
import noppes.npcs.scripted.ScriptSound;
|
import noppes.npcs.scripted.ScriptSound;
|
||||||
import noppes.npcs.scripted.event.DialogEvent;
|
import noppes.npcs.scripted.event.DialogEvent;
|
||||||
import noppes.npcs.api.entity.IPlayer;
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
|
||||||
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>();
|
||||||
@@ -82,7 +55,7 @@ public class NoppesUtilServer {
|
|||||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||||
data.editingNpc = npc;
|
data.editingNpc = npc;
|
||||||
if(npc != null)
|
if(npc != null)
|
||||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.EDIT_NPC, npc.getEntityId());
|
Server.sendDataChecked((EntityPlayerMP)player, EnumPacketClient.EDIT_NPC, npc.getEntityId());
|
||||||
}
|
}
|
||||||
public static EntityNPCInterface getEditingNpc(EntityPlayer player){
|
public static EntityNPCInterface getEditingNpc(EntityPlayer player){
|
||||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||||
@@ -113,6 +86,14 @@ public class NoppesUtilServer {
|
|||||||
}
|
}
|
||||||
sendScrollData(player, map);
|
sendScrollData(player, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sendTagDataAll(EntityPlayerMP player) {
|
||||||
|
Map<String,Integer> map = new HashMap<String,Integer>();
|
||||||
|
for(Tag tag : TagController.getInstance().tags.values()){
|
||||||
|
map.put(tag.name, tag.id);
|
||||||
|
}
|
||||||
|
sendScrollData(player, map);
|
||||||
|
}
|
||||||
|
|
||||||
public static void sendBankDataAll(EntityPlayerMP player) {
|
public static void sendBankDataAll(EntityPlayerMP player) {
|
||||||
Map<String,Integer> map = new HashMap<String,Integer>();
|
Map<String,Integer> map = new HashMap<String,Integer>();
|
||||||
@@ -191,7 +172,7 @@ public class NoppesUtilServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(npc instanceof EntityDialogNpc){
|
if(npc instanceof EntityDialogNpc || dia.id < 0){
|
||||||
dialog.hideNPC = true;
|
dialog.hideNPC = true;
|
||||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG_DUMMY, npc.getCommandSenderName(), dialog.writeToNBT(new NBTTagCompound()));
|
Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG_DUMMY, npc.getCommandSenderName(), dialog.writeToNBT(new NBTTagCompound()));
|
||||||
}
|
}
|
||||||
@@ -199,7 +180,7 @@ public class NoppesUtilServer {
|
|||||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG, npc.getEntityId(), dialog.writeToNBT(new NBTTagCompound()));
|
Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG, npc.getEntityId(), dialog.writeToNBT(new NBTTagCompound()));
|
||||||
dia.factionOptions.addPoints(player);
|
dia.factionOptions.addPoints(player);
|
||||||
if(dialog.hasQuest())
|
if(dialog.hasQuest())
|
||||||
PlayerQuestController.addActiveQuest(dialog.getQuest(),player);
|
PlayerQuestController.addActiveQuest(new QuestData(dialog.getQuest()),player);
|
||||||
if(!dialog.command.isEmpty()){
|
if(!dialog.command.isEmpty()){
|
||||||
runCommand(player, npc.getCommandSenderName(), dialog.command);
|
runCommand(player, npc.getCommandSenderName(), dialog.command);
|
||||||
}
|
}
|
||||||
@@ -260,19 +241,48 @@ public class NoppesUtilServer {
|
|||||||
EnumGuiType gui, EntityNPCInterface npc) {
|
EnumGuiType gui, EntityNPCInterface npc) {
|
||||||
sendOpenGui(player, gui, npc, 0, 0, 0);
|
sendOpenGui(player, gui, npc, 0, 0, 0);
|
||||||
}
|
}
|
||||||
public static void sendOpenGui(EntityPlayer player,
|
|
||||||
EnumGuiType gui, EntityNPCInterface npc, int i, int j, int k) {
|
public static void sendOpenGuiNoDelay(EntityPlayer player,
|
||||||
|
EnumGuiType gui, EntityNPCInterface npc) {
|
||||||
|
sendOpenGuiNoDelay(player, gui, npc, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendOpenGui(final EntityPlayer player,
|
||||||
|
final EnumGuiType gui, final EntityNPCInterface npc, final int i, final int j, final int k) {
|
||||||
if(!(player instanceof EntityPlayerMP))
|
if(!(player instanceof EntityPlayerMP))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setEditingNpc(player, npc);
|
setEditingNpc(player, npc);
|
||||||
sendExtraData(player, npc,gui, i, j, k);
|
sendExtraData(player, npc,gui, i, j, k);
|
||||||
|
|
||||||
if(CustomNpcs.proxy.getServerGuiElement(gui.ordinal(), player, player.worldObj, i, j, k) != null){
|
if(CustomNpcs.proxy.getServerGuiElement(gui.ordinal(), player, player.worldObj, i, j, k) != null){
|
||||||
player.openGui(CustomNpcs.instance, gui.ordinal(), player.worldObj, i, j, k);
|
player.openGui(CustomNpcs.instance, gui.ordinal(), player.worldObj, i, j, k);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.GUI, gui.ordinal(), i, j, k);
|
Server.sendDataChecked((EntityPlayerMP)player, EnumPacketClient.GUI, gui.ordinal(), i, j, k);
|
||||||
|
}
|
||||||
|
ArrayList<String> list = getScrollData(player, gui, npc);
|
||||||
|
if(list == null || list.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SCROLL_LIST, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendOpenGuiNoDelay(final EntityPlayer player,
|
||||||
|
final EnumGuiType gui, final EntityNPCInterface npc, final int i, final int j, final int k) {
|
||||||
|
if(!(player instanceof EntityPlayerMP))
|
||||||
|
return;
|
||||||
|
|
||||||
|
setEditingNpc(player, npc);
|
||||||
|
sendExtraData(player, npc,gui, i, j, k);
|
||||||
|
|
||||||
|
if(CustomNpcs.proxy.getServerGuiElement(gui.ordinal(), player, player.worldObj, i, j, k) != null){
|
||||||
|
player.openGui(CustomNpcs.instance, gui.ordinal(), player.worldObj, i, j, k);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Server.sendDataChecked((EntityPlayerMP)player, EnumPacketClient.GUI, gui.ordinal(), i, j, k);
|
||||||
}
|
}
|
||||||
ArrayList<String> list = getScrollData(player, gui, npc);
|
ArrayList<String> list = getScrollData(player, gui, npc);
|
||||||
if(list == null || list.isEmpty())
|
if(list == null || list.isEmpty())
|
||||||
@@ -333,6 +343,13 @@ public class NoppesUtilServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void playSound(ScriptSound sound) {
|
||||||
|
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
|
||||||
|
for (EntityPlayer player : list) {
|
||||||
|
NoppesUtilPlayer.playSoundTo((EntityPlayerMP) player, sound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void stopSound(int id) {
|
public static void stopSound(int id) {
|
||||||
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
|
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
|
||||||
for (EntityPlayer player : list) {
|
for (EntityPlayer player : list) {
|
||||||
@@ -393,10 +410,12 @@ 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);
|
}
|
||||||
}
|
for(String username : MinecraftServer.getServer().getConfigurationManager().getAllUsernames()){
|
||||||
|
map.put(username, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
PlayerData playerdata = PlayerDataController.instance.getDataFromUsername(name);
|
PlayerData playerdata = PlayerDataController.instance.getDataFromUsername(name);
|
||||||
@@ -480,39 +499,47 @@ public class NoppesUtilServer {
|
|||||||
if(pl != null){
|
if(pl != null){
|
||||||
playerdata.setNBT(new NBTTagCompound());
|
playerdata.setNBT(new NBTTagCompound());
|
||||||
sendPlayerData(type, player, name);
|
sendPlayerData(type, player, name);
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
PlayerDataController.instance.nameUUIDs.remove(name);
|
||||||
|
PlayerDataController.instance.savePlayerDataMap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(type == EnumPlayerData.Quest){
|
if(type == EnumPlayerData.Quest){
|
||||||
PlayerQuestData data = playerdata.questData;
|
PlayerQuestData data = playerdata.questData;
|
||||||
int questId = buffer.readInt();
|
int questId = buffer.readInt();
|
||||||
data.activeQuests.remove(questId);
|
data.activeQuests.remove(questId);
|
||||||
data.finishedQuests.remove(questId);
|
data.finishedQuests.remove(questId);
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
}
|
}
|
||||||
if(type == EnumPlayerData.Dialog){
|
if(type == EnumPlayerData.Dialog){
|
||||||
PlayerDialogData data = playerdata.dialogData;
|
PlayerDialogData data = playerdata.dialogData;
|
||||||
data.dialogsRead.remove(buffer.readInt());
|
data.dialogsRead.remove(buffer.readInt());
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
}
|
}
|
||||||
if(type == EnumPlayerData.Transport){
|
if(type == EnumPlayerData.Transport){
|
||||||
PlayerTransportData data = playerdata.transportData;
|
PlayerTransportData data = playerdata.transportData;
|
||||||
data.transports.remove(buffer.readInt());
|
data.transports.remove(buffer.readInt());
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
}
|
}
|
||||||
if(type == EnumPlayerData.Bank){
|
if(type == EnumPlayerData.Bank){
|
||||||
PlayerBankData data = playerdata.bankData;
|
PlayerBankData data = playerdata.bankData;
|
||||||
data.banks.remove(buffer.readInt());
|
data.banks.remove(buffer.readInt());
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
}
|
}
|
||||||
if(type == EnumPlayerData.Factions){
|
if(type == EnumPlayerData.Factions){
|
||||||
PlayerFactionData data = playerdata.factionData;
|
PlayerFactionData data = playerdata.factionData;
|
||||||
data.factionData.remove(buffer.readInt());
|
data.factionData.remove(buffer.readInt());
|
||||||
playerdata.savePlayerDataOnFile();
|
playerdata.save();
|
||||||
}
|
}
|
||||||
sendPlayerData(type, player, name);
|
sendPlayerData(type, player, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void regenPlayerData(EntityPlayerMP player) throws IOException {
|
||||||
|
PlayerDataController.instance.generatePlayerMap(player);
|
||||||
|
}
|
||||||
|
|
||||||
public static void sendRecipeData(EntityPlayerMP player, int size) {
|
public static void sendRecipeData(EntityPlayerMP player, int size) {
|
||||||
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
||||||
@@ -672,7 +699,7 @@ public class NoppesUtilServer {
|
|||||||
}
|
}
|
||||||
Server.sendData(player, EnumPacketClient.GUI_CLOSE, i, comp);
|
Server.sendData(player, EnumPacketClient.GUI_CLOSE, i, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Entity spawnCloneWithProtection(NBTTagCompound compound, int x, int y,
|
public static Entity spawnCloneWithProtection(NBTTagCompound compound, int x, int y,
|
||||||
int z, World worldObj) {
|
int z, World worldObj) {
|
||||||
ServerCloneController.Instance.cleanTags(compound);
|
ServerCloneController.Instance.cleanTags(compound);
|
||||||
@@ -716,8 +743,19 @@ public class NoppesUtilServer {
|
|||||||
if(entity == null){
|
if(entity == null){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
worldObj.spawnEntityInWorld(entity);
|
int i = MathHelper.floor_double(entity.posX / 16.0D);
|
||||||
return entity;
|
int j = MathHelper.floor_double(entity.posZ / 16.0D);
|
||||||
|
if (!entity.forceSpawn && !worldObj.checkChunksExist(
|
||||||
|
(int)entity.posX,(int)entity.posY,(int)entity.posZ,(int)entity.posX,(int)entity.posY,(int)entity.posZ
|
||||||
|
))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
worldObj.getChunkFromChunkCoords(i, j).addEntity(entity);
|
||||||
|
worldObj.loadedEntityList.add(entity);
|
||||||
|
worldObj.onEntityAdded(entity);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOp(EntityPlayer player) {
|
public static boolean isOp(EntityPlayer player) {
|
||||||
@@ -784,4 +822,27 @@ public class NoppesUtilServer {
|
|||||||
public static boolean IsItemStackNull(ItemStack is) {
|
public static boolean IsItemStackNull(ItemStack is) {
|
||||||
return is == null || is.stackSize == 0 || is.getItem() == null;
|
return is == null || is.stackSize == 0 || is.getItem() == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String millisToTime(long millis) {
|
||||||
|
long seconds = millis / 1000;
|
||||||
|
long minutes = seconds / 60;
|
||||||
|
long hours = minutes / 60;
|
||||||
|
long days = hours / 24;
|
||||||
|
seconds %= 60;
|
||||||
|
minutes %= 60;
|
||||||
|
hours %= 24;
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
if (days > 0) {
|
||||||
|
sb.append(days).append(" day").append(days == 1 ? "" : "s").append(", ");
|
||||||
|
}
|
||||||
|
if (hours > 0) {
|
||||||
|
sb.append(hours).append(" hour").append(hours == 1 ? "" : "s").append(", ");
|
||||||
|
}
|
||||||
|
if (minutes > 0) {
|
||||||
|
sb.append(minutes).append(" minute").append(minutes == 1 ? "" : "s").append(", ");
|
||||||
|
}
|
||||||
|
sb.append(seconds).append(" second").append(seconds == 1 ? "" : "s");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class NpcMiscInventory implements IInventory {
|
public class NpcMiscInventory implements IInventory {
|
||||||
public HashMap<Integer,ItemStack> items = new HashMap<Integer,ItemStack>();
|
public HashMap<Integer,ItemStack> items = new HashMap<Integer,ItemStack>();
|
||||||
public int stackLimit = 64;
|
public int stackLimit = 64;
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemEditableBook;
|
import net.minecraft.item.ItemEditableBook;
|
||||||
@@ -18,12 +16,15 @@ import noppes.npcs.blocks.tiles.TileBigSign;
|
|||||||
import noppes.npcs.blocks.tiles.TileBook;
|
import noppes.npcs.blocks.tiles.TileBook;
|
||||||
import noppes.npcs.constants.*;
|
import noppes.npcs.constants.*;
|
||||||
import noppes.npcs.containers.ContainerMail;
|
import noppes.npcs.containers.ContainerMail;
|
||||||
import noppes.npcs.controllers.*;
|
import noppes.npcs.controllers.PlayerDataController;
|
||||||
|
import noppes.npcs.controllers.PlayerQuestController;
|
||||||
|
import noppes.npcs.controllers.ScriptController;
|
||||||
import noppes.npcs.controllers.data.*;
|
import noppes.npcs.controllers.data.*;
|
||||||
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.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
import java.io.IOException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
public class PacketHandlerPlayer{
|
public class PacketHandlerPlayer{
|
||||||
|
|
||||||
@@ -189,9 +190,6 @@ public class PacketHandlerPlayer{
|
|||||||
else if(type == EnumPlayerPacket.QuestLog){
|
else if(type == EnumPlayerPacket.QuestLog){
|
||||||
NoppesUtilPlayer.sendQuestLogData(player);
|
NoppesUtilPlayer.sendQuestLogData(player);
|
||||||
}
|
}
|
||||||
else if(type == EnumPlayerPacket.QuestCompletion){
|
|
||||||
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;
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, data.getPlayerGuiData());
|
Server.sendData(player, EnumPacketClient.GUI_DATA, data.getPlayerGuiData());
|
||||||
@@ -269,7 +267,7 @@ public class PacketHandlerPlayer{
|
|||||||
if(mail.time == time && mail.sender.equals(username)){
|
if(mail.time == time && mail.sender.equals(username)){
|
||||||
mail.beenRead = true;
|
mail.beenRead = true;
|
||||||
if(mail.hasQuest())
|
if(mail.hasQuest())
|
||||||
PlayerQuestController.addActiveQuest(mail.getQuest(), player);
|
PlayerQuestController.addActiveQuest(new QuestData(mail.getQuest()), player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import foxz.utils.Market;
|
import foxz.utils.Market;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -31,13 +27,12 @@ import net.minecraft.village.MerchantRecipeList;
|
|||||||
import net.minecraft.world.WorldProvider;
|
import net.minecraft.world.WorldProvider;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import noppes.npcs.constants.EnumCompanionStage;
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
import noppes.npcs.api.handler.data.ITag;
|
||||||
import noppes.npcs.constants.EnumJobType;
|
import noppes.npcs.config.ConfigDebug;
|
||||||
import noppes.npcs.constants.EnumPacketClient;
|
import noppes.npcs.config.ConfigMain;
|
||||||
import noppes.npcs.constants.EnumPacketServer;
|
import noppes.npcs.config.ConfigScript;
|
||||||
import noppes.npcs.constants.EnumPlayerData;
|
import noppes.npcs.constants.*;
|
||||||
import noppes.npcs.constants.EnumRoleType;
|
|
||||||
import noppes.npcs.containers.ContainerCustomGui;
|
import noppes.npcs.containers.ContainerCustomGui;
|
||||||
import noppes.npcs.containers.ContainerMail;
|
import noppes.npcs.containers.ContainerMail;
|
||||||
import noppes.npcs.controllers.*;
|
import noppes.npcs.controllers.*;
|
||||||
@@ -49,19 +44,19 @@ import noppes.npcs.roles.JobSpawner;
|
|||||||
import noppes.npcs.roles.RoleCompanion;
|
import noppes.npcs.roles.RoleCompanion;
|
||||||
import noppes.npcs.roles.RoleTrader;
|
import noppes.npcs.roles.RoleTrader;
|
||||||
import noppes.npcs.roles.RoleTransporter;
|
import noppes.npcs.roles.RoleTransporter;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
|
||||||
import noppes.npcs.scripted.NpcAPI;
|
import noppes.npcs.scripted.NpcAPI;
|
||||||
import noppes.npcs.scripted.gui.ScriptGui;
|
import noppes.npcs.scripted.gui.ScriptGui;
|
||||||
import noppes.npcs.api.entity.IPlayer;
|
|
||||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class PacketHandlerServer{
|
public class PacketHandlerServer{
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onServerPacket(ServerCustomPacketEvent event) {
|
public void onServerPacket(ServerCustomPacketEvent event) {
|
||||||
EntityPlayerMP player = ((NetHandlerPlayServer)event.handler).playerEntity;
|
EntityPlayerMP player = ((NetHandlerPlayServer)event.handler).playerEntity;
|
||||||
if(CustomNpcs.OpsOnly && !NoppesUtilServer.isOp(player)){
|
if(ConfigMain.OpsOnly && !NoppesUtilServer.isOp(player)){
|
||||||
warn(player, "tried to use custom npcs without being an op");
|
warn(player, "tried to use custom npcs without being an op");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -81,10 +76,6 @@ public class PacketHandlerServer{
|
|||||||
((ContainerCustomGui) player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
((ContainerCustomGui) player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
||||||
EventHooks.onCustomGuiButton((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui, buffer.readInt());
|
EventHooks.onCustomGuiButton((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui, buffer.readInt());
|
||||||
return;
|
return;
|
||||||
} else if (type == EnumPacketServer.CustomGuiSlotChange && player.openContainer instanceof ContainerCustomGui) {
|
|
||||||
((ContainerCustomGui) player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
|
||||||
EventHooks.onCustomGuiSlot((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui, buffer.readInt());
|
|
||||||
return;
|
|
||||||
} else if (type == EnumPacketServer.CustomGuiUnfocused && player.openContainer instanceof ContainerCustomGui) {
|
} else if (type == EnumPacketServer.CustomGuiUnfocused && player.openContainer instanceof ContainerCustomGui) {
|
||||||
((ContainerCustomGui) player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
((ContainerCustomGui) player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
||||||
EventHooks.onCustomGuiUnfocused((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui, buffer.readInt());
|
EventHooks.onCustomGuiUnfocused((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui, buffer.readInt());
|
||||||
@@ -96,9 +87,29 @@ public class PacketHandlerServer{
|
|||||||
} else if (type == EnumPacketServer.CustomGuiClose) {
|
} else if (type == EnumPacketServer.CustomGuiClose) {
|
||||||
EventHooks.onCustomGuiClose((IPlayer) NpcAPI.Instance().getIEntity(player), (new ScriptGui()).fromNBT(Server.readNBT(buffer)));
|
EventHooks.onCustomGuiClose((IPlayer) NpcAPI.Instance().getIEntity(player), (new ScriptGui()).fromNBT(Server.readNBT(buffer)));
|
||||||
return;
|
return;
|
||||||
} else if (type == EnumPacketServer.UpdateTrackedQuest) {
|
} else if (type == EnumPacketServer.QuestLogToServer) {
|
||||||
updateTrackedQuest(buffer, player);
|
NoppesUtilPlayer.updateQuestLogData(buffer, player);
|
||||||
return;
|
return;
|
||||||
|
} else if(type == EnumPacketServer.DimensionsGet){
|
||||||
|
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
||||||
|
for(int id : DimensionManager.getStaticDimensionIDs()){
|
||||||
|
WorldProvider provider = DimensionManager.createProviderFor(id);
|
||||||
|
map.put(provider.getDimensionName(), id);
|
||||||
|
}
|
||||||
|
NoppesUtilServer.sendScrollData(player, map);
|
||||||
|
} else if(type == EnumPacketServer.TagsGet){
|
||||||
|
NoppesUtilServer.sendTagDataAll(player);
|
||||||
|
} else if (type == EnumPacketServer.NpcTagsGet) {
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
NBTTagList tagList = new NBTTagList();
|
||||||
|
for (UUID uuid : npc.advanced.tagUUIDs) {
|
||||||
|
Tag tag = TagController.getInstance().getTagFromUUID(uuid);
|
||||||
|
if (tag != null) {
|
||||||
|
tagList.appendTag(new NBTTagString(tag.name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compound.setTag("TagNames",tagList);
|
||||||
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type.needsNpc && npc == null){
|
if(type.needsNpc && npc == null){
|
||||||
@@ -107,7 +118,7 @@ public class PacketHandlerServer{
|
|||||||
else if(type.hasPermission() && !CustomNpcsPermissions.hasPermission(player, type.permission)){
|
else if(type.hasPermission() && !CustomNpcsPermissions.hasPermission(player, type.permission)){
|
||||||
//player doesnt have permission to do this
|
//player doesnt have permission to do this
|
||||||
}
|
}
|
||||||
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave))
|
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptGlobalNPCGet || type == EnumPacketServer.ScriptGlobalNPCSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave))
|
||||||
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 {
|
else {
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
@@ -123,11 +134,13 @@ public class PacketHandlerServer{
|
|||||||
featherPackets(type, buffer, player);
|
featherPackets(type, buffer, player);
|
||||||
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))
|
||||||
blockPackets(type, buffer, player);
|
blockPackets(type, buffer, player);
|
||||||
else if (CustomNpcs.isScriptDev(player)) {
|
else if (ConfigScript.isScriptDev(player)) {
|
||||||
if (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
|
if (type == EnumPacketServer.EventScriptDataGet || type == EnumPacketServer.EventScriptDataSave)
|
||||||
|
npcEventScriptPackets(type, buffer, player, npc);
|
||||||
|
else if (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
|
||||||
playerScriptPackets(type, buffer, player);
|
playerScriptPackets(type, buffer, player);
|
||||||
else if (type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave)
|
else if (type == EnumPacketServer.ScriptGlobalNPCGet || type == EnumPacketServer.ScriptGlobalNPCSave)
|
||||||
npcScriptPackets(type, buffer, player);
|
npcGlobalScriptPackets(type, buffer, player);
|
||||||
else if (type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave)
|
else if (type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave)
|
||||||
forgeScriptPackets(type, buffer, player);
|
forgeScriptPackets(type, buffer, player);
|
||||||
else if (type == EnumPacketServer.ScriptItemDataGet || type == EnumPacketServer.ScriptItemDataSave)
|
else if (type == EnumPacketServer.ScriptItemDataGet || type == EnumPacketServer.ScriptItemDataSave)
|
||||||
@@ -144,33 +157,6 @@ public class PacketHandlerServer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTrackedQuest(ByteBuf buffer, EntityPlayerMP player) {
|
|
||||||
String trackedQuestString = Server.readString(buffer);
|
|
||||||
if (trackedQuestString != null && trackedQuestString.contains(":")) {
|
|
||||||
String[] splitString = trackedQuestString.split(":");
|
|
||||||
if(splitString.length < 2){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String categoryName = splitString[0];
|
|
||||||
String questName = splitString[1];
|
|
||||||
|
|
||||||
for (QuestCategory category : QuestController.instance.categories.values()) {
|
|
||||||
if (category.title.equals(categoryName)) {
|
|
||||||
for (Quest quest : category.quests.values()) {
|
|
||||||
if (quest.title.equals(questName)) {
|
|
||||||
PlayerDataController.instance.getPlayerData(player).questData.trackedQuest = quest;
|
|
||||||
NoppesUtilPlayer.sendTrackedQuestData(player, quest);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerDataController.instance.getPlayerData(player).questData.trackedQuest = null;
|
|
||||||
Server.sendData(player, EnumPacketClient.OVERLAY_QUEST_TRACKING);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void isGuiOpenPacket(ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
private void isGuiOpenPacket(ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||||
NoppesUtilServer.isGUIOpen(buffer, player);
|
NoppesUtilServer.isGUIOpen(buffer, player);
|
||||||
}
|
}
|
||||||
@@ -178,18 +164,18 @@ public class PacketHandlerServer{
|
|||||||
private void getScriptsEnabled(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
private void getScriptsEnabled(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||||
if (type == EnumPacketServer.ScriptGlobalGuiDataGet) {
|
if (type == EnumPacketServer.ScriptGlobalGuiDataGet) {
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setBoolean("ScriptsEnabled", CustomNpcs.ScriptingEnabled);
|
compound.setBoolean("ScriptsEnabled", ConfigScript.ScriptingEnabled);
|
||||||
compound.setBoolean("PlayerScriptsEnabled", CustomNpcs.GlobalPlayerScripts);
|
compound.setBoolean("PlayerScriptsEnabled", ConfigScript.GlobalPlayerScripts);
|
||||||
compound.setBoolean("GlobalNPCScriptsEnabled", CustomNpcs.GlobalNPCScripts);
|
compound.setBoolean("GlobalNPCScriptsEnabled", ConfigScript.GlobalNPCScripts);
|
||||||
compound.setBoolean("ForgeScriptsEnabled", CustomNpcs.GlobalForgeScripts);
|
compound.setBoolean("ForgeScriptsEnabled", ConfigScript.GlobalForgeScripts);
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
}
|
}
|
||||||
else if (type == EnumPacketServer.ScriptGlobalGuiDataSave) {
|
else if (type == EnumPacketServer.ScriptGlobalGuiDataSave) {
|
||||||
NBTTagCompound compound = Server.readNBT(buffer);
|
NBTTagCompound compound = Server.readNBT(buffer);
|
||||||
CustomNpcs.ScriptingEnabled = compound.getBoolean("ScriptsEnabled");
|
ConfigScript.ScriptingEnabled = compound.getBoolean("ScriptsEnabled");
|
||||||
CustomNpcs.GlobalPlayerScripts = compound.getBoolean("PlayerScriptsEnabled");
|
ConfigScript.GlobalPlayerScripts = compound.getBoolean("PlayerScriptsEnabled");
|
||||||
CustomNpcs.GlobalNPCScripts = compound.getBoolean("GlobalNPCScriptsEnabled");
|
ConfigScript.GlobalNPCScripts = compound.getBoolean("GlobalNPCScriptsEnabled");
|
||||||
CustomNpcs.GlobalForgeScripts = compound.getBoolean("ForgeScriptsEnabled");
|
ConfigScript.GlobalForgeScripts = compound.getBoolean("ForgeScriptsEnabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +184,7 @@ public class PacketHandlerServer{
|
|||||||
npc.script.readFromNBT(Server.readNBT(buffer));
|
npc.script.readFromNBT(Server.readNBT(buffer));
|
||||||
npc.updateAI = true;
|
npc.updateAI = true;
|
||||||
npc.script.hasInited = false;
|
npc.script.hasInited = false;
|
||||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||||
LogWriter.script(String.format("[%s] (Player) %s SAVED NPC %s (%s, %s, %s) [%s]", "SCRIPTER", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)(npc).posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
LogWriter.script(String.format("[%s] (Player) %s SAVED NPC %s (%s, %s, %s) [%s]", "SCRIPTER", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)(npc).posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,48 +195,106 @@ public class PacketHandlerServer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getScripts(IScriptHandler data, ByteBuf buffer, EntityPlayerMP player) {
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
compound.setBoolean("ScriptEnabled", data.getEnabled());
|
||||||
|
compound.setString("ScriptLanguage", data.getLanguage());
|
||||||
|
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
|
||||||
|
compound.setTag("ScriptConsole", NBTTags.NBTLongStringMap(data.getConsoleText()));
|
||||||
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
|
List<ScriptContainer> containers = data.getScripts();
|
||||||
|
for (int i = 0; i < containers.size(); i++) {
|
||||||
|
ScriptContainer container = containers.get(i);
|
||||||
|
NBTTagCompound tabCompound = new NBTTagCompound();
|
||||||
|
tabCompound.setInteger("Tab",i);
|
||||||
|
tabCompound.setTag("Script",container.writeToNBT(new NBTTagCompound()));
|
||||||
|
tabCompound.setInteger("TotalScripts",containers.size());
|
||||||
|
Server.sendData(player, EnumPacketClient.GUI_DATA, tabCompound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveScripts(IScriptHandler data, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||||
|
int tab = buffer.readInt();
|
||||||
|
int totalScripts = buffer.readInt();
|
||||||
|
if (totalScripts == 0) {
|
||||||
|
data.getScripts().clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tab >= 0) {
|
||||||
|
if (data.getScripts().size() > totalScripts) {
|
||||||
|
data.setScripts(data.getScripts().subList(0,totalScripts));
|
||||||
|
} else while (data.getScripts().size() < totalScripts) {
|
||||||
|
data.getScripts().add(new ScriptContainer(data));
|
||||||
|
}
|
||||||
|
NBTTagCompound tabCompound = Server.readNBT(buffer);
|
||||||
|
ScriptContainer script = new ScriptContainer(data);
|
||||||
|
script.readFromNBT(tabCompound);
|
||||||
|
data.getScripts().set(tab,script);
|
||||||
|
} else {
|
||||||
|
NBTTagCompound compound = Server.readNBT(buffer);
|
||||||
|
data.setLanguage(compound.getString("ScriptLanguage"));
|
||||||
|
if (!ScriptController.Instance.languages.containsKey(data.getLanguage())) {
|
||||||
|
if (!ScriptController.Instance.languages.isEmpty()) {
|
||||||
|
data.setLanguage((String) ScriptController.Instance.languages.keySet().toArray()[0]);
|
||||||
|
} else {
|
||||||
|
data.setLanguage("ECMAScript");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.setEnabled(compound.getBoolean("ScriptEnabled"));
|
||||||
|
for (ScriptContainer container : data.getScripts()) {
|
||||||
|
container.setEngine(data.getLanguage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void npcEventScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws Exception {
|
||||||
|
DataScript data = npc.script;
|
||||||
|
if(type == EnumPacketServer.EventScriptDataGet) {
|
||||||
|
this.getScripts(data,buffer,player);
|
||||||
|
} else if(type == EnumPacketServer.EventScriptDataSave) {
|
||||||
|
this.saveScripts(data,buffer,player);
|
||||||
|
npc.updateAI = true;
|
||||||
|
npc.script.hasInited = false;
|
||||||
|
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||||
|
LogWriter.script(String.format("[%s] (Player) %s SAVED NPC %s (%s, %s, %s) [%s]", "SCRIPTER", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)(npc).posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void playerScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
private void playerScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||||
NBTTagCompound compound;
|
PlayerDataScript data = ScriptController.Instance.playerScripts;
|
||||||
if(type == EnumPacketServer.ScriptPlayerGet) {
|
if(type == EnumPacketServer.ScriptPlayerGet) {
|
||||||
PlayerDataScript data = ScriptController.Instance.playerScripts;
|
this.getScripts(data,buffer,player);
|
||||||
compound = data.writeToNBT(new NBTTagCompound());
|
|
||||||
compound.setBoolean("ScriptEnabled", ScriptController.Instance.playerScripts.getEnabled());
|
|
||||||
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
|
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
|
||||||
} else if(type == EnumPacketServer.ScriptPlayerSave) {
|
} else if(type == EnumPacketServer.ScriptPlayerSave) {
|
||||||
ScriptController.Instance.setPlayerScripts(Server.readNBT(buffer));
|
this.saveScripts(data,buffer,player);
|
||||||
|
ScriptController.Instance.lastPlayerUpdate = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void forgeScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
private void forgeScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||||
NBTTagCompound compound;
|
ForgeDataScript data = ScriptController.Instance.forgeScripts;
|
||||||
if (type == EnumPacketServer.ScriptForgeGet) {
|
if (type == EnumPacketServer.ScriptForgeGet) {
|
||||||
ForgeDataScript data = ScriptController.Instance.forgeScripts;
|
this.getScripts(data,buffer,player);
|
||||||
compound = data.writeToNBT(new NBTTagCompound());
|
|
||||||
compound.setBoolean("ScriptEnabled", ScriptController.Instance.forgeScripts.getEnabled());
|
|
||||||
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
|
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, new Object[]{compound});
|
|
||||||
} else if (type == EnumPacketServer.ScriptForgeSave) {
|
} else if (type == EnumPacketServer.ScriptForgeSave) {
|
||||||
ScriptController.Instance.setForgeScripts(Server.readNBT(buffer));
|
this.saveScripts(data,buffer,player);
|
||||||
|
ScriptController.Instance.lastForgeUpdate = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void npcScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
private void npcGlobalScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||||
NBTTagCompound compound;
|
GlobalNPCDataScript data = ScriptController.Instance.globalNpcScripts;
|
||||||
if(type == EnumPacketServer.ScriptNPCGet) {
|
if(type == EnumPacketServer.ScriptGlobalNPCGet) {
|
||||||
NPCDataScript data = ScriptController.Instance.npcScripts;
|
this.getScripts(data,buffer,player);
|
||||||
compound = data.writeToNBT(new NBTTagCompound());
|
} else if(type == EnumPacketServer.ScriptGlobalNPCSave) {
|
||||||
compound.setBoolean("ScriptEnabled", ScriptController.Instance.npcScripts.getEnabled());
|
this.saveScripts(data,buffer,player);
|
||||||
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
|
ScriptController.Instance.lastGlobalNpcUpdate = System.currentTimeMillis();
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
|
||||||
} else if(type == EnumPacketServer.ScriptNPCSave) {
|
|
||||||
ScriptController.Instance.setNPCScripts(Server.readNBT(buffer));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void itemScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
private void itemScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||||
if (type == EnumPacketServer.ScriptItemDataGet) {
|
if (type == EnumPacketServer.ScriptItemDataGet) {
|
||||||
ScriptCustomItem iw = (ScriptCustomItem) NpcAPI.Instance().getIItemStack(player.getHeldItem());
|
ScriptCustomItem iw = (ScriptCustomItem) NpcAPI.Instance().getIItemStack(player.getHeldItem());
|
||||||
|
iw.loadScriptData();
|
||||||
NBTTagCompound compound = iw.getMCNbt();
|
NBTTagCompound compound = iw.getMCNbt();
|
||||||
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
|
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, new Object[]{compound});
|
Server.sendData(player, EnumPacketClient.GUI_DATA, new Object[]{compound});
|
||||||
@@ -262,22 +306,15 @@ public class PacketHandlerServer{
|
|||||||
NBTTagCompound compound = Server.readNBT(buffer);
|
NBTTagCompound compound = Server.readNBT(buffer);
|
||||||
ScriptCustomItem wrapper = (ScriptCustomItem) NpcAPI.Instance().getIItemStack(player.getHeldItem());
|
ScriptCustomItem wrapper = (ScriptCustomItem) NpcAPI.Instance().getIItemStack(player.getHeldItem());
|
||||||
wrapper.setMCNbt(compound);
|
wrapper.setMCNbt(compound);
|
||||||
wrapper.lastInited = -1L;
|
wrapper.loadScriptData();
|
||||||
|
wrapper.loaded = false;
|
||||||
wrapper.saveScriptData();
|
wrapper.saveScriptData();
|
||||||
player.sendContainerToPlayer(player.inventoryContainer);
|
player.sendContainerToPlayer(player.inventoryContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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.DimensionTeleport){
|
||||||
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
|
||||||
for(int id : DimensionManager.getStaticDimensionIDs()){
|
|
||||||
WorldProvider provider = DimensionManager.createProviderFor(id);
|
|
||||||
map.put(provider.getDimensionName(), id);
|
|
||||||
}
|
|
||||||
NoppesUtilServer.sendScrollData(player, map);
|
|
||||||
}
|
|
||||||
else if(type == EnumPacketServer.DimensionTeleport){
|
|
||||||
int dimension = buffer.readInt();
|
int dimension = buffer.readInt();
|
||||||
WorldServer world = MinecraftServer.getServer().worldServerForDimension(dimension);
|
WorldServer world = MinecraftServer.getServer().worldServerForDimension(dimension);
|
||||||
ChunkCoordinates coords = world.getEntrancePortalLocation();
|
ChunkCoordinates coords = world.getEntrancePortalLocation();
|
||||||
@@ -369,11 +406,17 @@ public class PacketHandlerServer{
|
|||||||
faction.writeNBT(compound);
|
faction.writeNBT(compound);
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
}
|
}
|
||||||
|
else if(type == EnumPacketServer.TagGet){
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
Tag tag = TagController.getInstance().get(buffer.readInt());
|
||||||
|
tag.writeNBT(compound);
|
||||||
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void wandPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws IOException{
|
private void wandPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws IOException{
|
||||||
if(type == EnumPacketServer.Delete){
|
if(type == EnumPacketServer.Delete){
|
||||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||||
LogWriter.script(String.format("[%s] (Player) %s DELETE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
LogWriter.script(String.format("[%s] (Player) %s DELETE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
||||||
}
|
}
|
||||||
npc.delete();
|
npc.delete();
|
||||||
@@ -411,7 +454,7 @@ public class PacketHandlerServer{
|
|||||||
npc.reset();
|
npc.reset();
|
||||||
if(npc.linkedData != null)
|
if(npc.linkedData != null)
|
||||||
LinkedNpcController.Instance.saveNpcData(npc);
|
LinkedNpcController.Instance.saveNpcData(npc);
|
||||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||||
LogWriter.script(String.format("[%s] (Player) %s CLOSE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
LogWriter.script(String.format("[%s] (Player) %s CLOSE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
||||||
}
|
}
|
||||||
NoppesUtilServer.setEditingNpc(player, null);
|
NoppesUtilServer.setEditingNpc(player, null);
|
||||||
@@ -440,7 +483,7 @@ public class PacketHandlerServer{
|
|||||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||||
return;
|
return;
|
||||||
NoppesUtilServer.sendOpenGui(player, EnumGuiType.MainMenuDisplay, (EntityNPCInterface) entity);
|
NoppesUtilServer.sendOpenGui(player, EnumGuiType.MainMenuDisplay, (EntityNPCInterface) entity);
|
||||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||||
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), ((EntityNPCInterface)entity).display.getName(), entity.posX, entity.posY, entity.posZ, entity.worldObj.getWorldInfo().getWorldName()));
|
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), ((EntityNPCInterface)entity).display.getName(), entity.posX, entity.posY, entity.posZ, entity.worldObj.getWorldInfo().getWorldName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -449,7 +492,7 @@ public class PacketHandlerServer{
|
|||||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||||
return;
|
return;
|
||||||
npc = (EntityNPCInterface) entity;
|
npc = (EntityNPCInterface) entity;
|
||||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||||
LogWriter.script(String.format("[%s] (Player) %s DELETE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
LogWriter.script(String.format("[%s] (Player) %s DELETE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
||||||
}
|
}
|
||||||
npc.delete();
|
npc.delete();
|
||||||
@@ -681,6 +724,25 @@ public class PacketHandlerServer{
|
|||||||
(new Faction()).writeNBT(compound);
|
(new Faction()).writeNBT(compound);
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
}
|
}
|
||||||
|
else if(type == EnumPacketServer.TagSet){
|
||||||
|
this.setTags(npc,buffer);
|
||||||
|
}
|
||||||
|
else if(type == EnumPacketServer.TagSave){
|
||||||
|
Tag tag = new Tag();
|
||||||
|
tag.readNBT(Server.readNBT(buffer));
|
||||||
|
TagController.getInstance().saveTag(tag);
|
||||||
|
NoppesUtilServer.sendTagDataAll(player);
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
tag.writeNBT(compound);
|
||||||
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
|
}
|
||||||
|
else if(type == EnumPacketServer.TagRemove){
|
||||||
|
TagController.getInstance().delete(buffer.readInt());
|
||||||
|
NoppesUtilServer.sendTagDataAll(player);
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
(new Tag()).writeNBT(compound);
|
||||||
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
|
}
|
||||||
else if(type == EnumPacketServer.PlayerDataGet){
|
else if(type == EnumPacketServer.PlayerDataGet){
|
||||||
int id = buffer.readInt();
|
int id = buffer.readInt();
|
||||||
if(EnumPlayerData.values().length <= id)
|
if(EnumPlayerData.values().length <= id)
|
||||||
@@ -694,6 +756,9 @@ public class PacketHandlerServer{
|
|||||||
else if(type == EnumPacketServer.PlayerDataRemove){
|
else if(type == EnumPacketServer.PlayerDataRemove){
|
||||||
NoppesUtilServer.removePlayerData(buffer,player);
|
NoppesUtilServer.removePlayerData(buffer,player);
|
||||||
}
|
}
|
||||||
|
else if(type == EnumPacketServer.PlayerDataRegen){
|
||||||
|
NoppesUtilServer.regenPlayerData(player);
|
||||||
|
}
|
||||||
else if(type == EnumPacketServer.MainmenuDisplayGet){
|
else if(type == EnumPacketServer.MainmenuDisplayGet){
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, npc.display.writeToNBT(new NBTTagCompound()));
|
Server.sendData(player, EnumPacketClient.GUI_DATA, npc.display.writeToNBT(new NBTTagCompound()));
|
||||||
}
|
}
|
||||||
@@ -833,6 +898,43 @@ public class PacketHandlerServer{
|
|||||||
//NoppesUtilServer.sendRoleData(player, npc);
|
//NoppesUtilServer.sendRoleData(player, npc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(type == EnumPacketServer.AnimationListGet) {
|
||||||
|
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||||
|
}
|
||||||
|
else if(type == EnumPacketServer.AnimationGet) {
|
||||||
|
String animationName = Server.readString(buffer);
|
||||||
|
Animation animation = (Animation) AnimationController.instance.get(animationName);
|
||||||
|
if (animation != null) {
|
||||||
|
Server.sendData(player, EnumPacketClient.GUI_DATA, animation.writeToNBT());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == EnumPacketServer.AnimationAdd) {
|
||||||
|
String name = "Animation";
|
||||||
|
if (AnimationController.instance.has(name)) {
|
||||||
|
name += "_";
|
||||||
|
int i = 1;
|
||||||
|
while (AnimationController.instance.has(name + i)) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
name += i;
|
||||||
|
}
|
||||||
|
Animation animation = new Animation(name);
|
||||||
|
animation.save();
|
||||||
|
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||||
|
}
|
||||||
|
else if (type == EnumPacketServer.AnimationDelete) {
|
||||||
|
String animationName = Server.readString(buffer);
|
||||||
|
AnimationController.instance.delete(animationName);
|
||||||
|
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||||
|
}
|
||||||
|
else if (type == EnumPacketServer.AnimationSave) {
|
||||||
|
String prevName = Server.readString(buffer);
|
||||||
|
AnimationController.instance.delete(prevName);
|
||||||
|
Animation animation = new Animation();
|
||||||
|
animation.readFromNBT(Server.readNBT(buffer));
|
||||||
|
animation.save();
|
||||||
|
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
blockPackets(type, buffer, player);
|
blockPackets(type, buffer, player);
|
||||||
|
|
||||||
@@ -848,17 +950,22 @@ public class PacketHandlerServer{
|
|||||||
}
|
}
|
||||||
else if(type == EnumPacketServer.CloneList){
|
else if(type == EnumPacketServer.CloneList){
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagList list = new NBTTagList();
|
||||||
|
int tab = buffer.readInt();
|
||||||
for(String name : ServerCloneController.Instance.getClones(buffer.readInt()))
|
for(String name : ServerCloneController.Instance.getClones(tab))
|
||||||
list.appendTag(new NBTTagString(name));
|
list.appendTag(new NBTTagString(name));
|
||||||
|
|
||||||
|
NBTTagList listDate = new NBTTagList();
|
||||||
|
for(String name : ServerCloneController.Instance.getClonesDate(tab))
|
||||||
|
listDate.appendTag(new NBTTagString(name));
|
||||||
|
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setTag("List", list);
|
compound.setTag("List", list);
|
||||||
|
compound.setTag("ListDate", listDate);
|
||||||
|
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
warn(player,"tried todo something with the wrong tool, probably a hacker");
|
warn(player,"WE 1 tried todo something with the wrong tool, probably a hacker");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clonePackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
private void clonePackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||||
@@ -879,7 +986,7 @@ public class PacketHandlerServer{
|
|||||||
player.addChatMessage(new ChatComponentText("Failed to create an entity out of your clone"));
|
player.addChatMessage(new ChatComponentText("Failed to create an entity out of your clone"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||||
LogWriter.script(String.format("[%s] (Player) %s SPAWNED ENTITY %s", "CLONER", player.getCommandSenderName(), entity));
|
LogWriter.script(String.format("[%s] (Player) %s SPAWNED ENTITY %s", "CLONER", player.getCommandSenderName(), entity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -906,7 +1013,10 @@ public class PacketHandlerServer{
|
|||||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||||
if(data.cloned == null)
|
if(data.cloned == null)
|
||||||
return;
|
return;
|
||||||
ServerCloneController.Instance.addClone(data.cloned, Server.readString(buffer), buffer.readInt());
|
String name = Server.readString(buffer);
|
||||||
|
int tab = buffer.readInt();
|
||||||
|
NBTTagCompound tagExtra = Server.readNBT(buffer);
|
||||||
|
ServerCloneController.Instance.addClone(data.cloned, name, tab, tagExtra);
|
||||||
}
|
}
|
||||||
else if(type == EnumPacketServer.CloneRemove){
|
else if(type == EnumPacketServer.CloneRemove){
|
||||||
int tab = buffer.readInt();
|
int tab = buffer.readInt();
|
||||||
@@ -917,24 +1027,80 @@ public class PacketHandlerServer{
|
|||||||
for(String name : ServerCloneController.Instance.getClones(tab))
|
for(String name : ServerCloneController.Instance.getClones(tab))
|
||||||
list.appendTag(new NBTTagString(name));
|
list.appendTag(new NBTTagString(name));
|
||||||
|
|
||||||
|
NBTTagList listDate = new NBTTagList();
|
||||||
|
for(String name : ServerCloneController.Instance.getClonesDate(tab))
|
||||||
|
listDate.appendTag(new NBTTagString(name));
|
||||||
|
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setTag("List", list);
|
compound.setTag("List", list);
|
||||||
|
compound.setTag("ListDate", listDate);
|
||||||
|
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
}
|
}
|
||||||
else if(type == EnumPacketServer.CloneList){
|
else if(type == EnumPacketServer.CloneList){
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagList list = new NBTTagList();
|
||||||
|
int tab = buffer.readInt();
|
||||||
for(String name : ServerCloneController.Instance.getClones(buffer.readInt()))
|
for(String name : ServerCloneController.Instance.getClones(tab))
|
||||||
list.appendTag(new NBTTagString(name));
|
list.appendTag(new NBTTagString(name));
|
||||||
|
|
||||||
|
NBTTagList listDate = new NBTTagList();
|
||||||
|
for(String name : ServerCloneController.Instance.getClonesDate(tab))
|
||||||
|
listDate.appendTag(new NBTTagString(name));
|
||||||
|
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setTag("List", list);
|
compound.setTag("List", list);
|
||||||
|
compound.setTag("ListDate", listDate);
|
||||||
|
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
}
|
}
|
||||||
else
|
else if (type == EnumPacketServer.CloneTagList) {
|
||||||
warn(player,"tried todo something with the wrong tool, probably a hacker");
|
int tab = buffer.readInt();
|
||||||
|
TagMap tagMap = ServerTagMapController.Instance.getTagMap(tab);
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
compound.setTag("CloneTags", tagMap.writeNBT());
|
||||||
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
|
}
|
||||||
|
else if (type == EnumPacketServer.CloneAllTags) {
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
HashSet<Tag> validTags = TagController.getInstance().getAllTags();
|
||||||
|
NBTTagList validTagList = new NBTTagList();
|
||||||
|
for(Tag tag : validTags){
|
||||||
|
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||||
|
tag.writeNBT(tagCompound);
|
||||||
|
validTagList.appendTag(tagCompound);
|
||||||
|
}
|
||||||
|
compound.setTag("AllTags", validTagList);
|
||||||
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
|
}
|
||||||
|
else if (type == EnumPacketServer.CloneAllTagsShort) {
|
||||||
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
HashSet<Tag> validTags = TagController.getInstance().getAllTags();
|
||||||
|
NBTTagList validTagList = new NBTTagList();
|
||||||
|
for(Tag tag : validTags){
|
||||||
|
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||||
|
tag.writeShortNBT(tagCompound);
|
||||||
|
validTagList.appendTag(tagCompound);
|
||||||
|
}
|
||||||
|
compound.setTag("ShortTags", validTagList);
|
||||||
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
|
}
|
||||||
|
else if (type == EnumPacketServer.TagSet) {
|
||||||
|
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
|
||||||
|
this.setTags(npc,buffer);
|
||||||
|
}
|
||||||
|
else if (type != EnumPacketServer.NpcTagsGet && type != EnumPacketServer.TagsGet) {
|
||||||
|
warn(player, "WE 2 tried todo something with the wrong tool, probably a hacker");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTags(EntityNPCInterface npc, ByteBuf buffer) throws IOException {
|
||||||
|
npc.advanced.tagUUIDs.removeIf(uuid -> TagController.getInstance().getTagFromUUID(uuid) != null);
|
||||||
|
NBTTagCompound compound = Server.readNBT(buffer);
|
||||||
|
NBTTagList list = compound.getTagList("TagNames",8);
|
||||||
|
for (int i = 0; i < list.tagCount(); i++) {
|
||||||
|
String tagName = list.getStringTagAt(i);
|
||||||
|
npc.advanced.tagUUIDs.add(((Tag)TagController.getInstance().getTagFromName(tagName)).uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void warn(EntityPlayer player, String warning){
|
private void warn(EntityPlayer player, String warning){
|
||||||
|
|||||||
@@ -1,22 +1,23 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import noppes.npcs.constants.EnumQuestCompletion;
|
import noppes.npcs.constants.EnumQuestCompletion;
|
||||||
import noppes.npcs.controllers.data.PlayerData;
|
|
||||||
import noppes.npcs.controllers.PlayerDataController;
|
import noppes.npcs.controllers.PlayerDataController;
|
||||||
import noppes.npcs.controllers.PlayerQuestController;
|
import noppes.npcs.controllers.PlayerQuestController;
|
||||||
|
import noppes.npcs.controllers.data.PlayerData;
|
||||||
import noppes.npcs.controllers.data.Quest;
|
import noppes.npcs.controllers.data.Quest;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
public class QuestLogData {
|
public class QuestLogData {
|
||||||
public String trackedQuestKey = "";
|
public String trackedQuestKey = "";
|
||||||
public HashMap<String,Vector<String>> categories = new HashMap<String,Vector<String>>();
|
public HashMap<String,Vector<String>> categories = new HashMap<String,Vector<String>>();
|
||||||
public String selectedQuest = "";
|
public String selectedQuest = "";
|
||||||
public String selectedCategory = "";
|
public String selectedCategory = "";
|
||||||
public HashMap<String,String> questText = new HashMap<String,String>();
|
public HashMap<String,String> questText = new HashMap<String,String>();
|
||||||
|
public HashMap<String,String> questAlerts = new HashMap<>();
|
||||||
public HashMap<String,Vector<String>> questStatus = new HashMap<String,Vector<String>>();
|
public HashMap<String,Vector<String>> questStatus = new HashMap<String,Vector<String>>();
|
||||||
public HashMap<String,String> finish = new HashMap<String,String>();
|
public HashMap<String,String> finish = new HashMap<String,String>();
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ public class QuestLogData {
|
|||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setTag("Categories", NBTTags.nbtVectorMap(categories));
|
compound.setTag("Categories", NBTTags.nbtVectorMap(categories));
|
||||||
compound.setTag("Logs", NBTTags.nbtStringStringMap(questText));
|
compound.setTag("Logs", NBTTags.nbtStringStringMap(questText));
|
||||||
|
compound.setTag("Alerts", NBTTags.nbtStringStringMap(questAlerts));
|
||||||
compound.setTag("Status", NBTTags.nbtVectorMap(questStatus));
|
compound.setTag("Status", NBTTags.nbtVectorMap(questStatus));
|
||||||
compound.setTag("QuestFinisher", NBTTags.nbtStringStringMap(finish));
|
compound.setTag("QuestFinisher", NBTTags.nbtStringStringMap(finish));
|
||||||
compound.setString("TrackedQuestID", trackedQuestKey);
|
compound.setString("TrackedQuestID", trackedQuestKey);
|
||||||
@@ -33,6 +35,7 @@ public class QuestLogData {
|
|||||||
public void readNBT(NBTTagCompound compound){
|
public void readNBT(NBTTagCompound compound){
|
||||||
categories = NBTTags.getVectorMap(compound.getTagList("Categories", 10));
|
categories = NBTTags.getVectorMap(compound.getTagList("Categories", 10));
|
||||||
questText = NBTTags.getStringStringMap(compound.getTagList("Logs", 10));
|
questText = NBTTags.getStringStringMap(compound.getTagList("Logs", 10));
|
||||||
|
questAlerts = NBTTags.getStringStringMap(compound.getTagList("Alerts", 10));
|
||||||
questStatus = NBTTags.getVectorMap(compound.getTagList("Status", 10));
|
questStatus = NBTTags.getVectorMap(compound.getTagList("Status", 10));
|
||||||
finish = NBTTags.getStringStringMap(compound.getTagList("QuestFinisher", 10));
|
finish = NBTTags.getStringStringMap(compound.getTagList("QuestFinisher", 10));
|
||||||
trackedQuestKey = compound.getString("TrackedQuestID");
|
trackedQuestKey = compound.getString("TrackedQuestID");
|
||||||
@@ -49,13 +52,13 @@ public class QuestLogData {
|
|||||||
list.add(quest.title);
|
list.add(quest.title);
|
||||||
|
|
||||||
questText.put(category + ":" + quest.title, quest.logText);
|
questText.put(category + ":" + quest.title, quest.logText);
|
||||||
|
questAlerts.put(category + ":" + quest.title, String.valueOf(playerData.questData.activeQuests.get(quest.id).sendAlerts));
|
||||||
questStatus.put(category + ":" + quest.title, quest.questInterface.getQuestLogStatus(player));
|
questStatus.put(category + ":" + quest.title, quest.questInterface.getQuestLogStatus(player));
|
||||||
if(quest.completion == EnumQuestCompletion.Npc && quest.questInterface.isCompleted(playerData))
|
if(quest.completion == EnumQuestCompletion.Npc && quest.questInterface.isCompleted(playerData))
|
||||||
finish.put(category + ":" + quest.title, quest.completerNpc);
|
finish.put(category + ":" + quest.title, quest.completerNpc);
|
||||||
|
|
||||||
if (playerData.questData.trackedQuest != null) {
|
if (playerData.questData.getTrackedQuest() != null) {
|
||||||
if (quest.id == playerData.questData.trackedQuest.getId()) {
|
if (quest.id == playerData.questData.getTrackedQuest().getId()) {
|
||||||
trackedQuestKey = category + ":" + quest.title;
|
trackedQuestKey = category + ":" + quest.title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,6 +73,14 @@ public class QuestLogData {
|
|||||||
return questText.get(selectedCategory + ":" + selectedQuest);
|
return questText.get(selectedCategory + ":" + selectedQuest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getQuestAlerts() {
|
||||||
|
return Boolean.valueOf(questAlerts.get(selectedCategory+":"+selectedQuest));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toggleQuestAlerts() {
|
||||||
|
questAlerts.put(selectedCategory+":"+selectedQuest,String.valueOf(!getQuestAlerts()));
|
||||||
|
}
|
||||||
|
|
||||||
public Vector<String> getQuestStatus() {
|
public Vector<String> getQuestStatus() {
|
||||||
return questStatus.get(selectedCategory + ":" + selectedQuest);
|
return questStatus.get(selectedCategory + ":" + selectedQuest);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ import net.minecraftforge.event.entity.item.ItemTossEvent;
|
|||||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||||
import net.minecraftforge.event.entity.player.EntityInteractEvent;
|
import net.minecraftforge.event.entity.player.EntityInteractEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
|
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
|
||||||
import noppes.npcs.entity.EntityCustomNpc;
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
import noppes.npcs.items.ItemScripted;
|
|
||||||
import noppes.npcs.scripted.event.ItemEvent;
|
|
||||||
import noppes.npcs.api.item.IItemCustom;
|
import noppes.npcs.api.item.IItemCustom;
|
||||||
import noppes.npcs.api.item.IItemStack;
|
import noppes.npcs.api.item.IItemStack;
|
||||||
import noppes.npcs.api.entity.IPlayer;
|
import noppes.npcs.entity.EntityCustomNpc;
|
||||||
|
import noppes.npcs.items.ItemScripted;
|
||||||
import noppes.npcs.scripted.NpcAPI;
|
import noppes.npcs.scripted.NpcAPI;
|
||||||
|
import noppes.npcs.scripted.event.ItemEvent;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class ScriptItemEventHandler {
|
|||||||
try {
|
try {
|
||||||
if (event.entityItem.getEntityItem().getItem() == CustomItems.scripted_item && !event.isCanceled()) {
|
if (event.entityItem.getEntityItem().getItem() == CustomItems.scripted_item && !event.isCanceled()) {
|
||||||
IItemCustom isw = ItemScripted.GetWrapper(event.entityItem.getEntityItem());
|
IItemCustom isw = ItemScripted.GetWrapper(event.entityItem.getEntityItem());
|
||||||
EventHooks.onScriptItemTossed(isw, event.player, event.entityItem);
|
event.setCanceled(EventHooks.onScriptItemTossed(isw, event.player, event.entityItem));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import net.minecraft.entity.Entity;
|
|||||||
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.inventory.ContainerPlayer;
|
import net.minecraft.inventory.ContainerPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ChatComponentTranslation;
|
import net.minecraft.util.ChatComponentTranslation;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.common.ForgeHooks;
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
@@ -22,15 +23,21 @@ import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
|
|||||||
import net.minecraftforge.event.entity.item.ItemTossEvent;
|
import net.minecraftforge.event.entity.item.ItemTossEvent;
|
||||||
import net.minecraftforge.event.entity.living.*;
|
import net.minecraftforge.event.entity.living.*;
|
||||||
import net.minecraftforge.event.entity.player.*;
|
import net.minecraftforge.event.entity.player.*;
|
||||||
import net.minecraftforge.event.world.*;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
import noppes.npcs.constants.EnumPacketClient;
|
import noppes.npcs.constants.EnumPacketClient;
|
||||||
import noppes.npcs.controllers.*;
|
import noppes.npcs.constants.EnumQuestType;
|
||||||
|
import noppes.npcs.controllers.PlayerDataController;
|
||||||
|
import noppes.npcs.controllers.ScriptController;
|
||||||
import noppes.npcs.controllers.data.PlayerData;
|
import noppes.npcs.controllers.data.PlayerData;
|
||||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||||
|
import noppes.npcs.controllers.data.PlayerQuestData;
|
||||||
import noppes.npcs.controllers.data.Quest;
|
import noppes.npcs.controllers.data.Quest;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import noppes.npcs.scripted.NpcAPI;
|
import noppes.npcs.scripted.NpcAPI;
|
||||||
import noppes.npcs.api.entity.IPlayer;
|
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||||
|
|
||||||
|
import static noppes.npcs.config.ConfigMain.TrackedQuestUpdateFrequency;
|
||||||
|
|
||||||
public class ScriptPlayerEventHandler {
|
public class ScriptPlayerEventHandler {
|
||||||
public ScriptPlayerEventHandler() {
|
public ScriptPlayerEventHandler() {
|
||||||
@@ -47,6 +54,14 @@ public class ScriptPlayerEventHandler {
|
|||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(player);
|
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(player);
|
||||||
EventHooks.onPlayerTick(handler, scriptPlayer);
|
EventHooks.onPlayerTick(handler, scriptPlayer);
|
||||||
|
|
||||||
|
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
|
||||||
|
ItemStack item = player.inventory.getStackInSlot(i);
|
||||||
|
if(item != null && item.getItem() == CustomItems.scripted_item){
|
||||||
|
ScriptCustomItem isw = (ScriptCustomItem) NpcAPI.Instance().getIItemStack(item);
|
||||||
|
EventHooks.onScriptItemUpdate(isw, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerDataController.instance != null) {
|
if (PlayerDataController.instance != null) {
|
||||||
@@ -56,14 +71,22 @@ public class ScriptPlayerEventHandler {
|
|||||||
playerData.timers.update();
|
playerData.timers.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerData.questData.trackedQuest != null && !playerData.questData.activeQuests.containsKey(playerData.questData.trackedQuest.getId())) {
|
if (playerData.questData.getTrackedQuest() != null && !playerData.questData.activeQuests.containsKey(playerData.questData.getTrackedQuest().getId())) {
|
||||||
PlayerDataController.instance.getPlayerData(player).questData.trackedQuest = null;
|
PlayerDataController.instance.getPlayerData(player).questData.untrackQuest();
|
||||||
Server.sendData((EntityPlayerMP) player, EnumPacketClient.OVERLAY_QUEST_TRACKING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.ticksExisted%20 == 0 && !PlayerDataController.instance.getPlayerData(player).skinOverlays.overlayList.isEmpty()) {
|
if (player.ticksExisted % 20 == 0 && !PlayerDataController.instance.getPlayerData(player).skinOverlays.overlayList.isEmpty()) {
|
||||||
PlayerDataController.instance.getPlayerData(player).skinOverlays.updateClient();
|
PlayerDataController.instance.getPlayerData(player).skinOverlays.updateClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player.ticksExisted % (TrackedQuestUpdateFrequency * 20) == 0) {
|
||||||
|
PlayerQuestData questData = playerData.questData;
|
||||||
|
if(questData != null){
|
||||||
|
if (questData.getTrackedQuest() != null && ((Quest) questData.getTrackedQuest()).type == EnumQuestType.Item) {
|
||||||
|
NoppesUtilPlayer.sendTrackedQuestData((EntityPlayerMP) event.player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,7 +329,7 @@ public class ScriptPlayerEventHandler {
|
|||||||
if(event.player.worldObj instanceof WorldServer) {
|
if(event.player.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(event.player);
|
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(event.player);
|
||||||
EventHooks.onPlayerToss(handler, scriptPlayer, event.entityItem);
|
event.setCanceled(EventHooks.onPlayerToss(handler, scriptPlayer, event.entityItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,9 +476,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(event.player);
|
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(event.player);
|
||||||
EventHooks.onPlayerLogin(handler, scriptPlayer);
|
EventHooks.onPlayerLogin(handler, scriptPlayer);
|
||||||
|
|
||||||
Quest quest = (Quest) PlayerDataController.instance.getPlayerData(event.player).questData.trackedQuest;
|
Quest quest = (Quest) PlayerDataController.instance.getPlayerData(event.player).questData.getTrackedQuest();
|
||||||
if (quest != null) {
|
if (quest != null) {
|
||||||
NoppesUtilPlayer.sendTrackedQuestData((EntityPlayerMP) event.player, quest);
|
NoppesUtilPlayer.sendTrackedQuestData((EntityPlayerMP) event.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerDataController.instance.getPlayerData(event.player).skinOverlays.updateClient();
|
PlayerDataController.instance.getPlayerData(event.player).skinOverlays.updateClient();
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
|
import com.google.common.base.Charsets;
|
||||||
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
|
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
|
|
||||||
import java.io.EOFException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.nbt.CompressedStreamTools;
|
import net.minecraft.nbt.CompressedStreamTools;
|
||||||
@@ -18,25 +13,31 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.village.MerchantRecipeList;
|
import net.minecraft.village.MerchantRecipeList;
|
||||||
import noppes.npcs.constants.EnumPacketClient;
|
import noppes.npcs.constants.EnumPacketClient;
|
||||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
import noppes.npcs.util.CustomNPCsThreader;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class Server {
|
public class Server {
|
||||||
|
|
||||||
public static boolean sendData(EntityPlayerMP player, EnumPacketClient enu, Object... obs) {
|
public static void sendData(final EntityPlayerMP player, final EnumPacketClient enu, final Object... obs) {
|
||||||
ByteBuf buffer = Unpooled.buffer();
|
sendDataChecked(player, enu, obs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean sendDataChecked(EntityPlayerMP player, EnumPacketClient type, Object... obs) {
|
||||||
|
PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
|
||||||
try {
|
try {
|
||||||
if(!fillBuffer(buffer, enu, obs))
|
if(!fillBuffer(buffer, type, obs))
|
||||||
return false;
|
return false;
|
||||||
CustomNpcs.Channel.sendTo(new FMLProxyPacket(buffer, "CustomNPCs"), player);
|
CustomNpcs.Channel.sendTo(new FMLProxyPacket(buffer, "CustomNPCs"), player);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
LogWriter.error(type + " Errored", e);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendAssociatedData(Entity entity, EnumPacketClient enu, Object... obs) {
|
public static void sendAssociatedData(final Entity entity, final EnumPacketClient enu, final Object... obs) {
|
||||||
ByteBuf buffer = Unpooled.buffer();
|
ByteBuf buffer = Unpooled.buffer();
|
||||||
try {
|
try {
|
||||||
if(!fillBuffer(buffer, enu, obs))
|
if(!fillBuffer(buffer, enu, obs))
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -24,6 +21,7 @@ import net.minecraft.util.ChatComponentTranslation;
|
|||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraft.village.MerchantRecipeList;
|
import net.minecraft.village.MerchantRecipeList;
|
||||||
|
import net.minecraftforge.event.entity.EntityEvent;
|
||||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||||
@@ -34,11 +32,15 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||||
import noppes.npcs.blocks.tiles.TileBanner;
|
import noppes.npcs.blocks.tiles.TileBanner;
|
||||||
|
import noppes.npcs.config.ConfigDebug;
|
||||||
|
import noppes.npcs.config.ConfigMain;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
import noppes.npcs.constants.EnumPacketClient;
|
import noppes.npcs.constants.EnumPacketClient;
|
||||||
import noppes.npcs.constants.EnumQuestType;
|
import noppes.npcs.constants.EnumQuestType;
|
||||||
import noppes.npcs.constants.EnumRoleType;
|
import noppes.npcs.constants.EnumRoleType;
|
||||||
import noppes.npcs.controllers.*;
|
import noppes.npcs.controllers.PlayerDataController;
|
||||||
|
import noppes.npcs.controllers.RecipeController;
|
||||||
|
import noppes.npcs.controllers.ServerCloneController;
|
||||||
import noppes.npcs.controllers.data.*;
|
import noppes.npcs.controllers.data.*;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import noppes.npcs.items.ItemExcalibur;
|
import noppes.npcs.items.ItemExcalibur;
|
||||||
@@ -48,6 +50,10 @@ import noppes.npcs.quests.QuestItem;
|
|||||||
import noppes.npcs.quests.QuestKill;
|
import noppes.npcs.quests.QuestKill;
|
||||||
import noppes.npcs.roles.RoleFollower;
|
import noppes.npcs.roles.RoleFollower;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ServerEventsHandler {
|
public class ServerEventsHandler {
|
||||||
|
|
||||||
public static EntityVillager Merchant;
|
public static EntityVillager Merchant;
|
||||||
@@ -61,13 +67,13 @@ public class ServerEventsHandler {
|
|||||||
boolean isRemote = event.entityPlayer.worldObj.isRemote;
|
boolean isRemote = event.entityPlayer.worldObj.isRemote;
|
||||||
boolean npcInteracted = event.target instanceof EntityNPCInterface;
|
boolean npcInteracted = event.target instanceof EntityNPCInterface;
|
||||||
|
|
||||||
if(!isRemote && CustomNpcs.OpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(event.entityPlayer.getGameProfile())){
|
if(!isRemote && ConfigMain.OpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(event.entityPlayer.getGameProfile())){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isRemote && item.getItem() == CustomItems.soulstoneEmpty && event.target instanceof EntityLivingBase) {
|
if(!isRemote && item.getItem() == CustomItems.soulstoneEmpty && event.target instanceof EntityLivingBase) {
|
||||||
((ItemSoulstoneEmpty)item.getItem()).store((EntityLivingBase)event.target, item, event.entityPlayer);
|
((ItemSoulstoneEmpty)item.getItem()).store((EntityLivingBase)event.target, item, event.entityPlayer);
|
||||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||||
LogWriter.script(String.format("[%s] (Player) %s PICKED ENTITY %s", "SOULSTONE", event.entityPlayer.getCommandSenderName(), event.target));
|
LogWriter.script(String.format("[%s] (Player) %s PICKED ENTITY %s", "SOULSTONE", event.entityPlayer.getCommandSenderName(), event.target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +84,7 @@ public class ServerEventsHandler {
|
|||||||
}
|
}
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
NoppesUtilServer.sendOpenGui(event.entityPlayer, EnumGuiType.MainMenuDisplay, (EntityNPCInterface) event.target);
|
NoppesUtilServer.sendOpenGui(event.entityPlayer, EnumGuiType.MainMenuDisplay, (EntityNPCInterface) event.target);
|
||||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||||
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "WAND", event.entityPlayer.getCommandSenderName(), ((EntityNPCInterface)(event.target)).display.getName(), (int)(event.target).posX, (int)(event.target).posY, (int)(event.target).posZ, (event.target).worldObj.getWorldInfo().getWorldName()));
|
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "WAND", event.entityPlayer.getCommandSenderName(), ((EntityNPCInterface)(event.target)).display.getName(), (int)(event.target).posX, (int)(event.target).posY, (int)(event.target).posZ, (event.target).worldObj.getWorldInfo().getWorldName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,9 +94,12 @@ public class ServerEventsHandler {
|
|||||||
return;
|
return;
|
||||||
PlayerData data = PlayerDataController.instance.getPlayerData(event.entityPlayer);
|
PlayerData data = PlayerDataController.instance.getPlayerData(event.entityPlayer);
|
||||||
ServerCloneController.Instance.cleanTags(compound);
|
ServerCloneController.Instance.cleanTags(compound);
|
||||||
if(!Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.CLONE, compound))
|
if(!Server.sendDataChecked((EntityPlayerMP)event.entityPlayer, EnumPacketClient.CLONE, compound))
|
||||||
event.entityPlayer.addChatMessage(new ChatComponentText("Entity too big to clone"));
|
event.entityPlayer.addChatMessage(new ChatComponentText("Entity too big to clone"));
|
||||||
data.cloned = compound;
|
data.cloned = compound;
|
||||||
|
if (event.target instanceof EntityNPCInterface) {
|
||||||
|
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface) event.target);
|
||||||
|
}
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
else if(item.getItem() == CustomItems.scripter && !isRemote && npcInteracted){
|
else if(item.getItem() == CustomItems.scripter && !isRemote && npcInteracted){
|
||||||
@@ -99,7 +108,7 @@ public class ServerEventsHandler {
|
|||||||
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface)event.target);
|
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface)event.target);
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.GUI, EnumGuiType.Script.ordinal());
|
Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.GUI, EnumGuiType.Script.ordinal());
|
||||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||||
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "SCRIPTER", event.entityPlayer.getCommandSenderName(), ((EntityNPCInterface)(event.target)).display.getName(), (int)(event.target).posX, (int)(event.target).posY, (int)(event.target).posZ, (event.target).worldObj.getWorldInfo().getWorldName()));
|
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "SCRIPTER", event.entityPlayer.getCommandSenderName(), ((EntityNPCInterface)(event.target)).display.getName(), (int)(event.target).posX, (int)(event.target).posY, (int)(event.target).posZ, (event.target).worldObj.getWorldInfo().getWorldName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -246,7 +255,7 @@ public class ServerEventsHandler {
|
|||||||
doExcalibur((EntityPlayer) event.source.getEntity(),event.entityLiving);
|
doExcalibur((EntityPlayer) event.source.getEntity(),event.entityLiving);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.source.getEntity() instanceof EntityNPCInterface && event.entityLiving != null){
|
if(event.source.getEntity() instanceof EntityNPCInterface){
|
||||||
EntityNPCInterface npc = (EntityNPCInterface) event.source.getEntity();
|
EntityNPCInterface npc = (EntityNPCInterface) event.source.getEntity();
|
||||||
Line line = npc.advanced.getKillLine();
|
Line line = npc.advanced.getKillLine();
|
||||||
if(line != null)
|
if(line != null)
|
||||||
@@ -269,7 +278,7 @@ public class ServerEventsHandler {
|
|||||||
}
|
}
|
||||||
if(event.entityLiving instanceof EntityPlayer){
|
if(event.entityLiving instanceof EntityPlayer){
|
||||||
PlayerData data = PlayerDataController.instance.getPlayerData((EntityPlayer)event.entityLiving);
|
PlayerData data = PlayerDataController.instance.getPlayerData((EntityPlayer)event.entityLiving);
|
||||||
data.savePlayerDataOnFile();
|
data.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,48 +297,54 @@ public class ServerEventsHandler {
|
|||||||
private void doQuest(EntityPlayer player, EntityLivingBase entity, boolean all) {
|
private void doQuest(EntityPlayer player, EntityLivingBase entity, boolean all) {
|
||||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||||
PlayerQuestData questData = playerData.questData;
|
PlayerQuestData questData = playerData.questData;
|
||||||
boolean change = false;
|
boolean checkCompletion = false;
|
||||||
String entityName = EntityList.getEntityString(entity);
|
String entityName = EntityList.getEntityString(entity);
|
||||||
|
|
||||||
ArrayList<QuestData> activeQuestValues = new ArrayList<>(questData.activeQuests.values());
|
ArrayList<QuestData> activeQuestValues = new ArrayList<>(questData.activeQuests.values());
|
||||||
for(QuestData data : activeQuestValues){
|
for(QuestData data : activeQuestValues){
|
||||||
if(data.quest.type != EnumQuestType.Kill && data.quest.type != EnumQuestType.AreaKill)
|
if (data.quest.type != EnumQuestType.Kill && data.quest.type != EnumQuestType.AreaKill)
|
||||||
continue;
|
continue;
|
||||||
if(data.quest.type == EnumQuestType.AreaKill && all){
|
|
||||||
List<EntityPlayer> list = player.worldObj.getEntitiesWithinAABB(EntityPlayer.class, entity.boundingBox.expand(10, 10, 10));
|
|
||||||
for(EntityPlayer pl : list)
|
|
||||||
if(pl != player)
|
|
||||||
doQuest(pl, entity, false);
|
|
||||||
|
|
||||||
|
if (data.quest.type == EnumQuestType.AreaKill && all) {
|
||||||
|
List<EntityPlayer> list = player.worldObj.getEntitiesWithinAABB(EntityPlayer.class, entity.boundingBox.expand(10, 10, 10));
|
||||||
|
for (EntityPlayer pl : list) {
|
||||||
|
if (pl != player) {
|
||||||
|
doQuest(pl, entity, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String name = entityName;
|
String name = entityName;
|
||||||
QuestKill quest = (QuestKill) data.quest.questInterface;
|
QuestKill quest = (QuestKill) data.quest.questInterface;
|
||||||
|
|
||||||
Class entityType = EntityNPCInterface.class;
|
Class entityType = EntityNPCInterface.class;
|
||||||
if(quest.targetType == 2) {
|
if (quest.targetType == 2) {
|
||||||
try {
|
try {
|
||||||
entityType = Class.forName(quest.customTargetType);
|
entityType = Class.forName(quest.customTargetType);
|
||||||
} catch (ClassNotFoundException notFoundException) {
|
} catch (ClassNotFoundException notFoundException) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(quest.targetType > 0 && !(entityType.isInstance(entity)))
|
|
||||||
|
if (quest.targetType > 0 && !(entityType.isInstance(entity)))
|
||||||
continue;
|
continue;
|
||||||
if(quest.targets.containsKey(entity.getCommandSenderName()))
|
|
||||||
|
if (quest.targets.containsKey(entity.getCommandSenderName()))
|
||||||
name = entity.getCommandSenderName();
|
name = entity.getCommandSenderName();
|
||||||
else if(!quest.targets.containsKey(name))
|
else if (!quest.targets.containsKey(name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
checkCompletion = true;
|
||||||
|
|
||||||
HashMap<String, Integer> killed = quest.getKilled(data);
|
HashMap<String, Integer> killed = quest.getKilled(data);
|
||||||
if(killed.containsKey(name) && killed.get(name) >= quest.targets.get(name))
|
if (!killed.containsKey(name)) {
|
||||||
continue;
|
killed.put(name, 1);
|
||||||
int amount = 0;
|
} else if(killed.get(name) < quest.targets.get(name)) {
|
||||||
if(killed.containsKey(name))
|
int amount = killed.get(name);
|
||||||
amount = killed.get(name);
|
killed.put(name, amount + 1);
|
||||||
killed.put(name, amount + 1);
|
}
|
||||||
quest.setKilled(data, killed);
|
quest.setKilled(data, killed);
|
||||||
change = true;
|
|
||||||
}
|
}
|
||||||
if(!change)
|
if(!checkCompletion)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
questData.checkQuestCompletion(playerData,EnumQuestType.Kill);
|
questData.checkQuestCompletion(playerData,EnumQuestType.Kill);
|
||||||
@@ -345,6 +360,12 @@ public class ServerEventsHandler {
|
|||||||
questData.checkQuestCompletion(playerData, EnumQuestType.Item);
|
questData.checkQuestCompletion(playerData, EnumQuestType.Item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void world(PlayerEvent.SaveToFile event){
|
||||||
|
PlayerData data = PlayerDataController.instance.getPlayerData((EntityPlayer) event.entity);
|
||||||
|
data.save();
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void world(EntityJoinWorldEvent event){
|
public void world(EntityJoinWorldEvent event){
|
||||||
if(event.world.isRemote || !(event.entity instanceof EntityPlayer))
|
if(event.world.isRemote || !(event.entity instanceof EntityPlayer))
|
||||||
@@ -353,12 +374,6 @@ public class ServerEventsHandler {
|
|||||||
data.updateCompanion(event.world);
|
data.updateCompanion(event.world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void world(PlayerEvent.SaveToFile event){
|
|
||||||
PlayerData data = PlayerDataController.instance.getPlayerData((EntityPlayer) event.entity);
|
|
||||||
data.savePlayerDataOnFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void populateChunk(PopulateChunkEvent.Post event){
|
public void populateChunk(PopulateChunkEvent.Post event){
|
||||||
NPCSpawning.performWorldGenSpawning(event.world, event.chunkX, event.chunkZ, event.rand);
|
NPCSpawning.performWorldGenSpawning(event.world, event.chunkX, event.chunkZ, event.rand);
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.world.WorldServer;
|
|
||||||
import noppes.npcs.client.AnalyticsTracking;
|
|
||||||
import noppes.npcs.controllers.SpawnController;
|
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||||
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 net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.world.WorldServer;
|
||||||
|
import noppes.npcs.client.AnalyticsTracking;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
public class ServerTickHandler {
|
public class ServerTickHandler {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.util.IChatComponent;
|
|
||||||
|
|
||||||
public class TextBlock {
|
public class TextBlock {
|
||||||
public List<IChatComponent> lines = new ArrayList<IChatComponent>();
|
public List<IChatComponent> lines = new ArrayList<IChatComponent>();
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagInt;
|
import net.minecraft.nbt.NBTTagInt;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import noppes.npcs.controllers.data.Line;
|
import noppes.npcs.controllers.data.Line;
|
||||||
import noppes.npcs.controllers.data.Lines;
|
import noppes.npcs.controllers.data.Lines;
|
||||||
import noppes.npcs.entity.EntityCustomNpc;
|
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import org.lwjgl.Sys;
|
import noppes.npcs.entity.data.ModelRotate;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class VersionCompatibility {
|
public class VersionCompatibility {
|
||||||
public static int ModRev = 19;
|
public static int ModRev = 21;
|
||||||
|
|
||||||
public static void CheckNpcCompatibility(EntityNPCInterface npc, NBTTagCompound compound){
|
public static void CheckNpcCompatibility(EntityNPCInterface npc, NBTTagCompound compound){
|
||||||
if(npc.npcVersion == ModRev)
|
if(npc.npcVersion == ModRev)
|
||||||
@@ -115,21 +114,67 @@ public class VersionCompatibility {
|
|||||||
public static void CheckModelCompatibility(EntityNPCInterface npc, NBTTagCompound compound){
|
public static void CheckModelCompatibility(EntityNPCInterface npc, NBTTagCompound compound){
|
||||||
if(npc.npcVersion == ModRev)
|
if(npc.npcVersion == ModRev)
|
||||||
return;
|
return;
|
||||||
if(npc.npcVersion < 19) {
|
NBTTagCompound modelData = compound.getCompoundTag("NpcModelData");
|
||||||
NBTTagCompound partData = compound.getCompoundTag("NpcModelData");
|
if(npc.npcVersion < 20){
|
||||||
|
// Convert Puppet Job
|
||||||
|
if (compound.hasKey("NpcJob")) {
|
||||||
|
if(compound.getInteger("NpcJob") == 9){
|
||||||
|
// Remove Job
|
||||||
|
compound.setInteger("NpcJob", 0);
|
||||||
|
|
||||||
|
// Get Puppet Data
|
||||||
|
boolean moving = compound.getBoolean("PuppetMoving");
|
||||||
|
boolean attacking = compound.getBoolean("PuppetAttacking");
|
||||||
|
boolean standing = compound.getBoolean("PuppetStanding");
|
||||||
|
NBTTagCompound head = compound.getCompoundTag("PuppetHead");
|
||||||
|
NBTTagCompound body = compound.getCompoundTag("PuppetBody");
|
||||||
|
NBTTagCompound larm = compound.getCompoundTag("PuppetLArm");
|
||||||
|
NBTTagCompound rarm = compound.getCompoundTag("PuppetRArm");
|
||||||
|
NBTTagCompound lleg = compound.getCompoundTag("PuppetLLeg");
|
||||||
|
NBTTagCompound rleg = compound.getCompoundTag("PuppetRLeg");
|
||||||
|
|
||||||
|
// Enable Rotations
|
||||||
|
modelData.setBoolean("EnableRotation", true);
|
||||||
|
// Make New Rotation and Write It
|
||||||
|
ModelRotate newRotation = new ModelRotate();
|
||||||
|
newRotation.whileMoving = moving;
|
||||||
|
newRotation.whileAttacking = attacking;
|
||||||
|
newRotation.whileStanding = standing;
|
||||||
|
NBTTagCompound rotation = newRotation.writeToNBT();
|
||||||
|
rotation.setTag("PuppetHead", head);
|
||||||
|
rotation.setTag("PuppetBody", body);
|
||||||
|
rotation.setTag("PuppetLArm", larm);
|
||||||
|
rotation.setTag("PuppetRArm", rarm);
|
||||||
|
rotation.setTag("PuppetLLeg", lleg);
|
||||||
|
rotation.setTag("PuppetRLeg", rleg);
|
||||||
|
modelData.setTag("ModelRotation", rotation);
|
||||||
|
|
||||||
|
// Remove All Old Tags
|
||||||
|
compound.removeTag("PuppetMoving");
|
||||||
|
compound.removeTag("PuppetAttacking");
|
||||||
|
compound.removeTag("PuppetStanding");
|
||||||
|
compound.removeTag("PuppetHead");
|
||||||
|
compound.removeTag("PuppetBody");
|
||||||
|
compound.removeTag("PuppetLArm");
|
||||||
|
compound.removeTag("PuppetRArm");
|
||||||
|
compound.removeTag("PuppetLLeg");
|
||||||
|
compound.removeTag("PuppetRLeg");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(npc.npcVersion < 19) {
|
||||||
// Fix Leg MPM Dependency
|
// Fix Leg MPM Dependency
|
||||||
if(partData.hasKey("LegParts")){
|
if(modelData.hasKey("LegParts")){
|
||||||
NBTTagCompound legParts = partData.getCompoundTag("LegParts");
|
NBTTagCompound legParts = modelData.getCompoundTag("LegParts");
|
||||||
if(legParts.hasKey("Texture")){
|
if(legParts.hasKey("Texture")){
|
||||||
legParts.setString("Texture", legParts.getString("Texture").replace("moreplayermodels:textures", "customnpcs:textures/parts"));
|
legParts.setString("Texture", legParts.getString("Texture").replace("moreplayermodels:textures", "customnpcs:textures/parts"));
|
||||||
}
|
}
|
||||||
partData.setTag("LegParts", legParts);
|
modelData.setTag("LegParts", legParts);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix Part MPM Dependency
|
// Fix Part MPM Dependency
|
||||||
if(partData.hasKey("Parts")){
|
if(modelData.hasKey("Parts")){
|
||||||
NBTTagList list = partData.getTagList("Parts", 10);
|
NBTTagList list = modelData.getTagList("Parts", 10);
|
||||||
|
|
||||||
for (int i = 0; i < list.tagCount(); i++) {
|
for (int i = 0; i < list.tagCount(); i++) {
|
||||||
NBTTagCompound item = list.getCompoundTagAt(i);
|
NBTTagCompound item = list.getCompoundTagAt(i);
|
||||||
@@ -139,10 +184,10 @@ public class VersionCompatibility {
|
|||||||
}
|
}
|
||||||
list.func_150304_a(i, item);
|
list.func_150304_a(i, item);
|
||||||
}
|
}
|
||||||
partData.setTag("Parts", list);
|
modelData.setTag("Parts", list);
|
||||||
}
|
}
|
||||||
compound.setTag("NpcModelData", partData);
|
|
||||||
}
|
}
|
||||||
|
compound.setTag("NpcModelData", modelData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CheckAvailabilityCompatibility(ICompatibilty compatibilty, NBTTagCompound compound){
|
public static void CheckAvailabilityCompatibility(ICompatibilty compatibilty, NBTTagCompound compound){
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.entity.EntityCreature;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.pathfinding.PathEntity;
|
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
@@ -13,6 +9,8 @@ import net.minecraft.world.World;
|
|||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class EntityAIAmbushTarget extends EntityAIBase
|
public class EntityAIAmbushTarget extends EntityAIBase
|
||||||
{
|
{
|
||||||
private EntityNPCInterface theEntity;
|
private EntityNPCInterface theEntity;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import noppes.npcs.constants.AiMutex;
|
|
||||||
import noppes.npcs.constants.EnumAnimation;
|
import noppes.npcs.constants.EnumAnimation;
|
||||||
import noppes.npcs.constants.EnumMovingType;
|
import noppes.npcs.constants.EnumMovingType;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import net.minecraft.entity.ai.EntityAIBase;
|
|||||||
import net.minecraft.pathfinding.PathEntity;
|
import net.minecraft.pathfinding.PathEntity;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import noppes.npcs.CustomNpcs;
|
import noppes.npcs.config.ConfigMain;
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ public class EntityAIAttackTarget extends EntityAIBase
|
|||||||
this.entityTarget = entitylivingbase;
|
this.entityTarget = entitylivingbase;
|
||||||
this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(((EntityNPCInterface) this.attacker).stats.aggroRange);
|
this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(((EntityNPCInterface) this.attacker).stats.aggroRange);
|
||||||
this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase);
|
this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase);
|
||||||
this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(CustomNpcs.NpcNavRange);
|
this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(ConfigMain.NpcNavRange);
|
||||||
return this.entityPathEntity != null;
|
return this.entityPathEntity != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.entity.ai.RandomPositionGenerator;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.pathfinding.PathEntity;
|
import net.minecraft.pathfinding.PathEntity;
|
||||||
import net.minecraft.pathfinding.PathNavigate;
|
import net.minecraft.pathfinding.PathNavigate;
|
||||||
@@ -14,6 +11,8 @@ import noppes.npcs.constants.AiMutex;
|
|||||||
import noppes.npcs.constants.EnumNavType;
|
import noppes.npcs.constants.EnumNavType;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class EntityAIAvoidTarget extends EntityAIBase
|
public class EntityAIAvoidTarget extends EntityAIBase
|
||||||
{
|
{
|
||||||
/** The entity we are attached to */
|
/** The entity we are attached to */
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai;
|
|||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.entity.ai.RandomPositionGenerator;
|
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.entity.EntityCreature;
|
import net.minecraft.entity.EntityCreature;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
@@ -9,6 +7,8 @@ import net.minecraft.util.Vec3;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class EntityAIFindShade extends EntityAIBase
|
public class EntityAIFindShade extends EntityAIBase
|
||||||
{
|
{
|
||||||
private EntityCreature theCreature;
|
private EntityCreature theCreature;
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import net.minecraft.entity.EntityCreature;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.entity.ai.RandomPositionGenerator;
|
|
||||||
import net.minecraft.pathfinding.PathEntity;
|
|
||||||
import net.minecraft.pathfinding.PathPoint;
|
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.constants.EnumAnimation;
|
import noppes.npcs.constants.EnumAnimation;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -9,6 +7,8 @@ import noppes.npcs.constants.AiMutex;
|
|||||||
import noppes.npcs.constants.EnumStandingType;
|
import noppes.npcs.constants.EnumStandingType;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
public class EntityAILook extends EntityAIBase{
|
public class EntityAILook extends EntityAIBase{
|
||||||
private final EntityNPCInterface npc;
|
private final EntityNPCInterface npc;
|
||||||
private int idle = 0;
|
private int idle = 0;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.entity.EntityCreature;
|
import net.minecraft.entity.EntityCreature;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
@@ -9,6 +7,8 @@ import net.minecraft.util.Vec3;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class EntityAIMoveIndoors extends EntityAIBase
|
public class EntityAIMoveIndoors extends EntityAIBase
|
||||||
{
|
{
|
||||||
private EntityCreature theCreature;
|
private EntityCreature theCreature;
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.constants.EnumMovingType;
|
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class EntityAIMovingPath extends EntityAIBase
|
public class EntityAIMovingPath extends EntityAIBase
|
||||||
{
|
{
|
||||||
private EntityNPCInterface npc;
|
private EntityNPCInterface npc;
|
||||||
|
|||||||
@@ -1,23 +1,13 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EntityCreature;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.entity.monster.EntityPigZombie;
|
|
||||||
import net.minecraft.entity.monster.EntityZombie;
|
|
||||||
import net.minecraft.entity.passive.EntityVillager;
|
|
||||||
import net.minecraft.pathfinding.PathEntity;
|
|
||||||
import net.minecraft.pathfinding.PathPoint;
|
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class EntityAIOrbitTarget extends EntityAIBase
|
public class EntityAIOrbitTarget extends EntityAIBase
|
||||||
{
|
{
|
||||||
private EntityNPCInterface theEntity;
|
private EntityNPCInterface theEntity;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai;
|
|||||||
|
|
||||||
import net.minecraft.entity.EntityCreature;
|
import net.minecraft.entity.EntityCreature;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.entity.ai.RandomPositionGenerator;
|
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import net.minecraft.entity.EntityLivingBase;
|
|||||||
import net.minecraft.entity.IRangedAttackMob;
|
import net.minecraft.entity.IRangedAttackMob;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.constants.EnumAnimation;
|
import noppes.npcs.constants.EnumAnimation;
|
||||||
import noppes.npcs.constants.EnumNavType;
|
import noppes.npcs.constants.EnumNavType;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package noppes.npcs.ai;
|
|||||||
|
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import noppes.npcs.CustomNpcs;
|
import noppes.npcs.config.ConfigMain;
|
||||||
import noppes.npcs.constants.EnumMovingType;
|
import noppes.npcs.constants.EnumMovingType;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ public class EntityAIReturn extends EntityAIBase
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(npc.ai.movingType == EnumMovingType.MovingPath && npc.ai.getDistanceSqToPathPoint() < CustomNpcs.NpcNavRange * CustomNpcs.NpcNavRange)
|
if(npc.ai.movingType == EnumMovingType.MovingPath && npc.ai.getDistanceSqToPathPoint() < ConfigMain.NpcNavRange * ConfigMain.NpcNavRange)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (npc.getNavigator().noPath() || (!npc.isAttacking() && wasAttacked)) {
|
if (npc.getNavigator().noPath() || (!npc.isAttacking() && wasAttacked)) {
|
||||||
@@ -129,10 +129,10 @@ public class EntityAIReturn extends EntityAIBase
|
|||||||
double posY = endPosY;
|
double posY = endPosY;
|
||||||
double posZ = endPosZ;
|
double posZ = endPosZ;
|
||||||
double range = npc.getDistance(posX, posY, posZ);
|
double range = npc.getDistance(posX, posY, posZ);
|
||||||
if(range > CustomNpcs.NpcNavRange || towards){
|
if(range > ConfigMain.NpcNavRange || towards){
|
||||||
int distance = (int) range;
|
int distance = (int) range;
|
||||||
if(distance > CustomNpcs.NpcNavRange)
|
if(distance > ConfigMain.NpcNavRange)
|
||||||
distance = CustomNpcs.NpcNavRange / 2;
|
distance = ConfigMain.NpcNavRange / 2;
|
||||||
else
|
else
|
||||||
distance /= 2;
|
distance /= 2;
|
||||||
if(distance > 2){
|
if(distance > 2){
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.constants.EnumNavType;
|
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
public class EntityAIStalkTarget extends EntityAIBase
|
public class EntityAIStalkTarget extends EntityAIBase
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import noppes.npcs.NoppesStringUtils;
|
|
||||||
import noppes.npcs.NoppesUtilServer;
|
|
||||||
import noppes.npcs.Server;
|
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.constants.EnumPacketClient;
|
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
public class EntityAITransform extends EntityAIBase {
|
public class EntityAITransform extends EntityAIBase {
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.command.IEntitySelector;
|
import net.minecraft.command.IEntitySelector;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import noppes.npcs.CustomNpcs;
|
|
||||||
import noppes.npcs.ai.selector.NPCInteractSelector;
|
import noppes.npcs.ai.selector.NPCInteractSelector;
|
||||||
|
import noppes.npcs.config.ConfigMain;
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.controllers.data.Line;
|
import noppes.npcs.controllers.data.Line;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class EntityAIWander extends EntityAIBase
|
public class EntityAIWander extends EntityAIBase
|
||||||
{
|
{
|
||||||
private EntityNPCInterface entity;
|
private EntityNPCInterface entity;
|
||||||
@@ -84,12 +84,12 @@ public class EntityAIWander extends EntityAIBase
|
|||||||
if(entity.ai.walkingRange > 0){
|
if(entity.ai.walkingRange > 0){
|
||||||
double distance = this.entity.getDistanceSq(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos());
|
double distance = this.entity.getDistanceSq(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos());
|
||||||
int range = (int) MathHelper.sqrt_double(this.entity.ai.walkingRange * this.entity.ai.walkingRange - distance);
|
int range = (int) MathHelper.sqrt_double(this.entity.ai.walkingRange * this.entity.ai.walkingRange - distance);
|
||||||
if(range > CustomNpcs.NpcNavRange)
|
if(range > ConfigMain.NpcNavRange)
|
||||||
range = CustomNpcs.NpcNavRange;
|
range = ConfigMain.NpcNavRange;
|
||||||
if(range < 3){
|
if(range < 3){
|
||||||
range = this.entity.ai.walkingRange;
|
range = this.entity.ai.walkingRange;
|
||||||
if(range > CustomNpcs.NpcNavRange)
|
if(range > ConfigMain.NpcNavRange)
|
||||||
range = CustomNpcs.NpcNavRange;
|
range = ConfigMain.NpcNavRange;
|
||||||
Vec3 start = Vec3.createVectorHelper(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos());
|
Vec3 start = Vec3.createVectorHelper(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos());
|
||||||
return RandomPositionGeneratorAlt.findRandomTargetBlockTowards(this.entity, range / 2, range / 2 > 7?7:range / 2, start);
|
return RandomPositionGeneratorAlt.findRandomTargetBlockTowards(this.entity, range / 2, range / 2 > 7?7:range / 2, start);
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ public class EntityAIWander extends EntityAIBase
|
|||||||
return RandomPositionGeneratorAlt.findRandomTarget(this.entity, range, range / 2 > 7?7:range / 2);
|
return RandomPositionGeneratorAlt.findRandomTarget(this.entity, range, range / 2 > 7?7:range / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RandomPositionGeneratorAlt.findRandomTarget(this.entity, CustomNpcs.NpcNavRange, 7);
|
return RandomPositionGeneratorAlt.findRandomTarget(this.entity, ConfigMain.NpcNavRange, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package noppes.npcs.ai;
|
|||||||
import net.minecraft.entity.EntityCreature;
|
import net.minecraft.entity.EntityCreature;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.ai.EntityAIBase;
|
import net.minecraft.entity.ai.EntityAIBase;
|
||||||
import net.minecraft.entity.ai.RandomPositionGenerator;
|
|
||||||
import net.minecraft.pathfinding.PathEntity;
|
import net.minecraft.pathfinding.PathEntity;
|
||||||
import net.minecraft.pathfinding.PathPoint;
|
import net.minecraft.pathfinding.PathPoint;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package noppes.npcs.ai;
|
package noppes.npcs.ai;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import net.minecraft.entity.EntityCreature;
|
import net.minecraft.entity.EntityCreature;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class RandomPositionGeneratorAlt
|
public class RandomPositionGeneratorAlt
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import net.minecraft.entity.Entity;
|
|||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.pathfinding.PathFinder;
|
import net.minecraft.pathfinding.PathFinder;
|
||||||
import net.minecraft.pathfinding.PathPoint;
|
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.IntHashMap;
|
import net.minecraft.util.math.IntHashMap;
|
||||||
@@ -16,7 +15,6 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import noppes.npcs.entity.EntityCustomNpc;
|
import noppes.npcs.entity.EntityCustomNpc;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai.pathfinder;
|
|||||||
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes;
|
import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
import net.minecraft.entity.ai.EntityMoveHelper;
|
import net.minecraft.entity.ai.EntityMoveHelper;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import noppes.npcs.entity.EntityNPCFlying;
|
import noppes.npcs.entity.EntityNPCFlying;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai.pathfinder;
|
|||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.pathfinding.PathEntity;
|
import net.minecraft.pathfinding.PathEntity;
|
||||||
import net.minecraft.pathfinding.PathPoint;
|
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
|
|
||||||
public class NPCPath extends PathEntity{
|
public class NPCPath extends PathEntity{
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.ChunkCache;
|
import net.minecraft.world.ChunkCache;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class PathNavigateFlying extends PathNavigate {
|
public class PathNavigateFlying extends PathNavigate {
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package noppes.npcs.ai.selector;
|
package noppes.npcs.ai.selector;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.command.IEntitySelector;
|
import net.minecraft.command.IEntitySelector;
|
||||||
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.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.potion.Potion;
|
import net.minecraft.potion.Potion;
|
||||||
import noppes.npcs.CustomNpcs;
|
|
||||||
import noppes.npcs.constants.EnumCompanionJobs;
|
import noppes.npcs.constants.EnumCompanionJobs;
|
||||||
import noppes.npcs.constants.EnumJobType;
|
import noppes.npcs.constants.EnumJobType;
|
||||||
import noppes.npcs.constants.EnumMovingType;
|
import noppes.npcs.constants.EnumMovingType;
|
||||||
|
|||||||
@@ -1,16 +1,8 @@
|
|||||||
package noppes.npcs.ai.target;
|
package noppes.npcs.ai.target;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.command.IEntitySelector;
|
|
||||||
import net.minecraft.entity.EntityCreature;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
|
||||||
import net.minecraft.entity.ai.EntityAITarget;
|
import net.minecraft.entity.ai.EntityAITarget;
|
||||||
import net.minecraft.entity.monster.EntityMob;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
public class EntityAIClearTarget extends EntityAITarget
|
public class EntityAIClearTarget extends EntityAITarget
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package noppes.npcs.ai.target;
|
package noppes.npcs.ai.target;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.command.IEntitySelector;
|
import net.minecraft.command.IEntitySelector;
|
||||||
import net.minecraft.entity.EntityCreature;
|
import net.minecraft.entity.EntityCreature;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
@@ -11,9 +8,12 @@ import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
|||||||
import net.minecraft.entity.ai.EntityAITarget;
|
import net.minecraft.entity.ai.EntityAITarget;
|
||||||
import net.minecraft.entity.monster.EntityMob;
|
import net.minecraft.entity.monster.EntityMob;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import noppes.npcs.CustomNpcs;
|
import noppes.npcs.config.ConfigMain;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class EntityAIClosestTarget extends EntityAITarget
|
public class EntityAIClosestTarget extends EntityAITarget
|
||||||
{
|
{
|
||||||
private final Class targetClass;
|
private final Class targetClass;
|
||||||
@@ -59,7 +59,7 @@ public class EntityAIClosestTarget extends EntityAITarget
|
|||||||
double d0 = this.getTargetDistance();
|
double d0 = this.getTargetDistance();
|
||||||
List list = this.taskOwner.worldObj.selectEntitiesWithinAABB(this.targetClass, this.taskOwner.boundingBox.expand(d0, MathHelper.ceiling_double_int(d0 / 2.0D), d0), this.field_82643_g);
|
List list = this.taskOwner.worldObj.selectEntitiesWithinAABB(this.targetClass, this.taskOwner.boundingBox.expand(d0, MathHelper.ceiling_double_int(d0 / 2.0D), d0), this.field_82643_g);
|
||||||
Collections.sort(list, this.theNearestAttackableTargetSorter);
|
Collections.sort(list, this.theNearestAttackableTargetSorter);
|
||||||
taskOwner.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(CustomNpcs.NpcNavRange);
|
taskOwner.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(ConfigMain.NpcNavRange);
|
||||||
if (list.isEmpty())
|
if (list.isEmpty())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai.target;
|
|||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.ai.EntityAITarget;
|
import net.minecraft.entity.ai.EntityAITarget;
|
||||||
import net.minecraft.entity.passive.EntityTameable;
|
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai.target;
|
|||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.ai.EntityAITarget;
|
import net.minecraft.entity.ai.EntityAITarget;
|
||||||
import net.minecraft.entity.passive.EntityTameable;
|
|
||||||
import noppes.npcs.constants.AiMutex;
|
import noppes.npcs.constants.AiMutex;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.BlockColored;
|
import net.minecraft.block.BlockColored;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@@ -21,8 +21,8 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import noppes.npcs.NoppesUtilServer;
|
import noppes.npcs.NoppesUtilServer;
|
||||||
import noppes.npcs.blocks.tiles.TileBanner;
|
import noppes.npcs.blocks.tiles.TileBanner;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockBanner extends BlockContainer{
|
public class BlockBanner extends BlockContainer{
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
@@ -16,6 +14,8 @@ import noppes.npcs.blocks.tiles.TileBarrel;
|
|||||||
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockBarrel extends BlockRotated{
|
public class BlockBarrel extends BlockRotated{
|
||||||
|
|
||||||
public BlockBarrel() {
|
public BlockBarrel() {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
@@ -13,6 +11,8 @@ import net.minecraft.world.World;
|
|||||||
import noppes.npcs.blocks.tiles.TileBeam;
|
import noppes.npcs.blocks.tiles.TileBeam;
|
||||||
import noppes.npcs.blocks.tiles.TileColorable;
|
import noppes.npcs.blocks.tiles.TileColorable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockBeam extends BlockRotated{
|
public class BlockBeam extends BlockRotated{
|
||||||
|
|
||||||
public BlockBeam() {
|
public BlockBeam() {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
@@ -19,13 +19,9 @@ import noppes.npcs.CustomItems;
|
|||||||
import noppes.npcs.CustomNpcs;
|
import noppes.npcs.CustomNpcs;
|
||||||
import noppes.npcs.CustomNpcsPermissions;
|
import noppes.npcs.CustomNpcsPermissions;
|
||||||
import noppes.npcs.NoppesUtilServer;
|
import noppes.npcs.NoppesUtilServer;
|
||||||
import noppes.npcs.Server;
|
|
||||||
import noppes.npcs.blocks.tiles.TileBigSign;
|
import noppes.npcs.blocks.tiles.TileBigSign;
|
||||||
import noppes.npcs.blocks.tiles.TileColorable;
|
import noppes.npcs.blocks.tiles.TileColorable;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
import noppes.npcs.constants.EnumPacketClient;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockBigSign extends BlockContainer{
|
public class BlockBigSign extends BlockContainer{
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockEnchantmentTable;
|
|
||||||
import net.minecraft.block.BlockFence;
|
|
||||||
import net.minecraft.block.BlockFenceGate;
|
|
||||||
import net.minecraft.block.BlockFurnace;
|
|
||||||
import net.minecraft.block.BlockGlowstone;
|
|
||||||
import net.minecraft.block.BlockSapling;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
@@ -18,9 +15,6 @@ import net.minecraft.util.MathHelper;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import noppes.npcs.CustomItems;
|
import noppes.npcs.CustomItems;
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockBlood extends Block{
|
public class BlockBlood extends Block{
|
||||||
|
|
||||||
|
|||||||
@@ -2,27 +2,21 @@ package noppes.npcs.blocks;
|
|||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import noppes.npcs.CustomItems;
|
import noppes.npcs.CustomItems;
|
||||||
import noppes.npcs.CustomNpcs;
|
import noppes.npcs.CustomNpcs;
|
||||||
import noppes.npcs.Server;
|
|
||||||
import noppes.npcs.blocks.tiles.TileBorder;
|
import noppes.npcs.blocks.tiles.TileBorder;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
import noppes.npcs.constants.EnumPacketServer;
|
|
||||||
|
|
||||||
public class BlockBorder extends BlockContainer{
|
public class BlockBorder extends BlockContainer{
|
||||||
public int renderId = -1;
|
public int renderId = -1;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
@@ -14,11 +14,9 @@ import noppes.npcs.CustomItems;
|
|||||||
import noppes.npcs.CustomNpcs;
|
import noppes.npcs.CustomNpcs;
|
||||||
import noppes.npcs.NoppesUtilServer;
|
import noppes.npcs.NoppesUtilServer;
|
||||||
import noppes.npcs.blocks.tiles.TileCampfire;
|
import noppes.npcs.blocks.tiles.TileCampfire;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import java.util.Random;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockCampfire extends BlockLightable{
|
public class BlockCampfire extends BlockLightable{
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
@@ -12,8 +11,8 @@ import net.minecraft.world.World;
|
|||||||
import noppes.npcs.CustomItems;
|
import noppes.npcs.CustomItems;
|
||||||
import noppes.npcs.blocks.tiles.TileCandle;
|
import noppes.npcs.blocks.tiles.TileCandle;
|
||||||
import noppes.npcs.blocks.tiles.TileColorable;
|
import noppes.npcs.blocks.tiles.TileColorable;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockCandle extends BlockLightable{
|
public class BlockCandle extends BlockLightable{
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
@@ -15,11 +13,12 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import noppes.npcs.CustomItems;
|
|
||||||
import noppes.npcs.CustomNpcs;
|
import noppes.npcs.CustomNpcs;
|
||||||
import noppes.npcs.blocks.tiles.TileBlockAnvil;
|
import noppes.npcs.blocks.tiles.TileBlockAnvil;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockCarpentryBench extends BlockContainer
|
public class BlockCarpentryBench extends BlockContainer
|
||||||
{
|
{
|
||||||
public int renderId = -1;
|
public int renderId = -1;
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.block.BlockContainer;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
@@ -14,17 +9,12 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import noppes.npcs.blocks.tiles.TileChair;
|
import noppes.npcs.blocks.tiles.TileChair;
|
||||||
import noppes.npcs.blocks.tiles.TileColorable;
|
|
||||||
import noppes.npcs.entity.EntityChairMount;
|
import noppes.npcs.entity.EntityChairMount;
|
||||||
import noppes.npcs.entity.EntityCustomNpc;
|
import noppes.npcs.entity.EntityCustomNpc;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockChair extends BlockRotated{
|
public class BlockChair extends BlockRotated{
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockColored;
|
import net.minecraft.block.BlockColored;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
@@ -22,8 +22,8 @@ import net.minecraft.world.World;
|
|||||||
import noppes.npcs.NoppesUtilServer;
|
import noppes.npcs.NoppesUtilServer;
|
||||||
import noppes.npcs.blocks.tiles.TileColorable;
|
import noppes.npcs.blocks.tiles.TileColorable;
|
||||||
import noppes.npcs.blocks.tiles.TileCouchWood;
|
import noppes.npcs.blocks.tiles.TileCouchWood;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockCouchWood extends BlockContainer{
|
public class BlockCouchWood extends BlockContainer{
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockColored;
|
import net.minecraft.block.BlockColored;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
@@ -22,8 +22,8 @@ import net.minecraft.world.World;
|
|||||||
import noppes.npcs.NoppesUtilServer;
|
import noppes.npcs.NoppesUtilServer;
|
||||||
import noppes.npcs.blocks.tiles.TileColorable;
|
import noppes.npcs.blocks.tiles.TileColorable;
|
||||||
import noppes.npcs.blocks.tiles.TileCouchWool;
|
import noppes.npcs.blocks.tiles.TileCouchWool;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockCouchWool extends BlockContainer{
|
public class BlockCouchWool extends BlockContainer{
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
@@ -16,6 +14,8 @@ import noppes.npcs.blocks.tiles.TileCrate;
|
|||||||
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockCrate extends BlockRotated{
|
public class BlockCrate extends BlockRotated{
|
||||||
|
|
||||||
public BlockCrate() {
|
public BlockCrate() {
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockBreakable;
|
import net.minecraft.block.BlockBreakable;
|
||||||
import net.minecraft.block.material.MapColor;
|
import net.minecraft.block.material.MapColor;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@@ -14,6 +10,8 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockCrystal extends BlockBreakable{
|
public class BlockCrystal extends BlockBreakable{
|
||||||
|
|
||||||
public BlockCrystal() {
|
public BlockCrystal() {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
@@ -10,8 +11,6 @@ import net.minecraft.world.World;
|
|||||||
import noppes.npcs.CustomItems;
|
import noppes.npcs.CustomItems;
|
||||||
import noppes.npcs.blocks.tiles.TileColorable;
|
import noppes.npcs.blocks.tiles.TileColorable;
|
||||||
import noppes.npcs.blocks.tiles.TileLamp;
|
import noppes.npcs.blocks.tiles.TileLamp;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class BlockLamp extends BlockLightable{
|
public class BlockLamp extends BlockLightable{
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
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;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public abstract class BlockLightable extends BlockRotated{
|
public abstract class BlockLightable extends BlockRotated{
|
||||||
|
|
||||||
protected BlockLightable(Block block, boolean lit) {
|
protected BlockLightable(Block block, boolean lit) {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package noppes.npcs.blocks;
|
package noppes.npcs.blocks;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import java.util.List;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -21,8 +20,9 @@ import noppes.npcs.Server;
|
|||||||
import noppes.npcs.blocks.tiles.TileMailbox;
|
import noppes.npcs.blocks.tiles.TileMailbox;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
import noppes.npcs.constants.EnumPacketClient;
|
import noppes.npcs.constants.EnumPacketClient;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockMailbox extends BlockContainer{
|
public class BlockMailbox extends BlockContainer{
|
||||||
|
|
||||||
|
|||||||
Loaded 100 of 630 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user