203 Commits

Author SHA1 Message Date
71a706dfab Russian Language updates 2022-09-10 21:15:02 +00:00
Mohammad-Ali Minaie
3cb82b5e4c updating version 2019-07-15 22:19:28 -04:00
Mohammad-Ali Minaie
a341f1677a updating version to make sense 2019-07-15 22:17:35 -04:00
312bcb82bd Version Bump 2019-06-14 12:09:40 -05:00
295e556867 Sync'd maven repositories 2019-06-13 14:13:32 -05:00
Mohammad-Ali Minaie
d74f564d8e modify props 2019-06-10 15:22:22 -04:00
Mohammad-Ali Minaie
cbe15662e3 fixed bug with jei crashing when hovering over tool or weapon parts 2019-06-09 15:09:33 -04:00
Mohammad-Ali Minaie
bad57bdb6b update version 2019-06-08 15:53:27 -04:00
Mohammad-Ali Minaie
5ada5951bf fixing bug with moved crucibles and broken textures 2019-06-08 15:52:20 -04:00
Mohammad-Ali Minaie
a7f3b0b5ab adding russian lang file 2019-02-25 18:35:16 -05:00
Mohammad-Ali Minaie
ab42ba9f30 updating tooltip printout to print properly 2019-01-28 12:42:05 -05:00
Mohammad-Ali Minaie
6c467978fc version bump plus print out removal 2018-12-16 17:44:49 -05:00
Mohammad-Ali Minaie
88b60140d6 updating master with new script 2018-11-02 22:06:16 -04:00
Mohammad-Ali Minaie
f3cccdc613 fixed cauldron recipe and updated lang file 2018-10-31 17:29:43 -04:00
Mohammad-Ali Minaie
fdc65afa5d update 2018-10-29 16:26:26 -04:00
Mohammad-Ali Minaie
ce398ba90c fixed rendering and NBT crash with old weapons 2018-10-29 07:27:51 -04:00
Mohammad-Ali Minaie
69b0435cc3 sharpening and weapon upgrading 2018-10-28 14:57:33 -04:00
Mohammad-Ali Minaie
5d52195bda more Grinding bench stuff 2018-10-28 10:55:46 -04:00
Mohammad-Ali Minaie
25ba3af7c6 fixed merge conflict from master 2018-10-27 16:26:09 -04:00
Mohammad-Ali Minaie
94ed0367aa fixed some small render bugs 2018-10-27 16:25:03 -04:00
Mohammad-Ali Minaie
51561d063e update with merge conflict resolved 2018-10-27 15:28:36 -04:00
Mohammad-Ali Minaie
8fda4b25c4 update to crucible, should be fixed now 2018-10-26 23:26:33 -04:00
Mohammad-Ali Minaie
5ef2b3bd0d update before switch to master 2018-10-26 17:19:44 -04:00
Mohammad-Ali Minaie
7afe86e45e Merge branch 'master-1.12' into feature-1.12 2018-10-25 22:18:12 -04:00
Mohammad-Ali Minaie
69f25c4d0c fixed nbt crucible item adding bug 2018-10-25 22:17:49 -04:00
Mohammad-Ali Minaie
4260b1169c secret 2018-10-25 20:36:34 -04:00
Mohammad-Ali Minaie
b6cbeac459 updating toolbench weapon upgrade feature 2018-10-25 01:14:37 -04:00
Mohammad-Ali Minaie
d4881ea454 Merge branch 'master-1.12' into feature-1.12 2018-10-22 08:07:19 -04:00
Mohammad-Ali Minaie
d83adf0323 pushing fix to casting 2018-10-22 08:06:53 -04:00
Mohammad-Ali Minaie
324bba66c1 bugfixed in feature again 2018-10-22 06:43:36 -04:00
Mohammad-Ali Minaie
908c5150e5 update weapon crafting 2018-10-22 06:12:50 -04:00
Mohammad-Ali Minaie
eb429a5fc2 trying to fix merge conflixt 2018-10-20 19:49:32 -04:00
Mohammad-Ali Minaie
b7aba91158 somehow files got sent to master instead of feature 2018-10-20 19:47:27 -04:00
Mohammad-Ali Minaie
51d3bb7df3 trying to push new files 2018-10-20 18:17:53 -04:00
Mohammad-Ali Minaie
8a4f6f6dda made chisel placement better 2018-10-20 17:19:51 -04:00
Mohammad-Ali Minaie
fec851e5af fixed a bug but in the wrong branch 2018-10-20 11:06:35 -04:00
Mohammad-Ali Minaie
2b9f131984 created bone handle and bone guard items as well as workbench recipes to create the finised item, need to check if the NBT transfers correctly 2018-10-19 08:03:59 -04:00
Mohammad-Ali Minaie
b390ac48be Merge branch 'master-1.12' into feature-1.12 2018-10-18 20:01:05 -04:00
Mohammad-Ali Minaie
0e785eff57 bugfix for chisel 2018-10-18 20:00:00 -04:00
Mohammad-Ali Minaie
b7f3d04929 need saw and blade recipes to make weapon hilts and guards 2018-10-18 18:39:11 -04:00
Mohammad-Ali Minaie
dbc591fc59 created raw gladius for all material types and abstracted recipe creator, need wither dust in PC 2018-10-17 22:08:04 -04:00
Mohammad-Ali Minaie
0efd2b73fd weapon upgrades baby 2018-10-16 21:47:13 -04:00
Mohammad-Ali Minaie
3d8552ed1a trying to match inputs 2018-10-16 10:58:47 -04:00
Mohammad-Ali Minaie
eecd4536ce fixed the toolbench recipes and recipe to craft it 2018-10-15 16:53:12 -04:00
Mohammad-Ali Minaie
a822458bc2 upadting the longbow to work more like and render more like a vanilla bow 2018-10-15 16:11:16 -04:00
Mohammad-Ali Minaie
8b09d55bd0 updating workspace before new changes 2018-10-15 08:47:06 -04:00
Mohammad-Ali Minaie
25cf6c6704 something is wrong with my classpath for blocks 2018-10-14 13:40:02 -04:00
Mohammad-Ali Minaie
dbc09ae0b3 getting no class def error 2018-10-14 12:34:08 -04:00
Mohammad-Ali Minaie
1d45f17f21 changed the printout statements for the bloomery and fixed a dupe bug with damascus 2018-10-09 19:16:12 -04:00
Mohammad-Ali Minaie
f606675101 remove damascus config update to-dos released .22 2018-10-08 22:49:54 -04:00
Mohammad-Ali Minaie
03d0724cd2 finizhed chisel and sledgehammer feature plus fixed some bugs 2018-10-06 18:55:02 -04:00
Mohammad-Ali Minaie
14fc81e64b update code, missing my CrucibleRecipes class... 2018-10-06 14:21:45 -04:00
Mohammad-Ali Minaie
69ab05bc18 need to add bounding for chisel, chisel and sledgehammer crafting, chisel and sledgehammer asset updates 2018-10-06 02:38:22 -04:00
Mohammad-Ali Minaie
51eaa9eaeb more work on the chisel and hammer feature 2018-10-05 23:52:12 -04:00
Mohammad-Ali Minaie
ad02317dcd hammer and chisel working like i want, chisel needs directional, and hitting sounds, need rock crumbling sounds, 2018-10-04 17:01:20 -04:00
Mohammad-Ali Minaie
f5f00fd2e7 updated enchantment remove logic and created models for chisel and sledgehammer 2018-10-03 17:39:12 -04:00
Mohammad-Ali Minaie
3173246104 updated versions 2018-10-03 14:11:50 -04:00
Mohammad-Ali Minaie
e5ce106785 CT support for crucible recipes 2018-10-02 22:24:23 -04:00
Mohammad-Ali Minaie
0b16ea1138 updating with current code 2018-10-02 19:10:03 -04:00
Mohammad-Ali Minaie
bf125d564f update with new code 2018-10-02 17:31:53 -04:00
Mohammad-Ali Minaie
0b1fac7b05 pushing working CT code and recipe code for the crucible but its not updated JEI with new recipes 2018-10-02 17:02:51 -04:00
Mohammad-Ali Minaie
1b2ca345ce CT is working except add recipes 2018-10-02 03:27:30 -04:00
Mohammad-Ali Minaie
2ef0a38a8c Merge branch 'feature-1.12' of ssh://git.nmd.so:12000/nmd/ForgeCraft into master-1.12 2018-10-02 01:38:16 -04:00
Mohammad-Ali Minaie
eff6124c2a fking lang file 2018-10-02 01:04:11 -04:00
Mohammad-Ali Minaie
725186d1a6 renamed crap 2018-10-02 00:31:48 -04:00
Mohammad-Ali Minaie
1a9b83059a checking these damn recipes 2018-10-02 00:27:23 -04:00
Mohammad-Ali Minaie
3c9d80b139 version bump 2018-10-01 23:07:38 -04:00
Mohammad-Ali Minaie
93b7f9f82c working CT redoing all recipe handlers, woo.... 2018-10-01 23:00:30 -04:00
Mohammad-Ali Minaie
369e02712d push fixes and version updates 2018-10-01 18:19:27 -04:00
Mohammad-Ali Minaie
2f0c56c0eb update todos 2018-10-01 06:44:43 -04:00
Mohammad-Ali Minaie
2faa718deb tools range upgrades from 1-5 longbow fixed, reduced forge light level, forge really cools down now, chunks dont read upgrades, casting form works, anvil can cool down items stored in its inventory, 2018-09-30 14:30:47 -04:00
Mohammad-Ali Minaie
c765542d6a Forge Light level reduce, forge cools down, ingots dont need to read upgrades, casting form fixed, anvil now cools its inventory, longbow arrow velocity balanced, more bucket crafting, config, copper tools, config for lowering fortune multiplier need to finish copper tool and tool head assets 2018-09-28 02:04:01 -04:00
Mohammad-Ali Minaie
a77e2637ee working on fixing so many things 2018-09-27 15:57:37 -04:00
Mohammad-Ali Minaie
2c0c89f91b fixed forge lighting being to bright and updated to-do list 2018-09-26 09:38:34 -04:00
Mohammad-Ali Minaie
d7c4e390ea fixing forge 2018-09-25 12:44:29 -04:00
Mohammad-Ali Minaie
e5fe677771 update todos 2018-09-25 09:04:40 -04:00
Mohammad-Ali Minaie
8fc8dd32c2 fixed bugs 2018-09-25 07:52:42 -04:00
Mohammad-Ali Minaie
73a9bef667 updated and pulled back mcpMappings 2018-09-23 20:42:50 -04:00
Mohammad-Ali Minaie
432239c820 updated updating capability 2018-09-23 16:57:35 -04:00
Mohammad-Ali Minaie
91ea728d3b trying to fix capabilities 2018-09-23 16:24:58 -04:00
Mohammad-Ali Minaie
4818efe33c working on capabilities optimized imports 2018-09-23 12:21:57 -04:00
Mohammad-Ali Minaie
8dc5089de3 update tool parte 2018-09-23 00:02:03 -04:00
Mohammad-Ali Minaie
b6c42230fe tongs are functional but rendering is jacked 2018-09-22 22:08:37 -04:00
Mohammad-Ali Minaie
a06c4ce4ba workign through issues in the ForgeHandler 2018-09-22 20:52:36 -04:00
Mohammad-Ali Minaie
10e5e3d537 trying to get this damn handler to work 2018-09-22 20:10:45 -04:00
Mohammad-Ali Minaie
d5c64228ca adding capability to the tongs 2018-09-22 18:28:24 -04:00
Mohammad-Ali Minaie
0d1cbbaf95 trying to fix the forge 2018-09-22 15:41:06 -04:00
Mohammad-Ali Minaie
fed30aef92 Merge branch 'master-1.12' into feature-1.12 2018-09-21 23:42:59 -04:00
Mohammad-Ali Minaie
6f5dd58fc5 fixed slot tongs rendering 2018-09-21 23:25:16 -04:00
Mohammad-Ali Minaie
a45d502cc6 fixed render desnyc for tongs 2018-09-21 23:19:19 -04:00
Mohammad-Ali Minaie
456b51827c Merge branch 'master-1.12' into feature-1.12 2018-09-21 20:57:43 -04:00
Mohammad-Ali Minaie
ad4ba47527 fixed nbt breaking and rendering issues 2018-09-21 20:55:47 -04:00
Mohammad-Ali Minaie
bd6f01c244 working on copper tools and weapons / weapon upgrades 2018-09-21 11:03:10 -04:00
Mohammad-Ali Minaie
6656a2a3ab update version, start weapon upgrades 2018-09-21 00:04:40 -04:00
Mohammad-Ali Minaie
7151eef000 fixing the bugs 2018-09-20 18:36:13 -04:00
Mohammad-Ali Minaie
d17f020fc5 fixed a lot of things getting ready to push overwrite master-1.12 2018-09-20 12:59:34 -04:00
Mohammad-Ali Minaie
498847ad88 updating more casting and crucible shit 2018-09-18 17:10:52 -04:00
Mohammad-Ali Minaie
53df487ec2 updated recipe management 2018-09-18 10:00:42 -04:00
Mohammad-Ali Minaie
e083708a57 reworking the casting classes 2018-09-17 23:00:31 -04:00
Mohammad-Ali Minaie
8c6fbac6b0 switch out lacquerstick for OreDict treated stick 2018-09-17 04:53:48 -04:00
Mohammad-Ali Minaie
65e42b39c2 fixed Anvil JEI 2018-09-17 04:38:12 -04:00
Mohammad-Ali Minaie
ff8170b01e trying to add Anvil Recipe JEI 2018-09-17 00:40:34 -04:00
Mohammad-Ali Minaie
4e353b9f3c add JEI for Crucibles, adding JEI for anvil 2018-09-16 21:37:20 -04:00
Mohammad-Ali Minaie
ec1d66e3d7 updating recipe category, trying to render input slots 2018-09-15 20:01:33 -04:00
bfda82bc78 Merge branch 'ansar-jei' of nmd/ForgeCraft into nbtCrucible 2018-09-15 22:39:56 +00:00
srw
c12d708e48 jei test 2018-09-15 15:35:06 -07:00
e38ef6bdfa Merge branch 'ansar-hibachi' of nmd/ForgeCraft into nbtCrucible 2018-09-15 22:11:57 +00:00
srw
49c877afd3 add hibachi/drying recipe for the soft crucible 2018-09-15 15:07:04 -07:00
Mohammad-Ali Minaie
0714f9f0fa update gradle.properties 2018-09-15 17:46:13 -04:00
Mohammad-Ali Minaie
d25777955f jei crashing on load 2018-09-15 16:35:12 -04:00
Mohammad-Ali Minaie
9858d8b553 update checker 2018-09-15 16:13:09 -04:00
Mohammad-Ali Minaie
d0026da88a fuck JEI 2018-09-15 16:08:14 -04:00
Mohammad-Ali Minaie
83a3061a99 fixed Anvil unable to accept upgrades, fixed crucibles not returning cooked output, fixed molten layer model for hot crucibles in blockstate 2018-09-13 08:23:54 -04:00
Mohammad-Ali Minaie
4d889481c0 updating anvilDoWork 2018-09-13 07:23:38 -04:00
Mohammad-Ali Minaie
5d85dd7a8e fixing anvil inventory manager 2018-09-13 07:12:12 -04:00
Mohammad-Ali Minaie
5562a58f44 update todo 2018-09-12 17:19:46 -04:00
Mohammad-Ali Minaie
fd347fe3e3 SlottedTongs now can cool and drop its hot ingot in a barrel or water or rain_water also starting JEI fml 2018-09-11 11:43:09 -04:00
Mohammad-Ali Minaie
63697d731d add all Damascus recipes 2018-09-10 14:17:55 -04:00
Mohammad-Ali Minaie
74a83aaa37 renamed to-dos to avoid merge conflict 2018-09-10 06:07:14 -04:00
Mohammad-Ali Minaie
9f302566f6 updated rendering and models, still need hibachi recipe, JEI, and CT 2018-09-10 06:06:07 -04:00
Mohammad-Ali Minaie
bdf423d764 fixed renders, models, and casting logic 2018-09-07 10:47:37 -04:00
Mohammad-Ali Minaie
e7abf79946 updates to rendering and models, need more 2018-09-04 22:07:45 -04:00
Mohammad-Ali Minaie
7828c9b110 update breaker handler to match master-1.12 2018-09-01 17:06:45 -04:00
Mohammad-Ali Minaie
84992ccdc1 ready to start CT support. Need to make sure tongs models are still good 2018-08-31 08:13:55 -04:00
Mohammad-Ali Minaie
d8256951d4 item render is working, need to add all use cases 2018-08-30 08:19:31 -04:00
Mohammad-Ali Minaie
5f8d0c40c2 updated assets trying to get the itemnbtcrucible rendering to work 2018-08-30 08:05:24 -04:00
Mohammad-Ali Minaie
d0578ca56b need to updated nbtCrucible models to have textured filling instead of flat also need to updated dirt_sand texture 2018-08-21 23:13:48 -04:00
Mohammad-Ali Minaie
3e98f3998c updated models, addted to todo.md 2018-08-21 17:41:18 -04:00
Mohammad-Ali Minaie
132cb98443 updated assets 2018-08-21 08:05:32 -04:00
Mohammad-Ali Minaie
ba55b234b6 matched code in a class to avoid future merge conflict 2018-08-19 17:41:11 -04:00
Mohammad-Ali Minaie
04a1a50f08 updating resources to match new crucible rendering 2018-08-19 17:22:09 -04:00
Mohammad-Ali Minaie
71eaeb1d5d modified the updated logic for the crucible to write to nbt state changes 2018-08-19 02:21:29 -04:00
Mohammad-Ali Minaie
d77142c6e0 cant figure out issue with picking up and placing crucibles and not remembering state, probably has to do with placement code 2018-08-19 02:00:45 -04:00
Mohammad-Ali Minaie
4c967f7e87 updated crucible to have filling textures 2018-08-17 21:03:24 -04:00
Mohammad-Ali Minaie
935371ed6c updated tickets and todos 2018-08-15 11:41:29 -04:00
Mohammad-Ali Minaie
01e97eacff version updating complete 2018-08-14 16:15:20 -04:00
Mohammad-Ali Minaie
a633ace5e3 update Forge and dependency versions 2018-08-14 16:14:36 -04:00
Mohammad-Ali Minaie
9807be1f8d made updates with new Core version need to update gradle properties 2018-08-14 16:12:42 -04:00
Mohammad-Ali Minaie
fdc0d90144 fixed the bronze ingot crucible upgrades, need to modify the casting recipes and the nbtcrucible model to open top 2018-06-02 14:56:45 -04:00
Mohammad-Ali Minaie
2b4b432db1 fixed crafttweaker breaking launch but messed up rendering 2018-05-29 14:56:52 -04:00
Mohammad-Ali Minaie
6d8e0c2187 update wootz crafting 2018-05-06 01:45:44 -04:00
Mohammad-Ali Minaie
1889fd10a0 a lot of things to delete, need to add bronze crucible recipe, need to remove bloomery recipes and update crucible recipes, need wootz tools and weaponss 2018-05-06 00:39:45 -04:00
Mohammad-Ali Minaie
bb7c22aac2 more tongs and ingot assets 2018-04-30 22:01:06 -04:00
Mohammad-Ali Minaie
b7eb357f9d refactor all the anvil code and the slot tongs code, need to finish all the slotted tongs models now 2018-04-30 01:27:50 -04:00
Mohammad-Ali Minaie
b593173489 removed a lot of blocks removed block ingots and made them all items 2018-04-07 23:24:13 -04:00
Mohammad-Ali Minaie
024360389e much closer to stable state 2018-03-11 21:29:09 -04:00
Mohammad-Ali Minaie
117b3fd0f3 updated state doesn't seem to be working 2018-03-10 23:21:12 -05:00
Mohammad-Ali Minaie
cadbe7e204 more json updates 2018-03-10 23:09:51 -05:00
Mohammad-Ali Minaie
6b763a0337 updated the blockstate 2018-03-10 23:06:56 -05:00
Mohammad-Ali Minaie
adae8e3d82 need to use state with executing state 2018-03-10 22:09:34 -05:00
Mohammad-Ali Minaie
4bb3b25286 fixed rendering issue with placing crucible again aslo it wont change color 2018-02-25 16:20:26 -05:00
Mohammad-Ali Minaie
ebad0995ef Whiteshirt found blocks and itemBlocks being registered for everything 2018-02-25 15:17:33 -05:00
Mohammad-Ali Minaie
0d7b17305e trying to render the crucible 2018-02-25 14:51:23 -05:00
Mohammad-Ali Minaie
30dba0752e fixing merge conflict 2018-02-25 12:39:05 -05:00
Mohammad-Ali Minaie
7506534655 updated version 2018-02-25 11:59:02 -05:00
Mohammad-Ali Minaie
31a063532a merge conflict in peroperties 2018-02-24 19:45:34 -05:00
Mohammad-Ali Minaie
983d6b0418 commit current functioning code, needs assets 2018-02-24 19:43:22 -05:00
8932f51e90 Merge branch 'primal-update-20180223' of nmd/ForgeCraft into master-1.12 2018-02-24 02:37:53 +00:00
8b033972ac update primal FireSource method, convert old EntityMuck reference to EntityMud, update CT build.gradle references 2018-02-23 18:29:50 -08:00
Mohammad-Ali Minaie
01250d528c crucible happy path is working 2018-01-25 13:34:04 -05:00
Mohammad-Ali Minaie
72c4677c4b fixed the langFile name 2018-01-07 18:02:15 -05:00
Mohammad-Ali Minaie
81c9ff54a7 happy path achieved 2018-01-07 00:45:42 -05:00
Mohammad-Ali Minaie
390248afd3 fixed merge conflicts 2018-01-06 19:35:43 -05:00
Mohammad-Ali Minaie
64429816bd updated to primal 0.6.12 2018-01-06 19:29:50 -05:00
Mohammad-Ali Minaie
008332636b crazy nbt full retard need to make an itemslot 2018-01-06 17:33:33 -05:00
Mohammad-Ali Minaie
19730303c2 crucible add and pickup is working 2017-12-17 02:20:14 -05:00
Mohammad-Ali Minaie
a40b72eea6 push more 2017-12-17 00:56:21 -05:00
Mohammad-Ali Minaie
b3275e5f8e pusing current code 2017-12-17 00:50:14 -05:00
Mohammad-Ali Minaie
8a4d0cf70c trying to pass NBT around and crashing 2017-12-17 00:09:25 -05:00
Mohammad-Ali Minaie
392914ede3 fixed spewing broken tool heads 2017-12-02 18:05:18 -05:00
Mohammad-Ali Minaie
3a1c9676ab fixed bugs pushed .02 2017-11-29 22:13:57 -05:00
Mohammad-Ali Minaie
c7be7d569f crucible recipe manager is working 2017-11-29 06:59:36 -05:00
Mohammad-Ali Minaie
c32b0be9cc fixed the crucible crafting 2017-11-24 00:20:41 -05:00
Mohammad-Ali Minaie
4fd1da1215 got ingredient recipe 2017-11-16 22:04:44 -05:00
Mohammad-Ali Minaie
37ab61a195 trying nbt based crucible processing 2017-11-13 07:55:44 -05:00
Mohammad-Ali Minaie
a4512116cf Adding Helmet, command to show wiki, modify rendering, create recipe for shift click or lack of nonsense 2017-11-05 13:34:21 -05:00
An Sar
de70bb442c Merge branch 'ansar-0.6' of nmd/ForgeCraft into master-1.12 2017-10-28 23:18:51 +00:00
a7e3b222fe Merge branch 'master-1.12' into ansar-0.6 2017-10-28 16:10:42 -07:00
08ecdf8fa4 update mcp mappings, sync with changes in primal 0.6.x 2017-10-28 16:06:08 -07:00
Mohammad-Ali Minaie
b8e84dc824 update to client proxy registry 2017-10-28 18:50:20 -04:00
Mohammad-Ali Minaie
118ef3f90b Trying to add armor 2017-10-25 19:37:34 -04:00
a79a372729 Merge branch 'tile-factory' of nmd/ForgeCraft into master-1.12 2017-10-16 17:51:58 +00:00
4203c42cb4 update to primal 0.6.x, version bump, increase forge to 1.12.2 2017-10-05 20:42:12 -07:00
Mohammad-Ali Minaie
f5bd23682c updated lang file but lots of diff changes 2017-10-04 13:48:23 -04:00
Mohammad-Ali Minaie
6a0b872ebc not completing download of Primal 5.11 dependency 2017-09-16 13:28:16 -04:00
Mohammad-Ali Minaie
f708ac25f5 version bump 2017-09-16 10:47:08 -04:00
Mohammad-Ali Minaie
01834a6d77 fixed the API occorunces 2017-09-16 10:45:49 -04:00
Mohammad-Ali Minaie
b3d329c273 switch 12.1 to 12 2017-09-15 16:35:52 -04:00
Mohammad-Ali Minaie
9038bfc5ea fixed forge version 2017-09-15 16:31:45 -04:00
Mohammad-Ali Minaie
6d3533e588 big diff in the files 2017-09-15 16:15:23 -04:00
Mohammad-Ali Minaie
6f955f14f0 updating with new primal version 2017-09-15 16:12:49 -04:00
b374045de2 Merge branch 'primal-update' of nmd/ForgeCraft into master-1.12 2017-09-15 10:27:26 +00:00
b29071c6b4 Primal Blocks/Items refactor 2017-09-14 21:18:48 -07:00
b07102edd5 Update PrimalCore API changes 2017-09-14 18:15:47 -07:00
Mohammad-Ali Minaie
f0377332d8 fixed heating of damaged tools 2017-09-04 21:30:58 -04:00
Mohammad-Ali Minaie
622a3f4b17 fixing bugs 2017-09-04 13:24:17 -04:00
Mohammad-Ali Minaie
6fd05cffd5 updating lang file 2017-09-03 22:29:58 -04:00
srw
33c0582287 update to 1.12.1 2017-08-30 19:04:06 -07:00
Mohammad-Ali Minaie
6f084a9fa2 updating the .12 branch 2017-07-28 00:03:09 -04:00
Mohammad-Ali Minaie
49007061d0 1.12 update 2017-06-26 00:19:38 -04:00
Mohammad-Ali Minaie
b8b80fb547 Merge branch 'master' into master-1.12 2017-06-25 22:50:14 -04:00
Mohammad-Ali Minaie
3a40744de2 tryd to update gotta wait 2017-06-25 22:47:48 -04:00
Mohammad-Ali Minaie
3e1afd631b init to 1.12 2017-06-25 22:34:06 -04:00
2940 changed files with 42611 additions and 20415 deletions

449
.idea/workspace.xml generated
View File

@@ -2,26 +2,7 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="2374d888-04b5-4300-967c-f257dee6cdd6" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/CommonUtils.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/CommonUtils.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/ForgeCraft.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/ForgeCraft.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/ModInfo.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/ModInfo.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/compat/FuelHandler.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/compat/FuelHandler.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModItems.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModItems.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModRegistries.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModRegistries.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModTiles.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/init/ModTiles.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/items/BaseItem.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/items/BaseItem.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/items/ItemTest.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/items/ItemTest.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/proxy/ClientProxy.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/proxy/ClientProxy.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/renders/TileFireboxRender.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/renders/TileFireboxRender.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/renders/TilePistonBellowsRender.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/renders/TilePistonBellowsRender.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/BaseTile.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/BaseTile.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileBaseSlot.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileBaseSlot.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileFirebox.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileFirebox.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TilePistonBellows.java" afterPath="$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/tiles/TilePistonBellows.java" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
@@ -33,33 +14,23 @@
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FUSProjectUsageTrigger">
<session id="1807367187">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="2" />
<entry key="project.open.time.0" value="1" />
<entry key="project.open.time.4" value="1" />
<entry key="project.opened" value="2" />
</counts>
</usages-collector>
</session>
</component>
<component name="FavoritesManager">
<favorites_list name="ForgeCraft" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="PistonBellows.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Firebox.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-510">
<caret line="42" column="77" lean-forward="true" selection-start-line="42" selection-start-column="4" selection-end-line="42" selection-end-column="77" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
<leaf />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -72,251 +43,114 @@
<entry key="$PROJECT_DIR$/../PrimalCore" value="2962994312000" />
</map>
</option>
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
<component name="ProjectFrameBounds">
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="y" value="22" />
<option name="width" value="1680" />
<option name="height" value="1050" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="1.11" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="1.11" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="1.11" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="nmd" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="primal" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="forgecraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="1.11" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="nmd" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="primal" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="forgecraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="blocks" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="ForgeCraft" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="1.11" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<expand>
<path>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" />
<item name="ForgeCraft" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" />
<item name="ForgeCraft" type="462c0819:PsiDirectoryNode" />
<item name="kfc" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
</path>
<path>
<item name="ForgeCraft" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
<item name="&lt; 1.8 &gt;" type="70bed36:NamedLibraryElementNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="AndroidView" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/kfc/build.gradle" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="FullScreen" value="true" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<predefined_log_file id="idea.log" enabled="true" />
<method />
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<module />
<method />
<method>
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method />
<method>
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="build" type="GroovyScriptRunConfiguration" factoryName="Groovy" temporary="true">
<module name="ForgeCraft" />
<setting name="path" value="file://$PROJECT_DIR$/kfc/build.gradle" />
<setting name="vmparams" value="" />
<setting name="params" value="" />
<setting name="workDir" value="file://$PROJECT_DIR$/kfc" />
<setting name="debug" value="false" />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
<method />
<method>
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
@@ -325,26 +159,39 @@
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
<method>
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<predefined_log_file id="idea.log" enabled="true" />
<method>
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Groovy.build" />
</list>
</recent_temporary>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
@@ -353,72 +200,58 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1482033001334</updated>
<workItem from="1538459982472" duration="37000" />
<workItem from="1538460037447" duration="7000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="44000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="0" width="1680" height="1050" extended-state="6" />
<editor active="true" />
<frame x="-8" y="-8" width="2576" height="1416" extended-state="6" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Nl-Palette" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32958034" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info anchor="right" id="Palette" order="4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Messages" />
<window_info anchor="right" id="Palette&#9;" order="8" />
<window_info id="Image Layers" order="3" />
<window_info anchor="right" id="Capture Analysis" order="5" />
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" weight="0.32958034" />
<window_info anchor="right" id="Maven Projects" order="9" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Version Control" order="9" />
<window_info active="true" anchor="bottom" id="Terminal" order="7" visible="true" weight="0.33386454" />
<window_info id="Capture Tool" order="6" />
<window_info id="Designer" order="4" />
<window_info anchor="right" content_ui="combo" id="Project" order="10" visible="true" weight="0.16613673" />
<window_info id="Structure" order="0" side_tool="true" weight="0.25" />
<window_info anchor="right" id="Ant Build" order="2" weight="0.25" />
<window_info id="UI Designer" order="5" />
<window_info anchor="right" id="Theme Preview" order="6" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="3" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info id="Nl-Palette" order="1" />
<window_info anchor="right" id="Commander" order="1" weight="0.4" />
<window_info anchor="right" id="Properties" order="7" />
<window_info anchor="right" id="Database" order="0" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Database Changes" order="10" show_stripe_button="false" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Find" order="1" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/CommonUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-510">
<caret line="42" column="77" lean-forward="true" selection-start-line="42" selection-start-column="4" selection-end-line="42" selection-end-column="77" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/CommonUtils.java" />
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java" />
<entry file="file://$PROJECT_DIR$/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java" />
</component>
</project>

BIN
exampleModifiers.xlsx Normal file

Binary file not shown.

View File

@@ -1,14 +1,20 @@
To-Dos
# To-Dos
*** Bugs ***
## Bugs
- [ ] Placement bug for crucible from tongs
- [ ] Wootz shovel not rendering (NORTH)
- [ ] Damascus Rendering in tongs
*** Current Feature ***
- [x] BlockBreaker Support for copper dust and tin dust
- [x] picking up raw bronze crucible returns some other shit
- [x] Tool breaking should return tool head
## Current Feature
- [ ] Damascus Workblade Recipe
- [ ] Untick Bloomery and Forge
- [ ] Craft Tweaker Support
- [ ] Recipe Handler for Block Breaker
- [ ] Mass Ore Production
*** Feature Musket ***
## Feature Musket
- [ ] Create powder charge item (copper, charcoal, gunpowder)
- [ ] Create musket round item (lead or iron nugget)
- [ ] Create wadding item (paper)
@@ -19,23 +25,104 @@ To-Dos
- [ ] Create stock item
- [ ] Create lock assembly item
*** Backlog ***
- [ ] Move Ingot break into chunks logic out of the block and into the ForgeHammer
## Backlog
- [ ] Hardened Leather Helmet Inventory Model
- [ ] Add Achievements
- [ ] Random Floats for hot texture
- [ ] Silver/Lead Production
- [ ] Sparks to forging
- [ ] Add Iron Ring Recipe
- [ ] Add chainmail recipe
- [ ] Add Iron Shield
- [ ] Gold Smelting
- [ ] Create a method which adds the types of NBT upgrades and creates a unique float instead of using magic numbers
- [ ] Add forgehammer to oreDict
- [ ] WeaponHead recipes
*** Tid-Bits ***
### Tid-Bits
NonNullList<ItemStack> tempDrops = NonNullList.<ItemStack>create();
ItemStack iron_gear = RecipeHelper.getFirstDictionaryMatch("gearIron", 1);
```
sed -i -- 's/iron/steel/g' *
rm *.json--
rename s/iron/steel/ iron*
```
*** Completed ***
### Completed
- [x] weapon upgrades
- [x] Grinding Bench
- [x] Repair ToolHead
- [x] Grinding Wheel Crafting Slack, Clay, Sand
- [x] Grinding Bench Recipe
- [x] Dissasemble recipes for weapons
- [x] Chisel Pickup
- [x] WorkBench
- [x] Longbow change NBT management
- [x] Check dict name for cluster
- [x] Check block break code for NBTCrucible
- [x] Cooldown for sledgehammer not working
- [x] tune volume down on sledgehammer
- [x] when placing crucibles on the side of a block it replaces the block above
- [x] Check on disable for soft crucible in bloomery
- [x] Correct Tooltip for RawLongbow
- [x] Add tooltip to Chisel and SledgeHammer
- [x] Damascus workblade
- [x] Config to map only wrought iron to vanilla iron or wrought iron to another iron
- [x] Config to map damascus steel to generic mod steel
- [x] If blockbreaker charge is 0 shift right click will remove the gallagher
- [x] drop a tool handle when crafting
- [x] Hot Crucible block form missing texture
- [x] Soft Crucible drop from tongs
- [x] Pickaxe upgrades printout
- [x] Can't put a crucible straight from creative inventory into bloomery and pull with tongs
- [x] SledgeHammer and Chisel item and blocks
- [x] ToolTip rawLongbow
- [x] Update Recipes with oreDict for slackLime
- [x] Chisel Bounding Box changes
- [x] SledgeHammer Supid Damage Modifier
- [x] SledgeHammer and Chisel crafting
- [x] SledgeHammer and Chisel assets
- [x] SoftCrucible Color Issues
- [x] Apply Forge turn off logic to Bloomery
- [x] Soft Crucible Hibachi Recipe
- [x] Fix Plate Crafting
- [x] Longbow animation
- [x] Fix Forge Cool Down
- [x] Fix Forge StackTagCompound management
- [x] ForgeHammer Recipes
- [x] Bronze Plate Cast
- [x] JEI Support
- [x] Update SoftCrucible Model
- [x] Crucibles were returning input ingredients even after cooked
- [x] Hot Crucible doesn't have hot molten layer
- [x] Can't add upgrades to the anvil
- [x] Steel Plate Recipe #37
- [x] Damascus Recipes
- [x] Damascus Weapons
- [x] Need Recipe for Soft Crucible
- [x] Make Wootz Weapons
- [x] Crucible is not resetting after iron is removed.
- [x] Chunk and Ball stacking
- [x] Delete unused models, blockstates, and textures
- [x] Inventory version of balls have the same texture
- [x] Wootz Chunk Model
- [x] Casting Mud Texture
- [x] Adobe Bloomery Texture
- [x] Adobe Forge Texture
- [x] Update nbt Crucible Models with open top
- [x] Update all slotted tong models
- [x] Inventory model for nbtCrucible
- [x] Tongs hot Texture
- [x] Casting Block line 103
- [x] Bloomery rendering all messed up
- [x] Update Casting recipes to use new slotted tongs and nbtCrucible
- [x] NBT Crucible
- [x] NBT Crucible Recipes
- [x] Slotted Tongs
- [x] Item Crucible
- [x] NBTCrucible to ItemCrucible transformer
- [x] StoneTongs ItemCrucible to NBTCrucible transformer
- [x] BlockBreaker Support for copper dust and tin dust
- [x] picking up raw bronze crucible returns some other shit
- [x] Tool breaking should return tool head
- [x] Casting Table
- [x] Block
- [x] Gui
@@ -134,48 +221,4 @@ rename s/iron/steel/ iron*
- [x] Tongs Model for hotIronBurnt
- [x] Tongs Extract from bloomery for Hot Iron
- [x] Tongs Extract from bloomery for Hot Iron Finished
- [x] Crafting Recipes
0 | Default StoneTongs
1 | Empty Crucible Hot
2 | Empty Crucible Cracked Hot
================================
3 | Hot Iron Crucible
4 | Hot Cooked Iron Crucible
5 | Hot Failed Iron Crucible
6 | Hot Iron Ingot
7 | Hot Iron Chunk
--------------------------------
8 | Hot Iron Pickaxe Head
9 | Hot Iron Axe Head
10 | Hot Iron Shovel Head
11 | Hot Iron Hoe Head
================================
12 | Hot Clean Iron Crucible
13 | Hot Cooked Clean Iron Crucible
14 | Hot Failed Clean Iron Crucible
15 | Hot Clean Iron Ball
16 | Hot Clean Iron Chunk
--------------------------------
17 | Hot Clean Iron Pickaxe Head
18 | Hot Clean Iron Axe Head
19 | Hot Clean Iron Shovel Head
20 | Hot Clean Iron Hoe Head
================================
21 | Hot Steel Crucible
22 | Hot Cooked Steel Crucible
23 | Hot Failed Steel Crucible
24 | Hot Steel Ingot
25 | Hot Steel Chunk
--------------------------------
26 | Hot Steel Pickaxe Head
27 | Hot Steel Axe Head
28 | Hot Steel Shovel Head
29 | Hot Steel Hoe Head
- [x] Crafting Recipes

View File

@@ -1,9 +1,11 @@
// -Dhttps.protocols=TLSv1.2
//org.gradle.jvmargs="-Dhttps.protocols=TLSv1.2"
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
url = "https://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
@@ -11,107 +13,79 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
repositories {
maven {
name = "jei"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name = "mobius"
url "http://mobiusstrip.eu/maven"
}
maven {
name = "primal"
url "https://maven.nmd.so"
}
maven {
name = "jei"
url "https://dvs1.progwml6.com/files/maven"
}
maven {
name "CraftTweaker"
url "http://maven.blamejared.com/"
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'java'
compileJava {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
}
group = "${mod_group}"
version = "${mod_version}"
archivesBaseName = "${mod_name}"
idea { module { inheritOutputDirs = true } }
minecraft {
version = "${mc_version}" + "-" + "${forge_version}"
runDir = "run"
version = "${mc_version}" + "-" + "${forge_version}"
runDir = "run"
mappings = "${mcp_mappings}"
mappings = "${mcp_mappings}"
// JEI
//useDepAts = true
// Replace
replace "@VERSION@", project.mod_version
// JEI
useDepAts = true
// Replace
replace "@VERSION@", project.mod_version
}
dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// PrimalCore
deobfCompile "nmd.primal.core:PrimalCore:${mc_version}-${primal_version}:dev"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// JEI
//runtime "mezz.jei:jei_${mc_version}:${jei_version}"
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}:api"
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/ddependency_management.html
// JEI
// https://github.com/mezz/JustEnoughItems
// http://minecraft.curseforge.com/projects/just-enough-items-jei/files
// <MINECRAFT-VERSION> and <JEI-VERSION> can be found on CurseForge, check the file name of the version you want.
//
// compile against the JEI API
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}:api"
//runtime "mezz.jei:jei_${mc_version}:${jei_version}"
deobfCompile "nmd.primal.core:PrimalCore:${primal_version}:dev"
//runtime "nmd.primal.core:PrimalCore:${primal_version}"
// CraftTweaker
//compile "CraftTweaker2:CraftTweaker2-MC1120-Main:${craftweaker_version}"
//compile "CraftTweaker2:CraftTweaker2-API:${craftweaker_version}"
//compile "CraftTweaker2:CraftTweaker2-MC1120-Main:${mc_major_version}-${craftweaker_version}"
//compile "CraftTweaker2:CraftTweaker2-API:${craftweaker_version}"
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", "${mod_version}"
inputs.property "mcversion", "${mc_version}"
// this will ensure that this task is redone when the versions change.
inputs.property "version", "${mod_version}"
inputs.property "mcversion", "${mc_version}"
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':"${mod_version}", 'mcversion':"${mc_version}"
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':"${mod_version}", 'mcversion':"${mc_version}"
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
// end //
// end //

View File

@@ -1,16 +1,19 @@
# ~/.gradle/gradle.properties
#
#org.gradle.daemon=true
org.gradle.jvmargs=-Xmx3G
org.gradle.jvmargs=-Xmx3G
mod_group=nmd.primal.forgecraft
mod_name=ForgeCraft
mod_version=1.2.74
forge_version=13.20.1.2388
mcp_mappings=snapshot_20170610
mc_version=1.11.2
primal_version=0.4+
jei_version=4.3+
mod_version=1.6.51
forge_version=14.23.5.2806
mcp_mappings=snapshot_20171003
mc_version=1.12.2
mc_major_version=1.12
primal_version=0.6+
jei_version=4.12+
waila_version=1.7.0-B3
apple_version=2.1+
apple_version=2.1+
craftweaker_version=4.1.6.465

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExcludeFromValidation">
<file url="file://$PROJECT_DIR$/src/main/java/nmd/primal/forgecraft/blocks/Chisel.java" />
</component>
</project>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View File

@@ -0,0 +1,117 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidElementNotAllowed" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintByteOrderMark" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintContentDescription" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintCustomError" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintCustomWarning" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintEnforceUTF8" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintExtraTranslation" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintHardcodedText" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintImpliedQuantity" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintLabelFor" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintMissingQuantity" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintMissingTranslation" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintPluralsCandidate" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintRelativeOverlap" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintRtlCompat" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintRtlEnabled" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintRtlHardcoded" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintRtlSymmetry" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintSetTextI18n" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintStringFormatCount" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintStringFormatInvalid" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintStringFormatMatches" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintTypos" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintUnusedQuantity" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidMissingOnClickHandler" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidNonConstantResIdsInSwitch" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidUnknownAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AntDuplicateTargetsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AntMissingPropertiesFileInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AntResolveInspection" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CheckDtdRefs" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CheckEmptyScriptTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CheckNodeTest" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CheckTagEmptyBody" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CheckValidXmlInScriptTagBody" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CheckXmlFileWithXercesValidator" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="ConceptInspectionProvider" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="DeprecatedClassUsageInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HardwiredNamespacePrefix" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlExtraClosingTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlUnknownAnchorTarget" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlUnknownAttribute" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myValues">
<value>
<list size="0" />
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="HtmlUnknownBooleanAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="HtmlUnknownTag" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myValues">
<value>
<list size="6">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
<item index="4" class="java.lang.String" itemvalue="embed" />
<item index="5" class="java.lang.String" itemvalue="script" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="HtmlUnknownTarget" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ImplicitTypeConversion" enabled="false" level="WARNING" enabled_by_default="false">
<option name="BITS" value="1720" />
<option name="FLAG_EXPLICIT_CONVERSION" value="true" />
<option name="IGNORE_NODESET_TO_BOOLEAN_VIA_STRING" value="true" />
</inspection_tool>
<inspection_tool class="IndexZeroUsage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxColorRgb" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxDefaultTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxEventHandler" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxRedundantPropertyValue" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxResourcePropertyValue" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxUnresolvedFxIdReference" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="JavaFxUnusedImports" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LossyEncoding" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PatternNotApplicable" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="PatternOverriddenByNonAnnotatedMethod" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PatternValidation" enabled="false" level="WARNING" enabled_by_default="false">
<option name="CHECK_NON_CONSTANT_VALUES" value="true" />
</inspection_tool>
<inspection_tool class="RedundantTypeConversion" enabled="false" level="WARNING" enabled_by_default="false">
<option name="CHECK_ANY" value="false" />
</inspection_tool>
<inspection_tool class="RequiredAttributes" enabled="false" level="WARNING" enabled_by_default="false">
<option name="myAdditionalRequiredHtmlAttributes" value="" />
</inspection_tool>
<inspection_tool class="ResourceType" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SimplifiableIfStatement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpecInspectionProvider" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="XmlDuplicatedId" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlHighlighting" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlInvalidId" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlPathReference" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlUnboundNsPrefix" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlUnusedNamespaceDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlWrongFileType" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlWrongRootElement" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XsltDeclarations" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XsltTemplateInvocation" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XsltUnusedDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XsltVariableShadowing" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

17
kfc/idea_backup/misc.xml Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="3">
<item index="0" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.Mod" />
<item index="1" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.Mod.EventHandler" />
<item index="2" class="java.lang.String" itemvalue="net.minecraftforge.fml.common.eventhandler.SubscribeEvent" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="PreferredVcsStorage">
<preferredVcsName>ApexVCS</preferredVcsName>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

6
kfc/idea_backup/vcs.xml Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@@ -1,119 +1,78 @@
package nmd.primal.forgecraft;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import nmd.primal.forgecraft.items.parts.BronzeToolPart;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.tools.*;
import nmd.primal.forgecraft.util.ToolNBT;
import nmd.primal.core.api.events.CauldronRecipeEvent;
import nmd.primal.core.common.crafting.handlers.tile.CauldronRecipe;
import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.core.common.tiles.machines.TileCauldron;
import nmd.primal.forgecraft.items.parts.WeaponPart;
import nmd.primal.forgecraft.util.WeaponNBT;
/**
* Created by mminaie on 3/15/17.
*/
public class CommonEvents implements ToolNBT {
public class CommonEvents implements WeaponNBT {
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onItemCrafted(CauldronRecipeEvent.Pre event){
@SubscribeEvent(priority= EventPriority.LOWEST, receiveCanceled=true)
public void onItemCrafted(PlayerEvent.ItemCraftedEvent event) {
CauldronRecipe recipe = event.getRecipe();
if (recipe.matches("forgecraft:cauldron_item.rawcoppergladiussmite", "forgecraft:cauldron_item.rawcoppergladiusbane", "forgecraft:cauldron_item.rawcoppergladiusfire", "forgecraft:cauldron_item.rawcoppergladiusfortune",
"forgecraft:cauldron_item.rawbronzegladiussmite", "forgecraft:cauldron_item.rawbronzegladiusbane", "forgecraft:cauldron_item.rawbronzegladiusfire", "forgecraft:cauldron_item.rawbronzegladiusfortune",
"forgecraft:cauldron_item.rawwroughtirongladiussmite", "forgecraft:cauldron_item.rawwroughtirongladiusbane", "forgecraft:cauldron_item.rawwroughtirongladiusfire", "forgecraft:cauldron_item.rawwroughtirongladiusfortune",
"forgecraft:cauldron_item.rawclearnirongladiussmite", "forgecraft:cauldron_item.rawclearnirongladiusbane", "forgecraft:cauldron_item.rawclearnirongladiusfire", "forgecraft:cauldron_item.rawclearnirongladiusfortune",
"forgecraft:cauldron_item.rawsteelgladiussmite", "forgecraft:cauldron_item.rawsteelgladiusbane", "forgecraft:cauldron_item.rawsteelgladiusfire", "forgecraft:cauldron_item.rawsteelgladiusfortune",
"forgecraft:cauldron_item.rawwootzgladiussmite", "forgecraft:cauldron_item.rawwootzgladiusbane", "forgecraft:cauldron_item.rawwootzgladiusfire", "forgecraft:cauldron_item.rawwootzgladiusfortune",
"forgecraft:cauldron_item.rawcleanironlongswordsmite", "forgecraft:cauldron_item.rawcleanironlongswordbane", "forgecraft:cauldron_item.rawcleanironlongswordfire", "forgecraft:cauldron_item.rawcleanironlongswordfortune",
"forgecraft:cauldron_item.rawsteellongswordsmite", "forgecraft:cauldron_item.rawsteellongswordbane", "forgecraft:cauldron_item.rawsteellongswordfire", "forgecraft:cauldron_item.rawsteellongswordfortune",
"forgecraft:cauldron_item.rawwootzlongswordsmite", "forgecraft:cauldron_item.rawwootzlongswordbane", "forgecraft:cauldron_item.rawwootzlongswordfire", "forgecraft:cauldron_item.rawwootzlongswordfortune",
"forgecraft:cauldron_item.rawironslayersmite", "forgecraft:cauldron_item.rawironslayerbane", "forgecraft:cauldron_item.rawironslayerfire", "forgecraft:cauldron_item.rawironslayerfortune",
"forgecraft:cauldron_item.rawcleanironslayersmite", "forgecraft:cauldron_item.rawcleanironslayerbane", "forgecraft:cauldron_item.rawcleanironslayerfire", "forgecraft:cauldron_item.rawcleanironslayerfortune",
"forgecraft:cauldron_item.rawsteelslayersmite", "forgecraft:cauldron_item.rawsteelslayerbane", "forgecraft:cauldron_item.rawsteelslayerfire", "forgecraft:cauldron_item.rawsteelslayerfortune",
"forgecraft:cauldron_item.rawwootzslayersmite", "forgecraft:cauldron_item.rawwootzslayerbane", "forgecraft:cauldron_item.rawwootzslayerfire", "forgecraft:cauldron_item.rawwootzslayerfortune"
)){
if(!event.player.getEntityWorld().isRemote) {
NonNullList<ItemStack> inputList = NonNullList.<ItemStack>withSize(6, ItemStack.EMPTY);
inputList.set(0, event.getTile().getInputHandler().getStackInSlot(0));
inputList.set(1, event.getTile().getInputHandler().getStackInSlot(1));
inputList.set(2, event.getTile().getInputHandler().getStackInSlot(2));
inputList.set(3, event.getTile().getInputHandler().getStackInSlot(3));
inputList.set(4, event.getTile().getInputHandler().getStackInSlot(4));
inputList.set(5, event.getTile().getInputHandler().getStackInSlot(5));
if (event.crafting.getItem() instanceof CustomPickaxe || event.crafting.getItem() instanceof BronzePickaxe) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
}
}
}
TileCauldron tile = event.getTile();
ItemStack inputStack = tile.getInputStack(event.getOutputs().get(0));
Item inputStackItem = null;
if(inputStack.getItem() instanceof WeaponPart){
inputStackItem = inputStack.getItem();
}
if (event.crafting.getItem() instanceof CustomAxe || event.crafting.getItem() instanceof BronzeAxe) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
ItemStack modStack = ItemStack.EMPTY;
ItemStack outputStack = event.getOutputs().get(0);
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
}
}
}
}
if (event.crafting.getItem() instanceof CustomShovel || event.crafting.getItem() instanceof BronzeShovel) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
modStack = getOppositeStack(inputList, inputStack);
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
if(inputStackItem != null) {
if (inputStack.hasTagCompound()) {
if (WeaponNBT.getModifiers(inputStack) < WeaponNBT.materialModifiers.get(((WeaponPart) outputStack.getItem()).getMaterial()) ) {
if (RecipeHelper.isOreName(modStack, "dustSilver")) {
WeaponNBT.setSmiteLevel(outputStack, WeaponNBT.getSmiteLevel(inputStack) + 1);
WeaponNBT.setModifiers(outputStack, WeaponNBT.getModifiers(inputStack) + 1);
}
}
}
}
if (event.crafting.getItem() instanceof CustomHoe || event.crafting.getItem() instanceof BronzeHoe) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof ToolPart || a.getItem() instanceof BronzeToolPart) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
event.crafting.setItemDamage(event.craftMatrix.getStackInSlot(i).getItemDamage());
if (RecipeHelper.isOreName(modStack, "foodPoison")) {
WeaponNBT.setBaneLevel(outputStack, WeaponNBT.getBaneLevel(inputStack) + 1);
WeaponNBT.setModifiers(outputStack, WeaponNBT.getModifiers(inputStack) + 1);
}
}
}
}
if (event.crafting.getItem() instanceof ToolPart || event.crafting.getItem() instanceof BronzeToolPart) {
NBTTagCompound tempTag = new NBTTagCompound();
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
if (event.craftMatrix.getStackInSlot(i) != null) { // If there is an item
ItemStack a = event.craftMatrix.getStackInSlot(i); // Gets the item
if (a.getItem() instanceof CustomAxe || a.getItem() instanceof BronzeAxe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
if (RecipeHelper.isOreName(modStack, "dustBlaze")) {
WeaponNBT.setFireLevel(outputStack, WeaponNBT.getFireLevel(inputStack) + 1);
WeaponNBT.setModifiers(outputStack, WeaponNBT.getModifiers(inputStack) + 1);
}
if (a.getItem() instanceof CustomPickaxe || a.getItem() instanceof BronzePickaxe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
if (a.getItem() instanceof CustomShovel || a.getItem() instanceof BronzeShovel) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
}
if (a.getItem() instanceof CustomHoe || a.getItem() instanceof BronzeHoe) {
tempTag = a.getSubCompound("tags").copy();
event.crafting.getTagCompound().setTag("tags", tempTag);
event.crafting.getItem().updateItemStackNBT(event.crafting.getTagCompound());
Integer tempDamage = event.craftMatrix.getStackInSlot(i).getItemDamage();
event.crafting.setItemDamage(tempDamage);
if (RecipeHelper.isOreName(modStack, "gemLapis")) {
WeaponNBT.setFortuneLevel(outputStack, WeaponNBT.getFortuneLevel(inputStack) + 1);
WeaponNBT.setModifiers(outputStack, WeaponNBT.getModifiers(inputStack) + 1);
}
}
}
@@ -121,5 +80,15 @@ public class CommonEvents implements ToolNBT {
}
}
private ItemStack getOppositeStack(NonNullList<ItemStack> inputList, ItemStack inputStack){
ItemStack modStack = ItemStack.EMPTY;
for (int i = 0; i < inputList.size(); i++) {
if(inputList.get(i) != ItemStack.EMPTY && !(inputList.get(i).getItem() instanceof WeaponPart) ){
modStack = inputList.get(i);
}
}
return modStack;
}
}

View File

@@ -7,9 +7,10 @@ import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import nmd.primal.forgecraft.compat.ModDictionary;
import nmd.primal.forgecraft.commands.CommandShowWiki;
import nmd.primal.forgecraft.gui.GuiHandler;
import nmd.primal.forgecraft.init.*;
import nmd.primal.forgecraft.proxy.CommonProxy;
@@ -51,10 +52,11 @@ public class ForgeCraft
ModBlocks.register();
ModItems.init();
ModItems.register();
ModDictionary.registerDictionaryNames();
ModTiles.registerTileEntities();
ModSounds.registerSounds();
ModEvents.registerCommonEvents();
ModCrafting.register();
//ModEvents.registerClientEvents();
// ModItems.registerRenders();
proxy.preInit();
@@ -66,8 +68,8 @@ public class ForgeCraft
{
//this.proxy.init(event);
proxy.init();
ModDictionary.registerDictionaryNames();
ModCrafting.register();
//proxy.registerModelBakeryVariants();
}
@@ -75,7 +77,13 @@ public class ForgeCraft
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
//this.proxy.postInit(event);
ModEvents.registerCommonEvents();
}
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
event.registerServerCommand(new CommandShowWiki());
}
}

View File

@@ -2,8 +2,12 @@ package nmd.primal.forgecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import nmd.primal.forgecraft.init.ModItems;
//import nmd.primal.forgecraft.Item.ModItems;
@@ -17,9 +21,10 @@ public class ModInfo {
public static final String MOD_CONFIG = "primal/" + MOD_ID;
//public static final String MOD_PREFIX = MOD_ID + ":";
public static final String MOD_CHANNEL = MOD_ID;
public static final String MOD_VERSION = "1.2.74";
public static final String MC_VERSIONS = "[1.11.0, 1.12.0)";
public static final String DEPENDENCIES = "required-after:forge@[13.20.1.2388,);" + "required-after:primal@[0.4,);";
public static final String MOD_VERSION = "1.6.51";
public static final String MC_VERSIONS = "[1.12.0, 1.13.0)";
public static final String DEPENDENCIES = "required-after:forge@[14.21.1.2400,);" + "required-after:primal@[0.6.69,);";
/** Mod Structures **/
public static final String SERVER_PROXY = "nmd.primal.forgecraft.proxy.ServerProxy";
@@ -30,10 +35,28 @@ public class ModInfo {
/** Creative Tabs **/
public static CreativeTabs TAB_FORGECRAFT = new CreativeTabs(MOD_ID)
{
/*@Override
@SideOnly(Side.CLIENT)
public ItemStack createIcon() {
return new ItemStack(ModItems.forgehammer);
}*/
@Override
@SideOnly(Side.CLIENT)
public ItemStack getTabIconItem() {
return new ItemStack(ModItems.forgehammer);
}
};
// ***************************************************************************** //
// ForgeCraft.Registries
// ***************************************************************************** //
public static class Registries
{
// In-World Recipes
public static final IForgeRegistry<CrucibleCrafting> CRUCIBLE_CRAFTING = GameRegistry.findRegistry(CrucibleCrafting.class);
public static final IForgeRegistry<WorkbenchCrafting> WORKBENCH_CRAFTING = GameRegistry.findRegistry(WorkbenchCrafting.class);
}
}

View File

@@ -1,142 +0,0 @@
package nmd.primal.forgecraft.blocks.Anvil;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.forgecraft.util.AnvilHandler;
/**
* Created by mminaie on 6/11/17.
*/
public abstract class AnvilBase extends CustomContainerFacing implements AnvilHandler{
private boolean anvil;
public AnvilBase(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setHardness(hardness);
this.setIsAnvil(anvil);
}
public boolean isAnvil() {
return anvil;
}
public void setIsAnvil(boolean anvil) {
anvil = anvil;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
AnvilHandler.doDrops(world, pos);
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileAnvil();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,7 +0,0 @@
package nmd.primal.forgecraft.blocks.Anvil;
/**
* Created by mminaie on 6/10/17.
*/
public class AnvilSteel {
}

View File

@@ -1,65 +0,0 @@
package nmd.primal.forgecraft.blocks.Anvil;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.core.api.PrimalMaterials;
import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.BaseMultiItem;
import nmd.primal.forgecraft.tiles.TileAnvil;
/**
* Created by mminaie on 3/4/17.
*/
public class AnvilStone extends AnvilBase {
public AnvilStone(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName, hardness, anvil);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
/******************************************************************************
Crafting AnvilStone Recipes
*****************************************************************************/
if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem();
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
if (tile != null) {
if ((pItem.getItem() instanceof WorkMallet) || (pItem.getItem() == ModItems.forgehammer)) {
String[] tempArray = new String[25];
for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
}
for (int i = 0; i < 25; i++) {
if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) {
if (((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_WROUGHT_IRON) {
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(PrimalItems.ROCK_STONE, 3));
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.ironball, 1));
this.breakBlock(world, pos, state);
return true;
}
}
}
doAnvilRecipe(pItem, tempArray, world, tile, pos, player);
return true;
}
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,70 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.forgecraft.util.AnvilHandler;
/**
* Created by mminaie on 6/11/17.
*/
public abstract class AnvilBase extends CustomContainerFacing implements AnvilHandler{
private boolean anvil;
public AnvilBase(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setHardness(hardness);
this.setIsAnvil(anvil);
}
public boolean isAnvil() {
return anvil;
}
public void setIsAnvil(boolean anvil) {
anvil = anvil;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops")) {
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
if (tile != null) {
for (ItemStack stack : tile.getSlotList()) {
if (stack != ItemStack.EMPTY) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
stack.setCount(1);
ItemStack dropStack = stack.copy();
dropStack.setCount(1);
EntityItem itemDrop = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, dropStack);
itemDrop.setDefaultPickupDelay();
world.spawnEntity(itemDrop);
}
}
}
}
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileAnvil();
}
}

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.blocks.Anvil;
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@@ -8,7 +8,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.forgecraft.util.AnvilHandler;
@@ -32,11 +32,12 @@ public class AnvilIron extends AnvilBase implements AnvilHandler {
if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem();
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
ItemStack stack12 = tile.getSlotStack(12).copy();
if (tile != null) {
if ((pItem.getItem() instanceof WorkMallet) || (pItem.getItem() == ModItems.forgehammer)) {
String[] tempArray = new String[25];
if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) {
ItemStack[] tempArray = new ItemStack[25];
for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
tempArray[i] = tile.getSlotStack(i);
}
/*for (int i = 0; i < 25; i++) {
if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) {
@@ -51,7 +52,7 @@ public class AnvilIron extends AnvilBase implements AnvilHandler {
}
}
}*/
doAnvilRecipe(pItem, tempArray, world, tile, pos, player);
doAnvilRecipe(pItem, stack12, tempArray, world, tile, pos, player);
return true;
}
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);

View File

@@ -0,0 +1,7 @@
package nmd.primal.forgecraft.blocks;
/**
* Created by mminaie on 6/10/17.
*/
public class AnvilSteel {
}

View File

@@ -0,0 +1,132 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TileAnvil;
/**
* Created by mminaie on 3/4/17.
*/
public class AnvilStone extends AnvilBase {
public AnvilStone(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName, hardness, anvil);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
/******************************************************************************
Crafting AnvilStone Recipes
*****************************************************************************/
ItemStack pItem = player.inventory.getCurrentItem();
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
ItemStack stack12 = tile.getSlotStack(12).copy();
if (!world.isRemote) {
if (hand.equals(hand.MAIN_HAND)) {
if (!stack12.isEmpty()) {
if (tile != null) {
if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) {
NBTTagCompound tempTag = new NBTTagCompound();
ItemStack tempironchunk = new ItemStack(ModItems.wroughtironchunk, 1);
tempironchunk.setTagCompound(tempTag);
tempironchunk.getTagCompound().setBoolean("hot", true);
ItemStack tempironcleanchunk = new ItemStack(ModItems.ironcleanchunk, 1);
tempironcleanchunk.setTagCompound(tempTag);
tempironcleanchunk.getTagCompound().setBoolean("hot", true);
ItemStack tempsteelchunk = new ItemStack(ModItems.steelchunk, 1);
tempsteelchunk.setTagCompound(tempTag);
tempsteelchunk.getTagCompound().setBoolean("hot", true);
ItemStack tempwootzchunk = new ItemStack(ModItems.wootzchunk, 1);
tempwootzchunk.setTagCompound(tempTag);
tempwootzchunk.getTagCompound().setBoolean("hot", true);
world.playEvent(1031, pos, 0);
if (stack12.getItem().equals(ModItems.ironingotball) && stack12.getTagCompound().getBoolean("hot")) {
world.playEvent(1031, pos, 0);
tile.setSlotStack(6, tempironchunk);
tile.setSlotStack(7, tempironchunk);
tile.setSlotStack(8, tempironchunk);
tile.setSlotStack(11, tempironchunk);
tile.setSlotStack(12, tempironchunk);
tile.setSlotStack(13, tempironchunk);
tile.setSlotStack(16, tempironchunk);
tile.setSlotStack(17, tempironchunk);
tile.setSlotStack(18, tempironchunk);
world.playEvent(1031, pos, 0);
return true;
}
if (stack12.getItem().equals(ModItems.ironcleaningotball) && stack12.getTagCompound().getBoolean("hot")) {
world.playEvent(1031, pos, 0);
tile.setSlotStack(6, tempironcleanchunk);
tile.setSlotStack(7, tempironcleanchunk);
tile.setSlotStack(8, tempironcleanchunk);
tile.setSlotStack(11, tempironcleanchunk);
tile.setSlotStack(12, tempironcleanchunk);
tile.setSlotStack(13, tempironcleanchunk);
tile.setSlotStack(16, tempironcleanchunk);
tile.setSlotStack(17, tempironcleanchunk);
tile.setSlotStack(18, tempironcleanchunk);
world.playEvent(1031, pos, 0);
return true;
}
if (stack12.getItem().equals(ModItems.steelingotball) && stack12.getTagCompound().getBoolean("hot")) {
world.playEvent(1031, pos, 0);
tile.setSlotStack(6, tempsteelchunk);
tile.setSlotStack(7, tempsteelchunk);
tile.setSlotStack(8, tempsteelchunk);
tile.setSlotStack(11, tempsteelchunk);
tile.setSlotStack(12, tempsteelchunk);
tile.setSlotStack(13, tempsteelchunk);
tile.setSlotStack(16, tempsteelchunk);
tile.setSlotStack(17, tempsteelchunk);
tile.setSlotStack(18, tempsteelchunk);
return true;
}
if (stack12.getItem().equals(ModItems.wootzingotball) && stack12.getTagCompound().getBoolean("hot")) {
world.playEvent(1031, pos, 0);
tile.setSlotStack(6, tempwootzchunk);
tile.setSlotStack(7, tempwootzchunk);
tile.setSlotStack(8, tempwootzchunk);
tile.setSlotStack(11, tempwootzchunk);
tile.setSlotStack(12, tempwootzchunk);
tile.setSlotStack(13, tempwootzchunk);
tile.setSlotStack(16, tempwootzchunk);
tile.setSlotStack(17, tempwootzchunk);
tile.setSlotStack(18, tempwootzchunk);
return true;
}
}
}
}
//if(! (pItem.getItem() instanceof SledgeHammer) ) {
if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) {
ItemStack[] tempArray = new ItemStack[25];
for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i);
}
doAnvilRecipe(pItem, stack12, tempArray, world, tile, pos, player);
return true;
}
//}
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return true;
}
}
return false;
}
}

View File

@@ -1,422 +0,0 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.crafting.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
import nmd.primal.forgecraft.tiles.TileBloomery;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 6/11/17.
*/
public class BloomeryBase extends CustomContainerFacing implements ITileEntityProvider {
//public static final PropertyBool COVERED = PropertyBool.create("covered");
private int maxHeat;
public AxisAlignedBB AABB = new AxisAlignedBB(5/32D, 0.0D, 5/32D, 27/32D, 12/16D, 27/32D);
public BloomeryBase(Material material, String registryName, Integer maxHeat) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
setResistance(5.0f);
this.maxHeat=maxHeat;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return AABB;
}
public int getMaxHeat() {
return maxHeat;
}
public void setMaxHeat(int maxHeat) {
this.maxHeat = maxHeat;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBloomery();
}
/*@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if(state.getValue(PrimalStates.ACTIVE) == true) {
FireHelper.makeSmoke(world, pos, 50);
}
}
}*/
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (world.isRemote)
return true;
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile != null) {
ItemStack pItem = player.inventory.getCurrentItem();
ItemStack tileItem = tile.getSlotStack(0);
ItemStack tileItem1 = tile.getSlotStack(1);
if(pItem.isEmpty()) {
if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true){
Integer bloomeryHeat = tile.getHeat();
String display = "\n" + "Current Temp: " + bloomeryHeat.toString() +
" Fuel Remaining: " + tileItem.getCount();
ITextComponent itextcomponent = new TextComponentString(display);
player.sendStatusMessage(itextcomponent, false);
BloomeryCrafting recipe = BloomeryCrafting.getRecipe(tile.getSlotStack(1));
if(recipe != null) {
Integer minTemp = recipe.getHeatThreshold();
Integer cookCounter = tile.getCookCounter();
Integer idealTime = recipe.getIdealTime();
Integer remainingTime = idealTime - cookCounter;
String display1 =
"Cooking: " + tileItem1.getDisplayName() +
" Target Temp: " + minTemp.toString() +
" Time Left: " + remainingTime.toString();
ITextComponent itextcomponent1 = new TextComponentString(display1);
player.sendStatusMessage(itextcomponent1, false);
}
return true;
}
}
}
if(tile.getSlotStack(0) != ItemStack.EMPTY) {
if((FireSource.useSource(world, pos, player, pItem, hand, facing, hitX, hitY, hitZ))) {
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, true), 2);
tile.setHeat(100);
tile.markDirty();
tile.updateBlock();
return true;
}
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
if (!tileItem.isEmpty()){
if(pItem.getItem() == tileItem.getItem()){
if(tileItem.getCount() < 64){
if(tileItem.getCount() + pItem.getCount() <= 64){
tileItem.grow(pItem.getCount());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
if(tileItem.getCount() + pItem.getCount() > 64){
pItem.setCount(64-pItem.getCount());
tileItem.setCount(64);
tile.markDirty();
tile.updateBlock();
return true;
}
}
}
}
if(tileItem.isEmpty()) {
tile.setSlotStack(0, pItem);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(1, pItem)) {
if (!tileItem1.isEmpty()) {
return false;
}
if(tileItem1.isEmpty()){
ItemStack tempItem = new ItemStack(pItem.getItem(), 1);
tile.setSlotStack(1, tempItem);
pItem.shrink(1);
return true;
}
}
if (player.isSneaking()) {
if (!tile.getSlotStack(0).isEmpty()) {
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
ItemStack returnStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.clearSlot(0);
return true;
}
}
}
}
return false;
}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
int lightState =0;
if(state.getValue(PrimalStates.ACTIVE) == true){
lightState = 10;
}
return lightState;
}
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return 0;
}
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return true;
}
@Override
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
if(!world.isRemote){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE)==true){
return true;
}
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
if(ent instanceof EntityPlayer){
if(state.getValue(PrimalStates.ACTIVE) == true){
ent.setFire(1);
}
}
}
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 7;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing;
Boolean active;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.EAST;
active = false;
break;
case 1:
enumfacing = EnumFacing.WEST;
active = false;
break;
case 2:
enumfacing = EnumFacing.SOUTH;
active = false;
break;
case 3:
enumfacing = EnumFacing.NORTH;
active = false;
break;
case 4:
enumfacing = EnumFacing.EAST;
active = true;
break;
case 5:
enumfacing = EnumFacing.WEST;
active = true;
break;
case 6:
enumfacing = EnumFacing.SOUTH;
active = true;
break;
case 7:
enumfacing = EnumFacing.NORTH;
active = true;
break;
default:
enumfacing = EnumFacing.NORTH;
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalStates.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(PrimalStates.ACTIVE) == true)
{
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.2D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
if (rand.nextDouble() < 0.1D)
{
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
}
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
}
}
}

View File

@@ -1,236 +0,0 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileBreaker;
import nmd.primal.forgecraft.util.BreakerHandler;
/**
* Created by mminaie on 4/9/17.
*/
public class Breaker extends CustomContainerFacing implements BreakerHandler {
public AxisAlignedBB AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 6/16D, 1.0D);
public Breaker(Material material, String registryName, Float hardness) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, false));
setHardness(hardness);
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return AABB;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if(!world.isRemote){
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
if(state.getValue(PrimalStates.ACTIVE) == true && player.isSneaking() && pItem.isEmpty()){
doBreaking(world, state, pos, tile);
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalStates.ACTIVE, false));
tile.setCharge(0);
return true;
}
if(!player.isSneaking() && pItem.isEmpty()) {
if (!state.getValue(PrimalStates.ACTIVE)) {
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalStates.ACTIVE, true), 2);
return true;
}
if(state.getValue(PrimalStates.ACTIVE)) {
if (tile.getCharge() < 181) {
tile.setCharge(tile.getCharge() + 2.0f);
tile.updateBlock();
//System.out.println(tile.charge);
return true;
}
}
}
if(pItem.getItem() instanceof WorkMallet){
tile.setSlotStack(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
return false;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBreaker();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, false), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if(state.getValue(PrimalStates.ACTIVE ) == false) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 2;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 3;
return i;
}
}
if(state.getValue(PrimalStates.ACTIVE)) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 4;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 5;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 6;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 7;
return i;
}
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, false);
}
if (meta == 4){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, true);
}
if (meta == 5) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, true);
}
if (meta == 6) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, true);
}
if (meta == 7) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, true);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {PrimalStates.ACTIVE, FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,689 +0,0 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.casting.CastingPart;
import nmd.primal.forgecraft.tiles.TileCastingBlock;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 6/24/17.
*/
public class CastingBlock extends CustomContainerFacing {
protected static AxisAlignedBB bound = new AxisAlignedBB(0/16D, 0.0D, 0/16D, 16/16D, 5.5/16D, 16/16D);
public CastingBlock(Material material, String registryName) {
super(material, registryName);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
private void makeEmbers(World world, BlockPos pos, Random rand){
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.2D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.066, 0.33);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.05, 0.20);
if(rand.nextInt(3) == 0){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
if(rand.nextInt(3) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
if(rand.nextInt(3) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
if(rand.nextInt(3) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, ySpeed, ySpeed, ySpeed, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, ySpeed, ySpeed, ySpeed, new int[0]);
}
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if (!world.isRemote) {
TileCastingBlock tile = (TileCastingBlock) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
if(player.isSneaking()) {
if(!tile.getSlotStack(0).isEmpty()){
ItemStack copyStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, copyStack);
tile.setSlotStack(0, ItemStack.EMPTY);
tile.updateBlock();
return true;
}
}
if(pItem.getItem() instanceof CastingPart){
if(!player.isSneaking()) {
if (tile.getSlotStack(0).isEmpty()) {
ItemStack copyStack = pItem.copy();
copyStack.setCount(1);
pItem.shrink(1);
tile.setSlotStack(0, copyStack);
tile.updateBlock();
return true;
}
}
}
if(pItem.getItem() == ModItems.stonetongs ){
ItemStack dropCrucible = new ItemStack(ModBlocks.emptycrucible);
if(pItem.getTagCompound().getInteger("type") == 40){
if(tile.getSlotStack(0).getItem() == ModItems.cast_hoe){
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
//makeEmbers(world, pos, world.rand);
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe){
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_axe){
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_shovel){
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_gladius){
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
/***************************
* Bronze *
*
46 | Hot Cooked Bronze Crucible Emerald
48 | Hot Cooked Bronze Crucible Diamond
50 | Hot Cooked Bronze Crucible Redstone
52 | Hot Cooked Bronze Crucible Lapis
***************************/
if(pItem.getTagCompound().getInteger("type") == 46){
if(tile.getSlotStack(0).getItem() == ModItems.cast_hoe){
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe){
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_axe){
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_shovel){
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", true);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if(tile.getSlotStack(0).getItem() == ModItems.cast_gladius){
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
if(pItem.getTagCompound().getInteger("type") == 48) {
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 1);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if (CommonUtils.randomCheck(2)) {
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
if(pItem.getTagCompound().getInteger("type") == 50) {
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 1);
dropStack.getSubCompound("tags").setInteger("lapis", 0);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
if(pItem.getTagCompound().getInteger("type") == 52) {
if (tile.getSlotStack(0).getItem() == ModItems.cast_hoe) {
ItemStack dropStack = new ItemStack(ModItems.bronzehoehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_pickaxe) {
ItemStack dropStack = new ItemStack(ModItems.bronzepickaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_axe) {
ItemStack dropStack = new ItemStack(ModItems.bronzeaxehead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_shovel) {
ItemStack dropStack = new ItemStack(ModItems.bronzeshovelhead);
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
dropStack.getSubCompound("tags").setBoolean("hot", false);
dropStack.getSubCompound("tags").setBoolean("emerald", false);
dropStack.getSubCompound("tags").setInteger("diamond", 0);
dropStack.getSubCompound("tags").setInteger("redstone", 0);
dropStack.getSubCompound("tags").setInteger("lapis", 1);
dropStack.getSubCompound("tags").setInteger("modifiers", 1);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
if (tile.getSlotStack(0).getItem() == ModItems.cast_gladius) {
ItemStack dropStack = new ItemStack(ModItems.bronzegladius);
PlayerHelper.spawnItemOnGround(world, pos, dropStack);
PlayerHelper.spawnItemOnGround(world, pos, dropCrucible);
pItem.getTagCompound().setInteger("type", 0);
if(CommonUtils.randomCheck(2)){
tile.setSlotStack(0, ItemStack.EMPTY);
}
return true;
}
}
}
}
return false;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileCastingBlock tile = (TileCastingBlock) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileCastingBlock();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return bound;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,192 +0,0 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileCastingForm;
import nmd.primal.forgecraft.util.CastingFormHandler;
import java.util.Random;
/**
* Created by mminaie on 6/19/17.
*/
public class CastingForm extends CustomContainerFacing implements CastingFormHandler{
protected static AxisAlignedBB bound = new AxisAlignedBB(0/16D, 0.0D, 0/16D, 16/16D, 3/16D, 16/16D);
public CastingForm(Material material, String registryName) {
super(material, registryName);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setTickRandomly(true);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if (!world.isRemote) {
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
doInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return false;
}
return false;
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random random)
{
if (!world.isRemote) {
if(CommonUtils.randomCheck(4)) {
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
String[] tempArray = new String[25];
for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
}
doCraftingformCrafting(tempArray, world, tile, pos);
}
}
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileCastingForm();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return bound;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,481 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.MobEffects;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.init.ModSounds;
import nmd.primal.forgecraft.items.SledgeHammer;
import nmd.primal.forgecraft.util.ToolMaterialMap;
import javax.annotation.Nullable;
public class Chisel extends CustomFacing implements ToolMaterialMap {
private AxisAlignedBB boundBoxDown = new AxisAlignedBB(
0.4375D, 0.0D, 0.4375D,
0.5625D, 0.875D, 0.5625D);
private AxisAlignedBB boundBoxDownActive = new AxisAlignedBB(
0.4375D, 0.0D, 0.4375D,
0.5625D, 0.375D, 0.5625D);
private AxisAlignedBB boundBoxUp = new AxisAlignedBB(
0.4375D, 0.125D, 0.4375D,
0.5625D, 1.0, 0.5625D);
private AxisAlignedBB boundBoxUpActive = new AxisAlignedBB
(0.4375D, 0.625D, 0.4375D,
0.5625D, 1.0D, 0.5625D);
private AxisAlignedBB boundBoxEast = new AxisAlignedBB(
0.125D, 0.4375D, 0.4375D,
1.0D, 0.5625D, 0.5625D);
private AxisAlignedBB boundBoxEastActive = new AxisAlignedBB(
0.625D, 0.4375D, 0.4375D,
1.0D, 0.5625D, 0.5625D);
private AxisAlignedBB boundBoxWest = new AxisAlignedBB(
0.0D, 0.4375D, 0.4375D,
0.875D, 0.5625D, 0.5625D);
private AxisAlignedBB boundBoxWestActive = new AxisAlignedBB(
0.0D, 0.4375D, 0.4375D,
0.375D, 0.5625D, 0.5625D);
private AxisAlignedBB boundBoxNorth = new AxisAlignedBB(
0.4375D, 0.4375D, 0.0D,
0.5625D, 0.5625D, 0.875D);
private AxisAlignedBB boundBoxNorthActive = new AxisAlignedBB(
0.4375D, 0.4375D, 0.0D,
0.5625D, 0.5625D, 0.375D);
private AxisAlignedBB boundBoxSouth = new AxisAlignedBB(
0.4375D, 0.4375D, 0.125D,
0.5625D, 0.5625D, 1.0D);
private AxisAlignedBB boundBoxSouthActive = new AxisAlignedBB(
0.4375D, 0.4375D, 0.625D,
0.5625D, 0.5625D, 1.0D);
private Item.ToolMaterial realMaterial;
public Chisel(Material material, String name, Item.ToolMaterial realMaterial) {
super(material, name);
this.setHardness(8.0f);
this.setResistance(8.0f);
this.realMaterial = realMaterial;
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.DOWN).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
if(state.getValue(FACING)==EnumFacing.UP && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxUp;
}
if(state.getValue(FACING)==EnumFacing.UP && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxUpActive;
}
if(state.getValue(FACING)==EnumFacing.DOWN && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxDown;
}
if(state.getValue(FACING)==EnumFacing.DOWN && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxDownActive;
}
if(state.getValue(FACING)==EnumFacing.EAST && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxEast;
}
if(state.getValue(FACING)==EnumFacing.EAST && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxEastActive;
}
if(state.getValue(FACING)==EnumFacing.WEST && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxWest;
}
if(state.getValue(FACING)==EnumFacing.WEST && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxWestActive;
}
if(state.getValue(FACING)==EnumFacing.NORTH && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxNorth;
}
if(state.getValue(FACING)==EnumFacing.NORTH && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxNorthActive;
}
if(state.getValue(FACING)==EnumFacing.SOUTH && !state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxSouth;
}
if(state.getValue(FACING)==EnumFacing.SOUTH && state.getValue(PrimalAPI.States.ACTIVE)){
return boundBoxSouthActive;
}
return boundBoxDown;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(!world.isRemote) {
world.setBlockState(pos, state.withProperty(FACING, EnumFacing.getFacingFromVector((float)placer.getLookVec().x, (float)placer.getLookVec().y, (float)placer.getLookVec().z)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
}
}
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalAPI.States.ACTIVE});
}
public Item.ToolMaterial getRealMaterial() {
return realMaterial;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if(!world.isRemote){
ItemStack playerStack = player.inventory.getCurrentItem();
ItemStack offStack = player.inventory.offHandInventory.get(0);
int toolHarvestLevel = playerStack.getItem().getHarvestLevel(playerStack, "pickaxe", player, state);
if(player.getActiveItemStack().isEmpty()){
if(player.isSneaking()){
PlayerHelper.spawnItemOnPlayer(world, player, new ItemStack(Item.getItemFromBlock(state.getBlock()), 1));
world.setBlockToAir(pos);
return true;
}
}
if (hand.equals(hand.MAIN_HAND) && offStack == ItemStack.EMPTY) {
if(!player.isSwingInProgress) {
if(player.getActivePotionEffect(MobEffects.MINING_FATIGUE ) == null){
if (playerStack.getItem() instanceof SledgeHammer) {
SledgeHammer playerItem = (SledgeHammer) playerStack.getItem();
world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.CHISEL_HIT, SoundCategory.BLOCKS, (float) (PrimalAPI.getRandom().nextDouble(0.5D, 0.8D)), (float) (PrimalAPI.getRandom().nextDouble(0.3D, 1.0D)));
playerStack.damageItem(1, player);
player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, (100 - ((materialModifiers.get(playerItem.getMaterial()) * 8) + (materialModifiers.get(this.getRealMaterial()) * 8))), 100));
if (PrimalAPI.getRandom().nextInt(1, 10) != 1) {
if (state.getValue(FACING) == EnumFacing.UP) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (1), (i - 1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (1), (i - 1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.DOWN) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (-1), (i - 1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (-1), (i - 1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (i - 1), (1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (i - 1), (1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (i - 1), (-1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((a - 1), (i - 1), (-1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.EAST) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((1), (i - 1), (a - 1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((1), (i - 1), (a - 1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.WEST) {
if (state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((-1), (i - 1), (a - 1));
IBlockState breakState = world.getBlockState(movePos);
if (state.getValue(PrimalAPI.States.ACTIVE)) {
doBreaking(world, movePos, breakState, player);
}
}
}
doMoving(world, pos, toolHarvestLevel, state, state.getValue(FACING));
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
for (int i = 0; i < 3; i++) {
for (int a = 0; a < 3; a++) {
BlockPos movePos = pos.add((-1), (i - 1), (a - 1));
if (!(world.getBlockState(movePos).getBlock() instanceof Chisel)) {
IBlockState breakState = world.getBlockState(movePos);
doDamaging(world, movePos, breakState, player);
}
}
}
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
}
}
}
}
}
}
if(offStack != ItemStack.EMPTY) {
String printout = "Is your offhand empty?";
ITextComponent text = new TextComponentString(printout);
player.sendStatusMessage(text, true);
return false;
}
}
return false;
}
/**
* Convert the given metadata into a BlockState for this Block
*/
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(FACING, getFacing(meta)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf((meta & 8) > 0));
}
@Nullable
public static EnumFacing getFacing(int meta)
{
int i = meta & 7;
return i > 5 ? null : EnumFacing.getFront(i);
}
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state)
{
int i = 0;
i = i | ((EnumFacing)state.getValue(FACING)).getIndex();
if (((Boolean)state.getValue(PrimalAPI.States.ACTIVE)).booleanValue())
{
i |= 8;
}
return i;
}
private EnumFacing reverseFacing(EnumFacing facing){
if(facing == EnumFacing.UP){
return EnumFacing.DOWN;
}
if(facing == EnumFacing.DOWN){
return EnumFacing.UP;
}
if(facing == EnumFacing.NORTH){
return EnumFacing.SOUTH;
}
if(facing == EnumFacing.SOUTH){
return EnumFacing.NORTH;
}
if(facing == EnumFacing.EAST){
return EnumFacing.WEST;
}
if(facing == EnumFacing.WEST){
return EnumFacing.EAST;
}
return null;
}
@SideOnly(Side.CLIENT)
public boolean hasCustomBreakingProgress(IBlockState state)
{
return true;
}
private void doMoving(World world, BlockPos pos, int toolHarvestLevel, IBlockState state, EnumFacing facing){
if( (world.getBlockState(pos.offset(facing, 2)).getBlock() != Blocks.AIR) ) {
if ((compareHarvestLevel(toolHarvestLevel, world.getBlockState(pos.offset(facing, 1)).getBlock().getHarvestLevel(world.getBlockState(pos.offset(facing, 1))))) &&
(world.getBlockState(pos.offset(facing, 1)).getBlock() == Blocks.AIR)) {
world.setBlockState(pos.offset(facing, 1), state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
world.setBlockToAir(pos);
}
} else {
world.destroyBlock(pos, true);
}
}
private void doBreaking(World world, BlockPos movePos, IBlockState state, EntityPlayer player){
if (!(state.getBlock().equals(Blocks.AIR))) {
if(world.getBlockState(movePos).getBlock().getBlockHardness(state, world, movePos)>0) {
ItemStack playerStack = player.inventory.getCurrentItem();
int toolHarvestLevel = playerStack.getItem().getHarvestLevel(playerStack, "pickaxe", player, state);
world.destroyBlock(movePos, compareHarvestLevel(toolHarvestLevel, state.getBlock().getHarvestLevel(state)));
world.sendBlockBreakProgress(player.getEntityId()+PrimalAPI.getRandom().nextInt(100), movePos, 0);
}
}
}
private void doDamaging(World world, BlockPos movePos, IBlockState state, EntityPlayer player){
if (!(state.getBlock().equals(Blocks.AIR))) {
if(world.getBlockState(movePos).getBlock().blockHardness>0) {
world.sendBlockBreakProgress(player.getEntityId() - PrimalAPI.getRandom().nextInt(100), movePos, PrimalAPI.getRandom().nextInt(3,10));
}
}
}
private boolean compareHarvestLevel(int inputLevel, int compareHarvest){
if(inputLevel >= compareHarvest && inputLevel >=0){
return true;
} else return false;
}
private void makeParticles(World world, BlockPos pos, EnumParticleTypes particle, EnumFacing facing){
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.5D;
double d2 = (double)pos.getZ() + 0.5D;
double xVelocity = 0.0D;
double yVelocity = 0.0D;
double zVelocity = 0.0D;
double d4 = PrimalAPI.getRandom().nextDouble(0.066, 0.33);
if(facing == EnumFacing.NORTH){
d0 += 0.5D;
}
if(facing == EnumFacing.DOWN){
d1 += 0.5D;
yVelocity += 0.1D;
}
if(facing == EnumFacing.UP){
d1 -= 0.5D;
}
//if(PrimalAPI.getRandom().nextInt(3) == 0){
world.spawnParticle(particle, d0, d1, d2, 0.0D + xVelocity, 0.0 + yVelocity, 0.0D + zVelocity, new int[1]);
world.spawnParticle(particle, d0, d1, d2, 0.0D + xVelocity, 0.0 + yVelocity, 0.0D + zVelocity, new int[1]);
//}
//double ySpeed = ThreadLocalRandom.current().nextDouble(0.05, 0.20);
}
}

View File

@@ -1,190 +0,0 @@
package nmd.primal.forgecraft.blocks.Crucibles;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks;
import org.apache.commons.lang3.StringUtils;
import java.util.Random;
import static nmd.primal.forgecraft.CommonUtils.spawnItemEntityFromWorld;
/**
* Created by mminaie on 1/24/17.
*/
public class Crucible extends Block {
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
//public static final PropertyInteger SIZE = PropertyInteger.create("size", 0, 3);
public Crucible(Material material, String registryName) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setHardness(3.0f);
//this.blockState.getBaseState().withProperty(SIZE, Integer.valueOf(0));
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem();
if(pItem.isEmpty()){
CommonUtils.spawnItemEntity(world, player, new ItemStack(this, 1));
world.setBlockToAir(pos);
return true;
}
if(Block.getBlockFromItem(pItem.getItem()) == this){
CommonUtils.spawnItemEntity(world, player, new ItemStack(this, 1));
world.setBlockToAir(pos);
return true;
}
}
return false;
}
/*@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
ret.add(0, new ItemStack(ModBlocks.emptycrucible, 1));
if(this.getUnlocalizedName()=="tile.coolironcrucible"){
ret.add(1, new ItemStack(Items.IRON_INGOT, 1));
}
return ret;
}*/
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
if(!world.isRemote){
if(this.getUnlocalizedName().equals("tile.emptycruciblecracked")){} else spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.emptycrucible, 1));
if(StringUtils.isEmpty(this.getUnlocalizedName()) == false) {
if(checkDrops(this.getUnlocalizedName()) != null) {
if (checkDrops(this.getUnlocalizedName()).equals(this.getUnlocalizedName())) {
spawnItemEntityFromWorld(world, pos, new ItemStack(getItemFromName(this.getUnlocalizedName()), 1));
}
}
}
}
}
private String checkDrops(String name){
String string = null;
if(name.equals("tile.coolironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolcleanironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawcleanironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolsteelcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawsteelcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.coolwootzcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawwootzcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.emptycruciblecracked")){
string = this.getUnlocalizedName();
}
return string;
}
private Item getItemFromName(String name){
if(name.equals("tile.coolironcrucible")){
return Item.getItemFromBlock(ModBlocks.ironball);
} else if (name.equals("tile.rawironcrucible")){
return Item.getItemFromBlock(Blocks.IRON_ORE);
} else if (name.equals("tile.coolcleanironcrucible")){
return Item.getItemFromBlock(ModBlocks.ironcleanball);
} else if (name.equals("tile.rawcleanironcrucible")){
return PrimalItems.IRON_DUST;
} else if (name.equals("tile.coolsteelcrucible")){
return Item.getItemFromBlock(ModBlocks.steelball);
} else if (name.equals("tile.rawsteelcrucible")){
return Item.getItemFromBlock(ModBlocks.ironcleanball);
} else if (name.equals("tile.coolwootzcrucible")){
return Item.getItemFromBlock(ModBlocks.wootzball);
} else if (name.equals("tile.rawcleanironcrucible")){
return PrimalItems.GOLDEN_STICK;
}else if (name.equals("tile.emptycruciblecracked")){
return Items.CLAY_BALL;
}
else return Items.AIR;
}
@Override
public int quantityDropped(Random random)
{
return 0;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,101 +0,0 @@
package nmd.primal.forgecraft.blocks.Crucibles;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
import java.util.Random;
/**
* Created by mminaie on 2/4/17.
*/
public class CrucibleHot extends Block implements ITileEntityProvider {
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
//public static final PropertyInteger SIZE = PropertyInteger.create("size", 0, 3);
public CrucibleHot(Material material, String registryName) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setHardness(3.0f);
//this.blockState.getBaseState().withProperty(SIZE, Integer.valueOf(0));
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
return false;
}
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
if(!world.isRemote){
world.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState().withProperty(BlockDynamicLiquid.LEVEL, 1), 3);
}
}
@Override
public int quantityDropped(Random random)
{
return 0;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBaseCrucible();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,10 +1,21 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by kitsu on 12/3/2016.
@@ -20,10 +31,89 @@ public abstract class CustomContainerFacing extends BlockContainer {
this.setUnlocalizedName(registryName);
this.setHardness(3.0f);
this.setResistance(4.0f);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
protected CustomContainerFacing(Material material, MapColor color)
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
super(material, color);
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,138 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by kitsu on 12/3/2016.
*/
public abstract class CustomContainerFacingActive extends BlockContainer {
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
protected CustomContainerFacingActive(Material material, String registryName)
{
super(material);
this.setRegistryName(registryName);
this.setUnlocalizedName(registryName);
this.setHardness(3.0f);
this.setResistance(4.0f);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, false), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if(!state.getValue(PrimalAPI.States.ACTIVE)) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 2;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 3;
return i;
}
}
if(state.getValue(PrimalAPI.States.ACTIVE)) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 4;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 5;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 6;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 7;
return i;
}
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalAPI.States.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,26 +1,51 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by mminaie on 1/1/17.
*/
public abstract class CustomFacing extends Block {
public abstract class CustomFacing extends BlockDirectional {
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
protected CustomFacing(Material material)
{
protected CustomFacing(Material material, String name) {
super(material);
this.setRegistryName(name);
this.setUnlocalizedName(name);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
protected CustomFacing(Material material, MapColor color)
@Override
public boolean isFullCube(IBlockState state)
{
super(material, color);
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,488 +0,0 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.crafting.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.tiles.TileForge;
import javax.annotation.Nullable;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
//import nmd.primal.core.api.PrimalBlocks;
/**
* Created by kitsu on 11/26/2016.
*/
public class Forge extends CustomContainerFacing implements ITileEntityProvider{
private int maxHeat;
//public static final PropertyBool PrimalStates.ACTIVE = PropertyBool.create("PrimalStates.ACTIVE");
protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
public Forge(Material material, String name, Integer maxHeat) {
super(material, name);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
setResistance(5.0f);
this.maxHeat=maxHeat;
}
public int getMaxHeat() {
return maxHeat;
}
public void setMaxHeat(int maxHeat) {
this.maxHeat = maxHeat;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileForge();
}
@Nullable
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
{
return collideBox;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (!world.isRemote) {
TileForge tile = (TileForge) world.getTileEntity(pos);
if (tile != null) {
ItemStack pItem = player.inventory.getCurrentItem();
ItemStack fuelItem = tile.getSlotStack(0);
//System.out.println(pItem.getItem().getRegistryName().toString());
/***********************
FUEL SLOT CODE
***********************/
if (player.isSneaking()) {
if (!tile.getSlotStack(0).isEmpty()) {
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
ItemStack returnStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.clearSlot(0);
return true;
}
}
}
if(pItem.isEmpty()) {
if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true){
Integer tempInt = tile.getHeat();
String tempString = tempInt.toString();
ITextComponent itextcomponent = new TextComponentString(tempString);
player.sendStatusMessage(itextcomponent, true);
//System.out.println(pos);
return true;
}
}
}
if((FireSource.useSource(world, pos, player, pItem, hand, facing, hitX, hitY, hitZ))) {
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, true), 2);
tile.setHeat(100);
tile.markDirty();
tile.updateBlock();
return true;
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
if (!fuelItem.isEmpty()){
if(pItem.getItem() == fuelItem.getItem()){
if(fuelItem.getCount() < 64){
if(fuelItem.getCount() + pItem.getCount() <= 64){
fuelItem.grow(pItem.getCount());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
if(fuelItem.getCount() + pItem.getCount() > 64){
pItem.setCount(64-pItem.getCount());
fuelItem.setCount(64);
tile.markDirty();
tile.updateBlock();
return true;
}
}
}
}
if(fuelItem.isEmpty()) {
tile.setSlotStack(0, pItem);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
/***********************
FORGING SLOTS CODE
***********************/
//REMOVE COOL INGOT
if(facing == EnumFacing.UP ) {
/*if (pItem.isEmpty()) {
for (int i = 2; i < tile.getSlotListSize(); i++) {
//System.out.println(i);
if (!tile.getSlotStack(i).isEmpty()) {
if (Block.getBlockFromItem(tile.getSlotStack(i).getItem()) instanceof IngotBall) {
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
tile.setSlotStack(i, ItemStack.EMPTY);
return true;
}
if(tile.getSlotStack(i).hasTagCompound() == true){
if (tile.getSlotStack(i).getTagCompound().getBoolean("hot") == false) {
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(i));
tile.setSlotStack(i, ItemStack.EMPTY);
return true;
}
}
}
}
}*/
if (Block.getBlockFromItem(pItem.getItem()) instanceof IngotBall) {
//System.out.println("Activating");
for (int i = 2; i <= tile.getSlotListSize(); i++) {
if (tile.getSlotStack(i).isEmpty()) {
tile.setSlotStack(i, new ItemStack(pItem.getItem(), 1));
pItem.shrink(1);
return true;
}
}
}
//Needs Ore Dictionary Compat
if (pItem.getItem().equals(new ItemStack(Items.IRON_INGOT).getItem())) {
for (int i = 2; i < 7; i++) {
if (tile.getSlotStack(i).isEmpty()) {
tile.setSlotStack(i, new ItemStack(Items.IRON_INGOT, 1));
pItem.shrink(1);
return true;
}
}
}
if(pItem.getItem() instanceof ToolPart){
if(tile.getSlotStack(4).isEmpty()){
//System.out.println("Adding player Item to slot");
tile.setSlotStack(4, pItem);
//System.out.println(tile.getSlotStack(4));
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
}
}
//System.out.println(tile.getSlotStack(0));
//System.out.println(tile.getSlotStack(1));
//System.out.println(tile.getSlotStack(2));
//System.out.println(tile.getSlotStack(3));
//System.out.println(tile.getSlotStack(4));
//System.out.println(tile.getSlotStack(5));
//System.out.println(tile.getSlotStack(6));
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
//if (!world.isRemote){
if(ent instanceof EntityPlayer){
if(state.getValue(PrimalStates.ACTIVE) == true){
ent.setFire(1);
}
}
//}
}
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
if(state.getValue(PrimalStates.ACTIVE) == true){
return 15;
}
return 0;
}
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return 0;
}
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return true;
}
@Override
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
if (side == EnumFacing.UP)
{
if(!world.isRemote){
TileForge tile = (TileForge) world.getTileEntity(pos);
if(tile.getSlotStack(0) != ItemStack.EMPTY){
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE)==true){
return true;
}
}
}
}
return false;
}
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileForge tile = (TileForge) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
/*@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
return state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false));
}*/
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalStates.ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalStates.ACTIVE) == true){
i = 7;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing;
Boolean active;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.EAST;
active = false;
break;
case 1:
enumfacing = EnumFacing.WEST;
active = false;
break;
case 2:
enumfacing = EnumFacing.SOUTH;
active = false;
break;
case 3:
enumfacing = EnumFacing.NORTH;
active = false;
break;
case 4:
enumfacing = EnumFacing.EAST;
active = true;
break;
case 5:
enumfacing = EnumFacing.WEST;
active = true;
break;
case 6:
enumfacing = EnumFacing.SOUTH;
active = true;
break;
case 7:
enumfacing = EnumFacing.NORTH;
active = true;
break;
default:
enumfacing = EnumFacing.NORTH;
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalStates.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if(state.getValue(PrimalStates.ACTIVE) == true) {
makeSmoke(world, pos);
}
}
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(PrimalStates.ACTIVE) == true)
{
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.96D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
if (rand.nextDouble() < 0.1D)
{
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
}
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
}
}
}

View File

@@ -1,119 +0,0 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import nmd.primal.core.api.PrimalStates;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* Created by mminaie on 2/6/17.
*/
public class IngotBall extends BlockCustomBase {
protected static AxisAlignedBB boundBoxLarge = new AxisAlignedBB(6/16D, 0.0D, 6/16D, 10/16D, 4/16D, 10/16D);
protected static AxisAlignedBB boundBoxSmall = new AxisAlignedBB(7/16D, 0.0D, 7/16D, 9/16D, 2/16D, 9/16D);
//public static final PropertyBool ACTIVE = PropertyBool.create("active");
private String type;
public IngotBall(Material material, String registryName, Float hardness, String type){
super(material, registryName, hardness);
this.type = type;
this.setTickRandomly(true);
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
if(this.type.equals("chunk")){
return boundBoxSmall;
}else
return boundBoxLarge;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//System.out.println(stack.getItemDamage());
worldIn.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
//System.out.println(state.getValue(ACTIVE));
}
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
if(!world.isRemote){
if(state.getValue(PrimalStates.ACTIVE)){
world.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState().withProperty(BlockDynamicLiquid.LEVEL, 1), 3);
}
if(!state.getValue(PrimalStates.ACTIVE)){
//PlayerHelper.spawnItemOnGround(world, pos, new ItemStack(this, 1));
}
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(PrimalStates.ACTIVE) == false) {
i = 0;
return i;
}
if( state.getValue(PrimalStates.ACTIVE) == true) {
i = 1;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false));
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true));
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {PrimalStates.ACTIVE});
}
@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if ( ThreadLocalRandom.current().nextInt(0,4) == 0) {
if(state.getValue(PrimalStates.ACTIVE) == true) {
world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
world.playSound((EntityPlayer) null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, world.rand.nextFloat() * 0.4F + 0.8F);
}
}
}
}
}

View File

@@ -0,0 +1,432 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.ItemHandlerHelper;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.NBTHelper;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.items.SlottedTongs;
import nmd.primal.forgecraft.tiles.TileNBTCrucible;
import javax.swing.plaf.basic.BasicComboBoxUI;
import java.util.Random;
import static net.minecraft.util.EnumHand.MAIN_HAND;
/**
* Created by mminaie on 11/11/17.
*/
public class NBTCrucible extends BlockContainer implements ITileEntityProvider {
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(4/16D, 0.0D, 4/16D, 12/16D, 7/16D, 12/16D);
//private Ingredient crucibleIngredients;
public NBTCrucible(Material material, String registryName) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setHardness(3.0f);
setDefaultState(this.blockState.getBaseState().withProperty(PrimalAPI.States.LAYERS, Integer.valueOf(0)));
//setDefaultState(this.blockState.getBaseState().withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hands, EnumFacing face, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
if(player.getActiveHand().equals(EnumHand.MAIN_HAND)) {
ItemStack playerStackStart = player.getHeldItemMainhand().copy();
/**PICKS UP THE CRUCIBLE**/
if (playerStackStart.isEmpty()) {
if (!player.isSneaking()) {
//System.out.println(tile.getHot());
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(tile.ingList.get(0), tile.ingList.get(1), tile.ingList.get(2), tile.ingList.get(3), tile.ingList.get(4));
if (recipe != null) {
System.out.println(tile.getDrops());
//tile.setDrops(recipe.getDropsRaw());
}
PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getCrucibleItem(world, pos, state, player));
//ItemHandlerHelper.giveItemToPlayer(player, this.getCrucibleItem(world, pos, state, player));
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
world.markTileEntityForRemoval(tile);
//System.out.println(player.getHeldItemMainhand().getTagCompound());
return true;
}
}
/**SET INGREDIENT ARRAY FOR THE CRUCIBLE NOW**/
if (!player.isSneaking()) {
ItemStack pItem = player.inventory.getCurrentItem().copy();
pItem.setCount(1);
if (!pItem.isEmpty()) {
if (!tile.getStatus() || tile.getHot() == 15 || tile.getHot() == 6) {
if (pItem.getItem() instanceof SlottedTongs) {
return false;
} else {
pItem.setCount(1);
for (int i = 1; i < tile.ingList.size() + 1; i++) {
if (tile.ingList.get(i - 1).isEmpty()) {
tile.ingList.set(i - 1, pItem);
tile.setHot(i);
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, i), 2);
player.inventory.getCurrentItem().shrink(1);
tile.update();
tile.markDirty();
return true;
}
}
}
}
}
}
/**CLEARS THE INVENTORY**/
if (player.isSneaking()) {
ItemStack pItem = player.inventory.getCurrentItem().copy();
if (pItem.isEmpty()) {
if (tile.getHot() != 15) {
if (!tile.getStatus()) {
for (int i = 0; i < tile.ingList.size(); i++) {
if (!tile.ingList.get(i).isEmpty()) {
PlayerHelper.spawnItemOnPlayer(world, player, tile.ingList.get(i));
tile.ingList.set(i, ItemStack.EMPTY);
}
}
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, 0), 2);
tile.setHot(0);
tile.setStatus(false);
tile.update();
tile.markDirty();
return true;
}
}
}
}
/**REMOVE COOKED ITEM**/
if (player.isSneaking()) {
ItemStack pItem = player.inventory.getCurrentItem().copy();
if (pItem.isEmpty()) {
//TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
if (tile.getStatus() && tile.getHot() == 6) {
System.out.println(tile.getDrops());
ItemStack dropStack = tile.getDrops().copy();
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, 0), 2);
tile.setHot(0);
tile.setStatus(false);
tile.setDrops(ItemStack.EMPTY);
tile.ingList.clear();
EntityItem entityitem = new EntityItem(world, player.posX, player.posY, player.posZ, dropStack); // ? player.posY - 1.0D
world.spawnEntity(entityitem);
tile.update();
tile.markDirty();
return true;
}
}
}
}
}
return true;
}
private IBlockState getReplacementBlock(World world, BlockPos pos, IBlockState state)
{
return Blocks.AIR.getDefaultState();
}
@Override
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
{
this.onBlockHarvested(world, pos, state, player);
return this.destroyBlock(world, pos, state, EnumFacing.UP, player);
}
public ItemStack getCrucibleItem(World world, BlockPos pos, IBlockState state, EntityPlayer player)
{
return NBTHelper.getStackBlockNBT(world, pos, state, super.getPickBlock(state, null, world, pos, player));
}
public boolean destroyBlock(World world, BlockPos pos, IBlockState state, EnumFacing face, EntityPlayer player)
{
if (!world.isRemote) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileNBTCrucible) {
//PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getCrucibleItem(world, pos, state, player));
ItemStack dropStack = new ItemStack(ModBlocks.nbtCrucible, 1);
PlayerHelper.spawnItemOnPlayer(world, player, dropStack);
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
world.markTileEntityForRemoval(tile);
return true;
}
}
return false;
}
@Override
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player)
{
if (!world.isRemote) {
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(tile.ingList.get(0), tile.ingList.get(1), tile.ingList.get(2), tile.ingList.get(3), tile.ingList.get(4));
if(recipe != null && tile.getStatus() && tile.getHot() == 6){
if(tile.getDrops() != null) {
PlayerHelper.spawnItemOnPlayer(world, player, recipe.getDropsCooked());
} else {
PlayerHelper.spawnItemOnPlayer(world, player, recipe.getDropsRaw());
}
}
if(recipe != null && tile.getStatus() && tile.getHot() == 15){
PlayerHelper.spawnItemOnPlayer(world, player, recipe.getDropsRaw());
}
if(!tile.getStatus() && tile.getHot() != 15 && tile.getHot() != 6){
PlayerHelper.spawnItemOnPlayer(world, player, tile.ingList);
}
}
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
// see above onBlockHarvested
return null;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
TileEntity tileentity = world.getTileEntity(pos);
if (tileentity instanceof TileNBTCrucible) {
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
if(NBTHelper.hasNBT(stack)){
NBTTagCompound tag = stack.getTagCompound();
world.setBlockState(pos, state.withProperty(PrimalAPI.States.LAYERS, tile.getHot()), 2);
//tile.readNBT(tag);
}
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(PrimalAPI.States.LAYERS) == 0){
i = 0;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 1){
i = 1;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 2){
i = 2;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 3){
i = 3;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 4){
i = 4;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 5){
i = 5;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 6){
i = 6;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 7){
i = 7;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 8){
i = 8;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 9){
i = 9;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 10){
i = 10;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 11){
i = 11;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 12){
i = 12;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 13){
i = 13;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 14){
i = 14;
return i;
}
if( state.getValue(PrimalAPI.States.LAYERS) == 15){
i = 15;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 0);
}
if (meta == 1){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 1);
}
if (meta == 2){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 2);
}
if (meta == 3){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 3);
}
if (meta == 4){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 4);
}
if (meta == 5){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 5);
}
if (meta == 6){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 6);
}
if (meta == 7){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 7);
}
if (meta == 8){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 8);
}
if (meta == 9){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 9);
}
if (meta == 10){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 10);
}
if (meta == 11){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 11);
}
if (meta == 12){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 12);
}
if (meta == 13){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 13);
}
if (meta == 14){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 14);
}
if (meta == 15){
iblockstate = iblockstate.withProperty(PrimalAPI.States.LAYERS, 15);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {PrimalAPI.States.LAYERS});
}
@Override
public int quantityDropped(Random random)
{
return 1;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileNBTCrucible();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -4,7 +4,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@@ -13,12 +12,12 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import nmd.primal.core.api.PrimalSounds;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.items.tools.WorkBlade;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.init.ModSounds;
import static nmd.primal.core.api.PrimalAPI.randomCheck;
/**
* Created by mminaie on 7/2/17.
@@ -49,8 +48,8 @@ public class YewStave extends BlockCustomBase {
if(pItem.getItem() instanceof WorkBlade){
if(world.getBlockState(pos.up()).getBlock() instanceof YewStave ) {
//world.playSound(player, player.posX, player.posY, player.posZ, PrimalSounds.TOOL_BLADE_SCRAPE, SoundCategory.PLAYERS, 1.0F, 1F);
world.playSound(null, pos, PrimalSounds.TOOL_BLADE_SCRAPE, SoundCategory.PLAYERS, 1.0F, 1.0F);
if(CommonUtils.randomCheck(3) ) {
world.playSound(null, pos, PrimalAPI.Sounds.SOUND_TOOL_BLADE_SCRAPE, SoundCategory.PLAYERS, 1.0F, 1.0F);
if(randomCheck(3) ) {
PlayerHelper.spawnItemOnGround(world, pos, new ItemStack(ModItems.rawlongbow, 1));
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(pos.up(), Blocks.AIR.getDefaultState(), 2);

View File

@@ -0,0 +1,27 @@
package nmd.primal.forgecraft.blocks.fluids;
import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.Fluid;
import nmd.primal.core.common.fluids.AbstractFluidBlock;
import nmd.primal.forgecraft.ModInfo;
public class BasicFluidBlockKFC extends AbstractFluidBlock {
private boolean isSolidTexture;
private boolean isBurning;
public BasicFluidBlockKFC(Fluid fluid, Material material, boolean isSolidTexture, boolean isBurning)
{
super(fluid, material);
this.isSolidTexture = isSolidTexture;
this.isBurning = isBurning;
}
public BasicFluidBlockKFC(Fluid fluid, Material material)
{
this(fluid, material, false, false);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
}

View File

@@ -0,0 +1,506 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.crafting.handlers.inworld.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.items.SlottedTongs;
import nmd.primal.forgecraft.tiles.TileBloomery;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import static nmd.primal.forgecraft.items.SlottedTongs.ITEM_HANDLER;
/**
* Created by mminaie on 6/11/17.
*/
public class BloomeryBase extends CustomContainerFacing implements ITileEntityProvider {
//public static final PropertyBool COVERED = PropertyBool.create("covered");
private int maxHeat;
public AxisAlignedBB AABB = new AxisAlignedBB(5/32D, 0.0D, 5/32D, 27/32D, 12/16D, 27/32D);
public BloomeryBase(Material material, String registryName, Integer maxHeat) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
setResistance(5.0f);
this.maxHeat=maxHeat;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return AABB;
}
public int getMaxHeat() {
return maxHeat;
}
public void setMaxHeat(int maxHeat) {
this.maxHeat = maxHeat;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBloomery();
}
/*@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if(state.getValue(PrimalAPI.States.ACTIVE) == true) {
FireHelper.makeSmoke(world, pos, 50);
}
}
}*/
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (world.isRemote)
return true;
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile != null) {
ItemStack pItem = player.inventory.getCurrentItem();
ItemStack tileItem = tile.getSlotStack(0);
ItemStack tileItem1 = tile.getSlotStack(1);
if(pItem.isEmpty()) {
if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE)){
Integer bloomeryHeat = tile.getHeat();
String display = "Fuel Remaining: " + tileItem.getCount() + "\n" + "Current Temp: " + bloomeryHeat.toString();
ITextComponent itextcomponent = new TextComponentString(display);
NBTTagCompound tag = tile.getSlotStack(1).getSubCompound("BlockEntityTag");
if(tag != null) {
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
NonNullList<ItemStack> dropList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
ItemStackHelper.loadAllItems(tag, ingList);
ItemStackHelper.loadAllItems(tag, dropList);
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
if (recipe != null) {
if(!recipe.isHidden()) {
if (!recipe.isDisabled()) {
Integer minTemp = recipe.getCookTemp();
Integer cookCounter = tile.getCookCounter();
Integer idealTime = recipe.getCookTime();
Integer remainingTime = idealTime - cookCounter;
String display1 = "Cooking: " + recipe.getDropsCooked().getItem().getItemStackDisplayName(recipe.getDropsCooked());
String display2 = "Target Temp: " + minTemp.toString();
String display3 = "Time Left: " + remainingTime.toString() + "\n";
String display4 = "Finished";
//String display5 = "Current Temp: " + tile.getHeat();
ITextComponent cookingText = new TextComponentString(display1);
ITextComponent targetTempText = new TextComponentString(display2);
ITextComponent timeLeftText = new TextComponentString(display3);
ITextComponent finishedText = new TextComponentString(display4);
//ITextComponent itextcomponent5 = new TextComponentString(display5);
if (tileItem1.getSubCompound("BlockEntityTag").getBoolean("status")) {
player.sendMessage(finishedText);
} else {
player.sendMessage(cookingText);
player.sendMessage(itextcomponent);
player.sendMessage(targetTempText);
player.sendMessage(timeLeftText);
}
}
}
}
return true;
}
else {
String noRecipe = "Fuel Remaining: " + tileItem.getCount() + "\n" + "Current Temp: " + bloomeryHeat.toString() + "\n";
ITextComponent noRecipeText = new TextComponentString(noRecipe);
player.sendMessage(noRecipeText);
}
}
}
}
if(tile.getSlotStack(0) != ItemStack.EMPTY) {
if((FireSource.useSource(world, pos, facing, player, hand, pItem, hitX, hitY, hitZ))) {
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
tile.setHeat(100);
tile.markDirty();
tile.updateBlock();
return true;
}
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(0, pItem)) {
if (!tileItem.isEmpty()){
if(pItem.getItem() == tileItem.getItem()){
if(tileItem.getCount() < 64){
if(tileItem.getCount() + pItem.getCount() <= 64){
tileItem.grow(pItem.getCount());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
if(tileItem.getCount() + pItem.getCount() > 64){
pItem.setCount(64-pItem.getCount());
tileItem.setCount(64);
tile.markDirty();
tile.updateBlock();
return true;
}
}
}
}
if(tileItem.isEmpty()) {
tile.setSlotStack(0, pItem);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
if((!pItem.isEmpty()) && tile.isItemValidForSlot(1, pItem)) {
if (!tileItem1.isEmpty()) {
return false;
}
if(tileItem1.isEmpty()){
ItemStack place_stack = pItem.copy();
//if (tile.putStack(slot, place_stack))
tile.setSlotStack(1, place_stack);
pItem.shrink(1);
return true;
}
}
/***SLOTTED TONGS CODE TO PLACE THE ITEMS***/
if(pItem.getItem() instanceof SlottedTongs) {
IItemHandler inventory = pItem.getCapability(ITEM_HANDLER, null);
ItemStack slotStack = inventory.getStackInSlot(0).copy();
SlottedTongs itemstackItem = (SlottedTongs) pItem.getItem();
//SlottedTongs temp = (SlottedTongs) pItem.getItem();
if (!pItem.isEmpty() && tile.isItemValidForSlot(1, slotStack)) {
if (!tileItem1.isEmpty()) {
return false;
}
if(tileItem1.isEmpty()){
ItemStack place_stack = slotStack.copy();
//if (tile.putStack(slot, place_stack))
tile.setSlotStack(1, inventory.extractItem(0, 1, false));
itemstackItem.markDirty(pItem);
return true;
}
}
}
/***SLOTTED TONGS CODE TO REMOVE THE ITEMS***/
if(pItem.getItem() instanceof SlottedTongs) {
IItemHandler inventory = pItem.getCapability(ITEM_HANDLER, null);
ItemStack slotStack = inventory.getStackInSlot(0).copy();
SlottedTongs itemstackItem = (SlottedTongs) pItem.getItem();
//SlottedTongs temp = (SlottedTongs) pItem.getItem();
if (!pItem.isEmpty() && inventory.getStackInSlot(0).isEmpty()) {
if (tileItem1.isEmpty()) {
return false;
}
if(!tileItem1.isEmpty()){
ItemStack place_stack = tileItem1.copy();
if(inventory.getStackInSlot(0).isEmpty()){
inventory.insertItem(0, place_stack, false);
tile.setSlotStack(1, ItemStack.EMPTY);
itemstackItem.markDirty(pItem);
return true;
}
}
}
}
if (!tile.getSlotStack(0).isEmpty()) {
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
ItemStack returnStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.clearSlot(0);
return true;
}
}
}
return false;
}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
int lightState =0;
if(state.getValue(PrimalAPI.States.ACTIVE) == true){
lightState = 10;
}
return lightState;
}
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return 0;
}
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return true;
}
@Override
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
if(!world.isRemote){
if(world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE)==true){
return true;
}
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
if(ent instanceof EntityPlayer){
if(state.getValue(PrimalAPI.States.ACTIVE) == true){
ent.setFire(1);
}
}
}
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 7;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing;
Boolean active;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.EAST;
active = false;
break;
case 1:
enumfacing = EnumFacing.WEST;
active = false;
break;
case 2:
enumfacing = EnumFacing.SOUTH;
active = false;
break;
case 3:
enumfacing = EnumFacing.NORTH;
active = false;
break;
case 4:
enumfacing = EnumFacing.EAST;
active = true;
break;
case 5:
enumfacing = EnumFacing.WEST;
active = true;
break;
case 6:
enumfacing = EnumFacing.SOUTH;
active = true;
break;
case 7:
enumfacing = EnumFacing.NORTH;
active = true;
break;
default:
enumfacing = EnumFacing.NORTH;
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalAPI.States.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(PrimalAPI.States.ACTIVE) == true)
{
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.2D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
if (rand.nextDouble() < 0.1D)
{
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
}
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
}
}
}

View File

@@ -0,0 +1,243 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.tiles.TileBreaker;
import nmd.primal.forgecraft.util.BreakerHandler;
/**
* Created by mminaie on 4/9/17.
*/
public class Breaker extends CustomContainerFacing implements BreakerHandler {
public AxisAlignedBB AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 6/16D, 1.0D);
public Breaker(Material material, String registryName, Float hardness) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, false));
setHardness(hardness);
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return AABB;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if(!world.isRemote){
if (hand.equals(player.getActiveHand())) {
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
if (state.getValue(PrimalAPI.States.ACTIVE) && player.isSneaking() && pItem.isEmpty()) {
doBreaking(world, state, pos, tile);
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, false));
tile.setCharge(0);
return true;
}
if (!state.getValue(PrimalAPI.States.ACTIVE) && player.isSneaking() && pItem.isEmpty() && tile.getCharge() == 0) {
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(0));
tile.setSlotStack(0, ItemStack.EMPTY);
return true;
}
if (!player.isSneaking() && pItem.isEmpty()) {
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
return true;
}
if (state.getValue(PrimalAPI.States.ACTIVE)) {
if (tile.getCharge() < 181) {
tile.setCharge(tile.getCharge() + 2.0f);
tile.updateBlock();
//System.out.println(tile.charge);
return true;
}
}
}
if (pItem.getItem() instanceof Gallagher) {
tile.setSlotStack(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
}
return false;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileBreaker tile = (TileBreaker) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBreaker();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, false), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if(state.getValue(PrimalAPI.States.ACTIVE ) == false) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 2;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 3;
return i;
}
}
if(state.getValue(PrimalAPI.States.ACTIVE)) {
if (state.getValue(FACING) == EnumFacing.EAST) {
i = 4;
return i;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
i = 5;
return i;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
i = 6;
return i;
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
i = 7;
return i;
}
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalAPI.States.ACTIVE, false);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalAPI.States.ACTIVE, false);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalAPI.States.ACTIVE, false);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, false);
}
if (meta == 4){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalAPI.States.ACTIVE, true);
}
if (meta == 5) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalAPI.States.ACTIVE, true);
}
if (meta == 6) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalAPI.States.ACTIVE, true);
}
if (meta == 7) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, true);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {PrimalAPI.States.ACTIVE, FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,267 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.crafting.CastingCrafting;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.SlottedTongs;
import nmd.primal.forgecraft.tiles.TileCastingForm;
import nmd.primal.forgecraft.util.CastingFormHandler;
import nmd.primal.forgecraft.util.ToolNBT;
import static nmd.primal.forgecraft.items.SlottedTongs.ITEM_HANDLER;
/**
* Created by mminaie on 6/19/17.
*/
public class CastingForm extends CustomContainerFacing implements CastingFormHandler, ToolNBT {
protected static AxisAlignedBB bound = new AxisAlignedBB(0/16D, 0.0D, 0/16D, 16/16D, 3/16D, 16/16D);
public CastingForm(Material material, String registryName) {
super(material, registryName);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setTickRandomly(true);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
if (!world.isRemote) {
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
ItemStack pItem = player.inventory.getCurrentItem();
if(pItem.getItem() != ModItems.slottedtongs) {
doInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
}
if(pItem.getItem().equals(ModItems.slottedtongs)){
IItemHandler inventory = pItem.getCapability(ITEM_HANDLER, null);
SlottedTongs itemstackItem = (SlottedTongs) pItem.getItem();
ItemStack tongsStack = inventory.getStackInSlot(0).copy();
//SlottedTongs tongs = (SlottedTongs) pItem.getItem();
if(tongsStack.getItem().equals(Item.getItemFromBlock(ModBlocks.nbtCrucible))) {
NBTTagCompound tag = tongsStack.getTagCompound().copy();
if(tag != null){
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
NonNullList<ItemStack> ingListEmpty = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
ItemStackHelper.loadAllItems(tag.getCompoundTag("BlockEntityTag"), ingList);
CrucibleCrafting crucibleRecipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
if(crucibleRecipe != null){
if(tag.getCompoundTag("BlockEntityTag").getBoolean("status") && tag.getCompoundTag("BlockEntityTag").getInteger("hot") == 15){
Item[] tempArray = new Item[25];
for(int i=0; i<25; i++){
tempArray[i] = tile.getSlotStack(i).getItem();
}
CastingCrafting casting = CastingCrafting.getRecipe(crucibleRecipe.getDropsCooked(), tempArray);
if(casting != null){
NBTTagCompound tagOutput = casting.getOutput().getOrCreateSubCompound("tags");
NBTTagCompound crucibleOutput = crucibleRecipe.getDropsCooked().getTagCompound();
if(tagOutput != null) {
ItemStack dropStack = casting.getOutput();
dropStack.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
dropStack.getTagCompound().setTag("tags", tags);
setHot(dropStack, false);
if (crucibleOutput.getString("upgrades") == "emerald") {
setEmerald(dropStack, true);
setModifiers(dropStack, 1);
} else {
setEmerald(dropStack, false);
}
if (crucibleOutput.getString("upgrades") == "diamond") {
setDiamondLevel(dropStack, 1);
setModifiers(dropStack, 1);
} else {
setDiamondLevel(dropStack, 0);
}
if (crucibleOutput.getString("upgrades") == "redstone") {
setRedstoneLevel(dropStack, 1);
setModifiers(dropStack, 1);
} else {
setRedstoneLevel(dropStack, 0);
}
if (crucibleOutput.getString("upgrades") == "lapis") {
setLapisLevel(dropStack, 1);
setModifiers(dropStack, 1);
} else {
setLapisLevel(dropStack, 0);
}
CommonUtils.spawnItemEntityFromWorld(world, pos, dropStack);
tag.getCompoundTag("BlockEntityTag").setBoolean("status", false);
tag.getCompoundTag("BlockEntityTag").setInteger("hot", 0);
ItemStackHelper.saveAllItems(tag.getCompoundTag("BlockEntityTag"), ingListEmpty);
inventory.getStackInSlot(0).setTagCompound(tag);
itemstackItem.markDirty(pItem);
return true;
}
}
}
}
}
}
}
return false;
}
return false;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileCastingForm tile = (TileCastingForm) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileCastingForm();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return bound;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -0,0 +1,446 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.crafting.handlers.inworld.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.tiles.TileForge;
import nmd.primal.forgecraft.util.ForgeHandler;
import nmd.primal.forgecraft.util.SlotHelper;
import javax.annotation.Nullable;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
//import nmd.primal.core.api.PrimalBlocks;
/**
* Created by kitsu on 11/26/2016.
*/
public class Forge extends CustomContainerFacing implements ITileEntityProvider, ForgeHandler, SlotHelper {
private int maxHeat;
//public static final PropertyBool PrimalAPI.States.ACTIVE = PropertyBool.create("PrimalAPI.States.ACTIVE");
protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
protected static final AxisAlignedBB boundBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
public Forge(Material material, String name, Integer maxHeat) {
super(material, name);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
setResistance(5.0f);
this.maxHeat=maxHeat;
}
public int getMaxHeat() {
return maxHeat;
}
public void setMaxHeat(int maxHeat) {
this.maxHeat = maxHeat;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileForge();
}
@Nullable
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
{
return collideBox;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return boundBox;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (!world.isRemote) {
TileForge tile = (TileForge) world.getTileEntity(pos);
if (tile != null) {
if (hand.equals(player.getActiveHand())) {
ItemStack pItem = player.inventory.getCurrentItem();
ItemStack fuelItem = tile.getSlotStack(0);
/***********************
FUEL SLOT REMOVAL CODE
***********************/
if (!tile.getSlotStack(0).isEmpty()) {
if (player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
ItemStack returnStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.clearSlot(0);
return true;
}
}
/***********************
TEMP PRINT OUT CODE
***********************/
if (pItem.isEmpty()) {
if (!player.isSneaking()) {
if (world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE) == true) {
Integer tempInt = tile.getHeat();
String tempString = tempInt.toString();
ITextComponent itextcomponent = new TextComponentString(tempString);
player.sendStatusMessage(itextcomponent, true);
//System.out.println(pos);
return true;
}
}
}
/***********************
Forge Activation Code
***********************/
if ((FireSource.useSource(world, pos, facing, player, hand, pItem, hitX, hitY, hitZ))) {
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
tile.setHeat(100);
tile.markDirty();
tile.updateBlock();
return true;
}
/***********************
FUEL SLOT MANAGEMENT Code
***********************/
/***********************
FUEL SLOT IS EMPTYT
***********************/
if (tile.getSlotStack(0).isEmpty()) {
if(tile.isItemValidForSlot(0, player.inventory.getCurrentItem())) {
tile.setSlotStack(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
}
/***********************
FUEL SLOT HAS STUFF
***********************/
if(ItemStack.areItemsEqual(player.inventory.getCurrentItem(), tile.getSlotStack(0)) && !tile.getSlotStack(0).isEmpty()) {
if (tile.getSlotStack(0).getCount() < 64) {
if (tile.getSlotStack(0).getCount() + player.inventory.getCurrentItem().getCount() <= 64) {
tile.getSlotStack(0).grow(pItem.getCount());
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
if (tile.getSlotStack(0).getCount() + player.inventory.getCurrentItem().getCount() > 64) {
int count = 64 - tile.getSlotStack(0).getCount();
tile.getSlotStack(0).grow(count);
pItem.shrink(count);
tile.markDirty();
tile.updateBlock();
return true;
}
}
}
if (facing == EnumFacing.UP) {
doForgeInventoryManager(pItem, world, tile, pos, hitX, hitY, hitZ, state, player);
return true;
}
}
}
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
//if (!world.isRemote){
if(ent instanceof EntityPlayer){
if(state.getValue(PrimalAPI.States.ACTIVE) == true){
ent.setFire(1);
}
}
//}
}
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
}
@Override
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{
if(state.getValue(PrimalAPI.States.ACTIVE) == true){
return 5;
}
return 0;
}
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return 0;
}
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face)
{
return true;
}
@Override
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
if (side == EnumFacing.UP)
{
if(!world.isRemote){
TileForge tile = (TileForge) world.getTileEntity(pos);
if(tile.getSlotStack(0) != ItemStack.EMPTY){
if(world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE)==true){
return true;
}
}
}
}
return false;
}
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileForge tile = (TileForge) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
/*@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
return state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false));
}*/
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
//System.out.println(placer.getHorizontalFacing());
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 7;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing;
Boolean active;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.EAST;
active = false;
break;
case 1:
enumfacing = EnumFacing.WEST;
active = false;
break;
case 2:
enumfacing = EnumFacing.SOUTH;
active = false;
break;
case 3:
enumfacing = EnumFacing.NORTH;
active = false;
break;
case 4:
enumfacing = EnumFacing.EAST;
active = true;
break;
case 5:
enumfacing = EnumFacing.WEST;
active = true;
break;
case 6:
enumfacing = EnumFacing.SOUTH;
active = true;
break;
case 7:
enumfacing = EnumFacing.NORTH;
active = true;
break;
default:
enumfacing = EnumFacing.NORTH;
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalAPI.States.ACTIVE});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random)
{
this.updateTick(world, pos, state, random);
if(!world.isRemote){
if(state.getValue(PrimalAPI.States.ACTIVE) == true) {
makeSmoke(world, pos);
}
}
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(PrimalAPI.States.ACTIVE) == true)
{
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.96D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = ThreadLocalRandom.current().nextDouble(0.075, 0.35);
double ySpeed = ThreadLocalRandom.current().nextDouble(0.0, 0.075);
if (rand.nextDouble() < 0.1D)
{
world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
}
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, ySpeed, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, ySpeed, 0.0D, new int[0]);
}
}
}
}

View File

@@ -1,4 +1,4 @@
package nmd.primal.forgecraft.blocks;
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
@@ -15,7 +15,9 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.init.ModSounds;
import nmd.primal.forgecraft.tiles.TileBloomery;
import nmd.primal.forgecraft.tiles.TileForge;
@@ -24,14 +26,12 @@ import nmd.primal.forgecraft.tiles.TilePistonBellows;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import static nmd.primal.core.api.PrimalStates.ACTIVE;
/**
* Created by mminaie on 1/1/17.
*/
public class PistonBellows extends CustomContainerFacing {
//public static final PropertyBool ACTIVE = PropertyBool.create("active");
//public static final PropertyBool PrimalAPI.States.ACTIVE = PropertyBool.create("active");
//protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D);
protected static final AxisAlignedBB boundBoxNorth = new AxisAlignedBB(0.1875D, 0.0D, 0.0D, 1.0D, 12 / 16D, 1.0D);
protected static final AxisAlignedBB boundBoxSouth = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.8125D, 12 / 16D, 1.0D);
@@ -41,7 +41,7 @@ public class PistonBellows extends CustomContainerFacing {
public PistonBellows(Material material, String registryName) {
super(material, registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, Boolean.valueOf(false)));
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f);
}
@@ -57,7 +57,7 @@ public class PistonBellows extends CustomContainerFacing {
TilePistonBellows tile = (TilePistonBellows) worldIn.getTileEntity(pos);
if (tile != null) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(ACTIVE, Boolean.valueOf(false)), 2);
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
}
}
@@ -66,8 +66,8 @@ public class PistonBellows extends CustomContainerFacing {
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if(!world.isRemote){
//System.out.println(state.getValue(PistonBellows.FACING));
if(state.getValue(ACTIVE) == false) {
world.setBlockState(pos, state.withProperty(ACTIVE, true), 2);
if(state.getValue(PrimalAPI.States.ACTIVE) == false) {
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
//world.playSound(pos, ForgecraftSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f);
//world.playSound((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f, true);
world.playSound(null, pos, ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 0.25F, 0.8F);
@@ -78,7 +78,7 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
@@ -90,7 +90,7 @@ public class PistonBellows extends CustomContainerFacing {
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.EAST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -106,7 +106,7 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
@@ -118,7 +118,7 @@ public class PistonBellows extends CustomContainerFacing {
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.WEST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -134,7 +134,7 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
@@ -146,7 +146,7 @@ public class PistonBellows extends CustomContainerFacing {
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.SOUTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -162,7 +162,7 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 50);
@@ -174,7 +174,7 @@ public class PistonBellows extends CustomContainerFacing {
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true)
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(FACING) == EnumFacing.NORTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -244,35 +244,35 @@ public class PistonBellows extends CustomContainerFacing {
public int getMetaFromState(IBlockState state) {
int i = 0;
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(ACTIVE) == false){
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 0;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(ACTIVE) == false){
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 1;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(ACTIVE) == false){
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 2;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(ACTIVE) == false){
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == false){
i = 3;
return i;
}
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(ACTIVE) == true){
if( (state.getValue(FACING) == EnumFacing.EAST) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 4;
return i;
}
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(ACTIVE) == true){
if( (state.getValue(FACING) == EnumFacing.WEST) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 5;
return i;
}
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(ACTIVE) == true){
if( (state.getValue(FACING) == EnumFacing.SOUTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 6;
return i;
}
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(ACTIVE) == true){
if( (state.getValue(FACING) == EnumFacing.NORTH) && state.getValue(PrimalAPI.States.ACTIVE) == true){
i = 7;
return i;
}
@@ -326,12 +326,12 @@ public class PistonBellows extends CustomContainerFacing {
active = false;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(ACTIVE, Boolean.valueOf(active));
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(active));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, ACTIVE});
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalAPI.States.ACTIVE});
}
//return new ExtendedBlockState(this, new IProperty[] { BotaniaStateProps.CARDINALS, Properties.StaticProperty }, new IUnlistedProperty[] { Properties.AnimationProperty });
@@ -363,18 +363,18 @@ public class PistonBellows extends CustomContainerFacing {
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{
if(state.getValue(ACTIVE) == Boolean.TRUE) {
if(state.getValue(PrimalAPI.States.ACTIVE) == Boolean.TRUE) {
if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) {
BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) {
makeEmbers(world, tempPos, world.rand);
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.EAST)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.EAST)) {
makeEmbers(world, tempPos, world.rand);
}
}
@@ -385,13 +385,13 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) {
makeEmbers(world, tempPos, world.rand);
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.WEST)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.WEST)) {
makeEmbers(world, tempPos, world.rand);
}
}
@@ -402,13 +402,13 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) {
makeEmbers(world, tempPos, world.rand);
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.SOUTH)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.SOUTH)) {
makeEmbers(world, tempPos, world.rand);
}
}
@@ -419,13 +419,13 @@ public class PistonBellows extends CustomContainerFacing {
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1);
if (world.getBlockState(tempPos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) {
makeEmbers(world, tempPos, world.rand);
}
}
if (world.getBlockState(tempPos).getBlock() instanceof BloomeryBase) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.NORTH)) {
if ((world.getBlockState(tempPos).getValue(PrimalAPI.States.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(BloomeryBase.FACING) == EnumFacing.NORTH)) {
makeEmbers(world, tempPos, world.rand);
}
}
@@ -459,24 +459,4 @@ public class PistonBellows extends CustomContainerFacing {
}
}
/*
if(rand.nextInt(4) == 1){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 2){
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 3){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
if(rand.nextInt(4) == 4){
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
}
*/
}

View File

@@ -0,0 +1,185 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.blocks.CustomContainerFacingActive;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.parts.WeaponPart;
import nmd.primal.forgecraft.items.weapons.CustomSword;
import nmd.primal.forgecraft.items.weapons.SlayerSword;
import nmd.primal.forgecraft.tiles.TileSharpBench;
import nmd.primal.forgecraft.util.WeaponNBT;
import javax.annotation.Nullable;
public class SharpBench extends CustomContainerFacingActive {
protected static final AxisAlignedBB boundBoxNorth = new AxisAlignedBB(0.28125D, 0.0D, 1/16D, 0.71875D, 11 / 16D, 11 / 16D);
protected static final AxisAlignedBB boundBoxSouth = new AxisAlignedBB(0.28125D, 0.0D, 5/16D, 0.71875D, 11 / 16D, 15 / 16D);
protected static final AxisAlignedBB boundBoxEast = new AxisAlignedBB(5/16D, 0.0D, 0.28125D, 15/16D, 11 / 16D, 0.71875D);
protected static final AxisAlignedBB boundBoxWest = new AxisAlignedBB(1/16D, 0.0D, 0.28125D, 11/16D, 11 / 16D, 0.71875D);
public SharpBench(Material material, String registryName) {
super(material, registryName);
this.setHardness(4.0f);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
if(player.getActiveHand().equals(EnumHand.MAIN_HAND)) {
TileSharpBench tile = (TileSharpBench) world.getTileEntity(pos);
if(player.getHeldItemMainhand().isEmpty()) {
if(tile.getSlotStack(0).getItem().equals(ModItems.grindingwheel)) {
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, true), 2);
if (tile.getCharge() < 15) {
tile.setCharge(tile.getCharge() + 1);
return true;
}
}
}
if(player.getHeldItemMainhand().getItem().equals(ModItems.grindingwheel)) {
tile.setSlotStack(0, player.getHeldItemMainhand().copy());
player.getHeldItemMainhand().shrink(1);
return true;
}
if(player.getHeldItemMainhand().isEmpty()) {
if(player.isSneaking()){
if(tile.getSlotStack(0).getItem().equals(ModItems.grindingwheel)){
PlayerHelper.spawnItemOnGround(world, pos, tile.getSlotStack(0));
tile.clearSlot(0);
world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, false), 2);
}
}
}
}
}
return false;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{
if(ent instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer) ent;
TileSharpBench tile = (TileSharpBench) world.getTileEntity(pos);
if(state.getValue(PrimalAPI.States.ACTIVE) && tile.getSlotStack(0).getItem().equals(ModItems.grindingwheel)){
ItemStack playerStack = player.inventory.getCurrentItem();
if(
playerStack.getItem() instanceof CustomSword ||
playerStack.getItem() instanceof ToolPart
){
if(playerStack.getItemDamage() > 0){
if (!world.isRemote) {
if (PrimalAPI.getRandom().nextInt(1, 3) == 1) {
playerStack.setItemDamage(playerStack.getItemDamage() - 1);
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage() + 1);
if(tile.getSlotStack(0).getItemDamage()>= tile.getSlotStack(0).getMaxDamage()){
tile.clearSlot(0);
}
if(playerStack.getItem() instanceof CustomSword) {
WeaponNBT.removeAndSetEnchantsForStack(playerStack);
}
}
}
if (world.isRemote) {
makeSparks(world, pos, state);
}
}
}
}
}
}
@Nullable
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileSharpBench();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
state = state.getActualState(source, pos);
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
switch (enumfacing)
{
case EAST:
default:
return boundBoxEast;
case SOUTH:
return boundBoxSouth;
case WEST:
return boundBoxWest;
case NORTH:
return boundBoxNorth;
}
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileSharpBench tile = (TileSharpBench) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
private void makeSparks(World world, BlockPos pos, IBlockState state){
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.75D;
double d2 = (double)pos.getZ() + 0.5D;
double d3 = 0.52D;
//double d4 = PrimalAPI.getRandom().nextDouble(0.066, 0.33);
double ySpeed = PrimalAPI.getRandom().nextDouble(0.05, 0.20);
double zSpeed = PrimalAPI.getRandom().nextDouble(0.05, 0.20);
if(state.getValue(FACING) == EnumFacing.NORTH) {
world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, d0, d1, d2, 0.0D, ySpeed, -zSpeed, new int[0]);
}
if(state.getValue(FACING) == EnumFacing.SOUTH) {
world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, d0, d1, d2, 0.0D, ySpeed, zSpeed, new int[0]);
}
if(state.getValue(FACING) == EnumFacing.EAST) {
world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, d0, d1, d2, zSpeed, ySpeed, 0.0D, new int[0]);
}
if(state.getValue(FACING) == EnumFacing.WEST) {
world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, d0, d1, d2, -zSpeed, ySpeed, 0.0D, new int[0]);
}
}
}

View File

@@ -0,0 +1,304 @@
package nmd.primal.forgecraft.blocks.machine;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.core.common.items.tools.WorkBlade;
import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import nmd.primal.forgecraft.tiles.TileWorkbench;
import javax.annotation.Nullable;
public class Workbench extends CustomContainerFacing {
protected static final AxisAlignedBB boundBoxNorth = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 10 / 16D, 8/16D);
protected static final AxisAlignedBB boundBoxSouth = new AxisAlignedBB(0.0D, 0.0D, 8/16D, 1.0D, 10 / 16D, 1.0D);
protected static final AxisAlignedBB boundBoxEast = new AxisAlignedBB(8/16D, 0.0D, 0.0D, 1.0D, 10 / 16D, 1.0D);
protected static final AxisAlignedBB boundBoxWest = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 8/16D, 10 / 16D, 1.0D);
public Workbench(Material material, String registryName) {
super(material, registryName);
this.setHardness(4.0f);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
if(player.getActiveHand().equals(EnumHand.MAIN_HAND)) {
TileWorkbench tile = (TileWorkbench) world.getTileEntity(pos);
ItemStack playerStack = player.inventory.getCurrentItem();
if (tile != null) {
ItemStack slot0 = tile.getSlotStack(0);
ItemStack slot1 = tile.getSlotStack(1);
ItemStack slot2 = tile.getSlotStack(2);
ItemStack slot3 = tile.getSlotStack(3);
ItemStack slot4 = tile.getSlotStack(4);
ItemStack slot5 = tile.getSlotStack(5);
ItemStack slot6 = tile.getSlotStack(6);
if (hitY > 0.5D) {
if (!player.isSneaking()) {
if (tile.isItemValidForSlot(6, playerStack)) {
if (slot6.isEmpty()) {
if (slot2.isEmpty() && slot3.isEmpty() && slot4.isEmpty() && slot5.isEmpty()) {
ItemStack tempStack = player.inventory.getCurrentItem().copy();
tempStack.setCount(1);
tile.setSlotStack(6, tempStack);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
}
if(! (playerStack.getItem() instanceof Gallagher)) {
if (slot4.isEmpty() && slot3.isEmpty() && slot2.isEmpty()) {
if (tile.isItemValidForSlot(5, playerStack)) {
if (slot5.isEmpty()) {
tile.setSlotStack(5, playerStack.splitStack(1));
//player.inventory.getCurrentItem().shrink(1);
return true;
}
}
}
if(slot5.isEmpty()) {
if (tile.isItemValidForSlot(4, playerStack)) {
if (slot4.isEmpty()) {
tile.setSlotStack(4, playerStack.splitStack(1));
//player.inventory.getCurrentItem().shrink(1);
return true;
}
}
if (tile.isItemValidForSlot(3, playerStack)) {
if (slot3.isEmpty()) {
tile.setSlotStack(3, playerStack.splitStack(1));
//player.inventory.getCurrentItem().shrink(1);
return true;
}
}
if (tile.isItemValidForSlot(2, playerStack)) {
if (slot2.isEmpty()) {
tile.setSlotStack(2, playerStack.splitStack(1));
//player.inventory.getCurrentItem().shrink(1);
return true;
}
}
}
}
if(player.inventory.getCurrentItem().getItem() instanceof Gallagher || player.inventory.getCurrentItem().getItem() instanceof WorkBlade) {
if (slot5.isEmpty()) {
WorkbenchCrafting recipe = WorkbenchCrafting.getRecipe(slot2, slot3, slot4, slot5, player.inventory.getCurrentItem());
if (recipe != null) {
ItemStack drops = recipe.getOutput();
if (slot3.hasTagCompound()) {
drops.setTagCompound(slot3.getTagCompound());
}
PlayerHelper.spawnItemOnPlayer(world, player, drops);
tile.clearSlot(2);
tile.clearSlot(3);
tile.clearSlot(4);
tile.clearSlot(5);
playerStack.damageItem(1, player);
return true;
}
}
if (slot2.isEmpty() && slot3.isEmpty() && slot4.isEmpty() && !slot5.isEmpty()) {
WorkbenchCrafting recipe = WorkbenchCrafting.getRecipe(slot2, slot3, slot4, slot5, player.inventory.getCurrentItem());
if (recipe != null) {
ItemStack drops = recipe.getOutput();
if (slot5.hasTagCompound()) {
drops.setTagCompound(slot5.getTagCompound());
drops.setItemDamage(slot5.getItemDamage());
}
PlayerHelper.spawnItemOnPlayer(world, player, drops);
tile.clearSlot(2);
tile.clearSlot(3);
tile.clearSlot(4);
tile.clearSlot(5);
playerStack.damageItem(1, player);
return true;
}
}
}
}
if(player.isSneaking() && player.inventory.getCurrentItem().isEmpty()){
if(!slot6.isEmpty()){
PlayerHelper.spawnItemOnGround(world, pos, tile.getSlotStack(6));
tile.clearSlot(6);
return true;
}
if(!slot2.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(2));
tile.clearSlot(2);
return true;
}
if(!slot3.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(3));
tile.clearSlot(3);
return true;
}
if(!slot4.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(4));
tile.clearSlot(4);
return true;
}
if(!slot5.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(5));
tile.clearSlot(5);
return true;
}
}
}
if (hitY < 0.5D) {
if (state.getValue(FACING) == EnumFacing.NORTH) {
if (hitX < 0.5) {
return sideInventoryManager(world, player, tile, slot0, 0);
}
if (hitX > 0.5) {
return sideInventoryManager(world, player, tile, slot1, 1);
}
return true;
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
if (hitX > 0.5) {
return sideInventoryManager(world, player, tile, slot0, 0);
}
if (hitX < 0.5) {
return sideInventoryManager(world, player, tile, slot1, 1);
}
return true;
}
if (state.getValue(FACING) == EnumFacing.EAST) {
if (hitZ < 0.5) {
return sideInventoryManager(world, player, tile, slot0, 0);
}
if (hitZ > 0.5) {
return sideInventoryManager(world, player, tile, slot1, 1);
}
return true;
}
if (state.getValue(FACING) == EnumFacing.WEST) {
if (hitZ > 0.5) {
return sideInventoryManager(world, player, tile, slot0, 0);
}
if (hitZ < 0.5) {
return sideInventoryManager(world, player, tile, slot1, 1);
}
return true;
}
}
}
}
}
return false;
}
private boolean sideInventoryManager(World world, EntityPlayer player, TileWorkbench tile, ItemStack slot, int index)
{
if(!player.isSneaking()) {
ItemStack stack = player.inventory.getCurrentItem();
if (!(stack.isEmpty()) ) {
if( stack.isItemEqual(slot) ) {
if (slot.getCount() < 64) {
if (stack.getCount() + slot.getCount() > 64) {
stack.shrink(64 - slot.getCount());
slot.setCount(64);
return true;
}
if (stack.getCount() + slot.getCount() < 64) {
slot.grow(stack.getCount());
stack.shrink(stack.getCount());
return true;
}
}
}
if (slot.isEmpty()) {
tile.setSlotStack(index, stack);
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
return true;
}
}
}
if(player.isSneaking()){
if(!slot.isEmpty()){
PlayerHelper.spawnItemOnPlayer(world, player, tile.getSlotStack(index));
tile.clearSlot(index);
return true;
}
}
return false;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
state = state.getActualState(source, pos);
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
switch (enumfacing)
{
case EAST:
default:
return boundBoxEast;
case SOUTH:
return boundBoxSouth;
case WEST:
return boundBoxWest;
case NORTH:
return boundBoxNorth;
}
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileWorkbench tile = (TileWorkbench) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Nullable
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileWorkbench();
}
}

View File

@@ -0,0 +1,287 @@
package nmd.primal.forgecraft.capabilities;
/*
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import javax.annotation.Nullable;
import java.util.LinkedHashMap;
public class SlottedTongsHandler implements ICapabilitySerializable<NBTTagCompound>, IItemHandler {
@CapabilityInject(SlottedTongsHandler.class)
public static Capability<SlottedTongsHandler> CAP;
private IChangeCallback callback;
public final Map<ItemEntry, ItemEntryWithCount> items;
private ItemEntryWithCount[] itemsArray;
private int totalItemCount;
private NBTTagCompound cachedNetData;
public static AntibarrelData get(ItemStack stack)
{
AntibarrelData data = stack.getCapability(CAP, null);
if (BlockUtils.hasData(stack))
{
data.deserializeNBT(BlockUtils.getData(stack));
BlockUtils.removeData(stack);
}
return data;
}
public SlottedTongsHandler(@Nullable IChangeCallback c)
{
callback = c;
items = new LinkedHashMap<>();
}
public void clear()
{
items.clear();
itemsArray = null;
totalItemCount = -1;
cachedNetData = null;
}
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing)
{
return capability == CAP || capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;
}
@Override
@Nullable
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
{
return capability == CAP || capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ? (T) this : null;
}
@Override
public NBTTagCompound serializeNBT()
{
NBTTagCompound nbt = new NBTTagCompound();
NBTTagList list = new NBTTagList();
for (ItemEntryWithCount entry : items.values())
{
if (!entry.isEmpty())
{
list.appendTag(entry.serializeNBT());
}
}
if (!list.isEmpty())
{
nbt.setTag("Inv", list);
}
return nbt;
}
public NBTTagCompound serializeNBTForNet()
{
if (cachedNetData != null)
{
return cachedNetData;
}
cachedNetData = new NBTTagCompound();
NBTTagList list = new NBTTagList();
for (ItemEntryWithCount entry : items.values())
{
if (!entry.isEmpty())
{
list.appendTag(entry.serializeNBT());
}
}
if (!list.isEmpty())
{
cachedNetData.setTag("Inv", list);
}
return cachedNetData;
}
@Override
public void deserializeNBT(NBTTagCompound nbt)
{
clear();
NBTTagList list = nbt.getTagList("Inv", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
ItemEntryWithCount entryc = new ItemEntryWithCount(nbt1);
if (!entryc.isEmpty())
{
items.put(entryc.entry, entryc);
}
}
}
public void copyFrom(AntibarrelData data)
{
clear();
totalItemCount = data.totalItemCount;
for (ItemEntryWithCount entry : data.items.values())
{
items.put(entry.entry, new ItemEntryWithCount(entry.entry, entry.count));
}
}
@Override
public int getSlots()
{
return items.size() + 1;
}
@Override
public ItemStack getStackInSlot(int slot)
{
return slot <= 0 || slot > items.size() ? ItemStack.EMPTY : getItemArray()[slot - 1].getStack(false);
}
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate)
{
if (slot < 0 || slot > items.size() || stack.isEmpty() || stack.isStackable())
{
return stack;
}
ItemEntry entry = ItemEntry.get(stack);
ItemEntryWithCount entryc;
int added = 0;
if (slot == 0)
{
entryc = items.get(entry);
if (entryc != null)
{
added = Math.min(YabbaConfig.general.antibarrel_items_per_type - entryc.count, stack.getCount());
}
else if (items.size() < YabbaConfig.general.antibarrel_capacity)
{
entryc = new ItemEntryWithCount(entry, 0);
items.put(entry, entryc);
itemsArray = null;
totalItemCount = -1;
cachedNetData = null;
added = Math.min(YabbaConfig.general.antibarrel_items_per_type, stack.getCount());
}
}
else
{
entryc = getItemArray()[slot - 1];
if (entryc.entry.equalsEntry(entry))
{
added = Math.min(YabbaConfig.general.antibarrel_items_per_type - entryc.count, stack.getCount());
}
}
if (entryc != null && added > 0)
{
if (!simulate)
{
entryc.count += added;
totalItemCount = -1;
cachedNetData = null;
if (callback != null)
{
callback.onContentsChanged(false);
}
}
return added == stack.getCount() ? ItemStack.EMPTY : ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - added);
}
return stack;
}
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate)
{
if (slot <= 0 || slot > items.size() || amount < 1)
{
return ItemStack.EMPTY;
}
ItemEntryWithCount entryc = getItemArray()[slot - 1];
if (entryc.isEmpty())
{
return ItemStack.EMPTY;
}
int extracted = Math.min(amount, entryc.count);
ItemStack is = entryc.entry.getStack(extracted, true);
if (!simulate)
{
entryc.count -= extracted;
totalItemCount = -1;
cachedNetData = null;
if (callback != null)
{
callback.onContentsChanged(false);
}
}
return is;
}
private ItemEntryWithCount[] getItemArray()
{
if (itemsArray == null)
{
itemsArray = items.values().toArray(new ItemEntryWithCount[0]);
}
return itemsArray;
}
@Override
public int getSlotLimit(int slot)
{
return YabbaConfig.general.antibarrel_items_per_type;
}
public int getTotalItemCount()
{
if (totalItemCount >= 0)
{
return totalItemCount;
}
totalItemCount = 0;
for (ItemEntryWithCount entry : items.values())
{
totalItemCount += entry.count;
}
return totalItemCount;
}
}
*/

View File

@@ -0,0 +1,61 @@
package nmd.primal.forgecraft.commands;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.event.ClickEvent;
/**
* Created by mminaie on 11/5/17.
*/
public class CommandShowWiki extends CommandBase {
/**
* Check if the given ICommandSender has permission to execute this command
*/
public boolean checkPermission(MinecraftServer server, ICommandSender sender)
{
return server.isSinglePlayer() || super.checkPermission(server, sender);
}
/**
* Gets the name of the command
*/
public String getName()
{
return "ForgeCraftWiki";
}
/**
* Return the required permission level for this command.
*/
public int getRequiredPermissionLevel()
{
return 0;
}
/**
* Gets the usage string for the command.
*/
public String getUsage(ICommandSender sender)
{
return "OpenUrl";
}
/**
* Callback for when the command is executed
*/
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
String str = "https://sites.google.com/view/forgecraft/home/wiki";
ClickEvent event = new ClickEvent(ClickEvent.Action.OPEN_URL, str);
ITextComponent link = new TextComponentString("Wiki").setStyle(new Style().setClickEvent(event).setColor(TextFormatting.BLUE));
sender.sendMessage(link);
}
}

View File

@@ -1,15 +0,0 @@
package nmd.primal.forgecraft.compat;
import mezz.jei.api.BlankModPlugin;
import mezz.jei.api.IModRegistry;
/**
* Created by mminaie on 6/1/17.
*/
public class JEI extends BlankModPlugin
{
@Override
public void register(IModRegistry registry) {
}
}

View File

@@ -1,32 +0,0 @@
package nmd.primal.forgecraft.compat;
import net.minecraftforge.oredict.OreDictionary;
import nmd.primal.forgecraft.init.ModBlocks;
/**
* Created by mminaie on 2/7/17.
*/
public class ModDictionary {/*******************************************************************************
* Register Only Vanilla OreDictionary Entries Here
* Mod Items/Blocks have their names added through the respective
* registration methods as a list of comma delineated strings.
*
* EXAMPLE:
* LEATHER_CORDAGE = registerItem(new PrimalItem("leather_cordage"), "cordageGeneral, cordageLeather");
*
*/
public static void registerDictionaryNames()
{
//if (ModConfig.COMPATIBILITY_DICTIONARY_MAGMACREAM_AS_SLIME)
//OreDictionary.registerOre("clayball", Items.CLAY_BALL);
OreDictionary.registerOre("ingotIron", ModBlocks.ironball);
OreDictionary.registerOre("nuggetIron", ModBlocks.ironchunk);
OreDictionary.registerOre("ingotIron", ModBlocks.ironcleanball);
OreDictionary.registerOre("nuggetIron", ModBlocks.ironcleanchunk);
OreDictionary.registerOre("ingotSteel", ModBlocks.steelball);
OreDictionary.registerOre("nuggetSteel", ModBlocks.steelchunk);
}
}

View File

@@ -0,0 +1,225 @@
package nmd.primal.forgecraft.compat.ct;
import crafttweaker.CraftTweakerAPI;
import crafttweaker.IAction;
import crafttweaker.annotations.ModOnly;
import crafttweaker.annotations.ZenRegister;
import crafttweaker.api.item.IIngredient;
import crafttweaker.api.item.IItemStack;
import crafttweaker.api.minecraft.CraftTweakerMC;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import nmd.primal.core.common.PrimalCore;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import java.util.List;
import java.util.stream.Collectors;
@ZenClass("mods.forgecraft.NBTCrucible")
@ModOnly(ModInfo.MOD_ID)
@ZenRegister
public class CTCrucible {
static
{
PrimalCore.LOGGER.info("Registering CraftTweaker: " + CrucibleCrafting.RECIPE_PREFIX);
}
@ZenMethod
public static void addRecipe(IIngredient ing0,
IIngredient ing1,
IIngredient ing2,
IIngredient ing3,
IIngredient ing4,
IItemStack dropsRaw,
IItemStack dropsCooked,
int cookTemp,
int cookTime,
int coolTime,
String recipe_name)
{
CraftTweakerAPI.apply(new Add( ing0,
ing1,
ing2,
ing3,
ing4,
(ItemStack) dropsRaw.getInternal(),
(ItemStack) dropsCooked.getInternal(),
cookTemp, cookTime, coolTime, recipe_name) );
}
@ZenMethod
public static void removeRecipe(String recipe_name)
{
CraftTweakerAPI.apply(new Remove(recipe_name));
}
@ZenMethod
public static void removeAll()
{
CraftTweakerAPI.apply(new RemoveAll());
}
private static class Add implements IAction
{
private final String recipe_name;
private final int cookTemp;
private final int cookTime;
private final int coolTime;
private final Ingredient ing0, ing1, ing2, ing3, ing4;
private final ItemStack dropsCooked;
private final ItemStack dropsRaw;
private boolean isDisabled, isHidden;
public Add(IIngredient I0, IIngredient I1, IIngredient I2, IIngredient I3, IIngredient I4, ItemStack dropsRaw, ItemStack dropsCooked, int cookTemp, int cookTime, int coolTime, String recipe_name)
{
ItemStack[] array0 = null;
ItemStack[] array1 = null;
ItemStack[] array2 = null;
ItemStack[] array3 = null;
ItemStack[] array4 = null;
ItemStack[] emptyArray = new ItemStack[1];
emptyArray[0] = ItemStack.EMPTY;
if(I0 != null) {
Ingredient temp0 = null;
List<ItemStack> zeroIList = I0.getItems().stream().map(CraftTweakerMC::getItemStack).collect(Collectors.toList());
array0 = zeroIList.stream().toArray(ItemStack[]::new);
}
if(I0 == null) {
array0 = emptyArray;
}
if(I1 != null) {
Ingredient temp1 = null;
List<ItemStack> oneIList = I1.getItems().stream().map(CraftTweakerMC::getItemStack).collect(Collectors.toList());
array1 = oneIList.stream().toArray(ItemStack[]::new);
}
if(I1 == null) {
array1 = emptyArray;
}
if(I2 != null) {
Ingredient temp2 = null;
List<ItemStack> twoIList = I2.getItems().stream().map(CraftTweakerMC::getItemStack).collect(Collectors.toList());
array2 = twoIList.stream().toArray(ItemStack[]::new);
}
if(I2 == null) {
array2 = emptyArray;
}
if(I3 != null) {
Ingredient temp3 = null;
List<ItemStack> threeIList = I3.getItems().stream().map(CraftTweakerMC::getItemStack).collect(Collectors.toList());
array3 = threeIList.stream().toArray(ItemStack[]::new);
}
if(I3 == null) {
array3 = emptyArray;
}
if(I4 != null) {
Ingredient temp4 = null;
List<ItemStack> fourIList = I4.getItems().stream().map(CraftTweakerMC::getItemStack).collect(Collectors.toList());
array4 = fourIList.stream().toArray(ItemStack[]::new);
}
if(I4 == null) {
array4 = emptyArray;
}
this.recipe_name = recipe_name;
this.cookTemp = cookTemp;
this.cookTime = cookTime;
this.coolTime = coolTime;
this.ing0 = Ingredient.fromStacks(array0);
this.ing1 = Ingredient.fromStacks(array1);
this.ing2 = Ingredient.fromStacks(array2);
this.ing3 = Ingredient.fromStacks(array3);
this.ing4 = Ingredient.fromStacks(array4);
this.dropsCooked = dropsCooked;
this.dropsRaw = dropsRaw;
this.isDisabled = false;
this.isHidden = false;
}
@Override
public void apply()
{
PrimalCore.LOGGER.info("Add CraftTweaker Recipe: " + this.recipe_name);
CrucibleCrafting.REGISTRY.register(new CrucibleCrafting(
this.ing0,
this.ing1,
this.ing2,
this.ing3,
this.ing4,
this.dropsRaw,
this.dropsCooked,
this.cookTemp,
this.cookTime,
this.coolTime).setRecipeName(this.recipe_name));
}
@Override
public String describe()
{
return "[" + ModInfo.MOD_NAME + "] Adding Crafting Tweaker recipe for: " + CrucibleCrafting.RECIPE_PREFIX;
}
}
private static class Remove implements IAction
{
private String recipe_name;
public Remove(String recipe_name)
{
this.recipe_name = recipe_name;
}
@Override
public void apply()
{
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(recipe_name);
if (recipe != null && !recipe.isHidden())
{
PrimalCore.LOGGER.info("Remove CraftTweaker Recipe: " + recipe_name);
recipe.setDisabled(true);
}
}
@Override
public String describe()
{
return "[" + ModInfo.MOD_NAME + "] Removing Crafting Tweaker recipe for:" + CrucibleCrafting.RECIPE_PREFIX;
}
}
private static class RemoveAll implements IAction
{
public RemoveAll() { }
@Override
public void apply()
{
for (CrucibleCrafting recipe : CrucibleCrafting.RECIPES)
{
if (!recipe.isHidden())
recipe.setDisabled(true);
}
}
@Override
public String describe()
{
return "[" + ModInfo.MOD_NAME + "] Removing Crafting Tweaker recipe for:" + CrucibleCrafting.RECIPE_PREFIX;
}
}
}

View File

@@ -0,0 +1,31 @@
package nmd.primal.forgecraft.compat.jei;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import nmd.primal.forgecraft.ModInfo;
import java.util.List;
/**
* Created by mminaie on 9/13/18.
*/
public abstract class AbstractCategory<T extends IRecipeWrapper> implements IRecipeCategory<T> {
@Override
public String getModName() {
return ModInfo.MOD_NAME;
}
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
}
@Override
public IDrawable getIcon() {
// use the default icon
return null;
}
}

View File

@@ -0,0 +1,112 @@
package nmd.primal.forgecraft.compat.jei;
import mezz.jei.api.*;
import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import nmd.primal.forgecraft.compat.jei.anvil.AnvilRecipeCategory;
import nmd.primal.forgecraft.compat.jei.anvil.AnvilRecipeChecker;
import nmd.primal.forgecraft.compat.jei.anvil.AnvilRecipeHandler;
import nmd.primal.forgecraft.compat.jei.casting.CastingRecipeCategory;
import nmd.primal.forgecraft.compat.jei.casting.CastingRecipeChecker;
import nmd.primal.forgecraft.compat.jei.casting.CastingRecipeHandler;
import nmd.primal.forgecraft.compat.jei.crucible.CrucibleRecipeCategory;
import nmd.primal.forgecraft.compat.jei.crucible.CrucibleRecipeChecker;
import nmd.primal.forgecraft.compat.jei.crucible.CrucibleRecipeHandler;
import nmd.primal.forgecraft.compat.jei.forge.ForgeRecipeCategory;
import nmd.primal.forgecraft.compat.jei.forge.ForgeRecipeChecker;
import nmd.primal.forgecraft.compat.jei.forge.ForgeRecipeHandler;
import nmd.primal.forgecraft.compat.jei.workbench.WorkbenchRecipeCategory;
import nmd.primal.forgecraft.compat.jei.workbench.WorkbenchRecipeChecker;
import nmd.primal.forgecraft.compat.jei.workbench.WorkbenchRecipeHandler;
import nmd.primal.forgecraft.crafting.*;
import nmd.primal.forgecraft.init.ModBlocks;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/11/18.
*/
@JEIPlugin
public class ModJEI implements IModPlugin
{
public static IJeiHelpers jeiHelper;
public static ICraftingGridHelper craftingGridHelper;
public static IRecipeRegistry recipeRegistry;
public static IGuiHelper guiHelper;
private static final int craftOutputSlot = 0;
private static final int craftInputSlot1 = 1;
@Override
public void registerCategories(IRecipeCategoryRegistration registry)
{
final IJeiHelpers jeiHelpers = registry.getJeiHelpers();
final IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
//
// Recipe Categories
//
registry.addRecipeCategories(new ForgeRecipeCategory(guiHelper));
registry.addRecipeCategories(new CrucibleRecipeCategory(guiHelper));
registry.addRecipeCategories(new AnvilRecipeCategory(guiHelper));
registry.addRecipeCategories(new CastingRecipeCategory(guiHelper));
registry.addRecipeCategories(new WorkbenchRecipeCategory(guiHelper));
}
@Override
public void register(@Nonnull IModRegistry registry) {
jeiHelper = registry.getJeiHelpers();
guiHelper = jeiHelper.getGuiHelper();
craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot1, craftOutputSlot);
// ***************************************************************************** //
// Recipes
// ***************************************************************************** //
//
// Forging
//
registry.handleRecipes(ForgeCrafting.class, new ForgeRecipeHandler(), ForgeRecipeCategory.CATEGORY);
registry.addRecipes(ForgeRecipeChecker.getRecipes(), ForgeRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.forge_brick), ForgeRecipeCategory.CATEGORY);
//
// Crucible
//
registry.handleRecipes(CrucibleCrafting.class, new CrucibleRecipeHandler(), CrucibleRecipeCategory.CATEGORY);
registry.addRecipes(CrucibleRecipeChecker.getRecipes(), CrucibleRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.nbtCrucible), CrucibleRecipeCategory.CATEGORY);
//
// Anvil
//
registry.handleRecipes(AnvilCrafting.class, new AnvilRecipeHandler(), AnvilRecipeCategory.CATEGORY);
registry.addRecipes(AnvilRecipeChecker.getRecipes(), AnvilRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.stoneanvil), AnvilRecipeCategory.CATEGORY);
//
// Casting
//
registry.handleRecipes(CastingCrafting.class, new CastingRecipeHandler(), CastingRecipeCategory.CATEGORY);
registry.addRecipes(CastingRecipeChecker.getRecipes(), CastingRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.castingform), CastingRecipeCategory.CATEGORY);
//
// Workbench
//
registry.handleRecipes(WorkbenchCrafting.class, new WorkbenchRecipeHandler(), WorkbenchRecipeCategory.CATEGORY);
registry.addRecipes(WorkbenchRecipeChecker.getRecipes(), WorkbenchRecipeCategory.CATEGORY);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.workbench), WorkbenchRecipeCategory.CATEGORY);
// ***************************************************************************** //
// Info
// ***************************************************************************** //
//registry.addIngredientInfo(ItemStack.EMPTY, ItemStack.class, "jei.info.forgecraft.crucible");
//registry.addIngredientInfo(new ItemStack(ModBlocks.nbtCrucible, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.forgecraft.crucible");
//registry.addIngredientInfo(new OreIngredient("oreIron"), OreIngredient.class, "jei.info.forgecraft.oreiron");
registry.addIngredientInfo(new ItemStack(ModBlocks.castingform, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.forgecraft.casting");
registry.addIngredientInfo(new ItemStack(ModBlocks.sharpbench, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.forgecraft.sharpbench");
//registry.addIngredientInfo(new ItemStack(ModBlocks.stoneanvil, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.forgecraft.anvil");
}
}

View File

@@ -0,0 +1,122 @@
package nmd.primal.forgecraft.compat.jei.anvil;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.parts.ToolPart;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/16/18.
*/
public class AnvilRecipeCategory extends AbstractCategory<AnvilRecipeWrapper>
{
public static String CATEGORY = CommonUtils.prefix("anvil");
private static ResourceLocation gui_background = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/anvil.png");
private final IDrawable background;
public AnvilRecipeCategory(IGuiHelper guiHelper)
{
//background = guiHelper.createDrawable(gui_background, 0, 0, 134, 144, 0, 0, 0, 0);
background = guiHelper.createDrawable(gui_background, 0,0,160,96);
}
@Nonnull
@Override
public String getUid()
{
return CATEGORY;
}
@Nonnull
@Override
public String getTitle()
{
return I18n.format("jei.category.forgecraft.anvil");
}
@Nonnull
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft)
{
//progress.draw(minecraft, 67, 18);
}
@Override
public void setRecipe(IRecipeLayout layout, AnvilRecipeWrapper recipe, IIngredients ingredients)
{
IGuiItemStackGroup items = layout.getItemStacks();
/***INPUTS***/
items.init(0, true, 1, 1);
items.init(1, true, 20, 1);
items.init(2, true, 39, 1);
items.init(3, true, 58, 1);
items.init(4, true, 77, 1);
items.init(5, true, 1, 20);
items.init(6, true, 20, 20);
items.init(7, true, 39, 20);
items.init(8, true, 58, 20);
items.init(9, true, 77, 20);
items.init(10, true, 1, 39);
items.init(11, true, 20, 39);
items.init(12, true, 39, 39);
items.init(13, true, 58, 39);
items.init(14, true, 77, 39);
items.init(15, true, 1, 58);
items.init(16, true, 20, 58);
items.init(17, true, 39, 58);
items.init(18, true, 58, 58);
items.init(19, true, 77, 58);
items.init(20, true, 1, 77);
items.init(21, true, 20, 77);
items.init(22, true, 39, 77);
items.init(23, true, 58, 77);
items.init(24, true, 77, 77);
//items.set(0, recipe.getIngredient(0));
for(int i =0; i < 25; i++){
if(recipe.getIngredient(i).getItem() instanceof ToolPart) {
items.set(i, new ItemStack(recipe.getIngredient(i).getItem(), 1));
} else {
items.set(i, recipe.getIngredient(i));
}
}
/***OUTPUTS***/
items.init(25, false, 133, 40);
items.set(25, recipe.output);
/***EXTRAS***/
items.init(26, false, 105, 28);
ItemStack hammerStack = new ItemStack(ModItems.forgehammer, 1);
items.set(26, hammerStack);
//items.init(7, false, 58, 96);
//ItemStack bloomeryStack = new ItemStack(ModBlocks.bloomery_brick, 1, 0);
//items.set(7, bloomeryStack);
}
}

View File

@@ -0,0 +1,20 @@
package nmd.primal.forgecraft.compat.jei.anvil;
import nmd.primal.forgecraft.crafting.AnvilCrafting;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 9/16/18.
*/
public class AnvilRecipeChecker {
public static List<AnvilCrafting> getRecipes() {
List<AnvilCrafting> recipes = new ArrayList<>();
for (AnvilCrafting recipe : AnvilCrafting.getAnvilRecipes()) {
recipes.add(recipe);
}
return recipes;
}
}

View File

@@ -0,0 +1,18 @@
package nmd.primal.forgecraft.compat.jei.anvil;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;
import nmd.primal.forgecraft.crafting.AnvilCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/17/18.
*/
public class AnvilRecipeHandler implements IRecipeWrapperFactory<AnvilCrafting> {
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull AnvilCrafting recipe) {
return new AnvilRecipeWrapper(recipe);
}
}

View File

@@ -0,0 +1,53 @@
package nmd.primal.forgecraft.compat.jei.anvil;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import nmd.primal.forgecraft.crafting.AnvilCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/16/18.
*/
public class AnvilRecipeWrapper implements IRecipeWrapper {
protected final AnvilCrafting recipe;
protected ItemStack[] input;
protected String upgradeType;
protected ItemStack output;
public AnvilRecipeWrapper(AnvilCrafting recipe) {
this.recipe = recipe;
this.input = recipe.getInput();
this.upgradeType = recipe.getUpgrade();
this.output = recipe.getOutput();
}
@Override
public void getIngredients(IIngredients ingredients) {
for(int i =0; i < 25; i++){
//if(this.input[i] != new ItemStack(Items.AIR, 1) {
ingredients.setInput(ItemStack.class, this.input[i]);
//}
}
ingredients.setOutput(ItemStack.class, this.output);
}
public ItemStack getIngredient(int a){
return input[a];
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
//minecraft.fontRenderer.drawString(recipe.getDropsCooked().getDisplayName() + " Recipe", 20, 5, Color.black.getRGB());
}
}

View File

@@ -0,0 +1,129 @@
package nmd.primal.forgecraft.compat.jei.casting;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.parts.WeaponPart;
import nmd.primal.forgecraft.util.ToolNBT;
import nmd.primal.forgecraft.util.WeaponNBT;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/16/18.
*/
public class CastingRecipeCategory extends AbstractCategory<CastingRecipeWrapper>
{
public static String CATEGORY = CommonUtils.prefix("casting");
private static ResourceLocation gui_background = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/casting.png");
private final IDrawable background;
public CastingRecipeCategory(IGuiHelper guiHelper)
{
//background = guiHelper.createDrawable(gui_background, 0, 0, 134, 144, 0, 0, 0, 0);
background = guiHelper.createDrawable(gui_background, 0,0,256,96);
}
@Nonnull
@Override
public String getUid()
{
return CATEGORY;
}
@Nonnull
@Override
public String getTitle()
{
return I18n.format("jei.category.forgecraft.casting");
}
@Nonnull
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft)
{
//progress.draw(minecraft, 67, 18);
}
@Override
public void setRecipe(IRecipeLayout layout, CastingRecipeWrapper recipe, IIngredients ingredients)
{
IGuiItemStackGroup items = layout.getItemStacks();
/***INPUTS***/
items.init(0, true, 1, 1);
items.init(1, true, 20, 1);
items.init(2, true, 39, 1);
items.init(3, true, 58, 1);
items.init(4, true, 77, 1);
items.init(5, true, 1, 20);
items.init(6, true, 20, 20);
items.init(7, true, 39, 20);
items.init(8, true, 58, 20);
items.init(9, true, 77, 20);
items.init(10, true, 1, 39);
items.init(11, true, 20, 39);
items.init(12, true, 39, 39);
items.init(13, true, 58, 39);
items.init(14, true, 77, 39);
items.init(15, true, 1, 58);
items.init(16, true, 20, 58);
items.init(17, true, 39, 58);
items.init(18, true, 58, 58);
items.init(19, true, 77, 58);
items.init(20, true, 1, 77);
items.init(21, true, 20, 77);
items.init(22, true, 39, 77);
items.init(23, true, 58, 77);
items.init(24, true, 77, 77);
//items.set(0, recipe.getIngredient(0));
for(int i =0; i < 25; i++){
items.set(i, recipe.getIngredient(i));
}
/***OUTPUTS***/
items.init(26, false, 133, 77);
if(recipe.output.getItem() instanceof WeaponPart){
ItemStack tempStack = new ItemStack(recipe.output.getItem(), 1);
WeaponNBT.setDefaultNBT(tempStack);
items.set(26, tempStack);
} else if(recipe.output.getItem() instanceof ToolPart){
ItemStack tempStack = new ItemStack(recipe.output.getItem(), 1);
ToolNBT.setDefaultNBT(tempStack);
items.set(26, tempStack);
} else {items.set(26, recipe.output);}
/***EXTRAS***/
//items.init(26, false, 105, 28);
//ItemStack hammerStack = new ItemStack(ModItems.forgehammer, 1);
//items.set(26, hammerStack);
//items.init(7, false, 58, 96);
//ItemStack bloomeryStack = new ItemStack(ModBlocks.bloomery_brick, 1, 0);
//items.set(7, bloomeryStack);
}
}

View File

@@ -0,0 +1,20 @@
package nmd.primal.forgecraft.compat.jei.casting;
import nmd.primal.forgecraft.crafting.CastingCrafting;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 9/16/18.
*/
public class CastingRecipeChecker {
public static List<CastingCrafting> getRecipes() {
List<CastingCrafting> recipes = new ArrayList<>();
for (CastingCrafting recipe : CastingCrafting.getCastingRecipes()) {
recipes.add(recipe);
}
return recipes;
}
}

View File

@@ -0,0 +1,18 @@
package nmd.primal.forgecraft.compat.jei.casting;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;
import nmd.primal.forgecraft.crafting.CastingCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/17/18.
*/
public class CastingRecipeHandler implements IRecipeWrapperFactory<CastingCrafting> {
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull CastingCrafting recipe) {
return new CastingRecipeWrapper(recipe);
}
}

View File

@@ -0,0 +1,55 @@
package nmd.primal.forgecraft.compat.jei.casting;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import nmd.primal.forgecraft.crafting.CastingCrafting;
import javax.annotation.Nonnull;
import java.awt.*;
/**
* Created by mminaie on 9/16/18.
*/
public class CastingRecipeWrapper implements IRecipeWrapper {
protected final CastingCrafting recipe;
protected Item[] input;
protected ItemStack source;
protected ItemStack output;
public CastingRecipeWrapper(CastingCrafting recipe) {
this.recipe = recipe;
this.input = recipe.getInput();
this.output = recipe.getOutput();
this.source =recipe.getSource();
}
@Override
public void getIngredients(IIngredients ingredients) {
for(int i =0; i < 25; i++){
//if(this.input[i] != new ItemStack(Items.AIR, 1) {
ingredients.setInput(ItemStack.class, this.input[i]);
//}
}
ingredients.setOutput(ItemStack.class, this.output);
}
public ItemStack getIngredient(int a){
return new ItemStack(input[a], 1);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
String tempString = new String("To an empty crucible add: " + recipe.getSource().getDisplayName() + ". For details reference the appropriate crucible recipe. Pick up the hot crucible with Stonetongs and right click your casting block.");
minecraft.fontRenderer.drawSplitString(tempString, 97, 0, 150, Color.black.getRGB());
}
}

View File

@@ -0,0 +1,95 @@
package nmd.primal.forgecraft.compat.jei.crucible;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.init.ModBlocks;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeCategory extends AbstractCategory<CrucibleRecipeWrapper>
{
public static String CATEGORY = CommonUtils.prefix("crucible");
private static ResourceLocation gui_background = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/crucible.png");
private final IDrawable background;
public CrucibleRecipeCategory(IGuiHelper guiHelper)
{
//background = guiHelper.createDrawable(gui_background, 0, 0, 134, 144, 0, 0, 0, 0);
background = guiHelper.createDrawable(gui_background, 0,0,160,134);
}
@Nonnull
@Override
public String getUid()
{
return CATEGORY;
}
@Nonnull
@Override
public String getTitle()
{
return I18n.format("jei.category.forgecraft.crucible");
}
@Nonnull
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft)
{
//progress.draw(minecraft, 67, 18);
}
@Override
public void setRecipe(IRecipeLayout layout, CrucibleRecipeWrapper recipe, IIngredients ingredients)
{
IGuiItemStackGroup items = layout.getItemStacks();
/***INPUTS***/
items.init(0, true, 1, 77);
items.init(1, true, 1, 58);
items.init(2, true, 1, 39);
items.init(3, true, 1, 20);
items.init(4, true, 1, 1);
//items.set(0, recipe.getIngredient(0));
items.set(0, recipe.getIngredient(0));
items.set(1, recipe.getIngredient(1));
items.set(2, recipe.getIngredient(2));
items.set(3, recipe.getIngredient(3));
items.set(4, recipe.getIngredient(4));
/***OUTPUTS***/
items.init(5, false, 115, 96);
items.set(5, recipe.dropsCooked);
/***EXTRAS***/
items.init(6, false, 1, 96);
ItemStack crucibleStack = new ItemStack(ModBlocks.nbtCrucible, 1, 0);
items.set(6, crucibleStack);
items.init(7, false, 58, 96);
ItemStack bloomeryStack = new ItemStack(ModBlocks.bloomery_brick, 1, 0);
items.set(7, bloomeryStack);
}
}

View File

@@ -0,0 +1,24 @@
package nmd.primal.forgecraft.compat.jei.crucible;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeChecker {
public static List<CrucibleCrafting> getRecipes() {
List<CrucibleCrafting> recipes = new ArrayList<>();
for (CrucibleCrafting recipe : CrucibleCrafting.getRECIPES()) {
if(!recipe.isDisabled()) {
if(!recipe.isHidden()) {
recipes.add(recipe);
}
}
}
return recipes;
}
}

View File

@@ -0,0 +1,20 @@
package nmd.primal.forgecraft.compat.jei.crucible;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeHandler implements IRecipeWrapperFactory<CrucibleCrafting>
{
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull CrucibleCrafting recipe)
{
return new CrucibleRecipeWrapper(recipe);
}
}

View File

@@ -0,0 +1,86 @@
package nmd.primal.forgecraft.compat.jei.crucible;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import javax.annotation.Nonnull;
import java.awt.*;
import java.util.Arrays;
import java.util.List;
/**
* Created by mminaie on 9/13/18.
*/
public class CrucibleRecipeWrapper implements IRecipeWrapper
{
protected final CrucibleCrafting recipe;
//protected final List<Ingredient> ;
protected final int cookTemp;
protected final int cookTime;
protected final int coolTime;
protected final ItemStack dropsCooked;
protected final ItemStack dropsRaw;
protected Ingredient ing0;
protected Ingredient ing1;
protected Ingredient ing2;
protected Ingredient ing3;
protected Ingredient ing4;
protected List<Ingredient> ingredientList;
protected List crucibleCrafting;
public CrucibleRecipeWrapper(CrucibleCrafting recipe)
{
this.recipe = recipe;
this.cookTemp = recipe.getCookTemp();
this.cookTime = recipe.getCookTime();
this.coolTime = recipe.getCoolTime();
this.dropsCooked = recipe.getDropsCooked();
this.dropsRaw = recipe.getDropsRaw();
this.ing0 = recipe.getIng0();
this.ing1 = recipe.getIng1();
this.ing2 = recipe.getIng2();
this.ing3 = recipe.getIng3();
this.ing4 = recipe.getIng4();
this.ingredientList = recipe.getIngredientList();
this.crucibleCrafting = recipe.getIngredientList();
}
@Override
public void getIngredients(IIngredients ingredients)
{
//ingredients.setInputs(Ingredient.class, this.crucibleCrafting);
ingredients.setInput(ItemStack.class, this.ing0);
ingredients.setInput(ItemStack.class, this.ing1);
ingredients.setInput(ItemStack.class, this.ing2);
ingredients.setInput(ItemStack.class, this.ing3);
ingredients.setInput(ItemStack.class, this.ing4);
ingredients.setOutput(ItemStack.class, this.dropsCooked);
}
public List<ItemStack> getIngredient(int a){
ItemStack[] tempArray = this.ingredientList.get(a).getMatchingStacks();
List<ItemStack> stackList = Arrays.asList(tempArray);
return stackList;
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
minecraft.fontRenderer.drawString(String.valueOf(cookTemp) + "\u00b0", 58, 120, Color.red.getRGB());
minecraft.fontRenderer.drawString(String.valueOf(cookTime + " ticks"), 58, 86, Color.blue.getRGB());
minecraft.fontRenderer.drawString(recipe.getDropsCooked().getDisplayName() + " Recipe", 20, 5, Color.black.getRGB());
}
}

View File

@@ -0,0 +1,85 @@
package nmd.primal.forgecraft.compat.jei.forge;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.init.ModBlocks;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/16/18.
*/
public class ForgeRecipeCategory extends AbstractCategory<ForgeRecipeWrapper>
{
public static String CATEGORY = CommonUtils.prefix("forging");
private static ResourceLocation gui_background = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/forging.png");
private final IDrawable background;
public ForgeRecipeCategory(IGuiHelper guiHelper)
{
//background = guiHelper.createDrawable(gui_background, 0, 0, 134, 144, 0, 0, 0, 0);
background = guiHelper.createDrawable(gui_background, 0,0,77,58);
}
@Nonnull
@Override
public String getUid()
{
return CATEGORY;
}
@Nonnull
@Override
public String getTitle()
{
return I18n.format("jei.category.forgecraft.forging");
}
@Nonnull
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft)
{
//progress.draw(minecraft, 67, 18);
}
@Override
public void setRecipe(IRecipeLayout layout, ForgeRecipeWrapper recipe, IIngredients ingredients)
{
IGuiItemStackGroup items = layout.getItemStacks();
/***INPUTS***/
items.init(0, true, 1, 1);
items.set(0, new ItemStack(recipe.input, 1));
/***OUTPUTS***/
items.init(1, false, 58, 20);
items.set(1, recipe.output);
/***EXTRAS***/
items.init(3, false, 1, 20);
ItemStack forgeStack = new ItemStack(Item.getItemFromBlock(ModBlocks.forge_brick), 1);
items.set(3, forgeStack);
//items.init(7, false, 58, 96);
//ItemStack bloomeryStack = new ItemStack(ModBlocks.bloomery_brick, 1, 0);
//items.set(7, bloomeryStack);
}
}

View File

@@ -0,0 +1,20 @@
package nmd.primal.forgecraft.compat.jei.forge;
import nmd.primal.forgecraft.crafting.ForgeCrafting;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 9/16/18.
*/
public class ForgeRecipeChecker {
public static List<ForgeCrafting> getRecipes() {
List<ForgeCrafting> recipes = new ArrayList<>();
for (ForgeCrafting recipe : ForgeCrafting.getForgeRecipes()) {
recipes.add(recipe);
}
return recipes;
}
}

View File

@@ -0,0 +1,18 @@
package nmd.primal.forgecraft.compat.jei.forge;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;
import nmd.primal.forgecraft.crafting.ForgeCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/17/18.
*/
public class ForgeRecipeHandler implements IRecipeWrapperFactory<ForgeCrafting> {
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull ForgeCrafting recipe) {
return new ForgeRecipeWrapper(recipe);
}
}

View File

@@ -0,0 +1,57 @@
package nmd.primal.forgecraft.compat.jei.forge;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import nmd.primal.forgecraft.crafting.ForgeCrafting;
import javax.annotation.Nonnull;
import java.awt.*;
/**
* Created by mminaie on 9/16/18.
*/
public class ForgeRecipeWrapper implements IRecipeWrapper {
protected final ForgeCrafting recipe;
protected Item input;
protected ItemStack output;
protected int heat_threshold;
protected int ideal_time;
protected int cooldown;
public ForgeRecipeWrapper(ForgeCrafting recipe) {
this.recipe = recipe;
this.input = recipe.getInput();
this.output = recipe.getOutput();
this.heat_threshold = recipe.getHeatThreshold();
this.ideal_time = recipe.getIdealTime();
this.cooldown = recipe.getCooldown();
}
@Override
public void getIngredients(IIngredients ingredients) {
ingredients.setInput(ItemStack.class, this.input);
ingredients.setOutput(ItemStack.class, this.output);
}
public ItemStack getIngredient(){
return new ItemStack(this.input, 1);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
//String tempString = new String("To an empty crucible add: " + recipe.getSource().getDisplayName() + ". For details reference the appropriate crucible recipe. Pick up the hot crucible with Stonetongs and right click your casting block.");
//minecraft.fontRenderer.drawSplitString(tempString, 97, 0, 150, Color.black.getRGB());
minecraft.fontRenderer.drawString(String.valueOf(recipe.getHeatThreshold() + "\u00b0"), 24, 36, Color.red.getRGB());
minecraft.fontRenderer.drawString(String.valueOf(recipe.getIdealTime()), 26, 13, Color.green.getRGB());
}
}

View File

@@ -0,0 +1,100 @@
package nmd.primal.forgecraft.compat.jei.workbench;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.compat.jei.AbstractCategory;
import nmd.primal.forgecraft.init.ModBlocks;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.List;
/**
* Created by mminaie on 9/16/18.
*/
public class WorkbenchRecipeCategory extends AbstractCategory<WorkbenchRecipeWrapper>
{
public static String CATEGORY = CommonUtils.prefix("workbench");
private static ResourceLocation gui_background = new ResourceLocation(ModInfo.MOD_ID,"textures/gui/jei/workbench.png");
private final IDrawable background;
public WorkbenchRecipeCategory(IGuiHelper guiHelper)
{
//background = guiHelper.createDrawable(gui_background, 0, 0, 134, 144, 0, 0, 0, 0);
background = guiHelper.createDrawable(gui_background, 0,0,115,39);
}
@Nonnull
@Override
public String getUid()
{
return CATEGORY;
}
@Nonnull
@Override
public String getTitle()
{
return I18n.format("jei.category.forgecraft.workbench");
}
@Nonnull
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft)
{
//progress.draw(minecraft, 67, 18);
}
@Override
public void setRecipe(IRecipeLayout layout, WorkbenchRecipeWrapper recipe, IIngredients ingredients)
{
IGuiItemStackGroup items = layout.getItemStacks();
/***INPUTS***/
items.init(0, true, 1, 1);
List<ItemStack> slot0 = Arrays.asList( recipe.toolPart.getMatchingStacks());
items.set(0,slot0);
items.init(1, true, 20, 1);
List<ItemStack> slot1 = Arrays.asList( recipe.toolHead.getMatchingStacks());
items.set(1,slot1);
items.init(2, true, 39, 1);
List<ItemStack> slot2 = Arrays.asList( recipe.toolPin.getMatchingStacks());
items.set(2,slot2);
items.init(3, true, 39, 20);
List<ItemStack> slot3 = Arrays.asList( recipe.takeApart.getMatchingStacks());
items.set(3,slot3);
/***OUTPUTS***/
items.init(4, false, 96, 11);
items.set(4, recipe.output);
/***EXTRAS***/
items.init(5, true, 66, 20);
ItemStack bench = new ItemStack(Item.getItemFromBlock(ModBlocks.workbench), 1);
items.set(5, bench);
items.init(6, false, 66, 1);
List<ItemStack> tool = Arrays.asList( recipe.tool.getMatchingStacks());
items.set(6, tool);
}
}

View File

@@ -0,0 +1,24 @@
package nmd.primal.forgecraft.compat.jei.workbench;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mminaie on 9/16/18.
*/
public class WorkbenchRecipeChecker {
public static List<WorkbenchCrafting> getRecipes() {
List<WorkbenchCrafting> recipes = new ArrayList<>();
for (WorkbenchCrafting recipe : WorkbenchCrafting.getRECIPES()) {
if(!recipe.isDisabled()) {
if(!recipe.isHidden()) {
recipes.add(recipe);
}
}
}
return recipes;
}
}

View File

@@ -0,0 +1,18 @@
package nmd.primal.forgecraft.compat.jei.workbench;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.IRecipeWrapperFactory;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/17/18.
*/
public class WorkbenchRecipeHandler implements IRecipeWrapperFactory<WorkbenchCrafting> {
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull WorkbenchCrafting recipe) {
return new WorkbenchRecipeWrapper(recipe);
}
}

View File

@@ -0,0 +1,58 @@
package nmd.primal.forgecraft.compat.jei.workbench;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import javax.annotation.Nonnull;
/**
* Created by mminaie on 9/16/18.
*/
public class WorkbenchRecipeWrapper implements IRecipeWrapper {
protected final WorkbenchCrafting recipe;
protected Ingredient toolPart;
protected Ingredient toolHead;
protected Ingredient toolPin;
protected Ingredient takeApart;
protected Ingredient tool;
protected ItemStack output;
public WorkbenchRecipeWrapper(WorkbenchCrafting recipe) {
this.recipe = recipe;
this.toolPart = recipe.getToolPart();
this.toolHead = recipe.getToolHead();
this.toolPin = recipe.getToolPin();
this.takeApart = recipe.getTakeApart();
this.tool = recipe.getCraftingTool();
this.output = recipe.getOutput();
}
@Override
public void getIngredients(IIngredients ingredients) {
ingredients.setInput(ItemStack.class, this.toolPart);
ingredients.setInput(ItemStack.class, this.toolHead);
ingredients.setInput(ItemStack.class, this.toolPin);
ingredients.setInput(ItemStack.class, this.takeApart);
ingredients.setInput(ItemStack.class, this.tool);
ingredients.setOutput(ItemStack.class, this.output);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
//String tempString = new String("To an empty crucible add: " + recipe.getSource().getDisplayName() + ". For details reference the appropriate crucible recipe. Pick up the hot crucible with Stonetongs and right click your casting block.");
//minecraft.fontRenderer.drawSplitString(tempString, 97, 0, 150, Color.black.getRGB());
//minecraft.fontRenderer.drawString(String.valueOf(recipe.getHeatThreshold() + "\u00b0"), 24, 36, Color.red.getRGB());
//minecraft.fontRenderer.drawString(String.valueOf(recipe.getIdealTime()), 26, 13, Color.green.getRGB());
}
}

View File

@@ -14,53 +14,70 @@ public class AnvilCrafting {
// Recipe Handler AnvilCrafting
// ***************************************************************************** //
public static ArrayList<AnvilCrafting> getAnvilRecipes() {
return anvilRecipes;
}
private static ArrayList<AnvilCrafting> anvilRecipes = new ArrayList<>();
private String[] input = new String[25];
private ItemStack[] input = new ItemStack[25];
private String upgradeType;
private ItemStack output;
public AnvilCrafting(String[] input, ItemStack output, String upgrade){
public AnvilCrafting(ItemStack[] input, ItemStack output, String upgrade){
this.input = input;
this.output = output;
this.upgradeType = upgrade;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(String[] input, ItemStack output, String upgrade)
public static void addRecipe(ItemStack[] input, ItemStack output, String upgrade)
{
anvilRecipes.add(new AnvilCrafting(input, output, upgrade));
}
public static boolean isRecipe(String[] array)
public static boolean isRecipe(ItemStack[] array)
{
for(AnvilCrafting recipe : anvilRecipes) {
if (Arrays.equals(array, recipe.input))
return true;
}
return false;
}
public static AnvilCrafting getRecipe(String[] array)
public static AnvilCrafting getRecipe(ItemStack[] array)
{
for(AnvilCrafting recipe : anvilRecipes) {
if (Arrays.equals(array, recipe.input))
if(checkArrays(recipe.getInput(), array)){
return recipe;
}
}
return null;
}
public String[] getInput() {return this.input;}
public static boolean checkArrays (ItemStack[] leftArray, ItemStack[] rightArray){
int a =0;
for(int i=0; i<leftArray.length; i++){
if( (leftArray[i].isEmpty() && rightArray[i].isEmpty()) ||
((leftArray[i].isItemEqualIgnoreDurability(rightArray[i]))) ) {
a++;
}
if(a == 25){
return true;
}
}
return false;
}
public ItemStack getOutput() {return this.output;}
public ItemStack[] getInput() {return this.input;}
public ItemStack getOutput() {return this.output.copy();}
public String getUpgrade() {return this.upgradeType; }

View File

@@ -1,135 +0,0 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
/**
* Created by mminaie on 1/24/17.
*/
public class BloomeryCrafting {
// ***************************************************************************** //
// Recipe Handler Bloomery
// ***************************************************************************** //
private static ArrayList<BloomeryCrafting> bloomeryRecipes = new ArrayList<>();
private ItemStack input;
private ItemStack output;
private ItemStack output_failed;
private ItemStack cool_output;
private int heat_threshold;
private int ideal_time;
private int cooldown;
private float heat_variance;
private float time_variance;
public BloomeryCrafting(ItemStack input, ItemStack output, ItemStack output_failed, ItemStack cool_output, int heat_threshold, int ideal_time, int cooldown,float heat_variance, float time_variance)
{
this.input = input;
this.output = output;
this.output_failed = output_failed;
this.cool_output = cool_output;
this.heat_threshold = heat_threshold;
this.ideal_time = ideal_time;
this.cooldown = cooldown;
this.heat_variance = heat_variance;
this.time_variance = time_variance;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(ItemStack input, ItemStack output, ItemStack failed, ItemStack cool, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance)
{
bloomeryRecipes.add(new BloomeryCrafting(input, output, failed, cool, heat_threshold, ideal_time, cooldown, heat_variance, time_variance));
}
public static boolean isRecipeItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.input))
return true;
}
return false;
}
public static boolean isOutputItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.output))
return true;
}
return false;
}
public static boolean isCoolItem(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.cool_output))
return true;
}
return false;
}
public static BloomeryCrafting getRecipe(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.input))
return recipe;
}
return null;
}
public static BloomeryCrafting getRecipeFromOutput(ItemStack stack)
{
for(BloomeryCrafting recipe : bloomeryRecipes) {
if (stack.isItemEqual(recipe.output))
return recipe;
}
return null;
}
public ItemStack getInput()
{
return this.input;
}
public ItemStack getOutput()
{
return this.output;
}
public ItemStack getOutputFailed()
{
return this.output_failed;
}
public ItemStack getCoolOutput()
{
return this.cool_output;
}
public int getHeatThreshold()
{
return this.heat_threshold;
}
public int getIdealTime()
{
return this.ideal_time;
}
public int getCooldown(){ return this.cooldown;}
public float getHeatVariance(){return this.heat_variance; }
public float getTimeVariance(){return this.time_variance; }
///
// end
///
}

View File

@@ -0,0 +1,74 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by mminaie on 6/22/17.
*/
public class CastingCrafting {
// ***************************************************************************** //
// Recipe Handler AnvilCrafting
// ***************************************************************************** //
private static ArrayList<CastingCrafting> castingRecipes = new ArrayList<>();
private Item[] input = new Item[25];
private ItemStack output;
public ItemStack getSource() {
return source;
}
private ItemStack source;
public CastingCrafting(ItemStack source, Item[] input, ItemStack output){
this.input = input;
this.output = output;
this.source = source;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(ItemStack source, Item[] input, ItemStack output)
{
castingRecipes.add(new CastingCrafting(source, input, output));
}
public static ArrayList<CastingCrafting> getCastingRecipes() {
return castingRecipes;
}
public static boolean isRecipe(Item[] array)
{
for(CastingCrafting recipe : castingRecipes) {
if (Arrays.equals(array, recipe.input))
return true;
}
return false;
}
public static CastingCrafting getRecipe(ItemStack source, Item[] array)
{
for(CastingCrafting recipe : castingRecipes) {
if (source.getItem() == recipe.getSource().getItem() ) {
if (Arrays.equals(array, recipe.input))
return recipe;
}
}
return null;
}
public Item[] getInput() {return this.input;}
public ItemStack getOutput() {return this.output;}
}

View File

@@ -1,62 +0,0 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by mminaie on 6/22/17.
*/
public class CastingformCrafting {
// ***************************************************************************** //
// Recipe Handler AnvilCrafting
// ***************************************************************************** //
private static ArrayList<CastingformCrafting> castingRecipes = new ArrayList<>();
private String[] input = new String[25];
private ItemStack output;
public CastingformCrafting(String[] input, ItemStack output){
this.input = input;
this.output = output;
}
// ***************************************************************************** //
// Recipe Methods
// ***************************************************************************** //
public static void addRecipe(String[] input, ItemStack output)
{
castingRecipes.add(new CastingformCrafting(input, output));
}
public static boolean isRecipe(String[] array)
{
for(CastingformCrafting recipe : castingRecipes) {
if (Arrays.equals(array, recipe.input))
return true;
}
return false;
}
public static CastingformCrafting getRecipe(String[] array)
{
for(CastingformCrafting recipe : castingRecipes) {
if (Arrays.equals(array, recipe.input))
return recipe;
}
return null;
}
public String[] getInput() {return this.input;}
public ItemStack getOutput() {return this.output;}
}

View File

@@ -0,0 +1,250 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.common.crafting.AbstractRecipe;
import nmd.primal.forgecraft.ModInfo;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* Created by mminaie on 11/11/17.
*/
public class CrucibleCrafting extends AbstractRecipe<CrucibleCrafting> { //extends AbstractCrafting<CrucibleCrafting> {
// ***************************************************************************** //
// Recipe Handler CrucibleHandler
// ***************************************************************************** //
public static final String RECIPE_PREFIX = "crucible";
public static final IForgeRegistry<CrucibleCrafting> REGISTRY = ModInfo.Registries.CRUCIBLE_CRAFTING;
public static Collection<CrucibleCrafting> getRECIPES() {
return RECIPES;
}
public static final Collection<CrucibleCrafting> RECIPES = REGISTRY.getValuesCollection();
//public static ArrayList<CrucibleCrafting> getCrucibleCrafting() {
//return crucibleCrafting;
//}
//private static ArrayList<CrucibleCrafting> crucibleCrafting = new ArrayList<>();
private int cookTemp;
private int cookTime;
private int coolTime;
public Ingredient getIng0() {
return ing0;
}
public void setIng0(Ingredient ing0) {
this.ing0 = ing0;
}
public Ingredient getIng1() {
return ing1;
}
public void setIng1(Ingredient ing1) {
this.ing1 = ing1;
}
public Ingredient getIng2() {
return ing2;
}
public void setIng2(Ingredient ing2) {
this.ing2 = ing2;
}
public Ingredient getIng3() {
return ing3;
}
public void setIng3(Ingredient ing3) {
this.ing3 = ing3;
}
public Ingredient getIng4() {
return ing4;
}
public void setIng4(Ingredient ing4) {
this.ing4 = ing4;
}
private Ingredient ing0;
private Ingredient ing1;
private Ingredient ing2;
private Ingredient ing3;
private Ingredient ing4;
private ItemStack dropsCooked;
private ItemStack dropsRaw;
public List<Ingredient> getIngredientList() {
return ingredientList;
}
public void setIngredientList(List<Ingredient> ingredientList) {
this.ingredientList = ingredientList;
}
private List<Ingredient> ingredientList = new ArrayList<>();
public CrucibleCrafting(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3, Ingredient i4,
ItemStack outputRaw, ItemStack outputCooked,
Integer temp, Integer cookTime, Integer coolTime){
super();
this.ing0 = i0;
this.ing1 = i1;
this.ing2 = i2;
this.ing3 = i3;
this.ing4 = i4;
this.ingredientList.add(0, i0);
this.ingredientList.add(1, i1);
this.ingredientList.add(2, i2);
this.ingredientList.add(3, i3);
this.ingredientList.add(4, i4);
this.dropsRaw = outputRaw;
this.dropsCooked = outputCooked;
this.cookTemp = temp;
this.cookTime = cookTime;
this.coolTime = coolTime;
}
public static boolean compare(Ingredient ingredient, ItemStack stack){
if(stack == null){
stack = new ItemStack(Items.AIR, 1);
}
if(ingredient == null && stack.isEmpty()) {
return true;
}
if (ingredient.test(ItemStack.EMPTY)) {
if (stack.isEmpty()) {
return true;
}
}
if(ingredient.apply(stack)){
return true;
}
return false;
}
public static boolean isRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack i4){
for(CrucibleCrafting recipe : RECIPES){
if(i0 == null){
i0 = ItemStack.EMPTY;
}
if(i1 == null){
i1 = ItemStack.EMPTY;
}
if(i2 == null){
i2 = ItemStack.EMPTY;
}
if(i3 == null){
i3 = ItemStack.EMPTY;
}
if(i4 == null){
i4 = ItemStack.EMPTY;
}
if(compare(recipe.ing0, i0) &&
compare(recipe.ing1, i1) &&
compare(recipe.ing2, i2) &&
compare(recipe.ing3, i3) &&
compare(recipe.ing4, i4) ){
return true;
}
}
return false;
}
public static CrucibleCrafting getRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack i4){
for(CrucibleCrafting recipe : RECIPES){
if(i0 == null){
i0 = ItemStack.EMPTY;
}
if(i1 == null){
i1 = ItemStack.EMPTY;
}
if(i2 == null){
i2 = ItemStack.EMPTY;
}
if(i3 == null){
i3 = ItemStack.EMPTY;
}
if(i4 == null){
i4 = ItemStack.EMPTY;
}
if(recipe.ing0.apply(i0) && recipe.ing1.apply(i1) && recipe.ing2.apply(i2) && recipe.ing3.apply(i3) && recipe.ing4.apply(i4) ){
return recipe;
}
}
return null;
}
public static boolean isValidIngredient(ItemStack checkStack){
for(CrucibleCrafting recipe : RECIPES) {
if (recipe.ing0.apply(checkStack) ||
recipe.ing1.apply(checkStack) ||
recipe.ing2.apply(checkStack) ||
recipe.ing3.apply(checkStack) ||
recipe.ing4.apply(checkStack)) {
return true;
}
}
return false;
}
public int getCookTemp() {
return cookTemp;
}
public int getCookTime() {
return cookTime;
}
public int getCoolTime() {
return coolTime;
}
public ItemStack getDropsCooked() {
return dropsCooked;
}
public ItemStack getDropsRaw() {
return dropsRaw;
}
public Collection<CrucibleCrafting> getRecipes() {
return RECIPES;
}
public String getRecipePrefix() {
return RECIPE_PREFIX;
}
/**
* Shim for getting a recipe directly from correctly formatted name
* @param recipe_name basic recipe name, no prefix or mod id
* @return Recipe object
*/
@Nullable
public static CrucibleCrafting getRecipe(String recipe_name)
{
return REGISTRY.getValue(getFullRecipeName(RECIPE_PREFIX, recipe_name));
}
}

View File

@@ -10,7 +10,11 @@ import java.util.ArrayList;
*/
public class ForgeCrafting {
// ***************************************************************************** //
public static ArrayList<ForgeCrafting> getForgeRecipes() {
return forgeRecipes;
}
// ***************************************************************************** //
// Recipe Handler ForgeCrafting
// ***************************************************************************** //
private static ArrayList<ForgeCrafting> forgeRecipes = new ArrayList<>();
@@ -53,7 +57,8 @@ public class ForgeCrafting {
public static ForgeCrafting getRecipe(Item item)
{
for(ForgeCrafting recipe : forgeRecipes) {
if (item.equals(recipe.input))
if (item.equals(recipe.getInput()))
return recipe;
}
return null;

View File

@@ -0,0 +1,212 @@
package nmd.primal.forgecraft.crafting;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.common.crafting.AbstractRecipe;
import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.forgecraft.ModInfo;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static nmd.primal.core.common.crafting.AbstractRecipe.getFullRecipeName;
/**
* Created by mminaie on 11/11/17.
*/
public class WorkbenchCrafting extends AbstractRecipe<WorkbenchCrafting> { //extends AbstractCrafting<CrucibleCrafting> {
// ***************************************************************************** //
// Recipe Handler CrucibleHandler
// ***************************************************************************** //
public static final String RECIPE_PREFIX = "workbench";
public static final IForgeRegistry<WorkbenchCrafting> REGISTRY = ModInfo.Registries.WORKBENCH_CRAFTING;
public static Collection<WorkbenchCrafting> getRECIPES() {
return RECIPES;
}
public static final Collection<WorkbenchCrafting> RECIPES = REGISTRY.getValuesCollection();
private Ingredient toolPart;
private Ingredient toolHead;
private Ingredient toolPin;
private Ingredient takeApart;
private ItemStack output;
private Ingredient craftingTool;
public Ingredient getTakeApart() {
return takeApart;
}
public void setTakeApart(Ingredient takeApart) {
this.takeApart = takeApart;
}
public Ingredient getToolPart() {
return toolPart;
}
public void setToolPart(Ingredient toolPart) {
this.toolPart = toolPart;
}
public Ingredient getToolHead() {
return toolHead;
}
public void setToolHead(Ingredient toolHead) {
this.toolHead = toolHead;
}
public Ingredient getToolPin() {
return toolPin;
}
public void setToolPin(Ingredient toolPin) {
this.toolPin = toolPin;
}
public ItemStack getOutput() {
return output;
}
public void setOutput(ItemStack output) {
this.output = output;
}
public List<Ingredient> getIngredientList() {
return ingredientList;
}
public void setIngredientList(List<Ingredient> ingredientList) {
this.ingredientList = ingredientList;
}
public Ingredient getCraftingTool() {
return craftingTool;
}
private List<Ingredient> ingredientList = new ArrayList<>();
public WorkbenchCrafting(Ingredient i0, Ingredient i1, Ingredient i2, Ingredient i3 , Ingredient craftingTool, ItemStack output){
super();
this.toolPart = i0;
this.toolHead = i1;
this.toolPin = i2;
this.takeApart = i3;
this.output = output;
this.craftingTool = craftingTool;
}
public static boolean compare(Ingredient ingredient, ItemStack stack){
if(stack == null){
stack = new ItemStack(Items.AIR, 1);
}
if(ingredient == null && stack.isEmpty()) {
return true;
}
if (ingredient.test(ItemStack.EMPTY)) {
if (stack.isEmpty()) {
return true;
}
}
ItemStack[] testArray = ingredient.getMatchingStacks();
List<ItemStack> testList = RecipeHelper.buildList(testArray);
if(testList.contains(stack)){
return true;
}
return false;
}
public static boolean isRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack cTool){
for(WorkbenchCrafting recipe : RECIPES){
if(i0 == null){
i0 = ItemStack.EMPTY;
}
if(i1 == null){
i1 = ItemStack.EMPTY;
}
if(i2 == null){
i2 = ItemStack.EMPTY;
}
if(i3 == null){
i3 = ItemStack.EMPTY;
}
if(cTool == null){
cTool = ItemStack.EMPTY;
}
if(compare(recipe.toolPart, i0) &&
compare(recipe.toolHead, i1) &&
compare(recipe.toolPin, i2) &&
compare(recipe.takeApart, i3) &&
compare(recipe.craftingTool, cTool)){
return true;
}
}
return false;
}
public static WorkbenchCrafting getRecipe(ItemStack i0, ItemStack i1, ItemStack i2, ItemStack i3, ItemStack cTool){
for(WorkbenchCrafting recipe : RECIPES){
if(i0 == null){
i0 = ItemStack.EMPTY;
}
if(i1 == null){
i1 = ItemStack.EMPTY;
}
if(i2 == null){
i2 = ItemStack.EMPTY;
}
if(i3 == null){
i3 = ItemStack.EMPTY;
}
if(cTool == null){
cTool = ItemStack.EMPTY;
}
if(recipe.toolPart.apply(i0) && recipe.toolHead.apply(i1) && recipe.toolPin.apply(i2) && recipe.takeApart.apply(i3) && recipe.craftingTool.apply(cTool) ){
return recipe;
}
}
return null;
}
/*public static boolean isValidIngredient(ItemStack checkStack){
for(WorkbenchCrafting recipe : RECIPES) {
if (recipe.ing0.apply(checkStack) ||
recipe.ing1.apply(checkStack) ||
recipe.ing2.apply(checkStack) ||
recipe.ing3.apply(checkStack) ||
recipe.ing4.apply(checkStack)) {
return true;
}
}
return false;
}*/
public Collection<WorkbenchCrafting> getRecipes() {
return RECIPES;
}
public String getRecipePrefix() {
return RECIPE_PREFIX;
}
/**
* Shim for getting a recipe directly from correctly formatted name
* @param recipe_name basic recipe name, no prefix or mod id
* @return Recipe object
*/
@Nullable
public static WorkbenchCrafting getRecipe(String recipe_name)
{
return REGISTRY.getValue(getFullRecipeName(RECIPE_PREFIX, recipe_name));
}
}

View File

@@ -0,0 +1,413 @@
package nmd.primal.forgecraft.crafting.registery;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreIngredient;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.init.ModItems;
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public final class RecipesCrucible {
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<CrucibleCrafting> event) {
PrimalAPI.logger(7, "Registering Recipes: " + CrucibleCrafting.RECIPE_PREFIX);
final IForgeRegistry<CrucibleCrafting> recipes = event.getRegistry();
//RecipeHandler.addSmelting(ModItems.softcrucible, new ItemStack(ModBlocks.nbtCrucible, 1));
/***********************/
/***CRUCIBLE CRAFTING***/
/***********************/
recipes.register (new CrucibleCrafting(
new OreIngredient("oreIron"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(Blocks.IRON_ORE, 1),
new ItemStack(ModItems.ironingotball, 1),
1400,
1200,
800).setRecipeName("wroughtIron1"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustIron"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(Blocks.IRON_ORE, 1),
new ItemStack(ModItems.ironingotball, 1),
1250,
1100,
800).setRecipeName("wroughtIron2"));
recipes.register (new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(ModItems.brokenwroughtirontool, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
new ItemStack(ModItems.ironingotball, 1),
1250,
1100,
800).setRecipeName("wroughtIron3"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustIron"),
new OreIngredient("slackLime"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.IRON_DUST, 1),
new ItemStack(ModItems.ironcleaningotball, 1),
1550,
1200,
800).setRecipeName("cleanIron1"));
recipes.register (new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(ModItems.brokencleanirontool, 1)),
new OreIngredient("nuggetIron"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
new ItemStack(ModItems.ironcleaningotball, 1),
1550,
1200,
800).setRecipeName("cleanIron2"));
recipes.register (new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(ModItems.ironcleaningotball, 1)),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_HIGH, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(ModItems.ironcleaningotball, 1),
new ItemStack(ModItems.steelingotball, 1),
2100,
1500,
1000).setRecipeName("steel1"));
recipes.register (new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(ModItems.brokensteeltool, 1)),
new OreIngredient("nuggetSteel"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
new ItemStack(ModItems.steelingotball, 1),
2100,
1500,
1000).setRecipeName("steel2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("oreClusterMagnetite"),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
new OreIngredient("oreClusterMagnetite"),
Ingredient.fromStacks(new ItemStack(PrimalAPI.Items.CHARCOAL_PURE, 1)),
new OreIngredient("specialCarbon"),
new ItemStack(PrimalAPI.Items.ORE_CLUSTER_MAGNETITE, 1),
new ItemStack(ModItems.wootzingotball, 1),
2100,
1800,
1500).setRecipeName("wootz2"));
recipes.register (new CrucibleCrafting(
Ingredient.fromStacks(new ItemStack(ModItems.brokenwootztool, 1)),
new OreIngredient("nuggetWootz"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
new ItemStack(ModItems.wootzingotball, 1),
2100,
1800,
1500).setRecipeName("wootz3"));
/***BRONZE***/
NBTTagCompound tagBronzeDefault = new NBTTagCompound();
tagBronzeDefault.setString("upgrades", "");
tagBronzeDefault.setBoolean("hot", false);
ItemStack defaultBronze = new ItemStack(ModItems.bronzeingotball, 1);
defaultBronze.setTagCompound(tagBronzeDefault.copy());
recipes.register (new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
defaultBronze,
1100,
800,
600).setRecipeName("bronze1"));
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotBronze"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
defaultBronze,
1100,
800,
600).setRecipeName("bronze2"));
ItemStack redBronze = defaultBronze.copy();
redBronze.getTagCompound().setString("upgrades", "redstone");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("dustRedstone"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
redBronze,
1100,
800,
600).setRecipeName("redBronze1"));
ItemStack diamondBronze = defaultBronze.copy();
diamondBronze.getTagCompound().setString("upgrades", "diamond");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("flakeDiamond"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondBronze,
1100,
800,
600).setRecipeName("diamondBronze1"));
ItemStack emeraldBronze = defaultBronze.copy();
emeraldBronze.getTagCompound().setString("upgrades", "emerald");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("flakeEmerald"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
emeraldBronze,
1100,
800,
600).setRecipeName("emeraldBronze1"));
ItemStack lapisBronze = defaultBronze.copy();
lapisBronze.getTagCompound().setString("upgrades", "lapis");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotBronze"),
new OreIngredient("gemLapis"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
lapisBronze,
1100,
800,
600).setRecipeName("lapisBronze1"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
new OreIngredient("dustRedstone"),
new ItemStack(PrimalAPI.Items.SLAG, 1),
redBronze,
1100,
800,
600).setRecipeName("redBronze2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
new OreIngredient("flakeDiamond"),
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondBronze,
1100,
800,
600).setRecipeName("diamondBronze2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
new OreIngredient("flakeEmerald"),
new ItemStack(PrimalAPI.Items.SLAG, 1),
emeraldBronze,
1100,
800,
600).setRecipeName("emeraldBronze2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustCopper"),
new OreIngredient("dustTin"),
new OreIngredient("gemLapis"),
new ItemStack(PrimalAPI.Items.SLAG, 1),
lapisBronze,
1100,
800,
600).setRecipeName("lapisBronze2"));
/***COPPER***/
NBTTagCompound tagCopperDefault = new NBTTagCompound();
tagCopperDefault.setString("upgrades", "");
tagCopperDefault.setBoolean("hot", false);
ItemStack defaultCopper = new ItemStack(PrimalAPI.Items.COPPER_INGOT, 1);
defaultCopper.setTagCompound(tagCopperDefault.copy());
recipes.register (new CrucibleCrafting(
new OreIngredient("oreCopper"),
new OreIngredient("slackLime"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
defaultCopper,
900,
800,
600).setRecipeName("copper1"));
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotCopper"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
defaultCopper,
900,
750,
550).setRecipeName("copper2"));
ItemStack redCopper = defaultCopper.copy();
redCopper.getTagCompound().setString("upgrades", "redstone");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotCopper"),
new OreIngredient("dustRedstone"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
redCopper,
900,
750,
550).setRecipeName("redCopper1"));
ItemStack diamondCopper = defaultCopper.copy();
diamondCopper.getTagCompound().setString("upgrades", "diamond");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotCopper"),
new OreIngredient("flakeDiamond"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondCopper,
900,
750,
550).setRecipeName("diamondCopper1"));
ItemStack emeraldCopper = defaultCopper.copy();
emeraldCopper.getTagCompound().setString("upgrades", "emerald");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotCopper"),
new OreIngredient("flakeEmerald"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
emeraldCopper,
900,
750,
550).setRecipeName("emeraldCopper1"));
ItemStack lapisCopper = defaultCopper.copy();
lapisCopper.getTagCompound().setString("upgrades", "lapis");
recipes.register (new CrucibleCrafting(
new OreIngredient("ingotCopper"),
new OreIngredient("gemLapis"),
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
lapisCopper,
900,
750,
550).setRecipeName("lapisCopper1"));
recipes.register (new CrucibleCrafting(
new OreIngredient("oreCopper"),
new OreIngredient("slackLime"),
new OreIngredient("dustRedstone"),
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
redCopper,
900,
750,
550).setRecipeName("redCopper2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("oreCopper"),
new OreIngredient("slackLime"),
new OreIngredient("flakeDiamond"),
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
diamondCopper,
900,
750,
550).setRecipeName("diamondCopper2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("oreCopper"),
new OreIngredient("slackLime"),
new OreIngredient("flakeEmerald"),
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
emeraldCopper,
900,
750,
550).setRecipeName("emeraldCopper2"));
recipes.register (new CrucibleCrafting(
new OreIngredient("oreCopper"),
new OreIngredient("slackLime"),
new OreIngredient("gemLapis"),
Ingredient.EMPTY,
Ingredient.EMPTY,
new ItemStack(PrimalAPI.Items.SLAG, 1),
lapisCopper,
900,
750,
550).setRecipeName("lapisCopper2"));
}
}

View File

@@ -0,0 +1,638 @@
package nmd.primal.forgecraft.crafting.registery;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreIngredient;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
import nmd.primal.forgecraft.init.ModItems;
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public final class RecipesWorkbench {
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<WorkbenchCrafting> event) {
PrimalAPI.logger(7, "Registering Recipes: " + WorkbenchCrafting.RECIPE_PREFIX);
final IForgeRegistry<WorkbenchCrafting> recipes = event.getRegistry();
/***COPPER***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.copperaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperaxe, 1)).setRecipeName("copperaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.copperaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperaxehead, 1)).setRecipeName("copperaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.copperhoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperhoe, 1)).setRecipeName("copperhoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.copperhoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperhoehead, 1)).setRecipeName("copperhoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.copperpickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperpickaxe, 1)).setRecipeName("copperpickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.copperpickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.copperpickaxehead, 1)).setRecipeName("copperpickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.coppershovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.coppershovel, 1)).setRecipeName("coppershovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.coppershovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.coppershovelhead, 1)).setRecipeName("coppershovelsplit"));
/***BRONZE***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.bronzeaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzeaxe, 1)).setRecipeName("bronzeaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.bronzeaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzeaxehead, 1)).setRecipeName("bronzeaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.bronzehoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzehoe, 1)).setRecipeName("bronzehoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.bronzehoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzehoehead, 1)).setRecipeName("bronzehoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.bronzepickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzepickaxe, 1)).setRecipeName("bronzepickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.bronzepickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzepickaxehead, 1)).setRecipeName("bronzepickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.bronzeshovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzeshovel, 1)).setRecipeName("bronzeshovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.bronzeshovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.bronzeshovelhead, 1)).setRecipeName("bronzeshovelsplit"));
/***iron***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.ironaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironaxe, 1)).setRecipeName("ironaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.ironaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironaxehead, 1)).setRecipeName("ironaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.ironhoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironhoe, 1)).setRecipeName("ironhoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.ironhoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironhoehead, 1)).setRecipeName("ironhoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.pickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironpickaxe, 1)).setRecipeName("ironpickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.ironpickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.pickaxehead, 1)).setRecipeName("ironpickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.ironshovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironshovel, 1)).setRecipeName("ironshovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.ironshovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.ironshovelhead, 1)).setRecipeName("ironshovelsplit"));
/***cleaniron***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.cleanironaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironaxe, 1)).setRecipeName("cleanironaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironaxehead, 1)).setRecipeName("cleanironaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.cleanironhoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironhoe, 1)).setRecipeName("cleanironhoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironhoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironhoehead, 1)).setRecipeName("cleanironhoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.cleanironpickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironpickaxe, 1)).setRecipeName("cleanironpickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironpickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironpickaxehead, 1)).setRecipeName("cleanironpickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.cleanironshovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironshovel, 1)).setRecipeName("cleanironshovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironshovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.cleanironshovelhead, 1)).setRecipeName("cleanironshovelsplit"));
/***steel***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.steelaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelaxe, 1)).setRecipeName("steelaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelaxehead, 1)).setRecipeName("steelaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.steelhoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelhoe, 1)).setRecipeName("steelhoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelhoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelhoehead, 1)).setRecipeName("steelhoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.steelpickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelpickaxe, 1)).setRecipeName("steelpickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelpickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelpickaxehead, 1)).setRecipeName("steelpickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.steelshovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelshovel, 1)).setRecipeName("steelshovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelshovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.steelshovelhead, 1)).setRecipeName("steelshovelsplit"));
/***wootz***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.wootzaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzaxe, 1)).setRecipeName("wootzaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzaxehead, 1)).setRecipeName("wootzaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.wootzhoehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzhoe, 1)).setRecipeName("wootzhoe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzhoe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzhoehead, 1)).setRecipeName("wootzhoesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.wootzpickaxehead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzpickaxe, 1)).setRecipeName("wootzpickaxe"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzpickaxe, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzpickaxehead, 1)).setRecipeName("wootzpickaxesplit"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("stickTreatedWood"),
Ingredient.fromStacks(new ItemStack(ModItems.wootzshovelhead, 1)),
new OreIngredient("pinBasic"),
Ingredient.EMPTY,
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzshovel, 1)).setRecipeName("wootzshovel"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzshovel, 1, OreDictionary.WILDCARD_VALUE)),
new OreIngredient("toolGallagher"),
new ItemStack(ModItems.wootzshovelhead, 1)).setRecipeName("wootzshovelsplit"));
/*********WEAPONS********/
/***GLADIUS***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawcoppergladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.coppergladius, 1)).setRecipeName("coppergladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.coppergladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawcoppergladius, 1)).setRecipeName("rawcoppergladius"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawbronzegladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.bronzegladius, 1)).setRecipeName("bronzegladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.bronzegladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawbronzegladius, 1)).setRecipeName("rawbronzegladius"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawwroughtirongladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.wroughtirongladius, 1)).setRecipeName("wroughtirongladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wroughtirongladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawwroughtirongladius, 1)).setRecipeName("rawwroughtirongladius"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawcleanirongladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.cleanirongladius, 1)).setRecipeName("cleanirongladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanirongladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawcleanirongladius, 1)).setRecipeName("rawcleanirongladius"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawsteelgladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.steelgladius, 1)).setRecipeName("steelgladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelgladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawsteelgladius, 1)).setRecipeName("rawsteelgladius"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawwootzgladius, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.wootzgladius, 1)).setRecipeName("wootzgladius"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzgladius, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawwootzgladius, 1)).setRecipeName("rawwootzgladius"));
/***LONGSWORD***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawcleanironlongsword, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.cleanironlongsword, 1)).setRecipeName("cleanironlongsword"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironlongsword, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawcleanironlongsword, 1)).setRecipeName("rawcleanironlongsword"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawsteellongsword, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.steellongsword, 1)).setRecipeName("steellongsword"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steellongsword, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawsteellongsword, 1)).setRecipeName("rawsteellongsword"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawwootzlongsword, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.wootzlongsword, 1)).setRecipeName("wootzlongsword"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzlongsword, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawwootzlongsword, 1)).setRecipeName("rawwootzlongsword"));
/***SLAYER***/
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawironslayer, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.wroughtironslayer, 1)).setRecipeName("ironslayer"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wroughtironslayer, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawironslayer, 1)).setRecipeName("rawironslayer"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawcleanironslayer, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.cleanironslayer, 1)).setRecipeName("cleanironslayer"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.cleanironslayer, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawcleanironslayer, 1)).setRecipeName("rawcleanironslayer"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawsteelslayer, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.steelslayer, 1)).setRecipeName("steelslayer"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.steelslayer, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawsteelslayer, 1)).setRecipeName("rawsteelslayer"));
recipes.register (new WorkbenchCrafting(
new OreIngredient("cordageGeneral"),
Ingredient.fromStacks(new ItemStack(ModItems.rawwootzslayer, 1)),
Ingredient.EMPTY,
Ingredient.EMPTY,
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.wootzslayer, 1)).setRecipeName("wootzslayer"));
recipes.register (new WorkbenchCrafting(
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.EMPTY,
Ingredient.fromStacks(new ItemStack(ModItems.wootzslayer, 1)),
new OreIngredient("toolWorkBlade"),
new ItemStack(ModItems.rawwootzslayer, 1)).setRecipeName("rawwootzslayer"));
}
}

View File

@@ -2,44 +2,40 @@ package nmd.primal.forgecraft.init;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.blocks.Anvil.AnvilBase;
import nmd.primal.forgecraft.blocks.Anvil.AnvilIron;
import nmd.primal.forgecraft.blocks.Anvil.AnvilStone;
import nmd.primal.forgecraft.blocks.*;
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot;
import nmd.primal.forgecraft.items.ForgeHammer;
import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.blocks.AnvilStone;
import nmd.primal.forgecraft.blocks.Chisel;
import nmd.primal.forgecraft.blocks.NBTCrucible;
import nmd.primal.forgecraft.blocks.YewStave;
import nmd.primal.forgecraft.blocks.machine.*;
/**
* Created by kitsu on 11/26/2016.
*/
public class ModBlocks {
public static Block nbtCrucible;
public static Block forge_brick;
public static Block forge_adobe;
public static Block bloomery_brick;
public static Block bloomery_adobe;
public static Block blockbreaker;
public static Block castingform;
public static Block castingblock;
public static Block bronzechisel;
public static Block copperchisel;
public static Block ironchisel;
public static Block cleanironchisel;
public static Block steelchisel;
public static Block wootzchisel;
public static Block pistonbellowsoak;
public static Block pistonbellowsjungle;
@@ -48,83 +44,30 @@ public class ModBlocks {
public static Block pistonbellowsdarkoak;
public static Block pistonbellowsacacia;
public static Block emptycrucible;
public static Block emptycruciblehot;
public static Block emptycruciblecracked;
public static Block emptycruciblecrackedhot;
public static Block rawbronzecrucible;
public static Block hotbronzecrucible;
public static Block hotcookedbronzecrucible;
public static Block rawbronzecrucible_redstone;
public static Block hotbronzecrucible_redstone;
public static Block hotcookedbronzecrucible_redstone;
public static Block rawbronzecrucible_lapis;
public static Block hotbronzecrucible_lapis;
public static Block hotcookedbronzecrucible_lapis;
public static Block rawbronzecrucible_diamond;
public static Block hotbronzecrucible_diamond;
public static Block hotcookedbronzecrucible_diamond;
public static Block rawbronzecrucible_emerald;
public static Block hotbronzecrucible_emerald;
public static Block hotcookedbronzecrucible_emerald;
public static Block rawironcrucible;
public static Block hotironcrucible;
public static Block hotcookedironcrucible;
public static Block coolironcrucible;
public static Block failedironcrucible;
public static Block failedironcruciblehot;
public static Block rawcleanironcrucible;
public static Block hotcleanironcrucible;
public static Block hotcookedcleanironcrucible;
public static Block coolcleanironcrucible;
public static Block failedcleanironcrucible;
public static Block failedcleanironcruciblehot;
public static Block rawsteelcrucible;
public static Block hotsteelcrucible;
public static Block hotcookedsteelcrucible;
public static Block coolsteelcrucible;
public static Block failedsteelcrucible;
public static Block failedsteelcruciblehot;
public static Block rawwootzcrucible;
public static Block hotwootzcrucible;
public static Block hotcookedwootzcrucible;
public static Block coolwootzcrucible;
public static Block failedwootzcrucible;
public static Block failedwootzcruciblehot;
public static Block ironball;
public static Block ironchunk;
public static Block ironcleanball;
public static Block ironcleanchunk;
public static Block steelball;
public static Block steelchunk;
public static Block wootzball;
public static Block wootzchunk;
public static Block stoneanvil;
public static Block ironanvil;
public static Block yewstave;
public static Block workbench;
public static Block sharpbench;
public static Block yewstave;
public static void init() {
nbtCrucible = new NBTCrucible(Material.ROCK, "nbtcrucible");
forge_brick = new Forge(Material.ROCK, "forge_brick", 5000);
forge_adobe = new Forge(Material.ROCK, "forge_adobe", 5000);
bloomery_brick = new BloomeryBase(Material.ROCK, "bloomery_brick", 5000);
bloomery_adobe = new BloomeryBase(Material.ROCK, "bloomery_adobe", 5000);
blockbreaker = new Breaker(Material.WOOD, "blockbreaker", 4.0f);
castingform = new CastingForm(Material.WOOD, "castingform");
castingblock = new CastingBlock(Material.ROCK, "castingblock");
copperchisel = new Chisel(Material.IRON, "copperchisel", PrimalAPI.ToolMaterials.TOOL_COPPER);
bronzechisel = new Chisel(Material.IRON, "bronzechisel", PrimalAPI.ToolMaterials.TOOL_BRONZE);
ironchisel = new Chisel(Material.IRON, "ironchisel", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
cleanironchisel = new Chisel(Material.IRON, "cleanironchisel", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON);
steelchisel = new Chisel(Material.IRON, "steelchisel", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL);
wootzchisel = new Chisel(Material.IRON, "wootzchisel", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
pistonbellowsoak = new PistonBellows(Material.WOOD, "pistonbellowsoak");
pistonbellowsjungle = new PistonBellows(Material.WOOD, "pistonbellowsjungle");
@@ -133,386 +76,62 @@ public class ModBlocks {
pistonbellowsdarkoak = new PistonBellows(Material.WOOD, "pistonbellowsdarkoak");
pistonbellowsacacia = new PistonBellows(Material.WOOD, "pistonbellowsacacia");
emptycrucible = new Crucible(Material.ROCK, "emptycrucible");
emptycruciblehot = new CrucibleHot(Material.ROCK, "emptycruciblehot");
emptycruciblecracked = new Crucible(Material.ROCK, "emptycruciblecracked");
emptycruciblecrackedhot = new CrucibleHot(Material.ROCK, "emptycruciblecrackedhot");
rawbronzecrucible = new Crucible(Material.ROCK, "rawbronzecrucible");
hotbronzecrucible = new CrucibleHot(Material.ROCK, "hotbronzecrucible");
hotcookedbronzecrucible = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible");
rawbronzecrucible_redstone = new Crucible(Material.ROCK, "rawbronzecrucible_redstone");
hotbronzecrucible_redstone = new CrucibleHot(Material.ROCK, "hotbronzecrucible_redstone");
hotcookedbronzecrucible_redstone = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_redstone");
rawbronzecrucible_diamond = new Crucible(Material.ROCK, "rawbronzecrucible_diamond");
hotbronzecrucible_diamond = new CrucibleHot(Material.ROCK, "hotbronzecrucible_diamond");
hotcookedbronzecrucible_diamond = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_diamond");
rawbronzecrucible_lapis = new Crucible(Material.ROCK, "rawbronzecrucible_lapis");
hotbronzecrucible_lapis = new CrucibleHot(Material.ROCK, "hotbronzecrucible_lapis");
hotcookedbronzecrucible_lapis = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_lapis");
rawbronzecrucible_emerald = new Crucible(Material.ROCK, "rawbronzecrucible_emerald");
hotbronzecrucible_emerald = new CrucibleHot(Material.ROCK, "hotbronzecrucible_emerald");
hotcookedbronzecrucible_emerald = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_emerald");
rawironcrucible = new Crucible(Material.ROCK, "rawironcrucible");
hotironcrucible = new CrucibleHot(Material.ROCK, "hotironcrucible");
hotcookedironcrucible = new CrucibleHot(Material.ROCK, "hotcookedironcrucible");
coolironcrucible = new Crucible(Material.ROCK, "coolironcrucible");
failedironcrucible = new Crucible(Material.ROCK, "failedironcrucible");
failedironcruciblehot = new CrucibleHot(Material.ROCK, "failedironcruciblehot");
rawcleanironcrucible = new Crucible(Material.ROCK, "rawcleanironcrucible");
hotcleanironcrucible = new CrucibleHot(Material.ROCK, "hotcleanironcrucible");
hotcookedcleanironcrucible = new CrucibleHot(Material.ROCK, "hotcookedcleanironcrucible");
coolcleanironcrucible = new Crucible(Material.ROCK, "coolcleanironcrucible");
failedcleanironcrucible = new Crucible(Material.ROCK, "failedcleanironcrucible");
failedcleanironcruciblehot = new Crucible(Material.ROCK, "failedcleanironcruciblehot");
rawsteelcrucible = new Crucible(Material.ROCK, "rawsteelcrucible");
hotsteelcrucible = new CrucibleHot(Material.ROCK, "hotsteelcrucible");
hotcookedsteelcrucible = new CrucibleHot(Material.ROCK, "hotcookedsteelcrucible");
coolsteelcrucible = new Crucible(Material.ROCK, "coolsteelcrucible");
failedsteelcrucible = new Crucible(Material.ROCK, "failedsteelcrucible");
failedsteelcruciblehot = new Crucible(Material.ROCK, "failedsteelcruciblehot");
rawwootzcrucible = new Crucible(Material.ROCK, "rawwootzcrucible");
hotwootzcrucible = new CrucibleHot(Material.ROCK, "hotwootzcrucible");
hotcookedwootzcrucible = new CrucibleHot(Material.ROCK, "hotcookedwootzcrucible");
coolwootzcrucible = new Crucible(Material.ROCK, "coolwootzcrucible");
failedwootzcrucible = new Crucible(Material.ROCK, "failedwootzcrucible");
failedwootzcruciblehot = new Crucible(Material.ROCK, "failedwootzcruciblehot");
ironball = new IngotBall(Material.IRON, "ironball", 5.0F, "ingot") {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating");
if (pItem instanceof WorkMallet && world.getBlockState(belowPos).getBlock().equals(Blocks.STONE)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.stoneanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}
/*if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}*/
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.ironchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.ironchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
};
ironcleanball = new IngotBall(Material.IRON, "ironcleanball", 5.0f, "ingot") {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
//System.out.println("Level 0");
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating1");
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//System.out.println("Activating");
return true;
}
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.ironcleanchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.ironcleanchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
}; // clean_iron_ingot ironcleanball.json ironcleanballhot.json - done
steelball = new IngotBall(Material.IRON, "steelball", 6.0f, "ingot"){
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating");
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.steelchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.steelchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
}; // steel_ingot steelball.json steelballhot.json
wootzball = new IngotBall(Material.IRON, "wootzball", 6.0f, "ingot") {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz)
{
if(!world.isRemote){
Item pItem = player.getHeldItem(hand).getItem();
BlockPos belowPos = pos.down();
//System.out.println("Activating");
if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2);
world.playEvent(1031, pos, 0);
//CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1));
return true;
}
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
if (tile.getSlotStack(6).isEmpty() &&
tile.getSlotStack(7).isEmpty() &&
tile.getSlotStack(8).isEmpty() &&
tile.getSlotStack(11).isEmpty() &&
tile.getSlotStack(12).isEmpty() &&
tile.getSlotStack(13).isEmpty() &&
tile.getSlotStack(16).isEmpty() &&
tile.getSlotStack(17).isEmpty() &&
tile.getSlotStack(18).isEmpty()
) {
player.swingArm(hand);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
tile.setSlotStack(6, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(7, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(8, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(11, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(12, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(13, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(16, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(17, new ItemStack(ModItems.wootzchunkhot, 1));
tile.setSlotStack(18, new ItemStack(ModItems.wootzchunkhot, 1));
world.playEvent(1031, pos, 0);
return true;
}
}
}
}
return false;
}
}; //wootz_ingot wootzball.json wootzballhot.json
ironchunk = new IngotBall(Material.IRON, "ironchunk", 5.0F, "chunk");
ironcleanchunk = new IngotBall(Material.IRON, "ironcleanchunk", 5.0F, "chunk"); //Lyle to make assets clean_iron_ingot, blockstate\ironcleanchunk.json, item\ironcleanchunk.json, item\ironcleanchunkhot.json - done
steelchunk = new IngotBall(Material.IRON, "steelchunk", 6.0f, "chunk"); //steel_ingot steelchunk.json steelchunkhot.json - done
wootzchunk = new IngotBall(Material.IRON, "wootzchunk", 6.0f, "chunk"); //wootz_ingot wootzchunk.json wootzchunkhot.json - done
stoneanvil = new AnvilStone(Material.ANVIL, "stoneanvil", 5.0f, true);
ironanvil = new AnvilIron(Material.ANVIL, "ironanvil", 6.0f, true);
//ironballitemcool = new ItemBlockIngotBall(ironball);
//ironballitemhot = new ItemBlockIngotBall(ironball);
//ironanvil = new AnvilIron(Material.ANVIL, "ironanvil", 6.0f, true);
workbench = new Workbench(Material.WOOD, "toolbench");
sharpbench = new SharpBench(Material.WOOD, "sharpbench");
yewstave = new YewStave(Material.WOOD, "yewstave", 3.0F);
}
public static void register() {
registerBlock(forge_brick);
registerBlock(forge_adobe);
registerBlock(bloomery_brick);
registerBlock(bloomery_adobe);
registerBlock(blockbreaker);
registerBlock(castingform);
registerBlock(castingblock);
registerBlock(nbtCrucible);
registerBlockWithItem(forge_brick);
registerBlockWithItem(forge_adobe);
registerBlockWithItem(bloomery_brick);
registerBlockWithItem(bloomery_adobe);
registerBlockWithItem(blockbreaker);
registerBlockWithItem(castingform);
registerBlock(pistonbellowsoak);
registerBlock(pistonbellowsjungle);
registerBlock(pistonbellowsbirch);
registerBlock(pistonbellowsspruce);
registerBlock(pistonbellowsdarkoak);
registerBlock(pistonbellowsacacia);
registerBlockWithItem(copperchisel);
registerBlockWithItem(bronzechisel);
registerBlockWithItem(ironchisel);
registerBlockWithItem(cleanironchisel);
registerBlockWithItem(steelchisel);
registerBlockWithItem(wootzchisel);
registerBlock(emptycrucible);
registerBlock(emptycruciblehot);
registerBlock(emptycruciblecracked);
registerBlock(emptycruciblecrackedhot);
registerBlockWithItem(pistonbellowsoak);
registerBlockWithItem(pistonbellowsjungle);
registerBlockWithItem(pistonbellowsbirch);
registerBlockWithItem(pistonbellowsspruce);
registerBlockWithItem(pistonbellowsdarkoak);
registerBlockWithItem(pistonbellowsacacia);
registerBlock(rawbronzecrucible);
registerBlock(hotbronzecrucible);
registerBlock(hotcookedbronzecrucible);
registerBlockWithItem(stoneanvil);
//registerBlockWithItem(ironanvil);
registerBlock(rawbronzecrucible_diamond);
registerBlock(hotbronzecrucible_diamond);
registerBlock(hotcookedbronzecrucible_diamond);
registerBlockWithItem(workbench);
registerBlockWithItem(sharpbench);
registerBlock(rawbronzecrucible_emerald);
registerBlock(hotbronzecrucible_emerald);
registerBlock(hotcookedbronzecrucible_emerald);
registerBlock(rawbronzecrucible_redstone);
registerBlock(hotbronzecrucible_redstone);
registerBlock(hotcookedbronzecrucible_redstone);
registerBlock(rawbronzecrucible_lapis);
registerBlock(hotbronzecrucible_lapis);
registerBlock(hotcookedbronzecrucible_lapis);
registerBlock(rawironcrucible);
registerBlock(hotironcrucible);
registerBlock(hotcookedironcrucible);
registerBlock(coolironcrucible);
registerBlock(failedironcrucible);
registerBlock(failedironcruciblehot);
registerBlock(rawcleanironcrucible);
registerBlock(hotcleanironcrucible);
registerBlock(hotcookedcleanironcrucible);
registerBlock(coolcleanironcrucible);
registerBlock(failedcleanironcrucible);
registerBlock(failedcleanironcruciblehot);
registerBlock(rawsteelcrucible);
registerBlock(hotsteelcrucible);
registerBlock(hotcookedsteelcrucible);
registerBlock(coolsteelcrucible);
registerBlock(failedsteelcrucible);
registerBlock(failedsteelcruciblehot);
registerBlock(rawwootzcrucible);
registerBlock(hotwootzcrucible);
registerBlock(hotcookedwootzcrucible);
registerBlock(coolwootzcrucible);
registerBlock(failedwootzcrucible);
registerBlock(failedwootzcruciblehot);
registerBlock(ironball);
registerBlock(ironchunk);
registerBlock(ironcleanball);
registerBlock(ironcleanchunk);
registerBlock(steelball);
registerBlock(steelchunk);
registerBlock(wootzball);
registerBlock(wootzchunk);
//registerBlockSubType(ironball, ironballitemcool, "ironcool");
//registerBlockSubType(ironball, ironballitemhot, "ironhot");
registerBlock(stoneanvil);
registerBlock(ironanvil);
registerBlock(yewstave);
registerBlockWithItem(yewstave);
}
@SideOnly(Side.CLIENT)
public static void registerRenders() {
//registerRender(nbtCrucible);
registerRender(forge_brick);
registerRender(forge_adobe);
registerRender(castingform);
registerRender(castingblock);
registerRender(copperchisel);
registerRender(bronzechisel);
registerRender(ironchisel);
registerRender(cleanironchisel);
registerRender(steelchisel);
registerRender(wootzchisel);
registerRender(blockbreaker);
registerRender(pistonbellowsoak);
@@ -525,99 +144,57 @@ public class ModBlocks {
registerRender(bloomery_brick);
registerRender(bloomery_adobe);
registerRender(emptycrucible);
registerRender(emptycruciblehot);
registerRender(emptycruciblecracked);
registerRender(emptycruciblecrackedhot);
registerRender(rawbronzecrucible);
registerRender(hotbronzecrucible);
registerRender(hotcookedbronzecrucible);
registerRender(rawbronzecrucible_diamond);
registerRender(hotbronzecrucible_diamond);
registerRender(hotcookedbronzecrucible_diamond);
registerRender(rawbronzecrucible_emerald);
registerRender(hotbronzecrucible_emerald);
registerRender(hotcookedbronzecrucible_emerald);
registerRender(rawbronzecrucible_redstone);
registerRender(hotbronzecrucible_redstone);
registerRender(hotcookedbronzecrucible_redstone);
registerRender(rawbronzecrucible_lapis);
registerRender(hotbronzecrucible_lapis);
registerRender(hotcookedbronzecrucible_lapis);
registerRender(rawironcrucible);
registerRender(hotironcrucible);
registerRender(hotcookedironcrucible);
registerRender(coolironcrucible);
registerRender(failedironcrucible);
registerRender(failedironcruciblehot);
registerRender(rawcleanironcrucible);
registerRender(hotcleanironcrucible);
registerRender(hotcookedcleanironcrucible);
registerRender(coolcleanironcrucible);
registerRender(failedcleanironcrucible);
registerRender(failedcleanironcruciblehot);
registerRender(rawsteelcrucible);
registerRender(hotsteelcrucible);
registerRender(hotcookedsteelcrucible);
registerRender(coolsteelcrucible);
registerRender(failedsteelcrucible);
registerRender(failedsteelcruciblehot);
registerRender(rawwootzcrucible);
registerRender(hotwootzcrucible);
registerRender(hotcookedwootzcrucible);
registerRender(coolwootzcrucible);
registerRender(failedwootzcrucible);
registerRender(failedwootzcruciblehot);
registerRender(ironball);
registerRender(ironchunk);
registerRender(ironcleanball);
registerRender(ironcleanchunk);
registerRender(steelball);
registerRender(steelchunk);
registerRender(wootzball);
registerRender(wootzchunk);
//registerRenderCustom(ironballitemcool, 0, new ModelResourceLocation(ironballitemcool.getUnlocalizedName()));
//registerRenderCustom(ironballitemhot, 1, new ModelResourceLocation(ironballitemhot.getUnlocalizedName()));
registerRender(stoneanvil);
registerRender(ironanvil);
//registerRender(ironanvil);
registerRender(workbench);
registerRender(sharpbench);
registerRender(yewstave);
}
private static void registerBlock(Block block) {
GameRegistry.register(block);
private static void registerBlockWithItem(Block block)
{
ForgeRegistries.BLOCKS.register(block);
//GameRegistry.register(block);
ItemBlock item = new ItemBlock(block);
item.setRegistryName(block.getRegistryName());
GameRegistry.register(item);
ForgeRegistries.ITEMS.register(item);
//GameRegistry.register(item);
}
private static void registerBlockSubType(Block block, ItemBlock itemBlock, String registryName){
GameRegistry.register(block);
ItemBlock item = itemBlock;
private static void registerBlock(Block block)
{
ForgeRegistries.BLOCKS.register(block);
//GameRegistry.register(block);
//ItemBlock item = new ItemBlock(block);
//item.setRegistryName(block.getRegistryName());
//ForgeRegistries.ITEMS.register(item);
//GameRegistry.register(item);
}
private static void registerBlockSubType(Block block, ItemBlock item, String registryName)
{
ForgeRegistries.BLOCKS.register(block);
//GameRegistry.register(block);
item.setRegistryName(registryName);
GameRegistry.register(item);
ForgeRegistries.ITEMS.register(item);
//GameRegistry.register(item);
}
private static void registerRender(Block block) {
private static void registerRender(Block block)
{
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
}
private static void registerRenderCustom(ItemBlock item, Integer meta, ModelResourceLocation model){
private static void registerRenderCustom(ItemBlock item, Integer meta, ModelResourceLocation model)
{
ModelLoader.setCustomModelResourceLocation(item, meta, model);
}

View File

@@ -1,47 +1,72 @@
package nmd.primal.forgecraft.init;
import net.minecraftforge.common.config.Config;
import nmd.primal.forgecraft.ForgeCraft;
import nmd.primal.forgecraft.ModInfo;
@Config(modid = ModInfo.MOD_ID, name = ModInfo.MOD_CONFIG, category = "")
@Config.LangKey("forgecraft.config.title")
@SuppressWarnings("unused")
public class ModConfig
public final class ModConfig
{
static {
ForgeCraft.LOGGER.info("Loading Config File: " + ModInfo.MOD_CONFIG + ".cfg");
}
//static {
// ForgeCraft.LOGGER.info("Loading Config File: " + ModInfo.MOD_CONFIG + ".cfg");
//}
/**
* Main Config Sections
*/
public static Compatibility compatibility;
public static ModConfig.Features features;
public static Features features;
/**
* Options related to compatibility with mods and vanilla features
*/
public static class Compatibility
{
@Config.Comment({"Ore Dictionary Wootz steel for compatibility with common mod steel"})
public static boolean COMPAT_DICTIONARY_WOOTZ_STEEL;
@Config.Comment({"Ore Dictionary Wrought Iron to common Iron"})
public static boolean COMPAT_DICTIONARY_WROUGHT_IRON = true;
//@Config.Comment({"Ore Dictionary Damascus Steel to common Steel"})
//public static boolean COMPAT_DICTIONARY_DAMASCUS_STEEL = true;
}
/**
* Customize main features of the mod
*/
public static class Features
{
@Config.Comment({"Smoke is produced from various forge blocks when active"})
public static boolean FEATURE_ENABLE_SMOKE = true;
// @Config.RequiresMcRestart
// @Config.Comment({"Config to allow or dissallow Copper Tools"})
// public static boolean ENABLE_COPPER_TOOLS = false;
@Config.RequiresMcRestart
@Config.Comment({"Various forge blocks will set fire to their surroundings when active"})
public static boolean FEATURE_ENABLE_FIRE = true;
@Config.Comment({"Sample config for a numeric range"})
@Config.RangeInt(min = 0, max = 1000)
public static int FEATURE_HEAT_RANGE = 0;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
package nmd.primal.forgecraft.init;
import net.minecraft.init.Items;
import net.minecraftforge.oredict.OreDictionary;
import static nmd.primal.forgecraft.init.ModConfig.Compatibility.COMPAT_DICTIONARY_WROUGHT_IRON;
/**
* Created by mminaie on 2/7/17.
*/
public class ModDictionary {/*******************************************************************************
* Register Only Vanilla OreDictionary Entries Here
* Mod Items/Blocks have their names added through the respective
* registration methods as a list of comma delineated strings.
*
* EXAMPLE:
* LEATHER_CORDAGE = registerItem(new PrimalItem("leather_cordage"), "cordageGeneral, cordageLeather");
*
*/
public static void registerDictionaryNames()
{
OreDictionary.registerOre("ingotBronze", ModItems.bronzeingotball);
OreDictionary.registerOre("nuggetBronze", ModItems.bronzechunk);
if(COMPAT_DICTIONARY_WROUGHT_IRON) {
OreDictionary.registerOre("ingotIron", ModItems.ironingotball);
OreDictionary.registerOre("nuggetIron", ModItems.wroughtironchunk);
}
OreDictionary.registerOre("ingotIron", ModItems.ironcleaningotball);
OreDictionary.registerOre("nuggetIron", ModItems.ironcleanchunk);
OreDictionary.registerOre("ingotSteel", ModItems.steelingotball);
OreDictionary.registerOre("nuggetSteel", ModItems.steelchunk);
OreDictionary.registerOre("ingotBronze", ModItems.bronzeingotball);
OreDictionary.registerOre("nuggetBronze", ModItems.bronzechunk);
//if(COMPAT_DICTIONARY_DAMASCUS_STEEL) {
OreDictionary.registerOre("ingotWootz", ModItems.wootzingotball);
OreDictionary.registerOre("nuggetWootz", ModItems.wootzchunk);
//}
OreDictionary.registerOre("dustBlaze", Items.BLAZE_POWDER);
}
}

View File

@@ -0,0 +1,78 @@
package nmd.primal.forgecraft.init;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.fluids.BasicFluidBlockKFC;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;
import static nmd.primal.core.common.helper.RegistryHelper.registerFluidBlock;
import static nmd.primal.core.common.helper.RegistryHelper.registerFluidItems;
public class ModFluids {
public static Fluid HOLY_WATER;
public static final Set<IFluidBlock> FLUID_BLOCKS = new HashSet<>();
// ***************************************************************************** //
// Fluid Registration
// ***************************************************************************** //
@Mod.EventBusSubscriber(modid= ModInfo.MOD_ID)
public static class RegistrationHandler
{
/**
* Register this mod's fluid {@link Block}s.
* @param event The event
*/
@SubscribeEvent
public static void registryFluidBlocks(final RegistryEvent.Register<Block> event)
{
final IForgeRegistry<Block> registry = event.getRegistry();
/*registerFluidBlock(registry,
HOLY_WATER = createFluid("holy_water", 0xFFEDF1F5, true,
fluid -> fluid.setDensity(1000).setViscosity(1000).setTemperature(100).setLuminosity(5).setGaseous(false),
fluid -> new BasicFluidBlockKFC(fluid, Material.WATER)));
*/
}
/**
* Register this mod's fluid {@link ItemBlock}s.
* @param event The event
*/
// Use EventPriority.LOWEST so this is called after the RegistryEvent.Register<Item> handler in ModBlocks where
// the ItemBlock for ModBlocks.FLUID_TANK is registered.
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void registryFluidItems(final RegistryEvent.Register<Item> event)
{
final IForgeRegistry<Item> registry = event.getRegistry();
registerFluidItems(registry, FLUID_BLOCKS);
}
}
// ***************************************************************************** //
// Registry Overrides
// ***************************************************************************** //
private static <T extends Block & IFluidBlock> Fluid createFluid(String name, int color, boolean hasFlowIcon, Consumer<Fluid> fluidPropertyApplier, Function<Fluid, T> blockFactory)
{
return nmd.primal.core.common.helper.RegistryHelper.createFluid(name, ModInfo.MOD_ID, FLUID_BLOCKS, color, hasFlowIcon, fluidPropertyApplier, blockFactory);
}
}

View File

@@ -1,58 +1,70 @@
package nmd.primal.forgecraft.init;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalMaterials;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.items.*;
import nmd.primal.forgecraft.items.armor.CustomLeggings;
import nmd.primal.forgecraft.items.casting.CastingPart;
import nmd.primal.forgecraft.items.parts.BronzeToolPart;
import nmd.primal.forgecraft.items.armor.CustomHelmet;
import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.items.tools.*;
import nmd.primal.forgecraft.items.weapons.CustomShield;
import nmd.primal.forgecraft.items.weapons.CustomSword;
import nmd.primal.forgecraft.items.weapons.Longbow;
import nmd.primal.forgecraft.items.weapons.SlayerSword;
import nmd.primal.forgecraft.items.parts.WeaponPart;
import nmd.primal.forgecraft.items.tools.CustomAxe;
import nmd.primal.forgecraft.items.tools.CustomHoe;
import nmd.primal.forgecraft.items.tools.CustomPickaxe;
import nmd.primal.forgecraft.items.tools.CustomShovel;
import nmd.primal.forgecraft.items.weapons.*;
/**
* Created by kitsu on 11/26/2016.
*/
public class ModItems {
//public static Item test;
public static Item itemnbtcrucible;
public static Item slottedtongs;
// public static Item itemcrucible;
public static Item bellowshandle;
public static Item forgehammer;
public static Item softcrucible;
public static Item stonetongs;
//public static Item stonetongs;
public static Item castingmud;
public static Item ironingotballhot;
public static Item ironchunkhot;
public static Item ironcleaningotballhot;
public static Item ironcleanchunkhot;
public static Item steelingotballhot;
public static Item steelchunkhot;
public static Item wootzingotballhot;
public static Item wootzchunkhot;
public static Item grindingwheel;
public static Item cast_axe;
public static Item cast_gladius;
public static Item cast_hoe;
public static Item cast_pickaxe;
public static Item cast_shovel;
public static Item bronzeingotball;
public static Item bronzechunk;
public static Item ironingotball;
public static Item wroughtironchunk;
public static Item ironcleaningotball;
public static Item ironcleanchunk;
public static Item steelingotball;
public static Item steelchunk;
public static Item wootzingotball;
public static Item wootzchunk;
public static Item ironsledgehammer;
public static Item coppersledgehammer;
public static Item bronzesledgehammer;
public static Item cleanironsledgehammer;
public static Item steelsledgehammer;
public static Item wootzsledgehammer;
public static Item copperpickaxehead;
public static Item copperaxehead;
public static Item coppershovelhead;
public static Item copperhoehead;
public static Item copperpickaxe;
public static Item copperaxe;
public static Item coppershovel;
public static Item copperhoe;
public static Item pickaxehead;
@@ -106,18 +118,39 @@ public class ModItems {
public static Item wootzshovel;
public static Item wootzhoe;
public static Item rawbronzegladius;
public static Item rawcoppergladius;
public static Item rawwroughtirongladius;
public static Item rawcleanirongladius;
public static Item rawsteelgladius;
public static Item rawwootzgladius;
public static Item rawcleanironlongsword ;
public static Item rawsteellongsword;
public static Item rawwootzlongsword;
public static Item rawironslayer;
public static Item rawcleanironslayer;
public static Item rawsteelslayer;
public static Item rawwootzslayer;
public static Item coppergladius;
public static Item bronzegladius;
public static Item wroughtirongladius;
public static Item cleanirongladius;
public static Item steelgladius;
public static Item wootzgladius;
public static Item cleanironlongsword;
public static Item steellongsword;
public static Item wootzlongsword;
public static Item wroughtironslayer;
public static Item cleanironslayer;
public static Item steelslayer;
public static Item wootzslayer;
public static Item brokencoppertool;
public static Item brokenbronzetool;
public static Item brokenwroughtirontool;
public static Item brokencleanirontool;
@@ -133,124 +166,163 @@ public class ModItems {
public static Item rawlongbow;
public static Item unstrunglongbow;
public static Item longbow;
public static Item wootzworkblade;
public static Item leatherhelmet;
//public static Item testleggings;
//public static Item forgingmanual;
public static void init() {
//OBJLoader.INSTANCE.addDomain(ModInfo.MOD_ID);
//pistonbellows = new ItemBellowsHandle("pistonbellows");
itemnbtcrucible = new ItemNBTCrucible("itemnbtcrucible", ModBlocks.nbtCrucible);
slottedtongs = new SlottedTongs("slottedtongs");
//itemcrucible = new ItemCrucible("itemcrucible");
bellowshandle = new BaseItem("bellowshandle");
softcrucible = new ItemSoftCrucible("softcrucible");
stonetongs = new ItemStoneTongs("stonetongs");
//stonetongs = new ItemStoneTongs("stonetongs");
forgehammer = new ForgeHammer("forgehammer");
castingmud = new BaseItem("castingmud");
rawlongbow = new BaseItem("rawlongbow");
rawlongbow = new RawLongbow("rawlongbow");
unstrunglongbow = new BaseItem("unstrunglongbow");
longbow = new Longbow("longbow");
//matchlockmusket = new Musket("matchlock_musket");
/**********
CASTING PARTS
**********/
cast_axe = new CastingPart("cast_axe");
cast_gladius = new CastingPart("cast_gladius");
cast_hoe = new CastingPart("cast_hoe");
cast_pickaxe = new CastingPart("cast_pickaxe");
cast_shovel = new CastingPart("cast_shovel");
wootzworkblade = new Workblade("wootzworkblade", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, -1.0F).setFireProof(true);
grindingwheel = new BaseSingleItem("grindingwheel", 9000);
/**********
TOOL PARTS
**********/
copperpickaxehead = new ToolPart("copperpickaxehead", PrimalAPI.ToolMaterials.TOOL_COPPER, "pickaxe");
copperaxehead = new ToolPart("copperaxehead", PrimalAPI.ToolMaterials.TOOL_COPPER, "axe");
coppershovelhead= new ToolPart("coppershovelhead", PrimalAPI.ToolMaterials.TOOL_COPPER, "shovel");
copperhoehead = new ToolPart("copperhoehead", PrimalAPI.ToolMaterials.TOOL_COPPER, "hoe");
bronzepickaxehead = new BronzeToolPart("bronzepickaxehead", PrimalMaterials.TOOL_BRONZE, 41);
bronzeaxehead = new BronzeToolPart("bronzeaxehead", PrimalMaterials.TOOL_BRONZE, 42);
bronzeshovelhead = new BronzeToolPart("bronzeshovelhead", PrimalMaterials.TOOL_BRONZE, 43);
bronzehoehead = new BronzeToolPart("bronzehoehead", PrimalMaterials.TOOL_BRONZE, 44);
bronzepickaxehead = new ToolPart("bronzepickaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "pickaxe");
bronzeaxehead = new ToolPart("bronzeaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "axe");
bronzeshovelhead = new ToolPart("bronzeshovelhead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "shovel");
bronzehoehead = new ToolPart("bronzehoehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "hoe");
pickaxehead = new ToolPart("ironpickaxehead", PrimalMaterials.TOOL_WROUGHT_IRON, 8);
ironaxehead = new ToolPart("ironaxehead", PrimalMaterials.TOOL_WROUGHT_IRON, 9);
ironshovelhead = new ToolPart("ironshovelhead", PrimalMaterials.TOOL_WROUGHT_IRON, 10);
ironhoehead = new ToolPart("ironhoehead", PrimalMaterials.TOOL_WROUGHT_IRON, 11);
pickaxehead = new ToolPart("ironpickaxehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "pickaxe");
ironaxehead = new ToolPart("ironaxehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "axe");
ironshovelhead = new ToolPart("ironshovelhead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "shovel");
ironhoehead = new ToolPart("ironhoehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "hoe");
cleanironpickaxehead = new ToolPart("cleanironpickaxehead", PrimalMaterials.TOOL_CLEAN_IRON, 17);
cleanironaxehead = new ToolPart("cleanironaxehead", PrimalMaterials.TOOL_CLEAN_IRON, 18);
cleanironshovelhead = new ToolPart("cleanironshovelhead", PrimalMaterials.TOOL_CLEAN_IRON, 19);
cleanironhoehead = new ToolPart("cleanironhoehead", PrimalMaterials.TOOL_CLEAN_IRON, 20);
cleanironpickaxehead = new ToolPart("cleanironpickaxehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "pickaxe");
cleanironaxehead = new ToolPart("cleanironaxehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "axe");
cleanironshovelhead = new ToolPart("cleanironshovelhead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "shovel");
cleanironhoehead = new ToolPart("cleanironhoehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "hoe");
steelpickaxehead = new ToolPart("steelpickaxehead", PrimalMaterials.TOOL_BASIC_STEEL, 26);
steelaxehead = new ToolPart("steelaxehead", PrimalMaterials.TOOL_BASIC_STEEL, 27);
steelshovelhead = new ToolPart("steelshovelhead", PrimalMaterials.TOOL_BASIC_STEEL, 28);
steelhoehead = new ToolPart("steelhoehead", PrimalMaterials.TOOL_BASIC_STEEL, 29);
steelpickaxehead = new ToolPart("steelpickaxehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "pickaxe");
steelaxehead = new ToolPart("steelaxehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "axe");
steelshovelhead = new ToolPart("steelshovelhead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "shovel");
steelhoehead = new ToolPart("steelhoehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "hoe");
wootzpickaxehead = new ToolPart("wootzpickaxehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "pickaxe");
wootzaxehead = new ToolPart("wootzaxehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "axe");
wootzshovelhead = new ToolPart("wootzshovelhead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "shovel");
wootzhoehead = new ToolPart("wootzhoehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "hoe");
wootzpickaxehead = new ToolPart("wootzpickaxehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 35);
wootzaxehead = new ToolPart("wootzaxehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 36);
wootzshovelhead = new ToolPart("wootzshovelhead", PrimalMaterials.TOOL_WOOTZ_STEEL, 37);
wootzhoehead = new ToolPart("wootzhoehead", PrimalMaterials.TOOL_WOOTZ_STEEL, 38);
/**********
TOOLS
**********/
bronzepickaxe = new BronzePickaxe("bronzepickaxe", PrimalMaterials.TOOL_BRONZE, bronzepickaxehead);
bronzeaxe = new BronzeAxe("bronzeaxe", PrimalMaterials.TOOL_BRONZE, bronzeaxehead);
bronzeshovel = new BronzeShovel("bronzeshovel", PrimalMaterials.TOOL_BRONZE, bronzeshovelhead);
bronzehoe = new BronzeHoe("bronzehoe", PrimalMaterials.TOOL_BRONZE, bronzehoehead);
copperpickaxe = new CustomPickaxe("copperpickaxe", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool);
copperaxe = new CustomAxe("copperaxe", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool, 4, -2.6F);
coppershovel = new CustomShovel("coppershovel", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool);
copperhoe = new CustomHoe("copperhoe", PrimalAPI.ToolMaterials.TOOL_COPPER, brokencoppertool);
coppersledgehammer = new SledgeHammer("coppersledgehammer", PrimalAPI.ToolMaterials.TOOL_COPPER, 12, -3.7D);
ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalMaterials.TOOL_WROUGHT_IRON, pickaxehead);
ironaxe = new CustomAxe("ironaxe", PrimalMaterials.TOOL_WROUGHT_IRON, ironaxehead);
ironshovel = new CustomShovel("ironshovel", PrimalMaterials.TOOL_WROUGHT_IRON, ironshovelhead);
ironhoe = new CustomHoe("ironhoe", PrimalMaterials.TOOL_WROUGHT_IRON, ironhoehead);
bronzepickaxe = new CustomPickaxe("bronzepickaxe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzepickaxehead);
bronzeaxe = new CustomAxe("bronzeaxe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzeaxehead, 5, -2.4f);
bronzeshovel = new CustomShovel("bronzeshovel", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzeshovelhead);
bronzehoe = new CustomHoe("bronzehoe", PrimalAPI.ToolMaterials.TOOL_BRONZE, bronzehoehead);
bronzesledgehammer = new SledgeHammer("bronzesledgehammer", PrimalAPI.ToolMaterials.TOOL_BRONZE, 12, -3.7D);
cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalMaterials.TOOL_CLEAN_IRON, cleanironpickaxehead);
cleanironaxe = new CustomAxe("cleanironaxe", PrimalMaterials.TOOL_CLEAN_IRON, cleanironaxehead);
cleanironshovel = new CustomShovel("cleanironshovel", PrimalMaterials.TOOL_CLEAN_IRON, cleanironshovelhead);
cleanironhoe = new CustomHoe("cleanironhoe", PrimalMaterials.TOOL_CLEAN_IRON, cleanironhoehead);
ironpickaxe = new CustomPickaxe("ironpickaxe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, pickaxehead);
ironaxe = new CustomAxe("ironaxe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironaxehead, 5, -3.6f);
ironshovel = new CustomShovel("ironshovel", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironshovelhead);
ironhoe = new CustomHoe("ironhoe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironhoehead);
ironsledgehammer = new SledgeHammer("ironsledgehammer", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 12, -3.7D);
steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalMaterials.TOOL_BASIC_STEEL, steelpickaxehead);
steelaxe = new CustomAxe("steelaxe", PrimalMaterials.TOOL_BASIC_STEEL, steelaxehead);
steelshovel = new CustomShovel("steelshovel", PrimalMaterials.TOOL_BASIC_STEEL, steelshovelhead);
steelhoe = new CustomHoe("steelhoe", PrimalMaterials.TOOL_BASIC_STEEL, steelhoehead);
cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironpickaxehead);
cleanironaxe = new CustomAxe("cleanironaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironaxehead, 6, -3.2f);
cleanironshovel = new CustomShovel("cleanironshovel", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironshovelhead);
cleanironhoe = new CustomHoe("cleanironhoe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironhoehead);
cleanironsledgehammer = new SledgeHammer("cleanironsledgehammer", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 12, -3.7D);
wootzpickaxe = new CustomPickaxe("wootzpickaxe", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzpickaxehead);
wootzaxe = new CustomAxe("wootzaxe", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzaxehead);
wootzshovel = new CustomShovel("wootzshovel", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzshovelhead);
wootzhoe = new CustomHoe("wootzhoe", PrimalMaterials.TOOL_WOOTZ_STEEL, wootzhoehead);
steelpickaxe = new CustomPickaxe("steelpickaxe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelpickaxehead);
steelaxe = new CustomAxe("steelaxe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelaxehead, 7, -2.8f);
steelshovel = new CustomShovel("steelshovel", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelshovelhead);
steelhoe = new CustomHoe("steelhoe", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, steelhoehead);
steelsledgehammer = new SledgeHammer("steelsledgehammer", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, 12, -3.5D);
wootzpickaxe = new CustomPickaxe("wootzpickaxe", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzpickaxehead);
wootzaxe = new CustomAxe("wootzaxe", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzaxehead, 8, -2.4f);
wootzshovel = new CustomShovel("wootzshovel", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzshovelhead);
wootzhoe = new CustomHoe("wootzhoe", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, wootzhoehead);
wootzsledgehammer = new SledgeHammer("wootzsledgehammer", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, 12, -3.4D);
/**********
WEAPONS
**********/
bronzegladius = new CustomSword("bronzegladius", PrimalMaterials.TOOL_BRONZE, 5D, 2D);
wroughtirongladius = new CustomSword("wroughtirongladius", PrimalMaterials.TOOL_WROUGHT_IRON, 4.5D, -1.85D);
cleanirongladius = new CustomSword("cleanirongladius", PrimalMaterials.TOOL_CLEAN_IRON, 5D, -1.85D);
steelgladius = new CustomSword("steelgladius", PrimalMaterials.TOOL_BASIC_STEEL,6D, -1.85D);
cleanironlongsword = new CustomSword("cleanironlongsword", PrimalMaterials.TOOL_CLEAN_IRON, 7D, -2.5D);
steellongsword = new CustomSword("steellongsword", PrimalMaterials.TOOL_BASIC_STEEL,8D, -2.25D);
rawbronzegladius = new WeaponPart("rawbronzegladius", PrimalAPI.ToolMaterials.TOOL_BRONZE);
rawcoppergladius= new WeaponPart("rawcoppergladius", PrimalAPI.ToolMaterials.TOOL_COPPER);
rawwroughtirongladius= new WeaponPart("rawwroughtirongladius", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
rawcleanirongladius= new WeaponPart("rawcleanirongladius", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON);
rawsteelgladius= new WeaponPart("rawsteelgladius", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL);
rawwootzgladius= new WeaponPart("rawwootzgladius", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
wroughtironslayer = new SlayerSword("wroughtironslayer", PrimalMaterials.TOOL_WROUGHT_IRON, 11.5D, -3.7D);
cleanironslayer = new SlayerSword("cleanironslayer", PrimalMaterials.TOOL_CLEAN_IRON, 10D, -3.5D);
steelslayer = new SlayerSword("steelslayer", PrimalMaterials.TOOL_BASIC_STEEL,11D, -3.3D);
rawcleanironlongsword = new WeaponPart("rawcleanironlongsword", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON);
rawsteellongsword = new WeaponPart("rawsteellongsword", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL);
rawwootzlongsword = new WeaponPart("rawwootzlongsword", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
wroughtironshield = new CustomShield("wroughtironshield", PrimalMaterials.TOOL_WROUGHT_IRON);
rawironslayer = new WeaponPart("rawironslayer", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
rawcleanironslayer = new WeaponPart("rawcleanironslayer", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON);
rawsteelslayer = new WeaponPart("rawsteelslayer", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL);
rawwootzslayer = new WeaponPart("rawwootzslayer", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
coppergladius = new CustomSword("coppergladius", PrimalAPI.ToolMaterials.TOOL_COPPER, 5D, 2D);
bronzegladius = new CustomSword("bronzegladius", PrimalAPI.ToolMaterials.TOOL_BRONZE, 5.5D, 2D);
wroughtirongladius = new CustomSword("wroughtirongladius", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 4.5D, -1.85D);
cleanirongladius = new CustomSword("cleanirongladius", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 5D, -1.85D);
steelgladius = new CustomSword("steelgladius", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL,6D, -1.85D);
wootzgladius = new CustomSword("wootzgladius", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, 7D, -1.75D);
cleanironlongsword = new CustomSword("cleanironlongsword", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 7D, -2.5D);
steellongsword = new CustomSword("steellongsword", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL,8D, -2.25D);
wootzlongsword = new CustomSword("wootzlongsword", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL,9D, -2D);
wroughtironslayer = new SlayerSword("wroughtironslayer", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 11.5D, -3.7D);
cleanironslayer = new SlayerSword("cleanironslayer", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 10D, -3.5D);
steelslayer = new SlayerSword("steelslayer", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL,11D, -3.3D);
wootzslayer = new SlayerSword("wootzslayer", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL,11D, -3.1D);
wroughtironshield = new CustomShield("wroughtironshield", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
/**********
INGOTS AND CHUNKS
**********/
ironingotballhot = new BaseMultiItem("ironingothot", PrimalMaterials.TOOL_WROUGHT_IRON, 6);
ironchunkhot = new BaseMultiItem("ironchunkhot", PrimalMaterials.TOOL_WROUGHT_IRON, 7);
ironcleaningotballhot= new BaseMultiItem("ironcleaningotballhot", PrimalMaterials.TOOL_CLEAN_IRON, 15);
ironcleanchunkhot= new BaseMultiItem("ironcleanchunkhot", PrimalMaterials.TOOL_CLEAN_IRON, 16);
steelingotballhot= new BaseMultiItem("steelingotballhot", PrimalMaterials.TOOL_BASIC_STEEL, 24);
steelchunkhot= new BaseMultiItem("steelchunkhot", PrimalMaterials.TOOL_BASIC_STEEL, 25);
wootzingotballhot= new BaseMultiItem("wootzingotballhot", PrimalMaterials.TOOL_WOOTZ_STEEL, 33);
wootzchunkhot= new BaseMultiItem("wootzchunkhot", PrimalMaterials.TOOL_WOOTZ_STEEL, 34);
bronzeingotball = new BaseMultiItem("bronzeingotball", PrimalAPI.ToolMaterials.TOOL_BRONZE);
bronzechunk = new BaseMultiItem("bronzechunk", PrimalAPI.ToolMaterials.TOOL_BRONZE);
ironingotball = new BaseMultiItem("ironingotball", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
wroughtironchunk = new BaseMultiItem("wroughtironchunk", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
ironcleaningotball= new BaseMultiItem("ironcleaningotball", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON);
ironcleanchunk= new BaseMultiItem("ironcleanchunk", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON);
steelingotball= new BaseMultiItem("steelingotball", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL);
steelchunk= new BaseMultiItem("steelchunk", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL);
wootzingotball= new BaseMultiItem("wootzingotball", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
wootzchunk= new BaseMultiItem("wootzchunk", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
//forgingmanual = new ItemForgingManual();
//test = new ItemTest("ironsword");
brokencoppertool = new BaseItem("brokencoppertool");
brokenbronzetool = new BaseItem("brokenbronzetool");
brokenwroughtirontool = new BaseItem("brokenwroughtirontool");
brokencleanirontool = new BaseItem("brokencleanirontool");
@@ -260,153 +332,201 @@ public class ModItems {
/**********
ARMOR
**********/
//testleggings=new CustomLeggings(PrimalMaterials.ARMOR_ADAMANT, 3, EntityEquipmentSlot.LEGS, "testleggings");
leatherhelmet=new CustomHelmet(PrimalAPI.ArmorMaterials.ARMOR_HIDE, 0, EntityEquipmentSlot.HEAD, "leatherhelmet");
//testleggings=new CustomHelmet(PrimalAPI.ToolMaterials.ARMOR_ADAMANT, 3, EntityEquipmentSlot.LEGS, "testleggings");
//registerItem(312, "diamond_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, EntityEquipmentSlot.LEGS)).setUnlocalizedName("leggingsDiamond"));
}
public static void register() {
GameRegistry.register(castingmud);
GameRegistry.register(bellowshandle);
GameRegistry.register(softcrucible);
GameRegistry.register(stonetongs);
GameRegistry.register(forgehammer);
GameRegistry.register(ironingotballhot);
GameRegistry.register(ironchunkhot);
GameRegistry.register(ironcleaningotballhot);
GameRegistry.register(ironcleanchunkhot);
GameRegistry.register(steelingotballhot);
GameRegistry.register(steelchunkhot);
GameRegistry.register(wootzingotballhot);
GameRegistry.register(wootzchunkhot);
//GameRegistry.register(test);
//ForgeRegistries.ITEMS.register();
/**********
CASTING PARTS
**********/
GameRegistry.register(cast_axe);
GameRegistry.register(cast_gladius);
GameRegistry.register(cast_hoe);
GameRegistry.register(cast_pickaxe);
GameRegistry.register(cast_shovel);
ForgeRegistries.ITEMS.register(itemnbtcrucible);
ForgeRegistries.ITEMS.register(slottedtongs);
//ForgeRegistries.ITEMS.register(itemcrucible);
ForgeRegistries.ITEMS.register(castingmud);
ForgeRegistries.ITEMS.register(bellowshandle);
ForgeRegistries.ITEMS.register(softcrucible);
ForgeRegistries.ITEMS.register(wootzworkblade);
ForgeRegistries.ITEMS.register(forgehammer);
ForgeRegistries.ITEMS.register(grindingwheel);
ForgeRegistries.ITEMS.register(bronzeingotball);
ForgeRegistries.ITEMS.register(bronzechunk);
ForgeRegistries.ITEMS.register(ironingotball);
ForgeRegistries.ITEMS.register(wroughtironchunk);
ForgeRegistries.ITEMS.register(ironcleaningotball);
ForgeRegistries.ITEMS.register(ironcleanchunk);
ForgeRegistries.ITEMS.register(steelingotball);
ForgeRegistries.ITEMS.register(steelchunk);
ForgeRegistries.ITEMS.register(wootzingotball);
ForgeRegistries.ITEMS.register(wootzchunk);
//ForgeRegistries.ITEMS.register(test);
/**********
TOOL PARTS
**********/
GameRegistry.register(bronzepickaxehead);
GameRegistry.register(bronzeaxehead);
GameRegistry.register(bronzeshovelhead);
GameRegistry.register(bronzehoehead);
GameRegistry.register(pickaxehead);
GameRegistry.register(ironaxehead);
GameRegistry.register(ironshovelhead);
GameRegistry.register(ironhoehead);
ForgeRegistries.ITEMS.register(copperpickaxehead);
ForgeRegistries.ITEMS.register(copperaxehead);
ForgeRegistries.ITEMS.register(coppershovelhead);
ForgeRegistries.ITEMS.register(copperhoehead);
GameRegistry.register(cleanironpickaxehead);
GameRegistry.register(cleanironaxehead);
GameRegistry.register(cleanironshovelhead);
GameRegistry.register(cleanironhoehead);
ForgeRegistries.ITEMS.register(bronzepickaxehead);
ForgeRegistries.ITEMS.register(bronzeaxehead);
ForgeRegistries.ITEMS.register(bronzeshovelhead);
ForgeRegistries.ITEMS.register(bronzehoehead);
GameRegistry.register(steelpickaxehead);
GameRegistry.register(steelaxehead);
GameRegistry.register(steelshovelhead);
GameRegistry.register(steelhoehead);
ForgeRegistries.ITEMS.register(pickaxehead);
ForgeRegistries.ITEMS.register(ironaxehead);
ForgeRegistries.ITEMS.register(ironshovelhead);
ForgeRegistries.ITEMS.register(ironhoehead);
GameRegistry.register(wootzpickaxehead);
GameRegistry.register(wootzaxehead);
GameRegistry.register(wootzshovelhead);
GameRegistry.register(wootzhoehead);
ForgeRegistries.ITEMS.register(cleanironpickaxehead);
ForgeRegistries.ITEMS.register(cleanironaxehead);
ForgeRegistries.ITEMS.register(cleanironshovelhead);
ForgeRegistries.ITEMS.register(cleanironhoehead);
ForgeRegistries.ITEMS.register(steelpickaxehead);
ForgeRegistries.ITEMS.register(steelaxehead);
ForgeRegistries.ITEMS.register(steelshovelhead);
ForgeRegistries.ITEMS.register(steelhoehead);
ForgeRegistries.ITEMS.register(wootzpickaxehead);
ForgeRegistries.ITEMS.register(wootzaxehead);
ForgeRegistries.ITEMS.register(wootzshovelhead);
ForgeRegistries.ITEMS.register(wootzhoehead);
/**********
TOOLS
**********/
GameRegistry.register(bronzepickaxe);
GameRegistry.register(bronzeaxe);
GameRegistry.register(bronzeshovel);
GameRegistry.register(bronzehoe);
ForgeRegistries.ITEMS.register(copperpickaxe);
ForgeRegistries.ITEMS.register(copperaxe);
ForgeRegistries.ITEMS.register(coppershovel);
ForgeRegistries.ITEMS.register(copperhoe);
ForgeRegistries.ITEMS.register(coppersledgehammer);
GameRegistry.register(ironpickaxe);
GameRegistry.register(ironaxe);
GameRegistry.register(ironshovel);
GameRegistry.register(ironhoe);
ForgeRegistries.ITEMS.register(bronzepickaxe);
ForgeRegistries.ITEMS.register(bronzeaxe);
ForgeRegistries.ITEMS.register(bronzeshovel);
ForgeRegistries.ITEMS.register(bronzehoe);
ForgeRegistries.ITEMS.register(bronzesledgehammer);
GameRegistry.register(cleanironpickaxe);
GameRegistry.register(cleanironaxe);
GameRegistry.register(cleanironshovel);
GameRegistry.register(cleanironhoe);
ForgeRegistries.ITEMS.register(ironpickaxe);
ForgeRegistries.ITEMS.register(ironaxe);
ForgeRegistries.ITEMS.register(ironshovel);
ForgeRegistries.ITEMS.register(ironhoe);
ForgeRegistries.ITEMS.register(ironsledgehammer);
GameRegistry.register(steelpickaxe);
GameRegistry.register(steelaxe);
GameRegistry.register(steelshovel);
GameRegistry.register(steelhoe);
ForgeRegistries.ITEMS.register(cleanironpickaxe);
ForgeRegistries.ITEMS.register(cleanironaxe);
ForgeRegistries.ITEMS.register(cleanironshovel);
ForgeRegistries.ITEMS.register(cleanironhoe);
ForgeRegistries.ITEMS.register(cleanironsledgehammer);
GameRegistry.register(wootzpickaxe);
GameRegistry.register(wootzaxe);
GameRegistry.register(wootzshovel);
GameRegistry.register(wootzhoe);
ForgeRegistries.ITEMS.register(steelpickaxe);
ForgeRegistries.ITEMS.register(steelaxe);
ForgeRegistries.ITEMS.register(steelshovel);
ForgeRegistries.ITEMS.register(steelhoe);
ForgeRegistries.ITEMS.register(steelsledgehammer);
ForgeRegistries.ITEMS.register(wootzpickaxe);
ForgeRegistries.ITEMS.register(wootzaxe);
ForgeRegistries.ITEMS.register(wootzshovel);
ForgeRegistries.ITEMS.register(wootzhoe);
ForgeRegistries.ITEMS.register(wootzsledgehammer);
/**********
WEAPONS
**********/
GameRegistry.register(wroughtirongladius);
GameRegistry.register(bronzegladius);
GameRegistry.register(cleanirongladius);
GameRegistry.register(steelgladius);
GameRegistry.register(cleanironlongsword);
GameRegistry.register(steellongsword);
ForgeRegistries.ITEMS.register(rawbronzegladius);
ForgeRegistries.ITEMS.register(rawcoppergladius);
ForgeRegistries.ITEMS.register(rawwroughtirongladius);
ForgeRegistries.ITEMS.register(rawcleanirongladius);
ForgeRegistries.ITEMS.register(rawsteelgladius);
ForgeRegistries.ITEMS.register(rawwootzgladius);
GameRegistry.register(wroughtironslayer);
GameRegistry.register(cleanironslayer);
GameRegistry.register(steelslayer);
ForgeRegistries.ITEMS.register(rawcleanironlongsword);
ForgeRegistries.ITEMS.register(rawsteellongsword);
ForgeRegistries.ITEMS.register(rawwootzlongsword);
GameRegistry.register(rawlongbow);
GameRegistry.register(unstrunglongbow);
GameRegistry.register(longbow);
//GameRegistry.register(matchlockmusket);
ForgeRegistries.ITEMS.register(rawironslayer);
ForgeRegistries.ITEMS.register(rawcleanironslayer);
ForgeRegistries.ITEMS.register(rawsteelslayer);
ForgeRegistries.ITEMS.register(rawwootzslayer);
GameRegistry.register(brokenbronzetool);
GameRegistry.register(brokenwroughtirontool);
GameRegistry.register(brokencleanirontool);
GameRegistry.register(brokensteeltool);
GameRegistry.register(brokenwootztool);
ForgeRegistries.ITEMS.register(coppergladius);
ForgeRegistries.ITEMS.register(wroughtirongladius);
ForgeRegistries.ITEMS.register(bronzegladius);
ForgeRegistries.ITEMS.register(cleanirongladius);
ForgeRegistries.ITEMS.register(steelgladius);
ForgeRegistries.ITEMS.register(wootzgladius);
ForgeRegistries.ITEMS.register(cleanironlongsword);
ForgeRegistries.ITEMS.register(steellongsword);
ForgeRegistries.ITEMS.register(wootzlongsword);
ForgeRegistries.ITEMS.register(wroughtironslayer);
ForgeRegistries.ITEMS.register(cleanironslayer);
ForgeRegistries.ITEMS.register(steelslayer);
ForgeRegistries.ITEMS.register(wootzslayer);
ForgeRegistries.ITEMS.register(rawlongbow);
ForgeRegistries.ITEMS.register(unstrunglongbow);
ForgeRegistries.ITEMS.register(longbow);
//ForgeRegistries.ITEMS.register(matchlockmusket);
ForgeRegistries.ITEMS.register(brokenbronzetool);
ForgeRegistries.ITEMS.register(brokenwroughtirontool);
ForgeRegistries.ITEMS.register(brokencleanirontool);
ForgeRegistries.ITEMS.register(brokensteeltool);
ForgeRegistries.ITEMS.register(brokenwootztool);
/**********
ARMOR
**********/
//GameRegistry.register(testleggings);
ForgeRegistries.ITEMS.register(leatherhelmet);
//ForgeRegistries.ITEMS.register(testleggings);
//GameRegistry.register(forgingmanual);
//ForgeRegistries.ITEMS.register(forgingmanual);
}
@SideOnly(Side.CLIENT)
public static void registerRenders() {
registerRender(itemnbtcrucible);
registerRender(slottedtongs);
registerRender(castingmud);
registerRender(bellowshandle);
registerRender(softcrucible);
registerRender(forgehammer);
registerRender(ironingotballhot);
registerRender(ironchunkhot);
registerRender(ironcleaningotballhot);
registerRender(ironcleanchunkhot);
registerRender(steelingotballhot);
registerRender(steelchunkhot);
//registerRender(test);
registerRender(wootzworkblade);
registerRender(grindingwheel);
/**********
CASTING PARTS
**********/
registerRender(cast_axe);
registerRender(cast_gladius);
registerRender(cast_hoe);
registerRender(cast_pickaxe);
registerRender(cast_shovel);
registerRender(bronzeingotball);
registerRender(bronzechunk);
registerRender(ironingotball);
registerRender(wroughtironchunk);
registerRender(ironcleaningotball);
registerRender(ironcleanchunk);
registerRender(steelingotball);
registerRender(steelchunk);
registerRender(wootzingotball);
registerRender(wootzchunk);
//registerRender(test);
/**********
TOOL PARTS
**********/
registerRender(copperpickaxehead);
registerRender(copperaxehead);
registerRender(coppershovelhead);
registerRender(copperhoehead);
registerRender(bronzepickaxehead);
registerRender(bronzeaxehead);
registerRender(bronzeshovelhead);
@@ -435,47 +555,82 @@ public class ModItems {
/**********
TOOLS
**********/
registerRender(copperpickaxe);
registerRender(copperaxe);
registerRender(coppershovel);
registerRender(copperhoe);
registerRender(coppersledgehammer);
registerRender(bronzepickaxe);
registerRender(bronzeaxe);
registerRender(bronzeshovel);
registerRender(bronzehoe);
registerRender(bronzesledgehammer);
registerRender(ironpickaxe);
registerRender(ironaxe);
registerRender(ironshovel);
registerRender(ironhoe);
registerRender(ironsledgehammer);
registerRender(cleanironpickaxe);
registerRender(cleanironaxe);
registerRender(cleanironshovel);
registerRender(cleanironhoe);
registerRender(cleanironsledgehammer);
registerRender(steelpickaxe);
registerRender(steelaxe);
registerRender(steelshovel);
registerRender(steelhoe);
registerRender(steelsledgehammer);
registerRender(wootzpickaxe);
registerRender(wootzaxe);
registerRender(wootzshovel);
registerRender(wootzhoe);
registerRender(wootzsledgehammer);
/**********
WEAPON PARTS
**********/
//registerRender(wroughtironshield);
registerRender(rawbronzegladius);
registerRender(rawcoppergladius);
registerRender(rawwroughtirongladius);
registerRender(rawcleanirongladius);
registerRender(rawsteelgladius);
registerRender(rawwootzgladius);
registerRender(rawcleanironlongsword);
registerRender(rawsteellongsword);
registerRender(rawwootzlongsword);
registerRender(rawironslayer);
registerRender(rawcleanironslayer);
registerRender(rawsteelslayer);
registerRender(rawwootzslayer);
/**********
WEAPONS
**********/
registerRender(wroughtironshield);
registerRender(coppergladius);
registerRender(bronzegladius);
registerRender(wroughtirongladius);
registerRender(cleanirongladius);
registerRender(steelgladius);
registerRender(wootzgladius);
registerRender(cleanironlongsword);
registerRender(steellongsword);
registerRender(wootzlongsword);
registerRender(wroughtironslayer);
registerRender(cleanironslayer);
registerRender(steelslayer);
registerRender(wootzslayer);
registerRender(rawlongbow);
registerRender(unstrunglongbow);
@@ -494,190 +649,10 @@ public class ModItems {
/**********
ARMOR
**********/
//registerRender(testleggings);
registerRender(leatherhelmet);
}
@SideOnly(Side.CLIENT)
public static void registerCustomRenders(){
ModelBakery.registerItemVariants(ModItems.stonetongs, ModItems.stonetongs.getRegistryName(),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_default"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_emptyhot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_emptyhotcracked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotiron"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotironcooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotironfailed"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_ingot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_chunk"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_pickaxe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_axe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_shovel_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hoe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleaniron"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleanironcooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotcleanironfailed"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleanironingot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleanironchunk"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_pickaxe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_axe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_shovel_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_cleaniron_hoe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteel"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteelcooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotsteelfailed"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steelingot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steelchunk"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_pickaxe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_axe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_shovel_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_steel_hoe_hot"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_lapis"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_lapis"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_redstone"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_redstone"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_emerald"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_emerald"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronze_diamond"),
new ResourceLocation(ModInfo.MOD_ID, "stonetongs_hotbronzecooked_diamond")
);
ModelLoader.setCustomMeshDefinition(ModItems.stonetongs, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
if (stack.hasTagCompound()) {
if (stack.getTagCompound().getInteger("type") == 0 ){
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_default", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 1 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_emptyhot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 2 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_emptyhotcracked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 3 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotiron", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 4 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotironcooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 5 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotironfailed", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 6 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_ingot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 7 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_chunk", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 8 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_pickaxe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 9 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_axe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 10 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_shovel_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 11 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hoe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 12 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleaniron", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 13 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleanironcooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 14 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotcleanironfailed", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 15 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleanironingot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 16 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleanironchunk", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 17 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_pickaxe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 18 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_axe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 19 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_shovel_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 20 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_cleaniron_hoe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 21 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteel", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 22 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteelcooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 23 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotsteelfailed", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 24 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steelingot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 25 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steelchunk", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 26 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_pickaxe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 27 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_axe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 28 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_shovel_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 29 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_steel_hoe_hot", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 39 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 40 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 45 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_emerald", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 46 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_emerald", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 47 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_diamond", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 48 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_diamond", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 49 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_redstone", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 50 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_redstone", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 51 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronze_lapis", "inventory");
}
else if (stack.getTagCompound().getInteger("type") == 52 ) {
return new ModelResourceLocation(stack.getItem().getRegistryName() + "_hotbronzecooked_lapis", "inventory");
}
else return new ModelResourceLocation(stack.getItem().getRegistryName(), "inventory");
}
return new ModelResourceLocation(stack.getItem().getRegistryName(), "inventory");
}
});
}
private static void registerRender(Item item) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}

View File

@@ -1,14 +1,39 @@
package nmd.primal.forgecraft.init;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.RegistryBuilder;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.CrucibleCrafting;
import nmd.primal.forgecraft.crafting.WorkbenchCrafting;
/**
* Created by kitsu on 12/3/2016.
*/
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public class ModRegistries {
public static void registerFuels()
{
//if (ModConfig.FEATURE_ENABLE_FUELS)
//{
@SubscribeEvent
public static void customRegistries(RegistryEvent.NewRegistry event) {
PrimalAPI.logger(1, "Custom Registry", CrucibleCrafting.RECIPE_PREFIX);
RegistryBuilder registryCrucible = new RegistryBuilder();
registryCrucible.setType(CrucibleCrafting.class);
registryCrucible.setName(new ResourceLocation(ModInfo.MOD_ID, "recipes_" + CrucibleCrafting.RECIPE_PREFIX));
registryCrucible.setIDRange(0, 1000);
registryCrucible.create();
PrimalAPI.logger(1, "Custom Registry", WorkbenchCrafting.RECIPE_PREFIX);
RegistryBuilder registryWorkbench = new RegistryBuilder();
registryWorkbench.setType(WorkbenchCrafting.class);
registryWorkbench.setName(new ResourceLocation(ModInfo.MOD_ID, "recipes_" + WorkbenchCrafting.RECIPE_PREFIX));
registryWorkbench.setIDRange(0, 1000);
registryWorkbench.create();
}
}

View File

@@ -13,12 +13,16 @@ public class ModSounds {
public static SoundEvent PISTON_BELLOWS;
public static SoundEvent MUSKET_SHOT;
public static SoundEvent BOW_TWANG;
public static SoundEvent CHISEL_HIT;
public static SoundEvent CHISEL_HIT_FINISHED;
public static void registerSounds()
{
PISTON_BELLOWS = registerSound("piston_bellows");
MUSKET_SHOT = registerSound("musket_shot");
BOW_TWANG = registerSound("bow_twang");
CHISEL_HIT = registerSound("chisel_hit");
CHISEL_HIT_FINISHED = registerSound("chisel_hit_finished");
}
private static SoundEvent registerSound(String name)

View File

@@ -0,0 +1,20 @@
package nmd.primal.forgecraft.init;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import nmd.primal.forgecraft.renders.blocks.*;
import nmd.primal.forgecraft.tiles.*;
public class ModTileRenders {
public static void init(){
ClientRegistry.bindTileEntitySpecialRenderer(TileForge.class, new TileForgeRender());
ClientRegistry.bindTileEntitySpecialRenderer(TilePistonBellows.class, new TilePistonBellowsRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileBloomery.class, new TileBloomeryRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileAnvil.class, new TileAnvilRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileBreaker.class, new TileBreakerRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileCastingForm.class, new TileCastingformRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileWorkbench.class, new TileWorkbenchRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileSharpBench.class, new TileSharpBenchRender());
}
}

View File

@@ -13,11 +13,12 @@ public class ModTiles {
registerTileEntity(TileForge.class, "firebox");
registerTileEntity(TilePistonBellows.class, "pistonbellows");
registerTileEntity(TileBloomery.class, "bloomery");
registerTileEntity(TileBaseCrucible.class, "basecrucible");
registerTileEntity(TileAnvil.class, "anvil");
registerTileEntity(TileBreaker.class, "breaker");
registerTileEntity(TileCastingForm.class, "castingform");
registerTileEntity(TileCastingBlock.class, "castingblock");
registerTileEntity(TileNBTCrucible.class, "nbtcrucible");
registerTileEntity(TileWorkbench.class, "workbench");
registerTileEntity(TileSharpBench.class, "sharpbench");
}
private static void registerTileEntity(Class<? extends TileEntity> tile_class, String baseName) {

View File

@@ -0,0 +1,141 @@
package nmd.primal.forgecraft.init.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.common.crafting.handlers.tile.CauldronRecipe;
import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModItems;
import java.util.List;
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public class CauldronRecipes
{
@SubscribeEvent
public static void registerCauldronRecipes(RegistryEvent.Register<CauldronRecipe> event)
{
final IForgeRegistry<CauldronRecipe> recipes = event.getRegistry();
ItemStack defaultBronzeGladius = new ItemStack(ModItems.rawbronzegladius, 1);
ItemStack defaultCopperGladius = new ItemStack(ModItems.rawcoppergladius, 1);
ItemStack defaultWroughtIronGladius = new ItemStack(ModItems.rawwroughtirongladius, 1);
ItemStack defaultCleanIronGladius = new ItemStack(ModItems.rawcleanirongladius, 1);
ItemStack defaultSteelGladius = new ItemStack(ModItems.rawsteelgladius, 1);
ItemStack defaultWootzGladius = new ItemStack(ModItems.rawwootzgladius, 1);
ItemStack defaultCleanIronLongsword = new ItemStack(ModItems.rawcleanironlongsword, 1);
ItemStack defaultSteelLongsword = new ItemStack(ModItems.rawsteellongsword, 1);
ItemStack defaultWootzLongsword = new ItemStack(ModItems.rawwootzlongsword, 1);
ItemStack defaultIronSlayer = new ItemStack(ModItems.rawironslayer, 1);
ItemStack defaultCleanIronSlayer = new ItemStack(ModItems.rawcleanironslayer, 1);
ItemStack defaultSteelSlayer = new ItemStack(ModItems.rawsteelslayer, 1);
ItemStack defaultWootzSlayer = new ItemStack(ModItems.rawwootzslayer, 1);
List<ItemStack> recipeList = RecipeHelper.buildList(defaultBronzeGladius, defaultCopperGladius, defaultWroughtIronGladius, defaultCleanIronGladius, defaultSteelGladius, defaultWootzGladius,
defaultCleanIronLongsword, defaultSteelLongsword, defaultWootzLongsword,
defaultIronSlayer, defaultCleanIronSlayer, defaultSteelSlayer, defaultWootzSlayer);
for(ItemStack s : recipeList){
setDefaultNBT(s);
}
genRecipesForList(recipeList, recipes);
recipes.register(new CauldronRecipe(
5,
new FluidStack(FluidRegistry.WATER, 500),
null,
RecipeHelper.getOreStack("sand", 1),
RecipeHelper.getOreStack("slackLime", 4),
RecipeHelper.getOreStack("clayball", 2),
new ItemStack(ModItems.grindingwheel, 1),
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, ModItems.grindingwheel.getUnlocalizedName().toString()));
}
static void setDefaultNBT(ItemStack stack){
stack.getOrCreateSubCompound("tags");
stack.getSubCompound("tags").setInteger("smite", 0);
stack.getSubCompound("tags").setInteger("bane", 0);
stack.getSubCompound("tags").setInteger("fire", 0);
stack.getSubCompound("tags").setInteger("fortune", 0);
stack.getSubCompound("tags").setInteger("leech", 0);
stack.getSubCompound("tags").setInteger("sweeping", 0);
stack.getSubCompound("tags").setInteger("sharpness", 0);
stack.getSubCompound("tags").setBoolean("hot", false);
}
static CauldronRecipe genSmiteRecipe(ItemStack stack) {
return new CauldronRecipe(
8,
new FluidStack(PrimalAPI.Fluids.BRINE, 1000),
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
RecipeHelper.getOreStack("dustSilver", 2),
RecipeHelper.buildList(stack),
stack,
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, stack.getUnlocalizedName().toString().concat("smite"));
}
static CauldronRecipe genBaneRecipe(ItemStack stack) {
return new CauldronRecipe(
8,
new FluidStack(PrimalAPI.Fluids.BRINE, 1000),
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
RecipeHelper.getOreStack("foodPoison", 2),
RecipeHelper.buildList(stack),
stack,
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, stack.getUnlocalizedName().toString().concat("bane"));
}
static CauldronRecipe genFireRecipe(ItemStack stack) {
return new CauldronRecipe(
8,
new FluidStack(PrimalAPI.Fluids.BRINE, 1000),
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
RecipeHelper.getOreStack("dustBlaze", 2),
RecipeHelper.buildList(stack),
stack,
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, stack.getUnlocalizedName().toString().concat("fire"));
}
static CauldronRecipe genFortuneRecipe(ItemStack stack) {
return new CauldronRecipe(
8,
new FluidStack(PrimalAPI.Fluids.BRINE, 1000),
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
RecipeHelper.getOreStack("gemLapis", 2),
RecipeHelper.buildList(stack),
stack,
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, stack.getUnlocalizedName().toString().concat("fortune"));
}
/*static CauldronRecipe genLeechRecipe(ItemStack stack) {
return new CauldronRecipe(
5,
new FluidStack(FluidRegistry.WATER, 1000),
new FluidStack(PrimalAPI.Fluids.WASTE, 1000),
RecipeHelper.getOreStack("dustWitheredBone", 1),
RecipeHelper.buildList(stack),
stack,
ItemStack.EMPTY).setRecipeName(ModInfo.MOD_ID, stack.getUnlocalizedName().toString().concat("leech"));
}*/
static void genRecipesForList(List<ItemStack> list, IForgeRegistry<CauldronRecipe> recipes){
for(ItemStack s : list){
recipes.register(genSmiteRecipe(s));
recipes.register(genBaneRecipe(s));
recipes.register(genFireRecipe(s));
recipes.register(genFortuneRecipe(s));
}
}
}

View File

@@ -0,0 +1,29 @@
package nmd.primal.forgecraft.init.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.common.crafting.handlers.tile.DryingRecipe;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public class DryingRecipes
{
@SubscribeEvent
public static void registerDryingRecipes(RegistryEvent.Register<DryingRecipe> event)
{
final IForgeRegistry<DryingRecipe> recipes = event.getRegistry();
recipes.register(new DryingRecipe(
20,
new ItemStack(ModItems.softcrucible),
new ItemStack(ModBlocks.nbtCrucible)
).setRecipeName(ModInfo.MOD_ID + "_soft_crucible"));
}
}

View File

@@ -0,0 +1,29 @@
package nmd.primal.forgecraft.init.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.IForgeRegistry;
import nmd.primal.core.common.crafting.handlers.tile.HibachiRecipe;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
@GameRegistry.ObjectHolder(ModInfo.MOD_ID)
@Mod.EventBusSubscriber
public class HibachiRecipes
{
@SubscribeEvent
public static void registerHibachiRecipes(RegistryEvent.Register<HibachiRecipe> event)
{
final IForgeRegistry<HibachiRecipe> recipes = event.getRegistry();
recipes.register(new HibachiRecipe(
12,
new ItemStack(ModItems.softcrucible),
new ItemStack(ModBlocks.nbtCrucible)
).setRecipeName(ModInfo.MOD_ID + "_soft_crucible"));
}
}

View File

@@ -1,12 +1,15 @@
package nmd.primal.forgecraft.items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import nmd.primal.core.api.interfaces.crafting.IDictionaryName;
import nmd.primal.core.common.helper.RegistryHelper;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by kitsu on 11/26/2016.
*/
public class BaseItem extends Item
public class BaseItem extends Item implements IDictionaryName<Item>
{
public BaseItem(String registryName)
{
@@ -24,4 +27,30 @@ public class BaseItem extends Item
return false;
}
// ***************************************************************************** //
// IDictionaryName
// ***************************************************************************** //
private String[] dictionary_names;
@Override
public Item setDictionaryNames(String... strings)
{
this.dictionary_names = strings;
return this;
}
@Override
public String[] getDictionaryNames()
{
return this.dictionary_names;
}
@Override
public void registerDictionaryNames()
{
for (String name : this.getDictionaryNames())
//RegistryHelper.registerDictionaryNames(new ItemStack(this, 1, OreDictionary.WILDCARD_VALUE), REGISTRY_NAME);
RegistryHelper.registerDictionaryNames(new ItemStack(this), name);
}
}

View File

@@ -1,6 +1,24 @@
package nmd.primal.forgecraft.items;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.forgecraft.init.ModItems;
import javax.annotation.Nullable;
import java.util.List;
/**
* Created by mminaie on 2/19/17.
@@ -8,20 +26,205 @@ import net.minecraft.item.Item;
public class BaseMultiItem extends BaseItem {
private Item.ToolMaterial mat;
private int ID;
public BaseMultiItem( String registryName, Item.ToolMaterial material, Integer ID) {
super(registryName);
public BaseMultiItem( String name, Item.ToolMaterial material) {
super(name);
mat = material;
this.ID = ID;
//this.setMaxStackSize(1);
this.setNoRepair();
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
BaseMultiItem item = (BaseMultiItem) stack.getItem();
Item itemStack = stack.getItem();
//TODO get the item name
if (stack.getItem() instanceof BaseMultiItem) {
if(stack.getTagCompound() != null) {
/***INGOTS***/
if(itemStack.equals(ModItems.ironingotball)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.0f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.01f;
}
}
if(itemStack.equals(ModItems.bronzeingotball)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.02f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.03f;
}
}
if(itemStack.equals(ModItems.ironcleaningotball)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.04f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.05f;
}
}
if(itemStack.equals(ModItems.steelingotball)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.06f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.07f;
}
}
if(itemStack.equals(ModItems.wootzingotball)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.08f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.09f;
}
}
/***CHUNKS***/
if(itemStack.equals(ModItems.wroughtironchunk)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.10f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.11f;
}
}
if(itemStack.equals(ModItems.bronzechunk)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.12f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.13f;
}
}
if(itemStack.equals(ModItems.ironcleanchunk)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.14f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.15f;
}
}
if(itemStack.equals(ModItems.steelchunk)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.16f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.17f;
}
}
if(itemStack.equals(ModItems.wootzchunk)) {
if (!stack.getTagCompound().getBoolean("hot")) {
return 0.18f;
}
if (stack.getTagCompound().getBoolean("hot")) {
return 0.19f;
}
}
}
}
return 0.0f;
}
});
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
if(!item.isEmpty())
{
if (item.hasTagCompound())
{
//tooltip.add(ChatFormatting.GRAY + "Upgrades: " + item.getTagCompound().getString("upgrades"));
/*
tooltip.add(ChatFormatting.GRAY + "Upgrades: " + (3 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
*/
}
}
}
public Item.ToolMaterial getMaterial(Item item){
return mat;
}
public int getID() {
return ID;
@Override
public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
item.getTagCompound().setBoolean("hot", false);
}
}
@Override
public void onUpdate(ItemStack stack, World world, Entity player, int itemSlot, boolean isSelected) {
//System.out.println(item.getTagCompound());
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setBoolean("hot", false);
}
if (stack.hasTagCompound()) {
if (stack.getTagCompound().getBoolean("hot")) {
if (stack.getTagCompound().getBoolean("hot")) {
player.setFire(1);
}
if (PrimalAPI.randomCheck(10)) {
stack.getTagCompound().setBoolean("hot", false);
player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.AMBIENT, 1.0F, PrimalAPI.getRandom().nextFloat() * 0.4F + 0.8F);
}
}
}
}
@Override
public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem)
{
if(!entityItem.getEntityWorld().isRemote) {
if (entityItem.getItem().hasTagCompound()) {
if (entityItem.isWet()) {
if (entityItem.getItem().getTagCompound().getBoolean("hot")) {
entityItem.getItem().getTagCompound().setBoolean("hot", false);
entityItem.getEntityWorld().playSound(null, entityItem.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.AMBIENT, 1.0F, PrimalAPI.getRandom().nextFloat() * 0.4F + 0.8F);
return true;
}
}
/*
if (!entityItem.isWet()) {
if (entityItem.getItem().getTagCompound().getBoolean("hot")) {
FireHelper.setFire(entityItem.getEntityWorld(), entityItem.getPosition());
return true;
}
}
*/
if (PrimalAPI.randomCheck(10)) {
if (entityItem.getItem().getTagCompound().getBoolean("hot")) {
entityItem.getItem().getTagCompound().setBoolean("hot", false);
entityItem.getEntityWorld().playSound(null, entityItem.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.AMBIENT, 1.0F, PrimalAPI.getRandom().nextFloat() * 0.4F + 0.8F);
return true;
}
}
}
}
return false;
}
}

View File

@@ -0,0 +1,57 @@
package nmd.primal.forgecraft.items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import nmd.primal.core.api.interfaces.crafting.IDictionaryName;
import nmd.primal.core.common.helper.RegistryHelper;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by kitsu on 11/26/2016.
*/
public class BaseSingleItem extends BaseItem implements IDictionaryName<Item>
{
public BaseSingleItem(String registryName, int damage)
{
super(registryName);
this.setMaxStackSize(1);
this.canRepair = false;
this.setMaxDamage(damage);
}
public String getName() {
return this.getRegistryName().toString();
}
public static boolean isHidden()
{
return false;
}
// ***************************************************************************** //
// IDictionaryName
// ***************************************************************************** //
private String[] dictionary_names;
@Override
public Item setDictionaryNames(String... strings)
{
this.dictionary_names = strings;
return this;
}
@Override
public String[] getDictionaryNames()
{
return this.dictionary_names;
}
@Override
public void registerDictionaryNames()
{
for (String name : this.getDictionaryNames())
//RegistryHelper.registerDictionaryNames(new ItemStack(this, 1, OreDictionary.WILDCARD_VALUE), REGISTRY_NAME);
RegistryHelper.registerDictionaryNames(new ItemStack(this), name);
}
}

View File

@@ -0,0 +1,51 @@
package nmd.primal.forgecraft.items;
import net.minecraft.item.Item;
import nmd.primal.forgecraft.ModInfo;
/**
* Created by mminaie on 11/11/17.
*/
public class ItemCrucible extends Item {
public ItemCrucible(String unlocalizedName) {
setUnlocalizedName(unlocalizedName);
this.setRegistryName(unlocalizedName);
this.setMaxStackSize(1);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.setMaxStackSize(1);
this.setNoRepair();
}
/*@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
if(!item.isEmpty())
{
if (item.hasTagCompound())
{
NonNullList<ItemStack> ingList = NonNullList.<ItemStack>withSize(5, ItemStack.EMPTY);
NBTTagCompound nbtTag = item.getSubCompound("Items");
ItemStackHelper.loadAllItems(nbtTag, ingList);
tooltip.add(ChatFormatting.BLUE + "Items:" + ingList.get(0));
/*tooltip.add(ChatFormatting.GRAY + "Upgrades Left: " + (3 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
}*/
}

View File

@@ -1,897 +0,0 @@
package nmd.primal.forgecraft.items;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.BloomeryBase;
import nmd.primal.forgecraft.blocks.Crucibles.Crucible;
import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot;
import nmd.primal.forgecraft.blocks.Forge;
import nmd.primal.forgecraft.blocks.IngotBall;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.tiles.TileBaseCrucible;
import nmd.primal.forgecraft.tiles.TileBloomery;
import nmd.primal.forgecraft.tiles.TileForge;
import java.util.List;
/**
* Created by mminaie on 1/23/17.
*/
public class ItemStoneTongs extends Item {
public ItemStoneTongs(String unlocalizedName) {
setUnlocalizedName(unlocalizedName);
this.setRegistryName(unlocalizedName);
//this.setMaxDamage(0);
//this.setHasSubtypes(true); //This just says the item has metadata
this.setMaxStackSize(1);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
@Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if (!item.hasTagCompound()) {
item.setTagCompound(new NBTTagCompound());
NBTTagCompound tags = new NBTTagCompound();
//this.setDamage(item, 1000);
item.getTagCompound().setInteger("type", 0);
item.getTagCompound().setInteger("cooldown", 0);
item.getTagCompound().setTag("tags", tags);
item.getSubCompound("tags").setBoolean("hot", false);
item.getSubCompound("tags").setBoolean("emerald", false);
item.getSubCompound("tags").setInteger("diamond", 0);
item.getSubCompound("tags").setInteger("redstone", 0);
item.getSubCompound("tags").setInteger("lapis", 0);
item.getSubCompound("tags").setInteger("modifiers", 0);
}
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
/*
0 | Default StoneTongs
1 | Empty Crucible Hot
2 | Empty Crucible Cracked Hot
================================
3 | Hot Iron Crucible
4 | Hot Cooked Iron Crucible
5 | Hot Failed Iron Crucible
6 | Hot Iron Ingot
7 | Hot Iron Chunk
--------------------------------
8 | Hot Iron Pickaxe Head
9 | Hot Iron Axe Head
10 | Hot Iron Shovel Head
11 | Hot Iron Hoe Head
================================
12 | Hot Clean Iron Crucible
13 | Hot Cooked Clean Iron Crucible
14 | Hot Failed Clean Iron Crucible
15 | Hot Clean Iron Ball
16 | Hot Clean Iron Chunk
--------------------------------
17 | Hot Clean Iron Pickaxe Head
18 | Hot Clean Iron Axe Head
19 | Hot Clean Iron Shovel Head
20 | Hot Clean Iron Hoe Head
================================
21 | Hot Steel Crucible
22 | Hot Cooked Steel Crucible
23 | Hot Failed Steel Crucible
24 | Hot Steel Ingot
25 | Hot Steel Chunk
--------------------------------
26 | Hot Steel Pickaxe Head
27 | Hot Steel Axe Head
28 | Hot Steel Shovel Head
29 | Hot Steel Hoe Head
================================
30 | Hot Wootz Crucible
31 | Hot Cooked Wootz Crucible
32 | Hot Failed Wootz Crucible
33 | Hot Wootz Ingot
34 | Hot Wootz Chunk
--------------------------------
35 | Hot Wootz Pickaxe Head
36 | Hot Wootz Axe Head
37 | Hot Wootz Shovel Head
38 | Hot Wootz Hoe Head
================================
39 | Hot Bronze Crucible
40 | Hot Cooked Bronze Crucible
41 | Bronze Pickaxe Head
42 | Bronze Axe Head
43 | Bronze Shovel Head
44 | Bronze Hoe Head
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
*/
if(!world.isRemote) {
ItemStack itemstack = player.getHeldItem(hand);
//System.out.println(itemstack.getTagCompound().getInteger("type"));
//System.out.println(itemstack.getSubCompound("tags"));
/*****
Picks Up Hot Ingots from the Ground
*****/
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase == false) {
if (world.getBlockState(pos).getBlock() instanceof IngotBall) {
if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true) {
if (world.getBlockState(pos).getBlock() == ModBlocks.ironball) {
itemstack.getTagCompound().setInteger("type", 6);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.ironchunk) {
itemstack.getTagCompound().setInteger("type", 7);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.ironcleanball) {
itemstack.getTagCompound().setInteger("type", 15);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.ironcleanchunk) {
itemstack.getTagCompound().setInteger("type", 16);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.steelball) {
itemstack.getTagCompound().setInteger("type", 24);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.steelchunk) {
itemstack.getTagCompound().setInteger("type", 25);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/* TODO Wootz */
}
}
}
/*****
Picks Up Hot Crucibles from the Ground
*****/
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase == false) {
if(world.getBlockState(pos).getBlock() instanceof CrucibleHot) {
TileBaseCrucible tileCrucible = (TileBaseCrucible) world.getTileEntity(pos);
/***************************
* Crucibles *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.emptycruciblehot) {
itemstack.getTagCompound().setInteger("type", 1);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.emptycruciblecrackedhot) {
itemstack.getTagCompound().setInteger("type", 2);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/***************************
* Iron *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotironcrucible) {
itemstack.getTagCompound().setInteger("type", 3);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedironcrucible) {
itemstack.getTagCompound().setInteger("type", 4);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.failedironcruciblehot) {
itemstack.getTagCompound().setInteger("type", 5);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/***************************
* Clean Iron *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcleanironcrucible) {
itemstack.getTagCompound().setInteger("type", 12);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedcleanironcrucible) {
itemstack.getTagCompound().setInteger("type", 13);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.failedcleanironcruciblehot) {
itemstack.getTagCompound().setInteger("type", 14);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/***************************
* Steel *
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotsteelcrucible) {
itemstack.getTagCompound().setInteger("type", 21);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedsteelcrucible) {
itemstack.getTagCompound().setInteger("type", 22);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.failedsteelcruciblehot) {
itemstack.getTagCompound().setInteger("type", 23);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
/* TODO Wootz */
/***************************
* Bronze *
*
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
***************************/
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible) {
itemstack.getTagCompound().setInteger("type", 39);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible) {
itemstack.getTagCompound().setInteger("type", 40);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_emerald) {
itemstack.getTagCompound().setInteger("type", 45);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_emerald) {
itemstack.getTagCompound().setInteger("type", 46);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_diamond) {
itemstack.getTagCompound().setInteger("type", 47);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_diamond) {
itemstack.getTagCompound().setInteger("type", 48);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_redstone) {
itemstack.getTagCompound().setInteger("type", 49);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_redstone) {
itemstack.getTagCompound().setInteger("type", 50);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_lapis) {
itemstack.getTagCompound().setInteger("type", 51);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_lapis) {
itemstack.getTagCompound().setInteger("type", 52);
itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown);
world.setBlockToAir(pos);
return EnumActionResult.SUCCESS;
}
}
/*****
Places the content from the Tongs to the World
*****/
if ((world.getBlockState(pos).getBlock() instanceof Crucible) || (world.getBlockState(pos).getBlock() instanceof CrucibleHot)) {
return EnumActionResult.FAIL;
} else if (world.getBlockState(pos).getMaterial() == Material.ROCK ||
world.getBlockState(pos).getMaterial() == Material.SAND ||
world.getBlockState(pos).getMaterial() == Material.IRON ||
world.getBlockState(pos).getMaterial() == Material.ANVIL )
{
BlockPos tempPos = new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ());
if (world.getBlockState(tempPos).getBlock() == Blocks.AIR) {
switch (itemstack.getTagCompound().getInteger("type")) {
case 0:
break;
case 1:
world.setBlockState(tempPos, ModBlocks.emptycruciblehot.getDefaultState(), 2);
TileBaseCrucible tileCrucible1 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible1.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 2:
world.setBlockState(tempPos, ModBlocks.emptycruciblecrackedhot.getDefaultState(), 2);
TileBaseCrucible tileCrucible2 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible2.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 3:
world.setBlockState(tempPos, ModBlocks.hotironcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible3 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible3.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 4:
world.setBlockState(tempPos, ModBlocks.hotcookedironcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible4 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible4.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 5:
world.setBlockState(tempPos, ModBlocks.failedironcruciblehot.getDefaultState(), 2);
TileBaseCrucible tileCrucible5 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible5.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 6:
world.setBlockState(tempPos, ModBlocks.ironball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 7:
world.setBlockState(tempPos, ModBlocks.ironchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 8:
return EnumActionResult.FAIL;
case 9:
return EnumActionResult.FAIL;
case 10:
return EnumActionResult.FAIL;
case 11:
return EnumActionResult.FAIL;
case 12:
world.setBlockState(tempPos, ModBlocks.hotcleanironcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible12 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible12.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 13:
world.setBlockState(tempPos, ModBlocks.hotcookedcleanironcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible13 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible13.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 14:
world.setBlockState(tempPos, ModBlocks.failedcleanironcruciblehot.getDefaultState(), 2);
TileBaseCrucible tileCrucible14 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible14.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 15:
world.setBlockState(tempPos, ModBlocks.ironcleanball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 16:
world.setBlockState(tempPos, ModBlocks.ironcleanchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 17:
return EnumActionResult.FAIL;
case 18:
return EnumActionResult.FAIL;
case 19:
return EnumActionResult.FAIL;
case 20:
return EnumActionResult.FAIL;
case 21:
world.setBlockState(tempPos, ModBlocks.hotsteelcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible21 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible21.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 22:
world.setBlockState(tempPos, ModBlocks.hotcookedsteelcrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible22 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible22.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 23:
world.setBlockState(tempPos, ModBlocks.failedsteelcruciblehot.getDefaultState(), 2);
TileBaseCrucible tileCrucible23 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible23.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 24:
world.setBlockState(tempPos, ModBlocks.steelball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 25:
world.setBlockState(tempPos, ModBlocks.steelchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 2);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 29:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible39 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible39.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 40:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible.getDefaultState(), 2);
TileBaseCrucible tileCrucible40 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible40.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
/***************************
* Bronze *
*
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
***************************/
case 45:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_emerald.getDefaultState(), 2);
TileBaseCrucible tileCrucible45 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible45.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 46:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_emerald.getDefaultState(), 2);
TileBaseCrucible tileCrucible46 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible46.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 47:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_diamond.getDefaultState(), 2);
TileBaseCrucible tileCrucible47 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible47.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 48:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_diamond.getDefaultState(), 2);
TileBaseCrucible tileCrucible48 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible48.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 49:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_redstone.getDefaultState(), 2);
TileBaseCrucible tileCrucible49 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible49.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 50:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_redstone.getDefaultState(), 2);
TileBaseCrucible tileCrucible50 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible50.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 51:
world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_lapis.getDefaultState(), 2);
TileBaseCrucible tileCrucible51 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible51.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
case 52:
world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_lapis.getDefaultState(), 2);
TileBaseCrucible tileCrucible52 = (TileBaseCrucible) world.getTileEntity(tempPos);
tileCrucible52.countdown = itemstack.getTagCompound().getInteger("cooldown");
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS;
}
}
}
}
/*****
Pulls the crucible from the Bloomery
*****/
if (world.getBlockState(pos).getBlock() instanceof BloomeryBase) {
if (itemstack.getTagCompound().getInteger("type") == 0) {
TileBloomery tile = (TileBloomery) world.getTileEntity(pos);
if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.emptycruciblehot))) {
itemstack.getTagCompound().setInteger("type", 1);
itemstack.getTagCompound().setInteger("cooldown", 0);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.emptycruciblecrackedhot))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 2);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 3);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 4);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedironcruciblehot))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 5);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcleanironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 12);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedcleanironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 13);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedcleanironcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 14);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotsteelcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 21);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedsteelcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 22);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedsteelcrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 23);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 39);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 40);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
/***************************
* Bronze *
*
45 | Hot Bronze Crucible Emerald
46 | Hot Cooked Bronze Crucible Emerald
47 | Hot Bronze Crucible Diamond
48 | Hot Cooked Bronze Crucible Diamond
49 | Hot Bronze Crucible Redstone
50 | Hot Cooked Bronze Crucible Redstone
51 | Hot Bronze Crucible Lapis
52 | Hot Cooked Bronze Crucible Lapis
***************************/
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_emerald))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 45);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_emerald))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 46);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_diamond))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 47);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_diamond))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 48);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_redstone))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 49);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_redstone))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 50);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_lapis))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 51);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
} else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_lapis))) {
itemstack.getTagCompound().setInteger("cooldown", 0);
itemstack.getTagCompound().setInteger("type", 52);
tile.setSlotStack(1, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
}
/*****
Pulls the Tool Parts from the Forge
*****/
if(itemstack.getTagCompound().getInteger("type") == 0){
if (world.getBlockState(pos).getBlock() instanceof Forge) {
TileForge tile = (TileForge) world.getTileEntity(pos);
for (int i = 2; i < tile.getSlotListSize(); i++) {
if (tile.getSlotStack(i).getItem().equals(ModItems.ironchunkhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 7);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironingotballhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 6);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.pickaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 8);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 9);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironshovelhead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 10);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironhoehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 11);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironcleanchunkhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 16);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.ironcleaningotballhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 15);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironpickaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 17);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 18);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironshovelhead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 19);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironhoehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 20);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelchunkhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 25);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelingotballhot)) {
tile.setSlotStack(i, ItemStack.EMPTY);
itemstack.getTagCompound().setInteger("type", 24);
return EnumActionResult.SUCCESS;
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelpickaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 26);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelaxehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 27);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelshovelhead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 28);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
if (tile.getSlotStack(i).getItem().equals(ModItems.steelhoehead)) {
if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) {
itemstack.getTagCompound().setInteger("type", 29);
NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy();
itemstack.getTagCompound().setTag("tags", tags);
itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage());
//itemstack.getSubCompound("tags").setBoolean("hot", true);
tile.setSlotStack(i, ItemStack.EMPTY);
return EnumActionResult.SUCCESS;
}
}
}
}
}
else return EnumActionResult.FAIL;
//System.out.println(itemstack.getTagCompound().getInteger("type"));
}
//System.out.println(player.getHeldItem(hand).getTagCompound().getInteger("type"));
return EnumActionResult.SUCCESS;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
//tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags"));
//tooltip.add(ChatFormatting.RED + "NBT: " + item.getTagCompound().getInteger("type"));
}
}

View File

@@ -0,0 +1,121 @@
package nmd.primal.forgecraft.items;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.common.crafting.handlers.irecipe.ToolCraftingRecipe;
import nmd.primal.core.common.items.tools.Gallagher;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.util.ToolMaterialMap;
import javax.annotation.Nullable;
import java.util.List;
public class SledgeHammer extends Gallagher implements ToolMaterialMap {
private int attack;
private double speed;
private ToolMaterial material;
public SledgeHammer(String name, Item.ToolMaterial material, Integer attack, Double speed) {
super(material, ToolCraftingRecipe.EnumToolType.MALLET_METAL);
this.setUnlocalizedName(name);
this.setRegistryName(name);
this.setMaxDamage(material.getMaxUses()*3);
this.setHarvestLevel("pickaxe" , material.getHarvestLevel());
this.material=material;
this.attack = attack;
this.speed = speed;
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
/*@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
if(!world.isRemote){
EntityPlayer player = (EntityPlayer) entity;
if(player.inventory.getCurrentItem().getItem().equals(stack.getItem())) {
if(player.isPotionActive(MobEffects.MINING_FATIGUE)) {
if (!player.isSwingInProgress) {
player.removeActivePotionEffect(MobEffects.MINING_FATIGUE);
}
}
}
}
if(isSelected){
entity.setSprinting(false);
}
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitx, float hity, float hitz)
{
if(!world.isRemote) {
IBlockState state = world.getBlockState(pos);
Block block = world.getBlockState(pos).getBlock();
if(!(block instanceof AnvilBase)) {
if (!player.isSwingInProgress) {
int tempInt = 0;
player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, (100 - ((materialModifiers.get(this.getMaterial()) * 13) + tempInt)), 100));
player.swingArm(hand);
return EnumActionResult.SUCCESS;
}
}
}
return EnumActionResult.FAIL;
}*/
public ToolMaterial getMaterial() {
return material;
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack)
{
return false;
}
@Override
public boolean isRepairable()
{
return false;
}
public int getItemEnchantability(ItemStack stack)
{
return 0;
}
@Override
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
{
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
{
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", this.attack, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", this.speed, 0));
}
return multimap;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.add(ChatFormatting.GRAY + "Place a chisel and right click it");
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}

View File

@@ -0,0 +1,580 @@
package nmd.primal.forgecraft.items;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import nmd.primal.core.api.PrimalAPI;
import nmd.primal.core.api.interfaces.IPickup;
import nmd.primal.core.common.helper.NBTHelper;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.core.common.tiles.AbstractTileTank;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.AnvilBase;
import nmd.primal.forgecraft.blocks.NBTCrucible;
import nmd.primal.forgecraft.blocks.machine.Forge;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.tiles.TileNBTCrucible;
import nmd.primal.forgecraft.util.AnvilHandler;
import javax.annotation.Nullable;
import java.util.List;
/**
* Created by mminaie on 12/30/17.
*/
public class SlottedTongs extends Item implements IPickup, AnvilHandler{
@CapabilityInject(IItemHandler.class)
public static Capability<IItemHandler> ITEM_HANDLER;
public SlottedTongs(String unlocalizedName) {
this.setUnlocalizedName(unlocalizedName);
this.setRegistryName(unlocalizedName);
this.setMaxStackSize(1);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
{
NonNullList<ItemStack> renderList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);
if(stack.getTagCompound() != null){
ItemStackHelper.loadAllItems(stack.getTagCompound(), renderList);
ItemStack slotStack = renderList.get(0);
if (stack.getItem() instanceof SlottedTongs) {
if (slotStack.getItem() instanceof ItemNBTCrucible) {
/***Render Empty Crucible***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 0) {
return 0.99f;
}
/***Render Level 1***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 1) {
return 0.011f;
}
/***Render Level 2***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 2) {
return 0.012f;
}
/***Render Level 3***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 3) {
return 0.013f;
}
/***Render Level 4***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 4) {
return 0.014f;
}
/***Render Level 5***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 5) {
return 0.015f;
}
/***Render Level Cooked***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 6) {
return 0.016f;
}
/***Render Failed***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 7) {
return 0.017f;
}
/***Render Hot***/
if (slotStack.getSubCompound("BlockEntityTag").getInteger("hot") == 15) {
return 0.025f;
}
}
if (slotStack.getItem() instanceof ToolPart) {
ToolPart toolPart = (ToolPart) slotStack.getItem();
if (toolPart.getID() == "pickaxe") {
if (slotStack.getSubCompound("tags") != null) {
if (slotStack.getSubCompound("tags").getBoolean("hot")) {
return 0.03f;
}
if (!slotStack.getSubCompound("tags").getBoolean("hot")) {
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON) {
return 0.04f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON) {
return 0.05f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL) {
return 0.06f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL) {
return 0.07f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE) {
return 0.08f;
}
}
}
}
if (toolPart.getID() == "axe") {
if (slotStack.getSubCompound("tags") != null) {
if (slotStack.getSubCompound("tags").getBoolean("hot")) {
return 0.09f;
}
if (!slotStack.getSubCompound("tags").getBoolean("hot")) {
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON) {
return 0.10f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON) {
return 0.11f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL) {
return 0.12f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL) {
return 0.13f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE) {
return 0.14f;
}
}
}
}
if (toolPart.getID() == "shovel") {
if (slotStack.getSubCompound("tags") != null) {
if (slotStack.getSubCompound("tags").getBoolean("hot")) {
return 0.15f;
}
if (!slotStack.getSubCompound("tags").getBoolean("hot")) {
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON) {
return 0.16f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON) {
return 0.17f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL) {
return 0.18f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL) {
return 0.19f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE) {
return 0.20f;
}
}
}
}
if (toolPart.getID() == "hoe") {
if (slotStack.getSubCompound("tags") != null) {
if (slotStack.getSubCompound("tags").getBoolean("hot")) {
return 0.21f;
}
if (!slotStack.getSubCompound("tags").getBoolean("hot")) {
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON) {
return 0.22f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON) {
return 0.23f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL) {
return 0.24f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL) {
return 0.25f;
}
if (toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE) {
return 0.26f;
}
}
}
}
}
if (slotStack.getItem() instanceof BaseMultiItem) {
Item slotItem = slotStack.getItem();
if (slotStack.getTagCompound() != null) {
if (!slotStack.getTagCompound().getBoolean("hot")) {
if (slotItem.equals(ModItems.bronzeingotball)) {
return 0.27f;
}
if (slotItem.equals(ModItems.ironingotball)) {
return 0.28f;
}
if (slotItem.equals(ModItems.ironcleaningotball)) {
return 0.29f;
}
if (slotItem.equals(ModItems.steelingotball)) {
return 0.30f;
}
if (slotItem.equals(ModItems.wootzingotball)) {
return 0.31f;
}
if (slotItem.equals(ModItems.bronzechunk)) {
return 0.32f;
}
if (slotItem.equals(ModItems.wroughtironchunk)) {
return 0.33f;
}
if (slotItem.equals(ModItems.ironcleanchunk)) {
return 0.34f;
}
if (slotItem.equals(ModItems.steelchunk)) {
return 0.35f;
}
if (slotItem.equals(ModItems.wootzchunk)) {
return 0.36f;
}
}
if (slotStack.getTagCompound().getBoolean("hot")) {
if (slotItem.equals(ModItems.bronzeingotball)) {
return 0.37f;
}
if (slotItem.equals(ModItems.ironingotball)) {
return 0.38f;
}
if (slotItem.equals(ModItems.ironcleaningotball)) {
return 0.39f;
}
if (slotItem.equals(ModItems.steelingotball)) {
return 0.40f;
}
if (slotItem.equals(ModItems.wootzingotball)) {
return 0.41f;
}
if (slotItem.equals(ModItems.bronzechunk)) {
return 0.42f;
}
if (slotItem.equals(ModItems.wroughtironchunk)) {
return 0.43f;
}
if (slotItem.equals(ModItems.ironcleanchunk)) {
return 0.44f;
}
if (slotItem.equals(ModItems.steelchunk)) {
return 0.45f;
}
if (slotItem.equals(ModItems.wootzchunk)) {
return 0.46f;
}
}
}
}
}
}
return 0.0F;
}
});
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitx, float hity, float hitz)
{
if(!world.isRemote) {
if (hand.equals(player.getActiveHand())) {
IBlockState state = world.getBlockState(pos);
Block block = world.getBlockState(pos).getBlock();
ItemStack itemstack = player.getHeldItem(hand);
SlottedTongs itemstackItem = (SlottedTongs) itemstack.getItem();
IItemHandler inventory = itemstack.getCapability(ITEM_HANDLER, null);
ItemStack slotStack = inventory.getStackInSlot(0).copy();
if (!(block instanceof AnvilBase)) {
if (!(block instanceof Forge)) {
if (slotStack.isEmpty()) {
if (block instanceof NBTCrucible) {
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
ItemStack tempStack = takeBlock(world, pos, state, face, player, block).copy();
inventory.insertItem(0, tempStack, false);
world.setBlockState(pos, this.getReplacementBlock(world, pos, state));
world.markTileEntityForRemoval(tile);
//itemstack.getItem().updateItemStackNBT(itemstack.getTagCompound());
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
}
if (!slotStack.isEmpty()) {
if (slotStack.getItem() instanceof ItemNBTCrucible) {
NBTTagCompound tag = slotStack.getSubCompound("BlockEntityTag").copy();
if (tag != null) {
ItemBlock temp = (ItemBlock) slotStack.getItem();
int i = this.getMetadata(slotStack.getMetadata());
IBlockState iblockstate1 = temp.getBlock().getStateForPlacement(world, pos, face, hitx, hity, hitz, i, player, hand);
temp.placeBlockAt(slotStack, player, world, pos.up(1), face, hitx, hity, hitz, iblockstate1);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
}
}
/*****
DROPS the ToolParts into the World
*****/
if (!slotStack.isEmpty()) {
if (slotStack.getItem() instanceof ToolPart) {
ItemStack tempStack = slotStack;
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
}
/*****
Cools the Ingots on the Tongs
*****/
if (!slotStack.isEmpty()) {
if (world.getBlockState(pos).getBlock() == PrimalAPI.Blocks.BARREL) {
AbstractTileTank tileTank = (AbstractTileTank) world.getTileEntity(pos);
if (slotStack.getTagCompound().getBoolean("hot")) {
if (tileTank.getContainedFluid().getFluid().equals(FluidRegistry.WATER) ||
tileTank.getContainedFluid().getFluid().equals(PrimalAPI.Fluids.RAIN_WATER)
) {
ItemStack tempStack = slotStack.copy();
tempStack.getTagCompound().setBoolean("hot", false);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
world.playSound(null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.AMBIENT, 1.0F, PrimalAPI.getRandom().nextFloat() * 0.4F + 0.8F);
return EnumActionResult.SUCCESS;
}
}
}
}
/*****
DROPS the Ingots into the World
*****/
if (!slotStack.isEmpty()) {
if (slotStack.getItem() instanceof BaseMultiItem) {
ItemStack tempStack = slotStack.copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
if (!(slotStack.getItem() instanceof BaseMultiItem)) {
if (RecipeHelper.isOreName(slotStack.getItem(), "ingotIron")) {
ItemStack tempStack = slotStack.copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
if (RecipeHelper.isOreName(slotStack.getItem(), "nuggetIron")) {
ItemStack tempStack = slotStack.copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
if (RecipeHelper.isOreName(slotStack.getItem(), "ingotSteel")) {
ItemStack tempStack = slotStack.copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
if (RecipeHelper.isOreName(slotStack.getItem(), "nuggetSteel")) {
ItemStack tempStack = slotStack.copy();
PlayerHelper.spawnItemOnGround(world, pos, tempStack);
inventory.extractItem(0, 1, false);
itemstackItem.markDirty(itemstack);
return EnumActionResult.SUCCESS;
}
}
}
}
}
}
}
return EnumActionResult.FAIL;
}
public ItemStack getItem(World world, BlockPos pos, IBlockState state, Block block)
{
block = world.getBlockState(pos).getBlock();
return NBTHelper.getStackBlockNBT(world, pos, state, new ItemStack(Item.getItemFromBlock(block), 1, block.damageDropped(state)));
}
public ItemStack takeBlock(World world, BlockPos pos, IBlockState state, EnumFacing face, EntityPlayer player, Block block)
{
if (!world.isRemote) {
block = world.getBlockState(pos).getBlock();
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileNBTCrucible) {
return this.getItem(world, pos, state, block);
//PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, this.getItem(world, pos, state, block));
//world.updateComparatorOutputLevel(pos, state.getBlock());
}
}
return ItemStack.EMPTY;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
{
/*if(!stack.isEmpty())
{
IItemHandler inventory = stack.getCapability(ITEM_HANDLER, null);
ItemStack slotStack = inventory.getStackInSlot(0).copy();
if (!slotStack.isEmpty())
{
tooltip.add(ChatFormatting.GRAY + "Holding: " + slotStack.getItem().getUnlocalizedName());
/*
tooltip.add(ChatFormatting.GRAY + "Upgrades: " + (3 - getModifiers(item)) );
if (getEmerald(item) == true) {
tooltip.add(ChatFormatting.DARK_GREEN + "Emerald");
}
if (getDiamondLevel(item) > 0) {
tooltip.add(ChatFormatting.AQUA + "Diamond Level: " + getDiamondLevel(item));
}
if (getRedstoneLevel(item) > 0) {
tooltip.add(ChatFormatting.RED + "Redstone Level: " + getRedstoneLevel(item) );
}
if (getLapisLevel(item) > 0) {
tooltip.add(ChatFormatting.BLUE + "Lapis Level: " + getLapisLevel(item) );
}
tooltip.add(ChatFormatting.LIGHT_PURPLE + "Damage: " + item.getItemDamage() );
}
}
*/
}
@Override
public ICapabilityProvider initCapabilities(final ItemStack stack, NBTTagCompound nbt)
{
return new ICapabilitySerializable<NBTTagCompound>()
{
@Override
public NBTTagCompound serializeNBT() {
return itemHandler .serializeNBT();
}
@Override
public void deserializeNBT(NBTTagCompound nbt) {
itemHandler.deserializeNBT(nbt);
}
final ItemStackHandler itemHandler = new ItemStackHandler(1);
private NBTTagCompound cachedNetData;
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing)
{
if (capability == ITEM_HANDLER)
return true;
return false;
}
@SuppressWarnings("unchecked")
@Nullable
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
{
if (capability == ITEM_HANDLER)
return (T) itemHandler;
return null;
}
};
}
/**
* Update this with what you need to send to the client
*/
@Override
public NBTTagCompound getNBTShareTag(ItemStack stack)
{
ItemStackHandler h = (ItemStackHandler)stack.getCapability(ITEM_HANDLER, null);
if(stack.getTagCompound() != null) {
NBTTagCompound tag = stack.getTagCompound().copy();
tag.setTag("Inventory", h.serializeNBT());
tag.removeTag("changeNumber");
return tag;
}
return null;
}
/**
* What does the item do when it receives nbt Info
*/
@Override
public void readNBTShareTag(ItemStack stack, @Nullable NBTTagCompound nbt)
{
if (nbt != null)
{
ItemStackHandler h = (ItemStackHandler)stack.getCapability(ITEM_HANDLER, null);
h.deserializeNBT(nbt.getCompoundTag("Inventory"));
//nbt.removeTag("Inventory");
stack.setTagCompound(nbt);
}
}
@Override
public boolean getShareTag()
{
return true;
}
@Override
public boolean updateItemStackNBT(NBTTagCompound nbt)
{
return true;
}
public void markDirty(ItemStack stack) {
NBTTagCompound tag = stack.getTagCompound();
IItemHandler inventory = stack.getCapability(ITEM_HANDLER, null);
NonNullList<ItemStack> sendList = NonNullList.<ItemStack>withSize(1, inventory.getStackInSlot(0));
if (stack.getTagCompound() != null) {
stack.getTagCompound().setInteger("changeNumber", tag.getInteger("changeNumber") + 1);
ItemStackHelper.saveAllItems(stack.getTagCompound(), sendList);
} else {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setInteger("changeNumber", 0);
ItemStackHelper.saveAllItems(tagCompound, sendList);
stack.setTagCompound(tagCompound);
}
}
}

View File

@@ -0,0 +1,14 @@
package nmd.primal.forgecraft.items;
import nmd.primal.core.common.items.tools.WorkBlade;
import nmd.primal.forgecraft.ModInfo;
public class Workblade extends WorkBlade {
public Workblade(String name, ToolMaterial material, float speed) {
super(material, speed);
this.setRegistryName(name);
this.setUnlocalizedName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
}
}

Some files were not shown because too many files have changed in this diff Show More