From 092c076dba5e54af2ecd1b28a32cb634e844c5a7 Mon Sep 17 00:00:00 2001 From: MysteriousAges Date: Mon, 6 May 2013 00:24:06 -0700 Subject: [PATCH] Work on the Effect jar, which is finally done! \o/ --- thaumicbees_res/changelog.txt | 5 + thaumicbees_res/lang/thaumicbees/en_US.xml | 1 + .../mods/thaumicbees/model/effectJar.obj | 582 ++++++++++++++++++ .../thaumicbees/textures/model/jarTexture.png | Bin 0 -> 5376 bytes .../utils}/gui/SlotCustomItems.java | 18 +- .../bees/FlowerProviderAuraNode.java | 11 +- .../thaumicbees/block/BlockEffectJar.java | 75 ++- .../thaumicbees/block/BlockPlanks.java | 2 + .../thaumicbees/block/BlockWoodSlab.java | 24 +- .../client/gui/ContainerEffectJar.java | 123 ++++ .../{ => client}/gui/GUIEffectJar.java | 27 +- .../{ => client}/gui/GUIHandler.java | 6 +- .../{ => client}/gui/UIScreens.java | 2 +- .../client/model/ModelEffectJar.java | 38 ++ .../client/render/EffectJarRenderer.java | 79 +++ .../thaumicbees/gui/ContainerEffectJar.java | 95 --- .../thaumicbees/item/ItemThaumiumGrafter.java | 37 +- .../thaumicbees/main/ClientProxy.java | 18 +- .../thaumicbees/main/CommonProxy.java | 17 +- thaumicbees_src/thaumicbees/main/Config.java | 5 - .../thaumicbees/main/ThaumicBees.java | 6 +- .../main/utils/CraftingManager.java | 20 +- .../tileentity/EffectJarHousing.java | 44 +- .../tileentity/TileEntityEffectJar.java | 170 +++-- 24 files changed, 1182 insertions(+), 223 deletions(-) create mode 100644 thaumicbees_res/mods/thaumicbees/model/effectJar.obj create mode 100644 thaumicbees_res/mods/thaumicbees/textures/model/jarTexture.png rename thaumicbees_src/{thaumicbees => net/mysteriousages/utils}/gui/SlotCustomItems.java (83%) create mode 100644 thaumicbees_src/thaumicbees/client/gui/ContainerEffectJar.java rename thaumicbees_src/thaumicbees/{ => client}/gui/GUIEffectJar.java (66%) rename thaumicbees_src/thaumicbees/{ => client}/gui/GUIHandler.java (72%) rename thaumicbees_src/thaumicbees/{ => client}/gui/UIScreens.java (57%) create mode 100644 thaumicbees_src/thaumicbees/client/model/ModelEffectJar.java create mode 100644 thaumicbees_src/thaumicbees/client/render/EffectJarRenderer.java delete mode 100644 thaumicbees_src/thaumicbees/gui/ContainerEffectJar.java diff --git a/thaumicbees_res/changelog.txt b/thaumicbees_res/changelog.txt index 24fde96..895a87a 100644 --- a/thaumicbees_res/changelog.txt +++ b/thaumicbees_res/changelog.txt @@ -1,3 +1,8 @@ +Added the Bee Collector's Jar. +Created an alternate recipe for the Temporal Frame that is always active. +Adjusted TC3 alternate recipe for the Temporal Frame. +Fixed an issue with the "Pick Block" function on the Greatwood & Silverwood planks. Should also stop NEI from providing incorrect block info on them. +Fixed the Node flower growing flowers. Adding Apatite bees. 1.4.6 diff --git a/thaumicbees_res/lang/thaumicbees/en_US.xml b/thaumicbees_res/lang/thaumicbees/en_US.xml index 00cf080..c083f87 100644 --- a/thaumicbees_res/lang/thaumicbees/en_US.xml +++ b/thaumicbees_res/lang/thaumicbees/en_US.xml @@ -12,6 +12,7 @@ Greatwood Slab Silverwood Planks Silverwood Slab + Bee Collector's Jar Occult Comb diff --git a/thaumicbees_res/mods/thaumicbees/model/effectJar.obj b/thaumicbees_res/mods/thaumicbees/model/effectJar.obj new file mode 100644 index 0000000..28195e9 --- /dev/null +++ b/thaumicbees_res/mods/thaumicbees/model/effectJar.obj @@ -0,0 +1,582 @@ +# Blender v2.61 (sub 0) OBJ File: 'untitled.blend' +# www.blender.org +o jarLid +v 0.662251 0.792153 0.427678 +v 0.662251 0.792153 0.561617 +v 0.567542 0.792153 0.656327 +v 0.433603 0.792153 0.656327 +v 0.338893 0.792153 0.561618 +v 0.338893 0.792153 0.427678 +v 0.500572 0.792153 0.494648 +v 0.433603 0.792153 0.332969 +v 0.567542 0.792153 0.332969 +v 0.670335 0.764287 0.424330 +v 0.670335 0.764287 0.564966 +v 0.570890 0.764287 0.664411 +v 0.430254 0.764287 0.664411 +v 0.330809 0.764287 0.564966 +v 0.330809 0.764287 0.424330 +v 0.430254 0.764287 0.324885 +v 0.500572 0.764287 0.494648 +v 0.570890 0.764287 0.324885 +vt 0.492673 0.825009 +vt 0.525702 0.795846 +vt 0.646961 0.969937 +vt 0.608157 0.990808 +vt 0.031140 0.631984 +vt 0.074045 0.639292 +vt 0.050933 0.785797 +vt 0.006872 0.785813 +vt 0.081042 0.977922 +vt 0.038143 0.987974 +vt 0.013744 0.777223 +vt 0.057805 0.777207 +vt 0.342147 0.199526 +vt 0.338921 0.243469 +vt 0.187294 0.207947 +vt 0.197740 0.165696 +vt 0.544028 0.191123 +vt 0.550896 0.234645 +vt 0.600295 0.357122 +vt 0.644058 0.362232 +vt 0.602062 0.512194 +vt 0.560298 0.499944 +vt 0.600562 0.155067 +vt 0.644339 0.150074 +vt 0.560944 0.012139 +vt 0.602740 0.000000 +vt 0.608113 0.498928 +vt 0.649745 0.750816 +vt 0.324872 0.675127 +vt 0.400562 0.350255 +vt 0.148673 0.391886 +vt 0.000000 0.599437 +vt 0.046785 0.851326 +vt 0.005154 0.599437 +vt 0.330026 0.675127 +vt 0.249183 1.000000 +vt 0.041631 0.851326 +vt 0.501072 0.958366 +vt 0.324194 0.325913 +vt 0.648389 0.190915 +vt 0.648389 0.460910 +vt 0.458480 0.651825 +vt 0.189908 0.651825 +vt 0.017180 0.452320 +vt 0.341374 0.317323 +vt 0.207088 0.643235 +vt 0.025770 0.189197 +vt 0.349964 0.324195 +vt 0.025770 0.459192 +vt 0.201935 0.000000 +vt 0.336220 0.325913 +vt 0.012026 0.190915 +vt 0.458481 0.000000 +vt 0.189909 -0.000000 +vn 0.679110 0.278604 -0.679110 +vn 0.960403 0.278615 0.000000 +vn 0.679109 0.278615 0.679106 +vn 0.000000 0.278615 0.960403 +vn -0.679105 0.278615 0.679109 +vn -0.960403 0.278615 0.000000 +vn -0.679105 0.278616 -0.679109 +vn 0.000000 0.278615 -0.960403 +vn 0.620930 0.740440 -0.257210 +vn 0.257210 0.740440 -0.620930 +vn 0.000000 1.000000 0.000000 +vn 0.620930 0.740440 0.257179 +vn 0.257210 0.740440 0.620930 +vn -0.257179 0.740440 0.620930 +vn -0.620930 0.740440 0.257210 +vn -0.620930 0.740440 -0.257210 +vn -0.257179 0.740440 -0.620930 +vn 0.000000 -1.000000 0.000000 +vn 0.328410 -0.513199 -0.792901 +vn 0.792901 -0.513199 -0.328410 +vn 0.792901 -0.513199 0.328440 +vn 0.328440 -0.513199 0.792901 +vn -0.328440 -0.513199 0.792901 +vn -0.792932 -0.513199 0.328440 +vn -0.792901 -0.513199 -0.328440 +vn -0.328440 -0.513199 -0.792901 +s off +f 1/1/1 10/2/1 18/3/1 +f 1/1/1 18/3/1 9/4/1 +f 10/5/2 1/6/2 2/7/2 +f 10/5/2 2/7/2 11/8/2 +f 3/9/3 12/10/3 11/11/3 +f 3/9/3 11/11/3 2/12/3 +f 4/13/4 13/14/4 12/15/4 +f 4/13/4 12/15/4 3/16/4 +f 5/17/5 14/18/5 13/14/5 +f 5/17/5 13/14/5 4/13/5 +f 6/19/6 15/20/6 14/21/6 +f 6/19/6 14/21/6 5/22/6 +f 8/23/7 16/24/7 15/20/7 +f 8/23/7 15/20/7 6/19/7 +f 9/25/8 18/26/8 16/24/8 +f 9/25/8 16/24/8 8/23/8 +s 1 +f 1/27/9 9/28/10 7/29/11 +f 2/30/12 1/27/9 7/29/11 +f 3/31/13 2/30/12 7/29/11 +f 4/32/14 3/31/13 7/29/11 +f 5/33/15 4/34/14 7/35/11 +f 6/36/16 5/37/15 7/29/11 +f 8/38/17 6/36/16 7/29/11 +f 9/28/10 8/38/17 7/29/11 +f 17/39/18 18/40/19 10/41/20 +f 11/42/21 17/39/18 10/41/20 +f 12/43/22 17/39/18 11/42/21 +f 13/44/23 17/45/18 12/46/22 +f 14/47/24 17/48/18 13/49/23 +f 15/50/25 17/51/18 14/52/24 +f 16/53/26 17/39/18 15/54/25 +f 18/40/19 17/39/18 16/53/26 +o jarBase +v 0.586676 0.028885 0.286775 +v 0.586676 0.627663 0.286775 +v 0.414468 0.627663 0.286775 +v 0.414468 0.028885 0.286775 +v 0.292699 0.627663 0.408544 +v 0.292699 0.028885 0.408544 +v 0.292699 0.627663 0.580752 +v 0.292699 0.028885 0.580752 +v 0.414468 0.627663 0.702521 +v 0.414468 0.028885 0.702521 +v 0.586676 0.627663 0.702521 +v 0.586676 0.028885 0.702521 +v 0.708445 0.627663 0.580752 +v 0.708445 0.028885 0.580752 +v 0.708445 0.627663 0.408544 +v 0.708445 0.028885 0.408544 +v 0.500572 0.017159 0.494648 +v 0.560845 0.706413 0.349137 +v 0.440299 0.706413 0.349137 +v 0.355061 0.706413 0.434375 +v 0.355061 0.706413 0.554921 +v 0.440300 0.706413 0.640159 +v 0.560845 0.706413 0.640159 +v 0.646083 0.706413 0.554920 +v 0.646083 0.706413 0.434375 +v 0.560845 0.764881 0.349137 +v 0.440299 0.764881 0.349137 +v 0.355061 0.764881 0.434375 +v 0.355061 0.764881 0.554921 +v 0.440300 0.764881 0.640159 +v 0.560845 0.764881 0.640159 +v 0.646083 0.764881 0.554920 +v 0.646083 0.764881 0.434375 +v 0.596243 0.003573 0.263678 +v 0.404901 0.003573 0.263678 +v 0.404901 0.633581 0.263678 +v 0.596243 0.633580 0.263678 +v 0.269602 0.003573 0.398977 +v 0.269602 0.633581 0.398977 +v 0.269602 0.003573 0.590319 +v 0.269602 0.633581 0.590319 +v 0.404901 0.003573 0.725618 +v 0.404901 0.633581 0.725618 +v 0.596243 0.003573 0.725618 +v 0.596243 0.633581 0.725618 +v 0.731542 0.003573 0.590319 +v 0.731542 0.633581 0.590319 +v 0.731542 0.003573 0.398977 +v 0.731542 0.633580 0.398977 +v 0.500572 0.003573 0.494648 +v 0.433603 0.721081 0.332969 +v 0.567542 0.721080 0.332969 +v 0.338893 0.721081 0.427678 +v 0.338893 0.721081 0.561618 +v 0.433603 0.721081 0.656327 +v 0.567542 0.721081 0.656327 +v 0.662251 0.721081 0.561617 +v 0.662251 0.721080 0.427678 +v 0.433603 0.764830 0.332969 +v 0.567542 0.764830 0.332969 +v 0.338893 0.764830 0.427678 +v 0.338893 0.764830 0.561618 +v 0.433603 0.764830 0.656327 +v 0.567542 0.764830 0.656327 +v 0.662251 0.764830 0.561617 +v 0.662251 0.764830 0.427678 +vt 0.897412 0.384835 +vt 0.897412 0.173090 +vt 0.797595 0.173090 +vt 0.797595 0.384835 +vt 0.818211 0.268012 +vt 0.818211 0.056267 +vt 0.718393 0.056267 +vt 0.718393 0.268012 +vt 0.777909 0.678223 +vt 0.777909 0.889966 +vt 0.877726 0.889966 +vt 0.877726 0.678223 +vt 0.817596 0.319163 +vt 0.817596 0.530907 +vt 0.917413 0.530907 +vt 0.917413 0.319163 +vt 0.882340 0.406610 +vt 0.882340 0.618355 +vt 0.982158 0.618355 +vt 0.982158 0.406610 +vt 0.881285 0.612768 +vt 0.881285 0.824513 +vt 0.981102 0.824513 +vt 0.981102 0.612768 +vt 0.670291 0.319645 +vt 0.670291 0.531390 +vt 0.770109 0.531390 +vt 0.770109 0.319645 +vt 0.852746 0.536544 +vt 0.852746 0.324799 +vt 0.752929 0.324799 +vt 0.752929 0.536544 +vt 0.854462 0.336299 +vt 0.824517 0.286892 +vt 0.754645 0.286892 +vt 0.754645 0.336299 +vt 0.984538 0.633510 +vt 0.984538 0.584103 +vt 0.914665 0.584103 +vt 0.884720 0.633510 +vt 0.759011 0.817811 +vt 0.788956 0.867218 +vt 0.858828 0.867218 +vt 0.858828 0.817811 +vt 0.788390 0.950593 +vt 0.788390 1.000000 +vt 0.858262 1.000000 +vt 0.888207 0.950593 +vt 0.823928 0.889797 +vt 0.853874 0.939204 +vt 0.923746 0.939204 +vt 0.923746 0.889797 +vt 0.877361 0.869181 +vt 0.877361 0.918588 +vt 0.947233 0.918588 +vt 0.977178 0.869181 +vt 0.668573 0.536544 +vt 0.698519 0.585951 +vt 0.768391 0.585951 +vt 0.768391 0.536544 +vt 0.752929 0.585951 +vt 0.822801 0.585951 +vt 0.750644 0.137427 +vt 0.750644 0.096811 +vt 0.680772 0.096811 +vt 0.680772 0.137427 +vt 0.979701 0.372791 +vt 0.979701 0.332175 +vt 0.909828 0.332175 +vt 0.909828 0.372791 +vt 0.790674 0.862064 +vt 0.790674 0.902681 +vt 0.860546 0.902681 +vt 0.860546 0.862064 +vt 0.707645 0.959383 +vt 0.707645 1.000000 +vt 0.777517 1.000000 +vt 0.777517 0.959383 +vt 0.685512 0.880792 +vt 0.685512 0.921408 +vt 0.755384 0.921408 +vt 0.755384 0.880792 +vt 0.666048 0.925460 +vt 0.666048 0.966076 +vt 0.735920 0.966076 +vt 0.735920 0.925460 +vt 0.683057 0.585951 +vt 0.683057 0.626568 +vt 0.752929 0.626568 +vt 0.822801 0.626568 +vt 0.718750 0.375000 +vt 0.875000 0.375000 +vt 0.843750 0.687500 +vt 0.687500 0.656250 +vt 0.967358 0.400183 +vt 0.873608 0.400183 +vt 0.873608 0.118933 +vt 0.967358 0.087683 +vt 0.822829 0.901835 +vt 0.666579 0.901835 +vt 0.666579 0.620585 +vt 0.822829 0.620585 +vt 0.982820 0.535099 +vt 0.857820 0.535099 +vt 0.857820 0.253849 +vt 0.982820 0.222599 +vt 0.834116 0.281250 +vt 0.677866 0.281250 +vt 0.677866 0.000000 +vt 0.834116 0.000000 +vt 0.889178 0.312500 +vt 0.795428 0.312500 +vt 0.795428 0.000000 +vt 0.889178 0.031250 +vt 0.679410 0.005633 +vt 0.835660 0.005633 +vt 0.835660 0.286883 +vt 0.710660 0.286883 +vt 0.667297 0.383590 +vt 0.792297 0.383590 +vt 0.792297 0.664840 +vt 0.667297 0.664840 +vt 0.812500 0.750000 +vt 0.687500 0.718750 +vt 0.982168 0.829767 +vt 0.982168 0.986017 +vt 0.919668 0.954767 +vt 0.919668 0.861017 +vt 0.817675 0.867975 +vt 0.661425 0.867975 +vt 0.692675 0.774225 +vt 0.786425 0.774225 +vt 0.875000 0.656250 +vt 0.875000 0.531250 +vt 0.937500 0.531250 +vt 0.937500 0.656250 +vt 0.984538 0.121564 +vt 0.828288 0.121564 +vt 0.859538 0.027814 +vt 0.984538 0.027814 +vt 0.826178 0.623521 +vt 0.826178 0.467271 +vt 0.888678 0.498521 +vt 0.888678 0.592271 +vt 0.832637 0.797125 +vt 0.957637 0.797125 +vt 0.957637 0.890875 +vt 0.832637 0.890875 +vt 0.937500 0.375000 +vt 0.875000 0.500000 +vt 0.812500 0.781250 +vt 0.687500 0.781250 +vt 0.875000 0.781250 +vt 0.875000 0.812500 +vt 0.958224 0.659120 +vt 0.864474 0.659120 +vt 0.864474 0.627870 +vt 0.958224 0.627870 +vt 0.872564 0.031250 +vt 0.810064 0.031250 +vt 0.810064 0.000000 +vt 0.872564 0.000000 +vt 0.913143 0.617084 +vt 0.788143 0.617084 +vt 0.788143 0.585834 +vt 0.913143 0.585834 +vt 0.917884 0.561021 +vt 0.980384 0.561021 +vt 0.980384 0.592271 +vt 0.917884 0.592271 +vt 0.803431 0.765462 +vt 0.928431 0.765462 +vt 0.928431 0.796712 +vt 0.803431 0.796712 +vt 0.679323 0.945850 +vt 0.741823 0.945850 +vt 0.741823 0.977100 +vt 0.679323 0.977100 +vt 0.856845 0.759676 +vt 0.757027 0.659859 +vt 0.715682 0.759676 +vt 0.757027 0.859494 +vt 0.779536 1.000000 +vt 0.779536 0.858837 +vt 0.679718 0.958655 +vt 0.884507 0.957419 +vt 0.784690 0.857601 +vt 0.784690 0.998764 +vt 0.925853 0.900182 +vt 0.784690 0.900182 +vt 0.884507 1.000000 +vt 0.954944 0.896941 +vt 0.855127 0.996758 +vt 0.996290 0.996758 +vt 0.856845 0.618513 +vt 0.956662 0.659859 +vt 0.981102 0.318719 +vt 0.856102 0.443719 +vt 0.793602 0.256219 +vt 0.988800 0.133264 +vt 0.988800 0.289514 +vt 0.801300 0.227014 +vt 0.862974 0.068719 +vt 0.987974 0.162469 +vt 0.800474 0.256219 +vt 0.819698 0.018898 +vt 0.975948 0.018898 +vt 0.913448 0.206398 +vt 0.812500 0.093750 +vt 0.906250 0.000000 +vt 1.000000 0.187500 +vt 0.661904 0.317001 +vt 0.661904 0.160751 +vt 0.849404 0.254501 +vt 0.750500 0.438566 +vt 0.656750 0.313566 +vt 0.844250 0.251066 +vt 0.891288 0.397334 +vt 0.735038 0.397334 +vt 0.828788 0.209834 +vn 0.000000 -0.000000 1.000000 +vn 0.707107 -0.000000 0.707107 +vn 1.000000 0.000000 0.000000 +vn 0.707107 0.000000 -0.707107 +vn 0.000000 0.000000 -1.000000 +vn -0.707107 0.000000 -0.707107 +vn -1.000000 0.000000 0.000000 +vn -0.707107 -0.000000 0.707107 +vn 0.000000 -0.620815 0.783957 +vn 0.554342 -0.620814 0.554342 +vn 0.783958 -0.620814 -0.000000 +vn 0.554339 -0.620816 -0.554342 +vn 0.000000 -0.620815 -0.783957 +vn -0.554342 -0.620816 -0.554340 +vn -0.783957 -0.620815 -0.000000 +vn -0.554342 -0.620814 0.554342 +vn 0.707102 0.000000 -0.707111 +vn -0.707111 0.000000 -0.707103 +vn 0.000004 0.620814 -0.783958 +vn -0.554340 0.620815 -0.554343 +vn -0.783958 0.620814 0.000000 +vn -0.554340 0.620815 0.554343 +vn 0.000000 0.620814 0.783958 +vn 0.554343 0.620815 0.554340 +vn 0.783958 0.620814 -0.000004 +vn 0.554342 0.620813 -0.554342 +vn -0.707103 0.000000 -0.707111 +vn -0.707103 0.000000 0.707111 +vn 0.707111 0.000000 0.707103 +vn 0.000000 0.999969 0.000000 +vn -0.302011 0.614032 0.729179 +vn 0.302011 0.614032 0.729179 +vn 0.729179 0.614032 0.302011 +vn 0.729179 0.614032 -0.302011 +vn 0.302011 0.614032 -0.729179 +vn -0.302011 0.614032 -0.729179 +vn -0.729179 0.614032 -0.302011 +vn -0.729179 0.614032 0.302011 +vn -0.297098 -0.630238 -0.717277 +vn 0.297098 -0.630238 -0.717277 +vn -0.717277 -0.630238 -0.297098 +vn -0.717277 -0.630238 0.297098 +vn -0.297098 -0.630238 0.717277 +vn 0.297098 -0.630238 0.717277 +vn 0.717277 -0.630238 0.297098 +vn 0.717277 -0.630238 -0.297098 +s off +f 19/55/27 20/56/27 21/57/27 +f 19/55/27 21/57/27 22/58/27 +f 22/59/28 21/60/28 23/61/28 +f 22/59/28 23/61/28 24/62/28 +f 24/63/29 23/64/29 25/65/29 +f 24/63/29 25/65/29 26/66/29 +f 26/67/30 25/68/30 27/69/30 +f 26/67/30 27/69/30 28/70/30 +f 28/71/31 27/72/31 29/73/31 +f 28/71/31 29/73/31 30/74/31 +f 30/75/32 29/76/32 31/77/32 +f 30/75/32 31/77/32 32/78/32 +f 32/79/33 31/80/33 33/81/33 +f 32/79/33 33/81/33 34/82/33 +f 20/83/34 19/84/34 34/85/34 +f 20/83/34 34/85/34 33/86/34 +f 20/87/35 36/88/35 37/89/35 +f 20/87/35 37/89/35 21/90/35 +f 21/91/36 37/92/36 38/93/36 +f 21/91/36 38/93/36 23/94/36 +f 23/95/37 38/96/37 39/97/37 +f 23/95/37 39/97/37 25/98/37 +f 25/99/38 39/100/38 40/101/38 +f 25/99/38 40/101/38 27/102/38 +f 27/103/39 40/104/39 41/105/39 +f 27/103/39 41/105/39 29/106/39 +f 29/107/40 41/108/40 42/109/40 +f 29/107/40 42/109/40 31/110/40 +f 31/111/41 42/112/41 43/113/41 +f 31/111/41 43/113/41 33/114/41 +f 33/86/42 43/115/42 36/116/42 +f 33/86/42 36/116/42 20/83/42 +f 36/117/27 44/118/27 45/119/27 +f 36/117/27 45/119/27 37/120/27 +f 37/121/28 45/122/28 46/123/28 +f 37/121/28 46/123/28 38/124/28 +f 38/125/29 46/126/29 47/127/29 +f 38/125/29 47/127/29 39/128/29 +f 39/129/43 47/130/43 48/131/43 +f 39/129/43 48/131/43 40/132/43 +f 40/133/31 48/134/31 49/135/31 +f 40/133/31 49/135/31 41/136/31 +f 41/137/44 49/138/44 50/139/44 +f 41/137/44 50/139/44 42/140/44 +f 42/141/33 50/142/33 51/143/33 +f 42/141/33 51/143/33 43/115/33 +f 43/115/34 51/143/34 44/144/34 +f 43/115/34 44/144/34 36/116/34 +f 52/145/31 53/146/31 54/147/31 +f 52/145/31 54/147/31 55/148/31 +f 53/149/32 56/150/32 57/151/32 +f 53/149/32 57/151/32 54/152/32 +f 56/153/33 58/154/33 59/155/33 +f 56/153/33 59/155/33 57/156/33 +f 58/157/34 60/158/34 61/159/34 +f 58/157/34 61/159/34 59/160/34 +f 60/161/27 62/162/27 63/163/27 +f 60/161/27 63/163/27 61/164/27 +f 62/165/28 64/166/28 65/167/28 +f 62/165/28 65/167/28 63/168/28 +f 64/169/29 66/170/29 67/171/29 +f 64/169/29 67/171/29 65/172/29 +f 66/173/30 52/174/30 55/175/30 +f 66/173/30 55/175/30 67/176/30 +f 55/148/45 54/147/45 69/177/45 +f 55/148/45 69/177/45 70/178/45 +f 54/179/46 57/180/46 71/181/46 +f 54/179/46 71/181/46 69/182/46 +f 57/183/47 59/184/47 72/185/47 +f 57/183/47 72/185/47 71/186/47 +f 59/187/48 61/188/48 73/189/48 +f 59/187/48 73/189/48 72/190/48 +f 61/191/49 63/192/49 74/193/49 +f 61/191/49 74/193/49 73/194/49 +f 63/195/50 65/196/50 75/197/50 +f 63/195/50 75/197/50 74/198/50 +f 65/199/51 67/200/51 76/201/51 +f 65/199/51 76/201/51 75/202/51 +f 67/203/52 55/189/52 70/204/52 +f 67/203/52 70/204/52 76/146/52 +f 70/178/31 69/177/31 77/205/31 +f 70/178/31 77/205/31 78/206/31 +f 69/177/53 71/207/53 79/208/53 +f 69/177/53 79/208/53 77/205/53 +f 71/209/33 72/210/33 80/211/33 +f 71/209/33 80/211/33 79/212/33 +f 72/213/54 73/214/54 81/215/54 +f 72/213/54 81/215/54 80/216/54 +f 73/217/27 74/218/27 82/219/27 +f 73/217/27 82/219/27 81/220/27 +f 74/221/55 75/222/55 83/223/55 +f 74/221/55 83/223/55 82/224/55 +f 75/225/29 76/226/29 84/227/29 +f 75/225/29 84/227/29 83/228/29 +f 76/229/30 70/230/30 78/231/30 +f 76/229/30 78/231/30 84/232/30 +s 1 +f 35/233/56 19/234/57 22/235/58 +f 24/236/59 35/233/56 22/235/58 +f 26/237/60 35/238/56 24/239/59 +f 28/240/61 35/241/56 26/242/60 +f 30/243/62 35/244/56 28/245/61 +f 32/246/63 35/247/56 30/248/62 +f 34/249/64 35/233/56 32/250/63 +f 19/234/57 35/233/56 34/249/64 +f 53/251/65 52/252/66 68/253/18 +f 56/254/67 53/255/65 68/256/18 +f 58/257/68 56/258/67 68/259/18 +f 60/260/69 58/261/68 68/262/18 +f 62/263/70 60/264/69 68/265/18 +f 64/266/71 62/267/70 68/268/18 +f 66/269/72 64/270/71 68/271/18 +f 52/272/66 66/273/72 68/274/18 diff --git a/thaumicbees_res/mods/thaumicbees/textures/model/jarTexture.png b/thaumicbees_res/mods/thaumicbees/textures/model/jarTexture.png new file mode 100644 index 0000000000000000000000000000000000000000..ecb3f535081f44cad6ec78de59d5589b924d85bd GIT binary patch literal 5376 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 ewHRmlzX1R{#)HpPbMQC-0000 items; @@ -27,6 +33,10 @@ public class SlotCustomItems extends Slot } } + /** + * + * @return List of valid ItemStacks + */ public List getValidItems() { return this.items; @@ -40,7 +50,7 @@ public class SlotCustomItems extends Slot ItemStack s = this.items.get(i); if (s.itemID == newItem.itemID) { - if (s.getItemDamage() == -1) + if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE) { contains = true; break; @@ -69,7 +79,7 @@ public class SlotCustomItems extends Slot ItemStack s = this.items.get(i); if (s.itemID == removeItem.itemID) { - if (s.getItemDamage() == -1) + if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE) { this.items.remove(i); break; @@ -98,7 +108,7 @@ public class SlotCustomItems extends Slot } else { - flag = this.items.get(i).getItemDamage() == -1; + flag = this.items.get(i).getItemDamage() ==OreDictionary.WILDCARD_VALUE; break; } } diff --git a/thaumicbees_src/thaumicbees/bees/FlowerProviderAuraNode.java b/thaumicbees_src/thaumicbees/bees/FlowerProviderAuraNode.java index ee655e8..b0c8437 100644 --- a/thaumicbees_src/thaumicbees/bees/FlowerProviderAuraNode.java +++ b/thaumicbees_src/thaumicbees/bees/FlowerProviderAuraNode.java @@ -30,16 +30,7 @@ public class FlowerProviderAuraNode implements IFlowerProvider @Override public boolean growFlower(World world, IBeeGenome genome, int x, int y, int z) { - boolean flag = false; - int blockDown = world.getBlockId(x, y - 1, z); - if (world.isAirBlock(x, y, z) && (blockDown == Block.dirt.blockID || blockDown == Block.grass.blockID)) - { - int rand = world.rand.nextInt(10); - world.setBlockMetadataWithNotify(x, y, z, Config.tcPlant.blockID, (rand >= 5) ? 2 : 3); - System.out.println(x + ", " + y + ", " + ", " + z + " set to flower."); - flag = true; - } - return flag; + return true; } @Override diff --git a/thaumicbees_src/thaumicbees/block/BlockEffectJar.java b/thaumicbees_src/thaumicbees/block/BlockEffectJar.java index e6b1cb5..0b06a52 100644 --- a/thaumicbees_src/thaumicbees/block/BlockEffectJar.java +++ b/thaumicbees_src/thaumicbees/block/BlockEffectJar.java @@ -1,27 +1,31 @@ package thaumicbees.block; -import thaumicbees.gui.UIScreens; -import thaumicbees.main.ThaumicBees; -import thaumicbees.main.utils.TabThaumicBees; -import thaumicbees.tileentity.TileEntityEffectJar; +import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; +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.world.World; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeHousing; -import forestry.api.core.EnumHumidity; -import forestry.api.core.EnumTemperature; +import thaumicbees.client.gui.UIScreens; +import thaumicbees.main.CommonProxy; +import thaumicbees.main.ThaumicBees; +import thaumicbees.main.utils.TabThaumicBees; +import thaumicbees.tileentity.TileEntityEffectJar; public class BlockEffectJar extends BlockContainer { public BlockEffectJar(int id) { super(id, Material.glass); + // Copy glass's block icon for the breaking & running textures. + this.blockIcon = Block.glass.getIcon(0, 0); this.setCreativeTab(TabThaumicBees.tabThaumicBees); + this.setUnlocalizedName("tb.effectJar"); + this.setBlockBounds(0.25f, 0f, 0.25f, 0.75f, 0.81f, 0.74f); + this.setHardness(0.1f); + this.setResistance(1.5f); } @Override @@ -44,4 +48,57 @@ public class BlockEffectJar extends BlockContainer return new TileEntityEffectJar(); } + @Override + public boolean isOpaqueCube() + { + return false; + } + + @Override + public boolean renderAsNormalBlock() + { + return false; + } + + @Override + public int getRenderType() + { + return CommonProxy.RenderIdEffectJar; + } + + @Override + public void breakBlock(World world, int x, int y, int z, int id, int meta) + { + super.breakBlock(world, x, y, z, id, meta); + this.dropInventory(world, x, y, z); + } + + private void dropInventory(World world, int x, int y, int z) + { + TileEntity e = world.getBlockTileEntity(x, y, z); + + if (e != null && e instanceof TileEntityEffectJar) + { + TileEntityEffectJar jar = (TileEntityEffectJar)e; + + // 0 is the only droppable stack. + ItemStack stack = jar.getStackInSlot(0); + + if (stack != null && stack.stackSize > 0) + { + float pX = world.rand.nextFloat() * 0.8f + 0.1f; + float pY = world.rand.nextFloat() * 0.8f + 0.1f; + float pZ = world.rand.nextFloat() * 0.8f + 0.1f; + + EntityItem entityItem = new EntityItem(world, x + pX, y + pY, z + pZ, stack.copy()); + + entityItem.motionX = world.rand.nextGaussian() * 0.05f; + entityItem.motionY = world.rand.nextGaussian() * 0.05f + 0.2f; + entityItem.motionZ = world.rand.nextGaussian() * 0.05f; + + world.spawnEntityInWorld(entityItem); + stack.stackSize = 0; + } + } + } } diff --git a/thaumicbees_src/thaumicbees/block/BlockPlanks.java b/thaumicbees_src/thaumicbees/block/BlockPlanks.java index c17ec8f..ea3c530 100644 --- a/thaumicbees_src/thaumicbees/block/BlockPlanks.java +++ b/thaumicbees_src/thaumicbees/block/BlockPlanks.java @@ -8,6 +8,8 @@ import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; import thaumicbees.item.types.PlankType; import thaumicbees.main.ThaumicBees; import thaumicbees.main.utils.VersionInfo; diff --git a/thaumicbees_src/thaumicbees/block/BlockWoodSlab.java b/thaumicbees_src/thaumicbees/block/BlockWoodSlab.java index 228e790..05daaa6 100644 --- a/thaumicbees_src/thaumicbees/block/BlockWoodSlab.java +++ b/thaumicbees_src/thaumicbees/block/BlockWoodSlab.java @@ -8,8 +8,11 @@ import net.minecraft.block.BlockHalfSlab; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; import thaumicbees.item.types.PlankType; import thaumicbees.main.Config; import thaumicbees.main.ThaumicBees; @@ -43,7 +46,7 @@ public class BlockWoodSlab extends BlockHalfSlab protected ItemStack createStackedBlock(int meta) { - return new ItemStack(Config.slabWoodHalf.blockID, 2, meta & 7); + return new ItemStack(Config.planksWood.blockID, 1, meta & 7); } @Override @@ -78,4 +81,23 @@ public class BlockWoodSlab extends BlockHalfSlab this.icons[t.ordinal()] = par1IconRegister.registerIcon(VersionInfo.ModName.toLowerCase() + ":" + t.name); } } + + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) + { + int id = world.getBlockId(x, y, z); + + if (id == 0) + { + return null; + } + + Item item = Item.itemsList[id]; + if (item == null) + { + return null; + } + + return new ItemStack(id, 1, getDamageValue(world, x, y, z) & 7); + } } diff --git a/thaumicbees_src/thaumicbees/client/gui/ContainerEffectJar.java b/thaumicbees_src/thaumicbees/client/gui/ContainerEffectJar.java new file mode 100644 index 0000000..f4df8d4 --- /dev/null +++ b/thaumicbees_src/thaumicbees/client/gui/ContainerEffectJar.java @@ -0,0 +1,123 @@ +package thaumicbees.client.gui; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.mysteriousages.utils.gui.SlotCustomItems; +import thaumicbees.tileentity.TileEntityEffectJar; +import forestry.api.core.ItemInterface; + +public class ContainerEffectJar extends Container +{ + public TileEntityEffectJar jar; + + public int lastBeeHealth = 0; + public int speciesColour = 0xffffff; + + public ContainerEffectJar(TileEntityEffectJar tileEntityEffectJar, EntityPlayer player) + { + this.jar = tileEntityEffectJar; + this.addSlotToContainer(new SlotCustomItems(this.jar, 0, 80, 22, new ItemStack[] { ItemInterface.getItem("beeDroneGE") })); + + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 9; ++j) + { + this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 74 + i * 18)); + } + } + + for (int i = 0; i < 9; ++i) + { + this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 132)); + } + } + + @Override + public void addCraftingToCrafters(ICrafting crafting) + { + super.addCraftingToCrafters(crafting); + + crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth); + crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour); + } + + @Override + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + + for (int i = 0; i < this.crafters.size(); ++i) + { + ICrafting crafting = (ICrafting)this.crafters.get(i); + + if (this.lastBeeHealth != this.jar.currentBeeHealth) + { + crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth); + this.lastBeeHealth = this.jar.currentBeeHealth; + } + if (this.speciesColour != this.jar.currentBeeColour) + { + crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour); + this.speciesColour = this.jar.currentBeeColour; + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(int craftingId, int value) + { + if (craftingId == 0) + { + this.jar.currentBeeHealth = value; + } + else if (craftingId == 1) + { + this.jar.currentBeeColour = value; + } + } + + @Override + public boolean canInteractWith(EntityPlayer entityplayer) + { + return this.jar.isUseableByPlayer(entityplayer); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slot) + { + Slot itemSlot = this.getSlot(slot); + boolean clearSlot = false; + + if (itemSlot != null && itemSlot.getHasStack()) + { + ItemStack srcStack = itemSlot.getStack(); + if (slot == 0 && srcStack != null) + { + clearSlot = this.mergeItemStack(srcStack, 1, 36 + 1, false); + } + else + { + if (this.getSlot(0).isItemValid(srcStack)) + { + clearSlot = this.mergeItemStack(srcStack, 0, 1, false); + } + } + } + + if (clearSlot) + { + itemSlot.putStack(null); + } + itemSlot.onSlotChanged(); + player.inventory.onInventoryChanged(); + + return null; + } + +} diff --git a/thaumicbees_src/thaumicbees/gui/GUIEffectJar.java b/thaumicbees_src/thaumicbees/client/gui/GUIEffectJar.java similarity index 66% rename from thaumicbees_src/thaumicbees/gui/GUIEffectJar.java rename to thaumicbees_src/thaumicbees/client/gui/GUIEffectJar.java index 298eeb8..8117891 100644 --- a/thaumicbees_src/thaumicbees/gui/GUIEffectJar.java +++ b/thaumicbees_src/thaumicbees/client/gui/GUIEffectJar.java @@ -1,10 +1,13 @@ -package thaumicbees.gui; +package thaumicbees.client.gui; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; import org.lwjgl.opengl.GL11; import thaumicbees.main.CommonProxy; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Container; +import thaumicbees.tileentity.TileEntityEffectJar; public class GUIEffectJar extends GuiContainer { @@ -26,9 +29,9 @@ public class GUIEffectJar extends GuiContainer private static final int BAR_WIDTH = 10; private static final int BAR_HEIGHT = 40; - public GUIEffectJar(ContainerEffectJar container) + public GUIEffectJar(TileEntityEffectJar jar, EntityPlayer player) { - super(container); + super(new ContainerEffectJar(jar, player)); this.xSize = WIDTH; this.ySize = HEIGHT; } @@ -42,18 +45,22 @@ public class GUIEffectJar extends GuiContainer @Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { - int texture = this.mc.renderEngine.getTexture(CommonProxy.TCBEES_GUI_PATH + BACKGROUND_FILE); + int texture = this.mc.renderEngine.getTexture(CommonProxy.GUI_PATH + BACKGROUND_FILE); - GL11.glColor4f(1f, 1f, 1f, 0.2f); + GL11.glColor4f(1f, 1f, 1f, 1f); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize); - GL11.glColor4f(1f, 1f, 1f, 1f); + TileEntityEffectJar jar = ((ContainerEffectJar)this.inventorySlots).jar; + float r = ((jar.currentBeeColour >> 16) & 255) / 255f; + float g = ((jar.currentBeeColour >> 8) & 255) / 255f; + float b = (jar.currentBeeColour & 255) / 255f; - float percent = 0.0f; - int value = BAR_HEIGHT - (int)(percent * BAR_HEIGHT); + GL11.glColor3f(r, g, b); + + int value = BAR_HEIGHT - (jar.currentBeeHealth * BAR_HEIGHT) / 100; this.drawTexturedModalRect(this.guiLeft + BAR_DEST_X, this.guiTop + value + BAR_DEST_Y, BAR_SRC_X, BAR_SRC_Y, BAR_WIDTH, BAR_HEIGHT - value); } diff --git a/thaumicbees_src/thaumicbees/gui/GUIHandler.java b/thaumicbees_src/thaumicbees/client/gui/GUIHandler.java similarity index 72% rename from thaumicbees_src/thaumicbees/gui/GUIHandler.java rename to thaumicbees_src/thaumicbees/client/gui/GUIHandler.java index 817542a..886e5db 100644 --- a/thaumicbees_src/thaumicbees/gui/GUIHandler.java +++ b/thaumicbees_src/thaumicbees/client/gui/GUIHandler.java @@ -1,4 +1,4 @@ -package thaumicbees.gui; +package thaumicbees.client.gui; import thaumicbees.tileentity.TileEntityEffectJar; import net.minecraft.entity.player.EntityPlayer; @@ -15,7 +15,7 @@ public class GUIHandler implements IGuiHandler if (ID == UIScreens.EFFECT_JAR.ordinal()) { - value = new ContainerEffectJar((TileEntityEffectJar)(world.getBlockTileEntity(x, y, z)), player); + value = new ContainerEffectJar((TileEntityEffectJar)world.getBlockTileEntity(x, y, z), player); } return value; @@ -28,7 +28,7 @@ public class GUIHandler implements IGuiHandler if (ID == UIScreens.EFFECT_JAR.ordinal()) { - value = new GUIEffectJar(new ContainerEffectJar((TileEntityEffectJar)(world.getBlockTileEntity(x, y, z)), player)); + value = new GUIEffectJar((TileEntityEffectJar)world.getBlockTileEntity(x, y, z), player); } return value; diff --git a/thaumicbees_src/thaumicbees/gui/UIScreens.java b/thaumicbees_src/thaumicbees/client/gui/UIScreens.java similarity index 57% rename from thaumicbees_src/thaumicbees/gui/UIScreens.java rename to thaumicbees_src/thaumicbees/client/gui/UIScreens.java index c7134d5..856e87a 100644 --- a/thaumicbees_src/thaumicbees/gui/UIScreens.java +++ b/thaumicbees_src/thaumicbees/client/gui/UIScreens.java @@ -1,4 +1,4 @@ -package thaumicbees.gui; +package thaumicbees.client.gui; public enum UIScreens { diff --git a/thaumicbees_src/thaumicbees/client/model/ModelEffectJar.java b/thaumicbees_src/thaumicbees/client/model/ModelEffectJar.java new file mode 100644 index 0000000..77a815a --- /dev/null +++ b/thaumicbees_src/thaumicbees/client/model/ModelEffectJar.java @@ -0,0 +1,38 @@ +package thaumicbees.client.model; + +import org.lwjgl.opengl.GL11; + +import net.minecraftforge.client.model.AdvancedModelLoader; +import net.minecraftforge.client.model.IModelCustom; +import thaumicbees.main.CommonProxy; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ModelEffectJar +{ + public static final String objFile = CommonProxy.MODEL_PATH + "effectJar.obj"; + public static final String textureFile = CommonProxy.MODEL_TEXTURE_PATH + "jarTexture.png"; + + public static final ModelEffectJar model = new ModelEffectJar(); + + private IModelCustom effectJarObj; + + public ModelEffectJar() + { + this.effectJarObj = AdvancedModelLoader.loadModel(objFile); + } + + public void render() + { + this.effectJarObj.renderPart("jarLid"); + + GL11.glDepthMask(false); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + this.effectJarObj.renderPart("jarBase"); + GL11.glDisable(GL11.GL_BLEND); + GL11.glDepthMask(true); + + } +} diff --git a/thaumicbees_src/thaumicbees/client/render/EffectJarRenderer.java b/thaumicbees_src/thaumicbees/client/render/EffectJarRenderer.java new file mode 100644 index 0000000..6e820cb --- /dev/null +++ b/thaumicbees_src/thaumicbees/client/render/EffectJarRenderer.java @@ -0,0 +1,79 @@ +package thaumicbees.client.render; + +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + +import thaumicbees.client.model.ModelEffectJar; +import thaumicbees.tileentity.TileEntityEffectJar; +import cpw.mods.fml.client.FMLClientHandler; + +public class EffectJarRenderer extends TileEntitySpecialRenderer implements IItemRenderer +{ + public static EffectJarRenderer instance = new EffectJarRenderer(); + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) + { + if (tileEntity instanceof TileEntityEffectJar) + { + this.doRender(x, y, z, 1f); + } + } + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) + { + return true; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) + { + return true; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) + { + switch (type) + { + case ENTITY: + doRender(0, 0, 0, 1.8f); + break; + + case EQUIPPED: + doRender(-.5, .5, 0.25, 1f); + break; + + case INVENTORY: + doRender(0.3, 0.25, 0.3, 1.5f); + break; + + default: + break; + + } + } + + private void doRender(double x, double y, double z, float scale) + { + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + + GL11.glScaled(scale, scale, scale); + GL11.glTranslated(x, y, z); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelEffectJar.textureFile); + + ModelEffectJar.model.render(); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + +} diff --git a/thaumicbees_src/thaumicbees/gui/ContainerEffectJar.java b/thaumicbees_src/thaumicbees/gui/ContainerEffectJar.java deleted file mode 100644 index 303d2fb..0000000 --- a/thaumicbees_src/thaumicbees/gui/ContainerEffectJar.java +++ /dev/null @@ -1,95 +0,0 @@ -package thaumicbees.gui; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import thaumicbees.tileentity.TileEntityEffectJar; -import forestry.api.core.ItemInterface; - -public class ContainerEffectJar extends Container -{ - private TileEntityEffectJar jar; - - public ContainerEffectJar(TileEntityEffectJar tileEntityEffectJar, EntityPlayer player) - { - this.jar = tileEntityEffectJar; - SlotCustomItems slot = new SlotCustomItems(this.jar, 0, 80, 22); - slot.addValidItem(ItemInterface.getItem("beeDroneGE")); - this.addSlotToContainer(slot); - - for (int i = 0; i < 3; ++i) - { - for (int j = 0; j < 9; ++j) - { - this.addSlotToContainer(new Slot(player.inventory, j + i * 9+9, 8 + j * 18, 74 + i * 18)); - } - } - - for (int i = 0; i < 9; ++i) - { - this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 132)); - } - } - - @Override - public boolean canInteractWith(EntityPlayer entityplayer) - { - return this.jar.isUseableByPlayer(entityplayer); - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slot) - { - ItemStack value = null; - Slot s = (Slot)this.inventorySlots.get(slot); - - if (s != null && s.getHasStack()) - { - ItemStack source = s.getStack(); - value = source.copy(); - - if (slot == 0) - { - if (!this.mergeItemStack(source, 1, 36, true)) - { - return null; - } - - s.onSlotChange(source, value); - } - else - { - if (((SlotCustomItems)(this.inventorySlots.get(0))).isItemValid(source)) - { - if (this.mergeItemStack(source, 0, 1, false)) - { - return null; - } - - s.onSlotChange(source, value); - } - } - - if (source.stackSize == 0) - { - s.putStack(null); - } - else - { - s.onSlotChanged(); - } - - if (source.stackSize == value.stackSize) - { - value = null; - } - - s.onPickupFromSlot(player, source); - } - - return value; - } - -} diff --git a/thaumicbees_src/thaumicbees/item/ItemThaumiumGrafter.java b/thaumicbees_src/thaumicbees/item/ItemThaumiumGrafter.java index 2260711..45a1e46 100644 --- a/thaumicbees_src/thaumicbees/item/ItemThaumiumGrafter.java +++ b/thaumicbees_src/thaumicbees/item/ItemThaumiumGrafter.java @@ -1,19 +1,22 @@ package thaumicbees.item; -import thaumcraft.api.IVisRepairable; -import thaumcraft.api.ThaumcraftApi; -import thaumicbees.main.CommonProxy; -import thaumicbees.main.Config; -import thaumicbees.main.utils.compat.ThaumcraftHelper; -import forestry.api.arboriculture.IToolGrafter; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; +import thaumcraft.api.EnumTag; +import thaumcraft.api.IVisRepairable; +import thaumcraft.api.ObjectTags; +import thaumcraft.api.ThaumcraftApi; +import thaumicbees.main.Config; +import thaumicbees.main.utils.compat.ThaumcraftHelper; +import forestry.api.arboriculture.IToolGrafter; public class ItemThaumiumGrafter extends Item implements IVisRepairable, IToolGrafter { @@ -45,7 +48,7 @@ public class ItemThaumiumGrafter extends Item implements IVisRepairable, IToolGr } @Override - public boolean onBlockDestroyed(ItemStack itemstack, World world, int id, int x, int y, int z, EntityLiving entityliving) { + public boolean onBlockDestroyed(ItemStack itemstack, World world, int id, int x, int y, int z, EntityLiving entityLiving) { int damage = 1; if (id == Config.tcLeaf.blockID) { @@ -61,7 +64,13 @@ public class ItemThaumiumGrafter extends Item implements IVisRepairable, IToolGr damage = 4; } } - itemstack.damageItem(damage, entityliving); + itemstack.damageItem(damage, entityLiving); + + if (entityLiving instanceof EntityPlayer) + { + EntityPlayer p = (EntityPlayer)entityLiving; + p.addExhaustion(8f); + } return true; } @@ -94,15 +103,15 @@ public class ItemThaumiumGrafter extends Item implements IVisRepairable, IToolGr { if (stack.getItemDamage() > 0) { - if (ThaumcraftApi.decreaseClosestAura(e.worldObj, e.posX, e.posY, e.posZ, 2, true)) + if (ThaumcraftApi.decreaseClosestAura(e.worldObj, e.posX, e.posY, e.posZ, 5, true)) { - if (e instanceof EntityPlayer) - { - EntityPlayer p = (EntityPlayer)e; - p.addExhaustion(0.19f); - } stack.damageItem(-1, (EntityLiving)e); } + if (e instanceof EntityPlayer) + { + EntityPlayer p = (EntityPlayer)e; + p.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 600)); + } } } } diff --git a/thaumicbees_src/thaumicbees/main/ClientProxy.java b/thaumicbees_src/thaumicbees/main/ClientProxy.java index 2bc0c34..15862bd 100644 --- a/thaumicbees_src/thaumicbees/main/ClientProxy.java +++ b/thaumicbees_src/thaumicbees/main/ClientProxy.java @@ -1,10 +1,12 @@ package thaumicbees.main; -import java.lang.reflect.Field; - -import thaumicbees.main.render.BeeRenderEffect; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; +import thaumicbees.client.render.EffectJarRenderer; +import thaumicbees.main.render.BeeRenderEffect; +import thaumicbees.tileentity.TileEntityEffectJar; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -14,6 +16,16 @@ public class ClientProxy extends CommonProxy public ClientProxy() { } + @Override + public void registerTileEntities() + { + super.registerTileEntities(); + + RenderIdEffectJar = RenderingRegistry.getNextAvailableRenderId(); + MinecraftForgeClient.registerItemRenderer(Config.effectJar.blockID, EffectJarRenderer.instance); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEffectJar.class, EffectJarRenderer.instance); + } + @Override public void drawBeeEffects(World world, double xPos, double yPos, double zPos, int colour, int rangeX, int rangeY, int rangeZ) { diff --git a/thaumicbees_src/thaumicbees/main/CommonProxy.java b/thaumicbees_src/thaumicbees/main/CommonProxy.java index eab6186..5cf4c79 100644 --- a/thaumicbees_src/thaumicbees/main/CommonProxy.java +++ b/thaumicbees_src/thaumicbees/main/CommonProxy.java @@ -1,22 +1,33 @@ package thaumicbees.main; +import thaumicbees.tileentity.TileEntityEffectJar; import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.client.Minecraft; import net.minecraft.world.World; public class CommonProxy { - public static final String TCBEES_GFX = "/mods/thaumicbees/textures/"; + public static final String TEXTURE_PATH = "/mods/thaumicbees/textures/"; + public static final String MODEL_PATH = "/mods/thaumicbees/model/"; public static final String TCBEES_RESEARCH = "/research/thaumicbees/"; public static final String TCBEES_LOCDIR = "/lang/thaumicbees/"; public static String FORESTRY_GFX_ITEMS; public static String FORESTRY_GFX_BEEEFFECTS; - public static final String TCBEES_GUI_PATH = TCBEES_GFX + "gui/"; + public static final String GUI_PATH = TEXTURE_PATH + "gui/"; + public static final String MODEL_TEXTURE_PATH = TEXTURE_PATH + "model/"; + + public static int RenderIdEffectJar; public CommonProxy() { } + public void registerTileEntities() + { + GameRegistry.registerTileEntity(TileEntityEffectJar.class, "tb.entity.effectJar"); + } + public void drawBeeEffects(World world, double xPos, double yPos, double zPos, int colour, int rangeX, int rangeY, int rangeZ) { // Does nothing in common. @@ -26,5 +37,7 @@ public class CommonProxy { return FMLClientHandler.instance().getClient(); } + + public void registerRenderers() { } } diff --git a/thaumicbees_src/thaumicbees/main/Config.java b/thaumicbees_src/thaumicbees/main/Config.java index 731e0a9..6cf0283 100644 --- a/thaumicbees_src/thaumicbees/main/Config.java +++ b/thaumicbees_src/thaumicbees/main/Config.java @@ -211,11 +211,6 @@ public class Config GameRegistry.registerBlock(effectJar, "tb.effectJar"); } - public void registerTileEntities() - { - GameRegistry.registerTileEntity(TileEntityEffectJar.class, "tb.entity.effectJar"); - } - public void setupItems() { ThaumcraftHelper.getItems(); diff --git a/thaumicbees_src/thaumicbees/main/ThaumicBees.java b/thaumicbees_src/thaumicbees/main/ThaumicBees.java index ede9d22..dcbab40 100644 --- a/thaumicbees_src/thaumicbees/main/ThaumicBees.java +++ b/thaumicbees_src/thaumicbees/main/ThaumicBees.java @@ -1,6 +1,6 @@ package thaumicbees.main; -import thaumicbees.gui.GUIHandler; +import thaumicbees.client.gui.GUIHandler; import thaumicbees.main.utils.CompatabilityManager; import thaumicbees.main.utils.CraftingManager; import thaumicbees.main.utils.LocalizationManager; @@ -15,6 +15,7 @@ import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkRegistry; @Mod( @@ -25,6 +26,7 @@ import cpw.mods.fml.common.network.NetworkRegistry; version=VersionInfo.Version + " - " + VersionInfo.Build, dependencies=VersionInfo.Depends ) +@NetworkMod(serverSideRequired=false, clientSideRequired=true) public class ThaumicBees { @@ -57,7 +59,7 @@ public class ThaumicBees public void init(FMLInitializationEvent event) { this.modConfig.setupBlocks(); - this.modConfig.registerTileEntities(); + this.proxy.registerTileEntities(); this.modConfig.setupItems(); CompatabilityManager.setupBackpacks(); diff --git a/thaumicbees_src/thaumicbees/main/utils/CraftingManager.java b/thaumicbees_src/thaumicbees/main/utils/CraftingManager.java index fb15e04..62f0d65 100644 --- a/thaumicbees_src/thaumicbees/main/utils/CraftingManager.java +++ b/thaumicbees_src/thaumicbees/main/utils/CraftingManager.java @@ -16,6 +16,7 @@ import thaumicbees.item.types.HiveFrameType; import thaumicbees.item.types.LiquidType; import thaumicbees.item.types.NuggetType; import thaumicbees.item.types.PlankType; +import thaumicbees.item.types.PollenType; import thaumicbees.item.types.PropolisType; import thaumicbees.item.types.ResourceType; import thaumicbees.item.types.WaxType; @@ -122,6 +123,21 @@ public class CraftingManager 'w', Config.wax.getStackForType(WaxType.SOUL) }); + GameRegistry.addRecipe(new ItemStack(Config.hiveFrameTemporal), new Object[] { + "sPs", "PfP", "sPs", + 's', Block.sand, + 'P', Config.pollen.getStackForType(PollenType.PHASED), + 'f', Config.hiveFrameMagic + }); + + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Config.effectJar), new Object[] { + "GSG", "QPQ", "GGG", + 'G', Block.glass, + 'S', "slabWood", + 'P', Config.pollen.getStackForType(PollenType.UNUSUAL), + 'Q', Item.netherQuartz + })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Config.moonDial), new Object[] { "DqD", "qrq", "DqD", 'r', Item.redstone, @@ -509,14 +525,14 @@ public class CraftingManager "wSt", "wFw", "tSw", 't', Item.stick, 'S', Block.sand, - 'F', input, + 'F', Config.hiveFrameMagic, 'w', Config.wax.getStackForType(WaxType.MAGIC) }); GameRegistry.addRecipe(output, new Object[] { "tSw", "wFw", "wSt", 't', Item.stick, 'S', Block.sand, - 'F', input, + 'F', Config.hiveFrameMagic, 'w', Config.wax.getStackForType(WaxType.MAGIC) }); diff --git a/thaumicbees_src/thaumicbees/tileentity/EffectJarHousing.java b/thaumicbees_src/thaumicbees/tileentity/EffectJarHousing.java index 697462b..7bdb183 100644 --- a/thaumicbees_src/thaumicbees/tileentity/EffectJarHousing.java +++ b/thaumicbees_src/thaumicbees/tileentity/EffectJarHousing.java @@ -9,19 +9,29 @@ import forestry.api.apiculture.IBeeHousing; import forestry.api.core.EnumHumidity; import forestry.api.core.EnumTemperature; +/** + * + * Singleton object to simulate enough of a bee house to fire the bee effects. =D + * + * @author MysteriousAges + * + */ public class EffectJarHousing implements IBeeHousing { + private static EffectJarHousing instance = new EffectJarHousing(); + TileEntityEffectJar jarEntity; - public EffectJarHousing(TileEntityEffectJar entity) + public static EffectJarHousing getFor(TileEntityEffectJar entity) { - this.jarEntity = entity; + instance.jarEntity = entity; + return instance; } @Override public float getTerritoryModifier(IBeeGenome genome, float currentModifier) { - return 0f; + return 0.9f; } @Override @@ -33,7 +43,7 @@ public class EffectJarHousing implements IBeeHousing @Override public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { - return 0.5f; + return 0f; } @Override @@ -69,19 +79,19 @@ public class EffectJarHousing implements IBeeHousing @Override public boolean isSealed() { - return false; + return true; } @Override public boolean isSelfLighted() { - return false; + return true; } @Override public boolean isSunlightSimulated() { - return false; + return true; } @Override @@ -91,19 +101,13 @@ public class EffectJarHousing implements IBeeHousing } @Override - public void onQueenChange(ItemStack queen) - { - - } + public void onQueenChange(ItemStack queen) { } @Override public void wearOutEquipment(int amount) { } @Override - public void onQueenDeath(IBee queen) - { - - } + public void onQueenDeath(IBee queen) { } @Override public void onPostQueenDeath(IBee queen) { } @@ -111,7 +115,7 @@ public class EffectJarHousing implements IBeeHousing @Override public ItemStack getQueen() { - return this.jarEntity.queenSlot; + return this.jarEntity.getStackInSlot(TileEntityEffectJar.QUEEN_SLOT); } @Override @@ -123,7 +127,7 @@ public class EffectJarHousing implements IBeeHousing @Override public void setQueen(ItemStack itemStack) { - this.jarEntity.queenSlot = itemStack; + this.jarEntity.setInventorySlotContents(TileEntityEffectJar.QUEEN_SLOT, itemStack); } @Override @@ -139,7 +143,7 @@ public class EffectJarHousing implements IBeeHousing public EnumTemperature getTemperature() { EnumTemperature temp = EnumTemperature.NORMAL; - ItemStack stack = this.jarEntity.queenSlot; + ItemStack stack = this.jarEntity.getStackInSlot(TileEntityEffectJar.QUEEN_SLOT); if (stack != null) { IBee queen = BeeManager.beeInterface.getBee(stack); @@ -152,7 +156,7 @@ public class EffectJarHousing implements IBeeHousing public EnumHumidity getHumidity() { EnumHumidity humid = EnumHumidity.NORMAL; - ItemStack stack = this.jarEntity.queenSlot; + ItemStack stack = this.jarEntity.getStackInSlot(TileEntityEffectJar.QUEEN_SLOT); if (stack != null) { IBee queen = BeeManager.beeInterface.getBee(stack); @@ -179,7 +183,7 @@ public class EffectJarHousing implements IBeeHousing @Override public int getErrorOrdinal() { - return 0; + return 1; // EnumErrorCode.OK.ordinal() value. } @Override diff --git a/thaumicbees_src/thaumicbees/tileentity/TileEntityEffectJar.java b/thaumicbees_src/thaumicbees/tileentity/TileEntityEffectJar.java index 204d3d8..1c4a5bd 100644 --- a/thaumicbees_src/thaumicbees/tileentity/TileEntityEffectJar.java +++ b/thaumicbees_src/thaumicbees/tileentity/TileEntityEffectJar.java @@ -1,29 +1,36 @@ package thaumicbees.tileentity; -import forestry.api.apiculture.IBeeHousing; -import forestry.api.core.ItemInterface; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; +import forestry.api.apiculture.BeeManager; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.apiculture.IBee; +import forestry.api.genetics.IEffectData; public class TileEntityEffectJar extends TileEntity implements IInventory { private String ownerName; private EffectJarHousing housingLogic; - private ItemStack[] droneSlots; - protected ItemStack queenSlot; + private static final int SLOT_COUNT = 2; + public static final int DRONE_SLOT = 0; + public static final int QUEEN_SLOT = SLOT_COUNT - 1; - private int lifeTicksRemaining; - private static final int lifeTicks = 135; + private ItemStack[] beeSlots; + private IEffectData[] effectData = new IEffectData[2]; + + private int throttle; + public int currentBeeHealth; + public int currentBeeColour; public TileEntityEffectJar() { super(); - this.droneSlots = new ItemStack[1]; + this.beeSlots = new ItemStack[SLOT_COUNT]; } public void setOwner(EntityPlayer player) @@ -39,27 +46,96 @@ public class TileEntityEffectJar extends TileEntity implements IInventory @Override public int getSizeInventory() { - return this.droneSlots.length; + // Last slot reserved for "queen" + return this.beeSlots.length - 1; } @Override public ItemStack getStackInSlot(int slot) { - return droneSlots[slot]; + return beeSlots[slot]; + } + + @Override + public void updateEntity() + { + if (this.beeSlots[QUEEN_SLOT] != null) + { + IBee queen = BeeManager.beeInterface.getBee(this.beeSlots[QUEEN_SLOT]); + + currentBeeHealth = (queen.getHealth() * 100) / queen.getMaxHealth(); + currentBeeColour = ((IAlleleBeeSpecies)queen.getGenome().getPrimary()).getIconColour(0); + + EffectJarHousing housingLogic = EffectJarHousing.getFor(this); + this.effectData = queen.doEffect(this.effectData, housingLogic); + if (this.worldObj.getWorldTime() % 5 == 0) + { + this.effectData = queen.doFX(this.effectData, housingLogic); + } + + // run the queen + if (throttle > 550) + { + throttle = 0; + queen.age(this.worldObj, 0.26f); + + if (queen.getHealth() == 0) + { + this.beeSlots[QUEEN_SLOT] = null; + currentBeeHealth = 0; + currentBeeColour = 0x0ffffff; + } + else + { + queen.writeToNBT(this.beeSlots[QUEEN_SLOT].stackTagCompound); + } + this.onInventoryChanged(); + } + else + { + throttle++; + } + } + else if (this.beeSlots[DRONE_SLOT] != null) + { + // make a queen + ItemStack droneStack = this.beeSlots[DRONE_SLOT]; + if (BeeManager.beeInterface.isDrone(droneStack)) + { + IBee bee = BeeManager.beeInterface.getBee(droneStack); + if (droneStack.stackSize == 1) + { + this.beeSlots[DRONE_SLOT] = null; + } + else + { + droneStack.stackSize--; + } + + this.beeSlots[QUEEN_SLOT] = droneStack.copy(); + this.beeSlots[QUEEN_SLOT].stackSize = 1; + + int current = bee.getHealth(); + int max = bee.getMaxHealth(); + currentBeeHealth = (current * 100) / max; + currentBeeColour = ((IAlleleBeeSpecies)bee.getGenome().getPrimary()).getIconColour(0); + } + this.onInventoryChanged(); + } } @Override public ItemStack decrStackSize(int slot, int count) { ItemStack value = null; - if (this.droneSlots[slot] != null) + if (this.beeSlots[slot] != null) { - value = this.droneSlots[slot].copy(); - value.stackSize = Math.min(count, this.droneSlots[slot].stackSize); - this.droneSlots[slot].stackSize -= value.stackSize; - if (this.droneSlots[slot].stackSize == 0) + value = this.beeSlots[slot].copy(); + value.stackSize = Math.min(count, this.beeSlots[slot].stackSize); + this.beeSlots[slot].stackSize -= value.stackSize; + if (this.beeSlots[slot].stackSize == 0) { - this.droneSlots[slot] = null; + this.beeSlots[slot] = null; } } onInventoryChanged(); @@ -70,10 +146,10 @@ public class TileEntityEffectJar extends TileEntity implements IInventory public ItemStack getStackInSlotOnClosing(int slot) { ItemStack value = null; - if (this.droneSlots[slot] != null) + if (this.beeSlots[slot] != null) { - value = this.droneSlots[slot]; - this.droneSlots[slot] = null; + value = this.beeSlots[slot]; + this.beeSlots[slot] = null; } onInventoryChanged(); return value; @@ -84,41 +160,51 @@ public class TileEntityEffectJar extends TileEntity implements IInventory { super.readFromNBT(tagRoot); - if (tagRoot.hasKey("drones")) - { - this.droneSlots[0] = ItemStack.loadItemStackFromNBT((NBTTagCompound)tagRoot.getTag("drones")); - } - if (tagRoot.hasKey("queen")) - { - this.queenSlot = ItemStack.loadItemStackFromNBT((NBTTagCompound)tagRoot.getTag("queen")); - } - this.lifeTicksRemaining = tagRoot.getInteger("lifeTicksRemaining"); - + NBTTagList nbttaglist = tagRoot.getTagList("Items"); + this.beeSlots = new ItemStack[SLOT_COUNT]; + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i); + byte b0 = nbttagcompound1.getByte("Slot"); + + if (b0 >= 0 && b0 < this.beeSlots.length) + { + this.beeSlots[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + this.currentBeeHealth = tagRoot.getInteger("currentBeeHealth"); + this.throttle = tagRoot.getInteger("throttle"); } @Override public void writeToNBT(NBTTagCompound tagRoot) { super.writeToNBT(tagRoot); - - if (this.droneSlots[0] != null) - { - tagRoot.setTag("drones", this.droneSlots[0].writeToNBT(new NBTTagCompound())); - } - if (this.queenSlot != null) - { - tagRoot.setTag("queen", this.queenSlot.writeToNBT(new NBTTagCompound())); - } - tagRoot.setInteger("lifeTicksRemaining", this.lifeTicksRemaining); + + NBTTagList inventory = new NBTTagList(); + for (int i = 0; i < this.beeSlots.length; ++i) + { + if (this.beeSlots[i] != null) + { + NBTTagCompound itemTag = new NBTTagCompound(); + itemTag.setByte("Slot", (byte)i); + this.beeSlots[i].writeToNBT(itemTag); + inventory.appendTag(itemTag); + } + } + tagRoot.setTag("Items", inventory); + tagRoot.setInteger("currentBeeHealth", this.currentBeeHealth); + tagRoot.setInteger("throttle", this.throttle); } @Override public void setInventorySlotContents(int slot, ItemStack itemStack) { - this.droneSlots[slot] = itemStack; - if (this.droneSlots[slot] != null) + this.beeSlots[slot] = itemStack; + if (this.beeSlots[slot] != null) { - this.droneSlots[slot].stackSize = Math.min(this.droneSlots[slot].stackSize, this.droneSlots[slot].getItem().getItemStackLimit()); + this.beeSlots[slot].stackSize = Math.min(this.beeSlots[slot].stackSize, this.beeSlots[slot].getItem().getItemStackLimit()); } onInventoryChanged(); }