From 83d9da7797f0563224dea65f96b18c5e0c33d614 Mon Sep 17 00:00:00 2001 From: mezz Date: Thu, 13 Jul 2017 23:11:57 -0700 Subject: [PATCH 01/13] Update gradle and dependencies --- build.gradle | 17 ++++++++++------- gradle.properties | 9 ++++----- gradle/wrapper/gradle-wrapper.jar | Bin 52271 -> 53319 bytes gradle/wrapper/gradle-wrapper.properties | 4 ++-- gradlew.bat | 2 +- .../MultiFenceRecipeRegistryPlugin.java | 3 --- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index e2829480..d94686db 100644 --- a/build.gradle +++ b/build.gradle @@ -38,18 +38,21 @@ repositories { name = "ic2, forestry" url = "http://maven.ic2.player.to/" } - ivy { - name 'JEI Bees' - artifactPattern "http://addons-origin.cursecdn.com/files/${jeibees_cf}/[module]-[revision]-[classifier].[ext]" + maven { + name = "CurseForge" + url = "https://minecraft.curseforge.com/api/maven/" } } dependencies { - deobfCompile "net.sengir.forestry:forestry_${mcversion}:${forestry_version}" - deobfCompile "mezz.jei:jei_${mcversion}:${jei_version}:api" + deobfCompile("net.sengir.forestry:forestry_${mcversion}:${forestry_version}") { + transitive = false; + } + deobfProvided "mezz.jei:jei_${mcversion}:${jei_version}:api" runtime "mezz.jei:jei_${mcversion}:${jei_version}" - deobfCompile name: 'jeibees', version: jeibees_version, ext: 'jar', classifier: "dev" - deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}" + runtime "jei-bees:jeibees:${jeibees_version}:mc${mcversion}" + deobfProvided "net.industrial-craft:industrialcraft-2:${ic2_version}:api" + runtime "net.industrial-craft:industrialcraft-2:${ic2_version}" } processResources { diff --git a/gradle.properties b/gradle.properties index 9a1adb07..6d2fcf63 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,16 +3,15 @@ org.gradle.jvmargs=-Xmx3G mcversion=1.11.2 -forgeversion=13.20.0.2315 +forgeversion=13.20.1.2393 mcp_mappings=snapshot_20161220 -forestry_version=5.3.4.119 +forestry_version=5.3.4.132 ic2_version=2.7.71-ex111 version_major=2 version_minor=0 version_patch=0 -jei_version=4.5.0.287 -jeibees_cf=2376/963 -jeibees_version=0.9.0.4-mc1.11.2 +jei_version=4.5.0.292 +jeibees_version=0.9.0.5 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 30d399d8d2bf522ff5de94bf434a7cc43a9a74b5..d3b83982b9b1bccad955349d702be9b884c6e049 100644 GIT binary patch delta 15577 zcmZX51yo$i(lzex?(P!YLU0Z4?gV#d2oNAR3~s^Q-QC^Y3GM_9lAlZRzx(CAS?jD* zYxl0|>aH{0b!NIMlE4Qt!I2bXz#-s3Kww}%_@&1sV~{8j|G8tc;}pCH0Rd5sd9RFx zn{wfJ=?Dt)FO~HlY9R^4+kKS!_x+Cf?GB^^-Fy>jkiZAd4^SW=jKCNOETB9RJ^*O*5nUK%;MdCje1M?8Uv@UxDQQ~fCOa&$ zDyu32rlhw>xqSlpZse*i$EC6*8SCX2;!b4Kv^MR`(v@B=_8Rsd-=0r(9v>$r^g;G6 zXo6*uh735v2*MH09E1kO__^+yJUYid;DuT8n@rx?2wj}0aaHOD8&*14__84mzyZR` z#%>A_zO4TYJ=8|XD=aYPwaJmNVeJ})Gp&EJV}TZxy*|sn zQWZcM=n`sCgZUP@?}k#O3bDM9#Q3>@XuL&ZVTj1gsi)UGeCoNc zO5LXB3mzgS!jzuAEmH-@QH%E2&%Lvf2rd`IfI)VIG+)ve`b!Rs=mmxC{82ze5GbP9 zI`_>t{rGZT{cZ8%$z^yJ(3fBkrI5?77=8DrSPLN~#M<_>EzELM{vv z2V4^+ST^Au%vUK_9Ip)-<`>J;wzhP1E&^K)L{k}*)G&!tZt^*}5()`WI=U30IuoKP z2Wn`TBueT>F0!PepDeAg65F5?rKBoiY^-pCRLwMWF2(y#($TdDN{s6M2cKSrYWb7} zpZCLHCcLw&&+vbL0ZcqcH)0_`Km=fcn<(4>ZDnm$j2BKRZc>8bws(@+xpjfsO3ad! zwR9L1m|&DJd3r~rX;i^MPTNCLpmsMuwe$(hj{@wF#<|C56IlkseeNWRHsr~^&kvha z-!5DEc%9aD)Gf%r{CtcO0&NYk^Ev3t^`|91Vma(_k)=<%>>`h_d&o3UlP6PZ$=b95 zKsv$g`B-%4Vk`16NmkMH$q}nCNV%7yj<^?~(rd(TC#-(Y$F>q&?Qcs< zZVu7zSn&-HX?DE0o{9H!c0s9&!*pz#`uz}D$qhfr&zprGnmhSyC$%TV*X?+I4#_A` z;ipL~ZVbVO(2BZCo@0|b%Ofc_0)XpmD2Bm)E-z5g5^pUb`p7F{7% zb+{B}dJ#L2S+-1uJX-Fm>Ru=L!)uKZ;7rHd9PaiGbqId|JBTK9+`FLpd z0Zd~U=8+euJAtv_21Ul9=}7tgE7LRbqeL=Cd>fR`xD|8q-9guXesTlAyEcd`;m1c?=>NTH)xcs!fxT_KM)#KV2d|qh9uf!$)!W9~frACm$6rAG#U!bv zS!%;z%x55JDvM4ETD;b8Be$JEUylY6N8cy^0jn14I3&Khr8-O9vq|opUSPWU&IdRj zvpV_lhu5#d`i&)BnamKX2jTNEuN1By>F1-V4ZmI{j(>sKBmD~B;tv;zD<4qk6c3N3 z?LoxNP*;pQmDALqlV53dyY#^nQn0sft}Vx=mK&%Ws|&RPBrrf~%~vCMWf$^A zZqabNc=%d7dVX@TH2mayGi+`9$;Hq?kk3g|*!yRYukr+jOG&h5CTIyu@#cl-kfY9; zW8#fbpMt%Kt?%vEqOW~Fi^w6hC$J+Z2P!M#IK_Inj1$Kn(UN_MB_ z7S{ek&LYd1sjBb33)`m_UG{fBs#2^?k7)sBwF_e(`sT&loG%#LkXpamZ&~|PU_vsE z)jAiFH0Sg6hck(a|9E#CM(A49%VG`48z$C)oK~$VHQ;>M1Dv!4aBG|Bl`ZzsH`fS% zCHOfl!q{5N@9jQgPtax{n*!P6fO-8O9a*JUCFjNmTzTZW>9JZVS216ybAW_1=C2w! znw@V}M7saVodHiZ&&esn6;Z^vP)QKA7rk4R6OBkIGwwh7n05m_$k;Q+FlLSnqj{iH z9d<+3ULm(*3dq+L4i_ItCXIT230SgF0Z5_^2f*irw%HC+(fjBlMhwCt=D4f$KszY* z(c@8Fh#)Rp)CLu>l#qs5>V0oZ;CO;@d&du*uHKB>=ibM#hp62XCALp}Pm4Qbai3f& ze(8kRfpVDGn6vrBS7BduNsrkv&k~@yezf|XoX$6A3(#<%9=c(55B^fP_3^&Op9y)9 zYRt5M?8Cfcgn#DGFq-h~3V#cUu1lcjCRbCE-ck8y9YfZkH)R#iHKot1g^e?-4mxjjsa6`@_@?+3|-`>q7w+?z(6! zp}O-KCV&?s|GapXbkRP~b-FdOq+V@B$!`$`W(&4B$E~Qy9b+RyJwsi4pZM2j=la|5 zj-~5MkIZ&?Dq_jEhllBLe6`(pX=o1>Y%NI}1I$zLY~e*lUeXPtu2`YqiF-6g)LJ{r z8m=lEx~#m46zzZhy2kCGHfg)FPS+SGBzX87Q4FYgfPjt3*leg!a8$t4$WJH$tyU`g>27T9(8IJAn>ZEL77)d|GlZ{Qv(RS}W-mEJT2SrU zVU;0kru`UCM2r!1`9X}CSMK(ynvk%y`J2DZ00*a!-u?+%&Au%$hzYLwy{dDDzQO51 zKRKWg1oC{p7*VQRsM0)rJIW{8G0w|6jDUFOs4We1d`ks!xFq9^)Jol1yjJ}~&ex8Je8z<9C-M_q^lpdXS4z^c;nT0Nz+d(nKoN)tM*AOR$W41TUc8*Mk^Ejf;yTljL9#o(o*usa+ogNPk?j zLe4NGuy)}7tXg68PLJ%8S#!%xYV#Lm2D&)a%%urtKm|!kb69=4GyiTGZ{ESqp_c(u zkQ)V~a9gj02DRRl$(j12*Sf`rpYM)ua6Nqzcr;914!p`wO$ZMu=KT>$z4m{MW~vbC zi>nc~4FCH3wH98Id%b=Q9~}hbgckUVm<9mvjj>xNMBTEq#Lz>J(miY?O6C#Fg@=MD z6}^ZOeZfLw*M>b+*@Do`Ef?#s|6_lB~x%bv7b7EECQgP z;t%!?)Uto5056k`sNw7g)q(z!g!TMwWqJv-n!!=|9cJB|;f(fLX##SS`S z9B|ARKR$fH9t!URO_`9%1r&Wt9C89Qg?J@|rxRuxmEZh;^C)N7baGeqo7nvU=3b)g z?&6mafZczTXBnNZNK=XmxBuu-cKwdl`*ZiVE2o-o3sMp?e&ahg)7CH-Us@Hn=0VDK zFMZc3CdQ^!Al>2ZRPV{Yte8yKgOu%`f_~Zx!(2zrRNGqVPP~6mdT5kQq5ECOVN*>@ERezv}E68V10u*t+JRxyyn@Sd=eBITa@Y>z%yiY5(VQrw=7eO(UEB8-9!edot%+ynFA?=h1Gv}G!+LL6W~>{&${`*)Y)zMG>$(i( zqS{2k>^9lLbABK1%AN^dSD=W0=Z0%F8ls2|hdcD0S0I0-dahB?f`1Dv8t|j+opF9$ z=wa-1)YS0~2T#+YsdiH9&1GfRyQ-ydT*e}cmYBs{V+DQ`D;p8LA{P3?;%E8{TMcpL2Z)ly*8b!Lp%iK3cPBzcKwVK|$&zUe(t|vN*nR71!b1 zOhud%bTcpMb}ni%S#*LcRzOejQfn2ga;RfLt?OY}0+W@TSTdD_=uJ?X@Rte^w;zMH zRCTmi;O8MoIo&KW@}I6fazfsth(TDgpljj=%VsWDTeG+9;^#wJhudlaRK;I*)JKm;z`M< zxxzq&R`aJAtx;4!L;8B`Uy8U=Yz4hP#B~LN*B-F(oH5U zS!%dcU0{(Lx?b-te=_Drl4Qim+OW70CoSS$m_rn2i(_daME2}413Qv+R5RdLnz3H? zl*cCm^;t`%nG_$@JJQqMs-6pIovcLsS5N*|)G z%s>vg)1k6iyGOBmwnRjm2A-kq)nu?o3H|fO*`f;oa)Q_bjo^!Ic9L9_JnRNxV z*7z9V)Y{IPnkWEHvY_0Vz_2_PMXCIgQ}C@4rR0P#WQ3mWuo3L^1N&`^k znq#DdrL+FD&?`@D$r^u^-N!D6UPl zRXFtgS=!yA+Wy&2<$-EF=VJf+j#<3jmbU5(|3>KPL$CB0c&XHZkMJ(@Rbr-Cc`VGq ze4UGGp)$rx^|03iCxq)+V46K7s;BVQifVg6NA?v!{Xstd?oxM<>C7~s+pXk@D%yK7#ecn6Uj3Ie%Iu7L{XBdc!YJgS@VgvHZ@~|+T>m$#lF>6W6Z3P zgN%sqr$aN@8DpQMgic@lL;|%kj(jftu}~{Q$?qvsVLrUm1&pKP$0g#)udiV~kGltI z52@aO_XxMq!yDVrvV8J1qA6}@4BJ}QK&i~Do+q35Gt#635`e_6gaPJRH9aG{Nr5io zdREiWWLA&x){Kl1Wff=Vtc$$L`AqY*ZqU3f4(r%-&RVs(l|cTSsxDfM%(bXWO|vt6 zMAn!aW9Por+E;EYEgw9FHR@J^O4YnBwR9pt@N&v*SxR!C16npY0eS*uN`{}sVIWla z;>q+#U8E>~@nK55BxRqTJfbRNsAW@Meo%F>8og9PFI%!AFjOHZ?X0v<S9v%-4AZgc9t%CMw>qjdage10HzkZDFgt2nxl0T~_=;pgd_>;@Yp`8>5d_ zq?fQ4Z-_OFBPVOoV5ULJAL*Ot>AP-QoTpHx_KP0ExC8#M#XeKJH16uYwA8MS5 z3Qk3Q*n+7#?GaIH%QAZB=dm>M1+ez5@e0?rPFZcdjpE1Q;f`$j@lvli=WVwF9IlYr z+^h)q*Ga<#g7G~#NOSK|U8wOL!Hb?b!C{$O{;Fs)h7-)k)OZ!7Lv4a;#_5N4VLSqG=aN{E33t zC%7Ntu{C7<L{QWR-36>&D0{o0RVuk0QN9lIo=kjKCi;dk6`yi!mQ z#%Vj|lSh%4yS>qvcIY@}RIGfr0MTP-8ma@0qNMBTsLOBoPCT53jU9xY$?RI|a3TiZ zjMEG=X{zb)O3aP7p$gDN$`#pMS~OJGRT)-@zGYgB&sgL~?!fxV7n!X^xImdW9#v5g z@=&@tG^xB_oyaEzZr45H?gNk2%Ez?WQ|ic3cloYW{6nf*uL~DK8u!aIb;0+Ly8##$ z^aNbVdPF2QED_8V+_KUhyM|Zs>V)~Q!PZFMM7;1GCdd1vBk}>$xY340WBF*U=~7(A zxvN=H4U=V}x2c1@x2clx<{e*kh^~Dz+Wm-P_Fy0-yPQE{BNg|oeRQ`=>|gel+49B?i!1k~+1^R2;-nZ2LzamF?q%S(3VTKB%@ zD7`h>U8sWESCt^P{h$v*&V?Z_^r6coz*$SX4`j^ZlHrGZhUmn-)sL`Nk4H;0RhEu# zW=ub@JkEJu5{C`i3t*(jdF`J9hJ90X;TiX95u?>g+!G!EVNb#vQ;!y1CcH$~m=D|4<7a)EqcYMz{wv^?;EdVKQktD@^4wjcM^X>BcB#jqdusYozk09!`-T zQ)b>ZVsq3JAlrGqlxy;t1&s`slm5T6)#E3JHG=9HbOdbnnwEq%2Oi|#b(tbVA}6Om@N zY~zU2$4K861eb^-d1YiD@k@gb0>LxsC#guB&@$yf0fH@s8J#=jSeNa#}^UtV~$4Xp$qfpwJ8hr?Xel5NU&@f zb#fQ8)obfLrm7n27(0sV#;~tL>FOS$X3)B3l+IDLI5BFRYzlM`gBB*axsB+^SVJ`U z;j_O518}TCuI%cKJA(z|p-6lM%`zeiTZh$ZSWC>v1x)t|JkX!^m+U^SIK-CBk`R2S zxk2ZroIirHi&0aJ>nNPZzP_0W^~qI(^7%M5 z%)i{sM=a^v;5f)tW8>c-T(+{6%2ycI?qB&r2Y_e~82_S?48jb#eBKb?OsCq}EK%jl zYwtTMzJ_pr&C|LYX0Hi(JnefOkmAnFd@N9~FLmv`zK&IEbz3nhft zoY(^yQOQADY^xZQ*Nw0NVcNr{-MpxLOt}%SoW3-8XR{+{9`uv*)e7EsuEw*cmIDL| zZh&d@e7A<&7wqeqg5D|jYh@>)GQRg#P(^t*(en*MPl({oTOc-ZvQwdush==eH}>ka zeub$JsK7OFDWezZJR`;I9EgI!0EX^FIA<4(BWs<#TZ7{AN5!5Z6yfTic3C^Fdw zbNPhg7{dSUJ(5GGD=cQt8uIZ5eArsB+&;k9tKUe}hjH7NW4@NW+Y4oXfwbLDSoU0^ zmp_EY9p=^-rv(f*bMuj3W3WeO$n~k$Opj})h6)^hY|;T)*a7_LASx069AaP(EWl*{A*?WWih~k zM^BJzhK^Yt*SO6++Tu4g_e0d?6Nl-?qPC`Nmf4S6tC z<)A-_23R6}d1n_-HL2~Yu{-p|BV{5WTB)+BwL3ES6Mwi%hH4F66>OTGZBL2gJlUp| zUu*Se1MMq<)zcV_uGudlAGj}nks(|I&@|e@4csBAyfA4`I4GVHEm3DNvJ(7sVa?j) zIszBbQHWwE1vH$fp5c&CViL{A>e75|Qt3b1KF+kPi)~T}SGq;>nsgjHN6%3nF2!A2 zZ|^z=k-GBQN1fytP30;HW>4mQGkSlBAAkYf+p-cAfjEf?9`_y;qZ`htQeFK=@wsmfcUs9X*4qOPVWUk!+*;VC5aG zCv?^W|A7W9<3!e7H0uU*-bTPYF^&8$5NW`B+h=kMpFrMYV&Ow_6%@cYRhGx%r;VJA z?s~q;u@|Hg%D(flWd~-T=ymQ}fPZnPE!t5IvhW-@?yX-BF{u|-L%reC$IZ>}^V*Zt zD748ZVscYTieI#{ZIbV7Qxr5!)zJi?BY)u<9Ef2Qh+{bbgdgn`ZYyX^U(k0~H%N{E zrk_EwHBn_U=Rvi5(P(bl+Zx8I+^mrelw^OI?9Y^j0H3ZWGS5O5LwJbz0r6LG))p^W zO1+}3~K76%7Y2EJlX4?LNqa##7|7YIlrX73`9iUZQ>k0F+b}skK!8;N^$rm z;oem4N7GXlSX`RZJ_rvj$&Ec%*3_gv9-jBOIbHCKe?J=McjF{JA8&D7g)L=q%1C8h zOuvN<7xrM_|FIax`~J$7Xst`E5Z=DDdVlH{_<#NRB+U#D`S$0NK++T9lL$;hVfwr;rw6qMAHq&EbBWnrdQp$LPbJo)-+4DnZ z?=%-r0+*JEVBlzI=&}jOFhs@58iWs_Lj1C^`tZ*m1uwh7?Jn-dWI1bAY!Cq_sdsI6 zZRhts1745cosfm#4BF7Hb{KtEQ9HE*Xu8sUS20C#kpNIxo3@%w15pi-_7%i-$lHYO z<|vqr%puYQ*E_nxDmw;{JR6KXUMAcWJzl%lk0$ONmEI(N$isIc)mMheJ`{eq59`c5 z65#hq-o(+TJ!~UTEc6@DrtUO;!Ml9aJp<3~6n+wYp#y=>=)!4{A4AilMoyI39-TqH zp%O>lUjhOz2x8J7O>Q-X1hIRUxN$mxSI^!c`Y@Yepx(58%+MF{AnkM`A0IC3NSXsr zkFTDC5I(AIr`{(>KGYL$z-D7_U{Y?tZ$I9DPP*+O@eL$~zC?d|=l6}aaAO*u5clj9 zkMNL?U{Qc~wZY56-M-M=-9%Qn@SM%2Vm@Y82^~PFI3k-%#Yw9%ZIe5lkWlSvF%({I zV4C4qK5h{u@!@4pVSkWwVlT9H?4W*p4S$^9%FVe}zw1i3O{67Df}ee%VrYK#khoYs4=<(pB4V<69+u*%{& zCll4wQ^-aJdA#rH8+%a0Q1{>$5O}=N2C!btJgCW$dZJz7?gN1wRPPs$m;q7w4$D*SkmfQ{_m72nFBGCBS9L215XB^td& zCY4#BnGypyOV3D_%+S1Gii34JlmEzZDaj5==`dN4j4qm+AA*DzV=qc)!JY8|vTjH0 zJ8_P9SW0)e{bD_?@^w?}MN^DH>jEc$*k-la=(gDQ8xKq7*EpxpH0{#d#&(Gjiv7pa zrm)!BlEOm2BK;V{g|9VmZnQKj$04Q0xVZUq-y{o$8aAz2J}rbR|Ehz$Szx-tEPeSE zFOA(wTb|kEw?Vq1Q|*%_Qj*lmT-2-~H@IG5B3XFP;oHNjYwykttVUDzEU&}_)HZW| z!43?*n@qBwNpV)@wvCp>Rnyp*n6@+@V;ICENIW|juv6ua*!bGLQS%8~Q-IEO$CR$W zQl>A@y(%5xk6VXcMOqQyJ*yluP4@KjZP0KN55{MSR8oGd=P7p9h9gDdtBzmz#&DDgSOJm1Bf zaIy_GMkHKUU$m2Tru4@lTDNrG*kLBz|0G6z(&sPO_87lONN^`eQQ4YorPXg6(cV&c})={N%^xhzQ7gJ`Q%vb=@i@fCxDxhG3JR> zh=D#|mSVgTKRdFxubukEy~9lCIe1tEC1K<~Q$%G(Hk~6!lQ>shP%2ymqmC1!4V+bx z`^&h0o!seGjFdoG@Ev9B&_yE==MAkfGiE*_`5Y0E^bvv=H_%lMXgh3G=7XqwZP~Z4 zJ`B<3h}i)5GSYT))MSJs59q6)1I_EMfKbg-g1f+Ec?vD2lZm72P%5LNrjfyPM#3>{ zX__RkV)JhD?Nm(7m^U`EO@qQ1OY=C<2%z=^l6d+loZaOb%AG+GT$g5ep193=hwX|f zFEbc7>7H1ouEwihA<^@sjkLK>+^j3fN71aeABV2tsOYCNwH79F0``UE0!#8Yc@wuy zMXZ^Mi>Y+On-l`$9;RByk3zxLb@;Z_ekN%PXDr7jxz0k)=yfkS1h()Yq4KHXBU>GuZX!Y>}zJ{#ftZdr1IVW!0B;#6Sgfkc;+^pa7Y2T;>|{MSRdZk`9qQh<&@kqR+MTi0Gw0k$FfWq(CE^?*ddu3*U;D{e*yF-;O}dUv%hC| zjvPr-UNkYAx8w_7 z#=>)83w6dR9Te70&v7+X)GBk3P#wtng zQ%>&_Pj!f>sh`)hs$NJz&N9rI2qNF^oFcQIeKec8S_C{h8zY`|3ux?vRbk5T*!o2s z&v6shaR(?0p;K=$l&1y2j8oR3wk?WsbN2LlG=lCci&N+6_<1>yRv*-Z@&`<=hV3>Y zBq|dLe?U{_jH}@+3>5$(&{dg(+0pKM<2uF__It?R;=yWI5i44If!(<7@%yDPEH_Pe zAq;QVCIb?_7zA0{Xcs+`71la)FkM2_PSs_HKL|w7TYQlk9DbU|ZV#jwroBFm48x zjt-kHgQ#hZV6%+^YvWqX1zk2Q5T|ITM?LG=15zW@C6FX7Z!Z32j!-wafiVUXdJZL zmZ+yAXV#HguY(|c@#&-?br1|s_(5Vb`%>D7bW58fc%2o@ z+W`Q8KWz)_XcvJ&8f=L0(EgB9tRT_P+h50o9T*Rx+$;<^r>1BavZOL#2fl>`-orUt z;waWOJTCNl9Lb%hyjs_7v^hnn{dD!E`m;W)X=hQ{OSgRdWgy>XbMa)d)#?wzvj;XF zefN91iLL6@Eh~rgFsWE^nMBw+-eqXcpUVKPqvYFwJ8Y8;j@~P+gbSA@usFvg<`xt^ zv1?2(R{?S*qY1r$g)8f5vkgfFZypeemnW`m-pVD$zW2FehUeUQlflOVlvsn72%Ctm zrDD@^<+){XDo2u^7^x1$KW0WIP}Fcasu_*6F2#Gm7qPV{R%$F^a#~-{Jw|4>u5$rq zJRwZW*h|ht#R4DNY{WGu8&ay@xA@0t$Z3+cCKIi8hh1_~jh?P{^aL0ik09I5~2zC;%fkyCqqUo>|*GQnSdp*mx28 zJ2MW%%PpyX&4)igye7nSZwYZ?Cw2{iP%9kLKc}RZ#!=lfUk_{5A^{^I@M5Kr0qRz6 z_;Z+R3wWBL{89vkTYAm z$tS_`lH7<0%=X_5jd?5juro<5@Bh}kfH(G*s>+Jg(HRn8!g4Ywj zyd8-;#h-j|n;kTI-Cj?z^xlc`14z0Hw8w}F`8kE- z>px)RuCpD!{goyoe4F+#1Ld-I6hI|jJ0X6d13^vhu9xLAT*+s{Wwn^22H27x;lxxk zp$exZw`sD(y`!!DDmPB|6Fi~7Ueo5grZMG)V>)<-0M`)f^Yv$+fV5ia(dzOaneogX zL5sA`raH{u#=XSHIcFpUauitFt|cdL7g8O4vsp(k8mC$;f7n|pkrF}FAX0xL%Kr@9 z4^#uJ(z)6y99UqPPSXAivH^sxagJ0y5yC}LC$i}z1)Ak7YcYE&hAFxcs!aY|BdBR- zGv?V-uyh=~zQs3I3U(JCcAUImz*Ub=DOCc6`oPdvx`js1t!)N6A`N47EofDuB^sdmjMO%%%JjVtj;3gnO#t3NhO zeSNvK?>T-dOAVUkQf0gwLdW;1|*@hcT2DnhjFOCseKOLsU|%X5&Kr__CD z2$_u=y5l1PmsG1y(hd*rdGw|(;ai72ZyF_>Wk(v3D-PWW?GD_Pd$qH@@Xu)iz2JiO zkMHve0blglwaSc~o8|eRsr=nsT7#8&*9V|cpVS7#qHGwsJXGb^qrqD_mi8z$3@h#Na`s%c{lR5 z3hreG_U}IoZ1nE>F*F;~5&`8RI8-!hOi*DReTNAwG0NNR3H--A^S4sLzh`tOl~$`QtI&UKMHrgH_mZ1S3k zd>VsI9(^FerdkV4%&-;^E@!m9lxcn7gV!sbS!8On!W0y7wrV8pcL|SyaRLR6`xGtejKiR3sL_b-R$`9gp5;!wr4rd-pZefLy zYgF1*RFc~w@>S(7b=}f4vNUW37$OIuWbdmsM(J~SBH`e8w|w)xQ_N9hUu_5a-a+ep z=haih%m`98UG?^aB?~SA*;`d0DqJM)mCSp_LQ-vy*j|wZxp#`;!;9~z0R4NftD#qb z`cnnOp`-$X_Rs#d^JP+>=(XU8;PoO00d90r^1g;`LRyZAwqA}|T6RckPHueYJ00B^ z{m`gf9pwKxwMF}?E=zp@;ry!l_4UF50kU-C0XPP$kh)1wKqlKdjEv4`KHzGs>gZfU zM;@a}Nn3i(o-ZWb_a{bHk4`9w@y#*fy@y6(ba&1X>RRY5o1eCG`YxKt5J;K>!Utx6 zWI)XxgI@1{F!26saCTHYr%xRbJ0o3>wkxAeTdedu^V(mH#2iB}CCLAdlNS8dDRlS4X(4hXyZ>VP2=-`i3ZyF2wyH(bl2W0n2GnffQ2gh~c(nuaS|0ZHd9Akj^FaZ57EXPY?HtXS6=eQ3 z_TL)t|6c**AB_&+Mho6sB^vO#1rPM-Eze?VMfeQ~w&H;if&!;HFoB(|ut4`#^xt^Y zD-H_w2N(E_fwtj+xk0>P1rW$6|Lp=$@wMF$@~z#!jq0~f=_>{U^MR-ig z|8ey-&HGG*^hOkHr+Op)TWkaZ!txjKC(0W!xt*5yAB%Y&EX`{F%oijG2=QOUW#Cpj z)0?rsPX7PJvB7yW)`5f0@ZUrF_go|h2+3bc$;59;zoejn-#XCVdRXg}{o4B)t$5hi zqQ1Y#S8T6jzBkfezXAV60_A?QD3A2dPr`U_cRuNR(ZpOx>(~$X+7JD)i`tI|wgvcOgZ#~5ZFk$GIA{=%0o2zDm%kid{|v0~p#iq^|4|-! zRj&UE-0zosQ)IJNua|xuDa7kY#s5+a4SVfD<&E?uuNK=J4FshB^>O^$I(OtNi43?q z@O#MxJ`Ui4?PLO@MreRSgSfwkp)-gFwvhA3T_|AIAkLrRz2eRJuK~mb=4Mm;PY{9W zt(dK^o{_wI#_*SCP9?8HA_M+4Cw@bCU>@cF>7;MyPi&4~aqFsAoB-IAjr>2Ih)iMa z9f5;@c)zZm{C{;aTK#6Mvm76oHvDJqN{8{lP#S<+)qMYBh!NAmANtkXme-|#?Jq++ zjX>s+_iytkUJr98@Y>t(>srD07m2s!bEh{5U?O1(9j_G^7|68h~x;r(=M=vWkC=S5Y<>A6^xWi zrwb=gkpG1&CWd&^7^VD^-ZQ?XKw8lCw@fV(m=o9^Q82{rACWy|?jKPtCN%0h)ZhBX zmHy2JU?3pK??6E4L4d+tjDV=PCA(=M@pDaN{FmV}e(n$7_I3&tQH$e2PN; z+K7?d$$>ZcHj03lRCy~os|J&zVTUZgMdxlR2j1?18-B3h-ISX_763ml3zAM{CNh=6 zs$i{1nhNtr+s3LaNcu=)Zbt^zd8wszZ3h-IDM5l6P>&mLBx=5XF& z_6pIBR_8tybJ88MKLZHrzcA7qOtZ(=ch!gM+Zrz0c@ZQish0_)r*(lg*W^#c5}l0p=*Z9FU47tM6j>R(ZVSd$DJ#6pJe$RHUEk4z)g z&q49Wa1GsX_)p;(C`IM2uN7F@MNf}BYw2Y5GLU8WHffV%dU-W7zRvVLLOWqm!49vA z$tSpKhL^@6vJC-hDjbcSO4nj>q>>fnSf>c8f@s0Lftml`)qJ<1l zWf`H_WQiBJe+RRYFM;I_1PBPu>r7w*GJVGc(xMOnj-1id&|hrROuF5Ma}{M|f}z1I zA3ytH*uc_E$mAovSELJQmbV86n{e82)L~#`-Ag=m!AEy%2yh2>V}BnTaDSn?ap%k# zjaW4EI&Ir?9e>Dh9zR}t`SpP1_jIq-%@A4SAu5U{!Is`r6wb+hPkt5u4#W78iNPI> zhC(eJpnj1Uq8cey64y$}$V-`jX3fMz zCav5}7o?hLEevakQ4l^13np4%+AN8|CfQtwejmM5E7BRlJdKJLd>rX8hRcfMwAgo? z7n{O@uaY?|mzBnG1?$ysLx~~F-De}wvr9k*NJ3Mft4?+ozpXRAT2CbfOjS|2ZNhRC z2Ic9Iv_llquC`z*Q^) zP}j7pPZ~@aCOuGIHEGW_kPQx0(%=fQmR-8}w&P;@!$j4*EIYrfdLYOY#R_G@3B%8} z9JvyNnspF|!M+~X)T#M>xa?I)0K;x3rfc@&VvbkUA-Cj#!^bW;tq>iDePfRsql$&X z#40!i<@ohOFA3QjSrvj7;eF2XW#_2@K%r++I4uv0!L*HKP*Om&d0pJK#X(iVN z>T-4=x=RJbrvig-X6mZYyjHb5>P)P)HG^(QywN8?d(&O8<~GKOHRm#}-OiCapAn%v zrF97)b%CIxwDZaOAsa@3Ji*0sBjJ8hfeA+fqLO>5{{E(%O*De604<-8aaa8B04$pJ zAC4+c?Ok&;?UNVu?b8?hpA;Qs`(y5f=R(t`M zq^LAl3NN~3mqh@u81Ln?;zWzDv`hKcy3AD%N%dP_4>P*5KV@4dY1*VnwUM%aMIbF& zPnYMtZS|4U`$aJB5$IDS&6{?04$vac4~gOY&Yg%{5mcufMF*=>itS{VXpT(eo8Z-J zV^zAx(q0#vg$(DiQQMl28@-d`Ud8gbW!WwLxfIfnTs#n8UBZ%pVe11_mHk+}>un)^ z%XjX1LL6Jo;HY}O%{UbGA$e~EPMOrWhqI@wN5(xR&~#3}w1v;Gh@4FNK!7OU_!`4N z2L+XrK=+ zTa0+b`4bpm{E7U25IT}kIHO>1UCdq|<>>Kq53iSbyLSdkKBH6XqLS?9Lh7L&QFv(N6gFSgn>WFd$3D+r- z3MY&39v~Jpq2VF-Q5=STUS^QFLy0B?n;O4C_OiqfPfx$v)+H^OI{;iz2sYR`F0b?n zFZaqeeHew}I`-#*dNBN$l;3;wnA1@>1{4U09U=$_#q08j1q1C1!7 z=oT=gRj8!V&S%8RD<5eT7MrZC$?R#)np;YHLY&a3?tCG@;(xxw(x&dI1O2oe1J=Iq zQKx}s`WC8<^UQK}gp+kGt?}h~{D~7Zy{}`FE4+&^y;m9kom~%g8?mTT$PSgwuiT_ihW zWr0tkWZhS+D&4@Vq<+cJy}|-YXX7OF_Y!s%ob@(JtZ)m|xJ+<+7{>&4a{V)M?&`FO zE|5PdDEhPT3DZ}3>MISbAHE7~?cbVOYq9yTh9vlQQ5~|OcrG&`+NSZOxHM%WD<;X_2akW&B*WARRp!}1w#EXUbmpE?sPM(Z(D^4*Cf z!iuf@(~Y*_<}C|I-vO%q=+f+N4X5kgINK)cg~=0uiePKiE-Wuz1tOIq_EwIqdZ-50 zO#-nXO22bw*WzQ1s|t~xtLyZ|6h2GaG1W*&obgz|&`<6o_%CVAX&EUaC#W@f&V2v| zyI2pEv_1_@H%LcZ0)ybzWB1d{D4L(5%8G>PH8Qtf8PZH15fN_&VKA^9lzKh+2zz5x z;kWu}GP~I^oISLARj{|jSM9WVKb(h$L(*N!%zeeC!s%_bE4?q?{{=5-E>T1CiKG-tEGdDHy8JbH&3vwtB#s~MtDVBj@CcPc2wg1E8%>Ht~^w^9)L$_p-Zi1+EbWarQ|@kcF!o^5o5` z?)2myZ!e_kA>!2NZAHU72I*_zjHQN)2);>cTbzd^S zgCi0JthBe*_Rn2awJnt{sniAn;?k(d=IGOcRL=c*V)Y1$cO0GsE+$?q%|2}nddBRM z8uPVzOSqqeFdwjd5{1ui&L@|Uq4gZi|K@Ob=qH9d2(?ODoZjI~l~4-D@$t;G=v0nz zVV2(0x($Nkg4KWh>hbX2m01gl_o}&{n%?Giqq|twx8u?Z;&@7*&QiP((6?$9P43;%+Ddxg}twW0Q4}~K5)Fqeoz`~oK9iErG<_v@TP%|$@gZ(5E~2TK+XVm z7-1YQ2>Db5P*nV2xuv*uv_NpAG6q17?scU#L%Ho!xb1r>f4EUJ0f*X~D&Lruf}}sv z*{CDwV(wLJt|qd?H%x?@3{*4I5NSCMT!lU1U~r7l?UWs;#zf$A1)zOUw%XPLepob? z8zsJxOb%c=Iqs#(hh~3Rh8%3_1c;=^rV0KzZqW@j= zXz=G9evJ2NAL1Q-d;u=tADzR{$|eV)GIzG<-1ef&Zk+Lj(3shPJQ;LuSi|)9V=V2^ zi_BrvnHEN71FrcsoHg=hRX!nsJ6Bz9=Fr>>HxZ%>D6 z@EVu@OOmGo3roB-vhX-T&s1fOAwO{cMtxM|PHc_egx2G%Ii7soXOrz91EnHsVf%p$ z$?A)MY=MAe5+#_zC5;kq?NVTXrGmNJlh?KFKY2VAwAo()?nkO#D#h5YJBS(%a1 zhQEx-TJ^qKy=(vJv36O126$j6T^z#-KriGpxp&3^Jd1?bCm7w!;ylX;yzodFda2~t zdw=eDNFYv_a^F6t$9blZ0>}ce^3JB#pblUjp>Wy@Cj{S7i@m(hekq&ih@b43>Y%

z<;`7ozDQgTchTk}={L6#I5&)}>>>Jv$1}Gpme}>G55yk!d>6zX#)*9{{!)GQoqrR@ zcUP78(Ya75B5mgN zlJ$u}iTJiSRrF-s%`ui*Nhxwm+EW4rw zbUM0+2unszM&>Vsq%3Rf;jS?0h*27aZ*(~qG%ra&hHVnttR8jfMp8po0JG9CJ0@AnWr0~-SEES3;^j5ZqFnKLwaHMp4&xLd zol@HiG=kT9x1~#!W)CqIvg+ij_#|mSwuuzn*#xxFHGDv5%@uWq!GvMFvHL zsW3elfpAY=?RSb?E3SUH-5K3j{!Ae}HI!$=uLq6l;(MFTjmS5=9K+!3qYIEFWiM$m z)b=F~VuRShJ=l^!O+i!kwmMP}5@KDc92}i$%A6qYDkn_^%Z?l4!a?}88G&%$d5#@a z>%z5I0_=@zp=22FN!jKG@3N;mTnO$vKagHZ9a`$1WUpu-4)WR-GlK1tGPU_KQSa!u zg&!vh`BP+(>4_(Y_{qhLIiCbi`Xk|)$6l-Nq2=W7>OW_SJ7Y?EEe7pEpSm6Dsyus*k}T3o*mGCZF$Xz6@t0$}nz0ttfvcEdX+=YaoA86kS<+0sEksjIA0?nWb`%+ zf%~Xp6RAF66Pfe4s!-I_O%oeR^sV7Q(FlHL-k#w;JE@|xmC*%g?x0FmoeSR7cDVg}b`4)LvVs{*CC^BNgmExt!4XkdN>xI07eecBECV)lah81V z0;f3n4My^AvMU!r0^G>!vDB<+DME8(0$)HQ`3od#p4qU2e^Q$@bBEQGIY{hC zdWvjFClubN55-(;ab-G0G!30?+?D)-5G=m@*#k-wp2$E2kW%hq|J2b%r1;RvH4610 z%3aS`QcEL9j_IY%RH0*$B6hLW1u0zpCM)Gd>MDr1x-`uXh05YU!NpcmhezIs}$*vZ%6V9MBjX+6Nr?Cnu zY&rZx0jul*AbV9wA65H%@m0kzE3d{=px zTW)bOA(rhZyEy6x0#QrW*lO3L3qRZ45~cfsN?A|LG(W2T8_%C<`maHn?clU!%_^2UP}8Pdp~@tg_gAw^${X$Y6r2?A zL8Y*GxW2q(l&=e=k8ya9!fa!z=5gZ&Gl^SL6|p{U=ftLoN&PqgOjoR-+k!sXX}}oI zVwRYHI#W}+23ch;$p0xPdnUcVHGtyqttL;v(i|X&#p5Y}im^X^V)?X%)Y9P>v?teE zL~c#3+SlrKW!7HTjLqQ5PcAokT0+{GO?5$8%uUHFZr=_wjNC?bpGYH?Mx|g#dTIE> zGALQ%LQTXNJuZ}Ymc+A{mvwb*EV7?#7sJmth%VC7haU!BZ)E0%6}>1ce@c_8DXyJI z)D)m0Rc_xT^8DCGyIpGEEHcc%i*6HXJs9JNW@nc-Q-{N6lY^idRUN{@RqXCKmCGi) zT^2;?rrxC%R*TxsH=mJ5eGJW+mE#xasnN}ra5vK-H(aH;y2d6?yV#1Y(eO}J9O7Gx z9zGN5YiPd(U!Gbpqn{JbxcyBBJms?$^DIDxo87Nl!eRN?p<%5zYtIHNBe(y1V2t*@ zqZblW{It3kV;fO=c>%Pq-l=KIk{Tpyvp0X*KVpEj!ZXl$u+%EU6keAi+wpy>gH zp!;^nm-x91UfDuxPoBk(1nmo2zSyfu0clVNT944@zVUhao5y3$^VG2gjMn~@#_CM& zBU63z@ZygKe)3qBlm(+t@|7nSUbpu&J{YT5R8y)OOOv}uKMO5~#g*~8pG#Fgiu8~F zyq}7)XCGtk=oG#umh*-k$qF$XQ=|p(i@6*6A}wn|a6u<)YfEQ=EPbMC_h*V2EH{b4BMpf+BVAvyQ{h z)QIgiK3RxGRs}S6GM(ur;R`|&|1swMCyz-*}+x9B^ zRPD?{dIzZ&x_S|AF2sg5>+WDT-KG|K zl$(>7dPu#(p(@no{+nP21B294{!a&ejom|RuMfdr*%=lX=!Ta~KLDnWR5hf2eHYnu z!fr;282-{0pqH1GuVDU+>S`_u*kMyM!VkPfusAl<4qh)4(mWNbu@G(E7c0RI=%WC6 zdSCZUr=BIz)GqY_WXX7+jHr;&;E6nF3?pciF1up-=RN|&gu4MwwQcy2LurbDxFBM= zU>N!Z+BGoyo~<0J0%c+)%;g&Aky`T`0$;0;AObA_u__Cafbo3j&>SBN0HC#hXxxu8 zeo(tcaBy0UJwLj3{!WP)^~`~nN_kFxU}n3&PK*9T+Gd@)y0V0Pm{HIkHy$_sGj1>6 zXA_#6EtB+N!5AT+1@_V`J!sQlU`jofRL@D-F6@^{T>cel6Z+cn(t3|5Yr(U?`14Iv zWt&jiA;F!MZU^`?yJ#jqU={Z4YWu3yWtFTNY(mso&L%_z8l{++LJgwFDo6w&AcxR@ z;`14S!)7G#o6o$)K9(T}qh?9LFfNvKce#Ze8d8F^MfDUF^=BE3w`PNz- z9&S;jhKHkWy#*eO+wloY$2-;}i*SlpC;`_NEosrbl)!gjA$1 z+X_*gRiA|Y9`3~j8#`Z2?@dy6+O}(}><&;!`G}K?PvJv&X?z&SzWY;AXPr19D81&G zm`kPD`oUFm76ejaehs*voufhWJTa~JHTE?KUXwXuzxOYIsB4}l9!)yQR=~_)p(myW z#6IV~wHD(kXe3mv@|xdJ$;gaqN1#KwDAQ)ZguNLI&9#nJ2G#YFvaR2x`@VZEl@8Nz zimDyJF{lJ?owR3XP4qou`*BO#a7Rqgx}M!|Nc&pxP_KPU&dK=jrn@OK&XEIK*k3e^dJHfG~EsGW^i6I$Rul= z96#HbZ}>rj^46HL%1Vh?@PQTRX(}j(HXLX*&tsWnaAmOUOX*l>(%VX7O+XSH*ja=j zGzrNrO-!}jF|2q`$UpeHn;+!qPMwFYwcM?80@ge}d^#S4A_Q}&K!x3!WzxgwEX^(I zwC-x657)+z6zK$5o9?+9wh9Dr23_<~+4U1B{n!|z!dy4NwhuQ#L7a`f9A#-04{01a z=h$eM4QUD9K0#>}-E|)tYuP?hgg8rl;Ad&&47eNo^$AA+xf9Ct`3rn#cN1j*Qp8vc z^jVvd%jRcIc6xo*OILk}yNF(-AZA)Nq=CVV%bQ6i!pKd44}Ro2NeWT)x-p6mUw|a( zy%v;jo||)0Eo;U}PKb5YD8c5TmZuvs7yk>~Y)plFJX@r#6nX z+AW0WDOUB=S6bjLjBQK_*p@M>*mBgc)vV^TjVNeEV0p9AN`{7nyR};+iE&rh4ej0N zO5nLe?-hh~@k(Als z4Ihzfd7|PVZk>usCg8gK<9`3_I2mxk0!e)*cOOUIqQY;RMUaQ zCG>edYjnC?*Uax5H0itcOim$fN}c5X4eDgR_(%;jid1ET?#nHl<$L@tBDZ;+`{e@M zl1bb20RBoXuNWl**k~;A0nA}V2bm*W4Pk{w-p0sl=_**WNtvXrj{;$d@Kiw;^nGhn z^^s&#%SNUt(HKXB88XwU<>n2R@VW$`X;U^jjWP<{QZ|`O1p&=+TAIGIKUlik#ca8$ z*&rJ~#~SA!EUHSQc|JOgD7kz4Vy~I~pmbS^0YG)GD~My#SXle=P~*)K41}$ym1_{_ z+zH1$<{_EX`kQ|&u$&g47t9WmOeLoZ3nUp$B_>4x<*^9b2v?o(Aq|Gb?FZi`DwF`1 zH_5|IyBJK3ZTJb7#v<^5{YZIuoS45+>2ESKOSC&{S#;A3cuXk(Yzq|&1EIQYM1V>m`>@q#V?hFv$c!P2#3*` zuO*P=ZhGGfM3f$%OEH_{sdyFRV$^wa^bU7z@mk8Y?v#nh@)1Q|xEvB%E_r6)(XY-%q^tkgczt@y^Vr zccf1$=A+hGnnEGU_yOnT6B9ey*AKX9%KwnkQe0(_`Yrn2LEU_Qt2e+r^_oMEg}{90 zy?z$-)>*)+pz1Q|J>w15*UAl9u9xCX{d;%p7o`jR;xgZPj6NXEbH5N(c*zf{D|8!N zwk?IZZ0=i=Usk?Zr43)^rj6`E-a(j+;k(gQs60u3S(K!@dz`AuaUnu@a2p5kJ(rqQ zY*e3&TPHZStMo#ee{1`i_)%H8NuxX<0^F<8h?JUi)1Q$>d! zj=is~8huiNdyhUjs$KFhq90WIkTdha3V54FWdrq z{$A1T1aI)Al%&Gy%eL2iqh8-lLi^2uZp{7csBWRpk=o}$)8Vt^<;JlQ+PM@@G-o}j zjPXwA!3(~Mcg$J3-@~=2jBATgW+i8ab=67lPozwt5$dWGwWO%~#JZi@Xx=|Q!XocJO|C~S-u)lBen zY4J={WmAuE++dI`kteI#ltte70bX5hOVzz{VMXWQIAixTwc4X$ti@DaJoimuDkqUQnr9FhwGD{hzc zeO019RxZ*J^p%%xAi{P>JSs!y==|rFs=>|!Fj5EBM3H`lAyUlb?|FgqD~N94SL9*J zTRt%1SNEfwIFc}WApjqzhSa9ITeLFv7^81M;=8YgxG<+ox;d70M0T|Obh{QuIk$R6 zO_2xldl5@k;nWo(>CSwdvdxt)w;;ltn6e7FTU40iUx9-u>7CrHTz5?6 zJe53Z?~0v1r*Lf+seVMslWV!6SWeLcSEvpWbGHV+8?!4zfQ!?5|~bNP)r z7H_F5M(NF}6?mwnt_TVq_2!iS?L4dX%6m%H;%Y^@l+?ZgTV3{s54lI5T;>dxNa(N~ zmJb#vGV8-s>MGx1hUdF*rQJZhD+>WVG@U_Y+Q-qhs~!r^n;(7jMp4oKB|p&t>ZI2_ zjhh*iu?}|(#Rm_ta^QzmsHDn8NoZ^e?fYazvZ2ErvC0hA>X{vNtJl{tj6}ji43IpR)Pk;h4_P3w!UR*P|y-5ip?DF64i*4lzp5A5T|~Wt3oD6`PLz;k z4XbZitklGkX`nY>6grVo*Pufx-q&{Cy zqyvAhwj7`TK6~a|ZelZT>cQ7E>~=e*8$|1ckYJY?T(T&I^cy6Qz@$kJ zMHrgJcsNc)sPOThbZ_C8<9(=_!67pAnF=iA^H>ZthxpYUu9uspBrcdo-eBEKQ$_5g zi=*C^inHrlD}-~@Qaas!0t|<`CrZLjK za9CD0YQ`n3ju#WD@5+#vQg_L?(Pk5^ZG?7tXQndJuWFM3_i>4mxITq>aj@&NS<%Ph z9MGA?O8E2DA+pvPf!-;P3{x3+H4reTLc=2Uw2JpY8b|f9fFd(`|0KWwj_oQ@5&cNY zIH8Q3*$<4Zo&*baFj;(YnRLR_IyKp9`G}cN^rIjv?!zktwJ7qXQ4~?mgk(Q1u>l)a z6s1tL3@f35U(?HCMVOJjEb=-ATF;0d$emis7?>;vLtBHDT+$;;U@9!90&5{S8W}$_ zZ*K5|_s>vCrq1Q|BJ=_jw6^PA3%csKl%_uy(8;nNJK&jy`=i4x85fil9op!P?KWo4 z6a^7TsB!{RQP#>A1IsVPF*Kk4RXa`nYIQc70cZ0!r)Y%H=|&gw1&@_w2o~f?6v{I8X;tk(85iJJ<=A= z)<1?PmZEW&n|(O*Ja3Ow(v80W6}Vm}!y(#2!^zrY#mU-&Lu!w|z-Yf+kBhXQA8-6T zQEjE+I%7upgDzfTnn(P!z56acOK+<#QK~9(NY^&){XJ+B|GiS*2W+5Ya9iEEK&hFv zrd3*(5lmTfy><}5ddQ@P7lOu~DD+%{Uafk@&5FfeUOdLNgS8>0kC{I6tBR0bnmInH zh9A<^uO_QAHSEM`5<+cvYEdgg08j7^ZLlw%i-U-N%4Q1Yf;zEir7aJg|BSzpyIdw& zfO-M>lJm^a_k7^tY#icPa8Ru)vE?DP&PwTgU_3TCt{M>FLd!AHhMjWdt6_qt^3AEg z3Gkzs*qU4F;&?CM2PT@thzB1qs`c1({MKfnw5gm`Cdy7(ISI2=at(dk75Dwm%sI-?mw9$q5LUZq-t3K}T zP2SFLM$JD^%yLrOtpct;%?V%rd{6?hC>xKyW;2oSV%~2V6@QT^qdY-ivzCOBu`Gk1 zjS_{Ji_CqGjT=g}?tl_t zXOz(bde^x=P9@##489sT$26|>Fhxb16qd*Qg6qqLGMCWTrBqfV+btMw+Jije0ue!> zD6p&f$k;{pF<^U9mpy!|_EDejpo2EPFYePVw|~A?@1^N`ip2Onrzx2&L`l8Q)(KbD zW@M*yz{*0FD64-718O<4MI24uktX$i?9xcB8dyi?imEnpZmN-L{M0*qss&<Vj9QmVGUkcjU4V$E(@!I{IFX`r2Jy(A+awM4vhJi?a#25bSe%EdPIq+ zwnBc3259UeLE)~+GM@1=9+_NN6G6kOBWbEbfVB%^J44!Mky5ID4y9m@YS~@_?7FZPnk9iirwD^N}_j3tO5m#+Zw)Npf-v&sDW)lH^i#0R~3ot z6oA@q(C}0dFkH4m^GeYenl}vMYf(P|Qs%L{U z;Fv;~T)}x_I3A4ju4W`Vl0YH{KaW+XXXyZd{=17<5nFw!0|fz52L}P+`Ws#c4>ak; zu9Z=12mKQ{53ivLjez&M(ac0b0F+)M^FIJ>^=T|s#zsF-k4mdaNy`t94ATvcjBhC; zevnr>rx{gZs#0XCs$*fUVqsTva6>>;Vq#%p+o7Qv8kdo0pl*<7l#v^ho{=9L+@_%! zr5zlRuipXtzdo|Sycz@R>oFgFHHHfc9MvZRd}y%)CqX{G(;&@-3?PA&Z`B(g@Ni7#G3HGVfEDFY%A` zX^#j@{X790B9VA8ZRl_rCsm2KuLD^Z7LlyN9$a$*;ln0mw(0Vty(yZuXnD^{%Twd7 zI`c%F?g0@?%UJc9R@Ld2A!}6Gx6?DfGKU^p0{it?7;p&VdE``!@ps$rPul@tA1+|I;{ew-iCWQWz`{qmt{wKHO#`8Ca<242O zNA?<#@mJ&6{|D3`Sx?x+Us-ZQ$zNuP=t9&#r5D-fe`PzlYkzYC1@#brO8ra0{@Mtw zIQv`bRjvD%Z?Q(`FOINr{IBeyN#!q2swEB_^|yaIadSG7ul+6ldJ};Fktawr{{M}z zI>rBw5w`QsxB>-32mkLu6CiU3>%S*WfQ}vPZ(|);(t(Se`dR~fCv!$c+5e@t+=0u} z{5c>xM0tRIMjsaxUfCjFAXMY3l9cwz5yn>cqZ_H(+JYJ79Jv@f#R_^W#!4BnZgkYs<0z1BQZr z19L+Y1F?JH-+cP_D9wM-b^ZiEp)S5R!hcRW{1@`-_W<%6AuS34aI6ddPfx6N;e!3d zc#|V_W4{sn6ASzgK{WO&5c4%O7!_#W4gUuIZ_pD62=PDQJ)$?(s&1S=mPWgA!T1>8 zWY66cZ_59E*!{0|oxd#G-_N|bf0RG<;DY@ScvG(IA$wE)@ALTo?v63(zm}nZh`s1< z;C~k2{~CI26avLp@Nb`fugCBISc~k%1*24cBVp7)1P=GY6aTX?zY_dAq5#^!yIyAE ze-~5`5bS>}q38f7^>KmteeiF<-(~+ZhF_z`{$9VwFuE=@PV{eSU{YiKVU&Di1)ex5lgR`px*Km12f)!GONNm{L;U=n(1~L4+{7jn69q+$#akKLpmnz?UJZ zKZ>%$xL|^zZ-n8)%ztDZudyy*pl$A#a->gbb znjOcz0@Gjp`xh9Q^|#vZfcSavbpQ7<`geva3CPO|5Vrh>+5im{!=x9 zQCu*p!dE{T{?oAy->aOHUoDor_SL@~%TV$ki|rMd|7m_o2q}1+*M>3w?ax1!NXlOo z@PTy0cz>*EkKuy(SGRR)6aru=Tm{}A=o0N2MP|B%p* List getRecipeCategoryUids(IFocus focus) { - focus = Focus.check(focus); V ingredient = focus.getValue(); if (!(ingredient instanceof ItemStack)) { @@ -54,7 +52,6 @@ public class MultiFenceRecipeRegistryPlugin implements IRecipeRegistryPlugin { @Override public List getRecipeWrappers(IRecipeCategory recipeCategory, IFocus focus) { - focus = Focus.check(focus); V ingredient = focus.getValue(); if (!recipeCategory.getUid().equals(VanillaRecipeCategoryUid.CRAFTING) || !(ingredient instanceof ItemStack)) { return Collections.emptyList(); From 934bb3b8f96ed4a9a3875ac8f32f5ca7ae29ac1c Mon Sep 17 00:00:00 2001 From: mezz Date: Thu, 13 Jul 2017 23:25:53 -0700 Subject: [PATCH 02/13] Fix #162 Crash when hovering over drinks with AppleSkin and AppleCore --- src/main/java/binnie/core/liquid/ItemFluidContainer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/binnie/core/liquid/ItemFluidContainer.java b/src/main/java/binnie/core/liquid/ItemFluidContainer.java index 9bddb5e3..e8525a78 100644 --- a/src/main/java/binnie/core/liquid/ItemFluidContainer.java +++ b/src/main/java/binnie/core/liquid/ItemFluidContainer.java @@ -161,6 +161,9 @@ public class ItemFluidContainer extends ItemFood implements IItemModelRegister { private boolean isDrinkable(final ItemStack stack) { final FluidStack fluid = getContained(stack); + if (fluid == null) { + return false; + } final IDrinkLiquid liquid = DrinkManager.getLiquid(fluid); return liquid != null && liquid.isConsumable(); } From 96fe27e834ca51a58533207feb8b9df768239c23 Mon Sep 17 00:00:00 2001 From: mezz Date: Thu, 13 Jul 2017 23:34:51 -0700 Subject: [PATCH 03/13] Cleanup --- src/main/java/binnie/botany/farm/FlowerCrop.java | 4 ++-- src/main/java/binnie/extrabees/alveary/package-info.java | 9 +++++++++ src/main/java/binnie/extrabees/blocks/package-info.java | 9 +++++++++ src/main/java/binnie/extrabees/circuit/package-info.java | 9 +++++++++ .../extrabees/client/gui/AbstractAlvearyContainer.java | 3 +-- .../java/binnie/extrabees/client/gui/package-info.java | 9 +++++++++ src/main/java/binnie/extrabees/client/package-info.java | 9 +++++++++ src/main/java/binnie/extrabees/init/package-info.java | 9 +++++++++ src/main/java/binnie/extrabees/items/package-info.java | 9 +++++++++ .../java/binnie/extrabees/items/types/package-info.java | 9 +++++++++ .../java/binnie/extrabees/utils/config/package-info.java | 9 +++++++++ src/main/java/binnie/extrabees/utils/package-info.java | 8 ++++++++ .../binnie/extratrees/genetics/ETTreeDefinition.java | 4 +++- .../binnie/genetics/machine/indexer/package-info.java | 9 +++++++++ 14 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 src/main/java/binnie/extrabees/alveary/package-info.java create mode 100644 src/main/java/binnie/extrabees/blocks/package-info.java create mode 100644 src/main/java/binnie/extrabees/circuit/package-info.java create mode 100644 src/main/java/binnie/extrabees/client/gui/package-info.java create mode 100644 src/main/java/binnie/extrabees/client/package-info.java create mode 100644 src/main/java/binnie/extrabees/init/package-info.java create mode 100644 src/main/java/binnie/extrabees/items/package-info.java create mode 100644 src/main/java/binnie/extrabees/items/types/package-info.java create mode 100644 src/main/java/binnie/extrabees/utils/config/package-info.java create mode 100644 src/main/java/binnie/extrabees/utils/package-info.java create mode 100644 src/main/java/binnie/genetics/machine/indexer/package-info.java diff --git a/src/main/java/binnie/botany/farm/FlowerCrop.java b/src/main/java/binnie/botany/farm/FlowerCrop.java index 8a046551..7a87b50f 100644 --- a/src/main/java/binnie/botany/farm/FlowerCrop.java +++ b/src/main/java/binnie/botany/farm/FlowerCrop.java @@ -1,7 +1,7 @@ package binnie.botany.farm; import javax.annotation.Nullable; -import java.util.Arrays; +import java.util.Collections; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; @@ -14,7 +14,7 @@ public class FlowerCrop implements ICrop { BlockPos position; public FlowerCrop(BlockPos pos, ItemStack... drops) { - Arrays.stream(drops).forEach(drop -> this.drops.add(drop)); + Collections.addAll(this.drops, drops); position = pos; } diff --git a/src/main/java/binnie/extrabees/alveary/package-info.java b/src/main/java/binnie/extrabees/alveary/package-info.java new file mode 100644 index 00000000..b1d72b98 --- /dev/null +++ b/src/main/java/binnie/extrabees/alveary/package-info.java @@ -0,0 +1,9 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package binnie.extrabees.alveary; + +import binnie.extrabees.utils.FieldsAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/extrabees/blocks/package-info.java b/src/main/java/binnie/extrabees/blocks/package-info.java new file mode 100644 index 00000000..15945370 --- /dev/null +++ b/src/main/java/binnie/extrabees/blocks/package-info.java @@ -0,0 +1,9 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package binnie.extrabees.blocks; + +import binnie.extrabees.utils.FieldsAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/extrabees/circuit/package-info.java b/src/main/java/binnie/extrabees/circuit/package-info.java new file mode 100644 index 00000000..c9a3e8f3 --- /dev/null +++ b/src/main/java/binnie/extrabees/circuit/package-info.java @@ -0,0 +1,9 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package binnie.extrabees.circuit; + +import binnie.extrabees.utils.FieldsAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/extrabees/client/gui/AbstractAlvearyContainer.java b/src/main/java/binnie/extrabees/client/gui/AbstractAlvearyContainer.java index 288fe24d..246f73b3 100644 --- a/src/main/java/binnie/extrabees/client/gui/AbstractAlvearyContainer.java +++ b/src/main/java/binnie/extrabees/client/gui/AbstractAlvearyContainer.java @@ -1,6 +1,5 @@ package binnie.extrabees.client.gui; -import javax.annotation.Nonnull; import java.awt.Dimension; import forestry.core.utils.SlotUtil; @@ -52,7 +51,7 @@ public abstract class AbstractAlvearyContainer extends Container { } @Override - public boolean canInteractWith(@Nonnull EntityPlayer playerIn) { + public boolean canInteractWith(EntityPlayer playerIn) { return true; } diff --git a/src/main/java/binnie/extrabees/client/gui/package-info.java b/src/main/java/binnie/extrabees/client/gui/package-info.java new file mode 100644 index 00000000..a6a93966 --- /dev/null +++ b/src/main/java/binnie/extrabees/client/gui/package-info.java @@ -0,0 +1,9 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package binnie.extrabees.client.gui; + +import binnie.extrabees.utils.FieldsAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/extrabees/client/package-info.java b/src/main/java/binnie/extrabees/client/package-info.java new file mode 100644 index 00000000..fab2a52d --- /dev/null +++ b/src/main/java/binnie/extrabees/client/package-info.java @@ -0,0 +1,9 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package binnie.extrabees.client; + +import binnie.extrabees.utils.FieldsAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/extrabees/init/package-info.java b/src/main/java/binnie/extrabees/init/package-info.java new file mode 100644 index 00000000..13866df6 --- /dev/null +++ b/src/main/java/binnie/extrabees/init/package-info.java @@ -0,0 +1,9 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package binnie.extrabees.init; + +import binnie.extrabees.utils.FieldsAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/extrabees/items/package-info.java b/src/main/java/binnie/extrabees/items/package-info.java new file mode 100644 index 00000000..ab0678ac --- /dev/null +++ b/src/main/java/binnie/extrabees/items/package-info.java @@ -0,0 +1,9 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package binnie.extrabees.items; + +import binnie.extrabees.utils.FieldsAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/extrabees/items/types/package-info.java b/src/main/java/binnie/extrabees/items/types/package-info.java new file mode 100644 index 00000000..d60893ef --- /dev/null +++ b/src/main/java/binnie/extrabees/items/types/package-info.java @@ -0,0 +1,9 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package binnie.extrabees.items.types; + +import binnie.extrabees.utils.FieldsAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/extrabees/utils/config/package-info.java b/src/main/java/binnie/extrabees/utils/config/package-info.java new file mode 100644 index 00000000..47a44906 --- /dev/null +++ b/src/main/java/binnie/extrabees/utils/config/package-info.java @@ -0,0 +1,9 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package binnie.extrabees.utils.config; + +import binnie.extrabees.utils.FieldsAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/extrabees/utils/package-info.java b/src/main/java/binnie/extrabees/utils/package-info.java new file mode 100644 index 00000000..f1f2814d --- /dev/null +++ b/src/main/java/binnie/extrabees/utils/package-info.java @@ -0,0 +1,8 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package binnie.extrabees.utils; + +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/extratrees/genetics/ETTreeDefinition.java b/src/main/java/binnie/extratrees/genetics/ETTreeDefinition.java index a45eeb22..5acac37f 100644 --- a/src/main/java/binnie/extratrees/genetics/ETTreeDefinition.java +++ b/src/main/java/binnie/extratrees/genetics/ETTreeDefinition.java @@ -79,6 +79,8 @@ import binnie.extratrees.gen.WorldGenTree3; import binnie.extratrees.gen.WorldGenTropical; import binnie.extratrees.gen.WorldGenWalnut; +import javax.annotation.Nullable; + public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, ITreeGenerator { OrchardApple("malus", "domestica", EnumLeafType.DECIDUOUS, new Color(0x09E67E), new Color(0xFF9CF3), EnumSaplingType.Default, EnumETLog.Apple, new Color(0x7B7A7B)) { @Override @@ -2187,7 +2189,7 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT } @Override - public boolean setLeaves(ITreeGenome genome, World world, GameProfile owner, BlockPos pos) { + public boolean setLeaves(ITreeGenome genome, World world, @Nullable GameProfile owner, BlockPos pos) { boolean placed = world.setBlockState(pos, PluginArboriculture.getBlocks().leaves.getDefaultState()); if (!placed) { return false; diff --git a/src/main/java/binnie/genetics/machine/indexer/package-info.java b/src/main/java/binnie/genetics/machine/indexer/package-info.java new file mode 100644 index 00000000..c89292af --- /dev/null +++ b/src/main/java/binnie/genetics/machine/indexer/package-info.java @@ -0,0 +1,9 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +@FieldsAreNonnullByDefault +package binnie.genetics.machine.indexer; + +import binnie.extrabees.utils.FieldsAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file From 0aa9853da29163fcd8856fb9f93d8f8b2934a7ea Mon Sep 17 00:00:00 2001 From: Alexander Kornilov Date: Sat, 15 Jul 2017 08:48:11 +0300 Subject: [PATCH 04/13] Feature/refactoring (#207) * Fixed deprecated I18n usage * Code improve readability for botany.api package * Fix naming of templateAsGenome method params --- .../java/binnie/botany/api/EnumAcidity.java | 12 ++-- .../botany/api/EnumFlowerChromosome.java | 6 +- .../binnie/botany/api/EnumFlowerStage.java | 2 +- .../java/binnie/botany/api/EnumMoisture.java | 12 ++-- .../java/binnie/botany/api/EnumSoilType.java | 16 ++--- .../java/binnie/botany/api/FlowerManager.java | 2 +- .../botany/api/IAlleleFlowerEffect.java | 5 +- .../botany/api/IAlleleFlowerSpecies.java | 12 ++-- .../java/binnie/botany/api/IColorMix.java | 13 ++++ .../java/binnie/botany/api/IColourMix.java | 13 ---- src/main/java/binnie/botany/api/IFlower.java | 15 ++--- .../java/binnie/botany/api/IFlowerColour.java | 2 +- .../binnie/botany/api/IFlowerDefinition.java | 3 +- .../binnie/botany/api/IFlowerFactory.java | 2 +- .../java/binnie/botany/api/IFlowerGenome.java | 6 +- .../binnie/botany/api/IFlowerMutation.java | 5 +- .../java/binnie/botany/api/IFlowerRoot.java | 26 ++++--- .../java/binnie/botany/api/IFlowerType.java | 4 +- .../binnie/botany/api/IGardeningManager.java | 61 +++++++++-------- .../java/binnie/botany/api/package-info.java | 4 +- .../botany/ceramic/BlockStainedGlass.java | 2 +- .../botany/craftgui/ControlColorMixBox.java | 6 +- .../botany/craftgui/ControlColorMixItem.java | 12 ++-- .../craftgui/ControlColorMixSymbol.java | 8 +-- .../binnie/botany/craftgui/PageColorMix.java | 8 +-- .../craftgui/PageColorMixResultant.java | 6 +- .../binnie/botany/gardening/Gardening.java | 48 ++++++------- .../botany/gardening/ItemSoilMeter.java | 2 +- .../botany/genetics/AlleleEffectNone.java | 4 +- .../botany/genetics/AlleleFlowerSpecies.java | 2 +- .../binnie/botany/genetics/ColourMix.java | 12 ++-- .../java/binnie/botany/genetics/Flower.java | 8 +-- .../botany/genetics/FlowerColorAllele.java | 2 +- .../binnie/botany/genetics/FlowerFactory.java | 4 +- .../binnie/botany/genetics/FlowerGenome.java | 40 ++++++----- .../botany/genetics/FlowerMutation.java | 6 +- .../binnie/botany/genetics/FlowerRoot.java | 67 +++++++++---------- .../java/binnie/core/craftgui/Attribute.java | 2 +- .../binnie/core/craftgui/RenderStage.java | 2 +- .../java/binnie/core/craftgui/Tooltip.java | 2 +- .../craftgui/database/ControlMutationBox.java | 2 +- .../craftgui/database/EnumDiscoveryState.java | 2 +- .../core/craftgui/minecraft/MinecraftGUI.java | 2 +- .../craftgui/minecraft/MinecraftTooltip.java | 2 +- .../core/craftgui/renderer/TextureType.java | 2 +- .../genetics/effect/FireworkCreator.java | 2 +- .../utils/EnumBeeBooleanModifier.java | 2 +- .../extrabees/worldgen/WorldGenHiveRock.java | 1 - .../extrabees/worldgen/WorldGenHiveWater.java | 1 - .../carpentry/BlockStainedDesign.java | 2 +- .../extratrees/carpentry/ModuleCarpentry.java | 2 +- .../extratrees/genetics/ETTreeDefinition.java | 2 - .../MultiFenceRecipeSolidWrapper.java | 1 - .../binnie/extratrees/item/ItemSetSquare.java | 2 +- .../kitchen/MachineRendererKitchen.java | 1 - .../machines/MachineRendererNursery.java | 1 - .../gui/bee/database/ControlProductsBox.java | 2 +- .../gui/punnett/ExtraBeeGUITexture.java | 2 +- .../ComponentApiaristIndexerInventory.java | 2 +- 59 files changed, 236 insertions(+), 261 deletions(-) create mode 100644 src/main/java/binnie/botany/api/IColorMix.java delete mode 100644 src/main/java/binnie/botany/api/IColourMix.java diff --git a/src/main/java/binnie/botany/api/EnumAcidity.java b/src/main/java/binnie/botany/api/EnumAcidity.java index 80147bbb..c8bf2e10 100644 --- a/src/main/java/binnie/botany/api/EnumAcidity.java +++ b/src/main/java/binnie/botany/api/EnumAcidity.java @@ -1,10 +1,10 @@ package binnie.botany.api; -import javax.annotation.Nullable; - +import binnie.core.util.I18N; import net.minecraft.util.IStringSerializable; import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.translation.I18n; + +import javax.annotation.Nullable; public enum EnumAcidity implements IStringSerializable { ACID(TextFormatting.RED), @@ -24,9 +24,9 @@ public enum EnumAcidity implements IStringSerializable { } public String getLocalisedName(boolean withColor) { - String localisedName = I18n.translateToLocal("botany.ph." + getName()); - if(withColor && color != null){ - localisedName +=color; + String localisedName = I18N.localise("botany.ph." + getName()); + if (withColor && color != null) { + localisedName += color; } return localisedName; } diff --git a/src/main/java/binnie/botany/api/EnumFlowerChromosome.java b/src/main/java/binnie/botany/api/EnumFlowerChromosome.java index c90de665..052bf478 100644 --- a/src/main/java/binnie/botany/api/EnumFlowerChromosome.java +++ b/src/main/java/binnie/botany/api/EnumFlowerChromosome.java @@ -1,7 +1,5 @@ package binnie.botany.api; -import java.util.Locale; - import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IAllele; import forestry.api.genetics.IAlleleArea; @@ -11,6 +9,8 @@ import forestry.api.genetics.IAlleleTolerance; import forestry.api.genetics.IChromosomeType; import forestry.api.genetics.ISpeciesRoot; +import java.util.Locale; + public enum EnumFlowerChromosome implements IChromosomeType { SPECIES(IAlleleFlowerSpecies.class), PRIMARY(IAlleleInteger.class), @@ -27,7 +27,7 @@ public enum EnumFlowerChromosome implements IChromosomeType { private Class cls; - EnumFlowerChromosome(final Class cls) { + EnumFlowerChromosome(Class cls) { this.cls = cls; } diff --git a/src/main/java/binnie/botany/api/EnumFlowerStage.java b/src/main/java/binnie/botany/api/EnumFlowerStage.java index be7a2c4a..15be3988 100644 --- a/src/main/java/binnie/botany/api/EnumFlowerStage.java +++ b/src/main/java/binnie/botany/api/EnumFlowerStage.java @@ -10,7 +10,7 @@ public enum EnumFlowerStage implements ISpeciesType { public static final EnumFlowerStage[] VALUES = values(); String name; - EnumFlowerStage(final String name) { + EnumFlowerStage(String name) { this.name = name; } diff --git a/src/main/java/binnie/botany/api/EnumMoisture.java b/src/main/java/binnie/botany/api/EnumMoisture.java index 1b52c576..b5cb471b 100644 --- a/src/main/java/binnie/botany/api/EnumMoisture.java +++ b/src/main/java/binnie/botany/api/EnumMoisture.java @@ -1,10 +1,10 @@ package binnie.botany.api; -import javax.annotation.Nullable; - +import binnie.core.util.I18N; import net.minecraft.util.IStringSerializable; import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.translation.I18n; + +import javax.annotation.Nullable; public enum EnumMoisture implements IStringSerializable { DRY(TextFormatting.YELLOW), @@ -24,9 +24,9 @@ public enum EnumMoisture implements IStringSerializable { } public String getLocalisedName(boolean withColor) { - String localisedName = I18n.translateToLocal("botany.moisture." + getName()); - if(withColor && color != null){ - localisedName +=color; + String localisedName = I18N.localise("botany.moisture." + getName()); + if (withColor && color != null) { + localisedName += color; } return localisedName; } diff --git a/src/main/java/binnie/botany/api/EnumSoilType.java b/src/main/java/binnie/botany/api/EnumSoilType.java index 6153fa3d..4077da7e 100644 --- a/src/main/java/binnie/botany/api/EnumSoilType.java +++ b/src/main/java/binnie/botany/api/EnumSoilType.java @@ -1,21 +1,19 @@ package binnie.botany.api; -import javax.annotation.Nullable; -import java.util.Locale; - +import binnie.core.util.I18N; import net.minecraft.util.IStringSerializable; import net.minecraft.util.text.TextFormatting; -import net.minecraft.util.text.translation.I18n; + +import java.util.Locale; public enum EnumSoilType implements IStringSerializable { SOIL(TextFormatting.DARK_GRAY), LOAM(TextFormatting.GOLD), FLOWERBED(TextFormatting.LIGHT_PURPLE); - @Nullable - final TextFormatting color; + private final TextFormatting color; - EnumSoilType(@Nullable TextFormatting color) { + EnumSoilType(TextFormatting color) { this.color = color; } @@ -24,7 +22,7 @@ public enum EnumSoilType implements IStringSerializable { return this.name().toLowerCase(Locale.ENGLISH); } - public String getTranslated(boolean withColor) { - return (withColor && color != null ? color : "") + I18n.translateToLocal("botany.soil." + getName()); + public String getTranslated() { + return color + I18N.localise("botany.soil." + getName()); } } diff --git a/src/main/java/binnie/botany/api/FlowerManager.java b/src/main/java/binnie/botany/api/FlowerManager.java index 5a1c8ecc..c2844bee 100644 --- a/src/main/java/binnie/botany/api/FlowerManager.java +++ b/src/main/java/binnie/botany/api/FlowerManager.java @@ -10,7 +10,7 @@ public class FlowerManager { * Used to create new flowers. */ public static IFlowerFactory flowerFactory; - + /** * Used to manager soil. */ diff --git a/src/main/java/binnie/botany/api/IAlleleFlowerEffect.java b/src/main/java/binnie/botany/api/IAlleleFlowerEffect.java index 5b83c151..ac6cd8c5 100644 --- a/src/main/java/binnie/botany/api/IAlleleFlowerEffect.java +++ b/src/main/java/binnie/botany/api/IAlleleFlowerEffect.java @@ -1,10 +1,9 @@ package binnie.botany.api; -import net.minecraft.world.World; - import forestry.api.genetics.IAlleleEffect; import forestry.api.genetics.IEffectData; +import net.minecraft.world.World; public interface IAlleleFlowerEffect extends IAlleleEffect { - IEffectData doEffect(final IFlowerGenome p0, final IEffectData p1, final World p2, final int p3, final int p4, final int p5); + IEffectData doEffect(IFlowerGenome genome, IEffectData effect, World world, int x, int y, int z); } diff --git a/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java b/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java index 47e9c65e..5cc30f58 100644 --- a/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java +++ b/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java @@ -1,14 +1,12 @@ package binnie.botany.api; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.item.Item; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - import forestry.api.core.IModelManager; import forestry.api.genetics.IAlleleProperty; import forestry.api.genetics.IAlleleSpecies; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.item.Item; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; public interface IAlleleFlowerSpecies extends IAlleleSpecies, IAlleleProperty { IFlowerType getType(); @@ -18,7 +16,7 @@ public interface IAlleleFlowerSpecies extends IAlleleSpecies, IAlleleProperty getColourMixes(boolean p0); + Collection getColorMixes(boolean shuffle); + + void registerColourMix(IColorMix colorMix); - void registerColourMix(IColourMix colourMix); - boolean plant(World world, BlockPos pos, IFlower flower, GameProfile owner); - + void tryGrowSection(World world, BlockPos pos); - + void onGrowFromSeed(World world, BlockPos pos); } diff --git a/src/main/java/binnie/botany/api/IFlowerType.java b/src/main/java/binnie/botany/api/IFlowerType.java index fb53071b..644bc31b 100644 --- a/src/main/java/binnie/botany/api/IFlowerType.java +++ b/src/main/java/binnie/botany/api/IFlowerType.java @@ -1,13 +1,11 @@ package binnie.botany.api; +import forestry.api.core.IModelManager; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; - import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import forestry.api.core.IModelManager; - public interface IFlowerType> extends Comparable { @SideOnly(Side.CLIENT) void registerModels(Item item, IModelManager manager, EnumFlowerStage type); diff --git a/src/main/java/binnie/botany/api/IGardeningManager.java b/src/main/java/binnie/botany/api/IGardeningManager.java index e40dd437..44f3e5da 100644 --- a/src/main/java/binnie/botany/api/IGardeningManager.java +++ b/src/main/java/binnie/botany/api/IGardeningManager.java @@ -1,68 +1,67 @@ package binnie.botany.api; -import javax.annotation.Nullable; -import java.util.Collection; - +import forestry.api.core.EnumTemperature; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import forestry.api.core.EnumTemperature; +import javax.annotation.Nullable; +import java.util.Collection; public interface IGardeningManager { - default boolean isSoil(final Block block) { + default boolean isSoil(Block block) { return block instanceof IBlockSoil; } - + boolean isSoil(Item item); - + boolean isSoil(ItemStack item); - + EnumMoisture getNaturalMoisture(World world, BlockPos pos); - + EnumAcidity getNaturalPH(World world, BlockPos pos); - + float getBiomeMoisture(World world, BlockPos pos); - + float getBiomePH(World world, BlockPos pos); - + void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity); - + Collection getAcidFertilisers(); - + Collection getAlkalineFertilisers(); - + Collection getNutrientFertilisers(); - + void registerAcidFertiliser(ItemStack stack, int strength); - + void registerAlkalineFertiliser(ItemStack stack, int strength); - + void registerNutrientFertiliser(ItemStack stack, int strength); - + boolean isAcidFertiliser(ItemStack stack); - + boolean isAlkalineFertiliser(ItemStack stack); - + boolean isNutrientFertiliser(ItemStack stack); - + int getFertiliserStrength(ItemStack stack); - + boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos); - + EnumSoilType getSoilType(World world, BlockPos pos); - + default Block getSoilBlock(EnumSoilType type) { return getSoilBlock(type, false); } - - Block getSoilBlock(EnumSoilType type, boolean weedkill); - - boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp); - + + Block getSoilBlock(EnumSoilType type, boolean weedKill); + + boolean canTolerate(IFlower flower, EnumAcidity acidity, EnumMoisture moisture, EnumTemperature temperature); + boolean isWeedkiller(ItemStack heldItem); - + boolean addWeedKiller(World world, BlockPos pos); } diff --git a/src/main/java/binnie/botany/api/package-info.java b/src/main/java/binnie/botany/api/package-info.java index 25288c28..d93958b7 100644 --- a/src/main/java/binnie/botany/api/package-info.java +++ b/src/main/java/binnie/botany/api/package-info.java @@ -2,6 +2,6 @@ @MethodsReturnNonnullByDefault package binnie.botany.api; -import javax.annotation.ParametersAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; -import mcp.MethodsReturnNonnullByDefault; \ No newline at end of file +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/botany/ceramic/BlockStainedGlass.java b/src/main/java/binnie/botany/ceramic/BlockStainedGlass.java index 6fa78539..de22b64c 100644 --- a/src/main/java/binnie/botany/ceramic/BlockStainedGlass.java +++ b/src/main/java/binnie/botany/ceramic/BlockStainedGlass.java @@ -88,7 +88,7 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored player.addExhaustion(0.005F); if (EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0 && te instanceof TileEntityMetadata) { - java.util.List items = new java.util.ArrayList(); + java.util.List items = new java.util.ArrayList<>(); TileEntityMetadata tile = (TileEntityMetadata) te; int damage = getDroppedMeta(state, tile.getTileMetadata()); ItemStack itemstack = TileEntityMetadata.getItemStack(this, damage); diff --git a/src/main/java/binnie/botany/craftgui/ControlColorMixBox.java b/src/main/java/binnie/botany/craftgui/ControlColorMixBox.java index 4da7bd92..d1965f62 100644 --- a/src/main/java/binnie/botany/craftgui/ControlColorMixBox.java +++ b/src/main/java/binnie/botany/craftgui/ControlColorMixBox.java @@ -1,10 +1,10 @@ package binnie.botany.craftgui; -import binnie.botany.api.IColourMix; +import binnie.botany.api.IColorMix; import binnie.core.craftgui.IWidget; import binnie.core.craftgui.controls.listbox.ControlListBox; -public class ControlColorMixBox extends ControlListBox { +public class ControlColorMixBox extends ControlListBox { private int index; private Type type; @@ -14,7 +14,7 @@ public class ControlColorMixBox extends ControlListBox { } @Override - public IWidget createOption(final IColourMix value, final int y) { + public IWidget createOption(final IColorMix value, final int y) { return new ControlColorMixItem(this.getContent(), value, y); } diff --git a/src/main/java/binnie/botany/craftgui/ControlColorMixItem.java b/src/main/java/binnie/botany/craftgui/ControlColorMixItem.java index 3719f002..272fd22c 100644 --- a/src/main/java/binnie/botany/craftgui/ControlColorMixItem.java +++ b/src/main/java/binnie/botany/craftgui/ControlColorMixItem.java @@ -1,21 +1,21 @@ package binnie.botany.craftgui; -import binnie.botany.api.IColourMix; +import binnie.botany.api.IColorMix; import binnie.core.craftgui.controls.listbox.ControlList; import binnie.core.craftgui.controls.listbox.ControlOption; -public class ControlColorMixItem extends ControlOption { +public class ControlColorMixItem extends ControlOption { private final ControlColorDisplay itemWidget1; private final ControlColorDisplay itemWidget2; private final ControlColorDisplay itemWidget3; private final ControlColorMixSymbol addSymbol; private final ControlColorMixSymbol arrowSymbol; - public ControlColorMixItem(final ControlList controlList, final IColourMix option, final int y) { + public ControlColorMixItem(final ControlList controlList, final IColorMix option, final int y) { super(controlList, option, y); - IColourMix value = this.getValue(); - this.itemWidget1 = new ControlColorDisplay(this, 4, 4, value.getColourFirst()); - this.itemWidget2 = new ControlColorDisplay(this, 44, 4, value.getColourSecond()); + IColorMix value = this.getValue(); + this.itemWidget1 = new ControlColorDisplay(this, 4, 4, value.getColorFirst()); + this.itemWidget2 = new ControlColorDisplay(this, 44, 4, value.getColorSecond()); this.itemWidget3 = new ControlColorDisplay(this, 104, 4, value.getResult()); this.addSymbol = new ControlColorMixSymbol(this, 24, 4, 0, value); this.arrowSymbol = new ControlColorMixSymbol(this, 64, 4, 1, value); diff --git a/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java b/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java index 0e9adb7e..edcf688c 100644 --- a/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java +++ b/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java @@ -3,7 +3,7 @@ package binnie.botany.craftgui; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import binnie.botany.api.IColourMix; +import binnie.botany.api.IColorMix; import binnie.core.craftgui.Attribute; import binnie.core.craftgui.CraftGUI; import binnie.core.craftgui.ITooltip; @@ -19,10 +19,10 @@ import binnie.core.util.I18N; public class ControlColorMixSymbol extends Control implements ITooltip { static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2); static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2); - IColourMix value; + IColorMix value; int type; - protected ControlColorMixSymbol(final IWidget parent, final int x, final int y, final int type, final IColourMix value) { + protected ControlColorMixSymbol(final IWidget parent, final int x, final int y, final int type, final IColorMix value) { super(parent, x, y, 16 + type * 16, 16); this.value = value; this.type = type; @@ -40,7 +40,7 @@ public class ControlColorMixSymbol extends Control implements ITooltip { } } - public void setValue(final IColourMix value) { + public void setValue(final IColorMix value) { this.value = value; this.setColour(0xffffff); } diff --git a/src/main/java/binnie/botany/craftgui/PageColorMix.java b/src/main/java/binnie/botany/craftgui/PageColorMix.java index 671d1386..92bc8b31 100644 --- a/src/main/java/binnie/botany/craftgui/PageColorMix.java +++ b/src/main/java/binnie/botany/craftgui/PageColorMix.java @@ -3,7 +3,7 @@ package binnie.botany.craftgui; import java.util.ArrayList; import java.util.List; -import binnie.botany.api.IColourMix; +import binnie.botany.api.IColorMix; import binnie.botany.api.IFlowerColour; import binnie.botany.core.BotanyCore; import binnie.core.craftgui.IWidget; @@ -25,9 +25,9 @@ public class PageColorMix extends PageAbstract { @Override public void onValueChanged(final IFlowerColour colour) { - final List mixes = new ArrayList<>(); - for (final IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) { - if (mix.getColourFirst() == colour || mix.getColourSecond() == colour) { + final List mixes = new ArrayList<>(); + for (final IColorMix mix : BotanyCore.getFlowerRoot().getColorMixes(false)) { + if (mix.getColorFirst() == colour || mix.getColorSecond() == colour) { mixes.add(mix); } } diff --git a/src/main/java/binnie/botany/craftgui/PageColorMixResultant.java b/src/main/java/binnie/botany/craftgui/PageColorMixResultant.java index 95363098..c2f03342 100644 --- a/src/main/java/binnie/botany/craftgui/PageColorMixResultant.java +++ b/src/main/java/binnie/botany/craftgui/PageColorMixResultant.java @@ -3,7 +3,7 @@ package binnie.botany.craftgui; import java.util.ArrayList; import java.util.List; -import binnie.botany.api.IColourMix; +import binnie.botany.api.IColorMix; import binnie.botany.api.IFlowerColour; import binnie.botany.core.BotanyCore; import binnie.core.craftgui.IWidget; @@ -25,8 +25,8 @@ public class PageColorMixResultant extends PageAbstract { @Override public void onValueChanged(final IFlowerColour colour) { - final List mixes = new ArrayList<>(); - for (final IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) { + final List mixes = new ArrayList<>(); + for (final IColorMix mix : BotanyCore.getFlowerRoot().getColorMixes(false)) { if (mix.getResult() == colour) { mixes.add(mix); } diff --git a/src/main/java/binnie/botany/gardening/Gardening.java b/src/main/java/binnie/botany/gardening/Gardening.java index 1f387932..18b9b7c5 100644 --- a/src/main/java/binnie/botany/gardening/Gardening.java +++ b/src/main/java/binnie/botany/gardening/Gardening.java @@ -1,11 +1,16 @@ package binnie.botany.gardening; -import javax.annotation.Nullable; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - +import binnie.botany.Botany; +import binnie.botany.api.EnumAcidity; +import binnie.botany.api.EnumMoisture; +import binnie.botany.api.EnumSoilType; +import binnie.botany.api.IBlockSoil; +import binnie.botany.api.IFlower; +import binnie.botany.api.IGardeningManager; +import binnie.botany.items.BotanyItems; +import forestry.api.climate.IClimateInfo; +import forestry.api.core.EnumTemperature; +import forestry.api.core.ForestryAPI; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -16,18 +21,11 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; -import forestry.api.climate.IClimateInfo; -import forestry.api.core.EnumTemperature; -import forestry.api.core.ForestryAPI; - -import binnie.botany.Botany; -import binnie.botany.api.EnumAcidity; -import binnie.botany.api.EnumMoisture; -import binnie.botany.api.EnumSoilType; -import binnie.botany.api.IBlockSoil; -import binnie.botany.api.IFlower; -import binnie.botany.api.IGardeningManager; -import binnie.botany.items.BotanyItems; +import javax.annotation.Nullable; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; public class Gardening implements IGardeningManager { private final Map fertiliserAcid = new LinkedHashMap<>(); @@ -219,23 +217,25 @@ public class Gardening implements IGardeningManager { } @Override - public Block getSoilBlock(final EnumSoilType type, final boolean weedkill) { + public Block getSoilBlock(final EnumSoilType type, final boolean weedKill) { switch (type) { case FLOWERBED: { - return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed; + return weedKill ? Botany.flowerbedNoWeed : Botany.flowerbed; } case LOAM: { - return weedkill ? Botany.loamNoWeed : Botany.loam; + return weedKill ? Botany.loamNoWeed : Botany.loam; } default: { - return weedkill ? Botany.soilNoWeed : Botany.soil; + return weedKill ? Botany.soilNoWeed : Botany.soil; } } } @Override - public boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp) { - return flower.getGenome().canTolerate(ePH) && flower.getGenome().canTolerate(eMoisture) && flower.getGenome().canTolerate(eTemp); + public boolean canTolerate(IFlower flower, EnumAcidity acidity, EnumMoisture moisture, EnumTemperature temperature) { + return flower.getGenome().canTolerate(acidity) + && flower.getGenome().canTolerate(moisture) + && flower.getGenome().canTolerate(temperature); } @Override diff --git a/src/main/java/binnie/botany/gardening/ItemSoilMeter.java b/src/main/java/binnie/botany/gardening/ItemSoilMeter.java index c6224226..eb17f6ec 100644 --- a/src/main/java/binnie/botany/gardening/ItemSoilMeter.java +++ b/src/main/java/binnie/botany/gardening/ItemSoilMeter.java @@ -77,7 +77,7 @@ public class ItemSoilMeter extends Item implements IItemModelRegister { if (gardening.isSoil(block) && !BinnieCore.getBinnieProxy().isSimulating(worldIn)) { IBlockSoil soil = (IBlockSoil) block; String info = I18N.localise("botany.soil.type") + ": "; - info = info + soil.getType(worldIn, pos).getTranslated(true); + info = info + soil.getType(worldIn, pos).getTranslated(); info += ", " + TextFormatting.WHITE + I18N.localise("botany.moisture") + ": "; info = info + soil.getMoisture(worldIn, pos).getLocalisedName(true); info += ", " + TextFormatting.WHITE + I18N.localise("botany.ph") + ": "; diff --git a/src/main/java/binnie/botany/genetics/AlleleEffectNone.java b/src/main/java/binnie/botany/genetics/AlleleEffectNone.java index d44016e3..0ded7726 100644 --- a/src/main/java/binnie/botany/genetics/AlleleEffectNone.java +++ b/src/main/java/binnie/botany/genetics/AlleleEffectNone.java @@ -34,8 +34,8 @@ public class AlleleEffectNone implements IAlleleFlowerEffect { } @Override - public IEffectData doEffect(final IFlowerGenome genome, final IEffectData storedData, final World world, final int x, final int y, final int z) { - return storedData; + public IEffectData doEffect(final IFlowerGenome genome, final IEffectData effect, final World world, final int x, final int y, final int z) { + return effect; } @Override diff --git a/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java b/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java index 70fff790..884f0105 100644 --- a/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java +++ b/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java @@ -83,7 +83,7 @@ public class AlleleFlowerSpecies extends AlleleSpecies implements IAlleleFlowerS } @Override - public int getFlowerColour(EnumFlowerStage type, int renderPass) { + public int getFlowerColor(EnumFlowerStage type, int renderPass) { return 0; } diff --git a/src/main/java/binnie/botany/genetics/ColourMix.java b/src/main/java/binnie/botany/genetics/ColourMix.java index 0cf315c7..193fe56a 100644 --- a/src/main/java/binnie/botany/genetics/ColourMix.java +++ b/src/main/java/binnie/botany/genetics/ColourMix.java @@ -1,9 +1,9 @@ package binnie.botany.genetics; -import binnie.botany.api.IColourMix; +import binnie.botany.api.IColorMix; import binnie.botany.api.IFlowerColour; -public class ColourMix implements IColourMix { +public class ColourMix implements IColorMix { IFlowerColour colour1; IFlowerColour colour2; IFlowerColour result; @@ -17,18 +17,18 @@ public class ColourMix implements IColourMix { } @Override - public IFlowerColour getColourFirst() { + public IFlowerColour getColorFirst() { return this.colour1; } @Override - public IFlowerColour getColourSecond() { + public IFlowerColour getColorSecond() { return this.colour2; } @Override - public boolean isMutation(final IFlowerColour a, final IFlowerColour b) { - return (a == this.colour1 && b == this.colour2) || (a == this.colour2 && b == this.colour1); + public boolean isMutation(final IFlowerColour colorFirst, final IFlowerColour colorSecond) { + return (colorFirst == this.colour1 && colorSecond == this.colour2) || (colorFirst == this.colour2 && colorSecond == this.colour1); } @Override diff --git a/src/main/java/binnie/botany/genetics/Flower.java b/src/main/java/binnie/botany/genetics/Flower.java index 9b0c35a8..4168b7fa 100644 --- a/src/main/java/binnie/botany/genetics/Flower.java +++ b/src/main/java/binnie/botany/genetics/Flower.java @@ -17,7 +17,7 @@ import forestry.core.genetics.Individual; import binnie.botany.api.EnumFlowerChromosome; import binnie.botany.api.IAlleleFlowerSpecies; -import binnie.botany.api.IColourMix; +import binnie.botany.api.IColorMix; import binnie.botany.api.IFlower; import binnie.botany.api.IFlowerColour; import binnie.botany.api.IFlowerGenome; @@ -243,7 +243,7 @@ public class Flower extends Individual implements IFlower { IFlowerColour colourFirst = genome0.getPrimaryColor(); IFlowerColour colourSecond = genome2.getPrimaryColor(); if (colourFirst != colourSecond) { - for (final IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) { + for (final IColorMix mutation : BotanyCore.getFlowerRoot().getColorMixes(true)) { if (mutation.isMutation(colourFirst, colourSecond) && world.rand.nextFloat() * 100.0f < mutation.getChance()) { parentFirst[EnumFlowerChromosome.PRIMARY.ordinal()] = new Chromosome(mutation.getResult().getAllele()); } @@ -252,7 +252,7 @@ public class Flower extends Individual implements IFlower { colourFirst = genome0.getSecondaryColor(); colourSecond = genome2.getSecondaryColor(); if (colourFirst != colourSecond) { - for (final IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) { + for (final IColorMix mutation : BotanyCore.getFlowerRoot().getColorMixes(true)) { if (mutation.isMutation(colourFirst, colourSecond) && world.rand.nextFloat() * 100.0f < mutation.getChance()) { parentFirst[EnumFlowerChromosome.SECONDARY.ordinal()] = new Chromosome(mutation.getResult().getAllele()); } @@ -261,7 +261,7 @@ public class Flower extends Individual implements IFlower { colourFirst = genome0.getStemColor(); colourSecond = genome2.getStemColor(); if (colourFirst != colourSecond) { - for (final IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) { + for (final IColorMix mutation : BotanyCore.getFlowerRoot().getColorMixes(true)) { if (mutation.isMutation(colourFirst, colourSecond) && world.rand.nextFloat() * 100.0f < mutation.getChance()) { parentFirst[EnumFlowerChromosome.STEM.ordinal()] = new Chromosome(mutation.getResult().getAllele()); } diff --git a/src/main/java/binnie/botany/genetics/FlowerColorAllele.java b/src/main/java/binnie/botany/genetics/FlowerColorAllele.java index ec065b93..d50237f5 100644 --- a/src/main/java/binnie/botany/genetics/FlowerColorAllele.java +++ b/src/main/java/binnie/botany/genetics/FlowerColorAllele.java @@ -50,7 +50,7 @@ public class FlowerColorAllele implements IFlowerColour, IAlleleInteger { } @Override - public int getColor(final boolean dis) { + public int getColor(boolean dis) { return dis ? this.colorDis : this.color; } diff --git a/src/main/java/binnie/botany/genetics/FlowerFactory.java b/src/main/java/binnie/botany/genetics/FlowerFactory.java index 754b61ed..e0b19497 100644 --- a/src/main/java/binnie/botany/genetics/FlowerFactory.java +++ b/src/main/java/binnie/botany/genetics/FlowerFactory.java @@ -19,8 +19,8 @@ public class FlowerFactory implements IFlowerFactory { } @Override - public IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies parentFlower0, IAlleleFlowerSpecies parentFlower1, IAllele[] result, int chance) { - FlowerMutation mutation = new FlowerMutation(parentFlower0, parentFlower1, result, chance); + public IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] result, int chance) { + FlowerMutation mutation = new FlowerMutation(allele0, allele1, result, chance); FlowerManager.flowerRoot.registerMutation(mutation); return mutation; } diff --git a/src/main/java/binnie/botany/genetics/FlowerGenome.java b/src/main/java/binnie/botany/genetics/FlowerGenome.java index 5a7a3c32..39893ae7 100644 --- a/src/main/java/binnie/botany/genetics/FlowerGenome.java +++ b/src/main/java/binnie/botany/genetics/FlowerGenome.java @@ -1,20 +1,5 @@ package binnie.botany.genetics; -import javax.annotation.Nullable; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import forestry.api.core.EnumTemperature; -import forestry.api.genetics.EnumTolerance; -import forestry.api.genetics.IAlleleFloat; -import forestry.api.genetics.IAlleleInteger; -import forestry.api.genetics.IAlleleSpecies; -import forestry.api.genetics.IAlleleTolerance; -import forestry.api.genetics.IChromosome; -import forestry.api.genetics.ISpeciesRoot; -import forestry.core.genetics.Genome; - import binnie.Binnie; import binnie.botany.api.EnumAcidity; import binnie.botany.api.EnumFlowerChromosome; @@ -24,6 +9,19 @@ import binnie.botany.api.IAlleleFlowerSpecies; import binnie.botany.api.IFlowerGenome; import binnie.botany.api.IFlowerType; import binnie.botany.core.BotanyCore; +import forestry.api.core.EnumTemperature; +import forestry.api.genetics.EnumTolerance; +import forestry.api.genetics.IAlleleFloat; +import forestry.api.genetics.IAlleleInteger; +import forestry.api.genetics.IAlleleSpecies; +import forestry.api.genetics.IAlleleTolerance; +import forestry.api.genetics.IChromosome; +import forestry.api.genetics.ISpeciesRoot; +import forestry.core.genetics.Genome; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import javax.annotation.Nullable; public class FlowerGenome extends Genome implements IFlowerGenome { public FlowerGenome(final NBTTagCompound nbttagcompound) { @@ -119,24 +117,24 @@ public class FlowerGenome extends Genome implements IFlowerGenome { } @Override - public boolean canTolerate(final EnumAcidity ePH) { - final int pH = ePH.ordinal(); + public boolean canTolerate(final EnumAcidity acidity) { + final int pH = acidity.ordinal(); final int[] pHTol = Binnie.GENETICS.getTolerance(this.getTolerancePH()); final int fPH = this.getPrimary().getPH().ordinal(); return pH >= fPH + pHTol[0] && pH <= fPH + pHTol[1]; } @Override - public boolean canTolerate(final EnumMoisture eMoisture) { - final int moisture = eMoisture.ordinal(); + public boolean canTolerate(final EnumMoisture moist) { + final int moisture = moist.ordinal(); final int[] moistTol = Binnie.GENETICS.getTolerance(this.getToleranceMoisture()); final int fMoisture = this.getPrimary().getMoisture().ordinal(); return moisture >= fMoisture + moistTol[0] && moisture <= fMoisture + moistTol[1]; } @Override - public boolean canTolerate(final EnumTemperature eTemp) { - final int temp = eTemp.ordinal(); + public boolean canTolerate(final EnumTemperature temperature) { + final int temp = temperature.ordinal(); final int[] tempTol = Binnie.GENETICS.getTolerance(this.getToleranceTemperature()); final int fTemp = this.getPrimary().getTemperature().ordinal(); return temp >= fTemp + tempTol[0] && temp <= fTemp + tempTol[1]; diff --git a/src/main/java/binnie/botany/genetics/FlowerMutation.java b/src/main/java/binnie/botany/genetics/FlowerMutation.java index 120dc957..165a82bb 100644 --- a/src/main/java/binnie/botany/genetics/FlowerMutation.java +++ b/src/main/java/binnie/botany/genetics/FlowerMutation.java @@ -16,7 +16,7 @@ import binnie.botany.api.IFlowerRoot; import binnie.botany.core.BotanyCore; public class FlowerMutation extends Mutation implements IFlowerMutation, IFlowerMutationBuilder { - public FlowerMutation(final IAlleleFlowerSpecies allele0, final IAlleleFlowerSpecies allele1, final IAllele[] template, final int chance) { + public FlowerMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] template, int chance) { super(allele0, allele1, template, chance); } @@ -31,8 +31,8 @@ public class FlowerMutation extends Mutation implements IFlowerMutation, IFlower } @Override - public float getChance(World world, BlockPos pos, IAlleleFlowerSpecies a0, IAlleleFlowerSpecies a1, IFlowerGenome g0, IFlowerGenome g1) { - float processedChance = super.getChance(world, pos, a0, a1, g0, g1, ForestryAPI.climateManager.getDefaultClimate(world, pos)); + public float getChance(World world, BlockPos pos, IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IFlowerGenome genome0, IFlowerGenome genome1) { + float processedChance = super.getChance(world, pos, allele0, allele1, genome0, genome1, ForestryAPI.climateManager.getDefaultClimate(world, pos)); if (processedChance <= 0) { return 0; } diff --git a/src/main/java/binnie/botany/genetics/FlowerRoot.java b/src/main/java/binnie/botany/genetics/FlowerRoot.java index 8fc5e2af..0724fdaa 100644 --- a/src/main/java/binnie/botany/genetics/FlowerRoot.java +++ b/src/main/java/binnie/botany/genetics/FlowerRoot.java @@ -1,5 +1,32 @@ package binnie.botany.genetics; +import binnie.botany.Botany; +import binnie.botany.api.EnumFlowerChromosome; +import binnie.botany.api.EnumFlowerStage; +import binnie.botany.api.IAlleleFlowerSpecies; +import binnie.botany.api.IBotanistTracker; +import binnie.botany.api.IColorMix; +import binnie.botany.api.IFlower; +import binnie.botany.api.IFlowerGenome; +import binnie.botany.api.IFlowerMutation; +import binnie.botany.api.IFlowerRoot; +import binnie.botany.flower.TileEntityFlower; +import com.mojang.authlib.GameProfile; +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IAllele; +import forestry.api.genetics.IAlyzerPlugin; +import forestry.api.genetics.IChromosomeType; +import forestry.api.genetics.IIndividual; +import forestry.api.genetics.IMutation; +import forestry.api.genetics.ISpeciesType; +import forestry.core.genetics.SpeciesRoot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -8,42 +35,12 @@ import java.util.HashMap; import java.util.Map; import java.util.Random; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import com.mojang.authlib.GameProfile; - -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.IAllele; -import forestry.api.genetics.IAlyzerPlugin; -import forestry.api.genetics.IChromosomeType; -import forestry.api.genetics.IIndividual; -import forestry.api.genetics.IMutation; -import forestry.api.genetics.ISpeciesType; -import forestry.core.genetics.SpeciesRoot; - -import binnie.botany.Botany; -import binnie.botany.api.EnumFlowerChromosome; -import binnie.botany.api.EnumFlowerStage; -import binnie.botany.api.IAlleleFlowerSpecies; -import binnie.botany.api.IBotanistTracker; -import binnie.botany.api.IColourMix; -import binnie.botany.api.IFlower; -import binnie.botany.api.IFlowerGenome; -import binnie.botany.api.IFlowerMutation; -import binnie.botany.api.IFlowerRoot; -import binnie.botany.flower.TileEntityFlower; - public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { static final String UID = "rootFlowers"; public static int flowerSpeciesCount = -1; public static ArrayList flowerTemplates = new ArrayList<>(); private static ArrayList flowerMutations = new ArrayList<>(); - private static ArrayList colourMixes = new ArrayList<>(); + private static ArrayList colourMixes = new ArrayList<>(); Map conversions; public FlowerRoot() { @@ -152,7 +149,7 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { @Override public IFlowerGenome templateAsGenome(final IAllele[] templateActive, final IAllele[] templateInactive) { - return new FlowerGenome(this.templateAsChromosomes(templateActive, templateInactive)); + return new FlowerGenome(templateAsChromosomes(templateActive, templateInactive)); } @Override @@ -269,12 +266,12 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { } @Override - public void registerColourMix(final IColourMix colourMix) { - FlowerRoot.colourMixes.add(colourMix); + public void registerColourMix(final IColorMix colorMix) { + FlowerRoot.colourMixes.add(colorMix); } @Override - public Collection getColourMixes(final boolean shuffle) { + public Collection getColorMixes(final boolean shuffle) { if (shuffle) { Collections.shuffle(FlowerRoot.colourMixes); } diff --git a/src/main/java/binnie/core/craftgui/Attribute.java b/src/main/java/binnie/core/craftgui/Attribute.java index 0ca159af..3b1bb0fc 100644 --- a/src/main/java/binnie/core/craftgui/Attribute.java +++ b/src/main/java/binnie/core/craftgui/Attribute.java @@ -5,5 +5,5 @@ public enum Attribute implements IWidgetAttribute { CanFocus, NeedsDeletion, AlwaysOnTop, - BlockTooltip; + BlockTooltip } diff --git a/src/main/java/binnie/core/craftgui/RenderStage.java b/src/main/java/binnie/core/craftgui/RenderStage.java index 92eee4df..66432c25 100644 --- a/src/main/java/binnie/core/craftgui/RenderStage.java +++ b/src/main/java/binnie/core/craftgui/RenderStage.java @@ -3,5 +3,5 @@ package binnie.core.craftgui; public enum RenderStage { PreChildren, PostChildren, - PostSiblings; + PostSiblings } diff --git a/src/main/java/binnie/core/craftgui/Tooltip.java b/src/main/java/binnie/core/craftgui/Tooltip.java index 0e08d67a..d49b9ab9 100644 --- a/src/main/java/binnie/core/craftgui/Tooltip.java +++ b/src/main/java/binnie/core/craftgui/Tooltip.java @@ -91,7 +91,7 @@ public class Tooltip { Help, Information, User, - Power; + Power } public interface ITooltipType { diff --git a/src/main/java/binnie/core/craftgui/database/ControlMutationBox.java b/src/main/java/binnie/core/craftgui/database/ControlMutationBox.java index bb9be862..0c529892 100644 --- a/src/main/java/binnie/core/craftgui/database/ControlMutationBox.java +++ b/src/main/java/binnie/core/craftgui/database/ControlMutationBox.java @@ -55,6 +55,6 @@ class ControlMutationBox extends ControlListBox { enum Type { Resultant, - Further; + Further } } diff --git a/src/main/java/binnie/core/craftgui/database/EnumDiscoveryState.java b/src/main/java/binnie/core/craftgui/database/EnumDiscoveryState.java index fafae0c3..68d038d4 100644 --- a/src/main/java/binnie/core/craftgui/database/EnumDiscoveryState.java +++ b/src/main/java/binnie/core/craftgui/database/EnumDiscoveryState.java @@ -4,5 +4,5 @@ public enum EnumDiscoveryState { Show, Undetermined, Discovered, - Undiscovered; + Undiscovered } diff --git a/src/main/java/binnie/core/craftgui/minecraft/MinecraftGUI.java b/src/main/java/binnie/core/craftgui/minecraft/MinecraftGUI.java index 64363013..d33ffeb8 100644 --- a/src/main/java/binnie/core/craftgui/minecraft/MinecraftGUI.java +++ b/src/main/java/binnie/core/craftgui/minecraft/MinecraftGUI.java @@ -9,6 +9,6 @@ public class MinecraftGUI { Tinted, Coloured, Outline, - TabOutline; + TabOutline } } diff --git a/src/main/java/binnie/core/craftgui/minecraft/MinecraftTooltip.java b/src/main/java/binnie/core/craftgui/minecraft/MinecraftTooltip.java index e94721a3..76402ddf 100644 --- a/src/main/java/binnie/core/craftgui/minecraft/MinecraftTooltip.java +++ b/src/main/java/binnie/core/craftgui/minecraft/MinecraftTooltip.java @@ -19,7 +19,7 @@ public class MinecraftTooltip extends Tooltip { public enum Type implements ITooltipType { Error, - Warning; + Warning } private enum TypeColour { diff --git a/src/main/java/binnie/core/craftgui/renderer/TextureType.java b/src/main/java/binnie/core/craftgui/renderer/TextureType.java index ed4cd5d7..a26a1998 100644 --- a/src/main/java/binnie/core/craftgui/renderer/TextureType.java +++ b/src/main/java/binnie/core/craftgui/renderer/TextureType.java @@ -2,5 +2,5 @@ package binnie.core.craftgui.renderer; public enum TextureType { Stretched, - Tiled; + Tiled } diff --git a/src/main/java/binnie/extrabees/genetics/effect/FireworkCreator.java b/src/main/java/binnie/extrabees/genetics/effect/FireworkCreator.java index be58080a..65de16c3 100644 --- a/src/main/java/binnie/extrabees/genetics/effect/FireworkCreator.java +++ b/src/main/java/binnie/extrabees/genetics/effect/FireworkCreator.java @@ -14,7 +14,7 @@ public class FireworkCreator { LargeBall, Star, Creeper, - Burst; + Burst } public static class Firework { diff --git a/src/main/java/binnie/extrabees/utils/EnumBeeBooleanModifier.java b/src/main/java/binnie/extrabees/utils/EnumBeeBooleanModifier.java index 62e4833e..479482fa 100644 --- a/src/main/java/binnie/extrabees/utils/EnumBeeBooleanModifier.java +++ b/src/main/java/binnie/extrabees/utils/EnumBeeBooleanModifier.java @@ -5,6 +5,6 @@ public enum EnumBeeBooleanModifier { Sealed, SelfLighted, SunlightStimulated, - Hellish; + Hellish } diff --git a/src/main/java/binnie/extrabees/worldgen/WorldGenHiveRock.java b/src/main/java/binnie/extrabees/worldgen/WorldGenHiveRock.java index ab6341d7..1ec04b1d 100644 --- a/src/main/java/binnie/extrabees/worldgen/WorldGenHiveRock.java +++ b/src/main/java/binnie/extrabees/worldgen/WorldGenHiveRock.java @@ -7,7 +7,6 @@ import net.minecraft.block.state.pattern.BlockStateMatcher; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenerator; import binnie.extrabees.ExtraBees; import binnie.extrabees.blocks.BlockExtraBeeHive; diff --git a/src/main/java/binnie/extrabees/worldgen/WorldGenHiveWater.java b/src/main/java/binnie/extrabees/worldgen/WorldGenHiveWater.java index e228131b..927e8009 100644 --- a/src/main/java/binnie/extrabees/worldgen/WorldGenHiveWater.java +++ b/src/main/java/binnie/extrabees/worldgen/WorldGenHiveWater.java @@ -6,7 +6,6 @@ import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenerator; import binnie.extrabees.ExtraBees; import binnie.extrabees.blocks.BlockExtraBeeHive; diff --git a/src/main/java/binnie/extratrees/carpentry/BlockStainedDesign.java b/src/main/java/binnie/extratrees/carpentry/BlockStainedDesign.java index 7c8889e2..7943781b 100644 --- a/src/main/java/binnie/extratrees/carpentry/BlockStainedDesign.java +++ b/src/main/java/binnie/extratrees/carpentry/BlockStainedDesign.java @@ -47,7 +47,7 @@ public class BlockStainedDesign extends BlockDesign { player.addExhaustion(0.005F); if (EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0 && te instanceof TileEntityMetadata) { - java.util.List items = new java.util.ArrayList(); + java.util.List items = new java.util.ArrayList<>(); TileEntityMetadata tile = (TileEntityMetadata) te; int damage = getDroppedMeta(state, tile.getTileMetadata()); ItemStack itemstack = TileEntityMetadata.getItemStack(this, damage); diff --git a/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java b/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java index b5f2736b..5c5723ca 100644 --- a/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java +++ b/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java @@ -102,6 +102,6 @@ public class ModuleCarpentry implements IInitializable { enum Axis { Y, X, - Z; + Z } } diff --git a/src/main/java/binnie/extratrees/genetics/ETTreeDefinition.java b/src/main/java/binnie/extratrees/genetics/ETTreeDefinition.java index 5acac37f..860f0cea 100644 --- a/src/main/java/binnie/extratrees/genetics/ETTreeDefinition.java +++ b/src/main/java/binnie/extratrees/genetics/ETTreeDefinition.java @@ -286,7 +286,6 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT template.set(EnumTreeChromosome.YIELD, ForestryAllele.Yield.Lower.getAllele()); template.set(EnumTreeChromosome.SAPPINESS, ForestryAllele.Sappiness.Lower.getAllele()); template.set(EnumTreeChromosome.MATURATION, ForestryAllele.Maturation.Fast.getAllele()); - ; } @Override @@ -332,7 +331,6 @@ public enum ETTreeDefinition implements IStringSerializable, ITreeDefinition, IT template.set(EnumTreeChromosome.FRUITS, AlleleETFruit.SourCherry); template.set(EnumTreeChromosome.YIELD, ForestryAllele.Yield.Lower.getAllele()); template.set(EnumTreeChromosome.SAPPINESS, ForestryAllele.Sappiness.Low.getAllele()); - ; } @Override diff --git a/src/main/java/binnie/extratrees/integration/jei/multifence/MultiFenceRecipeSolidWrapper.java b/src/main/java/binnie/extratrees/integration/jei/multifence/MultiFenceRecipeSolidWrapper.java index 24c46fbc..9192e6ca 100644 --- a/src/main/java/binnie/extratrees/integration/jei/multifence/MultiFenceRecipeSolidWrapper.java +++ b/src/main/java/binnie/extratrees/integration/jei/multifence/MultiFenceRecipeSolidWrapper.java @@ -54,7 +54,6 @@ public class MultiFenceRecipeSolidWrapper extends BlankRecipeWrapper implements for (IPlankType plankTypeSecondary : WoodManager.getAllPlankTypes()) { for (IPlankType plankType : WoodManager.getAllPlankTypes()) { if (plankType != plankTypeSecondary) { - ; fences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, false, fenceType.embossed), 1)); outputFences.add(WoodManager.getFence(plankType, plankTypeSecondary, new FenceType(fenceType.size, true, fenceType.embossed), 2)); } diff --git a/src/main/java/binnie/extratrees/item/ItemSetSquare.java b/src/main/java/binnie/extratrees/item/ItemSetSquare.java index ff932675..2f2b7146 100644 --- a/src/main/java/binnie/extratrees/item/ItemSetSquare.java +++ b/src/main/java/binnie/extratrees/item/ItemSetSquare.java @@ -47,6 +47,6 @@ public class ItemSetSquare extends Item implements IToolHammer, IItemModelRegist public enum EnumSetSquareMode { Rotate, Edit, - Swap; + Swap } } diff --git a/src/main/java/binnie/extratrees/kitchen/MachineRendererKitchen.java b/src/main/java/binnie/extratrees/kitchen/MachineRendererKitchen.java index 267d086a..8aba5a99 100644 --- a/src/main/java/binnie/extratrees/kitchen/MachineRendererKitchen.java +++ b/src/main/java/binnie/extratrees/kitchen/MachineRendererKitchen.java @@ -10,7 +10,6 @@ import binnie.core.resource.BinnieResource; public class MachineRendererKitchen { public static MachineRendererKitchen instance = new MachineRendererKitchen(); static int level = 0; - ; BinnieResource texture; public void renderMachine(final Machine machine, final BinnieResource texture, final double x, final double y, final double z, final float var8) { diff --git a/src/main/java/binnie/extratrees/machines/MachineRendererNursery.java b/src/main/java/binnie/extratrees/machines/MachineRendererNursery.java index baec4968..2d3d4cd7 100644 --- a/src/main/java/binnie/extratrees/machines/MachineRendererNursery.java +++ b/src/main/java/binnie/extratrees/machines/MachineRendererNursery.java @@ -12,7 +12,6 @@ import binnie.extratrees.ExtraTrees; public class MachineRendererNursery { public static MachineRendererNursery instance = new MachineRendererNursery(); - ; BinnieResource texture; //private IModelCustom casinoMachine; private ModelNursery model; diff --git a/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java b/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java index 60780ed6..3b413549 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java +++ b/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java @@ -56,7 +56,7 @@ public class ControlProductsBox extends ControlListBox Date: Sat, 15 Jul 2017 22:27:20 +0300 Subject: [PATCH 05/13] Feature/refactoring (#211) * Some code improve readability for botany.ceramic package * Code improvement for botany.core package * Code improvement for botany.craftgui package * Fixed TextJustification from all code files * Code improvement for botany.farm package * Code improvement for botany.flower * Code improvement for root botany package Code improvement for botany.network package Code improvement for botany.proxypackage * Code improvement for botany.gargdening package Added missed localization for Soil Meter * Code improvement for botany.genetic package * Code improvement for botany.items package * Removed "// TODO fix deprecated" comment * Reformatted code by Forestry format settings * Reformat code with new format settings --- src/main/java/binnie/botany/Botany.java | 63 +-- .../java/binnie/botany/CreativeTabBotany.java | 2 +- .../java/binnie/botany/api/EnumAcidity.java | 7 +- .../botany/api/EnumFlowerChromosome.java | 8 +- .../binnie/botany/api/EnumFlowerStage.java | 6 +- .../java/binnie/botany/api/EnumMoisture.java | 5 +- .../java/binnie/botany/api/EnumSoilType.java | 7 +- .../botany/api/IAlleleFlowerEffect.java | 3 +- .../botany/api/IAlleleFlowerSpecies.java | 10 +- .../java/binnie/botany/api/IColorMix.java | 8 +- src/main/java/binnie/botany/api/IFlower.java | 5 +- .../{IFlowerColour.java => IFlowerColor.java} | 2 +- .../binnie/botany/api/IFlowerDefinition.java | 3 +- .../java/binnie/botany/api/IFlowerGenome.java | 6 +- .../binnie/botany/api/IFlowerMutation.java | 3 +- .../java/binnie/botany/api/IFlowerRoot.java | 16 +- .../java/binnie/botany/api/IFlowerType.java | 4 +- .../binnie/botany/api/IGardeningManager.java | 7 +- .../java/binnie/botany/api/package-info.java | 4 +- .../binnie/botany/ceramic/BlockCeramic.java | 12 +- .../botany/ceramic/BlockCeramicPatterned.java | 12 +- .../botany/ceramic/BlockStainedGlass.java | 31 +- .../binnie/botany/ceramic/CeramicColor.java | 12 +- .../botany/ceramic/CeramicDesignSystem.java | 24 +- .../botany/ceramic/CeramicTileRecipe.java | 26 +- .../binnie/botany/ceramic/ItemCeramic.java | 2 +- .../binnie/botany/ceramic/PigmentRecipe.java | 8 +- .../ceramic/brick/BlockCeramicBrick.java | 38 +- .../ceramic/brick/CeramicBrickPair.java | 33 +- .../ceramic/brick/CeramicBrickType.java | 160 +++--- .../ceramic/brick/ItemCeramicBrick.java | 2 +- .../ceramic/brick/TileCeramicBrick.java | 9 +- .../java/binnie/botany/core/BotanyCore.java | 4 +- .../java/binnie/botany/core/BotanyGUI.java | 14 +- .../binnie/botany/core/BotanyTexture.java | 7 +- .../java/binnie/botany/core/ModuleCore.java | 3 + .../botany/craftgui/ControlColorDisplay.java | 24 +- .../botany/craftgui/ControlColorMixBox.java | 10 +- .../botany/craftgui/ControlColorMixItem.java | 14 +- .../craftgui/ControlColorMixSymbol.java | 16 +- .../botany/craftgui/ControlColorOption.java | 30 +- .../binnie/botany/craftgui/PageColorMix.java | 18 +- .../craftgui/PageColorMixResultant.java | 18 +- .../craftgui/PageSpeciesFlowerGenome.java | 51 +- .../craftgui/WindowBotanistDatabase.java | 45 +- .../binnie/botany/farm/CircuitGarden.java | 13 +- .../java/binnie/botany/farm/FarmLogic.java | 6 +- .../binnie/botany/farm/FarmableFlower.java | 14 +- .../botany/farm/FarmableVanillaFlower.java | 4 +- .../java/binnie/botany/farm/GardenLogic.java | 260 +++++----- .../binnie/botany/flower/BlockFlower.java | 107 ++-- .../botany/flower/EnumTubeInsulate.java | 45 +- .../botany/flower/EnumTubeMaterial.java | 16 +- .../botany/flower/FlowerSpriteManager.java | 26 +- .../java/binnie/botany/flower/ItemBotany.java | 95 ++-- .../botany/flower/ItemInsulatedTube.java | 6 +- .../botany/flower/StateMapperFlower.java | 4 +- .../botany/flower/TileEntityFlower.java | 457 ++++++++++-------- .../binnie/botany/gardening/BlockPlant.java | 113 ++--- .../binnie/botany/gardening/BlockSoil.java | 81 ++-- .../binnie/botany/gardening/Gardening.java | 163 ++++--- .../binnie/botany/gardening/ItemSoil.java | 16 +- .../botany/gardening/ItemSoilMeter.java | 26 +- .../binnie/botany/gardening/ItemTrowel.java | 19 +- .../binnie/botany/gardening/ItemWeed.java | 8 +- .../botany/gardening/ModuleGardening.java | 243 +++++++--- .../binnie/botany/gardening/PlantType.java | 43 ++ .../botany/genetics/AlleleEffectNone.java | 6 +- .../botany/genetics/AlleleFlowerSpecies.java | 16 +- .../botany/genetics/BotanistTracker.java | 6 +- .../java/binnie/botany/genetics/ColorMix.java | 44 ++ .../binnie/botany/genetics/ColourMix.java | 43 -- .../botany/genetics/EnumFlowerColor.java | 20 +- .../botany/genetics/EnumFlowerType.java | 11 +- .../java/binnie/botany/genetics/Flower.java | 164 ++++--- .../botany/genetics/FlowerAlyzerPlugin.java | 34 +- .../botany/genetics/FlowerBreedingSystem.java | 54 +-- .../botany/genetics/FlowerColorAllele.java | 6 +- .../botany/genetics/FlowerDefinition.java | 38 +- .../binnie/botany/genetics/FlowerGenome.java | 83 ++-- .../botany/genetics/FlowerMutation.java | 2 +- .../binnie/botany/genetics/FlowerRoot.java | 153 +++--- .../botany/genetics/FlowerTemplates.java | 2 +- .../botany/genetics/ItemDictionary.java | 14 +- .../botany/genetics/ModuleGenetics.java | 56 ++- .../java/binnie/botany/items/BotanyItems.java | 24 +- .../java/binnie/botany/items/ItemClay.java | 14 +- .../java/binnie/botany/items/ItemPigment.java | 12 +- .../botany/network/PacketFlowerUpdate.java | 37 +- .../java/binnie/botany/network/PacketID.java | 6 +- .../binnie/core/craftgui/WindowFieldKit.java | 2 +- .../craftgui/controls/ControlCheckbox.java | 2 +- .../controls/button/ControlButton.java | 2 +- .../controls/listbox/ControlTextOption.java | 2 +- .../database/PageSpeciesOverview.java | 4 +- .../core/craftgui/geometry/CraftGUIUtil.java | 4 +- .../craftgui/geometry/TextJustification.java | 18 +- .../minecraft/control/ControlSlide.java | 2 +- .../machines/craftgui/PageFruit.java | 2 +- .../machines/craftgui/PagePlanksOverview.java | 8 +- .../machines/craftgui/PagePlanksTrees.java | 2 +- .../craftgui/PageSpeciesTreeGenome.java | 38 +- .../machines/craftgui/PageWood.java | 2 +- .../genetics/gui/AnalystPageDatabase.java | 2 +- .../genetics/gui/AnalystPageDescription.java | 2 +- .../genetics/gui/AnalystPageMutations.java | 2 +- .../genetics/gui/ControlGenesisOption.java | 4 +- .../genetics/gui/flower/AnalystPageSoil.java | 8 +- .../genetics/gui/tree/AnalystPageClimate.java | 6 +- .../machine/inoculator/WindowInoculator.java | 2 +- .../sequencer/ControlSequencerProgress.java | 2 +- .../machine/sequencer/WindowSequencer.java | 4 +- .../machine/splicer/WindowSplicer.java | 2 +- .../resources/assets/botany/lang/en_US.lang | 1 + 114 files changed, 1901 insertions(+), 1624 deletions(-) rename src/main/java/binnie/botany/api/{IFlowerColour.java => IFlowerColor.java} (84%) create mode 100644 src/main/java/binnie/botany/gardening/PlantType.java create mode 100644 src/main/java/binnie/botany/genetics/ColorMix.java delete mode 100644 src/main/java/binnie/botany/genetics/ColourMix.java diff --git a/src/main/java/binnie/botany/Botany.java b/src/main/java/binnie/botany/Botany.java index 7a6ff1b9..1783ac12 100644 --- a/src/main/java/binnie/botany/Botany.java +++ b/src/main/java/binnie/botany/Botany.java @@ -102,25 +102,25 @@ public class Botany extends AbstractMod { public static Item botanistBackpack; @Mod.EventHandler - public void preInit(final FMLPreInitializationEvent evt) { - this.preInit(); + public void preInit(FMLPreInitializationEvent evt) { + preInit(); } @Mod.EventHandler - public void init(final FMLInitializationEvent evt) { - this.init(); + public void init(FMLInitializationEvent evt) { + init(); } @Mod.EventHandler - public void postInit(final FMLPostInitializationEvent evt) { - this.postInit(); + public void postInit(FMLPostInitializationEvent evt) { + postInit(); } @Override protected void registerModules() { - this.addModule(new ModuleCore()); - this.addModule(new ModuleGenetics()); - this.addModule(new ModuleGardening()); + addModule(new ModuleCore()); + addModule(new ModuleGenetics()); + addModule(new ModuleGardening()); } @Override @@ -164,7 +164,7 @@ public class Botany extends AbstractMod { } @SubscribeEvent - public void onShearFlower(final PlayerInteractEvent.RightClickBlock event) { + public void onShearFlower(PlayerInteractEvent.RightClickBlock event) { EntityPlayer player = event.getEntityPlayer(); if (player == null) { return; @@ -196,7 +196,7 @@ public class Botany extends AbstractMod { } @SubscribeEvent - public void onFertiliseSoil(final PlayerInteractEvent.RightClickBlock event) { + public void onFertiliseSoil(PlayerInteractEvent.RightClickBlock event) { World world = event.getWorld(); if (world == null) { return; @@ -212,7 +212,7 @@ public class Botany extends AbstractMod { if (heldItem.isEmpty()) { return; } - + IGardeningManager gardening = BotanyCore.getGardening(); Block block = world.getBlockState(event.getPos()).getBlock(); if (!gardening.isSoil(block)) { @@ -259,14 +259,14 @@ public class Botany extends AbstractMod { } @SubscribeEvent - public void plantVanilla(final BlockEvent.PlaceEvent event) { + public void plantVanilla(BlockEvent.PlaceEvent event) { World world = event.getWorld(); BlockPos pos = event.getPos(); Block block = world.getBlockState(pos.down()).getBlock(); - if (!BotanyCore.getGardening().isSoil(block)) { return; } + EntityPlayer player = event.getPlayer(); ItemStack heldItem = player.getHeldItem(event.getHand()); IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot(); @@ -277,7 +277,7 @@ public class Botany extends AbstractMod { } @Deprecated - public void onPlantVanilla(final PlayerInteractEvent.RightClickBlock event) { + public void onPlantVanilla(PlayerInteractEvent.RightClickBlock event) { BlockPos pos = event.getPos(); World world = event.getWorld(); EntityPlayer player = event.getEntityPlayer(); @@ -286,24 +286,28 @@ public class Botany extends AbstractMod { return; } - if (!heldItem.isEmpty()) { - Block block = world.getBlockState(pos).getBlock(); - int py = -1; - if (block instanceof IBlockSoil && (world.isAirBlock(pos.up()) || block.isReplaceable(world, pos))) { - py = 1; - } - if (py >= 0) { - IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot(); - IFlower flower = flowerRoot.getConversion(heldItem); - if (flower != null && flowerRoot.plant(world, pos.add(0, py, 0), flower, player.getGameProfile()) && !player.capabilities.isCreativeMode) { - heldItem.shrink(1); - } - } + if (heldItem.isEmpty()) { + return; + } + + Block block = world.getBlockState(pos).getBlock(); + int py = -1; + if (block instanceof IBlockSoil && (world.isAirBlock(pos.up()) || block.isReplaceable(world, pos))) { + py = 1; + } + if (py < 0) { + return; + } + + IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot(); + IFlower flower = flowerRoot.getConversion(heldItem); + if (flower != null && flowerRoot.plant(world, pos.add(0, py, 0), flower, player.getGameProfile()) && !player.capabilities.isCreativeMode) { + heldItem.shrink(1); } } @SubscribeEvent - public void onBonemeal(final BonemealEvent event) { + public void onBonemeal(BonemealEvent event) { BlockPos pos = event.getPos(); Block block = event.getBlock().getBlock(); if (BotanyCore.getGardening().isSoil(block)) { @@ -312,6 +316,7 @@ public class Botany extends AbstractMod { event.setResult(Event.Result.ALLOW); } } + TileEntity tile = event.getWorld().getTileEntity(pos); if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) { event.setResult(Event.Result.ALLOW); diff --git a/src/main/java/binnie/botany/CreativeTabBotany.java b/src/main/java/binnie/botany/CreativeTabBotany.java index 37cca468..4a9cded2 100644 --- a/src/main/java/binnie/botany/CreativeTabBotany.java +++ b/src/main/java/binnie/botany/CreativeTabBotany.java @@ -24,7 +24,7 @@ public class CreativeTabBotany extends CreativeTabs { @Override @SideOnly(Side.CLIENT) public String getTranslatedTabLabel() { - return this.getTabLabel(); + return getTabLabel(); } @Override diff --git a/src/main/java/binnie/botany/api/EnumAcidity.java b/src/main/java/binnie/botany/api/EnumAcidity.java index c8bf2e10..b54535d8 100644 --- a/src/main/java/binnie/botany/api/EnumAcidity.java +++ b/src/main/java/binnie/botany/api/EnumAcidity.java @@ -1,10 +1,11 @@ package binnie.botany.api; -import binnie.core.util.I18N; +import javax.annotation.Nullable; + import net.minecraft.util.IStringSerializable; import net.minecraft.util.text.TextFormatting; -import javax.annotation.Nullable; +import binnie.core.util.I18N; public enum EnumAcidity implements IStringSerializable { ACID(TextFormatting.RED), @@ -20,7 +21,7 @@ public enum EnumAcidity implements IStringSerializable { @Override public String getName() { - return this.name().toLowerCase(); + return name().toLowerCase(); } public String getLocalisedName(boolean withColor) { diff --git a/src/main/java/binnie/botany/api/EnumFlowerChromosome.java b/src/main/java/binnie/botany/api/EnumFlowerChromosome.java index 052bf478..96eb1960 100644 --- a/src/main/java/binnie/botany/api/EnumFlowerChromosome.java +++ b/src/main/java/binnie/botany/api/EnumFlowerChromosome.java @@ -1,5 +1,7 @@ package binnie.botany.api; +import java.util.Locale; + import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IAllele; import forestry.api.genetics.IAlleleArea; @@ -9,8 +11,6 @@ import forestry.api.genetics.IAlleleTolerance; import forestry.api.genetics.IChromosomeType; import forestry.api.genetics.ISpeciesRoot; -import java.util.Locale; - public enum EnumFlowerChromosome implements IChromosomeType { SPECIES(IAlleleFlowerSpecies.class), PRIMARY(IAlleleInteger.class), @@ -33,12 +33,12 @@ public enum EnumFlowerChromosome implements IChromosomeType { @Override public Class getAlleleClass() { - return this.cls; + return cls; } @Override public String getName() { - return this.toString().toLowerCase(Locale.ENGLISH); + return toString().toLowerCase(Locale.ENGLISH); } @Override diff --git a/src/main/java/binnie/botany/api/EnumFlowerStage.java b/src/main/java/binnie/botany/api/EnumFlowerStage.java index 15be3988..6e0e0edd 100644 --- a/src/main/java/binnie/botany/api/EnumFlowerStage.java +++ b/src/main/java/binnie/botany/api/EnumFlowerStage.java @@ -20,12 +20,12 @@ public enum EnumFlowerStage implements ISpeciesType { public static EnumFlowerStage getStage(int age) { return age == 0 - ? EnumFlowerStage.SEED - : EnumFlowerStage.FLOWER; + ? EnumFlowerStage.SEED + : EnumFlowerStage.FLOWER; } public String getName() { - return this.name; + return name; } } diff --git a/src/main/java/binnie/botany/api/EnumMoisture.java b/src/main/java/binnie/botany/api/EnumMoisture.java index b5cb471b..8faded8b 100644 --- a/src/main/java/binnie/botany/api/EnumMoisture.java +++ b/src/main/java/binnie/botany/api/EnumMoisture.java @@ -1,10 +1,11 @@ package binnie.botany.api; -import binnie.core.util.I18N; +import javax.annotation.Nullable; + import net.minecraft.util.IStringSerializable; import net.minecraft.util.text.TextFormatting; -import javax.annotation.Nullable; +import binnie.core.util.I18N; public enum EnumMoisture implements IStringSerializable { DRY(TextFormatting.YELLOW), diff --git a/src/main/java/binnie/botany/api/EnumSoilType.java b/src/main/java/binnie/botany/api/EnumSoilType.java index 4077da7e..b687427d 100644 --- a/src/main/java/binnie/botany/api/EnumSoilType.java +++ b/src/main/java/binnie/botany/api/EnumSoilType.java @@ -1,10 +1,11 @@ package binnie.botany.api; -import binnie.core.util.I18N; +import java.util.Locale; + import net.minecraft.util.IStringSerializable; import net.minecraft.util.text.TextFormatting; -import java.util.Locale; +import binnie.core.util.I18N; public enum EnumSoilType implements IStringSerializable { SOIL(TextFormatting.DARK_GRAY), @@ -19,7 +20,7 @@ public enum EnumSoilType implements IStringSerializable { @Override public String getName() { - return this.name().toLowerCase(Locale.ENGLISH); + return name().toLowerCase(Locale.ENGLISH); } public String getTranslated() { diff --git a/src/main/java/binnie/botany/api/IAlleleFlowerEffect.java b/src/main/java/binnie/botany/api/IAlleleFlowerEffect.java index ac6cd8c5..45c81950 100644 --- a/src/main/java/binnie/botany/api/IAlleleFlowerEffect.java +++ b/src/main/java/binnie/botany/api/IAlleleFlowerEffect.java @@ -1,8 +1,9 @@ package binnie.botany.api; +import net.minecraft.world.World; + import forestry.api.genetics.IAlleleEffect; import forestry.api.genetics.IEffectData; -import net.minecraft.world.World; public interface IAlleleFlowerEffect extends IAlleleEffect { IEffectData doEffect(IFlowerGenome genome, IEffectData effect, World world, int x, int y, int z); diff --git a/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java b/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java index 5cc30f58..a2ca4e48 100644 --- a/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java +++ b/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java @@ -1,12 +1,14 @@ package binnie.botany.api; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.item.Item; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + import forestry.api.core.IModelManager; import forestry.api.genetics.IAlleleProperty; import forestry.api.genetics.IAlleleSpecies; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.item.Item; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; public interface IAlleleFlowerSpecies extends IAlleleSpecies, IAlleleProperty { IFlowerType getType(); diff --git a/src/main/java/binnie/botany/api/IColorMix.java b/src/main/java/binnie/botany/api/IColorMix.java index ca9bbe0e..dd740274 100644 --- a/src/main/java/binnie/botany/api/IColorMix.java +++ b/src/main/java/binnie/botany/api/IColorMix.java @@ -1,13 +1,13 @@ package binnie.botany.api; public interface IColorMix { - IFlowerColour getColorFirst(); + IFlowerColor getColorFirst(); - IFlowerColour getColorSecond(); + IFlowerColor getColorSecond(); - boolean isMutation(IFlowerColour colorFirst, IFlowerColour colorSecond); + boolean isMutation(IFlowerColor colorFirst, IFlowerColor colorSecond); int getChance(); - IFlowerColour getResult(); + IFlowerColor getResult(); } diff --git a/src/main/java/binnie/botany/api/IFlower.java b/src/main/java/binnie/botany/api/IFlower.java index 2ce27dce..90a7f352 100644 --- a/src/main/java/binnie/botany/api/IFlower.java +++ b/src/main/java/binnie/botany/api/IFlower.java @@ -1,10 +1,11 @@ package binnie.botany.api; -import forestry.api.genetics.IIndividual; +import javax.annotation.Nullable; + import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nullable; +import forestry.api.genetics.IIndividual; public interface IFlower extends IIndividual { @Override diff --git a/src/main/java/binnie/botany/api/IFlowerColour.java b/src/main/java/binnie/botany/api/IFlowerColor.java similarity index 84% rename from src/main/java/binnie/botany/api/IFlowerColour.java rename to src/main/java/binnie/botany/api/IFlowerColor.java index 61fecf37..c48f22e5 100644 --- a/src/main/java/binnie/botany/api/IFlowerColour.java +++ b/src/main/java/binnie/botany/api/IFlowerColor.java @@ -2,7 +2,7 @@ package binnie.botany.api; import forestry.api.genetics.IAlleleInteger; -public interface IFlowerColour { +public interface IFlowerColor { int getColor(boolean dis); IAlleleInteger getAllele(); diff --git a/src/main/java/binnie/botany/api/IFlowerDefinition.java b/src/main/java/binnie/botany/api/IFlowerDefinition.java index 87632611..4b9cdab4 100644 --- a/src/main/java/binnie/botany/api/IFlowerDefinition.java +++ b/src/main/java/binnie/botany/api/IFlowerDefinition.java @@ -1,8 +1,9 @@ package binnie.botany.api; -import forestry.core.genetics.IGeneticDefinition; import net.minecraft.item.ItemStack; +import forestry.core.genetics.IGeneticDefinition; + public interface IFlowerDefinition extends IGeneticDefinition { @Override IFlowerGenome getGenome(); diff --git a/src/main/java/binnie/botany/api/IFlowerGenome.java b/src/main/java/binnie/botany/api/IFlowerGenome.java index 7add46b5..a2d38c35 100644 --- a/src/main/java/binnie/botany/api/IFlowerGenome.java +++ b/src/main/java/binnie/botany/api/IFlowerGenome.java @@ -11,11 +11,11 @@ public interface IFlowerGenome extends IGenome { @Override IAlleleFlowerSpecies getSecondary(); - IFlowerColour getPrimaryColor(); + IFlowerColor getPrimaryColor(); - IFlowerColour getSecondaryColor(); + IFlowerColor getSecondaryColor(); - IFlowerColour getStemColor(); + IFlowerColor getStemColor(); int getFertility(); diff --git a/src/main/java/binnie/botany/api/IFlowerMutation.java b/src/main/java/binnie/botany/api/IFlowerMutation.java index 9ad60ed4..ba811675 100644 --- a/src/main/java/binnie/botany/api/IFlowerMutation.java +++ b/src/main/java/binnie/botany/api/IFlowerMutation.java @@ -1,9 +1,10 @@ package binnie.botany.api; -import forestry.api.genetics.IMutation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import forestry.api.genetics.IMutation; + public interface IFlowerMutation extends IMutation { @Override IFlowerRoot getRoot(); diff --git a/src/main/java/binnie/botany/api/IFlowerRoot.java b/src/main/java/binnie/botany/api/IFlowerRoot.java index af2a215f..bd127247 100644 --- a/src/main/java/binnie/botany/api/IFlowerRoot.java +++ b/src/main/java/binnie/botany/api/IFlowerRoot.java @@ -1,16 +1,18 @@ package binnie.botany.api; -import com.mojang.authlib.GameProfile; -import forestry.api.genetics.IAllele; -import forestry.api.genetics.ISpeciesRoot; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - import javax.annotation.Nullable; import java.util.Collection; import java.util.List; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import com.mojang.authlib.GameProfile; + +import forestry.api.genetics.IAllele; +import forestry.api.genetics.ISpeciesRoot; + public interface IFlowerRoot extends ISpeciesRoot { @Override @Nullable diff --git a/src/main/java/binnie/botany/api/IFlowerType.java b/src/main/java/binnie/botany/api/IFlowerType.java index 644bc31b..fb53071b 100644 --- a/src/main/java/binnie/botany/api/IFlowerType.java +++ b/src/main/java/binnie/botany/api/IFlowerType.java @@ -1,11 +1,13 @@ package binnie.botany.api; -import forestry.api.core.IModelManager; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import forestry.api.core.IModelManager; + public interface IFlowerType> extends Comparable { @SideOnly(Side.CLIENT) void registerModels(Item item, IModelManager manager, EnumFlowerStage type); diff --git a/src/main/java/binnie/botany/api/IGardeningManager.java b/src/main/java/binnie/botany/api/IGardeningManager.java index 44f3e5da..5742c470 100644 --- a/src/main/java/binnie/botany/api/IGardeningManager.java +++ b/src/main/java/binnie/botany/api/IGardeningManager.java @@ -1,14 +1,15 @@ package binnie.botany.api; -import forestry.api.core.EnumTemperature; +import javax.annotation.Nullable; +import java.util.Collection; + import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nullable; -import java.util.Collection; +import forestry.api.core.EnumTemperature; public interface IGardeningManager { default boolean isSoil(Block block) { diff --git a/src/main/java/binnie/botany/api/package-info.java b/src/main/java/binnie/botany/api/package-info.java index d93958b7..25288c28 100644 --- a/src/main/java/binnie/botany/api/package-info.java +++ b/src/main/java/binnie/botany/api/package-info.java @@ -2,6 +2,6 @@ @MethodsReturnNonnullByDefault package binnie.botany.api; -import mcp.MethodsReturnNonnullByDefault; +import javax.annotation.ParametersAreNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file +import mcp.MethodsReturnNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/binnie/botany/ceramic/BlockCeramic.java b/src/main/java/binnie/botany/ceramic/BlockCeramic.java index b11ba105..8ad9ccd3 100644 --- a/src/main/java/binnie/botany/ceramic/BlockCeramic.java +++ b/src/main/java/binnie/botany/ceramic/BlockCeramic.java @@ -35,16 +35,16 @@ import binnie.core.util.TileUtil; public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegister { public BlockCeramic() { super(Material.ROCK); - this.setHardness(1.0f); - this.setResistance(5.0f); - this.setRegistryName("ceramic"); - this.setCreativeTab(CreativeTabBotany.instance); + setHardness(1.0f); + setResistance(5.0f); + setRegistryName("ceramic"); + setCreativeTab(CreativeTabBotany.instance); } @Override @SideOnly(Side.CLIENT) public void registerModel(Item item, IModelManager manager) { - for (final EnumFlowerColor c : EnumFlowerColor.values()) { + for (EnumFlowerColor c : EnumFlowerColor.values()) { manager.registerItemModel(item, c.ordinal()); } } @@ -90,7 +90,7 @@ public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegi @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(final Item item, final CreativeTabs tab, final NonNullList itemList) { + public void getSubBlocks(Item item, CreativeTabs tab, NonNullList itemList) { for (EnumFlowerColor c : EnumFlowerColor.values()) { itemList.add(new ItemStack(item, 1, c.getFlowerColorAllele().getID())); } diff --git a/src/main/java/binnie/botany/ceramic/BlockCeramicPatterned.java b/src/main/java/binnie/botany/ceramic/BlockCeramicPatterned.java index d3e52610..acd63776 100644 --- a/src/main/java/binnie/botany/ceramic/BlockCeramicPatterned.java +++ b/src/main/java/binnie/botany/ceramic/BlockCeramicPatterned.java @@ -14,19 +14,19 @@ import binnie.extratrees.carpentry.ModuleCarpentry; public class BlockCeramicPatterned extends BlockDesign { public BlockCeramicPatterned() { super(CeramicDesignSystem.instance, Material.ROCK); - this.setHardness(1.0f); - this.setResistance(5.0f); - this.setCreativeTab(CreativeTabBotany.instance); - this.setRegistryName("ceramicPattern"); + setHardness(1.0f); + setResistance(5.0f); + setCreativeTab(CreativeTabBotany.instance); + setRegistryName("ceramicPattern"); } @Override - public ItemStack getCreativeStack(final IDesign design) { + public ItemStack getCreativeStack(IDesign design) { return ModuleCarpentry.getItemStack(this, CeramicColor.get(EnumFlowerColor.White), CeramicColor.get(EnumFlowerColor.Black), design); } @Override - public String getBlockName(final DesignBlock design) { + public String getBlockName(DesignBlock design) { return I18N.localise("botany.ceramic.block.name", design.getDesign().getName()); } } diff --git a/src/main/java/binnie/botany/ceramic/BlockStainedGlass.java b/src/main/java/binnie/botany/ceramic/BlockStainedGlass.java index de22b64c..9cec2f06 100644 --- a/src/main/java/binnie/botany/ceramic/BlockStainedGlass.java +++ b/src/main/java/binnie/botany/ceramic/BlockStainedGlass.java @@ -1,6 +1,7 @@ package binnie.botany.ceramic; import javax.annotation.Nullable; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; @@ -44,17 +45,17 @@ import binnie.core.util.I18N; public class BlockStainedGlass extends Block implements IBlockMetadata, IColoredBlock, IItemModelRegister { public BlockStainedGlass() { super(Material.GLASS); - this.setCreativeTab(CreativeTabBotany.instance); - this.setRegistryName("stained"); - this.setSoundType(SoundType.GLASS); - this.setHardness(0.3F); + setCreativeTab(CreativeTabBotany.instance); + setRegistryName("stained"); + setSoundType(SoundType.GLASS); + setHardness(0.3F); } @Override - public int quantityDropped(final Random rand) { + public int quantityDropped(Random rand) { return 0; } - + @Override public boolean isOpaqueCube(IBlockState state) { return false; @@ -81,22 +82,22 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored Block block = iblockstate.getBlock(); return block != this; } - + @Override public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) { player.addStat(StatList.getBlockStats(this)); player.addExhaustion(0.005F); - + if (EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0 && te instanceof TileEntityMetadata) { - java.util.List items = new java.util.ArrayList<>(); + List items = new ArrayList<>(); TileEntityMetadata tile = (TileEntityMetadata) te; int damage = getDroppedMeta(state, tile.getTileMetadata()); ItemStack itemstack = TileEntityMetadata.getItemStack(this, damage); - + if (!itemstack.isEmpty()) { items.add(itemstack); } - + ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player); for (ItemStack item : items) { spawnAsEntity(worldIn, pos, item); @@ -110,7 +111,7 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored } @Override - public TileEntity createNewTileEntity(final World var1, final int i) { + public TileEntity createNewTileEntity(World var1, int i) { return new TileEntityMetadata(); } @@ -126,7 +127,7 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored } @Override - public int getPlacedMeta(final ItemStack stack, final World world, final BlockPos pos, final EnumFacing clickedBlock) { + public int getPlacedMeta(ItemStack stack, World world, BlockPos pos, EnumFacing clickedBlock) { return TileEntityMetadata.getItemDamage(stack); } @@ -136,13 +137,13 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored } @Override - public String getDisplayName(final ItemStack itemStack) { + public String getDisplayName(ItemStack itemStack) { EnumFlowerColor color = EnumFlowerColor.get(TileEntityMetadata.getItemDamage(itemStack)); return I18N.localise("botany.pigmented.glass.name", color.getDisplayName()); } @Override - public void getSubBlocks(final Item itemIn, final CreativeTabs tab, final NonNullList itemList) { + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList itemList) { for (EnumFlowerColor color : EnumFlowerColor.values()) { itemList.add(TileEntityMetadata.getItemStack(this, color.ordinal())); } diff --git a/src/main/java/binnie/botany/ceramic/CeramicColor.java b/src/main/java/binnie/botany/ceramic/CeramicColor.java index 330a7c77..28b79511 100644 --- a/src/main/java/binnie/botany/ceramic/CeramicColor.java +++ b/src/main/java/binnie/botany/ceramic/CeramicColor.java @@ -14,24 +14,24 @@ public class CeramicColor implements IDesignMaterial { private final static Map map = new LinkedHashMap<>(); static { - for (final EnumFlowerColor c : EnumFlowerColor.values()) { + for (EnumFlowerColor c : EnumFlowerColor.values()) { CeramicColor.map.put(c, new CeramicColor(c)); } } EnumFlowerColor color; - CeramicColor(final EnumFlowerColor color) { + CeramicColor(EnumFlowerColor color) { this.color = color; } - public static CeramicColor get(final EnumFlowerColor c) { + public static CeramicColor get(EnumFlowerColor c) { return CeramicColor.map.get(c); } @Override public ItemStack getStack() { - return TileEntityMetadata.getItemStack(Botany.ceramic, this.color.ordinal()); + return TileEntityMetadata.getItemStack(Botany.ceramic, color.ordinal()); } @Override @@ -41,11 +41,11 @@ public class CeramicColor implements IDesignMaterial { @Override public String getDesignMaterialName() { - return this.color.getName(); + return color.getName(); } @Override public int getColour() { - return this.color.getFlowerColorAllele().getColor(false); + return color.getFlowerColorAllele().getColor(false); } } diff --git a/src/main/java/binnie/botany/ceramic/CeramicDesignSystem.java b/src/main/java/binnie/botany/ceramic/CeramicDesignSystem.java index 46f3852e..e73497dd 100644 --- a/src/main/java/binnie/botany/ceramic/CeramicDesignSystem.java +++ b/src/main/java/binnie/botany/ceramic/CeramicDesignSystem.java @@ -30,8 +30,8 @@ public class CeramicDesignSystem implements IDesignSystem { Map secondary; CeramicDesignSystem() { - this.primary = new HashMap<>(); - this.secondary = new HashMap<>(); + primary = new HashMap<>(); + secondary = new HashMap<>(); DesignerManager.instance.registerDesignSystem(this); } @@ -46,12 +46,12 @@ public class CeramicDesignSystem implements IDesignSystem { } @Override - public IDesignMaterial getMaterial(final int id) { + public IDesignMaterial getMaterial(int id) { return CeramicColor.get(EnumFlowerColor.get(id)); } @Override - public int getMaterialIndex(final IDesignMaterial id) { + public int getMaterialIndex(IDesignMaterial id) { return ((CeramicColor) id).color.ordinal(); } @@ -64,7 +64,7 @@ public class CeramicDesignSystem implements IDesignSystem { @SideOnly(Side.CLIENT) public TextureAtlasSprite getPrimarySprite(IPattern pattern) { if (pattern instanceof EnumPattern) { - return this.primary.get(((EnumPattern) pattern).ordinal()); + return primary.get(((EnumPattern) pattern).ordinal()); } return null; } @@ -74,7 +74,7 @@ public class CeramicDesignSystem implements IDesignSystem { @SideOnly(Side.CLIENT) public TextureAtlasSprite getSecondarySprite(IPattern pattern) { if (pattern instanceof EnumPattern) { - return this.secondary.get(((EnumPattern) pattern).ordinal()); + return secondary.get(((EnumPattern) pattern).ordinal()); } return null; } @@ -86,8 +86,8 @@ public class CeramicDesignSystem implements IDesignSystem { for (EnumPattern pattern : EnumPattern.values()) { ResourceLocation primaryLocation = new ResourceLocation(getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"); ResourceLocation secondaryLocation = new ResourceLocation(getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"); - this.primary.put(pattern.ordinal(), textureMap.registerSprite(primaryLocation)); - this.secondary.put(pattern.ordinal(), textureMap.registerSprite(secondaryLocation)); + primary.put(pattern.ordinal(), textureMap.registerSprite(primaryLocation)); + secondary.put(pattern.ordinal(), textureMap.registerSprite(secondaryLocation)); } } @@ -97,12 +97,14 @@ public class CeramicDesignSystem implements IDesignSystem { @Override public ItemStack getAdhesive() { - return BotanyItems.Mortar.get(1); + return BotanyItems.MORTAR.get(1); } @Override @Nullable - public IDesignMaterial getMaterial(final ItemStack itemStack) { - return (itemStack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? this.getMaterial(itemStack.getItemDamage()) : null; + public IDesignMaterial getMaterial(ItemStack itemStack) { + return (itemStack.getItem() == Item.getItemFromBlock(Botany.ceramic)) + ? getMaterial(itemStack.getItemDamage()) + : null; } } diff --git a/src/main/java/binnie/botany/ceramic/CeramicTileRecipe.java b/src/main/java/binnie/botany/ceramic/CeramicTileRecipe.java index 21035f5a..17b5db57 100644 --- a/src/main/java/binnie/botany/ceramic/CeramicTileRecipe.java +++ b/src/main/java/binnie/botany/ceramic/CeramicTileRecipe.java @@ -19,25 +19,25 @@ public class CeramicTileRecipe implements IRecipe { private ItemStack cached = ItemStack.EMPTY; @Override - public boolean matches(final InventoryCrafting inv, final World world) { - this.cached = this.getCraftingResult(inv); - return !this.cached.isEmpty(); + public boolean matches(InventoryCrafting inv, World world) { + cached = getCraftingResult(inv); + return !cached.isEmpty(); } @Override - public ItemStack getCraftingResult(final InventoryCrafting inv) { - final Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic); - final Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile); - final Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick); - final Item mortar = Botany.misc; - final List stacks = new ArrayList<>(); + public ItemStack getCraftingResult(InventoryCrafting inv) { + Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic); + Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile); + Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick); + Item mortar = Botany.misc; + List stacks = new ArrayList<>(); int ix = -1; int iy = -1; for (int i = 0; i < inv.getSizeInventory(); ++i) { - final ItemStack stack = inv.getStackInSlot(i); + ItemStack stack = inv.getStackInSlot(i); if (!stack.isEmpty()) { - final int x = i / 3; - final int y = i % 3; + int x = i / 3; + int y = i % 3; if (ix == -1) { ix = x; iy = y; @@ -67,7 +67,7 @@ public class CeramicTileRecipe implements IRecipe { @Override public ItemStack getRecipeOutput() { - return this.cached; + return cached; } @Override diff --git a/src/main/java/binnie/botany/ceramic/ItemCeramic.java b/src/main/java/binnie/botany/ceramic/ItemCeramic.java index 05246c76..56c41c1b 100644 --- a/src/main/java/binnie/botany/ceramic/ItemCeramic.java +++ b/src/main/java/binnie/botany/ceramic/ItemCeramic.java @@ -17,7 +17,7 @@ public class ItemCeramic extends ItemBlock implements IColoredItem { } @Override - public int getMetadata(final int metadata) { + public int getMetadata(int metadata) { return metadata; } diff --git a/src/main/java/binnie/botany/ceramic/PigmentRecipe.java b/src/main/java/binnie/botany/ceramic/PigmentRecipe.java index c300138d..b5af86af 100644 --- a/src/main/java/binnie/botany/ceramic/PigmentRecipe.java +++ b/src/main/java/binnie/botany/ceramic/PigmentRecipe.java @@ -14,8 +14,8 @@ import binnie.botany.api.IFlower; public class PigmentRecipe implements IRecipe { @Override - public boolean matches(final InventoryCrafting crafting, final World world) { - return !this.getCraftingResult(crafting).isEmpty(); + public boolean matches(InventoryCrafting crafting, World world) { + return !getCraftingResult(crafting).isEmpty(); } @Override @@ -24,7 +24,7 @@ public class PigmentRecipe implements IRecipe { } @Override - public ItemStack getCraftingResult(final InventoryCrafting crafting) { + public ItemStack getCraftingResult(InventoryCrafting crafting) { int n = 0; ItemStack stack = ItemStack.EMPTY; for (int i = 0; i < crafting.getSizeInventory(); ++i) { @@ -34,7 +34,7 @@ public class PigmentRecipe implements IRecipe { return ItemStack.EMPTY; } if (Binnie.GENETICS.getFlowerRoot().isMember(stackInSlot)) { - final IFlower flower = Binnie.GENETICS.getFlowerRoot().getMember(stackInSlot); + IFlower flower = Binnie.GENETICS.getFlowerRoot().getMember(stackInSlot); if (flower != null && flower.getAge() >= 1) { stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID()); } diff --git a/src/main/java/binnie/botany/ceramic/brick/BlockCeramicBrick.java b/src/main/java/binnie/botany/ceramic/brick/BlockCeramicBrick.java index ea778d7d..a25e88f3 100644 --- a/src/main/java/binnie/botany/ceramic/brick/BlockCeramicBrick.java +++ b/src/main/java/binnie/botany/ceramic/brick/BlockCeramicBrick.java @@ -66,10 +66,10 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock itemList) { - for (final EnumFlowerColor color : EnumFlowerColor.values()) { - itemList.add(new CeramicBrickPair(color, color, CeramicBrickType.Tile).getStack(1)); + public void getSubBlocks(Item item, CreativeTabs tab, NonNullList itemList) { + for (EnumFlowerColor color : EnumFlowerColor.values()) { + itemList.add(new CeramicBrickPair(color, color, CeramicBrickType.TILE).getStack(1)); } for (CeramicBrickType type : CeramicBrickType.VALUES) { if (type.canDouble()) { itemList.add(new CeramicBrickPair(EnumFlowerColor.Brown, EnumFlowerColor.Gold, type).getStack(1)); } } - itemList.add(new CeramicBrickPair(EnumFlowerColor.Gold, EnumFlowerColor.Gold, CeramicBrickType.Split).getStack(1)); - itemList.add(new CeramicBrickPair(EnumFlowerColor.Brown, EnumFlowerColor.Brown, CeramicBrickType.Chequered).getStack(1)); - itemList.add(new CeramicBrickPair(EnumFlowerColor.Gold, EnumFlowerColor.Brown, CeramicBrickType.LargeBrick).getStack(1)); + itemList.add(new CeramicBrickPair(EnumFlowerColor.Gold, EnumFlowerColor.Gold, CeramicBrickType.SPLIT).getStack(1)); + itemList.add(new CeramicBrickPair(EnumFlowerColor.Brown, EnumFlowerColor.Brown, CeramicBrickType.CHEQUERED).getStack(1)); + itemList.add(new CeramicBrickPair(EnumFlowerColor.Gold, EnumFlowerColor.Brown, CeramicBrickType.LARGE_BRICK).getStack(1)); } @SideOnly(Side.CLIENT) @@ -125,9 +125,10 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock(BlockCeramicBrick.class), this + new ModelResourceLocation(resourceLocation, "normal"), + new ModelResourceLocation(resourceLocation, "inventory"), + new ModelMutlipass<>(BlockCeramicBrick.class), + this )); } @@ -139,7 +140,14 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock> 8 & 0xFF); - this.type = CeramicBrickType.get(id >> 16 & 0xFF); + colorFirst = EnumFlowerColor.get(id & 0xFF); + colorSecond = EnumFlowerColor.get(id >> 8 & 0xFF); + type = CeramicBrickType.get(id >> 16 & 0xFF); } public boolean isTwoColors() { - return this.type.canDouble() && this.colorSecond != this.colorFirst; + return type.canDouble() && colorSecond != colorFirst; } public ItemStack getStack(int i) { - return new ItemStack(Botany.ceramicBrick, i, this.ordinal()); + return new ItemStack(Botany.ceramicBrick, i, ordinal()); } public String getName() { - String name = this.colorFirst.getFlowerColorAllele().getColorName(); - if (this.type.canDouble() && this.colorSecond != this.colorFirst) { - name = name + " & " + this.colorSecond.getFlowerColorAllele().getColorName(); + String name = colorFirst.getFlowerColorAllele().getColorName(); + if (type.canDouble() && colorSecond != colorFirst) { + name = name + " & " + colorSecond.getFlowerColorAllele().getColorName(); } return I18N.localise("botany.ceramic.type." + type.id + ".name", name); } @@ -58,7 +59,7 @@ public class CeramicBrickPair { @SideOnly(Side.CLIENT) public TextureAtlasSprite getSprite(int pass) { - TextureAtlasSprite[] sprites = this.type.sprites; + TextureAtlasSprite[] sprites = type.sprites; Preconditions.checkState(sprites != null, "Sprites have not been registered."); return sprites[pass]; } @@ -71,6 +72,6 @@ public class CeramicBrickPair { @Override public boolean equals(Object obj) { return obj instanceof CeramicBrickPair - && ((CeramicBrickPair) obj).ordinal() == ordinal(); + && ((CeramicBrickPair) obj).ordinal() == ordinal(); } } diff --git a/src/main/java/binnie/botany/ceramic/brick/CeramicBrickType.java b/src/main/java/binnie/botany/ceramic/brick/CeramicBrickType.java index 1ec6508d..c2f0302c 100644 --- a/src/main/java/binnie/botany/ceramic/brick/CeramicBrickType.java +++ b/src/main/java/binnie/botany/ceramic/brick/CeramicBrickType.java @@ -2,7 +2,6 @@ package binnie.botany.ceramic.brick; import javax.annotation.Nullable; import java.util.List; -import java.util.Locale; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.item.Item; @@ -18,7 +17,7 @@ import binnie.botany.items.BotanyItems; import binnie.core.block.TileEntityMetadata; public enum CeramicBrickType implements IStringSerializable { - Tile("tile") { + TILE("tile") { @Override public ItemStack getRecipe(List stacks) { if (stacks.size() != 4) { @@ -27,15 +26,15 @@ public enum CeramicBrickType implements IStringSerializable { int mortars = 0; int blocks = 0; int blockColor = -1; - for (final ItemStack stack : stacks) { - if (this.isMortar(stack)) { + for (ItemStack stack : stacks) { + if (isMortar(stack)) { ++mortars; } else { if (stack.getItem() != Item.getItemFromBlock(Botany.ceramic)) { return ItemStack.EMPTY; } ++blocks; - final int color = TileEntityMetadata.getItemDamage(stack); + int color = TileEntityMetadata.getItemDamage(stack); if (blockColor == -1) { blockColor = color; } else { @@ -48,29 +47,29 @@ public enum CeramicBrickType implements IStringSerializable { if (mortars != 1) { return ItemStack.EMPTY; } - final EnumFlowerColor c = EnumFlowerColor.get(blockColor); - return new CeramicBrickPair(c, c, CeramicBrickType.Tile).getStack(3); + EnumFlowerColor c = EnumFlowerColor.get(blockColor); + return new CeramicBrickPair(c, c, CeramicBrickType.TILE).getStack(3); } }, - Brick("brick") { + BRICK("brick") { @Override public ItemStack getRecipe(List stacks) { return getBrickRecipe(this, stacks); } }, - StripeBrick("brickstripe") { + STRIPE_BRICK("brickstripe") { @Override public ItemStack getRecipe(List stacks) { return getBrickRecipe(this, stacks); } }, - LargeBrick("bricklarge") { + LARGE_BRICK("bricklarge") { @Override public ItemStack getRecipe(List stacks) { if (stacks.size() == 1) { - final ItemStack stack3 = stacks.get(0); - final CeramicBrickPair type3 = new CeramicBrickPair(stack3); - if (type3.type == CeramicBrickType.VerticalLargeBrick) { + ItemStack stack3 = stacks.get(0); + CeramicBrickPair type3 = new CeramicBrickPair(stack3); + if (type3.type == CeramicBrickType.VERTICAL_LARGE_BRICK) { type3.type = this; return type3.getStack(1); } @@ -79,58 +78,58 @@ public enum CeramicBrickType implements IStringSerializable { if (stacks.size() != 3) { return ItemStack.EMPTY; } - final int[] colors = {-1, -1}; + int[] colors = {-1, -1}; int a = 0; int b = 0; - for (final ItemStack stack4 : stacks) { + for (ItemStack stack4 : stacks) { if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) { return ItemStack.EMPTY; } - final CeramicBrickPair type4 = new CeramicBrickPair(stack4); - if (type4.type != CeramicBrickType.Tile) { + CeramicBrickPair type4 = new CeramicBrickPair(stack4); + if (type4.type != CeramicBrickType.TILE) { return ItemStack.EMPTY; } - final int color5 = type4.colorFirst.ordinal(); + int color5 = type4.colorFirst.ordinal(); if (colors[0] == -1) { colors[0] = color5; - ++a; + a++; } else if (colors[0] == color5) { - ++a; + a++; } else if (colors[1] == -1) { colors[1] = color5; - ++b; + b++; } else { if (colors[1] != color5) { return ItemStack.EMPTY; } - ++b; + b++; } } if (colors[1] == -1) { colors[1] = colors[0]; } - return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.LargeBrick).getStack(3); + return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.LARGE_BRICK).getStack(3); } } }, - Split("split") { + SPLIT("split") { @Override public ItemStack getRecipe(List stacks) { if (stacks.size() != 4) { return ItemStack.EMPTY; } - final int[] colors = {-1, -1}; + int[] colors = {-1, -1}; int altCounter = 0; - for (final ItemStack stack2 : stacks) { - final int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0; + for (ItemStack stack2 : stacks) { + int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0; if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) { return ItemStack.EMPTY; } - final CeramicBrickPair type = new CeramicBrickPair(stack2); - if (type.type != CeramicBrickType.Tile) { + CeramicBrickPair type = new CeramicBrickPair(stack2); + if (type.type != CeramicBrickType.TILE) { return ItemStack.EMPTY; } - final int color2 = type.colorFirst.ordinal(); + int color2 = type.colorFirst.ordinal(); if (colors[alt] == -1) { colors[alt] = color2; } else if (colors[alt] != color2) { @@ -138,26 +137,26 @@ public enum CeramicBrickType implements IStringSerializable { } ++altCounter; } - return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.Split).getStack(4); + return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.SPLIT).getStack(4); } }, - Chequered("cheque") { + CHEQUERED("cheque") { @Override public ItemStack getRecipe(List stacks) { if (stacks.size() != 4) { return ItemStack.EMPTY; } - final int[] colors = {-1, -1}; - for (final ItemStack stack2 : stacks) { + int[] colors = {-1, -1}; + for (ItemStack stack2 : stacks) { if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) { return ItemStack.EMPTY; } - final CeramicBrickPair type2 = new CeramicBrickPair(stack2); - if (type2.type != CeramicBrickType.Split) { + CeramicBrickPair type2 = new CeramicBrickPair(stack2); + if (type2.type != CeramicBrickType.SPLIT) { return ItemStack.EMPTY; } - final int color3 = type2.colorFirst.ordinal(); - final int color4 = type2.colorSecond.ordinal(); + int color3 = type2.colorFirst.ordinal(); + int color4 = type2.colorSecond.ordinal(); if (colors[0] == -1) { colors[0] = color3; colors[1] = color4; @@ -167,32 +166,32 @@ public enum CeramicBrickType implements IStringSerializable { } } } - return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.Chequered).getStack(4); + return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.CHEQUERED).getStack(4); } }, - Mixed("mixed") { + MIXED("mixed") { @Override public ItemStack getRecipe(List stacks) { if (stacks.size() != 4) { return ItemStack.EMPTY; } - final int[] colors = {-1, -1}; - for (final ItemStack stack2 : stacks) { + int[] colors = {-1, -1}; + for (ItemStack stack2 : stacks) { if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) { return ItemStack.EMPTY; } - final CeramicBrickPair type2 = new CeramicBrickPair(stack2); + CeramicBrickPair type2 = new CeramicBrickPair(stack2); if (type2.isTwoColors()) { return ItemStack.EMPTY; } - final int color3 = type2.colorFirst.ordinal(); - if (type2.type == CeramicBrickType.Split) { + int color3 = type2.colorFirst.ordinal(); + if (type2.type == CeramicBrickType.SPLIT) { if (colors[1] != -1) { return ItemStack.EMPTY; } colors[1] = color3; } else { - if (type2.type != CeramicBrickType.Chequered) { + if (type2.type != CeramicBrickType.CHEQUERED) { return ItemStack.EMPTY; } if (colors[0] == -1) { @@ -201,27 +200,27 @@ public enum CeramicBrickType implements IStringSerializable { return ItemStack.EMPTY; } } - final int color4 = type2.colorSecond.ordinal(); + int color4 = type2.colorSecond.ordinal(); } if (colors[0] == -1 || colors[1] == -1) { return ItemStack.EMPTY; } - return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.Mixed).getStack(4); + return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.MIXED).getStack(4); } }, - VerticalBrick("verticalbrick") { + VERTICAL_BRICK("verticalbrick") { @Override public ItemStack getRecipe(List stacks) { return getVerticalBrickRecipe(stacks); } }, - VerticalStripeBrick("verticalbrickstripe") { + VERTICAL_STRIPE_BRICK("verticalbrickstripe") { @Override public ItemStack getRecipe(List stacks) { return getVerticalBrickRecipe(stacks); } }, - VerticalLargeBrick("verticalbricklarge") { + VERTICAL_LARGE_BRICK("verticalbricklarge") { @Override public ItemStack getRecipe(List stacks) { return getVerticalBrickRecipe(stacks); @@ -230,7 +229,7 @@ public enum CeramicBrickType implements IStringSerializable { public static final CeramicBrickType[] VALUES = values(); - String id; + public String id; @SideOnly(Side.CLIENT) @Nullable @@ -240,12 +239,12 @@ public enum CeramicBrickType implements IStringSerializable { this.id = id; } - public static CeramicBrickType get(final int id) { + public static CeramicBrickType get(int id) { return VALUES[id % VALUES.length]; } public boolean canDouble() { - return this != CeramicBrickType.Tile; + return this != CeramicBrickType.TILE; } public abstract ItemStack getRecipe(List stacks); @@ -254,18 +253,20 @@ public enum CeramicBrickType implements IStringSerializable { if (stacks.size() != 1) { return ItemStack.EMPTY; } - final ItemStack stack5 = stacks.get(0); - final CeramicBrickPair type = new CeramicBrickPair(stack5); - if (type.type == CeramicBrickType.LargeBrick) { - type.type = CeramicBrickType.VerticalLargeBrick; + ItemStack stack5 = stacks.get(0); + CeramicBrickPair type = new CeramicBrickPair(stack5); + if (type.type == CeramicBrickType.LARGE_BRICK) { + type.type = CeramicBrickType.VERTICAL_LARGE_BRICK; return type.getStack(1); } - if (type.type == CeramicBrickType.Brick) { - type.type = CeramicBrickType.VerticalBrick; + + if (type.type == CeramicBrickType.BRICK) { + type.type = CeramicBrickType.VERTICAL_BRICK; return type.getStack(1); } - if (type.type == CeramicBrickType.StripeBrick) { - type.type = CeramicBrickType.VerticalStripeBrick; + + if (type.type == CeramicBrickType.STRIPE_BRICK) { + type.type = CeramicBrickType.VERTICAL_STRIPE_BRICK; return type.getStack(1); } return ItemStack.EMPTY; @@ -273,34 +274,38 @@ public enum CeramicBrickType implements IStringSerializable { protected ItemStack getBrickRecipe(CeramicBrickType ceramicType, List stacks) { if (stacks.size() == 1) { - final ItemStack stack5 = stacks.get(0); - final CeramicBrickPair type = new CeramicBrickPair(stack5); - if (type.type == CeramicBrickType.VerticalBrick) { + ItemStack stack5 = stacks.get(0); + CeramicBrickPair type = new CeramicBrickPair(stack5); + if (type.type == CeramicBrickType.VERTICAL_BRICK) { type.type = ceramicType; return type.getStack(1); } - if (type.type == CeramicBrickType.StripeBrick) { + + if (type.type == CeramicBrickType.STRIPE_BRICK) { type.type = ceramicType; return type.getStack(1); } return ItemStack.EMPTY; } else if (stacks.size() == 4) { - final int[] colors = {-1, -1}; + int[] colors = {-1, -1}; for (int index2 = 0; index2 < stacks.size(); ++index2) { - final ItemStack stack4 = stacks.get(index2); + ItemStack stack4 = stacks.get(index2); if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) { return ItemStack.EMPTY; } - final CeramicBrickPair type4 = new CeramicBrickPair(stack4); - if (type4.type != CeramicBrickType.LargeBrick) { + + CeramicBrickPair type4 = new CeramicBrickPair(stack4); + if (type4.type != CeramicBrickType.LARGE_BRICK) { return ItemStack.EMPTY; } - final int color5 = type4.colorFirst.ordinal(); - final int color6 = type4.colorSecond.ordinal(); + + int color5 = type4.colorFirst.ordinal(); + int color6 = type4.colorSecond.ordinal(); int alt2 = (index2 != 0 && index2 != 3) ? 1 : 0; - if (ceramicType == CeramicBrickType.StripeBrick) { + if (ceramicType == CeramicBrickType.STRIPE_BRICK) { alt2 = 0; } + if (colors[alt2] == -1) { colors[alt2] = color5; colors[1 - alt2] = color6; @@ -309,17 +314,16 @@ public enum CeramicBrickType implements IStringSerializable { } } return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), ceramicType).getStack(4); - } else { - return ItemStack.EMPTY; } + return ItemStack.EMPTY; } - protected boolean isMortar(final ItemStack stack) { - return stack.getItem() == Botany.misc && stack.getItemDamage() == BotanyItems.Mortar.ordinal(); + protected boolean isMortar(ItemStack stack) { + return stack.getItem() == Botany.misc && stack.getItemDamage() == BotanyItems.MORTAR.ordinal(); } @Override public String getName() { - return name().toLowerCase(Locale.ENGLISH); + return id; } } diff --git a/src/main/java/binnie/botany/ceramic/brick/ItemCeramicBrick.java b/src/main/java/binnie/botany/ceramic/brick/ItemCeramicBrick.java index 9c2146c7..8dc38497 100644 --- a/src/main/java/binnie/botany/ceramic/brick/ItemCeramicBrick.java +++ b/src/main/java/binnie/botany/ceramic/brick/ItemCeramicBrick.java @@ -14,7 +14,7 @@ public class ItemCeramicBrick extends ItemBlock implements IColoredItem { } @Override - public int getMetadata(final int metadata) { + public int getMetadata(int metadata) { return metadata; } diff --git a/src/main/java/binnie/botany/ceramic/brick/TileCeramicBrick.java b/src/main/java/binnie/botany/ceramic/brick/TileCeramicBrick.java index 83fc1af2..7048739e 100644 --- a/src/main/java/binnie/botany/ceramic/brick/TileCeramicBrick.java +++ b/src/main/java/binnie/botany/ceramic/brick/TileCeramicBrick.java @@ -18,17 +18,17 @@ public class TileCeramicBrick extends TileEntity { } public boolean hasTwoColors() { - return CeramicBrickType.VALUES[getBlockMetadata()].canDouble() && this.colorSecond != this.colorFirst; + return CeramicBrickType.VALUES[getBlockMetadata()].canDouble() && colorSecond != colorFirst; } - public ItemStack getStack(final int i) { - final ItemStack s = TileEntityMetadata.getItemStack(Botany.ceramicBrick, this.ordinal()); + public ItemStack getStack(int i) { + ItemStack s = TileEntityMetadata.getItemStack(Botany.ceramicBrick, ordinal()); s.setCount(i); return s; } public int ordinal() { - return this.colorFirst.ordinal() + this.colorSecond.ordinal() * 256 + getBlockMetadata() * 256 * 256; + return colorFirst.ordinal() + colorSecond.ordinal() * 256 + getBlockMetadata() * 256 * 256; } public CeramicBrickPair pair() { @@ -61,6 +61,7 @@ public class TileCeramicBrick extends TileEntity { if (compound.hasKey("First")) { colorFirst = EnumFlowerColor.VALUES[compound.getInteger("First")]; } + if (compound.hasKey("Second")) { colorSecond = EnumFlowerColor.VALUES[compound.getInteger("Second")]; } diff --git a/src/main/java/binnie/botany/core/BotanyCore.java b/src/main/java/binnie/botany/core/BotanyCore.java index 10c52a95..b30389ea 100644 --- a/src/main/java/binnie/botany/core/BotanyCore.java +++ b/src/main/java/binnie/botany/core/BotanyCore.java @@ -15,8 +15,8 @@ public class BotanyCore { } return FlowerManager.flowerRoot; } - - public static IGardeningManager getGardening(){ + + public static IGardeningManager getGardening() { if (FlowerManager.gardening == null) { FlowerManager.gardening = new Gardening(); } diff --git a/src/main/java/binnie/botany/core/BotanyGUI.java b/src/main/java/binnie/botany/core/BotanyGUI.java index aeef3fae..e56dd489 100644 --- a/src/main/java/binnie/botany/core/BotanyGUI.java +++ b/src/main/java/binnie/botany/core/BotanyGUI.java @@ -13,21 +13,21 @@ import binnie.core.craftgui.minecraft.Window; import binnie.core.gui.IBinnieGUID; public enum BotanyGUI implements IBinnieGUID { - Database, - DatabaseNEI; + DATABASE, + DATABASE_NEI; @Override - public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) { + public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) { Window window = null; - final TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z)); + TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z)); IInventory object = null; if (tileEntity instanceof IInventory) { object = (IInventory) tileEntity; } switch (this) { - case Database: - case DatabaseNEI: { - window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.Database); + case DATABASE: + case DATABASE_NEI: { + window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.DATABASE); break; } } diff --git a/src/main/java/binnie/botany/core/BotanyTexture.java b/src/main/java/binnie/botany/core/BotanyTexture.java index c2782eb5..57538892 100644 --- a/src/main/java/binnie/botany/core/BotanyTexture.java +++ b/src/main/java/binnie/botany/core/BotanyTexture.java @@ -11,6 +11,7 @@ import binnie.core.resource.BinnieResource; import binnie.core.resource.IBinnieTexture; import binnie.core.resource.ResourceType; +// TODO unused enum? public enum BotanyTexture implements IBinnieTexture { ; String texture; @@ -20,16 +21,16 @@ public enum BotanyTexture implements IBinnieTexture { @Nullable private BinnieResource resource; - BotanyTexture(final ResourceType base, final String texture) { + BotanyTexture(ResourceType base, String texture) { this.texture = texture; - this.type = base; + type = base; } @Override @SideOnly(Side.CLIENT) public BinnieResource getTexture() { if (resource == null) { - resource = Binnie.RESOURCE.getPNG(Botany.instance, this.type, this.texture); + resource = Binnie.RESOURCE.getPNG(Botany.instance, type, texture); } return resource; } diff --git a/src/main/java/binnie/botany/core/ModuleCore.java b/src/main/java/binnie/botany/core/ModuleCore.java index 8377db43..9498a1e7 100644 --- a/src/main/java/binnie/botany/core/ModuleCore.java +++ b/src/main/java/binnie/botany/core/ModuleCore.java @@ -5,13 +5,16 @@ import binnie.core.IInitializable; public class ModuleCore implements IInitializable { @Override public void preInit() { + // ignored } @Override public void init() { + // ignored } @Override public void postInit() { + // ignored } } diff --git a/src/main/java/binnie/botany/craftgui/ControlColorDisplay.java b/src/main/java/binnie/botany/craftgui/ControlColorDisplay.java index 1721d438..279548bf 100644 --- a/src/main/java/binnie/botany/craftgui/ControlColorDisplay.java +++ b/src/main/java/binnie/botany/craftgui/ControlColorDisplay.java @@ -3,7 +3,7 @@ package binnie.botany.craftgui; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import binnie.botany.api.IFlowerColour; +import binnie.botany.api.IFlowerColor; import binnie.core.craftgui.Attribute; import binnie.core.craftgui.ITooltip; import binnie.core.craftgui.IWidget; @@ -12,35 +12,35 @@ import binnie.core.craftgui.controls.core.Control; import binnie.core.craftgui.controls.core.IControlValue; import binnie.core.craftgui.renderer.RenderUtil; -public class ControlColorDisplay extends Control implements IControlValue, ITooltip { - private IFlowerColour value; +public class ControlColorDisplay extends Control implements IControlValue, ITooltip { + private IFlowerColor value; - public ControlColorDisplay(final IWidget parent, final int x, final int y, final IFlowerColour value) { + public ControlColorDisplay(IWidget parent, int x, int y, IFlowerColor value) { super(parent, x, y, 16, 16); this.value = value; - this.addAttribute(Attribute.MouseOver); + addAttribute(Attribute.MouseOver); } @Override - public IFlowerColour getValue() { - return this.value; + public IFlowerColor getValue() { + return value; } @Override - public void setValue(final IFlowerColour value) { + public void setValue(IFlowerColor value) { this.value = value; } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawSolidRect(this.getArea(), -1); - RenderUtil.drawSolidRect(this.getArea().inset(1), -16777216 + this.getValue().getColor(false)); + RenderUtil.drawSolidRect(getArea(), -1); + RenderUtil.drawSolidRect(getArea().inset(1), 0xff000000 + getValue().getColor(false)); } @Override - public void getTooltip(final Tooltip tooltip) { + public void getTooltip(Tooltip tooltip) { super.getTooltip(tooltip); - tooltip.add(this.value.getColorName()); + tooltip.add(value.getColorName()); } } diff --git a/src/main/java/binnie/botany/craftgui/ControlColorMixBox.java b/src/main/java/binnie/botany/craftgui/ControlColorMixBox.java index d1965f62..d6001961 100644 --- a/src/main/java/binnie/botany/craftgui/ControlColorMixBox.java +++ b/src/main/java/binnie/botany/craftgui/ControlColorMixBox.java @@ -8,18 +8,18 @@ public class ControlColorMixBox extends ControlListBox { private int index; private Type type; - public ControlColorMixBox(final IWidget parent, final int x, final int y, final int width, final int height, final Type type) { + public ControlColorMixBox(IWidget parent, int x, int y, int width, int height, Type type) { super(parent, x, y, width, height, 12); this.type = type; } @Override - public IWidget createOption(final IColorMix value, final int y) { - return new ControlColorMixItem(this.getContent(), value, y); + public IWidget createOption(IColorMix value, int y) { + return new ControlColorMixItem(getContent(), value, y); } enum Type { - Resultant, - Further, + RESULTANT, + FURTHER, } } diff --git a/src/main/java/binnie/botany/craftgui/ControlColorMixItem.java b/src/main/java/binnie/botany/craftgui/ControlColorMixItem.java index 272fd22c..687cd28e 100644 --- a/src/main/java/binnie/botany/craftgui/ControlColorMixItem.java +++ b/src/main/java/binnie/botany/craftgui/ControlColorMixItem.java @@ -11,13 +11,13 @@ public class ControlColorMixItem extends ControlOption { private final ControlColorMixSymbol addSymbol; private final ControlColorMixSymbol arrowSymbol; - public ControlColorMixItem(final ControlList controlList, final IColorMix option, final int y) { + public ControlColorMixItem(ControlList controlList, IColorMix option, int y) { super(controlList, option, y); - IColorMix value = this.getValue(); - this.itemWidget1 = new ControlColorDisplay(this, 4, 4, value.getColorFirst()); - this.itemWidget2 = new ControlColorDisplay(this, 44, 4, value.getColorSecond()); - this.itemWidget3 = new ControlColorDisplay(this, 104, 4, value.getResult()); - this.addSymbol = new ControlColorMixSymbol(this, 24, 4, 0, value); - this.arrowSymbol = new ControlColorMixSymbol(this, 64, 4, 1, value); + IColorMix value = getValue(); + itemWidget1 = new ControlColorDisplay(this, 4, 4, value.getColorFirst()); + itemWidget2 = new ControlColorDisplay(this, 44, 4, value.getColorSecond()); + itemWidget3 = new ControlColorDisplay(this, 104, 4, value.getResult()); + addSymbol = new ControlColorMixSymbol(this, 24, 4, 0, value); + arrowSymbol = new ControlColorMixSymbol(this, 64, 4, 1, value); } } diff --git a/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java b/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java index edcf688c..84ec414e 100644 --- a/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java +++ b/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java @@ -22,33 +22,33 @@ public class ControlColorMixSymbol extends Control implements ITooltip { IColorMix value; int type; - protected ControlColorMixSymbol(final IWidget parent, final int x, final int y, final int type, final IColorMix value) { + protected ControlColorMixSymbol(IWidget parent, int x, int y, int type, IColorMix value) { super(parent, x, y, 16 + type * 16, 16); this.value = value; this.type = type; - this.addAttribute(Attribute.MouseOver); + addAttribute(Attribute.MouseOver); } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { super.onRenderBackground(guiWidth, guiHeight); - if (this.type == 0) { + if (type == 0) { CraftGUI.render.texture(ControlColorMixSymbol.MutationPlus, Point.ZERO); } else { CraftGUI.render.texture(ControlColorMixSymbol.MutationArrow, Point.ZERO); } } - public void setValue(final IColorMix value) { + public void setValue(IColorMix value) { this.value = value; - this.setColour(0xffffff); + setColour(0xffffff); } @Override - public void getTooltip(final Tooltip tooltip) { - if (this.type == 1) { - final float chance = this.value.getChance(); + public void getTooltip(Tooltip tooltip) { + if (type == 1) { + float chance = value.getChance(); tooltip.add(I18N.localise("botany.gui.controls.color_mix_symbol.chance", chance)); } } diff --git a/src/main/java/binnie/botany/craftgui/ControlColorOption.java b/src/main/java/binnie/botany/craftgui/ControlColorOption.java index 4e9482dd..a43dfbc5 100644 --- a/src/main/java/binnie/botany/craftgui/ControlColorOption.java +++ b/src/main/java/binnie/botany/craftgui/ControlColorOption.java @@ -3,7 +3,7 @@ package binnie.botany.craftgui; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import binnie.botany.api.IFlowerColour; +import binnie.botany.api.IFlowerColor; import binnie.core.craftgui.Attribute; import binnie.core.craftgui.CraftGUI; import binnie.core.craftgui.controls.listbox.ControlList; @@ -12,21 +12,21 @@ import binnie.core.craftgui.geometry.CraftGUIUtil; import binnie.core.craftgui.geometry.Point; @SideOnly(Side.CLIENT) -public class ControlColorOption extends ControlTextOption { - ControlColorDisplay controlBee; - Point boxPosition; +public class ControlColorOption extends ControlTextOption { + private ControlColorDisplay controlBee; + private Point boxPosition; - public ControlColorOption(final ControlList controlList, final IFlowerColour option, final int y) { + public ControlColorOption(ControlList controlList, IFlowerColor option, int y) { super(controlList, option, option.getColorName(), y); - this.setSize(new Point(this.getSize().x(), 20)); - this.controlBee = new ControlColorDisplay(this, 2, 2, option); - this.addAttribute(Attribute.MouseOver); - CraftGUIUtil.moveWidget(this.textWidget, new Point(22, 0)); - this.textWidget.setSize(this.textWidget.getSize().sub(new Point(24, 0))); - final int th = CraftGUI.render.textHeight(this.textWidget.getValue(), this.textWidget.getSize().x()); - final int height = Math.max(20, th + 6); - this.setSize(new Point(this.size().x(), height)); - this.textWidget.setSize(new Point(this.textWidget.getSize().x(), height)); - this.boxPosition = new Point(2, (height - 18) / 2); + setSize(new Point(getSize().x(), 20)); + controlBee = new ControlColorDisplay(this, 2, 2, option); + addAttribute(Attribute.MouseOver); + CraftGUIUtil.moveWidget(textWidget, new Point(22, 0)); + textWidget.setSize(textWidget.getSize().sub(new Point(24, 0))); + int th = CraftGUI.render.textHeight(textWidget.getValue(), textWidget.getSize().x()); + int height = Math.max(20, th + 6); + setSize(new Point(size().x(), height)); + textWidget.setSize(new Point(textWidget.getSize().x(), height)); + boxPosition = new Point(2, (height - 18) / 2); } } diff --git a/src/main/java/binnie/botany/craftgui/PageColorMix.java b/src/main/java/binnie/botany/craftgui/PageColorMix.java index 92bc8b31..f5d156ee 100644 --- a/src/main/java/binnie/botany/craftgui/PageColorMix.java +++ b/src/main/java/binnie/botany/craftgui/PageColorMix.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; import binnie.botany.api.IColorMix; -import binnie.botany.api.IFlowerColour; +import binnie.botany.api.IFlowerColor; import binnie.botany.core.BotanyCore; import binnie.core.craftgui.IWidget; import binnie.core.craftgui.controls.ControlText; @@ -13,24 +13,24 @@ import binnie.core.craftgui.database.DatabaseTab; import binnie.core.craftgui.database.PageAbstract; import binnie.core.util.I18N; -public class PageColorMix extends PageAbstract { +public class PageColorMix extends PageAbstract { ControlText pageSpeciesFurther_Title; ControlColorMixBox pageSpeciesFurther_List; - public PageColorMix(final IWidget parent, final DatabaseTab tab) { + public PageColorMix(IWidget parent, DatabaseTab tab) { super(parent, tab); - this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8, I18N.localise("botany.gui.controls.page.color_further.title")); - this.pageSpeciesFurther_List = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Further); + pageSpeciesFurther_Title = new ControlTextCentered(this, 8, I18N.localise("botany.gui.controls.page.color_further.title")); + pageSpeciesFurther_List = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.FURTHER); } @Override - public void onValueChanged(final IFlowerColour colour) { - final List mixes = new ArrayList<>(); - for (final IColorMix mix : BotanyCore.getFlowerRoot().getColorMixes(false)) { + public void onValueChanged(IFlowerColor colour) { + List mixes = new ArrayList<>(); + for (IColorMix mix : BotanyCore.getFlowerRoot().getColorMixes(false)) { if (mix.getColorFirst() == colour || mix.getColorSecond() == colour) { mixes.add(mix); } } - this.pageSpeciesFurther_List.setOptions(mixes); + pageSpeciesFurther_List.setOptions(mixes); } } diff --git a/src/main/java/binnie/botany/craftgui/PageColorMixResultant.java b/src/main/java/binnie/botany/craftgui/PageColorMixResultant.java index c2f03342..bffce1ce 100644 --- a/src/main/java/binnie/botany/craftgui/PageColorMixResultant.java +++ b/src/main/java/binnie/botany/craftgui/PageColorMixResultant.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; import binnie.botany.api.IColorMix; -import binnie.botany.api.IFlowerColour; +import binnie.botany.api.IFlowerColor; import binnie.botany.core.BotanyCore; import binnie.core.craftgui.IWidget; import binnie.core.craftgui.controls.ControlText; @@ -13,24 +13,24 @@ import binnie.core.craftgui.database.DatabaseTab; import binnie.core.craftgui.database.PageAbstract; import binnie.core.util.I18N; -public class PageColorMixResultant extends PageAbstract { +public class PageColorMixResultant extends PageAbstract { ControlText pageSpeciesFurther_Title; ControlColorMixBox pageSpeciesFurther_List; - public PageColorMixResultant(final IWidget parent, final DatabaseTab tab) { + public PageColorMixResultant(IWidget parent, DatabaseTab tab) { super(parent, tab); - this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8, I18N.localise("botany.gui.controls.page.species_further.title")); - this.pageSpeciesFurther_List = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Resultant); + pageSpeciesFurther_Title = new ControlTextCentered(this, 8, I18N.localise("botany.gui.controls.page.species_further.title")); + pageSpeciesFurther_List = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.RESULTANT); } @Override - public void onValueChanged(final IFlowerColour colour) { - final List mixes = new ArrayList<>(); - for (final IColorMix mix : BotanyCore.getFlowerRoot().getColorMixes(false)) { + public void onValueChanged(IFlowerColor colour) { + List mixes = new ArrayList<>(); + for (IColorMix mix : BotanyCore.getFlowerRoot().getColorMixes(false)) { if (mix.getResult() == colour) { mixes.add(mix); } } - this.pageSpeciesFurther_List.setOptions(mixes); + pageSpeciesFurther_List.setOptions(mixes); } } diff --git a/src/main/java/binnie/botany/craftgui/PageSpeciesFlowerGenome.java b/src/main/java/binnie/botany/craftgui/PageSpeciesFlowerGenome.java index ff0b4b7d..00ca7955 100644 --- a/src/main/java/binnie/botany/craftgui/PageSpeciesFlowerGenome.java +++ b/src/main/java/binnie/botany/craftgui/PageSpeciesFlowerGenome.java @@ -26,11 +26,11 @@ import binnie.core.craftgui.minecraft.control.ControlItemDisplay; import binnie.core.util.I18N; public class PageSpeciesFlowerGenome extends PageSpecies { - public PageSpeciesFlowerGenome(final IWidget parent, final DatabaseTab tab) { + public PageSpeciesFlowerGenome(IWidget parent, DatabaseTab tab) { super(parent, tab); } - public static String tolerated(final boolean t) { + public static String tolerated(boolean t) { if (t) { return "Tolerated"; } @@ -38,48 +38,52 @@ public class PageSpeciesFlowerGenome extends PageSpecies { } @Override - public void onValueChanged(final IAlleleSpecies species) { - this.deleteAllChildren(); + public void onValueChanged(IAlleleSpecies species) { + deleteAllChildren(); IAllele[] template = Binnie.GENETICS.getFlowerRoot().getTemplate(species.getUID()); if (template == null) { return; } + IFlower tree = Binnie.GENETICS.getFlowerRoot().templateAsIndividual(template); - if (tree == null) { - return; - } IFlowerGenome genome = tree.getGenome(); IAlleleFlowerSpecies treeSpecies = genome.getPrimary(); int w = 144; int h = 176; - new ControlText(this, new Area(0, 4, w, 16), I18N.localise("botany.gui.database.tab.genome"), TextJustification.MiddleCenter); + new ControlText(this, new Area(0, 4, w, 16), I18N.localise("botany.gui.database.tab.genome"), TextJustification.MIDDLE_CENTER); ControlScrollableContent scrollable = new ControlScrollableContent(this, 4, 20, w - 8, h - 8 - 16, 12); Control contents = new Control(scrollable, 0, 0, w - 8 - 12, h - 8 - 16); int tw = w - 8 - 12; int w2 = 55; int w3 = tw - 50; int y = 0; - final int th = 14; - final int th2 = 18; - new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.temp"), TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MIDDLE_LEFTt); + int th = 14; + int th2 = 18; + new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.temp"), TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MIDDLE_LEFT); + y += th; - new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.moist"), TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getMoisture().getLocalisedName(false), TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.moist"), TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getMoisture().getLocalisedName(false), TextJustification.MIDDLE_LEFT); + y += th; - new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.ph"), TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getPH().getLocalisedName(false), TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.ph"), TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getPH().getLocalisedName(false), TextJustification.MIDDLE_LEFT); + y += th; - new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.fertility"), TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.fertility"), TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFT); + y += th; float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f; String lifespanValue = String.format("%.2f", lifespan); - new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.lifespan"), TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), I18N.localise("botany.gui.database.tab.genome.lifespan.value", lifespanValue), TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.lifespan"), TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), I18N.localise("botany.gui.database.tab.genome.lifespan.value", lifespanValue), TextJustification.MIDDLE_LEFT); + y += th; - new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.nectar"), TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), I18N.localise("botany.gui.database.tab.genome.nectar"), TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MIDDLE_LEFT); + y += th; int x = w2; int tot = 0; @@ -96,8 +100,9 @@ public class PageSpeciesFlowerGenome extends PageSpecies { x += 18; } } + int numOfLines = 1 + (tot - 1) / 3; - new ControlText(contents, new Area(0, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), I18N.localise("botany.gui.database.tab.genome.varieties"), TextJustification.MiddleRight); + new ControlText(contents, new Area(0, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), I18N.localise("botany.gui.database.tab.genome.varieties"), TextJustification.MIDDLE_RIGHT); y += th; contents.setSize(new Point(contents.size().x(), y)); scrollable.setScrollableContent(contents); diff --git a/src/main/java/binnie/botany/craftgui/WindowBotanistDatabase.java b/src/main/java/binnie/botany/craftgui/WindowBotanistDatabase.java index 2055cae7..17c45635 100644 --- a/src/main/java/binnie/botany/craftgui/WindowBotanistDatabase.java +++ b/src/main/java/binnie/botany/craftgui/WindowBotanistDatabase.java @@ -11,7 +11,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import binnie.Binnie; import binnie.botany.Botany; -import binnie.botany.api.IFlowerColour; +import binnie.botany.api.IFlowerColor; import binnie.botany.genetics.EnumFlowerColor; import binnie.core.AbstractMod; import binnie.core.craftgui.IWidget; @@ -31,30 +31,30 @@ import binnie.core.craftgui.minecraft.Window; import binnie.core.util.I18N; public class WindowBotanistDatabase extends WindowAbstractDatabase { - ControlListBox selectionBoxColors; + private ControlListBox selectionBoxColors; - public WindowBotanistDatabase(final EntityPlayer player, final Side side, final boolean nei) { + public WindowBotanistDatabase(EntityPlayer player, Side side, boolean nei) { super(player, side, nei, Binnie.GENETICS.flowerBreedingSystem, 130); } - public static Window create(final EntityPlayer player, final Side side, final boolean nei) { + public static Window create(EntityPlayer player, Side side, boolean nei) { return new WindowBotanistDatabase(player, side, nei); } @Override @SideOnly(Side.CLIENT) protected void addTabs() { - new PageSpeciesOverview(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.overview", 0)); - new PageSpeciesFlowerGenome(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "genome", 0)); - new PageSpeciesClassification(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.classification", 0)); - new PageSpeciesResultant(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.resultant", 0)); - new PageSpeciesMutations(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.further", 0)); - new PageBranchOverview(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(Botany.instance, "branches.overview", 0)); - new PageBranchSpecies(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(Botany.instance, "branches.species", 0)); - this.createMode(FlowerMode.Color, new FlowerColorModeWidgets()); - new PageColorMixResultant(this.getInfoPages(FlowerMode.Color), new DatabaseTab(Botany.instance, "color.resultant", 0)); - new PageColorMix(this.getInfoPages(FlowerMode.Color), new DatabaseTab(Botany.instance, "color.further", 0)); - new PageBreeder(this.getInfoPages(Mode.BREEDER), this.getUsername(), new DatabaseTab(Botany.instance, "breeder", 0)); + new PageSpeciesOverview(getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.overview", 0)); + new PageSpeciesFlowerGenome(getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "genome", 0)); + new PageSpeciesClassification(getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.classification", 0)); + new PageSpeciesResultant(getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.resultant", 0)); + new PageSpeciesMutations(getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.further", 0)); + new PageBranchOverview(getInfoPages(Mode.BRANCHES), new DatabaseTab(Botany.instance, "branches.overview", 0)); + new PageBranchSpecies(getInfoPages(Mode.BRANCHES), new DatabaseTab(Botany.instance, "branches.species", 0)); + createMode(FlowerMode.Color, new FlowerColorModeWidgets()); + new PageColorMixResultant(getInfoPages(FlowerMode.Color), new DatabaseTab(Botany.instance, "color.resultant", 0)); + new PageColorMix(getInfoPages(FlowerMode.Color), new DatabaseTab(Botany.instance, "color.further", 0)); + new PageBreeder(getInfoPages(Mode.BREEDER), getUsername(), new DatabaseTab(Botany.instance, "breeder", 0)); } @Override @@ -72,7 +72,7 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase { @Override public String getName() { - return I18N.localise("botany.gui.database.tab." + this.name().toLowerCase()); + return I18N.localise("botany.gui.database.tab." + name().toLowerCase()); } } @@ -83,15 +83,16 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase { } @Override - public void createListBox(final Area area) { - this.listBox = new ControlListBox(this.modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12) { + public void createListBox(Area area) { + listBox = new ControlListBox(modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12) { @Override - public IWidget createOption(final IFlowerColour value, final int y) { - return new ControlColorOption(this.getContent(), value, y); + public IWidget createOption(IFlowerColor value, int y) { + return new ControlColorOption(getContent(), value, y); } }; - final List colors = Arrays.stream(EnumFlowerColor.values()).map( c -> c.getFlowerColorAllele()).collect(Collectors.toList()); - this.listBox.setOptions(colors); + + List colors = Arrays.stream(EnumFlowerColor.values()).map(c -> c.getFlowerColorAllele()).collect(Collectors.toList()); + listBox.setOptions(colors); } } } diff --git a/src/main/java/binnie/botany/farm/CircuitGarden.java b/src/main/java/binnie/botany/farm/CircuitGarden.java index f15f85ea..78d7edeb 100644 --- a/src/main/java/binnie/botany/farm/CircuitGarden.java +++ b/src/main/java/binnie/botany/farm/CircuitGarden.java @@ -23,15 +23,15 @@ public class CircuitGarden extends BinnieCircuit { public CircuitGarden(EnumMoisture moisture, @Nullable EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe, ItemStack icon) { super(getName(moisture, ph, manual, fertilised), 4, getLayout(manual), recipe); - this.isManual = manual; - this.logic = new GardenLogic(moisture, ph, this.isManual, fertilised, icon, I18N.localise(this.getUnlocalizedName())); + isManual = manual; + logic = new GardenLogic(moisture, ph, isManual, fertilised, icon, I18N.localise(getUnlocalizedName())); String info = I18N.localise("botany.moisture") + ": " + moisture.getLocalisedName(true); - if(ph != null){ - info+= TextFormatting.GRAY + ", " + I18N.localise("botany.ph") + ": " + moisture.getLocalisedName(true); + if (ph != null) { + info += TextFormatting.GRAY + ", " + I18N.localise("botany.ph") + ": " + moisture.getLocalisedName(true); } String fertilizedKey = fertilised ? "for.binnie.circuit.garden.fertilized" : "for.binnie.circuit.garden.unfertilized"; - info+= TextFormatting.GRAY + " " + I18N.localise(fertilizedKey); - this.addTooltipString(I18N.localise("for.binnie.circuit.garden.info", info)); + info += TextFormatting.GRAY + " " + I18N.localise(fertilizedKey); + addTooltipString(I18N.localise("for.binnie.circuit.garden.info", info)); } private static ICircuitLayout getLayout(boolean manual) { @@ -102,5 +102,6 @@ public class CircuitGarden extends BinnieCircuit { @Override public void onTick(int slot, Object tile) { + // ignored } } diff --git a/src/main/java/binnie/botany/farm/FarmLogic.java b/src/main/java/binnie/botany/farm/FarmLogic.java index 4d30b8f4..701f5db9 100644 --- a/src/main/java/binnie/botany/farm/FarmLogic.java +++ b/src/main/java/binnie/botany/farm/FarmLogic.java @@ -13,8 +13,8 @@ public abstract class FarmLogic implements IFarmLogic { boolean isManual; @Override - public IFarmLogic setManual(final boolean flag) { - this.isManual = flag; + public IFarmLogic setManual(boolean flag) { + isManual = flag; return this; } @@ -43,7 +43,7 @@ public abstract class FarmLogic implements IFarmLogic { return getBlock(world, pos) == Blocks.WATER; } - protected final void setBlock(World world, BlockPos pos, final Block block, final int meta) { + protected final void setBlock(World world, BlockPos pos, Block block, int meta) { world.setBlockState(pos, block.getStateFromMeta(meta), 2); } } diff --git a/src/main/java/binnie/botany/farm/FarmableFlower.java b/src/main/java/binnie/botany/farm/FarmableFlower.java index bf9d048f..81761623 100644 --- a/src/main/java/binnie/botany/farm/FarmableFlower.java +++ b/src/main/java/binnie/botany/farm/FarmableFlower.java @@ -21,7 +21,7 @@ import binnie.botany.flower.TileEntityFlower; public class FarmableFlower implements IFarmable { @Override - public boolean isSaplingAt(final World world, final BlockPos pos) { + public boolean isSaplingAt(World world, BlockPos pos) { return world.getBlockState(pos) == Botany.flower; } @@ -32,7 +32,8 @@ public class FarmableFlower implements IFarmable { if (world.getTileEntity(pos) instanceof TileEntityFlower) { flower = ((TileEntityFlower) world.getTileEntity(pos)).getFlower(); } - // Look at TileEntityFlower::onShear logic + + // TODO Look at TileEntityFlower::onShear logic if (flower != null && flower.getAge() > 1) { IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot(); ItemStack mature = flowerRoot.getMemberStack(flower, EnumFlowerStage.FLOWER); @@ -42,23 +43,22 @@ public class FarmableFlower implements IFarmable { return new FlowerCrop(pos, mature, seed); } } - return null; } @Override - public boolean isGermling(final ItemStack itemstack) { - final EnumFlowerStage stage = BotanyCore.getFlowerRoot().getType(itemstack); + public boolean isGermling(ItemStack itemstack) { + EnumFlowerStage stage = BotanyCore.getFlowerRoot().getType(itemstack); return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED; } @Override - public boolean isWindfall(final ItemStack itemstack) { + public boolean isWindfall(ItemStack itemstack) { return false; } @Override - public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final BlockPos pos) { + public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot(); IFlower flower = flowerRoot.getMember(germling); flowerRoot.plant(world, pos, flower, player.getGameProfile()); diff --git a/src/main/java/binnie/botany/farm/FarmableVanillaFlower.java b/src/main/java/binnie/botany/farm/FarmableVanillaFlower.java index 4de68a51..1fae23a0 100644 --- a/src/main/java/binnie/botany/farm/FarmableVanillaFlower.java +++ b/src/main/java/binnie/botany/farm/FarmableVanillaFlower.java @@ -11,12 +11,12 @@ import binnie.botany.core.BotanyCore; public class FarmableVanillaFlower extends FarmableFlower { @Override - public boolean isGermling(final ItemStack itemstack) { + public boolean isGermling(ItemStack itemstack) { return BotanyCore.getFlowerRoot().getConversion(itemstack) != null; } @Override - public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final BlockPos pos) { + public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot(); IFlower flower = flowerRoot.getConversion(germling); return flowerRoot.plant(world, pos, flower, player.getGameProfile()); diff --git a/src/main/java/binnie/botany/farm/GardenLogic.java b/src/main/java/binnie/botany/farm/GardenLogic.java index f51a2042..f52c918e 100644 --- a/src/main/java/binnie/botany/farm/GardenLogic.java +++ b/src/main/java/binnie/botany/farm/GardenLogic.java @@ -51,29 +51,31 @@ public class GardenLogic extends FarmLogic { private ItemStack icon; public GardenLogic(EnumMoisture moisture2, @Nullable EnumAcidity acidity2, boolean isManual, boolean isFertilised, ItemStack icon2, String name2) { - this.produce = NonNullList.create(); - (this.farmables = new ArrayList<>()).add(new FarmableFlower()); - this.farmables.add(new FarmableVanillaFlower()); - this.moisture = moisture2; - this.acidity = acidity2; this.isManual = isManual; - this.fertilised = isFertilised; - this.icon = icon2; - this.name = name2; + produce = NonNullList.create(); + farmables = new ArrayList<>(); + farmables.add(new FarmableFlower()); + farmables.add(new FarmableVanillaFlower()); + + moisture = moisture2; + acidity = acidity2; + fertilised = isFertilised; + icon = icon2; + name = name2; } @Override public int getFertilizerConsumption() { - return this.fertilised ? 8 : 2; + return fertilised ? 8 : 2; } @Override - public int getWaterConsumption(final float hydrationModifier) { - return (int) (this.moisture.ordinal() * 40 * hydrationModifier); + public int getWaterConsumption(float hydrationModifier) { + return (int) (moisture.ordinal() * 40 * hydrationModifier); } @Override - public boolean isAcceptedResource(final ItemStack itemstack) { + public boolean isAcceptedResource(ItemStack itemstack) { IGardeningManager gardening = BotanyCore.getGardening(); return gardening.isSoil(itemstack.getItem()) || itemstack.getItem() == Item.getItemFromBlock(Blocks.SAND) || @@ -84,19 +86,19 @@ public class GardenLogic extends FarmLogic { @Override public NonNullList collect(World world, IFarmHousing farmHousing) { - final NonNullList products = this.produce; - this.produce = NonNullList.create(); + NonNullList products = produce; + produce = NonNullList.create(); return products; } @Override public boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) { - return this.maintainSoil(world, pos, direction, extent, farmHousing) || - (!this.isManual && this.maintainWater(world, pos, direction, extent, farmHousing)) || - this.maintainCrops(world, pos.up(), direction, extent, farmHousing); + return maintainSoil(world, pos, direction, extent, farmHousing) || + (!isManual && maintainWater(world, pos, direction, extent, farmHousing)) || + maintainCrops(world, pos.up(), direction, extent, farmHousing); } - private boolean isWaste(final ItemStack stack) { + private boolean isWaste(ItemStack stack) { return stack.getItem() == Item.getItemFromBlock(Blocks.DIRT); } @@ -104,20 +106,21 @@ public class GardenLogic extends FarmLogic { IGardeningManager gardening = BotanyCore.getGardening(); for (int i = 0; i < extent; ++i) { BlockPos position = pos.offset(direction.getFacing(), i); - if (this.fertilised && gardening.isSoil(getBlock(world, position))) { + if (fertilised && gardening.isSoil(getBlock(world, position))) { IBlockSoil soil = (IBlockSoil) getBlock(world, position); if (soil.fertilise(world, position, EnumSoilType.FLOWERBED)) { continue; } } + if (getBlock(world, position.up()) == Botany.plant) { world.setBlockToAir(position.up()); } else { - if (this.acidity != null && gardening.isSoil(getBlock(world, position))) { + if (acidity != null && gardening.isSoil(getBlock(world, position))) { IBlockSoil soil = (IBlockSoil) getBlock(world, position); EnumAcidity pH = soil.getPH(world, position); - if (pH.ordinal() < this.acidity.ordinal()) { - ItemStack stack = this.getAvailableAlkaline(housing); + if (pH.ordinal() < acidity.ordinal()) { + ItemStack stack = getAvailableAlkaline(housing); if (!stack.isEmpty() && soil.setPH(world, position, EnumAcidity.values()[pH.ordinal() + 1])) { NonNullList resources = NonNullList.create(); resources.add(stack); @@ -125,8 +128,8 @@ public class GardenLogic extends FarmLogic { continue; } } - if (pH.ordinal() > this.acidity.ordinal()) { - final ItemStack stack = this.getAvailableAcid(housing); + if (pH.ordinal() > acidity.ordinal()) { + ItemStack stack = getAvailableAcid(housing); if (!stack.isEmpty() && soil.setPH(world, position, EnumAcidity.values()[pH.ordinal() - 1])) { NonNullList resources = NonNullList.create(); resources.add(stack); @@ -135,16 +138,17 @@ public class GardenLogic extends FarmLogic { } } } - if (!this.isAirBlock(world, position) && !BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) { - ItemStack block = this.getAsItemStack(world, position); - ItemStack loam = this.getAvailableLoam(housing); - if (this.isWaste(block) && !loam.isEmpty()) { - this.produce.addAll(Blocks.DIRT.getDrops(world, position, Block.getBlockFromItem(block.getItem()).getStateFromMeta(block.getItemDamage()), 0)); - this.setBlock(world, position, Blocks.AIR, 0); + + if (!isAirBlock(world, position) && !BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) { + ItemStack block = getAsItemStack(world, position); + ItemStack loam = getAvailableLoam(housing); + if (isWaste(block) && !loam.isEmpty()) { + produce.addAll(Blocks.DIRT.getDrops(world, position, Block.getBlockFromItem(block.getItem()).getStateFromMeta(block.getItemDamage()), 0)); + setBlock(world, position, Blocks.AIR, 0); return trySetSoil(world, position, loam, housing); } - } else if (!this.isManual) { - if (!this.isWaterBlock(world, position)) { + } else if (!isManual) { + if (!isWaterBlock(world, position)) { if (i % 2 == 0) { return trySetSoil(world, position, housing); } @@ -157,9 +161,9 @@ public class GardenLogic extends FarmLogic { cclock = FarmDirection.SOUTH; } BlockPos previous = position.offset(cclock.getFacing()); - final ItemStack soil2 = this.getAsItemStack(world, previous); + ItemStack soil2 = getAsItemStack(world, previous); if (!gardening.isSoil(soil2.getItem())) { - this.trySetSoil(world, position, housing); + trySetSoil(world, position, housing); } } } @@ -171,23 +175,27 @@ public class GardenLogic extends FarmLogic { private boolean maintainWater(World world, BlockPos pos, FarmDirection direction, int extent, IFarmHousing housing) { for (int i = 0; i < extent; ++i) { BlockPos position = pos.offset(direction.getFacing(), i); - if (this.isAirBlock(world, position) || BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) { - if (!this.isWaterBlock(world, position)) { - boolean isEnclosed = true; - if (world.isAirBlock(position.east())) { - isEnclosed = false; - } else if (world.isAirBlock(position.west())) { - isEnclosed = false; - } else if (world.isAirBlock(position.south())) { - isEnclosed = false; - } else if (world.isAirBlock(position.north())) { - isEnclosed = false; - } - isEnclosed = (isEnclosed || this.moisture != EnumMoisture.DAMP); - if (isEnclosed) { - return this.trySetWater(world, position, housing); - } - } + if (!isAirBlock(world, position) && !BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) { + continue; + } + if (isWaterBlock(world, position)) { + continue; + } + + boolean isEnclosed = true; + if (world.isAirBlock(position.east())) { + isEnclosed = false; + } else if (world.isAirBlock(position.west())) { + isEnclosed = false; + } else if (world.isAirBlock(position.south())) { + isEnclosed = false; + } else if (world.isAirBlock(position.north())) { + isEnclosed = false; + } + + isEnclosed = (isEnclosed || moisture != EnumMoisture.DAMP); + if (isEnclosed) { + return trySetWater(world, position, housing); } } return false; @@ -195,19 +203,37 @@ public class GardenLogic extends FarmLogic { private ItemStack getAvailableLoam(IFarmHousing housing) { EnumMoisture[] moistures; - if (this.moisture == EnumMoisture.DAMP) { - moistures = new EnumMoisture[]{EnumMoisture.DAMP, EnumMoisture.NORMAL, EnumMoisture.DRY}; - } else if (this.moisture == EnumMoisture.DRY) { - moistures = new EnumMoisture[]{EnumMoisture.DRY, EnumMoisture.DAMP, EnumMoisture.DRY}; + if (moisture == EnumMoisture.DAMP) { + moistures = new EnumMoisture[]{ + EnumMoisture.DAMP, + EnumMoisture.NORMAL, + EnumMoisture.DRY + }; + } else if (moisture == EnumMoisture.DRY) { + moistures = new EnumMoisture[]{ + EnumMoisture.DRY, + EnumMoisture.DAMP, + EnumMoisture.DRY + }; } else { - moistures = new EnumMoisture[]{EnumMoisture.DRY, EnumMoisture.NORMAL, EnumMoisture.DAMP}; + moistures = new EnumMoisture[]{ + EnumMoisture.DRY, + EnumMoisture.NORMAL, + EnumMoisture.DAMP + }; } - final EnumAcidity[] acidities = {EnumAcidity.NEUTRAL, EnumAcidity.ACID, EnumAcidity.ALKALINE}; - for (final EnumMoisture moist : moistures) { - for (final EnumAcidity acid : acidities) { - for (final Block type : new Block[]{Botany.flowerbed, Botany.loam, Botany.soil}) { - final int meta = acid.ordinal() * 3 + moist.ordinal(); - final NonNullList resources = NonNullList.create(); + + EnumAcidity[] acidities = { + EnumAcidity.NEUTRAL, + EnumAcidity.ACID, + EnumAcidity.ALKALINE + }; + + for (EnumMoisture moist : moistures) { + for (EnumAcidity acid : acidities) { + for (Block type : new Block[]{Botany.flowerbed, Botany.loam, Botany.soil}) { + int meta = acid.ordinal() * 3 + moist.ordinal(); + NonNullList resources = NonNullList.create(); ItemStack resourceStack = new ItemStack(type, 1, meta); resources.add(resourceStack); if (housing.getFarmInventory().hasResources(resources)) { @@ -216,7 +242,8 @@ public class GardenLogic extends FarmLogic { } } } - final NonNullList resources = NonNullList.create(); + + NonNullList resources = NonNullList.create(); ItemStack resourceStack = new ItemStack(Blocks.DIRT); resources.add(resourceStack); if (housing.getFarmInventory().hasResources(resources)) { @@ -226,56 +253,58 @@ public class GardenLogic extends FarmLogic { } private boolean trySetSoil(World world, BlockPos position, IFarmHousing housing) { - return this.trySetSoil(world, position, this.getAvailableLoam(housing), housing); + return trySetSoil(world, position, getAvailableLoam(housing), housing); } private boolean trySetSoil(World world, BlockPos position, ItemStack loam, IFarmHousing housing) { ItemStack copy = loam; - if (!loam.isEmpty()) { - if (loam.getItem() == Item.getItemFromBlock(Blocks.DIRT)) { - loam = new ItemStack(Botany.soil, 1, 4); - } - setBlock(world, position, ((ItemBlock) loam.getItem()).getBlock(), loam.getItemDamage()); - final NonNullList resources = NonNullList.create(); - resources.add(copy); - housing.getFarmInventory().removeResources(resources); - return true; + if (loam.isEmpty()) { + return false; } - return false; + + if (loam.getItem() == Item.getItemFromBlock(Blocks.DIRT)) { + loam = new ItemStack(Botany.soil, 1, 4); + } + + setBlock(world, position, ((ItemBlock) loam.getItem()).getBlock(), loam.getItemDamage()); + NonNullList resources = NonNullList.create(); + resources.add(copy); + housing.getFarmInventory().removeResources(resources); + return true; } private boolean trySetWater(World world, BlockPos position, IFarmHousing housing) { - final FluidStack water = Binnie.LIQUID.getFluidStack(ManagerLiquid.WATER, 1000); - if (this.moisture == EnumMoisture.DAMP) { + FluidStack water = Binnie.LIQUID.getFluidStack(ManagerLiquid.WATER, 1000); + if (moisture == EnumMoisture.DAMP) { if (water == null || !housing.hasLiquid(water)) { return false; } - this.setBlock(world, position, Blocks.WATER, 0); + setBlock(world, position, Blocks.WATER, 0); housing.removeLiquid(water); return true; - } else { - if (this.moisture != EnumMoisture.DRY) { - return trySetSoil(world, position, housing); - } - final ItemStack sand = new ItemStack(Blocks.SAND, 1); - final NonNullList resources = NonNullList.create(); - resources.add(sand); - if (!housing.getFarmInventory().hasResources(resources)) { - return false; - } - this.setBlock(world, position, Blocks.SAND, 0); - housing.getFarmInventory().removeResources(resources); - return true; } + + if (moisture != EnumMoisture.DRY) { + return trySetSoil(world, position, housing); + } + ItemStack sand = new ItemStack(Blocks.SAND, 1); + NonNullList resources = NonNullList.create(); + resources.add(sand); + if (!housing.getFarmInventory().hasResources(resources)) { + return false; + } + setBlock(world, position, Blocks.SAND, 0); + housing.getFarmInventory().removeResources(resources); + return true; } - public void setIcon(final ItemStack icon) { + public void setIcon(ItemStack icon) { this.icon = icon; } @Override - public boolean isAcceptedGermling(final ItemStack itemstack) { - for (final IFarmable farmable : this.farmables) { + public boolean isAcceptedGermling(ItemStack itemstack) { + for (IFarmable farmable : farmables) { if (farmable.isGermling(itemstack)) { return true; } @@ -287,10 +316,9 @@ public class GardenLogic extends FarmLogic { public Collection harvest(World world, BlockPos pos, FarmDirection direction, int extent) { if (isManual) { return Collections.emptyList(); - } else { - return farmables.stream().map(farmable -> farmable.getCropAt(world, pos.up(), world.getBlockState(pos.up()))) - .filter(Objects::nonNull).collect(Collectors.toList()); } + return farmables.stream().map(farmable -> farmable.getCropAt(world, pos.up(), world.getBlockState(pos.up()))) + .filter(Objects::nonNull).collect(Collectors.toList()); } @Override @@ -300,7 +328,7 @@ public class GardenLogic extends FarmLogic { @Override public String getName() { - return this.name; + return name; } @Override @@ -312,8 +340,8 @@ public class GardenLogic extends FarmLogic { IGardeningManager gardening = BotanyCore.getGardening(); for (int i = 0; i < extent; ++i) { BlockPos position = pos.offset(direction.getFacing(), i); - if (this.isAirBlock(world, position) || BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) { - ItemStack below = this.getAsItemStack(world, position.down()); + if (isAirBlock(world, position) || BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) { + ItemStack below = getAsItemStack(world, position.down()); if (gardening.isSoil(below.getItem())) { return trySetCrop(world, position, housing); } @@ -323,27 +351,29 @@ public class GardenLogic extends FarmLogic { } private boolean trySetCrop(World world, BlockPos position, IFarmHousing housing) { - for (IFarmable farmable : this.farmables) { - if (housing.plantGermling(farmable, world, position)) { - if (housing instanceof IOwnedTile) { - TileEntity tile = world.getTileEntity(position); - if (tile instanceof TileEntityFlower) { - TileEntityFlower flower = (TileEntityFlower) tile; - IOwnedTile owned = (IOwnedTile) housing; - - flower.setOwner(owned.getOwnerHandler().getOwner()); - } - } - return true; + for (IFarmable farmable : farmables) { + if (!housing.plantGermling(farmable, world, position)) { + continue; } + + if (housing instanceof IOwnedTile) { + TileEntity tile = world.getTileEntity(position); + if (tile instanceof TileEntityFlower) { + TileEntityFlower flower = (TileEntityFlower) tile; + IOwnedTile owned = (IOwnedTile) housing; + + flower.setOwner(owned.getOwnerHandler().getOwner()); + } + } + return true; } return false; } public ItemStack getAvailableAcid(IFarmHousing housing) { - for (final ItemStack stack : BotanyCore.getGardening().getAcidFertilisers()) { + for (ItemStack stack : BotanyCore.getGardening().getAcidFertilisers()) { if (!stack.isEmpty()) { - final NonNullList resources = NonNullList.create(); + NonNullList resources = NonNullList.create(); resources.add(stack); if (housing.getFarmInventory().hasResources(resources)) { return stack; @@ -354,9 +384,9 @@ public class GardenLogic extends FarmLogic { } public ItemStack getAvailableAlkaline(IFarmHousing housing) { - for (final ItemStack stack : BotanyCore.getGardening().getAlkalineFertilisers()) { + for (ItemStack stack : BotanyCore.getGardening().getAlkalineFertilisers()) { if (!stack.isEmpty()) { - final NonNullList resources = NonNullList.create(); + NonNullList resources = NonNullList.create(); resources.add(stack); if (housing.getFarmInventory().hasResources(resources)) { return stack; diff --git a/src/main/java/binnie/botany/flower/BlockFlower.java b/src/main/java/binnie/botany/flower/BlockFlower.java index 8248fb4f..c9ac0efd 100644 --- a/src/main/java/binnie/botany/flower/BlockFlower.java +++ b/src/main/java/binnie/botany/flower/BlockFlower.java @@ -53,7 +53,7 @@ import binnie.core.util.TileUtil; public class BlockFlower extends BlockContainer implements IColoredBlock, IStateMapperRegister { public static final AxisAlignedBB FLOWER_BLOCK_AABB = new AxisAlignedBB(0.3D, 0.0D, 0.3D, 0.7D, 0.6D, 0.7D); - /* PROPERTYS */ + /* PROPERTIES */ public static final PropertyFlower FLOWER = new PropertyFlower("flower", IFlowerType.class); public static final PropertyInteger SECTION = PropertyInteger.create("section", 0, EnumFlowerType.highestSection - 1); public static final PropertyBool FLOWERED = PropertyBool.create("flowered"); @@ -61,14 +61,13 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState public BlockFlower() { super(Material.PLANTS); - final float f = 0.2f; - this.setTickRandomly(true); - this.setRegistryName("flower"); - this.setSoundType(SoundType.PLANT); + setTickRandomly(true); + setRegistryName("flower"); + setSoundType(SoundType.PLANT); } @Override - public TileEntity createNewTileEntity(final World var1, final int i) { + public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityFlower(); } @@ -81,31 +80,36 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = player.getHeldItemMainhand(); - if (!heldItem.isEmpty() && heldItem.getItem() == BinnieCore.getFieldKit() && player.isSneaking()) { - if (world.isRemote) { - return true; - } - TileEntity tile = world.getTileEntity(pos); - if (tile instanceof TileEntityFlower) { - TileEntityFlower tileFlower = (TileEntityFlower) tile; - IFlower flower = tileFlower.getFlower(); - if (flower != null) { - IFlowerGenome flowerGenome = flower.getGenome(); - NBTTagCompound info = new NBTTagCompound(); - info.setString("Species", flowerGenome.getPrimary().getUID()); - info.setString("Species2", flowerGenome.getSecondary().getUID()); - info.setFloat("Age", flower.getAge() / flowerGenome.getLifespan()); - info.setShort("Colour", (short) flowerGenome.getPrimaryColor().getID()); - info.setShort("Colour2", (short) flowerGenome.getSecondaryColor().getID()); - info.setBoolean("Wilting", flower.isWilted()); - info.setBoolean("Flowered", flower.hasFlowered()); - Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FIELDKIT.ordinal(), info), player); - heldItem.damageItem(1, player); - } - } + if (heldItem.isEmpty() || heldItem.getItem() != BinnieCore.getFieldKit() || !player.isSneaking()) { + return false; + } + if (world.isRemote) { return true; } - return false; + + TileEntity tile = world.getTileEntity(pos); + if (!(tile instanceof TileEntityFlower)) { + return true; + } + + TileEntityFlower tileFlower = (TileEntityFlower) tile; + IFlower flower = tileFlower.getFlower(); + if (flower == null) { + return true; + } + + IFlowerGenome flowerGenome = flower.getGenome(); + NBTTagCompound info = new NBTTagCompound(); + info.setString("Species", flowerGenome.getPrimary().getUID()); + info.setString("Species2", flowerGenome.getSecondary().getUID()); + info.setFloat("Age", flower.getAge() / flowerGenome.getLifespan()); + info.setShort("Colour", (short) flowerGenome.getPrimaryColor().getID()); + info.setShort("Colour2", (short) flowerGenome.getSecondaryColor().getID()); + info.setBoolean("Wilting", flower.isWilted()); + info.setBoolean("Flowered", flower.hasFlowered()); + Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FIELDKIT.ordinal(), info), player); + heldItem.damageItem(1, player); + return true; } @Override @@ -152,22 +156,23 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { super.onBlockPlacedBy(world, pos, state, placer, stack); IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot(); - final TileEntity flower = world.getTileEntity(pos); + TileEntity flower = world.getTileEntity(pos); if (!BinnieCore.getBinnieProxy().isSimulating(world)) { if (flower != null && flower instanceof TileEntityFlower) { - final IFlower f = flowerRoot.getMember(stack); + IFlower f = flowerRoot.getMember(stack); if (f != null) { ((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower)); } } return; } - final TileEntity below = world.getTileEntity(pos.down()); + + TileEntity below = world.getTileEntity(pos.down()); if (flower != null && flower instanceof TileEntityFlower) { if (below instanceof TileEntityFlower) { ((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection()); } else { - final GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null; + GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null; ((TileEntityFlower) flower).create(stack, owner); } } @@ -185,9 +190,8 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState return flower.getStemColour(); } else if (tintIndex == 1) { return flower.getPrimaryColour(); - } else { - return flower.getSecondaryColour(); } + return flower.getSecondaryColour(); } } return 0xffffff; @@ -204,11 +208,14 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) { return downState.getBlock() == Botany.flower; } - return this.canPlaceBlockOn(downState.getBlock()); + return canPlaceBlockOn(downState.getBlock()); } - protected boolean canPlaceBlockOn(final Block block) { - return block == Blocks.GRASS || block == Blocks.DIRT || block == Blocks.FARMLAND || BotanyCore.getGardening().isSoil(block); + protected boolean canPlaceBlockOn(Block block) { + return block == Blocks.GRASS + || block == Blocks.DIRT + || block == Blocks.FARMLAND + || BotanyCore.getGardening().isSoil(block); } @Override @@ -257,12 +264,12 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState @Override public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { - this.checkAndDropBlock(worldIn, pos); - final TileEntity tile = worldIn.getTileEntity(pos); + checkAndDropBlock(worldIn, pos); + TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityFlower) { - final TileEntityFlower flower = (TileEntityFlower) tile; + TileEntityFlower flower = (TileEntityFlower) tile; if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && worldIn.getBlockState(pos.up()).getBlock() != Botany.flower) { - this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); + dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); worldIn.setBlockToAir(pos); } } @@ -270,18 +277,18 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState @Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { - final TileEntity tile = world.getTileEntity(pos); + TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityFlower) { ((TileEntityFlower) tile).randomUpdate(rand); - this.checkAndDropBlock(world, pos); + checkAndDropBlock(world, pos); return; } world.setBlockToAir(pos); } - protected void checkAndDropBlock(final World world, final BlockPos pos) { - if (!this.canBlockStay(world, pos)) { - this.dropBlockAsItem(world, pos, world.getBlockState(pos), 0); + protected void checkAndDropBlock(World world, BlockPos pos) { + if (!canBlockStay(world, pos)) { + dropBlockAsItem(world, pos, world.getBlockState(pos), 0); world.setBlockToAir(pos); } } @@ -301,10 +308,10 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState @Override public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { - final List drops = this.getDrops(world, pos, world.getBlockState(pos), 0); - final boolean hasBeenBroken = world.setBlockToAir(pos); + List drops = getDrops(world, pos, world.getBlockState(pos), 0); + boolean hasBeenBroken = world.setBlockToAir(pos); if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) { - for (final ItemStack drop : drops) { + for (ItemStack drop : drops) { spawnAsEntity(world, pos, drop); } } diff --git a/src/main/java/binnie/botany/flower/EnumTubeInsulate.java b/src/main/java/binnie/botany/flower/EnumTubeInsulate.java index 84823ef4..acdcecdd 100644 --- a/src/main/java/binnie/botany/flower/EnumTubeInsulate.java +++ b/src/main/java/binnie/botany/flower/EnumTubeInsulate.java @@ -6,19 +6,19 @@ import net.minecraft.item.ItemStack; import binnie.core.util.I18N; enum EnumTubeInsulate { - Clay(0xa1aacc, "clay"), - Cobble(0x7b7b7b, "cobblestone"), - Sand(0xefeab5, "sandstone"), - HardenedClay(0x935c43, "hardened_clay"), - Stone(0x6d6d6d, "stone"), - Sandstone(0xc1b989, "sandstone"); + CLAY(0xa1aacc, "clay"), + COBBLE(0x7b7b7b, "cobblestone"), + SAND(0xefeab5, "sandstone"), + HARDENED_CLAY(0x935c43, "hardened_clay"), + STONE(0x6d6d6d, "stone"), + SANDSTONE(0xc1b989, "sandstone"); public static final EnumTubeInsulate[] VALUES = values(); - + int color; String name; - EnumTubeInsulate(final int color, final String name) { + EnumTubeInsulate(int color, String name) { this.color = color; this.name = name; } @@ -28,7 +28,7 @@ enum EnumTubeInsulate { } public int getColor() { - return this.color; + return color; } public String getDisplayName() { @@ -37,27 +37,24 @@ enum EnumTubeInsulate { public ItemStack getStack() { switch (this) { - case Clay: { + case CLAY: return new ItemStack(Blocks.CLAY); - } - case Cobble: { + + case COBBLE: return new ItemStack(Blocks.COBBLESTONE); - } - case HardenedClay: { + + case HARDENED_CLAY: return new ItemStack(Blocks.HARDENED_CLAY); - } - case Sand: { + + case SAND: return new ItemStack(Blocks.SAND); - } - case Sandstone: { + + case SANDSTONE: return new ItemStack(Blocks.SANDSTONE); - } - case Stone: { + + case STONE: return new ItemStack(Blocks.STONE); - } - default: { - throw new IllegalStateException("Unknown insulated tube type: " + this); - } } + throw new IllegalStateException("Unknown insulated tube type: " + this); } } diff --git a/src/main/java/binnie/botany/flower/EnumTubeMaterial.java b/src/main/java/binnie/botany/flower/EnumTubeMaterial.java index 1a8d8405..cf6e31d6 100644 --- a/src/main/java/binnie/botany/flower/EnumTubeMaterial.java +++ b/src/main/java/binnie/botany/flower/EnumTubeMaterial.java @@ -3,17 +3,17 @@ package binnie.botany.flower; import binnie.core.util.I18N; enum EnumTubeMaterial { - Copper(0xe3b78e, "copper"), - Tin(0xe1eef4, "tin"), - Bronze(0xddc276, "bronze"), - Iron(0xd8d8d8, "iron"); + COPPER(0xe3b78e, "copper"), + TIN(0xe1eef4, "tin"), + BRONZE(0xddc276, "bronze"), + IRON(0xd8d8d8, "iron"); public static final EnumTubeMaterial[] VALUES = values(); - + int color; String name; - EnumTubeMaterial(final int color, final String name) { + EnumTubeMaterial(int color, String name) { this.color = color; this.name = name; } @@ -23,9 +23,9 @@ enum EnumTubeMaterial { } public int getColor() { - return this.color; + return color; } - + public String getDisplayName() { return I18N.localise("botany.tube.material." + name + ".name"); } diff --git a/src/main/java/binnie/botany/flower/FlowerSpriteManager.java b/src/main/java/binnie/botany/flower/FlowerSpriteManager.java index 5858f068..30c44abc 100644 --- a/src/main/java/binnie/botany/flower/FlowerSpriteManager.java +++ b/src/main/java/binnie/botany/flower/FlowerSpriteManager.java @@ -62,18 +62,18 @@ public class FlowerSpriteManager { private int sections; public FlowerSprites(IFlowerType type) { - this.sections = type.getSections(); - this.stem = new BinnieSprite[sections]; - this.petal = new BinnieSprite[sections]; - this.variant = new BinnieSprite[sections]; - this.unflowered = new BinnieSprite[sections]; + sections = type.getSections(); + stem = new BinnieSprite[sections]; + petal = new BinnieSprite[sections]; + variant = new BinnieSprite[sections]; + unflowered = new BinnieSprite[sections]; for (int section = 0; section < sections; ++section) { - final String suf = (section == 0) ? "" : ("" + (section + 1)); - final String pre = (sections == 1) ? "" : "double/"; - this.stem[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".0"); - this.petal[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".1"); - this.variant[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".2"); - this.unflowered[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".3"); + String suf = (section == 0) ? "" : ("" + (section + 1)); + String pre = (sections == 1) ? "" : "double/"; + stem[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".0"); + petal[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".1"); + variant[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".2"); + unflowered[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".3"); } } @@ -84,13 +84,13 @@ public class FlowerSpriteManager { @SideOnly(Side.CLIENT) public TextureAtlasSprite getPetal(IFlowerType type, int section, boolean flowered) { - return (flowered ? petal[section % this.sections] : this.unflowered[section % this.sections]).getSprite(); + return (flowered ? petal[section % sections] : unflowered[section % sections]).getSprite(); } @Nullable @SideOnly(Side.CLIENT) public TextureAtlasSprite getVariant(IFlowerType type, int section, boolean flowered) { - return flowered ? variant[section % this.sections].getSprite() : null; + return flowered ? variant[section % sections].getSprite() : null; } } } diff --git a/src/main/java/binnie/botany/flower/ItemBotany.java b/src/main/java/binnie/botany/flower/ItemBotany.java index 8b619a8e..cce76fa6 100644 --- a/src/main/java/binnie/botany/flower/ItemBotany.java +++ b/src/main/java/binnie/botany/flower/ItemBotany.java @@ -54,13 +54,13 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister private EnumFlowerStage type; private String tag; - public ItemBotany(final String name, EnumFlowerStage type, String tag) { - this.setCreativeTab(CreativeTabBotany.instance); - this.setUnlocalizedName(name); - setRegistryName(name); - this.hasSubtypes = true; + public ItemBotany(String name, EnumFlowerStage type, String tag) { this.type = type; this.tag = tag; + setCreativeTab(CreativeTabBotany.instance); + setUnlocalizedName(name); + setRegistryName(name); + hasSubtypes = true; } @Override @@ -79,22 +79,23 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister } @Override - public boolean hasEffect(final ItemStack itemstack) { + public boolean hasEffect(ItemStack itemstack) { if (!itemstack.hasTagCompound()) { return false; } - final IIndividual individual = this.getIndividual(itemstack); + IIndividual individual = getIndividual(itemstack); return individual != null && individual.hasEffect(); } @Override @SideOnly(Side.CLIENT) - public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List list, final boolean flag) { - IFlower individual = (IFlower) this.getIndividual(itemStack); + public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean flag) { + IFlower individual = (IFlower) getIndividual(itemStack); if (individual == null) { list.add(TextFormatting.DARK_RED + I18N.localise("item.botany.flower.destroy")); return; } + IFlowerGenome genome = individual.getGenome(); //Colors String primaryColor = genome.getPrimaryColor().getColorName(); @@ -120,7 +121,7 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister } @Nullable - protected IIndividual getIndividual(final ItemStack itemstack) { + protected IIndividual getIndividual(ItemStack itemstack) { NBTTagCompound tagCompound = itemstack.getTagCompound(); if (tagCompound == null) { return null; @@ -128,8 +129,8 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister return new Flower(tagCompound); } - private IAlleleFlowerSpecies getPrimarySpecies(final ItemStack itemstack) { - final IFlower tree = BotanyCore.getFlowerRoot().getMember(itemstack); + private IAlleleFlowerSpecies getPrimarySpecies(ItemStack itemstack) { + IFlower tree = BotanyCore.getFlowerRoot().getMember(itemstack); if (tree == null) { return (IAlleleFlowerSpecies) BotanyCore.getFlowerRoot().getDefaultTemplate()[EnumFlowerChromosome.SPECIES.ordinal()]; } @@ -137,11 +138,11 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister } @Override - public String getItemStackDisplayName(final ItemStack itemstack) { + public String getItemStackDisplayName(ItemStack itemstack) { if (!itemstack.hasTagCompound()) { return I18N.localise("item.botany.flower.corrupted.name"); } - IIndividual individual = this.getIndividual(itemstack); + IIndividual individual = getIndividual(itemstack); if (individual != null) { return individual.getDisplayName() + (!tag.isEmpty() ? " " + I18N.localise("item.botany." + tag + ".name") : ""); } @@ -149,12 +150,12 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister } @Override - public void getSubItems(final Item item, final CreativeTabs tab, final NonNullList itemList) { - this.addCreativeItems(itemList, true); + public void getSubItems(Item item, CreativeTabs tab, NonNullList itemList) { + addCreativeItems(itemList, true); } - public void addCreativeItems(final NonNullList itemList, final boolean hideSecrets) { - for (final IIndividual individual : BotanyCore.getFlowerRoot().getIndividualTemplates()) { + public void addCreativeItems(NonNullList itemList, boolean hideSecrets) { + for (IIndividual individual : BotanyCore.getFlowerRoot().getIndividualTemplates()) { if (hideSecrets && individual.isSecret() && !Config.isDebug) { continue; } @@ -166,9 +167,14 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister public int getColorFromItemstack(ItemStack stack, int tintIndex) { IFlower flower = BotanyCore.getFlowerRoot().getMember(stack); if (flower == null) { - return 16777215; + return 0xffffff; } - return (tintIndex == 0) ? flower.getGenome().getStemColor().getColor(flower.isWilted()) : ((tintIndex == 1) ? flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) : flower.getGenome().getSecondaryColor().getColor(flower.isWilted())); + if (tintIndex == 0) { + return flower.getGenome().getStemColor().getColor(flower.isWilted()); + } + return (tintIndex == 1) + ? flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) + : flower.getGenome().getSecondaryColor().getColor(flower.isWilted()); } @Override @@ -184,12 +190,12 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (type == EnumFlowerStage.POLLEN) { - final IFlower flower = Binnie.GENETICS.getFlowerRoot().getMember(stack); - final TileEntity target = world.getTileEntity(pos); + IFlower flower = Binnie.GENETICS.getFlowerRoot().getMember(stack); + TileEntity target = world.getTileEntity(pos); if (!(target instanceof IPollinatable)) { return EnumActionResult.PASS; } - final IPollinatable pollinatable = (IPollinatable) target; + IPollinatable pollinatable = (IPollinatable) target; if (!pollinatable.canMateWith(flower)) { return EnumActionResult.FAIL; } @@ -198,29 +204,28 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister stack.shrink(1); } return EnumActionResult.SUCCESS; - } else { - IBlockState iblockstate = world.getBlockState(pos); - Block block = iblockstate.getBlock(); - - if (!block.isReplaceable(world, pos)) { - pos = pos.offset(facing); - } - - if (stack.getCount() != 0 && player.canPlayerEdit(pos, facing, stack) && world.mayPlace(Botany.flower, pos, false, facing, null)) { - int i = this.getMetadata(stack.getMetadata()); - IBlockState iblockstate1 = Botany.flower.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, i, player, hand); - - if (placeBlockAt(stack, player, world, pos, facing, hitX, hitY, hitZ, iblockstate1)) { - SoundType soundtype = world.getBlockState(pos).getBlock().getSoundType(world.getBlockState(pos), world, pos, player); - world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); - stack.shrink(1); - } - - return EnumActionResult.SUCCESS; - } else { - return EnumActionResult.FAIL; - } } + + IBlockState iblockstate = world.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (!block.isReplaceable(world, pos)) { + pos = pos.offset(facing); + } + + if (stack.getCount() != 0 && player.canPlayerEdit(pos, facing, stack) && world.mayPlace(Botany.flower, pos, false, facing, null)) { + int i = getMetadata(stack.getMetadata()); + IBlockState iblockstate1 = Botany.flower.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, i, player, hand); + + if (placeBlockAt(stack, player, world, pos, facing, hitX, hitY, hitZ, iblockstate1)) { + SoundType soundtype = world.getBlockState(pos).getBlock().getSoundType(world.getBlockState(pos), world, pos, player); + world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); + stack.shrink(1); + } + + return EnumActionResult.SUCCESS; + } + return EnumActionResult.FAIL; } public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) { diff --git a/src/main/java/binnie/botany/flower/ItemInsulatedTube.java b/src/main/java/binnie/botany/flower/ItemInsulatedTube.java index e09ebeed..db3a4cb9 100644 --- a/src/main/java/binnie/botany/flower/ItemInsulatedTube.java +++ b/src/main/java/binnie/botany/flower/ItemInsulatedTube.java @@ -112,6 +112,10 @@ public class ItemInsulatedTube extends ItemCore implements IColoredItem { @Override public String getItemStackDisplayName(ItemStack itemStack) { int meta = itemStack.getMetadata(); - return I18N.localise("item.botany.insulated_tube.name", EnumTubeMaterial.get(meta).getDisplayName(), EnumTubeInsulate.get(meta).getDisplayName()); + return I18N.localise( + "item.botany.insulated_tube.name", + EnumTubeMaterial.get(meta).getDisplayName(), + EnumTubeInsulate.get(meta).getDisplayName() + ); } } diff --git a/src/main/java/binnie/botany/flower/StateMapperFlower.java b/src/main/java/binnie/botany/flower/StateMapperFlower.java index d902785d..3e06d73a 100644 --- a/src/main/java/binnie/botany/flower/StateMapperFlower.java +++ b/src/main/java/binnie/botany/flower/StateMapperFlower.java @@ -19,13 +19,14 @@ import binnie.botany.api.IFlowerType; public class StateMapperFlower extends StateMapperBase { @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { - final Map, Comparable> properties = Maps.newLinkedHashMap(state.getProperties()); + Map, Comparable> properties = Maps.newLinkedHashMap(state.getProperties()); IFlowerType flowerType = (IFlowerType) state.getValue(BlockFlower.FLOWER); if (flowerType.getSections() < 2) { properties.remove(BlockFlower.SECTION); } else if (flowerType.getSections() <= state.getValue(BlockFlower.SECTION)) { properties.put(BlockFlower.SECTION, flowerType.getSections() - 1); } + if (state.getValue(BlockFlower.SEED)) { properties.remove(BlockFlower.SECTION); properties.remove(BlockFlower.FLOWER); @@ -33,7 +34,6 @@ public class StateMapperFlower extends StateMapperBase { } else { properties.remove(BlockFlower.SEED); } - return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":flower", getPropertyString(properties)); } } diff --git a/src/main/java/binnie/botany/flower/TileEntityFlower.java b/src/main/java/binnie/botany/flower/TileEntityFlower.java index f87a5bae..0ad576dd 100644 --- a/src/main/java/binnie/botany/flower/TileEntityFlower.java +++ b/src/main/java/binnie/botany/flower/TileEntityFlower.java @@ -36,13 +36,13 @@ import binnie.botany.api.EnumFlowerStage; import binnie.botany.api.EnumSoilType; import binnie.botany.api.IAlleleFlowerSpecies; import binnie.botany.api.IFlower; -import binnie.botany.api.IFlowerColour; +import binnie.botany.api.IFlowerColor; import binnie.botany.api.IFlowerGenome; import binnie.botany.api.IFlowerRoot; import binnie.botany.api.IFlowerType; import binnie.botany.api.IGardeningManager; import binnie.botany.core.BotanyCore; -import binnie.botany.gardening.BlockPlant; +import binnie.botany.gardening.PlantType; import binnie.botany.genetics.EnumFlowerColor; import binnie.botany.genetics.EnumFlowerType; import binnie.botany.genetics.Flower; @@ -61,65 +61,73 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt int matureTime; public TileEntityFlower() { - this.flower = null; - this.section = 0; - this.renderInfo = null; - this.matureTime = 0; + flower = null; + section = 0; + renderInfo = null; + matureTime = 0; } @Override - public void readFromNBT(final NBTTagCompound nbtCompound) { + public void readFromNBT(NBTTagCompound nbtCompound) { if (nbtCompound.hasKey("Flower")) { - this.flower = new Flower(nbtCompound.getCompoundTag("Flower")); + flower = new Flower(nbtCompound.getCompoundTag("Flower")); if (flower.getAge() == 0) { flower.setFlowered(false); } } + if (nbtCompound.hasKey("section")) { - this.section = nbtCompound.getByte("section"); + section = nbtCompound.getByte("section"); } + if (nbtCompound.hasKey("owner")) { - this.owner = NBTUtil.readGameProfileFromNBT(nbtCompound.getCompoundTag("owner")); + owner = NBTUtil.readGameProfileFromNBT(nbtCompound.getCompoundTag("owner")); } + if (nbtCompound.hasKey("CATER") && BinnieCore.isLepidopteryActive()) { - this.matureTime = nbtCompound.getInteger("caterTime"); - this.caterpillar = Binnie.GENETICS.getButterflyRoot().getMember(nbtCompound.getCompoundTag("cater")); + matureTime = nbtCompound.getInteger("caterTime"); + caterpillar = Binnie.GENETICS.getButterflyRoot().getMember(nbtCompound.getCompoundTag("cater")); } + readRenderInfo(nbtCompound); super.readFromNBT(nbtCompound); } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbtCompound) { - if (this.flower != null) { + public NBTTagCompound writeToNBT(NBTTagCompound nbtCompound) { + if (flower != null) { nbtCompound.setTag("Flower", flower.writeToNBT(new NBTTagCompound())); } - if (this.owner != null) { - final NBTTagCompound nbt = new NBTTagCompound(); - NBTUtil.writeGameProfile(nbt, this.owner); + + if (owner != null) { + NBTTagCompound nbt = new NBTTagCompound(); + NBTUtil.writeGameProfile(nbt, owner); nbtCompound.setTag("owner", nbt); } - if (this.caterpillar != null) { - nbtCompound.setInteger("caterTime", this.matureTime); - final NBTTagCompound subcompound = new NBTTagCompound(); - this.caterpillar.writeToNBT(subcompound); + + if (caterpillar != null) { + nbtCompound.setInteger("caterTime", matureTime); + NBTTagCompound subcompound = new NBTTagCompound(); + caterpillar.writeToNBT(subcompound); nbtCompound.setTag("cater", subcompound); } + nbtCompound.setByte("section", (byte) getSection()); return super.writeToNBT(nbtCompound); } - public void create(final ItemStack stack, @Nullable final GameProfile owner) { + public void create(ItemStack stack, @Nullable GameProfile owner) { IFlower flower = BotanyCore.getFlowerRoot().getMember(stack); - this.create(flower, owner); + create(flower, owner); } - public void create(final IFlower flower, @Nullable final GameProfile owner) { + public void create(IFlower flower, @Nullable GameProfile owner) { this.flower = flower; - if (this.flower.getAge() == 0) { - this.flower.setFlowered(false); + if (flower.getAge() == 0) { + flower.setFlowered(false); } - this.updateRender(true); + + updateRender(true); this.owner = owner; } @@ -131,33 +139,40 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt @Override @Nullable public IIndividual getPollen() { - return this.getFlower(); + return getFlower(); } @Override - public boolean canMateWith(final IIndividual individual) { - return this.isBreeding() && individual instanceof IFlower && this.getFlower() != null && this.getFlower().getMate() == null && this.getFlower().hasFlowered() && !this.getFlower().isGeneticEqual(individual); + public boolean canMateWith(IIndividual individual) { + return isBreeding() + && individual instanceof IFlower + && getFlower() != null + && getFlower().getMate() == null + && getFlower().hasFlowered() + && !getFlower().isGeneticEqual(individual); } @Override - public void mateWith(final IIndividual individual) { - if (this.getFlower() == null || !(individual instanceof IFlower)) { + public void mateWith(IIndividual individual) { + if (getFlower() == null || !(individual instanceof IFlower)) { return; } - final IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) individual.getGenome().getPrimary(); - final IAlleleFlowerSpecies primary2 = this.getFlower().getGenome().getPrimary(); - if (primary == primary2 || this.world.rand.nextInt(4) == 0) { - this.getFlower().mate((IFlower) individual); + + IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) individual.getGenome().getPrimary(); + IAlleleFlowerSpecies primary2 = getFlower().getGenome().getPrimary(); + if (primary == primary2 || world.rand.nextInt(4) == 0) { + getFlower().mate((IFlower) individual); world.markBlockRangeForRenderUpdate(pos, pos); } } @Nullable public IFlower getFlower() { - if (this.getSection() <= 0) { - return this.flower; + if (getSection() <= 0) { + return flower; } - TileEntity tile = this.world.getTileEntity(pos.down(getSection())); + + TileEntity tile = world.getTileEntity(pos.down(getSection())); if (tile instanceof TileEntityFlower) { return ((TileEntityFlower) tile).getFlower(); } @@ -165,73 +180,82 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt } public boolean isBreeding() { - final Block roots = this.getWorld().getBlockState(getPos().down()).getBlock(); + Block roots = getWorld().getBlockState(getPos().down()).getBlock(); return BotanyCore.getGardening().isSoil(roots); } - public void randomUpdate(final Random rand) { - if (this.world.getBlockState(pos).getBlock() != Botany.flower) { - this.invalidate(); + public void randomUpdate(Random rand) { + if (world.getBlockState(pos).getBlock() != Botany.flower) { + invalidate(); return; } - if (this.getSection() > 0) { + if (getSection() > 0) { return; } - if (this.flower == null) { + if (flower == null) { return; } - if (this.flower.getGenome() == null) { - this.invalidate(); + + // TODO always false? + if (flower.getGenome() == null) { + invalidate(); return; } - if (!this.isBreeding()) { + if (!isBreeding()) { return; } - float light = this.world.getLight(pos); + + float light = world.getLight(pos); if (light < 6.0f) { for (int dx = -2; dx <= 2; ++dx) { for (int dy = -2; dy <= 2; ++dy) { - light -= (this.world.canBlockSeeSky(pos) ? 0.0f : 0.5f); + light -= (world.canBlockSeeSky(pos) ? 0.0f : 0.5f); } } } + IGardeningManager gardening = BotanyCore.getGardening(); - final boolean canTolerate = gardening.canTolerate(this.getFlower(), this.world, pos); - final EnumSoilType soil = gardening.getSoilType(this.world, pos.down()); - if (rand.nextFloat() < this.getFlower().getGenome().getAgeChance()) { - if (this.flower.getAge() < 1) { + boolean canTolerate = gardening.canTolerate(getFlower(), world, pos); + EnumSoilType soil = gardening.getSoilType(world, pos.down()); + if (rand.nextFloat() < getFlower().getGenome().getAgeChance()) { + if (flower.getAge() < 1) { if (canTolerate && light > 6.0f) { - this.doFlowerAge(); + doFlowerAge(); } } else { - this.doFlowerAge(); + doFlowerAge(); } } - if (canTolerate && this.flower.getAge() > 1 && !this.flower.isWilted() && light > 6.0f) { - this.flower.setFlowered(true); + + if (canTolerate && flower.getAge() > 1 && !flower.isWilted() && light > 6.0f) { + flower.setFlowered(true); } - if (!canTolerate && this.flower.isWilted() && rand.nextInt(2 + Math.max(this.flower.getAge(), 2)) == 0) { - this.kill(); + + if (!canTolerate && flower.isWilted() && rand.nextInt(2 + Math.max(flower.getAge(), 2)) == 0) { + kill(); return; } - if (light < 2.0f && this.flower.isWilted()) { - this.kill(); + + if (light < 2.0f && flower.isWilted()) { + kill(); return; } + if (!canTolerate || light < 1.0f) { - this.flower.setWilted(true); + flower.setWilted(true); } else { - this.flower.setWilted(false); + flower.setWilted(false); } + float CHANCE_DISPERSAL = 0.8f; - CHANCE_DISPERSAL += 0.2f * this.flower.getGenome().getFertility(); + CHANCE_DISPERSAL += 0.2f * flower.getGenome().getFertility(); CHANCE_DISPERSAL *= 1.0f + soil.ordinal() * 0.5f; float CHANCE_POLLINATE = 1.0f; - CHANCE_POLLINATE += 0.25f * this.flower.getGenome().getFertility(); + CHANCE_POLLINATE += 0.25f * flower.getGenome().getFertility(); CHANCE_POLLINATE *= 1.0f + soil.ordinal() * 0.5f; - final float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE; - if (this.world.rand.nextFloat() < CHANCE_DISPERSAL && this.flower.hasFlowered() && !this.flower.isWilted()) { - final IFlowerGenome mate = this.flower.getMate(); + float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE; + if (world.rand.nextFloat() < CHANCE_DISPERSAL && flower.hasFlowered() && !flower.isWilted()) { + IFlowerGenome mate = flower.getMate(); if (mate != null) { boolean dispersed = false; for (int a = 0; a < 5 && !dispersed; ++a) { @@ -240,68 +264,70 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt for (dx2 = 0, dz = 0; dx2 == 0 && dz == 0; dx2 = rand.nextInt(3) - 1, dz = rand.nextInt(3) - 1) { } - final Block b2 = world.getBlockState(pos.add(dx2, -1, dz)).getBlock(); + Block b2 = world.getBlockState(pos.add(dx2, -1, dz)).getBlock(); if (world.isAirBlock(pos.add(dx2, 0, dz)) && BotanyCore.getGardening().isSoil(b2)) { - final IFlower offspring = this.flower.getOffspring(world, pos); + IFlower offspring = flower.getOffspring(world, pos); if (offspring != null) { - BotanyCore.getFlowerRoot().plant(world, pos.add(dx2, 0, dz), offspring, this.getOwner()); - this.flower.removeMate(); + BotanyCore.getFlowerRoot().plant(world, pos.add(dx2, 0, dz), offspring, getOwner()); + flower.removeMate(); dispersed = true; } } } } } - if (this.world.rand.nextFloat() < CHANCE_POLLINATE && this.flower.hasFlowered() && !this.flower.isWilted()) { + + if (world.rand.nextFloat() < CHANCE_POLLINATE && flower.hasFlowered() && !flower.isWilted()) { for (int a2 = 0; a2 < 4; ++a2) { int dx3; int dz2; for (dx3 = 0, dz2 = 0; dx3 == 0 && dz2 == 0; dx3 = rand.nextInt(5) - 2, dz2 = rand.nextInt(5) - 2) { } - final TileEntity tile = world.getTileEntity(pos.add(dx3, 0, dz2)); - if (tile instanceof IPollinatable && ((IPollinatable) tile).canMateWith(this.getFlower())) { - ((IPollinatable) tile).mateWith(this.getFlower()); + TileEntity tile = world.getTileEntity(pos.add(dx3, 0, dz2)); + if (tile instanceof IPollinatable && ((IPollinatable) tile).canMateWith(getFlower())) { + ((IPollinatable) tile).mateWith(getFlower()); } } } - if (this.world.rand.nextFloat() < CHANCE_SELFPOLLINATE && this.flower.hasFlowered() && this.flower.getMate() == null) { - this.mateWith(this.getFlower()); + + if (world.rand.nextFloat() < CHANCE_SELFPOLLINATE && flower.hasFlowered() && flower.getMate() == null) { + mateWith(getFlower()); } - this.spawnButterflies(); - this.matureCaterpillar(); - this.checkIfDead(false); - this.updateRender(true); + spawnButterflies(); + matureCaterpillar(); + checkIfDead(false); + updateRender(true); } private void doFlowerAge() { - this.getFlower().age(); - if (this.getFlower().getAge() == 1) { + getFlower().age(); + if (getFlower().getAge() == 1) { IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot(); - flowerRoot.onGrowFromSeed(this.world, pos); - if (this.getOwner() != null && this.getFlower() != null) { - flowerRoot.getBreedingTracker(world, this.getOwner()).registerBirth(this.getFlower()); + flowerRoot.onGrowFromSeed(world, pos); + if (getOwner() != null && getFlower() != null) { + flowerRoot.getBreedingTracker(world, getOwner()).registerBirth(getFlower()); } } } - private NBTTagCompound writeRenderInfo(NBTTagCompound tag){ - if(renderInfo!=null){ + private NBTTagCompound writeRenderInfo(NBTTagCompound tag) { + if (renderInfo != null) { NBTTagCompound nbtRenderInfo = new NBTTagCompound(); - nbtRenderInfo.setByte("primary",(byte)this.renderInfo.primary.getID()); - nbtRenderInfo.setByte("secondary",(byte)this.renderInfo.secondary.getID()); - nbtRenderInfo.setByte("stem",(byte)this.renderInfo.stem.getID()); - nbtRenderInfo.setByte("type",(byte)this.renderInfo.type.ordinal()); - nbtRenderInfo.setByte("age",this.renderInfo.age); - nbtRenderInfo.setByte("section",this.renderInfo.section); - nbtRenderInfo.setBoolean("wilted",this.renderInfo.wilted); - nbtRenderInfo.setBoolean("flowered",this.renderInfo.flowered); + nbtRenderInfo.setByte("primary", (byte) renderInfo.primary.getID()); + nbtRenderInfo.setByte("secondary", (byte) renderInfo.secondary.getID()); + nbtRenderInfo.setByte("stem", (byte) renderInfo.stem.getID()); + nbtRenderInfo.setByte("type", (byte) renderInfo.type.ordinal()); + nbtRenderInfo.setByte("age", renderInfo.age); + nbtRenderInfo.setByte("section", renderInfo.section); + nbtRenderInfo.setBoolean("wilted", renderInfo.wilted); + nbtRenderInfo.setBoolean("flowered", renderInfo.flowered); tag.setTag("renderinfo", nbtRenderInfo); } return tag; } - private void readRenderInfo(NBTTagCompound tag){ - if(tag.hasKey("renderinfo")){ + private void readRenderInfo(NBTTagCompound tag) { + if (tag.hasKey("renderinfo")) { NBTTagCompound infotag = tag.getCompoundTag("renderinfo"); RenderInfo info = new RenderInfo(); info.primary = EnumFlowerColor.values()[infotag.getByte("primary")].getFlowerColorAllele(); @@ -319,6 +345,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { super.onDataPacket(net, pkt); + // TODO client only call? readRenderInfo(pkt.getNbtCompound()); } @@ -330,38 +357,40 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt @Override public SPacketUpdateTileEntity getUpdatePacket() { - if (this.renderInfo == null && this.getFlower() != null && this.getFlower().getGenome() != null) { - this.renderInfo = new RenderInfo(this.getFlower(), this); + // TODO getFlower().getGenome() != null always true? + if (renderInfo == null && getFlower() != null && getFlower().getGenome() != null) { + renderInfo = new RenderInfo(getFlower(), this); } - return (this.renderInfo != null) ? new SPacketUpdateTileEntity(pos, 0, getUpdateTag()) : null; + return (renderInfo != null) ? new SPacketUpdateTileEntity(pos, 0, getUpdateTag()) : null; } - public void updateRender(final boolean update) { - if (update && this.getFlower() != null && this.getFlower().getGenome() != null) { - final RenderInfo newInfo = new RenderInfo(this.getFlower(), this); - if (this.renderInfo == null || !newInfo.equals(this.renderInfo)) { - this.setRender(newInfo); + public void updateRender(boolean update) { + if (update && getFlower() != null && getFlower().getGenome() != null) { + RenderInfo newInfo = new RenderInfo(getFlower(), this); + if (renderInfo == null || !newInfo.equals(renderInfo)) { + setRender(newInfo); } } - final TileEntity above = this.world.getTileEntity(pos.up()); + + TileEntity above = world.getTileEntity(pos.up()); if (above instanceof TileEntityFlower) { ((TileEntityFlower) above).updateRender(true); } } public int getSection() { - return this.section; + return section; } - public void setSection(final int i) { - this.section = i; - if (BinnieCore.getBinnieProxy().isSimulating(this.world)) { - this.updateRender(true); + public void setSection(int i) { + section = i; + if (BinnieCore.getBinnieProxy().isSimulating(world)) { + updateRender(true); } } public ItemStack getItemStack() { - IFlower flower = this.getFlower(); + IFlower flower = getFlower(); if (flower == null) { return ItemStack.EMPTY; } @@ -370,57 +399,61 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt @Nullable private TileEntityFlower getRoot() { - if (this.getSection() == 0) { + if (getSection() == 0) { return null; } - final TileEntity tile = this.world.getTileEntity(pos.down(getSection())); + TileEntity tile = world.getTileEntity(pos.down(getSection())); return (tile instanceof TileEntityFlower) ? ((TileEntityFlower) tile) : null; } public void onShear() { - if (this.getRoot() != null) { - this.getRoot().onShear(); + if (getRoot() != null) { + getRoot().onShear(); } - if (this.getFlower() != null && this.getFlower().getAge() > 1) { - final Random rand = new Random(); - final IFlower cutting = (IFlower) this.getFlower().copy(); - cutting.setAge(0); - final ItemStack cuttingStack = BotanyCore.getFlowerRoot().getMemberStack(cutting, EnumFlowerStage.SEED); - final float f = 0.7f; - final double d = rand.nextFloat() * f + (1.0f - f) * 0.5; - final double d2 = rand.nextFloat() * f + (1.0f - f) * 0.5; - final double d3 = rand.nextFloat() * f + (1.0f - f) * 0.5; - final EntityItem entityitem = new EntityItem(this.world, pos.getX() + d, pos.getY() + d2, pos.getZ() + d3, cuttingStack); - entityitem.setPickupDelay(10); - this.world.spawnEntity(entityitem); - for (int maxAge = this.getFlower().getMaxAge(), i = 0; i < maxAge; ++i) { - if (rand.nextBoolean()) { - this.getFlower().age(); - if (this.checkIfDead(true)) { - return; - } + + if (getFlower() == null || getFlower().getAge() <= 1) { + return; + } + + Random rand = new Random(); + IFlower cutting = (IFlower) getFlower().copy(); + cutting.setAge(0); + ItemStack cuttingStack = BotanyCore.getFlowerRoot().getMemberStack(cutting, EnumFlowerStage.SEED); + float f = 0.7f; + double d = rand.nextFloat() * f + (1.0f - f) * 0.5; + double d2 = rand.nextFloat() * f + (1.0f - f) * 0.5; + double d3 = rand.nextFloat() * f + (1.0f - f) * 0.5; + EntityItem entityitem = new EntityItem(world, pos.getX() + d, pos.getY() + d2, pos.getZ() + d3, cuttingStack); + entityitem.setPickupDelay(10); + world.spawnEntity(entityitem); + for (int maxAge = getFlower().getMaxAge(), i = 0; i < maxAge; ++i) { + if (rand.nextBoolean()) { + getFlower().age(); + if (checkIfDead(true)) { + return; } } } } - public boolean checkIfDead(final boolean wasCut) { - if (this.getSection() != 0) { - return this.getRoot().checkIfDead(wasCut); + public boolean checkIfDead(boolean wasCut) { + if (getSection() != 0) { + return getRoot().checkIfDead(wasCut); } - final EnumSoilType soil = BotanyCore.getGardening().getSoilType(this.world, pos); - final int maxAge = (int) (this.flower.getMaxAge() * (1.0f + soil.ordinal() * 0.25f)); - if (this.flower.getAge() > maxAge) { - if (!wasCut && this.flower.getMate() != null) { - this.world.setBlockToAir(pos); - final IFlower offspring = this.flower.getOffspring(this.world, pos.down()); - final TileEntity above = this.world.getTileEntity(pos.up()); + + EnumSoilType soil = BotanyCore.getGardening().getSoilType(world, pos); + int maxAge = (int) (flower.getMaxAge() * (1.0f + soil.ordinal() * 0.25f)); + if (flower.getAge() > maxAge) { + if (!wasCut && flower.getMate() != null) { + world.setBlockToAir(pos); + IFlower offspring = flower.getOffspring(world, pos.down()); + TileEntity above = world.getTileEntity(pos.up()); if (above instanceof TileEntityFlower) { - this.world.setBlockToAir(pos.up()); + world.setBlockToAir(pos.up()); } - BotanyCore.getFlowerRoot().plant(this.world, pos, offspring, this.getOwner()); + BotanyCore.getFlowerRoot().plant(world, pos, offspring, getOwner()); } else { - this.kill(); + kill(); } return true; } @@ -428,42 +461,44 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt } public void kill() { - if (this.flower.getAge() > 0) { - this.world.setBlockState(pos, Botany.plant.getStateFromMeta(BlockPlant.Type.DeadFlower.ordinal()), 2); + if (flower.getAge() > 0) { + world.setBlockState(pos, Botany.plant.getStateFromMeta(PlantType.DEAD_FLOWER.ordinal()), 2); } else { - this.world.setBlockToAir(pos); + world.setBlockToAir(pos); } - for (int i = 1; this.world.getTileEntity(pos.up(i)) instanceof TileEntityFlower; ++i) { - this.world.setBlockToAir(pos.up(i)); + + for (int i = 1; world.getTileEntity(pos.up(i)) instanceof TileEntityFlower; ++i) { + world.setBlockToAir(pos.up(i)); } } public boolean onBonemeal() { - if (this.getFlower() == null) { + if (getFlower() == null) { return false; } - if (!this.isBreeding()) { + if (!isBreeding()) { return false; } - if (this.getFlower().isWilted()) { + if (getFlower().isWilted()) { return false; } + //this.doFlowerAge(); - if (this.getFlower().getAge() > 1 && !this.getFlower().hasFlowered()) { - this.getFlower().setFlowered(true); + if (getFlower().getAge() > 1 && !getFlower().hasFlowered()) { + getFlower().setFlowered(true); } - this.checkIfDead(false); - this.updateRender(true); + checkIfDead(false); + updateRender(true); return true; } @Nullable public GameProfile getOwner() { - return this.owner; + return owner; } - public void setOwner(final GameProfile ownerName) { - this.owner = ownerName; + public void setOwner(GameProfile ownerName) { + owner = ownerName; } public void spawnButterflies() { @@ -510,57 +545,57 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt }*/ } - private void attemptButterflySpawn(final World world, final IButterfly butterfly, final double x, final double y, final double z) { + private void attemptButterflySpawn(World world, IButterfly butterfly, double x, double y, double z) { if (BinnieCore.isLepidopteryActive()) { Binnie.GENETICS.getButterflyRoot().spawnButterflyInWorld(world, butterfly.copy(), x, y + 0.10000000149011612, z); } } public GameProfile getOwnerName() { - return this.getOwner(); + return getOwner(); } @Override public EnumTemperature getTemperature() { - return EnumTemperature.getFromValue(this.world.getBiome(getPos()).getTemperature()); + return EnumTemperature.getFromValue(world.getBiome(getPos()).getTemperature()); } @Override public EnumHumidity getHumidity() { - return EnumHumidity.getFromValue(this.world.getBiome(getPos()).getRainfall()); + return EnumHumidity.getFromValue(world.getBiome(getPos()).getRainfall()); } - public void setErrorState(final int state) { + public void setErrorState(int state) { } public int getErrorOrdinal() { return 0; } - public boolean addProduct(final ItemStack product, final boolean all) { + public boolean addProduct(ItemStack product, boolean all) { return false; } @Override @Nullable public IButterfly getCaterpillar() { - return this.caterpillar; + return caterpillar; } @Override - public void setCaterpillar(@Nullable final IButterfly butterfly) { - this.caterpillar = butterfly; - this.matureTime = 0; + public void setCaterpillar(@Nullable IButterfly butterfly) { + caterpillar = butterfly; + matureTime = 0; } @Override public IIndividual getNanny() { - return this.getFlower(); + return getFlower(); } @Override - public boolean canNurse(final IButterfly butterfly) { - return this.getFlower() != null && !this.getFlower().isWilted() && this.getFlower().getAge() > 1; + public boolean canNurse(IButterfly butterfly) { + return getFlower() != null && !getFlower().isWilted() && getFlower().getAge() > 1; } private void matureCaterpillar() { @@ -589,9 +624,9 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt }*/ } - public void setRender(final RenderInfo render) { - this.renderInfo = render; - this.section = this.renderInfo.section; + public void setRender(RenderInfo render) { + renderInfo = render; + section = renderInfo.section; if (!world.isRemote) { IBlockState blockState = world.getBlockState(pos); world.notifyBlockUpdate(pos, blockState, blockState, 0); @@ -601,40 +636,48 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt } public int getAge() { - return (this.renderInfo == null) ? 1 : this.renderInfo.age; + return (renderInfo == null) ? 1 : renderInfo.age; } public int getRenderSection() { - return (this.renderInfo == null) ? 1 : this.renderInfo.section; + return (renderInfo == null) ? 1 : renderInfo.section; } public boolean isWilted() { - return this.renderInfo != null && this.renderInfo.wilted; + return renderInfo != null && renderInfo.wilted; } public boolean isFlowered() { - return this.renderInfo == null || this.renderInfo.flowered; + return renderInfo == null || renderInfo.flowered; } public int getPrimaryColour() { - return (this.renderInfo == null) ? EnumFlowerColor.Red.getFlowerColorAllele().getColor(false) : this.renderInfo.primary.getColor(this.isWilted()); + return (renderInfo == null) + ? EnumFlowerColor.Red.getFlowerColorAllele().getColor(false) + : renderInfo.primary.getColor(isWilted()); } public int getSecondaryColour() { - return (this.renderInfo == null) ? EnumFlowerColor.Red.getFlowerColorAllele().getColor(false) : this.renderInfo.secondary.getColor(this.isWilted()); + return (renderInfo == null) + ? EnumFlowerColor.Red.getFlowerColorAllele().getColor(false) + : renderInfo.secondary.getColor(isWilted()); } public int getStemColour() { - return (this.renderInfo == null) ? EnumFlowerColor.Green.getFlowerColorAllele().getColor(false) : this.renderInfo.stem.getColor(this.isWilted()); + return (renderInfo == null) + ? EnumFlowerColor.Green.getFlowerColorAllele().getColor(false) + : renderInfo.stem.getColor(isWilted()); } public IFlowerType getType() { - return (this.renderInfo == null) ? EnumFlowerType.Poppy : this.renderInfo.type; + return (renderInfo == null) + ? EnumFlowerType.Poppy + : renderInfo.type; } @Override public Biome getBiome() { - return this.getWorld().getBiome(getPos()); + return getWorld().getBiome(getPos()); } @Nullable @@ -642,10 +685,10 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt return null; } - public void setErrorState(final IErrorState state) { + public void setErrorState(IErrorState state) { } - public boolean setErrorCondition(final boolean condition, final IErrorState errorState) { + public boolean setErrorCondition(boolean condition, IErrorState errorState) { return false; } @@ -669,9 +712,9 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt } public static class RenderInfo { - public IFlowerColour primary; - public IFlowerColour secondary; - public IFlowerColour stem; + public IFlowerColor primary; + public IFlowerColor secondary; + public IFlowerColor stem; public IFlowerType type; public byte age; public boolean wilted; @@ -681,22 +724,22 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt public RenderInfo() { } - public RenderInfo(final IFlower flower, final TileEntityFlower tile) { - this.section = (byte) tile.getSection(); - this.primary = flower.getGenome().getPrimaryColor(); - this.secondary = flower.getGenome().getSecondaryColor(); - this.stem = flower.getGenome().getStemColor(); - this.age = (byte) flower.getAge(); - this.wilted = flower.isWilted(); - this.flowered = flower.hasFlowered(); - this.type = flower.getGenome().getType(); + public RenderInfo(IFlower flower, TileEntityFlower tile) { + section = (byte) tile.getSection(); + primary = flower.getGenome().getPrimaryColor(); + secondary = flower.getGenome().getSecondaryColor(); + stem = flower.getGenome().getStemColor(); + age = (byte) flower.getAge(); + wilted = flower.isWilted(); + flowered = flower.hasFlowered(); + type = flower.getGenome().getType(); } @Override - public boolean equals(final Object obj) { + public boolean equals(Object obj) { if (obj instanceof RenderInfo) { - final RenderInfo o = (RenderInfo) obj; - return o.age == this.age && o.wilted == this.wilted && o.flowered == this.flowered && o.primary == this.primary && o.secondary == this.secondary && o.stem == this.stem && o.type == this.type; + RenderInfo o = (RenderInfo) obj; + return o.age == age && o.wilted == wilted && o.flowered == flowered && o.primary == primary && o.secondary == secondary && o.stem == stem && o.type == type; } return super.equals(obj); } diff --git a/src/main/java/binnie/botany/gardening/BlockPlant.java b/src/main/java/binnie/botany/gardening/BlockPlant.java index 7cc62c70..091fc745 100644 --- a/src/main/java/binnie/botany/gardening/BlockPlant.java +++ b/src/main/java/binnie/botany/gardening/BlockPlant.java @@ -13,7 +13,6 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.IStringSerializable; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -25,20 +24,19 @@ import net.minecraftforge.fml.relauncher.SideOnly; import forestry.api.core.IItemModelRegister; import forestry.api.core.IModelManager; -import binnie.botany.Botany; import binnie.botany.CreativeTabBotany; import binnie.botany.api.EnumSoilType; import binnie.botany.api.IBlockSoil; import binnie.botany.core.BotanyCore; public class BlockPlant extends BlockBush implements IItemModelRegister { - public static final PropertyEnum PLANT_TYPE = PropertyEnum.create("plant_type", Type.class); + public static final PropertyEnum PLANT_TYPE = PropertyEnum.create("plant_type", PlantType.class); public BlockPlant() { - this.setRegistryName("plant"); - this.setCreativeTab(CreativeTabBotany.instance); - this.setTickRandomly(true); - this.setSoundType(SoundType.PLANT); + setRegistryName("plant"); + setCreativeTab(CreativeTabBotany.instance); + setTickRandomly(true); + setSoundType(SoundType.PLANT); } public static boolean isWeed(IBlockAccess world, BlockPos pos) { @@ -46,7 +44,8 @@ public class BlockPlant extends BlockBush implements IItemModelRegister { if (!(blockState.getBlock() instanceof BlockPlant)) { return false; } - Type type = blockState.getValue(PLANT_TYPE); + + PlantType type = blockState.getValue(PLANT_TYPE); return type.isWeed(); } @@ -54,7 +53,7 @@ public class BlockPlant extends BlockBush implements IItemModelRegister { @SideOnly(Side.CLIENT) public void registerModel(Item item, IModelManager manager) { int index = 0; - for (Type type : Type.values()) { + for (PlantType type : PlantType.values()) { manager.registerItemModel(item, index, type.getName()); index++; } @@ -72,7 +71,7 @@ public class BlockPlant extends BlockBush implements IItemModelRegister { @Override public IBlockState getStateFromMeta(int meta) { - return getDefaultState().withProperty(PLANT_TYPE, Type.values()[meta]); + return getDefaultState().withProperty(PLANT_TYPE, PlantType.values()[meta]); } @Override @@ -92,49 +91,54 @@ public class BlockPlant extends BlockBush implements IItemModelRegister { @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(final Item p_149666_1_, final CreativeTabs p_149666_2_, final NonNullList subBlocks) { - for (final Type type : Type.values()) { + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, NonNullList subBlocks) { + for (PlantType type : PlantType.values()) { subBlocks.add(type.get()); } } @Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { - final Type type = state.getValue(PLANT_TYPE); + PlantType type = state.getValue(PLANT_TYPE); if (rand.nextInt(4) == 0) { - if (type == Type.Weeds) { - world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.WeedsLong), 2); - } else if (type == Type.WeedsLong) { - world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.WeedsVeryLong), 2); - } else if (type == Type.DeadFlower) { - world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.DecayingFlower), 2); - } else if (type == Type.DecayingFlower) { + if (type == PlantType.WEEDS) { + world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS_LONG), 2); + } else if (type == PlantType.WEEDS_LONG) { + world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS_VERY_LONG), 2); + } else if (type == PlantType.DEAD_FLOWER) { + world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.DECAYING_FLOWER), 2); + } else if (type == PlantType.DECAYING_FLOWER) { world.setBlockToAir(pos); return; } } + if (rand.nextInt(6) == 0) { - if (type == Type.Weeds) { + if (type == PlantType.WEEDS) { world.setBlockToAir(pos); - } else if (type == Type.WeedsLong) { - world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.Weeds), 2); - } else if (type == Type.WeedsVeryLong) { - world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.WeedsLong), 2); + } else if (type == PlantType.WEEDS_LONG) { + world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS), 2); + } else if (type == PlantType.WEEDS_VERY_LONG) { + world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS_LONG), 2); } } + Block below = world.getBlockState(pos.down()).getBlock(); - if (BotanyCore.getGardening().isSoil(below)) { - IBlockSoil soil = (IBlockSoil) below; - if(rand.nextInt(3) != 0){ - return; - } - if (type.isWeed()) { - if (!soil.degrade(world, pos.down(), EnumSoilType.LOAM)) { - soil.degrade(world, pos.down(), EnumSoilType.SOIL); - } - } else if (type == Type.DecayingFlower && !soil.fertilise(world, pos.down(), EnumSoilType.LOAM)) { - soil.fertilise(world, pos.down(), EnumSoilType.FLOWERBED); + if (!BotanyCore.getGardening().isSoil(below)) { + return; + } + + IBlockSoil soil = (IBlockSoil) below; + if (rand.nextInt(3) != 0) { + return; + } + + if (type.isWeed()) { + if (!soil.degrade(world, pos.down(), EnumSoilType.LOAM)) { + soil.degrade(world, pos.down(), EnumSoilType.SOIL); } + } else if (type == PlantType.DECAYING_FLOWER && !soil.fertilise(world, pos.down(), EnumSoilType.LOAM)) { + soil.fertilise(world, pos.down(), EnumSoilType.FLOWERBED); } } @@ -147,41 +151,4 @@ public class BlockPlant extends BlockBush implements IItemModelRegister { public EnumOffsetType getOffsetType() { return EnumOffsetType.XZ; } - - public enum Type implements IStringSerializable { - Weeds("weeds", true), - WeedsLong("weeds_long", true), - WeedsVeryLong("weeds_very_long", true), - DeadFlower("dead_flower"), - DecayingFlower("decaying_flower"); - - String name; - boolean isWeed; - - Type(String name) { - this(name, false); - } - - Type(String name, boolean isWeed) { - this.name = name; - this.isWeed = isWeed; - } - - public static Type get(int id) { - return values()[id % values().length]; - } - - public ItemStack get() { - return new ItemStack(Botany.plant, 1, this.ordinal()); - } - - public boolean isWeed(){ - return isWeed; - } - - @Override - public String getName() { - return name; - } - } } diff --git a/src/main/java/binnie/botany/gardening/BlockSoil.java b/src/main/java/binnie/botany/gardening/BlockSoil.java index b42a249f..827a569c 100644 --- a/src/main/java/binnie/botany/gardening/BlockSoil.java +++ b/src/main/java/binnie/botany/gardening/BlockSoil.java @@ -47,18 +47,18 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister { public BlockSoil(EnumSoilType type, String blockName, boolean weedKilled) { super(Material.GROUND); + this.type = type; this.weedKilled = weedKilled; setUnlocalizedName("botany.soil." + type.getName()); - this.setCreativeTab(CreativeTabBotany.instance); - this.setRegistryName(blockName); - this.setTickRandomly(true); - this.setLightOpacity(255); - this.setHardness(0.5f); - this.setSoundType(SoundType.GROUND); - this.type = type; + setCreativeTab(CreativeTabBotany.instance); + setRegistryName(blockName); + setTickRandomly(true); + setLightOpacity(255); + setHardness(0.5f); + setSoundType(SoundType.GROUND); } - public static int getMeta(final EnumAcidity acid, final EnumMoisture moisture) { + public static int getMeta(EnumAcidity acid, EnumMoisture moisture) { return acid.ordinal() * 3 + moisture.ordinal(); } @@ -88,6 +88,7 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister { switch (side) { case UP: return true; + case NORTH: case SOUTH: case WEST: @@ -95,9 +96,8 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister { IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side)); Block block = iblockstate.getBlock(); return !iblockstate.isOpaqueCube() && block != Blocks.FARMLAND && block != Blocks.GRASS_PATH && block != this; - default: - return super.shouldSideBeRendered(blockState, blockAccess, pos, side); } + return super.shouldSideBeRendered(blockState, blockAccess, pos, side); } /** @@ -136,7 +136,7 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister { @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(final Item itemIn, final CreativeTabs tab, final NonNullList list) { + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { for (int i = 0; i < 9; ++i) { list.add(new ItemStack(this, 1, i)); } @@ -151,16 +151,19 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister { if (acidity != EnumAcidity.NEUTRAL) { modelName += acidity.getName(); } + if (moisture != EnumMoisture.NORMAL) { if (!modelName.isEmpty()) { modelName += "_"; } modelName += moisture.getName(); } + if (modelName.isEmpty()) { modelName = "normal"; } - final String identifier; + + String identifier; if (weedKilled) { identifier = type.getName() + "_no_weed/" + modelName; } else { @@ -183,13 +186,13 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister { @Override public IBlockState getStateFromMeta(int meta) { - final EnumMoisture moisture = EnumMoisture.values()[meta % 3]; - final EnumAcidity acidity = EnumAcidity.values()[meta / 3]; + EnumMoisture moisture = EnumMoisture.values()[meta % 3]; + EnumAcidity acidity = EnumAcidity.values()[meta / 3]; return getDefaultState().withProperty(MOISTURE, moisture).withProperty(ACIDITY, acidity); } public EnumSoilType getType() { - return this.type; + return type; } @Override @@ -203,23 +206,24 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister { EnumMoisture desiredMoisture = BotanyCore.getGardening().getNaturalMoisture(world, pos); if (desiredMoisture.ordinal() > moisture.ordinal()) { moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP); - } - if (desiredMoisture.ordinal() < moisture.ordinal()) { + } else if (desiredMoisture.ordinal() < moisture.ordinal()) { moisture = ((moisture == EnumMoisture.DAMP) ? EnumMoisture.NORMAL : EnumMoisture.DRY); } + IBlockState blockState = state.withProperty(MOISTURE, moisture); if (state != blockState) { world.setBlockState(pos, blockState, 2); } - if(!weedKilled){ - if(rand.nextInt(5 - getType(world, pos).ordinal()) != 0){ + + if (!weedKilled) { + if (rand.nextInt(5 - getType(world, pos).ordinal()) != 0) { return; } pos = pos.up(); - if(!world.isAirBlock(pos)){ + if (!world.isAirBlock(pos)) { return; } - world.setBlockState(pos, Botany.plant.getStateFromMeta(BlockPlant.Type.Weeds.ordinal()), 2); + world.setBlockState(pos, Botany.plant.getStateFromMeta(PlantType.WEEDS.ordinal()), 2); } } @@ -233,48 +237,48 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister { } @Override - public EnumAcidity getPH(final World world, final BlockPos pos) { + public EnumAcidity getPH(World world, BlockPos pos) { return world.getBlockState(pos).getValue(ACIDITY); } @Override - public EnumMoisture getMoisture(final World world, final BlockPos pos) { + public EnumMoisture getMoisture(World world, BlockPos pos) { return world.getBlockState(pos).getValue(MOISTURE); } @Override - public EnumSoilType getType(final World world, final BlockPos pos) { - return this.type; + public EnumSoilType getType(World world, BlockPos pos) { + return type; } @Override - public boolean fertilise(final World world, final BlockPos pos, final EnumSoilType maxLevel) { - final EnumSoilType type = this.getType(world, pos); + public boolean fertilise(World world, BlockPos pos, EnumSoilType maxLevel) { + EnumSoilType type = getType(world, pos); if (type.ordinal() >= maxLevel.ordinal()) { return false; } - final IBlockState old = world.getBlockState(pos); - return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(maxLevel, this.weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2); + IBlockState old = world.getBlockState(pos); + return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(maxLevel, weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2); } @Override - public boolean degrade(final World world, final BlockPos pos, final EnumSoilType minLevel) { - final EnumSoilType type = this.getType(world, pos); + public boolean degrade(World world, BlockPos pos, EnumSoilType minLevel) { + EnumSoilType type = getType(world, pos); if (type.ordinal() <= minLevel.ordinal()) { return false; } - final IBlockState old = world.getBlockState(pos); - return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(minLevel, this.weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2); + IBlockState old = world.getBlockState(pos); + return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(minLevel, weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2); } @Override - public boolean setPH(final World world, final BlockPos pos, final EnumAcidity pH) { + public boolean setPH(World world, BlockPos pos, EnumAcidity pH) { IBlockState blockState = world.getBlockState(pos); return world.setBlockState(pos, blockState.withProperty(ACIDITY, pH)); } @Override - public boolean setMoisture(final World world, final BlockPos pos, final EnumMoisture moisture) { + public boolean setMoisture(World world, BlockPos pos, EnumMoisture moisture) { IBlockState blockState = world.getBlockState(pos); return world.setBlockState(pos, blockState.withProperty(MOISTURE, moisture)); } @@ -293,15 +297,16 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister { if (plant.getBlock() == Botany.flower) { return true; } + if (plant.getBlock() == Botany.plant) { - return !this.weedKilled || !BlockPlant.isWeed(world, pos); + return !weedKilled || !BlockPlant.isWeed(world, pos); } return world instanceof World && Blocks.DIRT.canSustainPlant(state, world, pos, direction, plantable); } @Override - public boolean resistsWeeds(final World world, final BlockPos pos) { - return this.weedKilled; + public boolean resistsWeeds(World world, BlockPos pos) { + return weedKilled; } public boolean isWeedKilled() { diff --git a/src/main/java/binnie/botany/gardening/Gardening.java b/src/main/java/binnie/botany/gardening/Gardening.java index 18b9b7c5..f17c63c9 100644 --- a/src/main/java/binnie/botany/gardening/Gardening.java +++ b/src/main/java/binnie/botany/gardening/Gardening.java @@ -1,16 +1,11 @@ package binnie.botany.gardening; -import binnie.botany.Botany; -import binnie.botany.api.EnumAcidity; -import binnie.botany.api.EnumMoisture; -import binnie.botany.api.EnumSoilType; -import binnie.botany.api.IBlockSoil; -import binnie.botany.api.IFlower; -import binnie.botany.api.IGardeningManager; -import binnie.botany.items.BotanyItems; -import forestry.api.climate.IClimateInfo; -import forestry.api.core.EnumTemperature; -import forestry.api.core.ForestryAPI; +import javax.annotation.Nullable; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; @@ -21,35 +16,43 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; -import javax.annotation.Nullable; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; +import forestry.api.climate.IClimateInfo; +import forestry.api.core.EnumTemperature; +import forestry.api.core.ForestryAPI; + +import binnie.botany.Botany; +import binnie.botany.api.EnumAcidity; +import binnie.botany.api.EnumMoisture; +import binnie.botany.api.EnumSoilType; +import binnie.botany.api.IBlockSoil; +import binnie.botany.api.IFlower; +import binnie.botany.api.IGardeningManager; +import binnie.botany.items.BotanyItems; public class Gardening implements IGardeningManager { private final Map fertiliserAcid = new LinkedHashMap<>(); private final Map fertiliserAlkaline = new LinkedHashMap<>(); private final Map fertiliserNutrient = new LinkedHashMap<>(); - + public Gardening() { + // ignored } - + @Override - public boolean isSoil(final Block block) { + public boolean isSoil(Block block) { return block instanceof IBlockSoil; } - + @Override - public boolean isSoil(final Item item) { + public boolean isSoil(Item item) { return item instanceof ItemBlock && isSoil(((ItemBlock) item).getBlock()); } - + @Override - public boolean isSoil(final ItemStack item) { + public boolean isSoil(ItemStack item) { return isSoil(item.getItem()); } - + @Override public EnumMoisture getNaturalMoisture(World world, BlockPos pos) { float bias = getBiomeMoisture(world, pos); @@ -64,9 +67,11 @@ public class Gardening implements IGardeningManager { } } } + if (world.isRaining() && world.canBlockSeeSky(pos.up()) && world.getPrecipitationHeight(pos).getY() <= pos.getY() + 1) { bias += 1.5; } + for (int dx = -1; dx < 2; ++dx) { for (int dz = -1; dz < 2; ++dz) { if (dx != 0 || dz != 0) { @@ -78,13 +83,16 @@ public class Gardening implements IGardeningManager { } return (bias <= -1.0f) ? EnumMoisture.DRY : ((bias >= 1.0f) ? EnumMoisture.DAMP : EnumMoisture.NORMAL); } - + @Override public EnumAcidity getNaturalPH(World world, BlockPos pos) { - final float bias = getBiomePH(world, pos); - return (bias <= -1.0f) ? EnumAcidity.ACID : ((bias >= 1.0f) ? EnumAcidity.ALKALINE : EnumAcidity.NEUTRAL); + float bias = getBiomePH(world, pos); + if (bias <= -1.0f) { + return EnumAcidity.ACID; + } + return (bias >= 1.0f) ? EnumAcidity.ALKALINE : EnumAcidity.NEUTRAL; } - + @Override public float getBiomeMoisture(World world, BlockPos pos) { IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos); @@ -93,7 +101,7 @@ public class Gardening implements IGardeningManager { double m = 3.2 * (humidity - 0.5) - 0.4 * (1.0 + temperature + 0.5 * temperature * temperature) + 1.1 - 1.6 * (temperature - 0.9) * (temperature - 0.9) - 0.002 * (pos.getY() - 64); return (float) ((m == 0.0) ? m : ((m < 0.0) ? (-Math.sqrt(m * m)) : Math.sqrt(m * m))); } - + @Override public float getBiomePH(World world, BlockPos pos) { IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos); @@ -101,153 +109,156 @@ public class Gardening implements IGardeningManager { double temperature = info.getTemperature(); return (float) (-3.0 * (humidity - 0.5) + 0.5 * (temperature - 0.699999988079071) * (temperature - 0.699999988079071) + 0.02f * (pos.getY() - 64) - 0.15000000596046448); } - + @Override - public void plantSoil(final World world, final BlockPos pos, final EnumSoilType soil, final EnumMoisture moisture, final EnumAcidity acidity) { - final int meta = moisture.ordinal() + acidity.ordinal() * 3; + public void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity) { + int meta = moisture.ordinal() + acidity.ordinal() * 3; world.setBlockState(pos, getSoilBlock(soil).getStateFromMeta(meta), 2); } - + @Override public Collection getAcidFertilisers() { return Collections.unmodifiableSet(fertiliserAcid.keySet()); } - + @Override public Collection getAlkalineFertilisers() { return Collections.unmodifiableSet(fertiliserAlkaline.keySet()); } - + @Override public Collection getNutrientFertilisers() { return Collections.unmodifiableSet(fertiliserNutrient.keySet()); } - + @Override public void registerAcidFertiliser(ItemStack stack, int strength) { ModuleGardening.queuedAcidFertilisers.put(stack, strength); fertiliserAcid.put(stack, strength); } - + @Override public void registerAlkalineFertiliser(ItemStack stack, int strength) { ModuleGardening.queuedAlkalineFertilisers.put(stack, strength); fertiliserAlkaline.put(stack, strength); } - + @Override public void registerNutrientFertiliser(ItemStack stack, int strength) { ModuleGardening.queuedNutrientFertilisers.put(stack, strength); fertiliserNutrient.put(stack, strength); } - + @Override - public boolean isAcidFertiliser(final ItemStack itemstack) { - for (final ItemStack stack : getAcidFertilisers()) { + public boolean isAcidFertiliser(ItemStack itemstack) { + for (ItemStack stack : getAcidFertilisers()) { if (!stack.isEmpty() && stack.isItemEqual(itemstack)) { return true; } } return false; } - + @Override - public boolean isAlkalineFertiliser(final ItemStack itemstack) { - for (final ItemStack stack : getAlkalineFertilisers()) { + public boolean isAlkalineFertiliser(ItemStack itemstack) { + for (ItemStack stack : getAlkalineFertilisers()) { if (!stack.isEmpty() && stack.isItemEqual(itemstack)) { return true; } } return false; } - + @Override - public boolean isNutrientFertiliser(final ItemStack itemstack) { - for (final ItemStack stack : getNutrientFertilisers()) { + public boolean isNutrientFertiliser(ItemStack itemstack) { + for (ItemStack stack : getNutrientFertilisers()) { if (!stack.isEmpty() && stack.isItemEqual(itemstack)) { return true; } } return false; } - + @Override - public int getFertiliserStrength(final ItemStack stack) { - for (final Map.Entry entry : fertiliserAcid.entrySet()) { + public int getFertiliserStrength(ItemStack stack) { + for (Map.Entry entry : fertiliserAcid.entrySet()) { if (entry.getKey().isItemEqual(stack)) { return entry.getValue(); } } - for (final Map.Entry entry : fertiliserAlkaline.entrySet()) { + for (Map.Entry entry : fertiliserAlkaline.entrySet()) { if (entry.getKey().isItemEqual(stack)) { return entry.getValue(); } } - for (final Map.Entry entry : fertiliserNutrient.entrySet()) { + for (Map.Entry entry : fertiliserNutrient.entrySet()) { if (entry.getKey().isItemEqual(stack)) { return entry.getValue(); } } return 1; } - + @Override - public boolean canTolerate(@Nullable final IFlower flower, final World world, final BlockPos pos) { + public boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos) { if (flower == null) { return false; } IBlockState soil = world.getBlockState(pos.down()); - final Block soilBlock = soil.getBlock(); - final int soilMeta = soilBlock.getMetaFromState(soil); - final Biome biome = world.getBiome(pos); - return canTolerate(flower, EnumAcidity.values()[soilMeta / 3 % 3], EnumMoisture.values()[soilMeta % 3], EnumTemperature.getFromValue(biome.getTemperature())); + Block soilBlock = soil.getBlock(); + int soilMeta = soilBlock.getMetaFromState(soil); + Biome biome = world.getBiome(pos); + return canTolerate( + flower, + EnumAcidity.values()[soilMeta / 3 % 3], + EnumMoisture.values()[soilMeta % 3], + EnumTemperature.getFromValue(biome.getTemperature()) + ); } @Override - public EnumSoilType getSoilType(final World world, final BlockPos pos) { + public EnumSoilType getSoilType(World world, BlockPos pos) { if (world.getBlockState(pos).getBlock() instanceof IBlockSoil) { return ((IBlockSoil) world.getBlockState(pos).getBlock()).getType(world, pos); } return EnumSoilType.SOIL; } - + @Override - public Block getSoilBlock(final EnumSoilType type) { + public Block getSoilBlock(EnumSoilType type) { return getSoilBlock(type, false); } - + @Override - public Block getSoilBlock(final EnumSoilType type, final boolean weedKill) { + public Block getSoilBlock(EnumSoilType type, boolean weedKill) { switch (type) { - case FLOWERBED: { + case FLOWERBED: return weedKill ? Botany.flowerbedNoWeed : Botany.flowerbed; - } - case LOAM: { + + case LOAM: return weedKill ? Botany.loamNoWeed : Botany.loam; - } - default: { - return weedKill ? Botany.soilNoWeed : Botany.soil; - } } + return weedKill ? Botany.soilNoWeed : Botany.soil; } - + @Override public boolean canTolerate(IFlower flower, EnumAcidity acidity, EnumMoisture moisture, EnumTemperature temperature) { return flower.getGenome().canTolerate(acidity) - && flower.getGenome().canTolerate(moisture) - && flower.getGenome().canTolerate(temperature); + && flower.getGenome().canTolerate(moisture) + && flower.getGenome().canTolerate(temperature); } - + @Override public boolean isWeedkiller(ItemStack heldItem) { - return heldItem.isItemEqual(BotanyItems.Weedkiller.get(1)); + return heldItem.isItemEqual(BotanyItems.WEEDKILLER.get(1)); } - + @Override public boolean addWeedKiller(World world, BlockPos pos) { if (!(world.getBlockState(pos).getBlock() instanceof IBlockSoil)) { return false; } + EnumSoilType type = getSoilType(world, pos); Block block = getSoilBlock(type, true); IBlockState oldState = world.getBlockState(pos); diff --git a/src/main/java/binnie/botany/gardening/ItemSoil.java b/src/main/java/binnie/botany/gardening/ItemSoil.java index 2a619c54..4f3a2646 100644 --- a/src/main/java/binnie/botany/gardening/ItemSoil.java +++ b/src/main/java/binnie/botany/gardening/ItemSoil.java @@ -19,35 +19,37 @@ public class ItemSoil extends ItemBlock { public ItemSoil(BlockSoil block) { super(block); - this.type = block.getType(); - this.noWeed = block.isWeedKilled(); - this.hasSubtypes = true; + type = block.getType(); + noWeed = block.isWeedKilled(); + hasSubtypes = true; } @Override @SideOnly(Side.CLIENT) - public void addInformation(final ItemStack stack, final EntityPlayer playerIn, final List tooltip, final boolean advanced) { + public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) { String info = ""; info += BlockSoil.getMoisture(stack, true, true); if (info.length() > 0) { info += ", "; } + info += BlockSoil.getPH(stack, true, true); if (info.length() > 0) { tooltip.add(info); } - if (this.noWeed) { + + if (noWeed) { tooltip.add(TextFormatting.GREEN + I18N.localise("botany.soil.weedkiller")); } } @Override public String getItemStackDisplayName(ItemStack stack) { - return this.getUnlocalizedNameInefficiently(stack).trim(); + return getUnlocalizedNameInefficiently(stack).trim(); } @Override - public int getMetadata(final int damage) { + public int getMetadata(int damage) { return damage; } } diff --git a/src/main/java/binnie/botany/gardening/ItemSoilMeter.java b/src/main/java/binnie/botany/gardening/ItemSoilMeter.java index eb17f6ec..6e45f29c 100644 --- a/src/main/java/binnie/botany/gardening/ItemSoilMeter.java +++ b/src/main/java/binnie/botany/gardening/ItemSoilMeter.java @@ -30,9 +30,9 @@ import binnie.core.util.I18N; public class ItemSoilMeter extends Item implements IItemModelRegister { public ItemSoilMeter() { - this.setCreativeTab(CreativeTabBotany.instance); - this.setUnlocalizedName("soil_meter"); - this.setMaxStackSize(1); + setCreativeTab(CreativeTabBotany.instance); + setUnlocalizedName("botany.soil_meter"); + setMaxStackSize(1); setRegistryName("soil_meter"); } @@ -70,26 +70,24 @@ public class ItemSoilMeter extends Item implements IItemModelRegister { pos = pos.down(); block = worldIn.getBlockState(pos).getBlock(); } + if (!gardening.isSoil(block)) { pos = pos.down(); block = worldIn.getBlockState(pos).getBlock(); } + if (gardening.isSoil(block) && !BinnieCore.getBinnieProxy().isSimulating(worldIn)) { IBlockSoil soil = (IBlockSoil) block; - String info = I18N.localise("botany.soil.type") + ": "; - info = info + soil.getType(worldIn, pos).getTranslated(); - info += ", " + TextFormatting.WHITE + I18N.localise("botany.moisture") + ": "; - info = info + soil.getMoisture(worldIn, pos).getLocalisedName(true); - info += ", " + TextFormatting.WHITE + I18N.localise("botany.ph") + ": "; - info = info + soil.getPH(worldIn, pos).getLocalisedName(true); + String info = I18N.localise("botany.soil.type") + ": " + + soil.getType(worldIn, pos).getTranslated() + ", " + + TextFormatting.WHITE + I18N.localise("botany.moisture") + ": " + + soil.getMoisture(worldIn, pos).getLocalisedName(true) + ", " + + TextFormatting.WHITE + I18N.localise("botany.ph") + ": " + + soil.getPH(worldIn, pos).getLocalisedName(true); + ITextComponent chat = new TextComponentString(info); player.sendStatusMessage(chat, false); } return EnumActionResult.SUCCESS; } - - @Override - public String getItemStackDisplayName(final ItemStack i) { - return "Soil Meter"; - } } diff --git a/src/main/java/binnie/botany/gardening/ItemTrowel.java b/src/main/java/binnie/botany/gardening/ItemTrowel.java index 891a42d7..7b5dfd5b 100644 --- a/src/main/java/binnie/botany/gardening/ItemTrowel.java +++ b/src/main/java/binnie/botany/gardening/ItemTrowel.java @@ -42,13 +42,13 @@ public class ItemTrowel extends Item implements IItemModelRegister { protected final String modelName; public ItemTrowel(ToolMaterial toolMaterial, String materialName) { - this.theToolMaterial = toolMaterial; - this.setMaxStackSize(1); - this.setMaxDamage(toolMaterial.getMaxUses()); - this.setCreativeTab(CreativeTabBotany.instance); - this.modelName = "trowel_" + materialName; - this.setUnlocalizedName("botany." + modelName); - this.setRegistryName(modelName); + theToolMaterial = toolMaterial; + setMaxStackSize(1); + setMaxDamage(toolMaterial.getMaxUses()); + setCreativeTab(CreativeTabBotany.instance); + modelName = "trowel_" + materialName; + setUnlocalizedName("botany." + modelName); + setRegistryName(modelName); } @SideOnly(Side.CLIENT) @@ -64,14 +64,17 @@ public class ItemTrowel extends Item implements IItemModelRegister { if (!player.canPlayerEdit(pos, facing, stack)) { return EnumActionResult.FAIL; } + Block block = worldIn.getBlockState(pos).getBlock(); if (facing == EnumFacing.DOWN || (!worldIn.isAirBlock(pos.up()) && worldIn.getBlockState(pos.up()).getBlock() != Botany.flower) || (block != Blocks.GRASS && block != Blocks.DIRT && block != Blocks.GRASS_PATH)) { return EnumActionResult.PASS; } + worldIn.playSound(player, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.BLOCKS, 1.0F, 1.0F); if (worldIn.isRemote) { return EnumActionResult.SUCCESS; } + IGardeningManager gardening = BotanyCore.getGardening(); EnumMoisture moisture = gardening.getNaturalMoisture(worldIn, pos); EnumAcidity acidity = gardening.getNaturalPH(worldIn, pos); @@ -99,7 +102,7 @@ public class ItemTrowel extends Item implements IItemModelRegister { } public String getToolMaterialName() { - return this.theToolMaterial.toString(); + return theToolMaterial.toString(); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/binnie/botany/gardening/ItemWeed.java b/src/main/java/binnie/botany/gardening/ItemWeed.java index 4bd73ea5..dc6b73b6 100644 --- a/src/main/java/binnie/botany/gardening/ItemWeed.java +++ b/src/main/java/binnie/botany/gardening/ItemWeed.java @@ -9,13 +9,13 @@ import binnie.core.util.I18N; public class ItemWeed extends ItemBlock { public ItemWeed(Block block) { super(block); - this.setHasSubtypes(true); - this.hasSubtypes = true; + setHasSubtypes(true); + hasSubtypes = true; } @Override - public String getItemStackDisplayName(final ItemStack stack) { - return I18N.localise("botany.plant." + BlockPlant.Type.values()[stack.getItemDamage()].getName()); + public String getItemStackDisplayName(ItemStack stack) { + return I18N.localise("botany.plant." + PlantType.values()[stack.getItemDamage()].getName()); } @Override diff --git a/src/main/java/binnie/botany/gardening/ModuleGardening.java b/src/main/java/binnie/botany/gardening/ModuleGardening.java index 212dbf25..d89cb23d 100644 --- a/src/main/java/binnie/botany/gardening/ModuleGardening.java +++ b/src/main/java/binnie/botany/gardening/ModuleGardening.java @@ -53,54 +53,58 @@ public class ModuleGardening implements IInitializable { @Override public void preInit() { + // TODO migrate static into BotanyItems Botany.plant = new BlockPlant(); - Botany.proxy.registerBlock(Botany.plant, new ItemWeed(Botany.plant)); Botany.soil = new BlockSoil(EnumSoilType.SOIL, "soil", false); - Botany.proxy.registerBlock(Botany.soil, new ItemSoil(Botany.soil)); Botany.loam = new BlockSoil(EnumSoilType.LOAM, "loam", false); - Botany.proxy.registerBlock(Botany.loam, new ItemSoil(Botany.loam)); Botany.flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false); - Botany.proxy.registerBlock(Botany.flowerbed, new ItemSoil(Botany.flowerbed)); Botany.soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soil_no_weed", true); - Botany.proxy.registerBlock(Botany.soilNoWeed, new ItemSoil(Botany.soilNoWeed)); Botany.loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loam_no_weed", true); - Botany.proxy.registerBlock(Botany.loamNoWeed, new ItemSoil(Botany.loamNoWeed)); Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed_no_weed", true); - Botany.proxy.registerBlock(Botany.flowerbedNoWeed, new ItemSoil(Botany.flowerbedNoWeed)); Botany.soilMeter = new ItemSoilMeter(); - Botany.proxy.registerItem(Botany.soilMeter); Botany.insulatedTube = new ItemInsulatedTube(); - Botany.proxy.registerItem(Botany.insulatedTube); Botany.trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "wood"); - Botany.proxy.registerItem(Botany.trowelWood); Botany.trowelStone = new ItemTrowel(Item.ToolMaterial.STONE, "stone"); - Botany.proxy.registerItem(Botany.trowelStone); Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "iron"); - Botany.proxy.registerItem(Botany.trowelIron); Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.DIAMOND, "diamond"); - Botany.proxy.registerItem(Botany.trowelDiamond); Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "gold"); - Botany.proxy.registerItem(Botany.trowelGold); Botany.misc = new ItemMisc(CreativeTabBotany.instance, BotanyItems.values()); - Botany.proxy.registerItem(Botany.misc); Botany.pigment = new ItemPigment(); - Botany.proxy.registerItem(Botany.pigment); Botany.clay = new ItemClay(); - Botany.proxy.registerItem(Botany.clay); Botany.ceramic = new BlockCeramic(); + Botany.stained = new BlockStainedGlass(); + Botany.ceramicTile = new BlockCeramicPatterned(); + Botany.ceramicBrick = new BlockCeramicBrick(); + + Botany.proxy.registerBlock(Botany.plant, new ItemWeed(Botany.plant)); + Botany.proxy.registerBlock(Botany.soil, new ItemSoil(Botany.soil)); + Botany.proxy.registerBlock(Botany.loam, new ItemSoil(Botany.loam)); + Botany.proxy.registerBlock(Botany.flowerbed, new ItemSoil(Botany.flowerbed)); + Botany.proxy.registerBlock(Botany.soilNoWeed, new ItemSoil(Botany.soilNoWeed)); + Botany.proxy.registerBlock(Botany.loamNoWeed, new ItemSoil(Botany.loamNoWeed)); + Botany.proxy.registerBlock(Botany.flowerbedNoWeed, new ItemSoil(Botany.flowerbedNoWeed)); + Botany.proxy.registerItem(Botany.soilMeter); + Botany.proxy.registerItem(Botany.insulatedTube); + Botany.proxy.registerItem(Botany.trowelWood); + Botany.proxy.registerItem(Botany.trowelStone); + Botany.proxy.registerItem(Botany.trowelIron); + Botany.proxy.registerItem(Botany.trowelDiamond); + Botany.proxy.registerItem(Botany.trowelGold); + Botany.proxy.registerItem(Botany.misc); + Botany.proxy.registerItem(Botany.pigment); + Botany.proxy.registerItem(Botany.clay); Botany.proxy.registerBlock(Botany.ceramic, new ItemCeramic(Botany.ceramic)); + Botany.proxy.registerBlock(Botany.stained, new ItemStainedGlass(Botany.stained)); + Botany.proxy.registerBlock(Botany.ceramicTile, new ItemDesign(Botany.ceramicTile)); + Botany.proxy.registerBlock(Botany.ceramicBrick, new ItemCeramicBrick(Botany.ceramicBrick)); + BinnieCore.getBinnieProxy().registerTileEntity(TileCeramic.class, "botany.tile.ceramic"); //BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer()); - Botany.stained = new BlockStainedGlass(); - Botany.proxy.registerBlock(Botany.stained, new ItemStainedGlass(Botany.stained)); //BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer()); - Botany.ceramicTile = new BlockCeramicPatterned(); - Botany.proxy.registerBlock(Botany.ceramicTile, new ItemDesign(Botany.ceramicTile)); - Botany.ceramicBrick = new BlockCeramicBrick(); - Botany.proxy.registerBlock(Botany.ceramicBrick, new ItemCeramicBrick(Botany.ceramicBrick)); BinnieCore.getBinnieProxy().registerTileEntity(TileCeramicBrick.class, "botany.tile.ceramicBrick"); //BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer()); //BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer()); + OreDictionary.registerOre("pigment", Botany.pigment); OreDictionary.registerOre("toolTrowel", Botany.trowelWood); OreDictionary.registerOre("toolTrowel", Botany.trowelStone); @@ -113,9 +117,9 @@ public class ModuleGardening implements IInitializable { public void init() { RecipeSorter.register("botany:ceramictile", CeramicTileRecipe.class, RecipeSorter.Category.SHAPED, ""); RecipeSorter.register("botany:pigment", PigmentRecipe.class, RecipeSorter.Category.SHAPED, ""); - final ItemStack yellow = new ItemStack(Blocks.YELLOW_FLOWER, 1); - final ItemStack red = new ItemStack(Blocks.RED_FLOWER, 1); - final ItemStack blue = new ItemStack(Blocks.RED_FLOWER, 1, 7); + ItemStack yellow = new ItemStack(Blocks.YELLOW_FLOWER, 1); + ItemStack red = new ItemStack(Blocks.RED_FLOWER, 1); + ItemStack blue = new ItemStack(Blocks.RED_FLOWER, 1, 7); for (boolean manual : new boolean[]{true, false}) { for (boolean fertilised : new boolean[]{true, false}) { for (EnumMoisture moist : EnumMoisture.values()) { @@ -131,7 +135,7 @@ public class ModuleGardening implements IInitializable { if (fertilised) { insulate += 3; } - new CircuitGarden(moist, null, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 0 + 128 * insulate), icon); + new CircuitGarden(moist, null, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 128 * insulate), icon); new CircuitGarden(moist, EnumAcidity.ACID, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate), icon); new CircuitGarden(moist, EnumAcidity.NEUTRAL, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate), icon); new CircuitGarden(moist, EnumAcidity.ALKALINE, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate), icon); @@ -146,80 +150,167 @@ public class ModuleGardening implements IInitializable { GameRegistry.addRecipe(new CeramicTileRecipe()); for (int mat = 0; mat < 4; ++mat) { for (int insulate = 0; insulate < 6; ++insulate) { - final ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate); - final ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes); - final ItemStack forestryTube = new ItemStack(Mods.Forestry.item("thermionic_tubes"), 1, mat); + ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate); + ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes); + ItemStack forestryTube = new ItemStack(Mods.Forestry.item("thermionic_tubes"), 1, mat); GameRegistry.addShapelessRecipe(tubes, forestryTube, forestryTube, insulateStack); } } - GameRegistry.addRecipe(new ShapedOreRecipe(Botany.trowelWood, "d ", " x ", " s", 'd', Blocks.DIRT, 's', "stickWood", 'x', "plankWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(Botany.trowelStone, "d ", " x ", " s", 'd', Blocks.DIRT, 's', "stickWood", 'x', "cobblestone")); - GameRegistry.addRecipe(new ShapedOreRecipe(Botany.trowelIron, "d ", " x ", " s", 'd', Blocks.DIRT, 's', "stickWood", 'x', "ingotIron")); - GameRegistry.addRecipe(new ShapedOreRecipe(Botany.trowelGold, "d ", " x ", " s", 'd', Blocks.DIRT, 's', "stickWood", 'x', "ingotGold")); - GameRegistry.addRecipe(new ShapedOreRecipe(Botany.trowelDiamond, "d ", " x ", " s", 'd', Blocks.DIRT, 's', "stickWood", 'x', "gemDiamond")); - GameRegistry.addRecipe(new ShapedOreRecipe(Botany.soilMeter, " gg", " rg", "i ", 'g', "ingotGold", 'r', "dustRedstone", 'i', "ingotIron")); - GameRegistry.addShapelessRecipe(BotanyItems.Weedkiller.get(4), new ItemStack(Items.SPIDER_EYE), new ItemStack(Items.WHEAT_SEEDS), new ItemStack(Items.WHEAT_SEEDS), new ItemStack(Items.WHEAT_SEEDS)); - GameRegistry.addShapelessRecipe(BotanyItems.AshPowder.get(4), Mods.Forestry.stack("ash")); - GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), Mods.Forestry.stack("mulch")); - GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), Mods.Forestry.stack("fertilizer_bio")); - GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), Mods.Forestry.stack("fertilizer_compound")); - GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), Mods.Forestry.stack("wood_pulp")); - GameRegistry.addRecipe(new ShapelessOreRecipe(BotanyItems.SulphurPowder.get(4), "dustSulphur")); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Botany.pigment, 2, EnumFlowerColor.Black.ordinal()), "pigment", "pigment", "dyeBlack")); - gardening.registerAcidFertiliser(BotanyItems.SulphurPowder.get(1), 1); - gardening.registerAcidFertiliser(BotanyItems.MulchPowder.get(1), 1); + + GameRegistry.addRecipe(new ShapedOreRecipe( + Botany.trowelWood, + "d ", " x ", " s", + 'd', Blocks.DIRT, + 's', "stickWood", + 'x', "plankWood") + ); + + GameRegistry.addRecipe(new ShapedOreRecipe( + Botany.trowelStone, + "d ", " x ", " s", + 'd', Blocks.DIRT, + 's', "stickWood", + 'x', "cobblestone" + )); + + GameRegistry.addRecipe(new ShapedOreRecipe( + Botany.trowelIron, + "d ", " x ", " s", + 'd', Blocks.DIRT, + 's', "stickWood", + 'x', "ingotIron" + )); + + GameRegistry.addRecipe(new ShapedOreRecipe( + Botany.trowelGold, + "d ", " x ", " s", + 'd', Blocks.DIRT, + 's', "stickWood", + 'x', "ingotGold" + )); + + GameRegistry.addRecipe(new ShapedOreRecipe( + Botany.trowelDiamond, + "d ", " x ", " s", + 'd', Blocks.DIRT, + 's', "stickWood", + 'x', "gemDiamond" + )); + + GameRegistry.addRecipe(new ShapedOreRecipe( + Botany.soilMeter, + " gg", " rg", "i ", + 'g', "ingotGold", + 'r', "dustRedstone", + 'i', "ingotIron" + )); + + GameRegistry.addShapelessRecipe( + BotanyItems.WEEDKILLER.get(4), + new ItemStack(Items.SPIDER_EYE), + new ItemStack(Items.WHEAT_SEEDS), + new ItemStack(Items.WHEAT_SEEDS), + new ItemStack(Items.WHEAT_SEEDS) + ); + + GameRegistry.addShapelessRecipe( + BotanyItems.POWDER_ASH.get(4), + Mods.Forestry.stack("ash") + ); + + GameRegistry.addShapelessRecipe( + BotanyItems.POWDER_MULCH.get(4), + Mods.Forestry.stack("mulch") + ); + + GameRegistry.addShapelessRecipe( + BotanyItems.POWDER_COMPOST.get(4), + Mods.Forestry.stack("fertilizer_bio") + ); + + GameRegistry.addShapelessRecipe( + BotanyItems.POWDER_FERTILISER.get(4), + Mods.Forestry.stack("fertilizer_compound") + ); + + GameRegistry.addShapelessRecipe( + BotanyItems.POWDER_PULP.get(4), + Mods.Forestry.stack("wood_pulp") + ); + + GameRegistry.addRecipe(new ShapelessOreRecipe( + BotanyItems.POWDER_SULPHUR.get(4), + "dustSulphur" + )); + + GameRegistry.addRecipe(new ShapelessOreRecipe( + new ItemStack(Botany.pigment, 2, EnumFlowerColor.Black.ordinal()), + "pigment", "pigment", "dyeBlack" + )); + + gardening.registerAcidFertiliser(BotanyItems.POWDER_SULPHUR.get(1), 1); + gardening.registerAcidFertiliser(BotanyItems.POWDER_MULCH.get(1), 1); gardening.registerAcidFertiliser(Mods.Forestry.stack("mulch"), 2); - for (final ItemStack stack : OreDictionary.getOres("dustSulfur")) { + for (ItemStack stack : OreDictionary.getOres("dustSulfur")) { gardening.registerAcidFertiliser(stack, 2); } - gardening.registerAlkalineFertiliser(BotanyItems.AshPowder.get(1), 1); - gardening.registerAlkalineFertiliser(BotanyItems.PulpPowder.get(1), 1); + + gardening.registerAlkalineFertiliser(BotanyItems.POWDER_ASH.get(1), 1); + gardening.registerAlkalineFertiliser(BotanyItems.POWDER_PULP.get(1), 1); gardening.registerAlkalineFertiliser(Mods.Forestry.stack("ash"), 2); gardening.registerAlkalineFertiliser(Mods.Forestry.stack("wood_pulp"), 2); - gardening.registerNutrientFertiliser(BotanyItems.CompostPowder.get(1), 1); - gardening.registerNutrientFertiliser(BotanyItems.FertiliserPowder.get(1), 1); + gardening.registerNutrientFertiliser(BotanyItems.POWDER_COMPOST.get(1), 1); + gardening.registerNutrientFertiliser(BotanyItems.POWDER_FERTILISER.get(1), 1); gardening.registerNutrientFertiliser(Mods.Forestry.stack("fertilizer_bio"), 2); gardening.registerNutrientFertiliser(Mods.Forestry.stack("fertilizer_compound"), 2); - for (final Map.Entry entry : ModuleGardening.queuedAcidFertilisers.entrySet()) { - this.addAcidFertiliserRecipe(entry.getKey(), entry.getValue()); + + for (Map.Entry entry : ModuleGardening.queuedAcidFertilisers.entrySet()) { + addAcidFertiliserRecipe(entry.getKey(), entry.getValue()); } - for (final Map.Entry entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) { - this.addAlkalineFertiliserRecipe(entry.getKey(), entry.getValue()); + for (Map.Entry entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) { + addAlkalineFertiliserRecipe(entry.getKey(), entry.getValue()); } - for (final Map.Entry entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) { - this.addNutrientFertiliserRecipe(entry.getKey(), entry.getValue()); + for (Map.Entry entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) { + addNutrientFertiliserRecipe(entry.getKey(), entry.getValue()); } - GameRegistry.addRecipe(BotanyItems.Mortar.get(6), " c ", "cgc", " c ", 'c', Items.CLAY_BALL, 'g', Blocks.GRAVEL); - for (final EnumFlowerColor c : EnumFlowerColor.values()) { - final ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal()); - final ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal()); + + GameRegistry.addRecipe(BotanyItems.MORTAR.get(6), " c ", "cgc", " c ", 'c', Items.CLAY_BALL, 'g', Blocks.GRAVEL); + for (EnumFlowerColor c : EnumFlowerColor.values()) { + ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal()); + ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal()); GameRegistry.addShapelessRecipe(clay, Items.CLAY_BALL, Items.CLAY_BALL, Items.CLAY_BALL, pigment); GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f); - final ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal()); + ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal()); glass.setCount(4); - GameRegistry.addShapedRecipe(glass, " g ", "gpg", " g ", 'g', Blocks.GLASS, 'p', pigment); + + GameRegistry.addShapedRecipe( + glass, + " g ", "gpg", " g ", + 'g', Blocks.GLASS, + 'p', pigment + ); } GameRegistry.addRecipe(new PigmentRecipe()); } - private ItemStack getStack(final int type, final int pH, final int moisture) { + private ItemStack getStack(int type, int pH, int moisture) { if (type >= 0 && type <= 2 && pH >= 0 && pH <= 2 && moisture >= 0 && moisture <= 2) { return new ItemStack(BotanyCore.getGardening().getSoilBlock(EnumSoilType.values()[type]), 1, BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture])); } return ItemStack.EMPTY; } - private void addAcidFertiliserRecipe(final ItemStack stack, final int strengthMax) { + private void addAcidFertiliserRecipe(ItemStack stack, int strengthMax) { for (int moisture = 0; moisture < 3; ++moisture) { for (int pH = 0; pH < 3; ++pH) { for (int type = 0; type < 3; ++type) { int numOfBlocks = strengthMax * strengthMax; for (int strength = 1; strength < strengthMax; ++strength) { - final ItemStack start = this.getStack(type, pH, moisture); - final ItemStack end = this.getStack(type, pH - strength, moisture); + ItemStack start = getStack(type, pH, moisture); + ItemStack end = getStack(type, pH - strength, moisture); if (!start.isEmpty() && !end.isEmpty()) { end.setCount(numOfBlocks); - final Object[] stacks = new Object[numOfBlocks + 1]; + Object[] stacks = new Object[numOfBlocks + 1]; for (int i = 0; i < numOfBlocks; ++i) { stacks[i] = start; } @@ -233,17 +324,17 @@ public class ModuleGardening implements IInitializable { } } - private void addAlkalineFertiliserRecipe(final ItemStack stack, final int strengthMax) { + private void addAlkalineFertiliserRecipe(ItemStack stack, int strengthMax) { for (int moisture = 0; moisture < 3; ++moisture) { for (int pH = 0; pH < 3; ++pH) { for (int type = 0; type < 3; ++type) { int numOfBlocks = strengthMax * strengthMax; for (int strength = 1; strength < strengthMax; ++strength) { - final ItemStack start = this.getStack(type, pH, moisture); - final ItemStack end = this.getStack(type, pH + strength, moisture); + ItemStack start = getStack(type, pH, moisture); + ItemStack end = getStack(type, pH + strength, moisture); if (!end.isEmpty()) { end.setCount(numOfBlocks); - final Object[] stacks = new Object[numOfBlocks + 1]; + Object[] stacks = new Object[numOfBlocks + 1]; for (int i = 0; i < numOfBlocks; ++i) { stacks[i] = start; } @@ -257,17 +348,17 @@ public class ModuleGardening implements IInitializable { } } - private void addNutrientFertiliserRecipe(final ItemStack stack, final int strengthMax) { + private void addNutrientFertiliserRecipe(ItemStack stack, int strengthMax) { for (int moisture = 0; moisture < 3; ++moisture) { for (int pH = 0; pH < 3; ++pH) { for (int type = 0; type < 3; ++type) { int numOfBlocks = strengthMax * strengthMax; for (int strength = 1; strength < strengthMax; ++strength) { - final ItemStack start = this.getStack(type, pH, moisture); - final ItemStack end = this.getStack(type + strength, pH, moisture); + ItemStack start = getStack(type, pH, moisture); + ItemStack end = getStack(type + strength, pH, moisture); if (!end.isEmpty()) { end.setCount(numOfBlocks); - final Object[] stacks = new Object[numOfBlocks + 1]; + Object[] stacks = new Object[numOfBlocks + 1]; for (int i = 0; i < numOfBlocks; ++i) { stacks[i] = start; } diff --git a/src/main/java/binnie/botany/gardening/PlantType.java b/src/main/java/binnie/botany/gardening/PlantType.java new file mode 100644 index 00000000..49696cbc --- /dev/null +++ b/src/main/java/binnie/botany/gardening/PlantType.java @@ -0,0 +1,43 @@ +package binnie.botany.gardening; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; + +import binnie.botany.Botany; + +public enum PlantType implements IStringSerializable { + WEEDS("weeds", true), + WEEDS_LONG("weeds_long", true), + WEEDS_VERY_LONG("weeds_very_long", true), + DEAD_FLOWER("dead_flower"), + DECAYING_FLOWER("decaying_flower"); + + String name; + boolean isWeed; + + PlantType(String name) { + this(name, false); + } + + PlantType(String name, boolean isWeed) { + this.name = name; + this.isWeed = isWeed; + } + + public static PlantType get(int id) { + return values()[id % values().length]; + } + + public ItemStack get() { + return new ItemStack(Botany.plant, 1, ordinal()); + } + + public boolean isWeed() { + return isWeed; + } + + @Override + public String getName() { + return name; + } +} diff --git a/src/main/java/binnie/botany/genetics/AlleleEffectNone.java b/src/main/java/binnie/botany/genetics/AlleleEffectNone.java index 0ded7726..a0ae1f28 100644 --- a/src/main/java/binnie/botany/genetics/AlleleEffectNone.java +++ b/src/main/java/binnie/botany/genetics/AlleleEffectNone.java @@ -14,7 +14,7 @@ public class AlleleEffectNone implements IAlleleFlowerEffect { } @Override - public IEffectData validateStorage(final IEffectData storedData) { + public IEffectData validateStorage(IEffectData storedData) { return storedData; } @@ -34,12 +34,12 @@ public class AlleleEffectNone implements IAlleleFlowerEffect { } @Override - public IEffectData doEffect(final IFlowerGenome genome, final IEffectData effect, final World world, final int x, final int y, final int z) { + public IEffectData doEffect(IFlowerGenome genome, IEffectData effect, World world, int x, int y, int z) { return effect; } @Override public String getUnlocalizedName() { - return this.getUID(); + return getUID(); } } diff --git a/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java b/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java index 884f0105..0e245043 100644 --- a/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java +++ b/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java @@ -27,14 +27,14 @@ public class AlleleFlowerSpecies extends AlleleSpecies implements IAlleleFlowerS private EnumMoisture moisture = EnumMoisture.NORMAL; public AlleleFlowerSpecies( - String uid, - String unlocalizedName, - String authority, - String unlocalizedDescription, - boolean isDominant, - IClassification branch, - String binomial, - IFlowerType flowerType) { + String uid, + String unlocalizedName, + String authority, + String unlocalizedDescription, + boolean isDominant, + IClassification branch, + String binomial, + IFlowerType flowerType) { super(uid, unlocalizedName, authority, unlocalizedDescription, isDominant, branch, binomial); this.flowerType = flowerType; } diff --git a/src/main/java/binnie/botany/genetics/BotanistTracker.java b/src/main/java/binnie/botany/genetics/BotanistTracker.java index 822a67c8..7379b86b 100644 --- a/src/main/java/binnie/botany/genetics/BotanistTracker.java +++ b/src/main/java/binnie/botany/genetics/BotanistTracker.java @@ -10,16 +10,16 @@ import binnie.Binnie; import binnie.botany.api.IBotanistTracker; public class BotanistTracker extends BreedingTracker implements IBotanistTracker { - public BotanistTracker(final String s) { + public BotanistTracker(String s) { super(s, "NORMAL"); } @Override - public void registerPickup(final IIndividual individual) { + public void registerPickup(IIndividual individual) { } @Override - protected IBreedingTracker getBreedingTracker(final EntityPlayer player) { + protected IBreedingTracker getBreedingTracker(EntityPlayer player) { return Binnie.GENETICS.getFlowerRoot().getBreedingTracker(player.world, player.getGameProfile()); } diff --git a/src/main/java/binnie/botany/genetics/ColorMix.java b/src/main/java/binnie/botany/genetics/ColorMix.java new file mode 100644 index 00000000..b320e30c --- /dev/null +++ b/src/main/java/binnie/botany/genetics/ColorMix.java @@ -0,0 +1,44 @@ +package binnie.botany.genetics; + +import binnie.botany.api.IColorMix; +import binnie.botany.api.IFlowerColor; + +public class ColorMix implements IColorMix { + IFlowerColor color1; + IFlowerColor color2; + IFlowerColor result; + int chance; + + public ColorMix(IFlowerColor color1, IFlowerColor color2, IFlowerColor result, int chance) { + this.color1 = color1; + this.color2 = color2; + this.result = result; + this.chance = chance; + } + + @Override + public IFlowerColor getColorFirst() { + return color1; + } + + @Override + public IFlowerColor getColorSecond() { + return color2; + } + + @Override + public boolean isMutation(IFlowerColor colorFirst, IFlowerColor colorSecond) { + return (colorFirst == color1 && colorSecond == color2) + || (colorFirst == color2 && colorSecond == color1); + } + + @Override + public int getChance() { + return chance; + } + + @Override + public IFlowerColor getResult() { + return result; + } +} diff --git a/src/main/java/binnie/botany/genetics/ColourMix.java b/src/main/java/binnie/botany/genetics/ColourMix.java deleted file mode 100644 index 193fe56a..00000000 --- a/src/main/java/binnie/botany/genetics/ColourMix.java +++ /dev/null @@ -1,43 +0,0 @@ -package binnie.botany.genetics; - -import binnie.botany.api.IColorMix; -import binnie.botany.api.IFlowerColour; - -public class ColourMix implements IColorMix { - IFlowerColour colour1; - IFlowerColour colour2; - IFlowerColour result; - int chance; - - public ColourMix(final IFlowerColour colour1, final IFlowerColour colour2, final IFlowerColour result, final int chance) { - this.colour1 = colour1; - this.colour2 = colour2; - this.result = result; - this.chance = chance; - } - - @Override - public IFlowerColour getColorFirst() { - return this.colour1; - } - - @Override - public IFlowerColour getColorSecond() { - return this.colour2; - } - - @Override - public boolean isMutation(final IFlowerColour colorFirst, final IFlowerColour colorSecond) { - return (colorFirst == this.colour1 && colorSecond == this.colour2) || (colorFirst == this.colour2 && colorSecond == this.colour1); - } - - @Override - public int getChance() { - return this.chance; - } - - @Override - public IFlowerColour getResult() { - return this.result; - } -} diff --git a/src/main/java/binnie/botany/genetics/EnumFlowerColor.java b/src/main/java/binnie/botany/genetics/EnumFlowerColor.java index 64c107e7..885b85b4 100644 --- a/src/main/java/binnie/botany/genetics/EnumFlowerColor.java +++ b/src/main/java/binnie/botany/genetics/EnumFlowerColor.java @@ -93,11 +93,11 @@ public enum EnumFlowerColor implements IStringSerializable { private FlowerColorAllele allele; - EnumFlowerColor(final String ident, final int c) { + EnumFlowerColor(String ident, int c) { this(c); } - EnumFlowerColor(final int color) { + EnumFlowerColor(int color) { int r = color >> 16 & 0xFF; int g = color >> 8 & 0xFF; int b = color & 0xFF; @@ -105,12 +105,12 @@ public enum EnumFlowerColor implements IStringSerializable { g = (int) (0.45 * (g + 174)); b = (int) (0.45 * (b + 131)); int colorDis = (r << 16) + (g << 8) + b; - String uid = "botany.color" + this.name(); + String uid = "botany.color" + name(); allele = new FlowerColorAllele(uid, ordinal(), color, colorDis, name().toLowerCase(), uid, true); } - public static void addMix(final EnumFlowerColor start1, final EnumFlowerColor start2, final EnumFlowerColor result, final int chance) { - BotanyCore.getFlowerRoot().registerColourMix(new ColourMix(start1.allele, start2.allele, result.allele, chance)); + public static void addMix(EnumFlowerColor start1, EnumFlowerColor start2, EnumFlowerColor result, int chance) { + BotanyCore.getFlowerRoot().registerColourMix(new ColorMix(start1.allele, start2.allele, result.allele, chance)); } public static void setupMutations() { @@ -2937,24 +2937,24 @@ public enum EnumFlowerColor implements IStringSerializable { } } - public static EnumFlowerColor get(final int i) { + public static EnumFlowerColor get(int i) { return values()[Math.max(0, i) % values().length]; } - public String getDisplayName(){ + public String getDisplayName() { return I18N.localise("botany.color." + getName()); } - + @Override public String getName() { return name().toLowerCase(); } public String getHTMLName() { - return this.name(); + return name(); } - public FlowerColorAllele getFlowerColorAllele(){ + public FlowerColorAllele getFlowerColorAllele() { return allele; } } diff --git a/src/main/java/binnie/botany/genetics/EnumFlowerType.java b/src/main/java/binnie/botany/genetics/EnumFlowerType.java index 6841e9bb..2e94311b 100644 --- a/src/main/java/binnie/botany/genetics/EnumFlowerType.java +++ b/src/main/java/binnie/botany/genetics/EnumFlowerType.java @@ -76,14 +76,14 @@ public enum EnumFlowerType implements IFlowerType { this(1); } - EnumFlowerType(final int sections) { + EnumFlowerType(int sections) { this.sections = sections; } @Override @SideOnly(Side.CLIENT) public void registerModels(Item item, IModelManager manager, EnumFlowerStage type) { - String pre = (this.sections == 1) ? "" : "double/"; + String pre = (sections == 1) ? "" : "double/"; flower = new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":flowers/" + pre + getName(), "inventory"); seed = new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":flowers/seed", "inventory"); pollen = new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":flowers/pollen", "inventory"); @@ -97,19 +97,18 @@ public enum EnumFlowerType implements IFlowerType { return seed; } else if (type == EnumFlowerStage.POLLEN) { return pollen; - } else { - return flower; } + return flower; } @Override public int getID() { - return this.ordinal(); + return ordinal(); } @Override public int getSections() { - return this.sections; + return sections; } @Override diff --git a/src/main/java/binnie/botany/genetics/Flower.java b/src/main/java/binnie/botany/genetics/Flower.java index 4168b7fa..4ca3ef4d 100644 --- a/src/main/java/binnie/botany/genetics/Flower.java +++ b/src/main/java/binnie/botany/genetics/Flower.java @@ -19,96 +19,100 @@ import binnie.botany.api.EnumFlowerChromosome; import binnie.botany.api.IAlleleFlowerSpecies; import binnie.botany.api.IColorMix; import binnie.botany.api.IFlower; -import binnie.botany.api.IFlowerColour; +import binnie.botany.api.IFlowerColor; import binnie.botany.api.IFlowerGenome; import binnie.botany.api.IFlowerMutation; import binnie.botany.core.BotanyCore; public class Flower extends Individual implements IFlower { public IFlowerGenome genome; + @Nullable public IFlowerGenome mate; + private int age; private boolean wilting; private boolean flowered; - public Flower(final NBTTagCompound nbt) { + public Flower(NBTTagCompound nbt) { super(nbt); if (nbt.hasKey("Age")) { - this.age = nbt.getInteger("Age"); + age = nbt.getInteger("Age"); } else { - this.age = 0; + age = 0; } - this.wilting = nbt.hasKey("Wilt") && nbt.getBoolean("Wilt"); + wilting = nbt.hasKey("Wilt") && nbt.getBoolean("Wilt"); if (nbt.hasKey("Flowered")) { - this.flowered = nbt.getBoolean("Flowered"); + flowered = nbt.getBoolean("Flowered"); } else { - this.flowered = age > 0; + flowered = age > 0; } if (nbt.hasKey("Genome")) { - this.genome = new FlowerGenome(nbt.getCompoundTag("Genome")); + genome = new FlowerGenome(nbt.getCompoundTag("Genome")); } else { - this.genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate()); + genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate()); } if (nbt.hasKey("Mate")) { - this.mate = new FlowerGenome(nbt.getCompoundTag("Mate")); + mate = new FlowerGenome(nbt.getCompoundTag("Mate")); } } - public Flower(final IFlowerGenome genome, final int age) { + public Flower(IFlowerGenome genome, int age) { this.age = 0; - this.wilting = false; this.genome = genome; this.age = age; - this.flowered = age > 0; + wilting = false; + flowered = age > 0; } @Override public String getDisplayName() { - final IAlleleFlowerSpecies species = this.getGenome().getPrimary(); + IAlleleFlowerSpecies species = getGenome().getPrimary(); String name = species.getName(); - if (this.age == 0) { + if (age == 0) { name += ""; } return name; } @Override - public void addTooltip(final List list) { - final IAlleleFlowerSpecies primary = this.genome.getPrimary(); - final IAlleleFlowerSpecies secondary = this.genome.getSecondary(); - if (!this.isPureBred(EnumFlowerChromosome.SPECIES)) { + public void addTooltip(List list) { + IAlleleFlowerSpecies primary = genome.getPrimary(); + IAlleleFlowerSpecies secondary = genome.getSecondary(); + // TODO localize + if (!isPureBred(EnumFlowerChromosome.SPECIES)) { list.add(TextFormatting.BLUE + primary.getAlleleName() + "-" + secondary.getAlleleName() + " Hybrid"); } - list.add(TextFormatting.GOLD + "Age: " + this.getAge()); - list.add(TextFormatting.GOLD + "T: " + this.getGenome().getPrimary().getTemperature() + " / " + this.getGenome().getToleranceTemperature()); - list.add(TextFormatting.GOLD + "M: " + this.getGenome().getPrimary().getMoisture() + " / " + this.getGenome().getToleranceMoisture()); - list.add(TextFormatting.GOLD + "pH: " + this.getGenome().getPrimary().getHumidity() + " / " + this.getGenome().getTolerancePH()); - list.add(TextFormatting.GOLD + "Fert: " + this.getGenome().getFertility() + "x"); + + list.add(TextFormatting.GOLD + "Age: " + getAge()); + list.add(TextFormatting.GOLD + "T: " + getGenome().getPrimary().getTemperature() + " / " + getGenome().getToleranceTemperature()); + list.add(TextFormatting.GOLD + "M: " + getGenome().getPrimary().getMoisture() + " / " + getGenome().getToleranceMoisture()); + list.add(TextFormatting.GOLD + "pH: " + getGenome().getPrimary().getHumidity() + " / " + getGenome().getTolerancePH()); + list.add(TextFormatting.GOLD + "Fert: " + getGenome().getFertility() + "x"); } @Override public String getIdent() { - return this.getGenome().getPrimary().getUID(); + return getGenome().getPrimary().getUID(); } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbttagcompound2) { + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound2) { NBTTagCompound nbttagcompound = super.writeToNBT(nbttagcompound2); - nbttagcompound.setInteger("Age", this.age); - nbttagcompound.setBoolean("Wilt", this.wilting); - nbttagcompound.setBoolean("Flowered", this.flowered); - final NBTTagCompound nbtGenome = new NBTTagCompound(); - this.genome.writeToNBT(nbtGenome); + nbttagcompound.setInteger("Age", age); + nbttagcompound.setBoolean("Wilt", wilting); + nbttagcompound.setBoolean("Flowered", flowered); + NBTTagCompound nbtGenome = new NBTTagCompound(); + genome.writeToNBT(nbtGenome); nbttagcompound.setTag("Genome", nbtGenome); - if (this.mate != null) { - final NBTTagCompound nbtMate = new NBTTagCompound(); - this.mate.writeToNBT(nbtMate); + if (mate != null) { + NBTTagCompound nbtMate = new NBTTagCompound(); + mate.writeToNBT(nbtMate); nbttagcompound.setTag("Mate", nbtMate); } return nbttagcompound; @@ -116,7 +120,7 @@ public class Flower extends Individual implements IFlower { @Override public IFlowerGenome getGenome() { - return this.genome; + return genome; } private IChromosome inheritChromosome(Random rand, IChromosome parentFirst, IChromosome parentSecond) { @@ -140,91 +144,91 @@ public class Flower extends Individual implements IFlower { @Override public void mate(IFlower other) { - this.mate = new FlowerGenome(other.getGenome().getChromosomes()); + mate = new FlowerGenome(other.getGenome().getChromosomes()); } @Override @Nullable public IFlowerGenome getMate() { - return this.mate; + return mate; } @Override public IFlower copy() { - final NBTTagCompound nbttagcompound = new NBTTagCompound(); - this.writeToNBT(nbttagcompound); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + writeToNBT(nbttagcompound); return new Flower(nbttagcompound); } @Override public int getAge() { - return this.age; + return age; } @Override - public void setAge(final int i) { - this.age = i; + public void setAge(int i) { + age = i; } @Override public void age() { - if (this.age < 15) { - ++this.age; + if (age < 15) { + age++; } } @Override public int getMaxAge() { - return this.getGenome().getLifespan(); + return getGenome().getLifespan(); } @Override public boolean isWilted() { - return this.wilting; + return wilting; } @Override - public void setWilted(final boolean wilted) { - this.wilting = wilted; + public void setWilted(boolean wilted) { + wilting = wilted; } @Override public boolean hasFlowered() { - return this.flowered; + return flowered; } @Override - public void setFlowered(final boolean flowered) { + public void setFlowered(boolean flowered) { this.flowered = flowered; } @Override public void removeMate() { - this.mate = null; + mate = null; } @Override - public IFlower getOffspring(final World world, final BlockPos pos) { - if (this.mate != null) { - final IChromosome[] chromosomes = new IChromosome[this.genome.getChromosomes().length]; - IChromosome[] parentFirst = this.mutateSpecies(world, pos, this.genome, this.mate); - IChromosome[] parentSecond = this.mutateSpecies(world, pos, this.mate, this.genome); + public IFlower getOffspring(World world, BlockPos pos) { + if (mate != null) { + IChromosome[] chromosomes = new IChromosome[genome.getChromosomes().length]; + IChromosome[] parentFirst = mutateSpecies(world, pos, genome, mate); + IChromosome[] parentSecond = mutateSpecies(world, pos, mate, genome); for (int i = 0; i < parentFirst.length; ++i) { if (parentFirst[i] != null && parentSecond[i] != null) { chromosomes[i] = Chromosome.inheritChromosome(world.rand, parentFirst[i], parentSecond[i]); } } return new Flower(new FlowerGenome(chromosomes), 0); - } else { - NBTTagCompound nbt = new NBTTagCompound(); - writeToNBT(nbt); - return new Flower(nbt); } + + NBTTagCompound nbt = new NBTTagCompound(); + writeToNBT(nbt); + return new Flower(nbt); } private IChromosome[] mutateSpecies(World world, BlockPos pos, IFlowerGenome genomeFirst, IFlowerGenome genomeSecond) { IChromosome[] parentFirst = genomeFirst.getChromosomes(); - final IChromosome[] parentSecond = genomeSecond.getChromosomes(); + IChromosome[] parentSecond = genomeSecond.getChromosomes(); IAlleleFlowerSpecies alleleFrist; IAlleleFlowerSpecies alleleSecond; IFlowerGenome genome0; @@ -240,40 +244,44 @@ public class Flower extends Individual implements IFlower { genome0 = genomeSecond; genome2 = genomeFirst; } - IFlowerColour colourFirst = genome0.getPrimaryColor(); - IFlowerColour colourSecond = genome2.getPrimaryColor(); - if (colourFirst != colourSecond) { - for (final IColorMix mutation : BotanyCore.getFlowerRoot().getColorMixes(true)) { - if (mutation.isMutation(colourFirst, colourSecond) && world.rand.nextFloat() * 100.0f < mutation.getChance()) { + + IFlowerColor colorFirst = genome0.getPrimaryColor(); + IFlowerColor colorSecond = genome2.getPrimaryColor(); + if (colorFirst != colorSecond) { + for (IColorMix mutation : BotanyCore.getFlowerRoot().getColorMixes(true)) { + if (mutation.isMutation(colorFirst, colorSecond) && world.rand.nextFloat() * 100.0f < mutation.getChance()) { parentFirst[EnumFlowerChromosome.PRIMARY.ordinal()] = new Chromosome(mutation.getResult().getAllele()); } } } - colourFirst = genome0.getSecondaryColor(); - colourSecond = genome2.getSecondaryColor(); - if (colourFirst != colourSecond) { - for (final IColorMix mutation : BotanyCore.getFlowerRoot().getColorMixes(true)) { - if (mutation.isMutation(colourFirst, colourSecond) && world.rand.nextFloat() * 100.0f < mutation.getChance()) { + + colorFirst = genome0.getSecondaryColor(); + colorSecond = genome2.getSecondaryColor(); + if (colorFirst != colorSecond) { + for (IColorMix mutation : BotanyCore.getFlowerRoot().getColorMixes(true)) { + if (mutation.isMutation(colorFirst, colorSecond) && world.rand.nextFloat() * 100.0f < mutation.getChance()) { parentFirst[EnumFlowerChromosome.SECONDARY.ordinal()] = new Chromosome(mutation.getResult().getAllele()); } } } - colourFirst = genome0.getStemColor(); - colourSecond = genome2.getStemColor(); - if (colourFirst != colourSecond) { - for (final IColorMix mutation : BotanyCore.getFlowerRoot().getColorMixes(true)) { - if (mutation.isMutation(colourFirst, colourSecond) && world.rand.nextFloat() * 100.0f < mutation.getChance()) { + colorFirst = genome0.getStemColor(); + colorSecond = genome2.getStemColor(); + if (colorFirst != colorSecond) { + for (IColorMix mutation : BotanyCore.getFlowerRoot().getColorMixes(true)) { + if (mutation.isMutation(colorFirst, colorSecond) && world.rand.nextFloat() * 100.0f < mutation.getChance()) { parentFirst[EnumFlowerChromosome.STEM.ordinal()] = new Chromosome(mutation.getResult().getAllele()); } } } + IChromosome[] template = null; - for (final IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) { - final float chance = mutation2.getChance(world, pos, alleleFrist, alleleSecond, genome0, genome2); + for (IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) { + float chance = mutation2.getChance(world, pos, alleleFrist, alleleSecond, genome0, genome2); if (chance > 0.0f && world.rand.nextFloat() * 100.0f < chance && template == null) { template = BotanyCore.getFlowerRoot().templateAsChromosomes(mutation2.getTemplate()); } } + if (template != null) { parentFirst = template; } diff --git a/src/main/java/binnie/botany/genetics/FlowerAlyzerPlugin.java b/src/main/java/binnie/botany/genetics/FlowerAlyzerPlugin.java index c28c715a..e27a82a7 100644 --- a/src/main/java/binnie/botany/genetics/FlowerAlyzerPlugin.java +++ b/src/main/java/binnie/botany/genetics/FlowerAlyzerPlugin.java @@ -32,12 +32,6 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin { public static final int COLUMN_0 = 12; public static final int COLUMN_1 = 90; public static final int COLUMN_2 = 155; - private int lastTopOffset; - private int rowSize = 12; - private int margin = 10; - private int guiLeft; - private int guiTop; - private HashMap iconStacks = new HashMap<>(); private static final EnumFlowerChromosome[] firstPageChromosome = new EnumFlowerChromosome[]{ EnumFlowerChromosome.SPECIES, EnumFlowerChromosome.SAPPINESS, @@ -46,39 +40,43 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin { EnumFlowerChromosome.EFFECT, EnumFlowerChromosome.LIFESPAN }; - private static final EnumFlowerChromosome[] secondPageColorChromosome = new EnumFlowerChromosome[]{ EnumFlowerChromosome.PRIMARY, EnumFlowerChromosome.SECONDARY, EnumFlowerChromosome.STEM, }; - private static final EnumFlowerChromosome[] secondPageToleranceChromosome = new EnumFlowerChromosome[]{ EnumFlowerChromosome.TEMPERATURE_TOLERANCE, EnumFlowerChromosome.HUMIDITY_TOLERANCE, EnumFlowerChromosome.PH_TOLERANCE }; + private int lastTopOffset; + private int rowSize = 12; + private int margin = 10; + private int guiLeft; + private int guiTop; + private HashMap iconStacks = new HashMap<>(); public FlowerAlyzerPlugin() { - for(FlowerDefinition def : FlowerDefinition.values()){ + for (FlowerDefinition def : FlowerDefinition.values()) { iconStacks.put(def.getSpecies().getUID(), def.getMemberStack(EnumFlowerStage.FLOWER)); } } - public void drawLine(GuiScreen gui, int xOffset, String msg, int color){ + public void drawLine(GuiScreen gui, int xOffset, String msg, int color) { gui.mc.fontRendererObj.drawString(msg, guiLeft + xOffset, guiTop + lastTopOffset + margin, color); } - public void drawChromosom(GuiScreen gui, EnumFlowerChromosome chromosome, IFlower flower){ + public void drawChromosom(GuiScreen gui, EnumFlowerChromosome chromosome, IFlower flower) { drawLine(gui, COLUMN_0, StringUtils.capitalize(chromosome.getName()), 0xEEEEEE); drawLine(gui, COLUMN_1, I18N.localise(flower.getGenome().getActiveAllele(chromosome).getUnlocalizedName()), 0xEEEEEE); drawLine(gui, COLUMN_2, I18N.localise(flower.getGenome().getInactiveAllele(chromosome).getUnlocalizedName()), 0xEEEEEE); lastTopOffset += rowSize; } - public void newLine(){ + public void newLine() { lastTopOffset += rowSize; } @@ -100,13 +98,13 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin { gui.mc.fontRendererObj.drawString("Active", guiLeft + 10 + COLUMN_1, guiTop + 10, 0xffffff); gui.mc.fontRendererObj.drawString("Inactive", guiLeft + 10 + COLUMN_2, guiTop + 10, 0xffffff); - if (renderP != null && renderS!=null){ + if (renderP != null && renderS != null) { RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); - itemRender.renderItemAndEffectIntoGUI(renderP, guiLeft + 10 + COLUMN_1, guiTop + 10 +12); + itemRender.renderItemAndEffectIntoGUI(renderP, guiLeft + 10 + COLUMN_1, guiTop + 10 + 12); itemRender.renderItemOverlayIntoGUI(gui.mc.fontRendererObj, renderP, guiLeft + 10 + COLUMN_1, guiTop + 10 + 12, null); - itemRender.renderItemAndEffectIntoGUI(renderS, guiLeft + 10 + COLUMN_2, guiTop +10 +12); - itemRender.renderItemOverlayIntoGUI(gui.mc.fontRendererObj, renderS, guiLeft + 10 + COLUMN_1, guiTop +10 + 12, null); + itemRender.renderItemAndEffectIntoGUI(renderS, guiLeft + 10 + COLUMN_2, guiTop + 10 + 12); + itemRender.renderItemOverlayIntoGUI(gui.mc.fontRendererObj, renderS, guiLeft + 10 + COLUMN_1, guiTop + 10 + 12, null); } guiTop += rowSize * 3; @@ -128,8 +126,8 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin { for (EnumFlowerChromosome chromosome : secondPageColorChromosome) { drawChromosom(gui, chromosome, f); - RenderUtil.drawSolidRect(new Area(guiLeft + COLUMN_1, guiTop + lastTopOffset + margin, 50, 10), ((IAlleleInteger)f.getGenome().getActiveAllele(chromosome)).getValue()); - RenderUtil.drawSolidRect(new Area(guiLeft + COLUMN_2, guiTop + lastTopOffset + margin, 50, 10), ((IAlleleInteger)f.getGenome().getInactiveAllele(chromosome)).getValue()); + RenderUtil.drawSolidRect(new Area(guiLeft + COLUMN_1, guiTop + lastTopOffset + margin, 50, 10), ((IAlleleInteger) f.getGenome().getActiveAllele(chromosome)).getValue()); + RenderUtil.drawSolidRect(new Area(guiLeft + COLUMN_2, guiTop + lastTopOffset + margin, 50, 10), ((IAlleleInteger) f.getGenome().getInactiveAllele(chromosome)).getValue()); newLine(); } diff --git a/src/main/java/binnie/botany/genetics/FlowerBreedingSystem.java b/src/main/java/binnie/botany/genetics/FlowerBreedingSystem.java index c406c8ba..7d02bbe5 100644 --- a/src/main/java/binnie/botany/genetics/FlowerBreedingSystem.java +++ b/src/main/java/binnie/botany/genetics/FlowerBreedingSystem.java @@ -26,12 +26,12 @@ import binnie.core.util.I18N; public class FlowerBreedingSystem extends BreedingSystem { public FlowerBreedingSystem() { - this.iconUndiscovered = Binnie.RESOURCE.getUndiscoveredBeeSprite(); - this.iconDiscovered = Binnie.RESOURCE.getDiscoveredBeeSprite(); + iconUndiscovered = Binnie.RESOURCE.getUndiscoveredBeeSprite(); + iconDiscovered = Binnie.RESOURCE.getDiscoveredBeeSprite(); } @Override - public float getChance(final IMutation mutation, final EntityPlayer player, final IAlleleSpecies species1, final IAlleleSpecies species2) { + public float getChance(IMutation mutation, EntityPlayer player, IAlleleSpecies species1, IAlleleSpecies species2) { return mutation.getBaseChance(); } @@ -51,7 +51,7 @@ public class FlowerBreedingSystem extends BreedingSystem { } @Override - public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) { + public String getAlleleName(IChromosomeType chromosome, IAllele allele) { if (chromosome == EnumFlowerChromosome.FERTILITY) { if (allele.getUID().contains("Low")) { return I18N.localise("binniecore.allele.fertility.low"); @@ -70,8 +70,8 @@ public class FlowerBreedingSystem extends BreedingSystem { } @Override - public boolean isDNAManipulable(final ItemStack member) { - ISpeciesType type = this.getSpeciesRoot().getType(member); + public boolean isDNAManipulable(ItemStack member) { + ISpeciesType type = getSpeciesRoot().getType(member); return type != null && isDNAManipulable(type); } @@ -81,7 +81,7 @@ public class FlowerBreedingSystem extends BreedingSystem { } @Override - public IIndividual getConversion(final ItemStack stack) { + public IIndividual getConversion(ItemStack stack) { return BotanyCore.getFlowerRoot().getConversion(stack); } @@ -91,51 +91,47 @@ public class FlowerBreedingSystem extends BreedingSystem { } @Override - public void addExtraAlleles(final IChromosomeType chromosome, final TreeSet alleles) { + public void addExtraAlleles(IChromosomeType chromosome, TreeSet alleles) { switch ((EnumFlowerChromosome) chromosome) { - case FERTILITY: { - for (final ForestryAllele.Fertility a : ForestryAllele.Fertility.values()) { + case FERTILITY: + for (ForestryAllele.Fertility a : ForestryAllele.Fertility.values()) { alleles.add(a.getAllele()); } break; - } - case LIFESPAN: { - for (final ForestryAllele.Lifespan a2 : ForestryAllele.Lifespan.values()) { + + case LIFESPAN: + for (ForestryAllele.Lifespan a2 : ForestryAllele.Lifespan.values()) { alleles.add(a2.getAllele()); } break; - } + case HUMIDITY_TOLERANCE: case PH_TOLERANCE: - case TEMPERATURE_TOLERANCE: { - for (final Tolerance a3 : Tolerance.values()) { + case TEMPERATURE_TOLERANCE: + for (Tolerance a3 : Tolerance.values()) { alleles.add(a3.getAllele()); } break; - } + case PRIMARY: case SECONDARY: - case STEM: { - for (final EnumFlowerColor a4 : EnumFlowerColor.values()) { + case STEM: + for (EnumFlowerColor a4 : EnumFlowerColor.values()) { alleles.add(a4.getFlowerColorAllele()); } break; - } - case SAPPINESS: { - for (final ForestryAllele.Sappiness a5 : ForestryAllele.Sappiness.values()) { + + case SAPPINESS: + for (ForestryAllele.Sappiness a5 : ForestryAllele.Sappiness.values()) { alleles.add(a5.getAllele()); } break; - } - case TERRITORY: { - for (final ForestryAllele.Territory a6 : ForestryAllele.Territory.values()) { + + case TERRITORY: + for (ForestryAllele.Territory a6 : ForestryAllele.Territory.values()) { alleles.add(a6.getAllele()); } break; - } - default: { - break; - } } } } diff --git a/src/main/java/binnie/botany/genetics/FlowerColorAllele.java b/src/main/java/binnie/botany/genetics/FlowerColorAllele.java index d50237f5..e012d7a5 100644 --- a/src/main/java/binnie/botany/genetics/FlowerColorAllele.java +++ b/src/main/java/binnie/botany/genetics/FlowerColorAllele.java @@ -2,10 +2,10 @@ package binnie.botany.genetics; import forestry.api.genetics.IAlleleInteger; -import binnie.botany.api.IFlowerColour; +import binnie.botany.api.IFlowerColor; import binnie.core.util.I18N; -public class FlowerColorAllele implements IFlowerColour, IAlleleInteger { +public class FlowerColorAllele implements IFlowerColor, IAlleleInteger { private int color; private String uid; private boolean isDominant; @@ -51,7 +51,7 @@ public class FlowerColorAllele implements IFlowerColour, IAlleleInteger { @Override public int getColor(boolean dis) { - return dis ? this.colorDis : this.color; + return dis ? colorDis : color; } @Override diff --git a/src/main/java/binnie/botany/genetics/FlowerDefinition.java b/src/main/java/binnie/botany/genetics/FlowerDefinition.java index 93258b88..397e7392 100644 --- a/src/main/java/binnie/botany/genetics/FlowerDefinition.java +++ b/src/main/java/binnie/botany/genetics/FlowerDefinition.java @@ -954,34 +954,34 @@ public enum FlowerDefinition implements IFlowerDefinition { private IAllele[] template; private IFlowerGenome genome; - FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType type, final EnumFlowerColor colour) { + FlowerDefinition(String name, String branch, String binomial, IFlowerType type, EnumFlowerColor colour) { this(name, branch, binomial, type, false, colour, colour); } - FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType type, final EnumFlowerColor primaryColor, final EnumFlowerColor secondaryColor) { + FlowerDefinition(String name, String branch, String binomial, IFlowerType type, EnumFlowerColor primaryColor, EnumFlowerColor secondaryColor) { this(name, branch, binomial, type, true, primaryColor, secondaryColor); } - FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType type, final boolean isDominant, final EnumFlowerColor colour) { + FlowerDefinition(String name, String branch, String binomial, IFlowerType type, boolean isDominant, EnumFlowerColor colour) { this(name, branch, binomial, type, isDominant, colour, colour); } - FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType flowerType, final boolean isDominant, final EnumFlowerColor primaryColor, final EnumFlowerColor secondaryColor) { + FlowerDefinition(String name, String branch, String binomial, IFlowerType flowerType, boolean isDominant, EnumFlowerColor primaryColor, EnumFlowerColor secondaryColor) { String uid = Constants.BOTANY_MOD_ID + ".flower" + this; String unlocalizedDescription = "botany.description.flower" + this; String unlocalizedName = "botany.flowers.species." + name; - this.variantTemplates = new ArrayList<>(); + variantTemplates = new ArrayList<>(); this.name = name; this.binomial = binomial; - this.branchName = branch; - this.type = flowerType; + branchName = branch; + type = flowerType; this.primaryColor = primaryColor; this.secondaryColor = secondaryColor; IAlleleFlowerSpeciesBuilder speciesBuilder = FlowerManager.flowerFactory.createSpecies(uid, unlocalizedName, "Binnie's Mod Team", unlocalizedDescription, isDominant, getBranch(), binomial, flowerType); setSpeciesProperties(speciesBuilder); - this.species = speciesBuilder.build(); + species = speciesBuilder.build(); if (this.branch != null) { this.branch.addMemberSpecies(species); } @@ -1039,36 +1039,36 @@ public enum FlowerDefinition implements IFlowerDefinition { protected abstract void registerMutations(); - private IAllele[] addVariant(final EnumFlowerColor a, final EnumFlowerColor b) { - final IAllele[] template = this.getTemplate(); + private IAllele[] addVariant(EnumFlowerColor a, EnumFlowerColor b) { + IAllele[] template = getTemplate(); template[EnumFlowerChromosome.PRIMARY.ordinal()] = a.getFlowerColorAllele(); template[EnumFlowerChromosome.SECONDARY.ordinal()] = b.getFlowerColorAllele(); - this.variantTemplates.add(template); + variantTemplates.add(template); return template; } - private IAllele[] addVariant(final EnumFlowerColor a) { - return this.addVariant(a, a); + private IAllele[] addVariant(EnumFlowerColor a) { + return addVariant(a, a); } public List getVariants() { - return this.variantTemplates; + return variantTemplates; } public IClassification getBranch() { if (branch == null) { - final String scientific = branchName.substring(0, 1).toUpperCase() + branchName.substring(1).toLowerCase(); - final String uid = "flowers." + branchName.toLowerCase(); + String scientific = branchName.substring(0, 1).toUpperCase() + branchName.substring(1).toLowerCase(); + String uid = "flowers." + branchName.toLowerCase(); IClassification branch = AlleleManager.alleleRegistry.getClassification("genus." + uid); if (branch == null) { branch = AlleleManager.alleleRegistry.createAndRegisterClassification(IClassification.EnumClassLevel.GENUS, uid, scientific); } this.branch = branch; } - return this.branch; + return branch; } - public void setBranch(final IClassification branch) { + public void setBranch(IClassification branch) { this.branch = branch; } @@ -1121,7 +1121,7 @@ public enum FlowerDefinition implements IFlowerDefinition { } } - protected final IFlowerMutationBuilder registerMutation(final FlowerDefinition parent1, final FlowerDefinition parent2, final int chance) { + protected final IFlowerMutationBuilder registerMutation(FlowerDefinition parent1, FlowerDefinition parent2, int chance) { return FlowerManager.flowerFactory.createMutation(parent1.species, parent2.species, getTemplate(), chance); } } diff --git a/src/main/java/binnie/botany/genetics/FlowerGenome.java b/src/main/java/binnie/botany/genetics/FlowerGenome.java index 39893ae7..ed579db5 100644 --- a/src/main/java/binnie/botany/genetics/FlowerGenome.java +++ b/src/main/java/binnie/botany/genetics/FlowerGenome.java @@ -1,5 +1,20 @@ package binnie.botany.genetics; +import javax.annotation.Nullable; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import forestry.api.core.EnumTemperature; +import forestry.api.genetics.EnumTolerance; +import forestry.api.genetics.IAlleleFloat; +import forestry.api.genetics.IAlleleInteger; +import forestry.api.genetics.IAlleleSpecies; +import forestry.api.genetics.IAlleleTolerance; +import forestry.api.genetics.IChromosome; +import forestry.api.genetics.ISpeciesRoot; +import forestry.core.genetics.Genome; + import binnie.Binnie; import binnie.botany.api.EnumAcidity; import binnie.botany.api.EnumFlowerChromosome; @@ -9,26 +24,13 @@ import binnie.botany.api.IAlleleFlowerSpecies; import binnie.botany.api.IFlowerGenome; import binnie.botany.api.IFlowerType; import binnie.botany.core.BotanyCore; -import forestry.api.core.EnumTemperature; -import forestry.api.genetics.EnumTolerance; -import forestry.api.genetics.IAlleleFloat; -import forestry.api.genetics.IAlleleInteger; -import forestry.api.genetics.IAlleleSpecies; -import forestry.api.genetics.IAlleleTolerance; -import forestry.api.genetics.IChromosome; -import forestry.api.genetics.ISpeciesRoot; -import forestry.core.genetics.Genome; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import javax.annotation.Nullable; public class FlowerGenome extends Genome implements IFlowerGenome { - public FlowerGenome(final NBTTagCompound nbttagcompound) { + public FlowerGenome(NBTTagCompound nbttagcompound) { super(nbttagcompound); } - public FlowerGenome(final IChromosome[] chromosomes) { + public FlowerGenome(IChromosome[] chromosomes) { super(chromosomes); } @@ -42,18 +44,17 @@ public class FlowerGenome extends Genome implements IFlowerGenome { if (species instanceof IAlleleFlowerSpecies) { return (IAlleleFlowerSpecies) species; } - return (IAlleleFlowerSpecies) getActiveAllele(itemStack, EnumFlowerChromosome.SPECIES, FlowerManager.flowerRoot); } @Override public IAlleleFlowerSpecies getPrimary() { - return (IAlleleFlowerSpecies) this.getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getPrimaryAllele(); + return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getPrimaryAllele(); } @Override public IAlleleFlowerSpecies getSecondary() { - return (IAlleleFlowerSpecies) this.getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getSecondaryAllele(); + return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getSecondaryAllele(); } @Override @@ -63,80 +64,80 @@ public class FlowerGenome extends Genome implements IFlowerGenome { @Override public FlowerColorAllele getPrimaryColor() { - return ((FlowerColorAllele) this.getActiveAllele(EnumFlowerChromosome.PRIMARY)); + return ((FlowerColorAllele) getActiveAllele(EnumFlowerChromosome.PRIMARY)); } @Override public FlowerColorAllele getSecondaryColor() { - return ((FlowerColorAllele) this.getActiveAllele(EnumFlowerChromosome.SECONDARY)); + return ((FlowerColorAllele) getActiveAllele(EnumFlowerChromosome.SECONDARY)); } @Override public FlowerColorAllele getStemColor() { - return ((FlowerColorAllele) this.getActiveAllele(EnumFlowerChromosome.STEM)); + return ((FlowerColorAllele) getActiveAllele(EnumFlowerChromosome.STEM)); } @Override public int getFertility() { - return ((IAlleleInteger) this.getActiveAllele(EnumFlowerChromosome.FERTILITY)).getValue(); + return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.FERTILITY)).getValue(); } @Override public int getLifespan() { - return ((IAlleleInteger) this.getActiveAllele(EnumFlowerChromosome.LIFESPAN)).getValue() / 5; + return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.LIFESPAN)).getValue() / 5; } @Override public IFlowerType getType() { - return this.getPrimary().getType(); + return getPrimary().getType(); } @Override public EnumTolerance getToleranceTemperature() { - return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue(); + return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue(); } @Override public EnumTolerance getToleranceMoisture() { - return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.HUMIDITY_TOLERANCE)).getValue(); + return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.HUMIDITY_TOLERANCE)).getValue(); } @Override public EnumTolerance getTolerancePH() { - return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.PH_TOLERANCE)).getValue(); + return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.PH_TOLERANCE)).getValue(); } @Override public float getAgeChance() { - return 1.0f * (float) Math.sqrt(2.0f / this.getLifespan()); + return 1.0f * (float) Math.sqrt(2.0f / getLifespan()); } @Override public float getSappiness() { - return ((IAlleleFloat) this.getActiveAllele(EnumFlowerChromosome.SAPPINESS)).getValue(); + return ((IAlleleFloat) getActiveAllele(EnumFlowerChromosome.SAPPINESS)).getValue(); } @Override - public boolean canTolerate(final EnumAcidity acidity) { - final int pH = acidity.ordinal(); - final int[] pHTol = Binnie.GENETICS.getTolerance(this.getTolerancePH()); - final int fPH = this.getPrimary().getPH().ordinal(); + public boolean canTolerate(EnumAcidity acidity) { + int pH = acidity.ordinal(); + int[] pHTol = Binnie.GENETICS.getTolerance(getTolerancePH()); + int fPH = getPrimary().getPH().ordinal(); return pH >= fPH + pHTol[0] && pH <= fPH + pHTol[1]; } @Override - public boolean canTolerate(final EnumMoisture moist) { - final int moisture = moist.ordinal(); - final int[] moistTol = Binnie.GENETICS.getTolerance(this.getToleranceMoisture()); - final int fMoisture = this.getPrimary().getMoisture().ordinal(); + public boolean canTolerate(EnumMoisture moist) { + int moisture = moist.ordinal(); + int[] moistTol = Binnie.GENETICS.getTolerance(getToleranceMoisture()); + int fMoisture = getPrimary().getMoisture().ordinal(); return moisture >= fMoisture + moistTol[0] && moisture <= fMoisture + moistTol[1]; } @Override - public boolean canTolerate(final EnumTemperature temperature) { - final int temp = temperature.ordinal(); - final int[] tempTol = Binnie.GENETICS.getTolerance(this.getToleranceTemperature()); - final int fTemp = this.getPrimary().getTemperature().ordinal(); + public boolean canTolerate(EnumTemperature temperature) { + int temp = temperature.ordinal(); + int[] tempTol = Binnie.GENETICS.getTolerance(getToleranceTemperature()); + int fTemp = getPrimary().getTemperature().ordinal(); return temp >= fTemp + tempTol[0] && temp <= fTemp + tempTol[1]; } } diff --git a/src/main/java/binnie/botany/genetics/FlowerMutation.java b/src/main/java/binnie/botany/genetics/FlowerMutation.java index 165a82bb..813926e3 100644 --- a/src/main/java/binnie/botany/genetics/FlowerMutation.java +++ b/src/main/java/binnie/botany/genetics/FlowerMutation.java @@ -32,7 +32,7 @@ public class FlowerMutation extends Mutation implements IFlowerMutation, IFlower @Override public float getChance(World world, BlockPos pos, IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IFlowerGenome genome0, IFlowerGenome genome1) { - float processedChance = super.getChance(world, pos, allele0, allele1, genome0, genome1, ForestryAPI.climateManager.getDefaultClimate(world, pos)); + float processedChance = getChance(world, pos, allele0, allele1, genome0, genome1, ForestryAPI.climateManager.getDefaultClimate(world, pos)); if (processedChance <= 0) { return 0; } diff --git a/src/main/java/binnie/botany/genetics/FlowerRoot.java b/src/main/java/binnie/botany/genetics/FlowerRoot.java index 0724fdaa..76d73c78 100644 --- a/src/main/java/binnie/botany/genetics/FlowerRoot.java +++ b/src/main/java/binnie/botany/genetics/FlowerRoot.java @@ -1,5 +1,31 @@ package binnie.botany.genetics; +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import com.mojang.authlib.GameProfile; + +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IAllele; +import forestry.api.genetics.IAlyzerPlugin; +import forestry.api.genetics.IChromosomeType; +import forestry.api.genetics.IIndividual; +import forestry.api.genetics.IMutation; +import forestry.api.genetics.ISpeciesType; +import forestry.core.genetics.SpeciesRoot; + import binnie.botany.Botany; import binnie.botany.api.EnumFlowerChromosome; import binnie.botany.api.EnumFlowerStage; @@ -11,29 +37,6 @@ import binnie.botany.api.IFlowerGenome; import binnie.botany.api.IFlowerMutation; import binnie.botany.api.IFlowerRoot; import binnie.botany.flower.TileEntityFlower; -import com.mojang.authlib.GameProfile; -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.IAllele; -import forestry.api.genetics.IAlyzerPlugin; -import forestry.api.genetics.IChromosomeType; -import forestry.api.genetics.IIndividual; -import forestry.api.genetics.IMutation; -import forestry.api.genetics.ISpeciesType; -import forestry.core.genetics.SpeciesRoot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Random; public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { static final String UID = "rootFlowers"; @@ -44,7 +47,7 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { Map conversions; public FlowerRoot() { - this.conversions = new HashMap<>(); + conversions = new HashMap<>(); } @Override @@ -56,7 +59,7 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { public int getSpeciesCount() { if (FlowerRoot.flowerSpeciesCount < 0) { FlowerRoot.flowerSpeciesCount = 0; - for (final Map.Entry entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) { + for (Map.Entry entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) { if (entry.getValue() instanceof IAlleleFlowerSpecies && ((IAlleleFlowerSpecies) entry.getValue()).isCounted()) { ++FlowerRoot.flowerSpeciesCount; } @@ -66,17 +69,17 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { } @Override - public boolean isMember(final ItemStack stack) { - return !stack.isEmpty() && this.getType(stack) != null; + public boolean isMember(ItemStack stack) { + return !stack.isEmpty() && getType(stack) != null; } @Override public boolean isMember(ItemStack stack, ISpeciesType type) { - return this.getType(stack) == type; + return getType(stack) == type; } @Override - public boolean isMember(final IIndividual individual) { + public boolean isMember(IIndividual individual) { return individual instanceof IFlower; } @@ -94,7 +97,6 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { @Nullable public EnumFlowerStage getType(ItemStack stack) { Item item = stack.getItem(); - if (Botany.flowerItem == item) { return EnumFlowerStage.SEED; } else if (Botany.pollen == item) { @@ -102,64 +104,64 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { } else if (Botany.seed == item) { return EnumFlowerStage.SEED; } - return null; } @Override public ItemStack getMemberStack(IIndividual flower, ISpeciesType type) { - if (!this.isMember(flower)) { + if (!isMember(flower)) { return ItemStack.EMPTY; } + Item flowerItem = Botany.flowerItem; if (type == EnumFlowerStage.SEED) { flowerItem = Botany.seed; - } - if (type == EnumFlowerStage.POLLEN) { + } else if (type == EnumFlowerStage.POLLEN) { flowerItem = Botany.pollen; } if (flowerItem != Botany.flowerItem) { ((IFlower) flower).setAge(0); } - final NBTTagCompound nbttagcompound = new NBTTagCompound(); + + NBTTagCompound nbttagcompound = new NBTTagCompound(); flower.writeToNBT(nbttagcompound); - final ItemStack flowerStack = new ItemStack(flowerItem); + ItemStack flowerStack = new ItemStack(flowerItem); flowerStack.setTagCompound(nbttagcompound); return flowerStack; } @Override @Nullable - public IFlower getMember(final ItemStack stack) { - if (!this.isMember(stack) || stack.getTagCompound() == null) { + public IFlower getMember(ItemStack stack) { + if (!isMember(stack) || stack.getTagCompound() == null) { return null; } return new Flower(stack.getTagCompound()); } @Override - public IFlower getFlower(final IFlowerGenome genome) { + public IFlower getFlower(IFlowerGenome genome) { return new Flower(genome, 2); } @Override - public IFlowerGenome templateAsGenome(final IAllele[] template) { - return new FlowerGenome(this.templateAsChromosomes(template)); + public IFlowerGenome templateAsGenome(IAllele[] template) { + return new FlowerGenome(templateAsChromosomes(template)); } @Override - public IFlowerGenome templateAsGenome(final IAllele[] templateActive, final IAllele[] templateInactive) { + public IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive) { return new FlowerGenome(templateAsChromosomes(templateActive, templateInactive)); } @Override - public IFlower templateAsIndividual(final IAllele[] template) { - return new Flower(this.templateAsGenome(template), 2); + public IFlower templateAsIndividual(IAllele[] template) { + return new Flower(templateAsGenome(template), 2); } @Override - public IFlower templateAsIndividual(final IAllele[] templateActive, final IAllele[] templateInactive) { - return new Flower(this.templateAsGenome(templateActive, templateInactive), 2); + public IFlower templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive) { + return new Flower(templateAsGenome(templateActive, templateInactive), 2); } @Override @@ -168,21 +170,21 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { } @Override - public void registerTemplate(final IAllele[] template) { - this.registerTemplate(template[0].getUID(), template); + public void registerTemplate(IAllele[] template) { + registerTemplate(template[0].getUID(), template); } @Override - public void registerTemplate(final String identifier, final IAllele[] template) { - FlowerRoot.flowerTemplates.add(new Flower(this.templateAsGenome(template), 2)); - if (!this.speciesTemplates.containsKey(identifier)) { - this.speciesTemplates.put(identifier, template); + public void registerTemplate(String identifier, IAllele[] template) { + FlowerRoot.flowerTemplates.add(new Flower(templateAsGenome(template), 2)); + if (!speciesTemplates.containsKey(identifier)) { + speciesTemplates.put(identifier, template); } } @Override - public IAllele[] getTemplate(final String identifier) { - return this.speciesTemplates.get(identifier); + public IAllele[] getTemplate(String identifier) { + return speciesTemplates.get(identifier); } @Override @@ -191,12 +193,12 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { } @Override - public IAllele[] getRandomTemplate(final Random rand) { - return this.speciesTemplates.values().toArray(new IAllele[0][])[rand.nextInt(this.speciesTemplates.values().size())]; + public IAllele[] getRandomTemplate(Random rand) { + return speciesTemplates.values().toArray(new IAllele[0][])[rand.nextInt(speciesTemplates.values().size())]; } @Override - public ArrayList getMutations(final boolean shuffle) { + public ArrayList getMutations(boolean shuffle) { if (shuffle) { Collections.shuffle(FlowerRoot.flowerMutations); } @@ -204,7 +206,7 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { } @Override - public void registerMutation(final IMutation mutation) { + public void registerMutation(IMutation mutation) { if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())) { return; } @@ -218,8 +220,8 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { } @Override - public IBotanistTracker getBreedingTracker(final World world, @Nullable final GameProfile player) { - final String filename = "BotanistTracker." + ((player == null) ? "common" : player.getId()); + public IBotanistTracker getBreedingTracker(World world, @Nullable GameProfile player) { + String filename = "BotanistTracker." + ((player == null) ? "common" : player.getId()); BotanistTracker tracker = (BotanistTracker) world.loadData(BotanistTracker.class, filename); if (tracker == null) { tracker = new BotanistTracker(filename); @@ -229,7 +231,7 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { } @Override - public IIndividual getMember(final NBTTagCompound compound) { + public IIndividual getMember(NBTTagCompound compound) { return new Flower(compound); } @@ -249,15 +251,15 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { } @Override - public void addConversion(final ItemStack itemstack, final IAllele[] template) { - final IFlower flower = this.getFlower(this.templateAsGenome(template)); - this.conversions.put(itemstack, flower); + public void addConversion(ItemStack itemstack, IAllele[] template) { + IFlower flower = getFlower(templateAsGenome(template)); + conversions.put(itemstack, flower); } @Override @Nullable - public IFlower getConversion(final ItemStack itemstack) { - for (final Map.Entry entry : this.conversions.entrySet()) { + public IFlower getConversion(ItemStack itemstack) { + for (Map.Entry entry : conversions.entrySet()) { if (entry.getKey().isItemEqual(itemstack)) { return (IFlower) entry.getValue().copy(); } @@ -266,23 +268,24 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { } @Override - public void registerColourMix(final IColorMix colorMix) { + public void registerColourMix(IColorMix colorMix) { FlowerRoot.colourMixes.add(colorMix); } @Override - public Collection getColorMixes(final boolean shuffle) { + public Collection getColorMixes(boolean shuffle) { if (shuffle) { Collections.shuffle(FlowerRoot.colourMixes); } return FlowerRoot.colourMixes; } - + public boolean plant(World world, BlockPos pos, IFlower flower, GameProfile owner) { boolean set = world.setBlockState(pos, Botany.flower.getDefaultState()); if (!set) { return false; } + TileEntity tile = world.getTileEntity(pos); TileEntity below = world.getTileEntity(pos.down()); if (tile != null && tile instanceof TileEntityFlower) { @@ -293,31 +296,35 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot { tileFlower.create(flower, owner); } } + tryGrowSection(world, pos); return true; } - + @Override public void tryGrowSection(World world, BlockPos pos) { if (world.isRemote) { return; } + TileEntity tileFlower = world.getTileEntity(pos); - if(tileFlower == null || !(tileFlower instanceof TileEntityFlower)){ + if (tileFlower == null || !(tileFlower instanceof TileEntityFlower)) { return; } + IFlower flower = ((TileEntityFlower) tileFlower).getFlower(); int section = ((TileEntityFlower) tileFlower).getSection(); - if(flower == null || section >= flower.getGenome().getPrimary().getType().getSections() - 1 || flower.getAge() <= 0){ + if (flower == null || section >= flower.getGenome().getPrimary().getType().getSections() - 1 || flower.getAge() <= 0) { return; } + world.setBlockState(pos.up(), Botany.flower.getDefaultState()); TileEntity flowerAbove = world.getTileEntity(pos.up()); if (flowerAbove != null && flowerAbove instanceof TileEntityFlower) { ((TileEntityFlower) flowerAbove).setSection(section + 1); } } - + @Override public void onGrowFromSeed(World world, BlockPos pos) { tryGrowSection(world, pos); diff --git a/src/main/java/binnie/botany/genetics/FlowerTemplates.java b/src/main/java/binnie/botany/genetics/FlowerTemplates.java index 198ab52b..e3d080e5 100644 --- a/src/main/java/binnie/botany/genetics/FlowerTemplates.java +++ b/src/main/java/binnie/botany/genetics/FlowerTemplates.java @@ -8,7 +8,7 @@ import binnie.botany.api.EnumFlowerChromosome; public class FlowerTemplates { public static IAllele[] getDefaultTemplate() { - final IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length]; + IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length]; //TODO: Test flower reset AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.SPECIES, FlowerDefinition.Poppy.getSpecies()); AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.PRIMARY, EnumFlowerColor.Red.getFlowerColorAllele()); diff --git a/src/main/java/binnie/botany/genetics/ItemDictionary.java b/src/main/java/binnie/botany/genetics/ItemDictionary.java index 614709a3..36e79978 100644 --- a/src/main/java/binnie/botany/genetics/ItemDictionary.java +++ b/src/main/java/binnie/botany/genetics/ItemDictionary.java @@ -22,15 +22,15 @@ import binnie.core.util.I18N; public class ItemDictionary extends Item implements IItemModelRegister { public ItemDictionary() { - this.setCreativeTab(CreativeTabBotany.instance); - this.setUnlocalizedName("database"); - this.setMaxStackSize(1); + setCreativeTab(CreativeTabBotany.instance); + setUnlocalizedName("database"); + setMaxStackSize(1); setRegistryName("database"); } @Override @SideOnly(Side.CLIENT) - public void getSubItems(final Item itemIn, final CreativeTabs tab, final NonNullList subItems) { + public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList subItems) { super.getSubItems(itemIn, tab, subItems); subItems.add(new ItemStack(itemIn, 1, 1)); } @@ -46,15 +46,15 @@ public class ItemDictionary extends Item implements IItemModelRegister { public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemStack = playerIn.getHeldItem(handIn); if (itemStack.getMetadata() == 0) { - Botany.proxy.openGui(BotanyGUI.Database, playerIn, playerIn.getPosition()); + Botany.proxy.openGui(BotanyGUI.DATABASE, playerIn, playerIn.getPosition()); } else { - Botany.proxy.openGui(BotanyGUI.DatabaseNEI, playerIn, playerIn.getPosition()); + Botany.proxy.openGui(BotanyGUI.DATABASE_NEI, playerIn, playerIn.getPosition()); } return super.onItemRightClick(worldIn, playerIn, handIn); } @Override - public String getItemStackDisplayName(final ItemStack i) { + public String getItemStackDisplayName(ItemStack i) { return I18N.localise("item.botany.database." + ((i.getItemDamage() == 0) ? "name" : "master.name")); } } diff --git a/src/main/java/binnie/botany/genetics/ModuleGenetics.java b/src/main/java/binnie/botany/genetics/ModuleGenetics.java index 5556d394..121b6f19 100644 --- a/src/main/java/binnie/botany/genetics/ModuleGenetics.java +++ b/src/main/java/binnie/botany/genetics/ModuleGenetics.java @@ -35,7 +35,7 @@ public class ModuleGenetics implements IInitializable { @Override public void preInit() { /* INIT API*/ - binnie.botany.api.FlowerManager.flowerFactory = new FlowerFactory(); + FlowerManager.flowerFactory = new FlowerFactory(); AlleleManager.alleleRegistry.registerSpeciesRoot(BotanyCore.getFlowerRoot()); AlleleManager.alleleRegistry.registerAllele(ModuleGenetics.alleleEffectNone); EnumFlowerColor.setupMutations(); @@ -43,7 +43,7 @@ public class ModuleGenetics implements IInitializable { /* BACKPACK*/ IBackpackInterface backpackInterface = BackpackManager.backpackInterface; - + if (ForestryAPI.enabledPlugins.contains("forestry.storage")) { Predicate filter = BackpackManager.backpackInterface.createNaturalistBackpackFilter("rootFlowers"); BackpackDefinition definition = new BackpackDefinition(new Color(0xf6e83e), Color.WHITE, filter); @@ -56,19 +56,19 @@ public class ModuleGenetics implements IInitializable { } /* ITEMS */ - Botany.flower = new BlockFlower(); - Botany.proxy.registerBlock(Botany.flower); - BinnieCore.getBinnieProxy().registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null); - Botany.flowerItem = new ItemBotany("itemFlower", EnumFlowerStage.FLOWER, ""); Botany.pollen = new ItemBotany("pollen", EnumFlowerStage.POLLEN, "pollen"); Botany.seed = new ItemBotany("seed", EnumFlowerStage.SEED, "germling"); Botany.database = new ItemDictionary(); + + Botany.proxy.registerBlock(Botany.flower); Botany.proxy.registerItem(Botany.flowerItem); Botany.proxy.registerItem(Botany.pollen); Botany.proxy.registerItem(Botany.seed); Botany.proxy.registerItem(Botany.database); + + BinnieCore.getBinnieProxy().registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null); } @Override @@ -80,25 +80,31 @@ public class ModuleGenetics implements IInitializable { @Override public void postInit() { forestry.api.apiculture.FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, "flowersVanilla"); - RecipeManagers.carpenterManager.addRecipe(100, Binnie.LIQUID.getFluidStack(ManagerLiquid.WATER, 2000), ItemStack.EMPTY, new ItemStack(Botany.database), - "X#X", - "YEY", - "RDR", - '#', Blocks.GLASS_PANE, - 'X', Items.GOLD_INGOT, - 'Y', Items.GOLD_NUGGET, - 'R', Items.REDSTONE, - 'D', Items.DIAMOND, - 'E', Items.EMERALD + RecipeManagers.carpenterManager.addRecipe( + 100, + Binnie.LIQUID.getFluidStack(ManagerLiquid.WATER, 2000), + ItemStack.EMPTY, + new ItemStack(Botany.database), + "X#X", + "YEY", + "RDR", + '#', Blocks.GLASS_PANE, + 'X', Items.GOLD_INGOT, + 'Y', Items.GOLD_NUGGET, + 'R', Items.REDSTONE, + 'D', Items.DIAMOND, + 'E', Items.EMERALD ); - RecipeUtil.addRecipe(Botany.botanistBackpack, - "X#X", - "VYZ", - "X#X", - '#', Blocks.WOOL, - 'X', Items.STRING, - 'V', Botany.soilMeter, - 'Z', "toolTrowel", - 'Y', "chestWood"); + RecipeUtil.addRecipe + (Botany.botanistBackpack, + "X#X", + "VYZ", + "X#X", + '#', Blocks.WOOL, + 'X', Items.STRING, + 'V', Botany.soilMeter, + 'Z', "toolTrowel", + 'Y', "chestWood" + ); } } diff --git a/src/main/java/binnie/botany/items/BotanyItems.java b/src/main/java/binnie/botany/items/BotanyItems.java index 81abd26c..19a74fc3 100644 --- a/src/main/java/binnie/botany/items/BotanyItems.java +++ b/src/main/java/binnie/botany/items/BotanyItems.java @@ -1,6 +1,7 @@ package binnie.botany.items; import java.util.List; +import java.util.Locale; import net.minecraft.item.ItemStack; @@ -9,23 +10,24 @@ import binnie.core.item.IItemMiscProvider; import binnie.core.util.I18N; public enum BotanyItems implements IItemMiscProvider { - AshPowder("powder_ash"), - PulpPowder("powder_pulp"), - MulchPowder("powder_mulch"), - SulphurPowder("powder_sulphur"), - FertiliserPowder("powder_fertiliser"), - CompostPowder("powder_compost"), - Mortar("mortar"), - Weedkiller("weedkiller"); + POWDER_ASH, + POWDER_PULP, + POWDER_MULCH, + POWDER_SULPHUR, + POWDER_FERTILISER, + POWDER_COMPOST, + MORTAR, + WEEDKILLER; String name; - BotanyItems(String name) { - this.name = name; + BotanyItems() { + name = name().toLowerCase(Locale.ENGLISH); } @Override public void addInformation(List tooltip) { + // ignored } @Override @@ -40,7 +42,7 @@ public enum BotanyItems implements IItemMiscProvider { @Override public ItemStack get(int size) { - return new ItemStack(Botany.misc, size, this.ordinal()); + return new ItemStack(Botany.misc, size, ordinal()); } @Override diff --git a/src/main/java/binnie/botany/items/ItemClay.java b/src/main/java/binnie/botany/items/ItemClay.java index c745526e..1e3893b8 100644 --- a/src/main/java/binnie/botany/items/ItemClay.java +++ b/src/main/java/binnie/botany/items/ItemClay.java @@ -18,10 +18,10 @@ import binnie.core.util.I18N; public class ItemClay extends Item implements IColoredItem, IItemModelRegister { public ItemClay() { - this.setUnlocalizedName("botany.clay"); - this.setHasSubtypes(true); - this.setCreativeTab(CreativeTabBotany.instance); - this.setRegistryName("clay"); + setUnlocalizedName("botany.clay"); + setHasSubtypes(true); + setCreativeTab(CreativeTabBotany.instance); + setRegistryName("clay"); } @SideOnly(Side.CLIENT) @@ -40,14 +40,14 @@ public class ItemClay extends Item implements IColoredItem, IItemModelRegister { } @Override - public String getItemStackDisplayName(final ItemStack stack) { + public String getItemStackDisplayName(ItemStack stack) { EnumFlowerColor color = EnumFlowerColor.get(stack.getItemDamage()); return I18N.localise("item.botany.clay.name", color.getFlowerColorAllele().getColorName()); -} + } @Override @SideOnly(Side.CLIENT) - public void getSubItems(final Item itemIn, final CreativeTabs tab, final NonNullList list) { + public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList list) { for (EnumFlowerColor color : EnumFlowerColor.values()) { list.add(new ItemStack(this, 1, color.ordinal())); } diff --git a/src/main/java/binnie/botany/items/ItemPigment.java b/src/main/java/binnie/botany/items/ItemPigment.java index 98a5556d..51cc048a 100644 --- a/src/main/java/binnie/botany/items/ItemPigment.java +++ b/src/main/java/binnie/botany/items/ItemPigment.java @@ -18,10 +18,10 @@ import binnie.core.util.I18N; public class ItemPigment extends Item implements IItemModelRegister, IColoredItem { public ItemPigment() { - this.setUnlocalizedName("botany.pigment"); - this.setHasSubtypes(true); - this.setCreativeTab(CreativeTabBotany.instance); - this.setRegistryName("pigment"); + setUnlocalizedName("botany.pigment"); + setHasSubtypes(true); + setCreativeTab(CreativeTabBotany.instance); + setRegistryName("pigment"); } @SideOnly(Side.CLIENT) @@ -40,14 +40,14 @@ public class ItemPigment extends Item implements IItemModelRegister, IColoredIte } @Override - public String getItemStackDisplayName(final ItemStack stack) { + public String getItemStackDisplayName(ItemStack stack) { EnumFlowerColor color = EnumFlowerColor.get(stack.getItemDamage()); return I18N.localise("item.botany.pigment.name", color.getFlowerColorAllele().getColorName()); } @Override @SideOnly(Side.CLIENT) - public void getSubItems(final Item itemIn, final CreativeTabs tab, final NonNullList list) { + public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList list) { for (EnumFlowerColor color : EnumFlowerColor.values()) { list.add(new ItemStack(this, 1, color.ordinal())); } diff --git a/src/main/java/binnie/botany/network/PacketFlowerUpdate.java b/src/main/java/binnie/botany/network/PacketFlowerUpdate.java index cb6a6f9b..00901678 100644 --- a/src/main/java/binnie/botany/network/PacketFlowerUpdate.java +++ b/src/main/java/binnie/botany/network/PacketFlowerUpdate.java @@ -11,10 +11,11 @@ import binnie.botany.flower.TileEntityFlower; import binnie.botany.genetics.EnumFlowerColor; import binnie.botany.genetics.EnumFlowerType; +// TODO unused class? public class PacketFlowerUpdate extends SPacketUpdateTileEntity { public TileEntityFlower.RenderInfo render; - public PacketFlowerUpdate(BlockPos blockPos, int metadata, NBTTagCompound compound, final TileEntityFlower.RenderInfo render) { + public PacketFlowerUpdate(BlockPos blockPos, int metadata, NBTTagCompound compound, TileEntityFlower.RenderInfo render) { super(blockPos, metadata, compound); this.render = render; } @@ -22,27 +23,27 @@ public class PacketFlowerUpdate extends SPacketUpdateTileEntity { @Override public void readPacketData(PacketBuffer buf) throws IOException { super.readPacketData(buf); - this.render = new TileEntityFlower.RenderInfo(); - this.render.primary = EnumFlowerColor.values()[buf.readByte()].getFlowerColorAllele(); - this.render.secondary = EnumFlowerColor.values()[buf.readByte()].getFlowerColorAllele(); - this.render.stem = EnumFlowerColor.values()[buf.readByte()].getFlowerColorAllele(); - this.render.type = EnumFlowerType.values()[buf.readByte()]; - this.render.age = buf.readByte(); - this.render.section = buf.readByte(); - this.render.wilted = buf.readBoolean(); - this.render.flowered = buf.readBoolean(); + render = new TileEntityFlower.RenderInfo(); + render.primary = EnumFlowerColor.values()[buf.readByte()].getFlowerColorAllele(); + render.secondary = EnumFlowerColor.values()[buf.readByte()].getFlowerColorAllele(); + render.stem = EnumFlowerColor.values()[buf.readByte()].getFlowerColorAllele(); + render.type = EnumFlowerType.values()[buf.readByte()]; + render.age = buf.readByte(); + render.section = buf.readByte(); + render.wilted = buf.readBoolean(); + render.flowered = buf.readBoolean(); } @Override public void writePacketData(PacketBuffer buf) throws IOException { super.writePacketData(buf); - buf.writeByte(this.render.primary.getID()); - buf.writeByte(this.render.secondary.getID()); - buf.writeByte(this.render.stem.getID()); - buf.writeByte(this.render.type.ordinal()); - buf.writeByte(this.render.age); - buf.writeByte(this.render.section); - buf.writeBoolean(this.render.wilted); - buf.writeBoolean(this.render.flowered); + buf.writeByte(render.primary.getID()); + buf.writeByte(render.secondary.getID()); + buf.writeByte(render.stem.getID()); + buf.writeByte(render.type.ordinal()); + buf.writeByte(render.age); + buf.writeByte(render.section); + buf.writeBoolean(render.wilted); + buf.writeBoolean(render.flowered); } } diff --git a/src/main/java/binnie/botany/network/PacketID.java b/src/main/java/binnie/botany/network/PacketID.java index ebfaf6e6..98971de4 100644 --- a/src/main/java/binnie/botany/network/PacketID.java +++ b/src/main/java/binnie/botany/network/PacketID.java @@ -31,7 +31,7 @@ public enum PacketID implements IPacketID { public void onUseFieldKit(NBTTagCompound data) { EntityPlayer player = BinnieCore.getBinnieProxy().getPlayer(); String info = ""; - if (data == null || data.hasNoTags()) { + if (data.hasNoTags()) { info += I18N.localise("botany.flowers.species.not.discover"); } else { IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species")); @@ -42,6 +42,7 @@ public enum PacketID implements IPacketID { if (primary == null || secondary == null) { return; } + info += I18N.localise("botany.flowers.fielkit.a"); if (age == 0.0f) { info += ""; @@ -52,16 +53,19 @@ public enum PacketID implements IPacketID { } else { info += " " + I18N.localise("botany.flowers.fielkit.old"); } + if (color1 == color2) { info = info + " " + color1.getName(); } else { info = info + " " + color1.getName() + " & " + color2.getName(); } + if (primary == secondary) { info = info + " " + primary.getName(); } else { info = info + " " + primary.getName() + "-" + secondary.getName() + " " + I18N.localise("botany.flowers.species.hybrid"); } + if (age == 0.0f) { info += " " + I18N.localise("botany.flowers.species.germling"); } diff --git a/src/main/java/binnie/core/craftgui/WindowFieldKit.java b/src/main/java/binnie/core/craftgui/WindowFieldKit.java index c2608b27..f84c0d05 100644 --- a/src/main/java/binnie/core/craftgui/WindowFieldKit.java +++ b/src/main/java/binnie/core/craftgui/WindowFieldKit.java @@ -121,7 +121,7 @@ public class WindowFieldKit extends Window { new ControlSlot.Builder(this, handGlass.x() + 54, handGlass.y() + 26).assign(InventoryType.Window, 0); new ControlSlot.Builder(this, 208, 8).assign(InventoryType.Window, 1); (this.text = new ControlText(this, new Point(232, 13), "Paper")).setColour(2236962); - (this.text = new ControlText(this, new Area(0, 120, this.width(), 24), "", TextJustification.MiddleCenter)).setColour(2236962); + (this.text = new ControlText(this, new Area(0, 120, this.width(), 24), "", TextJustification.MIDDLE_CENTER)).setColour(2236962); this.chromo = new ControlChromosome(this, 150, 24); this.addEventHandler(new EventValueChanged.Handler() { @Override diff --git a/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java b/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java index 4fc1d366..a702c05b 100644 --- a/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java +++ b/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java @@ -29,7 +29,7 @@ public class ControlCheckbox extends Control implements IControlValue { this.text = text; this.value = bool; if (w > 16) { - new ControlText(this, new Area(16, 1, w - 16, 16), text, TextJustification.MiddleCenter).setColour(4473924); + new ControlText(this, new Area(16, 1, w - 16, 16), text, TextJustification.MIDDLE_CENTER).setColour(4473924); } this.addAttribute(Attribute.MouseOver); this.addEventHandler(new EventMouse.Down.Handler() { diff --git a/src/main/java/binnie/core/craftgui/controls/button/ControlButton.java b/src/main/java/binnie/core/craftgui/controls/button/ControlButton.java index 8c0e054c..1784405d 100644 --- a/src/main/java/binnie/core/craftgui/controls/button/ControlButton.java +++ b/src/main/java/binnie/core/craftgui/controls/button/ControlButton.java @@ -37,7 +37,7 @@ public class ControlButton extends Control { public ControlButton(final IWidget parent, final int x, final int y, final int width, final int height, final String text) { this(parent, x, y, width, height); this.text = text; - this.textWidget = new ControlText(this, this.getArea(), text, TextJustification.MiddleCenter); + this.textWidget = new ControlText(this, this.getArea(), text, TextJustification.MIDDLE_CENTER); } protected void onMouseClick(final EventMouse.Down event) { diff --git a/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java b/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java index 16df62d0..cbd72614 100644 --- a/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java +++ b/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java @@ -11,7 +11,7 @@ public class ControlTextOption extends ControlOption { public ControlTextOption(final ControlList controlList, final T option, final String optionName, final int y) { super(controlList, option, y); this.textWidget = null; - this.textWidget = new ControlText(this, this.getArea(), optionName, TextJustification.MiddleCenter); + this.textWidget = new ControlText(this, this.getArea(), optionName, TextJustification.MIDDLE_CENTER); this.addEventHandler(new EventWidget.ChangeColour.Handler() { @Override public void onEvent(final EventWidget.ChangeColour event) { diff --git a/src/main/java/binnie/core/craftgui/database/PageSpeciesOverview.java b/src/main/java/binnie/core/craftgui/database/PageSpeciesOverview.java index 9c1560ac..157a88b9 100644 --- a/src/main/java/binnie/core/craftgui/database/PageSpeciesOverview.java +++ b/src/main/java/binnie/core/craftgui/database/PageSpeciesOverview.java @@ -37,8 +37,8 @@ public class PageSpeciesOverview extends PageSpecies { this.controlScientific = new ControlTextCentered(this, 32, ""); this.controlAuthority = new ControlTextCentered(this, 44, ""); this.controlComplexity = new ControlTextCentered(this, 68, ""); - this.controlDescription = new ControlText(this, new Area(8, 84, this.getSize().x() - 16, 0), "", TextJustification.MiddleCenter); - this.controlSignature = new ControlText(this, new Area(8, 84, this.getSize().x() - 16, 0), "", TextJustification.BottomRight); + this.controlDescription = new ControlText(this, new Area(8, 84, this.getSize().x() - 16, 0), "", TextJustification.MIDDLE_CENTER); + this.controlSignature = new ControlText(this, new Area(8, 84, this.getSize().x() - 16, 0), "", TextJustification.BOTTOM_RIGHT); } @Override diff --git a/src/main/java/binnie/core/craftgui/geometry/CraftGUIUtil.java b/src/main/java/binnie/core/craftgui/geometry/CraftGUIUtil.java index aa946de3..11a5a25a 100644 --- a/src/main/java/binnie/core/craftgui/geometry/CraftGUIUtil.java +++ b/src/main/java/binnie/core/craftgui/geometry/CraftGUIUtil.java @@ -16,7 +16,7 @@ public class CraftGUIUtil { } public static void horizontalGrid(final int px, final int py, final IWidget... widgets) { - horizontalGrid(px, py, TextJustification.MiddleCenter, 0, widgets); + horizontalGrid(px, py, TextJustification.MIDDLE_CENTER, 0, widgets); } public static void horizontalGrid(final int px, final int py, final TextJustification just, final int spacing, final IWidget... widgets) { @@ -32,7 +32,7 @@ public class CraftGUIUtil { } public static void verticalGrid(final int px, final int py, final IWidget... widgets) { - horizontalGrid(px, py, TextJustification.MiddleCenter, 0, widgets); + horizontalGrid(px, py, TextJustification.MIDDLE_CENTER, 0, widgets); } public static void verticalGrid(final int px, final int py, final TextJustification just, final int spacing, final IWidget... widgets) { diff --git a/src/main/java/binnie/core/craftgui/geometry/TextJustification.java b/src/main/java/binnie/core/craftgui/geometry/TextJustification.java index 4ade7961..7cc8bb4c 100644 --- a/src/main/java/binnie/core/craftgui/geometry/TextJustification.java +++ b/src/main/java/binnie/core/craftgui/geometry/TextJustification.java @@ -4,26 +4,26 @@ public enum TextJustification { TOP_LEFT(0.0f, 0.0f), TOP_CENTER(0.5f, 0.0f), TOP_RIGHT(1.0f, 0.0f), - MIDDLE_LEFTt(0.0f, 0.5f), - MiddleCenter(0.5f, 0.5f), - MiddleRight(1.0f, 0.5f), - BottomLeft(0.0f, 1.0f), - BottomCenter(0.5f, 1.0f), - BottomRight(1.0f, 1.0f); + MIDDLE_LEFT(0.0f, 0.5f), + MIDDLE_CENTER(0.5f, 0.5f), + MIDDLE_RIGHT(1.0f, 0.5f), + BOTTOM_LEFT(0.0f, 1.0f), + BOTTOM_CENTER(0.5f, 1.0f), + BOTTOM_RIGHT(1.0f, 1.0f); private final float xOffset; private final float yOffset; - TextJustification(final float xOffset, final float yOffset) { + TextJustification(float xOffset, float yOffset) { this.xOffset = xOffset; this.yOffset = yOffset; } public float getXOffset() { - return this.xOffset; + return xOffset; } public float getYOffset() { - return this.yOffset; + return yOffset; } } diff --git a/src/main/java/binnie/core/craftgui/minecraft/control/ControlSlide.java b/src/main/java/binnie/core/craftgui/minecraft/control/ControlSlide.java index 65ee8cd2..8cf7fa2f 100644 --- a/src/main/java/binnie/core/craftgui/minecraft/control/ControlSlide.java +++ b/src/main/java/binnie/core/craftgui/minecraft/control/ControlSlide.java @@ -63,7 +63,7 @@ public class ControlSlide extends Control { if (this.anchor.y() > 0) { GlStateManager.translate(0.0f, -lh, 0.0f); } - RenderUtil.drawText(labelArea, TextJustification.MiddleCenter, this.label, 16777215); + RenderUtil.drawText(labelArea, TextJustification.MIDDLE_CENTER, this.label, 16777215); GlStateManager.popMatrix(); } CraftGUI.render.texture(CraftGUITexture.Window, this.getArea()); diff --git a/src/main/java/binnie/extratrees/machines/craftgui/PageFruit.java b/src/main/java/binnie/extratrees/machines/craftgui/PageFruit.java index db6ac765..b757446d 100644 --- a/src/main/java/binnie/extratrees/machines/craftgui/PageFruit.java +++ b/src/main/java/binnie/extratrees/machines/craftgui/PageFruit.java @@ -34,7 +34,7 @@ public class PageFruit extends PageAbstract { public void onValueChanged(final ItemStack species) { this.deleteAllChildren(); final WindowAbstractDatabase database = Window.get(this); - new ControlText(this, new Area(0, 0, this.size().x(), 24), I18N.localise("extratrees.gui.database.tab.fruit." + (this.treesThatBearFruit ? "natural" : "potential")), TextJustification.MiddleCenter); + new ControlText(this, new Area(0, 0, this.size().x(), 24), I18N.localise("extratrees.gui.database.tab.fruit." + (this.treesThatBearFruit ? "natural" : "potential")), TextJustification.MIDDLE_CENTER); final Collection trees = this.treesThatBearFruit ? ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatBearFruit(species, database.isNEI(), database.getWorld(), database.getUsername()) : ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatCanBearFruit(species, database.isNEI(), database.getWorld(), database.getUsername()); new ControlSpeciesBox(this, 4, 24, this.size().x() - 8, this.size().y() - 4 - 24).setOptions(trees); } diff --git a/src/main/java/binnie/extratrees/machines/craftgui/PagePlanksOverview.java b/src/main/java/binnie/extratrees/machines/craftgui/PagePlanksOverview.java index edbcf293..f78d68ac 100644 --- a/src/main/java/binnie/extratrees/machines/craftgui/PagePlanksOverview.java +++ b/src/main/java/binnie/extratrees/machines/craftgui/PagePlanksOverview.java @@ -31,8 +31,8 @@ public class PagePlanksOverview extends PageAbstract { public void onValueChanged(final ItemStack species) { this.deleteAllChildren(); final WindowAbstractDatabase database = Window.get(this); - new ControlText(this, new Area(0, 0, this.size().x(), 24), species.getDisplayName(), TextJustification.MiddleCenter); - new ControlText(this, new Area(12, 24, this.size().x() - 24, 24), I18N.localise("extratrees.gui.database.planks.use"), TextJustification.MIDDLE_LEFTt); + new ControlText(this, new Area(0, 0, this.size().x(), 24), species.getDisplayName(), TextJustification.MIDDLE_CENTER); + new ControlText(this, new Area(12, 24, this.size().x() - 24, 24), I18N.localise("extratrees.gui.database.planks.use"), TextJustification.MIDDLE_LEFT); final IPlankType type = WoodManager.getPlankType(species); int x = 12; if (type != null) { @@ -52,8 +52,8 @@ public class PagePlanksOverview extends PageAbstract { x += 22; } } - final ControlText controlDescription = new ControlText(this, new Area(8, 84, this.getSize().x() - 16, 0), "", TextJustification.MiddleCenter); - final ControlText controlSignature = new ControlText(this, new Area(8, 84, this.getSize().x() - 16, 0), "", TextJustification.BottomRight); + final ControlText controlDescription = new ControlText(this, new Area(8, 84, this.getSize().x() - 16, 0), "", TextJustification.MIDDLE_CENTER); + final ControlText controlSignature = new ControlText(this, new Area(8, 84, this.getSize().x() - 16, 0), "", TextJustification.BOTTOM_RIGHT); String desc = ""; if (type != null) { desc = type.getDescription(); diff --git a/src/main/java/binnie/extratrees/machines/craftgui/PagePlanksTrees.java b/src/main/java/binnie/extratrees/machines/craftgui/PagePlanksTrees.java index 1964f085..23eb2f6d 100644 --- a/src/main/java/binnie/extratrees/machines/craftgui/PagePlanksTrees.java +++ b/src/main/java/binnie/extratrees/machines/craftgui/PagePlanksTrees.java @@ -30,7 +30,7 @@ public class PagePlanksTrees extends PageAbstract { public void onValueChanged(final ItemStack species) { this.deleteAllChildren(); final WindowAbstractDatabase database = Window.get(this); - new ControlText(this, new Area(0, 0, this.size().x(), 24), species.getDisplayName(), TextJustification.MiddleCenter); + new ControlText(this, new Area(0, 0, this.size().x(), 24), species.getDisplayName(), TextJustification.MIDDLE_CENTER); final Collection trees = ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatMakePlanks(species, database.isNEI(), database.getWorld(), database.getUsername()); new ControlSpeciesBox(this, 4, 24, this.size().x() - 8, this.size().y() - 4 - 24).setOptions(trees); } diff --git a/src/main/java/binnie/extratrees/machines/craftgui/PageSpeciesTreeGenome.java b/src/main/java/binnie/extratrees/machines/craftgui/PageSpeciesTreeGenome.java index 5f84348f..0e57f9de 100644 --- a/src/main/java/binnie/extratrees/machines/craftgui/PageSpeciesTreeGenome.java +++ b/src/main/java/binnie/extratrees/machines/craftgui/PageSpeciesTreeGenome.java @@ -62,7 +62,7 @@ public class PageSpeciesTreeGenome extends PageSpecies { final IAlleleTreeSpecies treeSpecies = genome.getPrimary(); final int w = 144; final int h = 176; - new ControlText(this, new Area(0, 4, w, 16), this.getValue().toString(), TextJustification.MiddleCenter); + new ControlText(this, new Area(0, 4, w, 16), this.getValue().toString(), TextJustification.MIDDLE_CENTER); final ControlScrollableContent scrollable = new ControlScrollableContent(this, 4, 20, w - 8, h - 8 - 16, 12); final Control contents = new Control(scrollable, 0, 0, w - 8 - 12, h - 8 - 16); final int tw = w - 8 - 12; @@ -72,10 +72,10 @@ public class PageSpeciesTreeGenome extends PageSpecies { final int th = 14; final int th2 = 18; final BreedingSystem syst = Binnie.GENETICS.treeBreedingSystem; - new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getPlantType().toString(), TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getPlantType().toString(), TextJustification.MIDDLE_LEFT); y += th; - new ControlText(contents, new Area(0, y, w2, th), I18N.localise("binniecore.gui.temperature.short") + " : ", TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), I18N.localise("binniecore.gui.temperature.short") + " : ", TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MIDDLE_LEFT); y += th; TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks(); ILeafSpriteProvider spriteProvider = treeSpecies.getLeafSpriteProvider(); @@ -91,7 +91,7 @@ public class PageSpeciesTreeGenome extends PageSpecies { ex.printStackTrace(); } if (leaf != null) { - new ControlText(contents, new Area(0, y, w2, th2), I18N.localise("extratrees.gui.database.leaves") + " : ", TextJustification.MiddleRight); + new ControlText(contents, new Area(0, y, w2, th2), I18N.localise("extratrees.gui.database.leaves") + " : ", TextJustification.MIDDLE_RIGHT); new ControlBlockIconDisplay(contents, w2, y, leaf).setColour(leafColour); if (fruit != null && !treeSpecies.getUID().equals("forestry.treeOak")) { new ControlBlockIconDisplay(contents, w2, y, fruit).setColour(fruitColour); @@ -101,22 +101,22 @@ public class PageSpeciesTreeGenome extends PageSpecies { Map products = fruitProvider.getProducts(); ItemStack log = treeSpecies.getWoodProvider().getWoodStack(); if (log.isEmpty()) { - new ControlText(contents, new Area(0, y, w2, th2), I18N.localise("extratrees.gui.database.log") + " : ", TextJustification.MiddleRight); + new ControlText(contents, new Area(0, y, w2, th2), I18N.localise("extratrees.gui.database.log") + " : ", TextJustification.MIDDLE_RIGHT); final ControlItemDisplay display = new ControlItemDisplay(contents, w2, y); display.setItemStack(log); display.setTooltip(); y += th2; } - new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.HEIGHT) + " : ", TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), genome.getHeight() + "x", TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.HEIGHT) + " : ", TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), genome.getHeight() + "x", TextJustification.MIDDLE_LEFT); y += th; - new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.FERTILITY) + " : ", TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.FERTILITY) + " : ", TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFT); y += th; List fruits = new ArrayList<>(); fruits.addAll(products.keySet()); if (!fruits.isEmpty()) { - new ControlText(contents, new Area(0, y, w2, th2), syst.getChromosomeShortName(EnumTreeChromosome.FRUITS) + " : ", TextJustification.MiddleRight); + new ControlText(contents, new Area(0, y, w2, th2), syst.getChromosomeShortName(EnumTreeChromosome.FRUITS) + " : ", TextJustification.MIDDLE_RIGHT); for (ItemStack fruitw : fruits) { final ControlItemDisplay display2 = new ControlItemDisplay(contents, w2, y); display2.setItemStack(fruitw); @@ -124,17 +124,17 @@ public class PageSpeciesTreeGenome extends PageSpecies { y += th2; } } - new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.YIELD) + " : ", TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), genome.getYield() + "x", TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.YIELD) + " : ", TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), genome.getYield() + "x", TextJustification.MIDDLE_LEFT); y += th; - new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.SAPPINESS) + " : ", TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), genome.getSappiness() + "x", TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.SAPPINESS) + " : ", TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), genome.getSappiness() + "x", TextJustification.MIDDLE_LEFT); y += th; - new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.MATURATION) + " : ", TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), genome.getMaturationTime() + "x", TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.MATURATION) + " : ", TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), genome.getMaturationTime() + "x", TextJustification.MIDDLE_LEFT); y += th; - new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.GIRTH) + " : ", TextJustification.MiddleRight); - new ControlText(contents, new Area(w2, y, w3, th), genome.getGirth() + "x" + genome.getGirth(), TextJustification.MIDDLE_LEFTt); + new ControlText(contents, new Area(0, y, w2, th), syst.getChromosomeShortName(EnumTreeChromosome.GIRTH) + " : ", TextJustification.MIDDLE_RIGHT); + new ControlText(contents, new Area(w2, y, w3, th), genome.getGirth() + "x" + genome.getGirth(), TextJustification.MIDDLE_LEFT); y += th; contents.setSize(new Point(contents.size().x(), y)); scrollable.setScrollableContent(contents); diff --git a/src/main/java/binnie/extratrees/machines/craftgui/PageWood.java b/src/main/java/binnie/extratrees/machines/craftgui/PageWood.java index 0e26acf1..6486e7ae 100644 --- a/src/main/java/binnie/extratrees/machines/craftgui/PageWood.java +++ b/src/main/java/binnie/extratrees/machines/craftgui/PageWood.java @@ -30,7 +30,7 @@ public class PageWood extends PageAbstract { public void onValueChanged(final ItemStack species) { this.deleteAllChildren(); final WindowAbstractDatabase database = Window.get(this); - new ControlText(this, new Area(0, 0, this.size().x(), 24), this.getValue().toString(), TextJustification.MiddleCenter); + new ControlText(this, new Area(0, 0, this.size().x(), 24), this.getValue().toString(), TextJustification.MIDDLE_CENTER); final Collection trees = ((TreeBreedingSystem) database.getBreedingSystem()).getTreesThatHaveWood(species, database.isNEI(), database.getWorld(), database.getUsername()); new ControlSpeciesBox(this, 4, 24, this.size().x() - 8, this.size().y() - 4 - 24).setOptions(trees); } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java b/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java index e834250f..50aada3d 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java @@ -109,7 +109,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawText(this.getArea(), TextJustification.MiddleCenter, this.value.getName(), 16777215); + RenderUtil.drawText(this.getArea(), TextJustification.MIDDLE_CENTER, this.value.getName(), 16777215); } }; } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageDescription.java b/src/main/java/binnie/genetics/gui/AnalystPageDescription.java index 7a2cfed8..b53e1a08 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageDescription.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageDescription.java @@ -65,7 +65,7 @@ public class AnalystPageDescription extends ControlAnalystPage { new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.desc.complexity") + ": " + species.getComplexity()).setColour(this.getColour()); y += 26; final ControlText descText = new ControlText(this, new Area(8, y, this.width() - 16, 0), descBody + "§r", TextJustification.TOP_CENTER); - final IWidget signatureText = new ControlText(this, new Area(8, y, this.width() - 16, 0), descSig + "§r", TextJustification.BottomRight); + final IWidget signatureText = new ControlText(this, new Area(8, y, this.width() - 16, 0), descSig + "§r", TextJustification.BOTTOM_RIGHT); descText.setColour(this.getColour()); signatureText.setColour(this.getColour()); final int descHeight = CraftGUI.render.textHeight(descText.getValue(), descText.getSize().x()); diff --git a/src/main/java/binnie/genetics/gui/AnalystPageMutations.java b/src/main/java/binnie/genetics/gui/AnalystPageMutations.java index 1cf31de1..fb5c43ef 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageMutations.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageMutations.java @@ -275,7 +275,7 @@ public class AnalystPageMutations extends ControlAnalystPage { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawText(this.getArea(), TextJustification.MiddleCenter, I18N.localise("genetics.gui.analyst.mutations.unknown"), 11184810); + RenderUtil.drawText(this.getArea(), TextJustification.MIDDLE_CENTER, I18N.localise("genetics.gui.analyst.mutations.unknown"), 11184810); } } } diff --git a/src/main/java/binnie/genetics/gui/ControlGenesisOption.java b/src/main/java/binnie/genetics/gui/ControlGenesisOption.java index 124cb4a7..d33fb741 100644 --- a/src/main/java/binnie/genetics/gui/ControlGenesisOption.java +++ b/src/main/java/binnie/genetics/gui/ControlGenesisOption.java @@ -27,8 +27,8 @@ public class ControlGenesisOption extends ControlOption { @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { super.onRenderBackground(guiWidth, guiHeight); - RenderUtil.drawText(new Area(0, 0, 70, 22), TextJustification.MiddleCenter, this.getChromosomeName(), this.getColour()); - RenderUtil.drawText(new Area(75, 0, 80, 22), TextJustification.MiddleCenter, this.getAlleleName(), this.getColour()); + RenderUtil.drawText(new Area(0, 0, 70, 22), TextJustification.MIDDLE_CENTER, this.getChromosomeName(), this.getColour()); + RenderUtil.drawText(new Area(75, 0, 80, 22), TextJustification.MIDDLE_CENTER, this.getAlleleName(), this.getColour()); RenderUtil.drawSolidRect(new Area(70, 2, 1, 16), -16777216 + this.getColour()); } } diff --git a/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java b/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java index 41738127..1661cb22 100644 --- a/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java +++ b/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java @@ -36,15 +36,15 @@ public class AnalystPageSoil extends ControlAnalystPage { int y = 4; new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.moisture"), TextJustification.MiddleCenter).setColour(this.getColour()); + new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.moisture"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); y += 12; this.createMoisture(this, (this.width() - 100) / 2, y, 100, 10, moisture, moistureTol); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.ph"), TextJustification.MiddleCenter).setColour(this.getColour()); + new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.ph"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); y += 12; this.createAcidity(this, (this.width() - 100) / 2, y, 100, 10, pH, pHTol); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.recommended"), TextJustification.MiddleCenter).setColour(this.getColour()); + new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.recommended"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); y += 12; EnumMoisture recomMoisture = EnumMoisture.NORMAL; final boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol); @@ -87,7 +87,7 @@ public class AnalystPageSoil extends ControlAnalystPage { recomSoil.setItemStack(stack); recomSoil.setTooltip(); y += 32; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.other"), TextJustification.MiddleCenter).setColour(this.getColour()); + new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.other"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); y += 12; final List stacks = new ArrayList<>(); for (final EnumAcidity a : EnumSet.range(EnumAcidity.ACID, EnumAcidity.ALKALINE)) { diff --git a/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java b/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java index 195d48c6..0ad818ce 100644 --- a/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java +++ b/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java @@ -54,17 +54,17 @@ public class AnalystPageClimate extends ControlAnalystPage { int y = 4; new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.temp"), TextJustification.MiddleCenter).setColour(this.getColour()); + new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.temp"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); y += 12; this.createTemperatureBar(this, (this.width() - 100) / 2, y, 100, 10, temp, tempTol); y += 16; if (!(ind instanceof IFlower)) { - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.hum"), TextJustification.MiddleCenter).setColour(this.getColour()); + new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.hum"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); y += 12; this.createHumidity(this, (this.width() - 100) / 2, y, 100, 10, humid, humidTol); y += 16; } - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.biomes"), TextJustification.MiddleCenter).setColour(this.getColour()); + new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.biomes"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); y += 12; final List biomes = new ArrayList<>(); for (final Biome biome : Biome.EXPLORATION_BIOMES_LIST) { //TODO check diff --git a/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java b/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java index 5295a470..f27fbe3f 100644 --- a/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java +++ b/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java @@ -53,7 +53,7 @@ public class WindowInoculator extends WindowMachine { new ControlEnergyBar(this, 91, 118, 60, 16, Position.LEFT); new ControlErrorState(this, 161, 118); x += 142; - CraftGUIUtil.verticalGrid(x, y, TextJustification.MIDDLE_LEFTt, 8, + CraftGUIUtil.verticalGrid(x, y, TextJustification.MIDDLE_LEFT, 8, new ControlSlotArray.Builder(this, x, y, 4, 1).create(Inoculator.SLOT_RESERVE), new ControlSlot.Builder(this, x, y + 18 + 8).assign(9), new ControlSlotArray.Builder(this, x, y + 18 + 8 + 18 + 8, 4, 1).create(Inoculator.SLOT_FINISHED) diff --git a/src/main/java/binnie/genetics/machine/sequencer/ControlSequencerProgress.java b/src/main/java/binnie/genetics/machine/sequencer/ControlSequencerProgress.java index ff43c317..a37a2647 100644 --- a/src/main/java/binnie/genetics/machine/sequencer/ControlSequencerProgress.java +++ b/src/main/java/binnie/genetics/machine/sequencer/ControlSequencerProgress.java @@ -25,7 +25,7 @@ public class ControlSequencerProgress extends ControlProgressBase { public ControlSequencerProgress(final IWidget parent, final int x, final int y) { super(parent, x, y, 100, 52); final Panel panel = new Panel(this, 0, 0, 100, 52, MinecraftGUI.PanelType.Gray); - this.textControl = new ControlText(panel, new Area(4, 4, 92, 44), "", TextJustification.MiddleCenter); + this.textControl = new ControlText(panel, new Area(4, 4, 92, 44), "", TextJustification.MIDDLE_CENTER); } @Override diff --git a/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java b/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java index 8a59be08..214d6e19 100644 --- a/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java +++ b/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java @@ -53,7 +53,7 @@ public class WindowSequencer extends WindowMachine { super.initialiseClient(); int x = 16; int y = 32; - CraftGUIUtil.horizontalGrid(x, y, TextJustification.MiddleCenter, 2, + CraftGUIUtil.horizontalGrid(x, y, TextJustification.MIDDLE_CENTER, 2, new ControlSlotArray.Builder(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation()), new ControlSequencerProgress(this, 0, 0), @@ -63,7 +63,7 @@ public class WindowSequencer extends WindowMachine { final ControlSlot slotTarget = new ControlSlot.Builder(this, x + 96, y + 16).assign(5); x = 34; y = 92; - this.slotText = new ControlText(this, new Area(0, y, this.width(), 12), TextFormatting.DARK_GRAY + I18N.localise("genetics.machine.machine.sequencer.texts.userless"), TextJustification.MiddleCenter); + this.slotText = new ControlText(this, new Area(0, y, this.width(), 12), TextFormatting.DARK_GRAY + I18N.localise("genetics.machine.machine.sequencer.texts.userless"), TextJustification.MIDDLE_CENTER); y += 20; final ControlSlot slotDye = new ControlSlot.Builder(this, x, y).assign(0); x += 20; diff --git a/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java b/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java index 6b202f6b..91702b58 100644 --- a/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java +++ b/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java @@ -49,7 +49,7 @@ public class WindowSplicer extends WindowMachine { new ControlEnergyBar(this, 196, 64, 60, 16, Position.LEFT); new ControlErrorState(this, 218, 86); x += 142; - CraftGUIUtil.verticalGrid((this.width() - 72) / 2, 32, TextJustification.MiddleCenter, 4, + CraftGUIUtil.verticalGrid((this.width() - 72) / 2, 32, TextJustification.MIDDLE_CENTER, 4, new ControlSlotArray.Builder(this, 0, 0, 4, 1).create(Inoculator.SLOT_RESERVE), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_DOWN.getIcon().getResourceLocation()), new ControlSlot.Builder(this, 0, 0).assign(9), diff --git a/src/main/resources/assets/botany/lang/en_US.lang b/src/main/resources/assets/botany/lang/en_US.lang index 62f2bc67..82176757 100644 --- a/src/main/resources/assets/botany/lang/en_US.lang +++ b/src/main/resources/assets/botany/lang/en_US.lang @@ -37,6 +37,7 @@ botany.ceramic.type.verticalbrick.name=%s Vertical Ceramic Bricks botany.ceramic.type.verticalbrickstripe.name=%s Vertical Striped Ceramic Bricks botany.ceramic.type.verticalbricklarge.name=%s Large Vertical Ceramic Bricks +item.botany.soil_meter.name=Soil Meter item.botany.germling.name=Germling item.botany.pollen.name=Pollen item.botany.flower.corrupted.name=Corrupted Flower From 3ff4957a10c4d5eee5da8c21265b408f7ae29e10 Mon Sep 17 00:00:00 2001 From: Alexander Kornilov Date: Mon, 17 Jul 2017 04:08:38 +0300 Subject: [PATCH 06/13] Feature/code improve (#221) * Code improvement for genetics.api Code improvement for genetics.core Fix missed localization for info of Lab Stand * Code improvement for genetics.genetics package --- .../craftgui/ControlColorMixSymbol.java | 2 +- .../java/binnie/core/craftgui/IWidget.java | 4 +- .../java/binnie/core/craftgui/Widget.java | 4 +- .../binnie/core/craftgui/WindowFieldKit.java | 4 +- .../craftgui/controls/ControlCheckbox.java | 2 +- .../core/craftgui/controls/ControlText.java | 2 +- .../controls/listbox/ControlOption.java | 2 +- .../controls/listbox/ControlTextOption.java | 2 +- .../craftgui/controls/tab/ControlTab.java | 4 +- .../database/ControlMutationSymbol.java | 4 +- .../database/PageSpeciesClassification.java | 4 +- .../database/WindowAbstractDatabase.java | 4 +- .../core/craftgui/minecraft/Window.java | 4 +- .../craftgui/renderer/TextureRenderer.java | 2 +- .../storage/ControlColourSelector.java | 2 +- .../binnie/extrabees/init/FluidRegister.java | 2 +- .../binnie/extratrees/block/PlankType.java | 2 +- .../craftgui/PageSpeciesTreeGenome.java | 4 +- .../machines/craftgui/WindowWoodworker.java | 2 +- .../binnie/genetics/CreativeTabGenetics.java | 2 +- src/main/java/binnie/genetics/Genetics.java | 38 +- .../binnie/genetics/api/IIncubatorRecipe.java | 8 +- .../binnie/genetics/api/IItemAnalysable.java | 6 +- .../binnie/genetics/api/IItemChargeable.java | 6 +- .../java/binnie/genetics/api/IItemSerum.java | 6 +- .../binnie/genetics/core/GeneticsGUI.java | 49 ++- .../binnie/genetics/core/GeneticsPacket.java | 17 +- .../binnie/genetics/core/GeneticsTexture.java | 40 +- .../genetics/genetics/AlleleHelper.java | 84 ++-- .../binnie/genetics/genetics/Engineering.java | 19 +- .../genetics/genetics/GeneArrayItem.java | 88 +++-- .../binnie/genetics/genetics/GeneItem.java | 32 +- .../binnie/genetics/genetics/GeneProject.java | 35 +- .../genetics/genetics/GeneProjectTracker.java | 89 +++-- .../binnie/genetics/genetics/GeneTracker.java | 84 ++-- .../genetics/GeneticEngineeringSystem.java | 40 +- .../binnie/genetics/genetics/IGeneItem.java | 4 +- .../genetics/genetics/SequencerItem.java | 14 +- .../genetics/gui/AnalystPageBehaviour.java | 48 +-- .../genetics/gui/AnalystPageBiology.java | 94 ++--- .../genetics/gui/AnalystPageDatabase.java | 116 +++--- .../genetics/gui/AnalystPageDescription.java | 38 +- .../genetics/gui/AnalystPageGenome.java | 28 +- .../genetics/gui/AnalystPageKaryogram.java | 16 +- .../genetics/gui/AnalystPageMutations.java | 104 ++--- .../genetics/gui/AnalystPageProduce.java | 116 +++--- .../gui/ControlAnalystChromosome.java | 28 +- .../genetics/gui/ControlAnalystPage.java | 14 +- .../binnie/genetics/gui/ControlBiome.java | 54 +-- .../genetics/gui/ControlChromoPicker.java | 30 +- .../genetics/gui/ControlChromosome.java | 52 +-- .../genetics/gui/ControlGenesisOption.java | 12 +- .../gui/ControlIndividualDisplay.java | 16 +- .../genetics/gui/ControlToleranceBar.java | 52 +-- .../binnie/genetics/gui/ControlTooltip.java | 4 +- .../binnie/genetics/gui/WindowAnalyst.java | 368 +++++++++--------- .../genetics/gui/bee/AnalystPageProducts.java | 111 +++--- .../gui/bee/database/ControlBiomes.java | 47 ++- .../gui/bee/database/ControlClimateBar.java | 118 +++--- .../gui/bee/database/ControlProductsBox.java | 56 +-- .../gui/bee/database/ControlProductsItem.java | 35 +- .../gui/bee/database/PageSpeciesClimate.java | 16 +- .../gui/bee/database/PageSpeciesGenome.java | 98 ++--- .../gui/bee/database/PageSpeciesProducts.java | 24 +- .../bee/database/WindowApiaristDatabase.java | 52 +-- .../gui/butterfly/AnalystPageSpecimen.java | 10 +- .../gui/flower/AnalystPageAppearance.java | 22 +- .../genetics/gui/flower/AnalystPageSoil.java | 68 ++-- .../gui/punnett/ControlChromosome.java | 18 +- .../genetics/gui/punnett/ControlPunnett.java | 32 +- .../gui/punnett/WindowPunnettSquare.java | 16 +- .../genetics/gui/tree/AnalystPageClimate.java | 46 +-- .../genetics/gui/tree/AnalystPageFruit.java | 68 ++-- .../genetics/gui/tree/AnalystPageGrowth.java | 20 +- .../genetics/gui/tree/AnalystPageWood.java | 36 +- .../binnie/genetics/item/ItemAnalyst.java | 2 +- .../genetics/item/ItemBeeDictionary.java | 4 +- .../binnie/genetics/item/ItemDatabase.java | 4 +- .../java/binnie/genetics/item/ItemGene.java | 2 +- .../genetics/item/ItemMasterRegistry.java | 2 +- .../genetics/item/ItemPunnettSquare.java | 2 +- .../binnie/genetics/item/ItemRegistry.java | 2 +- .../binnie/genetics/item/ItemSequence.java | 12 +- .../java/binnie/genetics/item/ItemSerum.java | 16 +- .../binnie/genetics/item/ItemSerumArray.java | 8 +- .../genetics/machine/LaboratoryMachine.java | 2 +- .../acclimatiser/PackageAcclimatiser.java | 4 +- .../acclimatiser/WindowAcclimatiser.java | 4 +- .../machine/analyser/PackageAnalyser.java | 4 +- .../machine/analyser/WindowAnalyser.java | 10 +- .../machine/genepool/PackageGenepool.java | 4 +- .../machine/genepool/WindowGenepool.java | 6 +- .../machine/incubator/PackageIncubator.java | 4 +- .../machine/incubator/WindowIncubator.java | 4 +- .../machine/inoculator/PackageInoculator.java | 4 +- .../machine/inoculator/WindowInoculator.java | 4 +- .../machine/isolator/PackageIsolator.java | 4 +- .../machine/isolator/WindowIsolator.java | 6 +- .../polymeriser/PackagePolymeriser.java | 4 +- .../polymeriser/WindowPolymeriser.java | 6 +- .../machine/sequencer/PackageSequencer.java | 4 +- .../machine/sequencer/WindowSequencer.java | 6 +- .../machine/splicer/PackageSplicer.java | 4 +- .../machine/splicer/WindowSplicer.java | 4 +- .../resources/assets/genetics/lang/en_US.lang | 1 + 105 files changed, 1500 insertions(+), 1443 deletions(-) diff --git a/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java b/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java index 84ec414e..45db8929 100644 --- a/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java +++ b/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java @@ -42,7 +42,7 @@ public class ControlColorMixSymbol extends Control implements ITooltip { public void setValue(IColorMix value) { this.value = value; - setColour(0xffffff); + setColor(0xffffff); } @Override diff --git a/src/main/java/binnie/core/craftgui/IWidget.java b/src/main/java/binnie/core/craftgui/IWidget.java index 8cab1663..8063fa58 100644 --- a/src/main/java/binnie/core/craftgui/IWidget.java +++ b/src/main/java/binnie/core/craftgui/IWidget.java @@ -53,9 +53,9 @@ public interface IWidget { Point getRelativeMousePosition(); - int getColour(); + int getColor(); - void setColour(final int p0); + void setColor(final int p0); @SideOnly(Side.CLIENT) void render(int guiWidth, int guiHeight); diff --git a/src/main/java/binnie/core/craftgui/Widget.java b/src/main/java/binnie/core/craftgui/Widget.java index 130677ac..64db8703 100644 --- a/src/main/java/binnie/core/craftgui/Widget.java +++ b/src/main/java/binnie/core/craftgui/Widget.java @@ -209,12 +209,12 @@ public class Widget implements IWidget { } @Override - public final int getColour() { + public final int getColor() { return this.colour; } @Override - public final void setColour(final int colour) { + public final void setColor(final int colour) { if (this.colour != colour) { this.colour = colour; this.callEvent(new EventWidget.ChangeColour(this)); diff --git a/src/main/java/binnie/core/craftgui/WindowFieldKit.java b/src/main/java/binnie/core/craftgui/WindowFieldKit.java index f84c0d05..6a5e66b2 100644 --- a/src/main/java/binnie/core/craftgui/WindowFieldKit.java +++ b/src/main/java/binnie/core/craftgui/WindowFieldKit.java @@ -120,8 +120,8 @@ public class WindowFieldKit extends Window { this.GlassControl = new ControlImage(this, handGlass.x(), handGlass.y(), new StandardTexture(0, 160, 96, 96, ExtraBeeTexture.GUIPunnett)); new ControlSlot.Builder(this, handGlass.x() + 54, handGlass.y() + 26).assign(InventoryType.Window, 0); new ControlSlot.Builder(this, 208, 8).assign(InventoryType.Window, 1); - (this.text = new ControlText(this, new Point(232, 13), "Paper")).setColour(2236962); - (this.text = new ControlText(this, new Area(0, 120, this.width(), 24), "", TextJustification.MIDDLE_CENTER)).setColour(2236962); + (this.text = new ControlText(this, new Point(232, 13), "Paper")).setColor(2236962); + (this.text = new ControlText(this, new Area(0, 120, this.width(), 24), "", TextJustification.MIDDLE_CENTER)).setColor(2236962); this.chromo = new ControlChromosome(this, 150, 24); this.addEventHandler(new EventValueChanged.Handler() { @Override diff --git a/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java b/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java index a702c05b..d302c190 100644 --- a/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java +++ b/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java @@ -29,7 +29,7 @@ public class ControlCheckbox extends Control implements IControlValue { this.text = text; this.value = bool; if (w > 16) { - new ControlText(this, new Area(16, 1, w - 16, 16), text, TextJustification.MIDDLE_CENTER).setColour(4473924); + new ControlText(this, new Area(16, 1, w - 16, 16), text, TextJustification.MIDDLE_CENTER).setColor(4473924); } this.addAttribute(Attribute.MouseOver); this.addEventHandler(new EventMouse.Down.Handler() { diff --git a/src/main/java/binnie/core/craftgui/controls/ControlText.java b/src/main/java/binnie/core/craftgui/controls/ControlText.java index 07f6e31a..781c8fa3 100644 --- a/src/main/java/binnie/core/craftgui/controls/ControlText.java +++ b/src/main/java/binnie/core/craftgui/controls/ControlText.java @@ -32,7 +32,7 @@ public class ControlText extends Control implements IControlValue { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawText(this.getArea(), this.align, this.text, this.getColour()); + RenderUtil.drawText(this.getArea(), this.align, this.text, this.getColor()); } @Override diff --git a/src/main/java/binnie/core/craftgui/controls/listbox/ControlOption.java b/src/main/java/binnie/core/craftgui/controls/listbox/ControlOption.java index e1686ae1..10adc033 100644 --- a/src/main/java/binnie/core/craftgui/controls/listbox/ControlOption.java +++ b/src/main/java/binnie/core/craftgui/controls/listbox/ControlOption.java @@ -35,7 +35,7 @@ public class ControlOption extends Control implements IControlValue { if (this.isCurrentSelection()) { colour = 0xffffff; } - this.setColour(colour); + this.setColor(colour); } @Override diff --git a/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java b/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java index cbd72614..ad677498 100644 --- a/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java +++ b/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java @@ -15,7 +15,7 @@ public class ControlTextOption extends ControlOption { this.addEventHandler(new EventWidget.ChangeColour.Handler() { @Override public void onEvent(final EventWidget.ChangeColour event) { - ControlTextOption.this.textWidget.setColour(ControlTextOption.this.getColour()); + ControlTextOption.this.textWidget.setColor(ControlTextOption.this.getColor()); } }.setOrigin(EventHandler.Origin.Self, this)); } diff --git a/src/main/java/binnie/core/craftgui/controls/tab/ControlTab.java b/src/main/java/binnie/core/craftgui/controls/tab/ControlTab.java index a959b0c4..ed147ec4 100644 --- a/src/main/java/binnie/core/craftgui/controls/tab/ControlTab.java +++ b/src/main/java/binnie/core/craftgui/controls/tab/ControlTab.java @@ -96,9 +96,9 @@ public class ControlTab extends Control implements ITooltip, IControlValue final ControlTabIcon icon = (ControlTabIcon) this; final ControlItemDisplay item = (ControlItemDisplay) this.getWidgets().get(0); if (texture == CraftGUITexture.TabDisabled) { - item.setColour(-1431655766); + item.setColor(-1431655766); } else { - item.setColour(-1); + item.setColor(-1); } if (icon.hasOutline()) { iTexture = CraftGUI.render.getTexture(CraftGUITexture.TabOutline); diff --git a/src/main/java/binnie/core/craftgui/database/ControlMutationSymbol.java b/src/main/java/binnie/core/craftgui/database/ControlMutationSymbol.java index 0780b2a0..34e17199 100644 --- a/src/main/java/binnie/core/craftgui/database/ControlMutationSymbol.java +++ b/src/main/java/binnie/core/craftgui/database/ControlMutationSymbol.java @@ -50,9 +50,9 @@ class ControlMutationSymbol extends Control implements ITooltip { final BreedingSystem system = ((WindowAbstractDatabase) this.getTopParent()).getBreedingSystem(); this.discovered = (isNEI || system.isMutationDiscovered(value, Window.get(this).getWorld(), Window.get(this).getUsername())); if (this.discovered) { - this.setColour(16777215); + this.setColor(16777215); } else { - this.setColour(7829367); + this.setColor(7829367); } } diff --git a/src/main/java/binnie/core/craftgui/database/PageSpeciesClassification.java b/src/main/java/binnie/core/craftgui/database/PageSpeciesClassification.java index 013b7872..00ca592f 100644 --- a/src/main/java/binnie/core/craftgui/database/PageSpeciesClassification.java +++ b/src/main/java/binnie/core/craftgui/database/PageSpeciesClassification.java @@ -20,11 +20,11 @@ public class PageSpeciesClassification extends PageSpecies { int y = 16; for (final IClassification.EnumClassLevel level : IClassification.EnumClassLevel.values()) { final ControlText text = new ControlTextCentered(this, y, ""); - text.setColour(level.getColour()); + text.setColor(level.getColour()); this.levels.put(level, text); y += 12; } - (this.genus = new ControlTextCentered(this, y, "")).setColour(16759415); + (this.genus = new ControlTextCentered(this, y, "")).setColor(16759415); } @Override diff --git a/src/main/java/binnie/core/craftgui/database/WindowAbstractDatabase.java b/src/main/java/binnie/core/craftgui/database/WindowAbstractDatabase.java index 4c304584..186408b4 100644 --- a/src/main/java/binnie/core/craftgui/database/WindowAbstractDatabase.java +++ b/src/main/java/binnie/core/craftgui/database/WindowAbstractDatabase.java @@ -133,8 +133,8 @@ public abstract class WindowAbstractDatabase extends Window { } }.setOrigin(EventHandler.Origin.DirectChild, this)); new ControlHelp(this, 4, 4); - (this.panelInformation = new Panel(this, 24, 24, 144, 176, MinecraftGUI.PanelType.Black)).setColour(860416); - (this.panelSearch = new Panel(this, 176, 24, this.selectionBoxWidth, 160, MinecraftGUI.PanelType.Black)).setColour(860416); + (this.panelInformation = new Panel(this, 24, 24, 144, 176, MinecraftGUI.PanelType.Black)).setColor(860416); + (this.panelSearch = new Panel(this, 176, 24, this.selectionBoxWidth, 160, MinecraftGUI.PanelType.Black)).setColor(860416); this.modePages = new ControlPages<>(this, 0, 0, this.getSize().x(), this.getSize().y()); new ControlTextEdit(this, 176, 184, this.selectionBoxWidth, 16); this.createMode(Mode.SPECIES, new SpeciesModeWidgets()); diff --git a/src/main/java/binnie/core/craftgui/minecraft/Window.java b/src/main/java/binnie/core/craftgui/minecraft/Window.java index 384cd874..c20a3127 100644 --- a/src/main/java/binnie/core/craftgui/minecraft/Window.java +++ b/src/main/java/binnie/core/craftgui/minecraft/Window.java @@ -179,7 +179,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG } public void setTitle(final String title) { - (this.title = new ControlTextCentered(this, 12, title)).setColour(4210752); + (this.title = new ControlTextCentered(this, 12, title)).setColor(4210752); } @SideOnly(Side.CLIENT) @@ -229,7 +229,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG if (this.getBackground2() != null) { CraftGUI.render.texture(this.getBackground2(), new Point(256, 0)); } - RenderUtil.setColour(this.getColour()); + RenderUtil.setColour(this.getColor()); CraftGUI.render.texture(CraftGUITexture.Window, this.getArea()); } diff --git a/src/main/java/binnie/core/craftgui/renderer/TextureRenderer.java b/src/main/java/binnie/core/craftgui/renderer/TextureRenderer.java index ca02f5cd..89bd2f04 100644 --- a/src/main/java/binnie/core/craftgui/renderer/TextureRenderer.java +++ b/src/main/java/binnie/core/craftgui/renderer/TextureRenderer.java @@ -98,7 +98,7 @@ public class TextureRenderer { public final void preRender(final IWidget widget, int guiWidth, int guiHeight) { GlStateManager.pushMatrix(); GlStateManager.translate(widget.getPosition().x(), widget.getPosition().y(), 0.0f); - RenderUtil.setColour(widget.getColour()); + RenderUtil.setColour(widget.getColor()); if (widget.isCroppedWidet()) { final IWidget cropRelative = (widget.getCropWidget() != null) ? widget.getCropWidget() : widget; final Point pos = cropRelative.getAbsolutePosition(); diff --git a/src/main/java/binnie/core/machines/storage/ControlColourSelector.java b/src/main/java/binnie/core/machines/storage/ControlColourSelector.java index 8ab8731d..f991e171 100644 --- a/src/main/java/binnie/core/machines/storage/ControlColourSelector.java +++ b/src/main/java/binnie/core/machines/storage/ControlColourSelector.java @@ -34,7 +34,7 @@ class ControlColourSelector extends Control implements ITooltip, IControlValue WindowApiaristDatabase.create(player, side, false)), - BeeDatabaseNEI((player, inventory, side) -> WindowApiaristDatabase.create(player, side, true)), - PunnettSquare(WindowPunnettSquare::create); + GENEPOOL(WindowGenepool::new), + ISOLATOR(WindowIsolator::new), + SEQUENCER(WindowSequencer::new), + POLYMERISER(WindowPolymeriser::new), + INOCULATOR(WindowInoculator::new), + GENE_BANK(WindowGeneBank::new), + ANALYSER(WindowAnalyser::new), + INCUBATOR(WindowIncubator::new), + DATABASE(WindowGeneBank::new), + DATABASE_NEI(WindowGeneBankNEI::new), + ACCLIMATISER(WindowAcclimatiser::new), + SPLICER(WindowSplicer::new), + ANALYST(WindowAnalyst.create(false, false)), + REGISTRY(WindowAnalyst.create(true, false)), + MASTER_REGISTRY(WindowAnalyst.create(true, true)), + BEE_DATABASE((player, inventory, side) -> WindowApiaristDatabase.create(player, side, false)), + BEE_DATABASE_NEI((player, inventory, side) -> WindowApiaristDatabase.create(player, side, true)), + PUNNETT_SQUARE(WindowPunnettSquare::create); private final WindowFactory windowFactory; - GeneticsGUI(final WindowFactory windowFactory) { + GeneticsGUI(WindowFactory windowFactory) { this.windowFactory = windowFactory; } - public Window getWindow(final EntityPlayer player, @Nullable final IInventory object, final Side side) { - return this.windowFactory.create(player, object, side); + public Window getWindow(EntityPlayer player, @Nullable IInventory object, Side side) { + return windowFactory.create(player, object, side); } @Override - public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) { - final TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z)); + public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) { + TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z)); IInventory object = null; if (tileEntity instanceof IInventory) { object = (IInventory) tileEntity; } - return getWindow(player, object, side); } public interface WindowFactory { - Window create(final EntityPlayer player, @Nullable final IInventory inventory, final Side side); + Window create(EntityPlayer player, @Nullable IInventory inventory, Side side); } } diff --git a/src/main/java/binnie/genetics/core/GeneticsPacket.java b/src/main/java/binnie/genetics/core/GeneticsPacket.java index 31cbff93..43bed372 100644 --- a/src/main/java/binnie/genetics/core/GeneticsPacket.java +++ b/src/main/java/binnie/genetics/core/GeneticsPacket.java @@ -12,17 +12,16 @@ import binnie.core.network.packet.MessageNBT; import binnie.genetics.genetics.GeneTracker; public enum GeneticsPacket implements IPacketID { - GeneTrackerSync; + GENE_TRACKER_SYNC; @Override - public void onMessage(final MessageBinnie message, final MessageContext context) { - if (this == GeneticsPacket.GeneTrackerSync && context.side == Side.CLIENT) { - final MessageNBT packet = new MessageNBT(message); - final EntityPlayer player = BinnieCore.getBinnieProxy().getPlayer(); - GeneTracker tracker = GeneTracker.getTracker(BinnieCore.getBinnieProxy().getWorld(), player.getGameProfile()); - if (tracker != null) { - tracker.readFromNBT(packet.getTagCompound()); - } + public void onMessage(MessageBinnie message, MessageContext context) { + if (this != GeneticsPacket.GENE_TRACKER_SYNC || context.side != Side.CLIENT) { + return; } + MessageNBT packet = new MessageNBT(message); + EntityPlayer player = BinnieCore.getBinnieProxy().getPlayer(); + GeneTracker tracker = GeneTracker.getTracker(BinnieCore.getBinnieProxy().getWorld(), player.getGameProfile()); + tracker.readFromNBT(packet.getTagCompound()); } } diff --git a/src/main/java/binnie/genetics/core/GeneticsTexture.java b/src/main/java/binnie/genetics/core/GeneticsTexture.java index b7c7e71b..1192a29b 100644 --- a/src/main/java/binnie/genetics/core/GeneticsTexture.java +++ b/src/main/java/binnie/genetics/core/GeneticsTexture.java @@ -13,40 +13,42 @@ import binnie.core.resource.ResourceType; import binnie.genetics.Genetics; public enum GeneticsTexture implements IBinnieTexture { - GeneticMachine(ResourceType.Tile, "GeneticMachine"), - Genepool(ResourceType.Tile, "genepool"), - Incubator(ResourceType.Tile, "incubator"), - GUIProcess(ResourceType.GUI, "process"), - GUIProcess2(ResourceType.GUI, "process2"), - GUIProcess3(ResourceType.GUI, "process3"), - Isolator(ResourceType.Tile, "isolator"), - Sequencer(ResourceType.Tile, "sequencer"), - Polymeriser(ResourceType.Tile, "polymeriser"), - Inoculator(ResourceType.Tile, "inoculator"), - Analyser(ResourceType.Tile, "analyser"), - MachineGlow(ResourceType.Tile, "MachineGlow"), - GeneBank(ResourceType.Tile, "GeneBank"), - LabMachine(ResourceType.Tile, "lab_machine"), - Acclimatiser(ResourceType.Tile, "acclimatiser"), - Splicer(ResourceType.Tile, "splicer"); + GENETIC_MACHINE(ResourceType.Tile, "GeneticMachine"), + GENEPOOL(ResourceType.Tile, "genepool"), + INCUBATOR(ResourceType.Tile, "incubator"), + GUI_PROCESS(ResourceType.GUI, "process"), + GUI_PROCESS_2(ResourceType.GUI, "process2"), + GUI_PROCESS_3(ResourceType.GUI, "process3"), + ISOLATOR(ResourceType.Tile, "isolator"), + SEQUENCER(ResourceType.Tile, "sequencer"), + POLYMERISER(ResourceType.Tile, "polymeriser"), + INOCULATOR(ResourceType.Tile, "inoculator"), + ANALYSER(ResourceType.Tile, "analyser"), + MACHINE_GLOW(ResourceType.Tile, "MachineGlow"), + GENE_BANK(ResourceType.Tile, "GeneBank"), + LAB_MACHINE(ResourceType.Tile, "lab_machine"), + ACCLIMATISER(ResourceType.Tile, "acclimatiser"), + SPLICER(ResourceType.Tile, "splicer"); public static BinnieSprite dnaIcon = Binnie.RESOURCE.getItemSprite(Genetics.instance, "dna"); + private final String texture; private final ResourceType type; + @SideOnly(Side.CLIENT) @Nullable private BinnieResource resource; - GeneticsTexture(final ResourceType base, final String texture) { + GeneticsTexture(ResourceType base, String texture) { this.texture = texture; - this.type = base; + type = base; } @Override @SideOnly(Side.CLIENT) public BinnieResource getTexture() { if (resource == null) { - resource = Binnie.RESOURCE.getPNG(Genetics.instance, this.type, this.texture); + resource = Binnie.RESOURCE.getPNG(Genetics.instance, type, texture); } return resource; } diff --git a/src/main/java/binnie/genetics/genetics/AlleleHelper.java b/src/main/java/binnie/genetics/genetics/AlleleHelper.java index 82adea27..f714b08a 100644 --- a/src/main/java/binnie/genetics/genetics/AlleleHelper.java +++ b/src/main/java/binnie/genetics/genetics/AlleleHelper.java @@ -21,133 +21,133 @@ public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper { public static IAllele getAllele(EnumTemperature temperature) { return getAllele(getUid(temperature)); } - + public static IAllele getAllele(EnumHumidity humidity) { return getAllele(getUid(humidity)); } - + public static IAllele getAllele(EnumTolerance tolerance) { return getAllele(getUid(tolerance)); } - + public static IAllele getAllele(EnumAllele.Fertility fertility) { return getAllele(getUid(fertility)); } - + public static IAllele getAllele(EnumAllele.Territory territory) { return getAllele(getUid(territory)); } - + public static IAllele getAllele(EnumAllele.Lifespan lifespan) { return getAllele(getUid(lifespan)); } - + public static IAllele getAllele(EnumAllele.Sappiness sappiness) { return getAllele(getUid(sappiness)); } - + public static IAllele getAllele(EnumAllele.Speed speed) { return getAllele(getUid(speed)); } - + public static IAllele getAllele(EnumAllele.Flowering flowering) { return getAllele(getUid(flowering)); } - + public static IAllele getAllele(EnumAllele.Height height) { return getAllele(getUid(height)); } - + public static IAllele getAllele(EnumAllele.Maturation maturation) { return getAllele(getUid(maturation)); } - + public static IAllele getAllele(EnumAllele.Yield yield) { return getAllele(getUid(yield)); } - + public static IAllele getAllele(EnumAllele.Saplings saplings) { return getAllele(getUid(saplings)); } - + public static IAllele getAllele(EnumFlowerColor color) { return color.getFlowerColorAllele(); } - + public static IAllele getAllele(int number) { return getAllele("forestry.i" + number + "d"); } - + public static IAllele getAllele(boolean bool) { if (bool) { return getAllele("forestry.boolTrue"); } return getAllele("forestry.boolFalse"); } - + public static IAllele getAllele(String uid) { return AlleleManager.alleleRegistry.getAllele(uid); } - + public static String toDisplay(EnumTemperature temperature) { return AlleleManager.climateHelper.toDisplay(temperature); } - + public static String toDisplay(EnumHumidity humidity) { return AlleleManager.climateHelper.toDisplay(humidity); } - + public static String toDisplay(EnumMoisture moisture) { return I18N.localise("botany.moisture." + moisture.getName()); } - + public static String toDisplay(EnumAcidity acidity) { return I18N.localise("botany.ph." + acidity.getName()); } - + public static String toDisplay(EnumSoilType soilType) { return I18N.localise("botany.soil." + soilType.getName()); } - + public static String toDisplay(EnumTolerance tolerance) { return toAlleleDisplay("tolerance", tolerance.name()); } - + public static String toDisplay(EnumAllele.Flowering flowering) { if (flowering == EnumAllele.Flowering.AVERAGE) { return toAlleleDisplay("flowering", "normal"); } return toAlleleDisplay(null, flowering.name()); } - + public static String toDisplay(EnumAllele.Speed speed) { return toAlleleDisplay(null, speed.name()); } - + public static String toDisplay(EnumAllele.Lifespan lifespan) { return toAlleleDisplay("lifespan", lifespan.name()); } - + public static String getUid(EnumAllele.Fertility fertility) { return getUid("fertility", fertility.name()); } - + public static String getUid(EnumAllele.Lifespan lifespan) { return getUid("lifespan", lifespan.name()); } - + public static String getUid(EnumAllele.Sappiness sappiness) { return getUid("sappiness", sappiness.name()); } - + private static String getUid(EnumTemperature temperature) { return getUid("temperature", temperature.name()); } - + private static String getUid(EnumHumidity humidity) { return getUid("humidity", humidity.name()); } - + public static String getUid(EnumAllele.Saplings saplings) { if (saplings == EnumAllele.Saplings.AVERAGE) { return getUid("saplings", "Default"); @@ -160,49 +160,49 @@ public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper { } return getUid("saplings", saplings.name()); } - + public static String getUid(EnumAllele.Height height) { if (height == EnumAllele.Height.AVERAGE) { return getUid("height", "Max10", false); } return getUid("height", height.name()); } - + public static String getUid(EnumAllele.Maturation maturation) { return getUid("maturation", maturation.name()); } - + public static String getUid(EnumAllele.Territory territory) { return getUid("territory", territory.name()); } - + public static String getUid(EnumAllele.Yield yield) { if (yield == EnumAllele.Yield.AVERAGE) { return getUid("yield", "Default", false); } return getUid("yield", yield.name()); } - + public static String getUid(EnumAllele.Fireproof fireproof) { return getUid("bool", fireproof.name()); } - + public static String getUid(EnumAllele.Flowering flowering) { return getUid("flowering", flowering.name()); } - + public static String getUid(EnumTolerance tolerance) { return getUid("tolerance", tolerance.name()); } - + public static String getUid(EnumAllele.Speed speed) { return getUid("speed", speed.name()); } - + protected static String getUid(String key, String valueName) { return getUid(key, valueName, true); } - + private static String getUid(String key, String valueName, boolean needCapitalize) { if (needCapitalize) { valueName = WordUtils.capitalize(valueName.toLowerCase(Locale.ENGLISH)); @@ -210,7 +210,7 @@ public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper { valueName = valueName.replace("_", ""); return "forestry." + key + valueName; } - + private static String toAlleleDisplay(String key, String valueName) { String name = valueName.toLowerCase().replace("_", ""); if (key == null) { diff --git a/src/main/java/binnie/genetics/genetics/Engineering.java b/src/main/java/binnie/genetics/genetics/Engineering.java index 0495817f..689c949b 100644 --- a/src/main/java/binnie/genetics/genetics/Engineering.java +++ b/src/main/java/binnie/genetics/genetics/Engineering.java @@ -14,19 +14,22 @@ import binnie.genetics.item.ItemSerum; import binnie.genetics.item.ItemSerumArray; public class Engineering { - public static boolean isGeneAcceptor(final ItemStack stack) { + public static boolean isGeneAcceptor(ItemStack stack) { if (stack.isEmpty()) { return false; } + Item item = stack.getItem(); if (item instanceof IItemSerum) { return ((IItemSerum) item).getCharges(stack) == 0; } + int metadata = stack.getMetadata(); - return item == Genetics.items().getItemGenetics() && (metadata == GeneticsItems.EMPTY_SERUM.ordinal() || metadata == GeneticsItems.EMPTY_GENOME.ordinal()); + return item == Genetics.items().getItemGenetics() + && (metadata == GeneticsItems.EMPTY_SERUM.ordinal() || metadata == GeneticsItems.EMPTY_GENOME.ordinal()); } - public static boolean canAcceptGene(final ItemStack stack, final IGene gene) { + public static boolean canAcceptGene(ItemStack stack, IGene gene) { Item item = stack.getItem(); if (item instanceof ItemSerum) { return true; @@ -38,19 +41,20 @@ public class Engineering { } @Nullable - public static IGene getGene(final ItemStack stack, final int chromosome) { + public static IGene getGene(ItemStack stack, int chromosome) { if (stack.getItem() instanceof IItemSerum) { return ((IItemSerum) stack.getItem()).getGene(stack, chromosome); } return null; } - public static ItemStack addGene(final ItemStack stack, final IGene gene) { + public static ItemStack addGene(ItemStack stack, IGene gene) { Item item = stack.getItem(); int metadata = stack.getMetadata(); if (item instanceof IItemSerum) { ((IItemSerum) item).addGene(stack, gene); } + if (item == Genetics.items().getItemGenetics()) { if (metadata == GeneticsItems.EMPTY_SERUM.ordinal()) { return ItemSerum.create(gene); @@ -61,12 +65,13 @@ public class Engineering { return stack; } - public static IGene[] getGenes(final ItemStack serum) { + public static IGene[] getGenes(ItemStack serum) { if (!serum.isEmpty()) { Item item = serum.getItem(); if (item instanceof IItemSerum) { return ((IItemSerum) item).getGenes(serum); } + if (item == Genetics.items().itemSequencer) { SequencerItem sequencerItem = SequencerItem.create(serum); if (sequencerItem != null) { @@ -77,7 +82,7 @@ public class Engineering { return new IGene[0]; } - public static int getCharges(final ItemStack serum) { + public static int getCharges(ItemStack serum) { return ((IItemChargeable) serum.getItem()).getCharges(serum); } } diff --git a/src/main/java/binnie/genetics/genetics/GeneArrayItem.java b/src/main/java/binnie/genetics/genetics/GeneArrayItem.java index c53fffe9..7c012ace 100644 --- a/src/main/java/binnie/genetics/genetics/GeneArrayItem.java +++ b/src/main/java/binnie/genetics/genetics/GeneArrayItem.java @@ -24,87 +24,91 @@ import binnie.core.util.I18N; import binnie.genetics.api.IGene; public class GeneArrayItem implements INbtReadable, INbtWritable, IGeneItem { - static final String GENES_NBT = "genes"; - List genes; + private static final String GENES_NBT = "genes"; - public GeneArrayItem(final ItemStack stack) { - this.genes = new ArrayList<>(); - this.readFromNBT(stack.getTagCompound()); + private List genes; + + public GeneArrayItem(ItemStack stack) { + genes = new ArrayList<>(); + readFromNBT(stack.getTagCompound()); } - public GeneArrayItem(final IGene gene) { - this.genes = new ArrayList<>(); - this.addGene(gene); + public GeneArrayItem(IGene gene) { + genes = new ArrayList<>(); + addGene(gene); } public GeneArrayItem() { - this.genes = new ArrayList<>(); + genes = new ArrayList<>(); } @Override - public int getColour(final int renderPass) { + public int getColor(int renderPass) { if (renderPass == 2) { - BreedingSystem breedingSystem = this.getBreedingSystem(); + BreedingSystem breedingSystem = getBreedingSystem(); if (breedingSystem != null) { return breedingSystem.getColour(); } } - return 16777215; + return 0xffffff; } @Override @SideOnly(Side.CLIENT) - public void getInfo(final List list) { - final List totalList = new ArrayList<>(); - - BreedingSystem breedingSystem = this.getBreedingSystem(); + public void getInfo(List list) { + List totalList = new ArrayList<>(); + BreedingSystem breedingSystem = getBreedingSystem(); if (breedingSystem != null) { - for (IGene gene : this.genes) { - final String chromosomeName = breedingSystem.getChromosomeName(gene.getChromosome()); + for (IGene gene : genes) { + String chromosomeName = breedingSystem.getChromosomeName(gene.getChromosome()); totalList.add(TextFormatting.GOLD + chromosomeName + TextFormatting.GRAY + ": " + gene.getName()); } } + if (totalList.size() < 4 || GuiScreen.isShiftKeyDown()) { list.addAll(totalList); } else { list.add(totalList.get(0)); list.add(totalList.get(1)); - list.add(totalList.size() - 2 + " " + I18N.localise("genetics.item.gene.more.genes")); + list.add((totalList.size() - 2) + " " + I18N.localise("genetics.item.gene.more.genes")); } } @Nullable public BreedingSystem getBreedingSystem() { - if (this.genes.size() == 0) { + if (genes.size() == 0) { return null; } - final BreedingSystem system = Binnie.GENETICS.getSystem(this.genes.get(0).getSpeciesRoot().getUID()); + BreedingSystem system = Binnie.GENETICS.getSystem(genes.get(0).getSpeciesRoot().getUID()); return (system == null) ? Binnie.GENETICS.getActiveSystems().iterator().next() : system; } public List getGenes() { - return this.genes; + return genes; } @Override public void readFromNBT(@Nullable NBTTagCompound nbt) { - this.genes.clear(); - if (nbt != null) { - NBTTagList list = nbt.getTagList(GENES_NBT, 10); - for (int i = 0; i < list.tagCount(); ++i) { - Gene gene = Gene.create(list.getCompoundTagAt(i)); - this.genes.add(gene); - } + genes.clear(); + if (nbt == null) { + return; + } + + NBTTagList list = nbt.getTagList(GENES_NBT, 10); + for (int i = 0; i < list.tagCount(); ++i) { + Gene gene = Gene.create(list.getCompoundTagAt(i)); + genes.add(gene); } } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbt) { - if (this.genes.size() == 0) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + if (genes.size() == 0) { return nbt; } + NBTTagList list = new NBTTagList(); - for (IGene gene : this.genes) { + for (IGene gene : genes) { list.appendTag(gene.getNBTTagCompound()); } nbt.setTag(GENES_NBT, list); @@ -114,15 +118,15 @@ public class GeneArrayItem implements INbtReadable, INbtWritable, IGeneItem { @Override @Nullable public ISpeciesRoot getSpeciesRoot() { - if (this.genes.size() == 0) { + if (genes.size() == 0) { return null; } - return this.genes.get(0).getSpeciesRoot(); + return genes.get(0).getSpeciesRoot(); } @Nullable - public IGene getGene(final int chromosome) { - for (final IGene gene : this.genes) { + public IGene getGene(int chromosome) { + for (IGene gene : genes) { if (gene.getChromosome().ordinal() == chromosome) { return gene; } @@ -131,20 +135,20 @@ public class GeneArrayItem implements INbtReadable, INbtWritable, IGeneItem { } @Override - public void writeToItem(final ItemStack stack) { + public void writeToItem(ItemStack stack) { NBTTagCompound nbt = stack.getTagCompound(); if (nbt == null) { nbt = new NBTTagCompound(); } - this.writeToNBT(nbt); + writeToNBT(nbt); stack.setTagCompound(nbt); } @Override - public void addGene(final IGene gene) { - if (this.getGene(gene.getChromosome().ordinal()) != null) { - this.genes.remove(this.getGene(gene.getChromosome().ordinal())); + public void addGene(IGene gene) { + if (getGene(gene.getChromosome().ordinal()) != null) { + genes.remove(getGene(gene.getChromosome().ordinal())); } - this.genes.add(gene); + genes.add(gene); } } diff --git a/src/main/java/binnie/genetics/genetics/GeneItem.java b/src/main/java/binnie/genetics/genetics/GeneItem.java index d4db1bc8..899c7520 100644 --- a/src/main/java/binnie/genetics/genetics/GeneItem.java +++ b/src/main/java/binnie/genetics/genetics/GeneItem.java @@ -23,12 +23,12 @@ import binnie.genetics.api.IGene; public class GeneItem implements INbtWritable, IGeneItem { private IGene gene; - public GeneItem(final IGene gene) { + public GeneItem(IGene gene) { this.gene = gene; } @Nullable - public static GeneItem create(final ItemStack stack) { + public static GeneItem create(ItemStack stack) { NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound != null && tagCompound.hasKey("gene", Constants.NBT.TAG_COMPOUND)) { NBTTagCompound geneNbt = tagCompound.getCompoundTag("gene"); @@ -39,52 +39,52 @@ public class GeneItem implements INbtWritable, IGeneItem { } @Override - public void writeToItem(final ItemStack stack) { + public void writeToItem(ItemStack stack) { NBTTagCompound nbt = stack.getTagCompound(); if (nbt == null) { nbt = new NBTTagCompound(); } - this.writeToNBT(nbt); + writeToNBT(nbt); stack.setTagCompound(nbt); } @Override - public int getColour(final int renderPass) { + public int getColor(int renderPass) { if (renderPass == 2) { - return this.getBreedingSystem().getColour(); + return getBreedingSystem().getColour(); } - return 16777215; + return 0xffffff; } @Override @SideOnly(Side.CLIENT) - public void getInfo(final List list) { - final String chromosomeName = this.getBreedingSystem().getChromosomeName(this.gene.getChromosome()); - list.add(TextFormatting.GOLD + chromosomeName + TextFormatting.GRAY + ": " + this.gene.getName()); + public void getInfo(List list) { + String chromosomeName = getBreedingSystem().getChromosomeName(gene.getChromosome()); + list.add(TextFormatting.GOLD + chromosomeName + TextFormatting.GRAY + ": " + gene.getName()); } public BreedingSystem getBreedingSystem() { - return Binnie.GENETICS.getSystem(this.gene.getSpeciesRoot()); + return Binnie.GENETICS.getSystem(gene.getSpeciesRoot()); } public IGene getGene() { - return this.gene; + return gene; } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbt) { - final NBTTagCompound geneNBT = this.gene.getNBTTagCompound(); + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + NBTTagCompound geneNBT = gene.getNBTTagCompound(); nbt.setTag("gene", geneNBT); return nbt; } @Override public ISpeciesRoot getSpeciesRoot() { - return this.gene.getSpeciesRoot(); + return gene.getSpeciesRoot(); } @Override - public void addGene(final IGene gene) { + public void addGene(IGene gene) { this.gene = gene; } } diff --git a/src/main/java/binnie/genetics/genetics/GeneProject.java b/src/main/java/binnie/genetics/genetics/GeneProject.java index b8f3d0cf..81bc45a2 100644 --- a/src/main/java/binnie/genetics/genetics/GeneProject.java +++ b/src/main/java/binnie/genetics/genetics/GeneProject.java @@ -11,51 +11,52 @@ public class GeneProject { private GameProfile leader; private List members; - public GeneProject(final int id, final String name, final GameProfile leader) { + public GeneProject(int id, String name, GameProfile leader) { this.id = 0; this.leader = leader; - this.members = new ArrayList<>(); - this.setID(id); this.name = name; + members = new ArrayList<>(); + setID(id); } public int getID() { - return this.id; + return id; } - public void setID(final int id) { + public void setID(int id) { this.id = id; } public String getName() { - return this.name; + return name; } - public void setName(final String name) { + public void setName(String name) { this.name = name; } public GameProfile getLeader() { - return this.leader; + return leader; } public boolean isEmpty() { - return this.members.isEmpty(); + return members.isEmpty(); } - public void addPlayer(final GameProfile player) { - if (!this.members.contains(player)) { - this.members.add(player); + public void addPlayer(GameProfile player) { + if (!members.contains(player)) { + members.add(player); } - if (this.leader == null) { - this.leader = player; + // TODO always false? + if (leader == null) { + leader = player; } } - public void removePlayer(final GameProfile player) { - if (player == this.leader) { + public void removePlayer(GameProfile player) { + if (player == leader) { throw new RuntimeException("Can't remove leader of a Gene Project"); } - this.members.remove(player); + members.remove(player); } } diff --git a/src/main/java/binnie/genetics/genetics/GeneProjectTracker.java b/src/main/java/binnie/genetics/genetics/GeneProjectTracker.java index 3ab86609..8739715e 100644 --- a/src/main/java/binnie/genetics/genetics/GeneProjectTracker.java +++ b/src/main/java/binnie/genetics/genetics/GeneProjectTracker.java @@ -12,17 +12,17 @@ import net.minecraft.world.WorldSavedData; import com.mojang.authlib.GameProfile; public class GeneProjectTracker extends WorldSavedData { - Map projects; - Map> TeamInvites; + private Map projects; + private Map> TeamInvites; - public GeneProjectTracker(final String s) { + public GeneProjectTracker(String s) { super(s); - this.projects = new HashMap<>(); - this.TeamInvites = new HashMap<>(); + projects = new HashMap<>(); + TeamInvites = new HashMap<>(); } - public static GeneProjectTracker getTracker(final World world) { - final String filename = "GeneProjectTracker.common"; + public static GeneProjectTracker getTracker(World world) { + String filename = "GeneProjectTracker.common"; GeneProjectTracker tracker = (GeneProjectTracker) world.loadData(GeneProjectTracker.class, filename); if (tracker == null) { tracker = new GeneProjectTracker(filename); @@ -32,87 +32,90 @@ public class GeneProjectTracker extends WorldSavedData { } @Override - public void readFromNBT(final NBTTagCompound nbt) { + public void readFromNBT(NBTTagCompound nbt) { + // ignored } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbt) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { return nbt; } - public int createProject(final String name, final GameProfile leader) { + public int createProject(String name, GameProfile leader) { int i; - for (i = 1; this.projects.keySet().contains(i); ++i) { + for (i = 1; projects.keySet().contains(i); ++i) { } - final GeneProject project = new GeneProject(i, name, leader); - this.projects.put(i, project); - this.markDirty(); + GeneProject project = new GeneProject(i, name, leader); + projects.put(i, project); + markDirty(); return i; } - public void removeProject(final int id) { - this.projects.remove(id); - for (final Map.Entry> entry : this.TeamInvites.entrySet()) { + public void removeProject(int id) { + projects.remove(id); + for (Map.Entry> entry : TeamInvites.entrySet()) { entry.getValue().remove(id); } - this.markDirty(); + markDirty(); } - public void leaveProject(final int id, final GameProfile player) { - final GeneProject project = this.projects.get(id); + public void leaveProject(int id, GameProfile player) { + GeneProject project = projects.get(id); if (project == null) { return; } + project.removePlayer(player); if (project.isEmpty()) { - this.removeProject(id); + removeProject(id); } - this.markDirty(); + markDirty(); } - public void joinProject(final int id, final GameProfile player) { - final GeneProject project = this.projects.get(id); + public void joinProject(int id, GameProfile player) { + GeneProject project = projects.get(id); if (project == null) { return; } project.addPlayer(player); - this.markDirty(); + markDirty(); } - public void reassignPlayer(final int id, final int id2, final GameProfile player) { - final GeneProject project = this.projects.get(id); + public void reassignPlayer(int id, int id2, GameProfile player) { + GeneProject project = projects.get(id); if (project == null) { return; } - final GeneProject project2 = this.projects.get(id2); + + GeneProject project2 = projects.get(id2); if (project2 == null) { return; } - this.leaveProject(id, player); - this.joinProject(id2, player); + leaveProject(id, player); + joinProject(id2, player); } - public void renameProject(final int id, final String newName) { - final GeneProject project = this.projects.get(id); + public void renameProject(int id, String newName) { + GeneProject project = projects.get(id); if (project != null) { project.setName(newName); } - this.markDirty(); + markDirty(); } - public void invitePlayer(final int id, final GameProfile player) { - if (!this.TeamInvites.containsKey(player)) { - this.TeamInvites.put(player, new LinkedHashSet<>()); + public void invitePlayer(int id, GameProfile player) { + if (!TeamInvites.containsKey(player)) { + TeamInvites.put(player, new LinkedHashSet<>()); } - this.TeamInvites.get(player).add(id); - this.markDirty(); + TeamInvites.get(player).add(id); + markDirty(); } - public void revokeInvite(final int id, final GameProfile player) { - if (!this.TeamInvites.containsKey(player)) { - this.TeamInvites.put(player, new LinkedHashSet<>()); + public void revokeInvite(int id, GameProfile player) { + if (!TeamInvites.containsKey(player)) { + TeamInvites.put(player, new LinkedHashSet<>()); } - this.TeamInvites.get(player).add(id); - this.markDirty(); + TeamInvites.get(player).add(id); + markDirty(); } } diff --git a/src/main/java/binnie/genetics/genetics/GeneTracker.java b/src/main/java/binnie/genetics/genetics/GeneTracker.java index d62ae602..d935178e 100644 --- a/src/main/java/binnie/genetics/genetics/GeneTracker.java +++ b/src/main/java/binnie/genetics/genetics/GeneTracker.java @@ -25,26 +25,27 @@ import binnie.genetics.core.GeneticsPacket; public class GeneTracker extends WorldSavedData { private ArrayList discoveredGenes; + @Nullable private GameProfile username; - public GeneTracker(final String s, @Nullable final GameProfile username) { + public GeneTracker(String s, @Nullable GameProfile username) { super(s); - this.discoveredGenes = new ArrayList<>(); + discoveredGenes = new ArrayList<>(); this.username = username; } - public GeneTracker(final String s) { + public GeneTracker(String s) { super(s); - this.discoveredGenes = new ArrayList<>(); + discoveredGenes = new ArrayList<>(); } - protected static GeneTracker getCommonTracker(final EntityPlayer player) { + protected static GeneTracker getCommonTracker(EntityPlayer player) { return getTracker(player.world, null); } - public static GeneTracker getTracker(final World world, @Nullable final GameProfile player) { - final String filename = "GeneTracker." + ((player == null) ? "common" : player.getId()); + public static GeneTracker getTracker(World world, @Nullable GameProfile player) { + String filename = "GeneTracker." + ((player == null) ? "common" : player.getId()); GeneTracker tracker = (GeneTracker) world.loadData(GeneTracker.class, filename); if (tracker == null) { tracker = new GeneTracker(filename, player); @@ -55,31 +56,36 @@ public class GeneTracker extends WorldSavedData { return tracker; } - public void synchToPlayer(final EntityPlayer player) { - final NBTTagCompound nbttagcompound = new NBTTagCompound(); - this.writeToNBT(nbttagcompound); - Genetics.proxy.sendToPlayer(new MessageNBT(GeneticsPacket.GeneTrackerSync.ordinal(), nbttagcompound), player); + public void synchToPlayer(EntityPlayer player) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + writeToNBT(nbttagcompound); + Genetics.proxy.sendToPlayer(new MessageNBT(GeneticsPacket.GENE_TRACKER_SYNC.ordinal(), nbttagcompound), player); } @Override - public void readFromNBT(final NBTTagCompound nbt) { - for (final ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) { + public void readFromNBT(NBTTagCompound nbt) { + for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) { if (!nbt.hasKey(root.getUID())) { continue; } - final NBTTagCompound nbtRoot = nbt.getCompoundTag(root.getUID()); - for (final IChromosomeType chromo : root.getKaryotype()) { - if (nbtRoot.hasKey("" + chromo.ordinal())) { - final NBTTagList nbtChromo = nbtRoot.getTagList("" + chromo.ordinal(), 8); - for (int i = 0; i < nbtChromo.tagCount(); ++i) { - final String uid = nbtChromo.getStringTagAt(i); - final IAllele allele = AlleleManager.alleleRegistry.getAllele(uid); - if (allele != null) { - final Gene gene = new Gene(allele, chromo, root); - if (!this.discoveredGenes.contains(gene)) { - this.discoveredGenes.add(gene); - } - } + + NBTTagCompound nbtRoot = nbt.getCompoundTag(root.getUID()); + for (IChromosomeType chromo : root.getKaryotype()) { + if (!nbtRoot.hasKey("" + chromo.ordinal())) { + continue; + } + + NBTTagList nbtChromo = nbtRoot.getTagList("" + chromo.ordinal(), 8); + for (int i = 0; i < nbtChromo.tagCount(); ++i) { + String uid = nbtChromo.getStringTagAt(i); + IAllele allele = AlleleManager.alleleRegistry.getAllele(uid); + if (allele == null) { + continue; + } + + Gene gene = new Gene(allele, chromo, root); + if (!discoveredGenes.contains(gene)) { + discoveredGenes.add(gene); } } } @@ -87,12 +93,12 @@ public class GeneTracker extends WorldSavedData { } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbt) { - for (final ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) { - final NBTTagCompound nbtRoot = new NBTTagCompound(); - for (final IChromosomeType chromo : root.getKaryotype()) { - final NBTTagList nbtChromo = new NBTTagList(); - for (final IGene gene : this.discoveredGenes) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) { + NBTTagCompound nbtRoot = new NBTTagCompound(); + for (IChromosomeType chromo : root.getKaryotype()) { + NBTTagList nbtChromo = new NBTTagList(); + for (IGene gene : discoveredGenes) { if (gene.getSpeciesRoot() == root && gene.getChromosome() == chromo) { nbtChromo.appendTag(new NBTTagString(gene.getAllele().getUID())); } @@ -104,18 +110,18 @@ public class GeneTracker extends WorldSavedData { return nbt; } - public void registerGene(final IGene iGene) { - if (!this.discoveredGenes.contains(iGene)) { - this.discoveredGenes.add(iGene); + public void registerGene(IGene iGene) { + if (!discoveredGenes.contains(iGene)) { + discoveredGenes.add(iGene); } - this.markDirty(); + markDirty(); } public int getGenesSequenced() { - return this.discoveredGenes.size(); + return discoveredGenes.size(); } - public boolean isSequenced(final Gene gene) { - return this.discoveredGenes.contains(gene); + public boolean isSequenced(Gene gene) { + return discoveredGenes.contains(gene); } } diff --git a/src/main/java/binnie/genetics/genetics/GeneticEngineeringSystem.java b/src/main/java/binnie/genetics/genetics/GeneticEngineeringSystem.java index 66016274..533f9dcc 100644 --- a/src/main/java/binnie/genetics/genetics/GeneticEngineeringSystem.java +++ b/src/main/java/binnie/genetics/genetics/GeneticEngineeringSystem.java @@ -23,45 +23,45 @@ public class GeneticEngineeringSystem { public Map> chromosomeMap; BreedingSystem breedingSystem; - public GeneticEngineeringSystem(final BreedingSystem system) { - this.chromosomeMap = new HashMap<>(); - this.breedingSystem = system; - for (final IIndividual indiv : this.breedingSystem.getSpeciesRoot().getIndividualTemplates()) { - for (final IChromosomeType chromosome : this.breedingSystem.getSpeciesRoot().getKaryotype()) { - if (!this.chromosomeMap.containsKey(chromosome)) { - this.chromosomeMap.put(chromosome, new ArrayList<>()); + public GeneticEngineeringSystem(BreedingSystem system) { + chromosomeMap = new HashMap<>(); + breedingSystem = system; + for (IIndividual indiv : breedingSystem.getSpeciesRoot().getIndividualTemplates()) { + for (IChromosomeType chromosome : breedingSystem.getSpeciesRoot().getKaryotype()) { + if (!chromosomeMap.containsKey(chromosome)) { + chromosomeMap.put(chromosome, new ArrayList<>()); } try { - final IAllele a1 = indiv.getGenome().getActiveAllele(chromosome); - final IAllele a2 = indiv.getGenome().getInactiveAllele(chromosome); - this.chromosomeMap.get(chromosome).add(a1); - this.chromosomeMap.get(chromosome).add(a2); + IAllele a1 = indiv.getGenome().getActiveAllele(chromosome); + IAllele a2 = indiv.getGenome().getInactiveAllele(chromosome); + chromosomeMap.get(chromosome).add(a1); + chromosomeMap.get(chromosome).add(a2); } catch (Exception ex) { throw Throwables.propagate(ex); } } } - for (final IChromosomeType chromosome2 : this.breedingSystem.getSpeciesRoot().getKaryotype()) { - final List alleles = this.getAlleles(chromosome2); - final TreeSet set = new TreeSet<>(new ComparatorAllele()); + for (IChromosomeType chromosome2 : breedingSystem.getSpeciesRoot().getKaryotype()) { + List alleles = getAlleles(chromosome2); + TreeSet set = new TreeSet<>(new ComparatorAllele()); set.addAll(alleles); - final List list = new ArrayList<>(); + List list = new ArrayList<>(); list.addAll(set); - this.chromosomeMap.put(chromosome2, list); + chromosomeMap.put(chromosome2, list); } } - public List getAlleles(final IChromosomeType chromosome) { - return this.chromosomeMap.get(chromosome); + public List getAlleles(IChromosomeType chromosome) { + return chromosomeMap.get(chromosome); } public ISpeciesRoot getSpeciesRoot() { - return this.breedingSystem.getSpeciesRoot(); + return breedingSystem.getSpeciesRoot(); } class ComparatorAllele implements Comparator { @Override - public int compare(final IAllele o1, final IAllele o2) { + public int compare(IAllele o1, IAllele o2) { if (o1 instanceof IAlleleFloat && o2 instanceof IAlleleFloat) { return Float.valueOf(((IAlleleFloat) o1).getValue()).compareTo(((IAlleleFloat) o2).getValue()); } diff --git a/src/main/java/binnie/genetics/genetics/IGeneItem.java b/src/main/java/binnie/genetics/genetics/IGeneItem.java index 504281e6..b1308b55 100644 --- a/src/main/java/binnie/genetics/genetics/IGeneItem.java +++ b/src/main/java/binnie/genetics/genetics/IGeneItem.java @@ -19,9 +19,9 @@ public interface IGeneItem { @SideOnly(Side.CLIENT) void getInfo(List info); - int getColour(int p0); + int getColor(int renderPass); - void writeToItem(ItemStack itemStack); + void writeToItem(ItemStack stack); void addGene(IGene gene); } diff --git a/src/main/java/binnie/genetics/genetics/SequencerItem.java b/src/main/java/binnie/genetics/genetics/SequencerItem.java index 8e0e8e9c..e11920a6 100644 --- a/src/main/java/binnie/genetics/genetics/SequencerItem.java +++ b/src/main/java/binnie/genetics/genetics/SequencerItem.java @@ -14,14 +14,14 @@ public class SequencerItem extends GeneItem { public int sequenced; public boolean analysed; - public SequencerItem(final IGene gene) { + public SequencerItem(IGene gene) { super(gene); - this.sequenced = 0; - this.analysed = false; + sequenced = 0; + analysed = false; } @Nullable - public static SequencerItem create(final ItemStack itemStack) { + public static SequencerItem create(ItemStack itemStack) { NBTTagCompound nbt = itemStack.getTagCompound(); if (nbt != null && nbt.hasKey("gene", Constants.NBT.TAG_COMPOUND) && @@ -39,10 +39,10 @@ public class SequencerItem extends GeneItem { } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbt2) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt2) { NBTTagCompound nbt = super.writeToNBT(nbt2); - nbt.setByte("seq", (byte) this.sequenced); - nbt.setBoolean("ana", this.analysed); + nbt.setByte("seq", (byte) sequenced); + nbt.setBoolean("ana", analysed); return nbt; } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java b/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java index a6066fde..6205e133 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java @@ -25,47 +25,47 @@ import binnie.core.util.I18N; //TODO:localise @SideOnly(Side.CLIENT) public class AnalystPageBehaviour extends ControlAnalystPage { - public AnalystPageBehaviour(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageBehaviour(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(6684723); + setColor(6684723); int y = 4; - new ControlTextCentered(this, y, "§nBehaviour").setColour(this.getColour()); + new ControlTextCentered(this, y, "§nBehaviour").setColor(getColor()); y += 12; if (ind instanceof IBee) { - final IBee bee = (IBee) ind; + IBee bee = (IBee) ind; y += 8; - final int fertility = bee.getGenome().getFlowering(); - new ControlTextCentered(this, y, "Pollinates nearby\n" + bee.getGenome().getFlowerProvider().getDescription()).setColour(this.getColour()); + int fertility = bee.getGenome().getFlowering(); + new ControlTextCentered(this, y, "Pollinates nearby\n" + bee.getGenome().getFlowerProvider().getDescription()).setColor(getColor()); y += 20; - new ControlTextCentered(this, y, "§oEvery " + this.getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100 / fertility)).setColour(this.getColour()); + new ControlTextCentered(this, y, "§oEvery " + getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100 / fertility)).setColor(getColor()); y += 22; - final IAlleleBeeEffect effect = bee.getGenome().getEffect(); - final Vec3i t = bee.getGenome().getTerritory(); + IAlleleBeeEffect effect = bee.getGenome().getEffect(); + Vec3i t = bee.getGenome().getTerritory(); if (!effect.getUID().contains("None")) { - final String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc"); - final String loc = effectDesc.equals("") ? ("Effect: " + effect.getName()) : effectDesc; - new ControlText(this, new Area(4, y, this.width() - 8, 0), loc, TextJustification.TOP_CENTER).setColour(this.getColour()); - y += CraftGUI.render.textHeight(loc, this.width() - 8) + 1; - new ControlTextCentered(this, y, "§oWithin " + t.getX() / 2 + " blocks").setColour(this.getColour()); + String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc"); + String loc = effectDesc.equals("") ? ("Effect: " + effect.getName()) : effectDesc; + new ControlText(this, new Area(4, y, width() - 8, 0), loc, TextJustification.TOP_CENTER).setColor(getColor()); + y += CraftGUI.render.textHeight(loc, width() - 8) + 1; + new ControlTextCentered(this, y, "§oWithin " + t.getX() / 2 + " blocks").setColor(getColor()); y += 22; } - new ControlTextCentered(this, y, "Territory: §o" + t.getX() + "x" + t.getY() + "x" + t.getZ()).setColour(this.getColour()); + new ControlTextCentered(this, y, "Territory: §o" + t.getX() + "x" + t.getY() + "x" + t.getZ()).setColor(getColor()); y += 22; } if (ind instanceof IButterfly) { - final IButterfly bee2 = (IButterfly) ind; - new ControlTextCentered(this, y, "§oMetabolism: " + Binnie.GENETICS.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM))).setColour(this.getColour()); + IButterfly bee2 = (IButterfly) ind; + new ControlTextCentered(this, y, "§oMetabolism: " + Binnie.GENETICS.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM))).setColor(getColor()); y += 20; - new ControlTextCentered(this, y, "Pollinates nearby\n" + bee2.getGenome().getFlowerProvider().getDescription()).setColour(this.getColour()); + new ControlTextCentered(this, y, "Pollinates nearby\n" + bee2.getGenome().getFlowerProvider().getDescription()).setColor(getColor()); y += 20; - new ControlTextCentered(this, y, "§oEvery " + this.getTimeString(1500)).setColour(this.getColour()); + new ControlTextCentered(this, y, "§oEvery " + getTimeString(1500)).setColor(getColor()); y += 22; - final IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect(); + IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect(); if (!effect2.getUID().contains("None")) { - final String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc"); - final String loc2 = effectDesc2.equals("") ? ("Effect: " + effect2.getName()) : effectDesc2; - new ControlText(this, new Area(4, y, this.width() - 8, 0), loc2, TextJustification.TOP_CENTER).setColour(this.getColour()); - y += CraftGUI.render.textHeight(loc2, this.width() - 8) + 1; + String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc"); + String loc2 = effectDesc2.equals("") ? ("Effect: " + effect2.getName()) : effectDesc2; + new ControlText(this, new Area(4, y, width() - 8, 0), loc2, TextJustification.TOP_CENTER).setColor(getColor()); + y += CraftGUI.render.textHeight(loc2, width() - 8) + 1; y += 22; } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageBiology.java b/src/main/java/binnie/genetics/gui/AnalystPageBiology.java index 33232beb..d6d9dce8 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageBiology.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageBiology.java @@ -28,14 +28,14 @@ import binnie.genetics.item.ModuleItems; //TODO:localise @SideOnly(Side.CLIENT) public class AnalystPageBiology extends ControlAnalystPage { - public AnalystPageBiology(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageBiology(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(26214); + setColor(26214); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; if (ind instanceof IBee) { - final IBee bee = (IBee) ind; + IBee bee = (IBee) ind; if (bee.getGenome().getNeverSleeps()) { new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconAllDay).addTooltip(I18N.localise("genetics.gui.analyst.biology.bee.allday")); } else if (bee.getGenome().getPrimary().isNocturnal()) { @@ -55,7 +55,7 @@ public class AnalystPageBiology extends ControlAnalystPage { } y += 30; } else if (ind instanceof IButterfly) { - final IButterfly moth = (IButterfly) ind; + IButterfly moth = (IButterfly) ind; if (moth.getGenome().getNocturnal()) { new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconAllDay).addTooltip("Active all day and night"); } else if (moth.getGenome().getPrimary().isNocturnal()) { @@ -75,92 +75,92 @@ public class AnalystPageBiology extends ControlAnalystPage { } y += 30; } else if (ind instanceof ITree) { - new ControlTextCentered(this, y, "§oSappiness: " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS))).setColour(this.getColour()); + new ControlTextCentered(this, y, "§oSappiness: " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS))).setColor(getColor()); y += 20; } else { y += 10; } if (ind instanceof IBee) { - final IBee bee = (IBee) ind; - final int fertility = bee.getGenome().getFertility(); - new ControlTextCentered(this, y, "§l" + fertility + "§r drone" + ((fertility > 1) ? "s" : "") + " per hive").setColour(this.getColour()); + IBee bee = (IBee) ind; + int fertility = bee.getGenome().getFertility(); + new ControlTextCentered(this, y, "§l" + fertility + "§r drone" + ((fertility > 1) ? "s" : "") + " per hive").setColor(getColor()); y += 22; - final int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle; - new ControlTextCentered(this, y, "Average Lifespan").setColour(this.getColour()); + int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle; + new ControlTextCentered(this, y, "Average Lifespan").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§l" + this.getMCDayString(lifespan * (bee.getGenome().getNeverSleeps() ? 1.0f : 2.0f))).setColour(this.getColour()); + new ControlTextCentered(this, y, "§l" + getMCDayString(lifespan * (bee.getGenome().getNeverSleeps() ? 1.0f : 2.0f))).setColor(getColor()); y += 22; } if (ind instanceof IButterfly) { - final IButterfly bee2 = (IButterfly) ind; - final int fertility = bee2.getGenome().getFertility(); - new ControlTextCentered(this, y, "Lays §l" + fertility + "§r caterpillar" + ((fertility > 1) ? "s" : "") + " before dying").setColour(this.getColour()); + IButterfly bee2 = (IButterfly) ind; + int fertility = bee2.getGenome().getFertility(); + new ControlTextCentered(this, y, "Lays §l" + fertility + "§r caterpillar" + ((fertility > 1) ? "s" : "") + " before dying").setColor(getColor()); y += 32; - final float caterpillarMatureTime = 1365.3999f * Math.round(bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2)); - new ControlTextCentered(this, y, "Caterpillar Gestation").setColour(this.getColour()); + float caterpillarMatureTime = 1365.3999f * Math.round(bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2)); + new ControlTextCentered(this, y, "Caterpillar Gestation").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§l" + this.getMCDayString(caterpillarMatureTime)).setColour(this.getColour()); + new ControlTextCentered(this, y, "§l" + getMCDayString(caterpillarMatureTime)).setColor(getColor()); y += 22; - final int speed = (int) (20.0f * bee2.getGenome().getSpeed()); - new ControlTextCentered(this, y, "Flight Speed").setColour(this.getColour()); + int speed = (int) (20.0f * bee2.getGenome().getSpeed()); + new ControlTextCentered(this, y, "Flight Speed").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§l" + speed + "§r blocks per second").setColour(this.getColour()); + new ControlTextCentered(this, y, "§l" + speed + "§r blocks per second").setColor(getColor()); y += 22; } if (ind instanceof ITree) { - final ITree tree = (ITree) ind; - final int fertility = (int) (1.0f / tree.getGenome().getFertility()); - new ControlTextCentered(this, y, "1 Sapling per §l" + fertility + "§r leave" + ((fertility > 1) ? "s" : "")).setColour(this.getColour()); + ITree tree = (ITree) ind; + int fertility = (int) (1.0f / tree.getGenome().getFertility()); + new ControlTextCentered(this, y, "1 Sapling per §l" + fertility + "§r leave" + ((fertility > 1) ? "s" : "")).setColor(getColor()); y += 22; - final int butterflySpawn = Math.round(1365.3999f / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f)); - new ControlTextCentered(this, y, "Butterfies spawn every\n" + this.getTimeString(butterflySpawn) + " per leaf").setColour(this.getColour()); + int butterflySpawn = Math.round(1365.3999f / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f)); + new ControlTextCentered(this, y, "Butterfies spawn every\n" + getTimeString(butterflySpawn) + " per leaf").setColor(getColor()); y += 34; - new ControlTextCentered(this, y, "Plant Type").setColour(this.getColour()); + new ControlTextCentered(this, y, "Plant Type").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§o" + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH)).setColour(this.getColour()); + new ControlTextCentered(this, y, "§o" + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH)).setColor(getColor()); } if (ind instanceof IFlower) { - final IFlower flower = (IFlower) ind; - final int butterflySpawn2 = Math.round(1365.3999f / (flower.getGenome().getSappiness() * 0.2f)); - new ControlTextCentered(this, y, "Butterfies spawn every\n" + this.getTimeString(butterflySpawn2)).setColour(this.getColour()); + IFlower flower = (IFlower) ind; + int butterflySpawn2 = Math.round(1365.3999f / (flower.getGenome().getSappiness() * 0.2f)); + new ControlTextCentered(this, y, "Butterfies spawn every\n" + getTimeString(butterflySpawn2)).setColor(getColor()); y += 30; float CHANCE_DISPERSAL = 0.8f; CHANCE_DISPERSAL += 0.2f * flower.getGenome().getFertility(); float CHANCE_POLLINATE = 0.6f; CHANCE_POLLINATE += 0.25f * flower.getGenome().getFertility(); - final float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE; + float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE; if (CHANCE_DISPERSAL > 1.0f) { CHANCE_DISPERSAL = 1.0f; } if (CHANCE_POLLINATE > 1.0f) { CHANCE_POLLINATE = 1.0f; } - final float dispersalTime = 1365.3999f / CHANCE_DISPERSAL; - final float pollinateTime = 1365.3999f / CHANCE_POLLINATE; - final float lifespan2 = flower.getMaxAge() * 20.0f * 68.27f / flower.getGenome().getAgeChance(); + float dispersalTime = 1365.3999f / CHANCE_DISPERSAL; + float pollinateTime = 1365.3999f / CHANCE_POLLINATE; + float lifespan2 = flower.getMaxAge() * 20.0f * 68.27f / flower.getGenome().getAgeChance(); float floweringLifespan = (flower.getMaxAge() - 1) * 20.0f * 68.27f / flower.getGenome().getAgeChance(); floweringLifespan -= 1365.3999f; - new ControlTextCentered(this, y, "Average Lifespan").setColour(this.getColour()); + new ControlTextCentered(this, y, "Average Lifespan").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§l" + this.getMCDayString(lifespan2)).setColour(this.getColour()); + new ControlTextCentered(this, y, "§l" + getMCDayString(lifespan2)).setColor(getColor()); y += 22; - new ControlTextCentered(this, y, "Seed Dispersal").setColour(this.getColour()); + new ControlTextCentered(this, y, "Seed Dispersal").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / dispersalTime) + " per lifetime").setColour(this.getColour()); + new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / dispersalTime) + " per lifetime").setColor(getColor()); y += 22; - new ControlTextCentered(this, y, "Pollination").setColour(this.getColour()); + new ControlTextCentered(this, y, "Pollination").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / pollinateTime) + " per lifetime").setColour(this.getColour()); + new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / pollinateTime) + " per lifetime").setColor(getColor()); y += 22; } - this.setSize(new Point(this.width(), y)); + setSize(new Point(width(), y)); } - private String getMCDayString(final float time) { - final float seconds = time / 20.0f; - final float minutes = seconds / 60.0f; - final float days = minutes / 20.0f; - final DecimalFormat df = new DecimalFormat("#.0"); + private String getMCDayString(float time) { + float seconds = time / 20.0f; + float minutes = seconds / 60.0f; + float days = minutes / 20.0f; + DecimalFormat df = new DecimalFormat("#.0"); return df.format(days) + " MC days"; } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java b/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java index 50aada3d..b409c6f4 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java @@ -36,29 +36,29 @@ public class AnalystPageDatabase extends ControlAnalystPage { private final ControlScrollableContent scroll; boolean isMaster; - public AnalystPageDatabase(final IWidget parent, final Area area, final BreedingSystem system, final boolean isMaster) { + public AnalystPageDatabase(IWidget parent, Area area, BreedingSystem system, boolean isMaster) { super(parent, area); this.isMaster = isMaster; - final int cOfSystem = system.getColour(); - final int cr = (0xFF0000 & cOfSystem) >> 16; - final int cg = (0xFF00 & cOfSystem) >> 8; - final int cb = 0xFF & cOfSystem; + int cOfSystem = system.getColour(); + int cr = (0xFF0000 & cOfSystem) >> 16; + int cg = (0xFF00 & cOfSystem) >> 8; + int cb = 0xFF & cOfSystem; float brightness = 0.1f * cb / 255.0f + 0.35f * cr / 255.0f + 0.55f * cg / 255.0f; brightness = 0.3f / brightness; if (brightness > 1.0f) { brightness = 1.0f; } - final int newColour = (int) (cr * brightness) * 65536 + (int) (cg * brightness) * 256 + (int) (cb * brightness); - this.setColour(newColour); + int newColour = (int) (cr * brightness) * 65536 + (int) (cg * brightness) * 256 + (int) (cb * brightness); + setColor(newColour); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlTextEdit(this, 20, y, this.width() - 40, 16) { + new ControlTextEdit(this, 20, y, width() - 40, 16) { @Override - public void onTextEdit(final String value) { - final Collection options = new ArrayList<>(); - AnalystPageDatabase.this.getSpecies(system); - for (final IAlleleSpecies species : AnalystPageDatabase.this.getSpecies(system)) { + public void onTextEdit(String value) { + Collection options = new ArrayList<>(); + getSpecies(system); + for (IAlleleSpecies species : getSpecies(system)) { if (value != null) { if (!Objects.equals(value, "")) { if (!species.getName().toLowerCase().contains(value.toLowerCase())) { @@ -68,87 +68,87 @@ public class AnalystPageDatabase extends ControlAnalystPage { } options.add(species); } - AnalystPageDatabase.this.scroll.deleteAllChildren(); - AnalystPageDatabase.this.scroll.setScrollableContent(AnalystPageDatabase.this.getItemScrollList(system, options)); + scroll.deleteAllChildren(); + scroll.setScrollableContent(getItemScrollList(system, options)); } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { RenderUtil.setColour(5592405); - CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().inset(1)); - RenderUtil.setColour(AnalystPageDatabase.this.getColour()); - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea()); - super.renderTextField(); + CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1)); + RenderUtil.setColour(AnalystPageDatabase.this.getColor()); + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea()); + renderTextField(); } }; y += 22; - new Panel(this, 3, y - 1, this.width() - 6, this.height() - y - 8 + 2, MinecraftGUI.PanelType.TabOutline).setColour(this.getColour()); - final boolean textView = false; - final Collection options = this.getSpecies(system); - for (final IAlleleSpecies species : options) { - final String height = system.getAlleleName(EnumTreeChromosome.HEIGHT, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT)); - final String fertility = system.getAlleleName(EnumTreeChromosome.FERTILITY, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.FERTILITY)); - final String yield = system.getAlleleName(EnumTreeChromosome.YIELD, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.YIELD)); - final String sappiness = system.getAlleleName(EnumTreeChromosome.SAPPINESS, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS)); - final String maturation = system.getAlleleName(EnumTreeChromosome.MATURATION, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.MATURATION)); + new Panel(this, 3, y - 1, width() - 6, height() - y - 8 + 2, MinecraftGUI.PanelType.TabOutline).setColor(getColor()); + boolean textView = false; + Collection options = getSpecies(system); + for (IAlleleSpecies species : options) { + String height = system.getAlleleName(EnumTreeChromosome.HEIGHT, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT)); + String fertility = system.getAlleleName(EnumTreeChromosome.FERTILITY, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.FERTILITY)); + String yield = system.getAlleleName(EnumTreeChromosome.YIELD, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.YIELD)); + String sappiness = system.getAlleleName(EnumTreeChromosome.SAPPINESS, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS)); + String maturation = system.getAlleleName(EnumTreeChromosome.MATURATION, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.MATURATION)); } if (textView) { - this.scroll = new ControlListBox(this, 4, y, this.width() - 8, this.height() - y - 8 - 20, 0) { + scroll = new ControlListBox(this, 4, y, width() - 8, height() - y - 8 - 20, 0) { @Override public void initialise() { super.initialise(); - this.setOptions(options); + setOptions(options); } @Override - public IWidget createOption(final IAlleleSpecies v, final int y) { - return new Control(this.getContent(), 0, y, this.width(), 12) { + public IWidget createOption(IAlleleSpecies v, int y) { + return new Control(getContent(), 0, y, width(), 12) { IAlleleSpecies value = v; @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawText(this.getArea(), TextJustification.MIDDLE_CENTER, this.value.getName(), 16777215); + RenderUtil.drawText(getArea(), TextJustification.MIDDLE_CENTER, value.getName(), 16777215); } }; } }; } else { - this.scroll = new ControlScrollableContent(this, 4, y, this.width() - 8, this.height() - y - 8, 0); - this.scroll.setScrollableContent(this.getItemScrollList(system, options)); + scroll = new ControlScrollableContent(this, 4, y, width() - 8, height() - y - 8, 0); + scroll.setScrollableContent(getItemScrollList(system, options)); } - new ControlScrollBar(this, this.scroll.xPos() + this.scroll.width() - 6, this.scroll.yPos() + 3, 3, this.scroll.height() - 6, this.scroll) { + new ControlScrollBar(this, scroll.xPos() + scroll.width() - 6, scroll.yPos() + 3, 3, scroll.height() - 6, scroll) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (!this.isEnabled()) { + if (!isEnabled()) { return; } - RenderUtil.drawGradientRect(this.getArea(), 1140850688 + AnalystPageDatabase.this.getColour(), 1140850688 + AnalystPageDatabase.this.getColour()); - RenderUtil.drawSolidRect(this.getRenderArea(), AnalystPageDatabase.this.getColour()); + RenderUtil.drawGradientRect(getArea(), 1140850688 + AnalystPageDatabase.this.getColor(), 1140850688 + AnalystPageDatabase.this.getColor()); + RenderUtil.drawSolidRect(getRenderArea(), AnalystPageDatabase.this.getColor()); } }; } - private IWidget getItemScrollList(final BreedingSystem system, final Collection options) { - return new Control(this.scroll, 0, 0, this.scroll.width(), this.scroll.height()) { + private IWidget getItemScrollList(BreedingSystem system, Collection options) { + return new Control(scroll, 0, 0, scroll.width(), scroll.height()) { @Override public void initialise() { - final int maxBiomePerLine = (this.width() - 4 + 2) / 18; - final int biomeListX = -6 + (this.width() - (maxBiomePerLine * 18 - 2)) / 2; + int maxBiomePerLine = (width() - 4 + 2) / 18; + int biomeListX = -6 + (width() - (maxBiomePerLine * 18 - 2)) / 2; int dx = 0; int dy = 0; - for (final IAlleleSpecies species : options) { - final IIndividual ind = system.getSpeciesRoot().templateAsIndividual(system.getSpeciesRoot().getTemplate(species)); + for (IAlleleSpecies species : options) { + IIndividual ind = system.getSpeciesRoot().templateAsIndividual(system.getSpeciesRoot().getTemplate(species)); new ControlIndividualDisplay(this, biomeListX + dx, 2 + dy, ind) { @Override public void initialise() { - this.addSelfEventHandler(new EventMouse.Down.Handler() { + addSelfEventHandler(new EventMouse.Down.Handler() { @Override @SideOnly(Side.CLIENT) - public void onEvent(final EventMouse.Down event) { - final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent(); + public void onEvent(EventMouse.Down event) { + WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent(); window.setIndividual(ind); } }); @@ -157,15 +157,15 @@ public class AnalystPageDatabase extends ControlAnalystPage { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent(); + WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent(); if (window.getIndividual() != null && window.getIndividual().getGenome().getPrimary() == species) { RenderUtil.setColour(15658734); - CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().outset(1)); - RenderUtil.setColour(AnalystPageDatabase.this.getColour()); - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea().outset(1)); - } else if (this.calculateIsMouseOver()) { + CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(1)); + RenderUtil.setColour(AnalystPageDatabase.this.getColor()); + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().outset(1)); + } else if (calculateIsMouseOver()) { RenderUtil.setColour(15658734); - CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().outset(1)); + CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(1)); } super.onRenderBackground(guiWidth, guiHeight); } @@ -176,7 +176,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { dy += 18; } } - this.setSize(new Point(this.width(), 4 + dy + 18)); + setSize(new Point(width(), 4 + dy + 18)); } }; } @@ -186,9 +186,9 @@ public class AnalystPageDatabase extends ControlAnalystPage { return I18N.localise("genetics.gui.analyst.registry.title"); } - private Collection getSpecies(final BreedingSystem system) { - final Collection species = new ArrayList<>(); - species.addAll(this.isMaster ? system.getAllSpecies() : system.getDiscoveredSpecies(this.getWindow().getWorld(), this.getWindow().getPlayer().getGameProfile())); + private Collection getSpecies(BreedingSystem system) { + Collection species = new ArrayList<>(); + species.addAll(isMaster ? system.getAllSpecies() : system.getDiscoveredSpecies(getWindow().getWorld(), getWindow().getPlayer().getGameProfile())); return species; } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageDescription.java b/src/main/java/binnie/genetics/gui/AnalystPageDescription.java index b53e1a08..176b41bd 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageDescription.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageDescription.java @@ -21,20 +21,20 @@ import binnie.core.util.I18N; @SideOnly(Side.CLIENT) public class AnalystPageDescription extends ControlAnalystPage { - public AnalystPageDescription(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageDescription(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(3355443); + setColor(3355443); int y = 4; - final IAlleleSpecies species = ind.getGenome().getPrimary(); - final String branchBinomial = species.getBranch().getScientific(); - final String branchName = species.getBranch().getName(); - final String desc = species.getDescription(); + IAlleleSpecies species = ind.getGenome().getPrimary(); + String branchBinomial = species.getBranch().getScientific(); + String branchName = species.getBranch().getName(); + String desc = species.getDescription(); StringBuilder descBody = new StringBuilder(TextFormatting.ITALIC.toString()); String descSig = ""; if (Objects.equals(desc, "") || desc.contains("for.description")) { descBody.append(""); } else { - final String[] descStrings = desc.split("\\|"); + String[] descStrings = desc.split("\\|"); descBody.append(descStrings[0]); for (int i = 1; i < descStrings.length - 1; ++i) { descBody.append(" ").append(descStrings[i]); @@ -53,24 +53,24 @@ public class AnalystPageDescription extends ControlAnalystPage { if (authority.contains("MysteriousAges")) { authority = TextFormatting.DARK_PURPLE.toString() + TextFormatting.BOLD + authority; } - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlTextCentered(this, y, species.getName() + TextFormatting.RESET).setColour(this.getColour()); + new ControlTextCentered(this, y, species.getName() + TextFormatting.RESET).setColor(getColor()); y += 10; - new ControlTextCentered(this, y, TextFormatting.ITALIC + branchBinomial + " " + species.getBinomial() + TextFormatting.RESET).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + branchBinomial + " " + species.getBinomial() + TextFormatting.RESET).setColor(getColor()); y += 20; String discovered = I18N.localise("genetics.gui.analyst.desc.discovered") + " " + TextFormatting.BOLD + authority + TextFormatting.RESET; - new ControlTextCentered(this, y, discovered).setColour(this.getColour()); - y += (int) (3.0f + CraftGUI.render.textHeight(discovered, this.width())); - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.desc.complexity") + ": " + species.getComplexity()).setColour(this.getColour()); + new ControlTextCentered(this, y, discovered).setColor(getColor()); + y += (int) (3.0f + CraftGUI.render.textHeight(discovered, width())); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.desc.complexity") + ": " + species.getComplexity()).setColor(getColor()); y += 26; - final ControlText descText = new ControlText(this, new Area(8, y, this.width() - 16, 0), descBody + "§r", TextJustification.TOP_CENTER); - final IWidget signatureText = new ControlText(this, new Area(8, y, this.width() - 16, 0), descSig + "§r", TextJustification.BOTTOM_RIGHT); - descText.setColour(this.getColour()); - signatureText.setColour(this.getColour()); - final int descHeight = CraftGUI.render.textHeight(descText.getValue(), descText.getSize().x()); + ControlText descText = new ControlText(this, new Area(8, y, width() - 16, 0), descBody + "§r", TextJustification.TOP_CENTER); + IWidget signatureText = new ControlText(this, new Area(8, y, width() - 16, 0), descSig + "§r", TextJustification.BOTTOM_RIGHT); + descText.setColor(getColor()); + signatureText.setColor(getColor()); + int descHeight = CraftGUI.render.textHeight(descText.getValue(), descText.getSize().x()); signatureText.setPosition(new Point(signatureText.pos().x(), descText.getPosition().y() + descHeight + 10)); - this.setSize(new Point(this.width(), 20 + signatureText.yPos())); + setSize(new Point(width(), 20 + signatureText.yPos())); } @Override diff --git a/src/main/java/binnie/genetics/gui/AnalystPageGenome.java b/src/main/java/binnie/genetics/gui/AnalystPageGenome.java index af72022b..179a319f 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageGenome.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageGenome.java @@ -28,16 +28,16 @@ import binnie.core.util.I18N; public class AnalystPageGenome extends ControlAnalystPage { boolean active; - public AnalystPageGenome(final IWidget parent, final Area area, final boolean active, final IIndividual ind) { + public AnalystPageGenome(IWidget parent, Area area, boolean active, IIndividual ind) { super(parent, area); this.active = active; - this.setColour(26265); + setColor(26265); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + this.getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind); - final BreedingSystem system = Binnie.GENETICS.getSystem(root); - final Control scaled = new Control(this, 0, y, 0, 0) { + ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind); + BreedingSystem system = Binnie.GENETICS.getSystem(root); + Control scaled = new Control(this, 0, y, 0, 0) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { @@ -52,19 +52,19 @@ public class AnalystPageGenome extends ControlAnalystPage { GlStateManager.popMatrix(); } }; - for (final IChromosomeType chromo : system.getActiveKaryotype()) { - final IAllele allele = active ? ind.getGenome().getActiveAllele(chromo) : ind.getGenome().getInactiveAllele(chromo); - final String alleleName = system.getAlleleName(chromo, allele); - final int height = CraftGUI.render.textHeight(alleleName, this.width() / 2 - 2); - new ControlText(scaled, new Area(0, y + (height - 9) / 2, this.width() / 2 - 2, 0), system.getChromosomeShortName(chromo) + " :", TextJustification.TOP_RIGHT).setColour(this.getColour()); - new ControlText(scaled, new Area(this.width() / 2 + 2, y, this.width() / 2 - 2, 0), alleleName, TextJustification.TOP_LEFT).setColour(this.getColour()); + for (IChromosomeType chromo : system.getActiveKaryotype()) { + IAllele allele = active ? ind.getGenome().getActiveAllele(chromo) : ind.getGenome().getInactiveAllele(chromo); + String alleleName = system.getAlleleName(chromo, allele); + int height = CraftGUI.render.textHeight(alleleName, width() / 2 - 2); + new ControlText(scaled, new Area(0, y + (height - 9) / 2, width() / 2 - 2, 0), system.getChromosomeShortName(chromo) + " :", TextJustification.TOP_RIGHT).setColor(getColor()); + new ControlText(scaled, new Area(width() / 2 + 2, y, width() / 2 - 2, 0), alleleName, TextJustification.TOP_LEFT).setColor(getColor()); y += 3 + height; } - this.setSize(new Point(this.width(), y + 8)); + setSize(new Point(width(), y + 8)); } @Override public String getTitle() { - return I18N.localise("genetics.gui.analyst.genome." + (this.active ? "active" : "inactive")) + " " + I18N.localise("genetics.gui.analyst.genome.title"); + return I18N.localise("genetics.gui.analyst.genome." + (active ? "active" : "inactive")) + " " + I18N.localise("genetics.gui.analyst.genome.title"); } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java b/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java index edc723cc..b3299422 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java @@ -15,21 +15,21 @@ import binnie.core.genetics.BreedingSystem; import binnie.core.util.I18N; public class AnalystPageKaryogram extends ControlAnalystPage { - public AnalystPageKaryogram(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageKaryogram(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(10040319); + setColor(10040319); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; y += 8; - final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind); - final BreedingSystem system = Binnie.GENETICS.getSystem(root); - final int maxBiomePerLine = (int) ((this.width() + 4.0f - 16.0f) / 22.0f); - int karygramX = (this.width() - (Math.min(maxBiomePerLine, system.getActiveKaryotype().size()) * 18 - 4)) / 2; + ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind); + BreedingSystem system = Binnie.GENETICS.getSystem(root); + int maxBiomePerLine = (int) ((width() + 4.0f - 16.0f) / 22.0f); + int karygramX = (width() - (Math.min(maxBiomePerLine, system.getActiveKaryotype().size()) * 18 - 4)) / 2; int dx = 0; int dy = 0; int rem = system.getActiveKaryotype().size(); - for (final IChromosomeType type : system.getActiveKaryotype()) { + for (IChromosomeType type : system.getActiveKaryotype()) { new ControlAnalystChromosome(this, karygramX + dx, y + dy, root, type, ind.getGenome().getActiveAllele(type), ind.getGenome().getInactiveAllele(type)); dx += 22; if (dx >= 22 * maxBiomePerLine - 22) { diff --git a/src/main/java/binnie/genetics/gui/AnalystPageMutations.java b/src/main/java/binnie/genetics/gui/AnalystPageMutations.java index fb5c43ef..2bc410de 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageMutations.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageMutations.java @@ -37,17 +37,17 @@ import binnie.core.util.I18N; import binnie.genetics.item.ModuleItems; public class AnalystPageMutations extends ControlAnalystPage { - public AnalystPageMutations(final IWidget parent, final Area area, final IIndividual ind, final boolean isMaster) { + public AnalystPageMutations(IWidget parent, Area area, IIndividual ind, boolean isMaster) { super(parent, area); - this.setColour(3355392); + setColor(3355392); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 18; - final BreedingSystem system = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); - final List discovered = system.getDiscoveredMutations(Window.get(this).getWorld(), Window.get(this).getUsername()); - final IAlleleSpecies speciesCurrent = ind.getGenome().getPrimary(); - final Collection resultant = system.getResultantMutations(speciesCurrent); - final Collection further = system.getFurtherMutations(speciesCurrent); + BreedingSystem system = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); + List discovered = system.getDiscoveredMutations(Window.get(this).getWorld(), Window.get(this).getUsername()); + IAlleleSpecies speciesCurrent = ind.getGenome().getPrimary(); + Collection resultant = system.getResultantMutations(speciesCurrent); + Collection further = system.getFurtherMutations(speciesCurrent); if (ind instanceof IBee) { ItemStack hive = null; if (ExtraBeesIntegration.isLoaded()) { @@ -86,19 +86,19 @@ public class AnalystPageMutations extends ControlAnalystPage { hive = new ItemStack(Blocks.CHEST); } if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Valiant.getAllele()) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColor(getColor()); y += 10; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.bee.hive")).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.bee.hive")).setColor(getColor()); y += 22; } else if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Monastic.getAllele()) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColor(getColor()); y += 10; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.bee.villager")).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.bee.villager")).setColor(getColor()); y += 22; } else if (hive != null) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColor(getColor()); y += 10; - final ControlItemDisplay display = new ControlItemDisplay(this, (this.width() - 16) / 2, y); + ControlItemDisplay display = new ControlItemDisplay(this, (width() - 16) / 2, y); if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Steadfast.getAllele()) { display.addTooltip(I18N.localise("genetics.gui.analyst.mutations.bee.dungeon")); } else { @@ -108,33 +108,33 @@ public class AnalystPageMutations extends ControlAnalystPage { y += 24; } } - int ox = (this.width() - 88 - 8) / 2; + int ox = (width() - 88 - 8) / 2; int dx = 0; if (!resultant.isEmpty()) { if (resultant.size() == 1) { - ox = (this.width() - 44) / 2; + ox = (width() - 44) / 2; } - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.resultant")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.resultant")).setColor(getColor()); y += 10; - for (final IMutation mutation : resultant) { - final float specificChance = this.getSpecificChance(ind, mutation, system); - if (!isMaster && !this.isKnown(system, mutation)) { + for (IMutation mutation : resultant) { + float specificChance = getSpecificChance(ind, mutation, system); + if (!isMaster && !isKnown(system, mutation)) { new ControlUnknownMutation(this, ox + dx, y, 44, 16); } else { new Control(this, ox + dx, y, 44, 16) { @Override public void initialise() { - final IAlleleSpecies species0 = mutation.getAllele0(); - final IAlleleSpecies species2 = mutation.getAllele1(); - final String comb = species0.getName() + " + " + species2.getName(); - this.addTooltip(comb); + IAlleleSpecies species0 = mutation.getAllele0(); + IAlleleSpecies species2 = mutation.getAllele1(); + String comb = species0.getName() + " + " + species2.getName(); + addTooltip(comb); String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% " + I18N.localise("genetics.gui.analyst.mutations.chance"); if (specificChance != mutation.getBaseChance()) { chance = chance + getMutationColour(specificChance).getCode() + " (" + (int) specificChance + "% " + I18N.localise("genetics.gui.analyst.mutations.currently") + ")"; } - this.addTooltip(chance); - for (final String s : mutation.getSpecialConditions()) { - this.addTooltip(s); + addTooltip(chance); + for (String s : mutation.getSpecialConditions()) { + addTooltip(s); } } @@ -165,35 +165,35 @@ public class AnalystPageMutations extends ControlAnalystPage { } y += 10; } - ox = (this.width() - 88 - 8) / 2; + ox = (width() - 88 - 8) / 2; dx = 0; if (!further.isEmpty()) { if (further.size() == 1) { - ox = (this.width() - 44) / 2; + ox = (width() - 44) / 2; } - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.further")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.further")).setColor(getColor()); y += 10; - for (final IMutation mutation : further) { - final IAllele speciesComb = mutation.getPartner(speciesCurrent); - final float specificChance2 = this.getSpecificChance(ind, mutation, system); - if (!isMaster && !this.isKnown(system, mutation)) { + for (IMutation mutation : further) { + IAllele speciesComb = mutation.getPartner(speciesCurrent); + float specificChance2 = getSpecificChance(ind, mutation, system); + if (!isMaster && !isKnown(system, mutation)) { new ControlUnknownMutation(this, ox + dx, y, 44, 16); } else { new Control(this, ox + dx, y, 44, 16) { @Override public void initialise() { - final IAlleleSpecies species0 = (IAlleleSpecies) speciesComb; - final IAlleleSpecies species2 = (IAlleleSpecies) mutation.getTemplate()[0]; - this.addTooltip(species2.getName()); - final String comb = speciesCurrent.getName() + " + " + species0.getName(); - this.addTooltip(comb); + IAlleleSpecies species0 = (IAlleleSpecies) speciesComb; + IAlleleSpecies species2 = (IAlleleSpecies) mutation.getTemplate()[0]; + addTooltip(species2.getName()); + String comb = speciesCurrent.getName() + " + " + species0.getName(); + addTooltip(comb); String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% " + I18N.localise("genetics.gui.analyst.mutations.chance"); if (specificChance2 != mutation.getBaseChance()) { chance = chance + getMutationColour(specificChance2).getCode() + " (" + (int) specificChance2 + "% " + I18N.localise("genetics.gui.analyst.mutations.currently") + ")"; } - this.addTooltip(chance); - for (final String s : mutation.getSpecialConditions()) { - this.addTooltip(s); + addTooltip(chance); + for (String s : mutation.getSpecialConditions()) { + addTooltip(s); } } @@ -225,7 +225,7 @@ public class AnalystPageMutations extends ControlAnalystPage { } } y += 8; - this.setSize(new Point(this.width(), y)); + setSize(new Point(width(), y)); } @SideOnly(Side.CLIENT) @@ -233,12 +233,12 @@ public class AnalystPageMutations extends ControlAnalystPage { RenderUtil.drawSprite(new Point(14, 0), sprite.getSprite()); } - private boolean isKnown(final BreedingSystem system, final IMutation mutation) { - return system.getDiscoveredMutations(this.getWindow().getWorld(), this.getWindow().getPlayer().getGameProfile()).contains(mutation); + private boolean isKnown(BreedingSystem system, IMutation mutation) { + return system.getDiscoveredMutations(getWindow().getWorld(), getWindow().getPlayer().getGameProfile()).contains(mutation); } - private float getSpecificChance(final IIndividual ind, final IMutation mutation, final BreedingSystem system) { - return system.getChance(mutation, this.getWindow().getPlayer(), mutation.getAllele0(), mutation.getAllele1()); + private float getSpecificChance(IIndividual ind, IMutation mutation, BreedingSystem system) { + return system.getChance(mutation, getWindow().getPlayer(), mutation.getAllele0(), mutation.getAllele1()); } @Override @@ -246,7 +246,7 @@ public class AnalystPageMutations extends ControlAnalystPage { return I18N.localise("genetics.gui.analyst.mutations.title"); } - protected EnumColor getMutationColour(final float percent) { + protected EnumColor getMutationColour(float percent) { if (percent >= 20.0f) { return EnumColor.DarkGreen; } @@ -266,16 +266,16 @@ public class AnalystPageMutations extends ControlAnalystPage { } static class ControlUnknownMutation extends Control { - public ControlUnknownMutation(final IWidget parent, final int x, final int y, final int w, final int h) { + public ControlUnknownMutation(IWidget parent, int x, int y, int w, int h) { super(parent, x, y, w, h); - this.addAttribute(Attribute.MouseOver); - this.addTooltip(I18N.localise("genetics.gui.analyst.mutations.unknown.tooltip")); + addAttribute(Attribute.MouseOver); + addTooltip(I18N.localise("genetics.gui.analyst.mutations.unknown.tooltip")); } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawText(this.getArea(), TextJustification.MIDDLE_CENTER, I18N.localise("genetics.gui.analyst.mutations.unknown"), 11184810); + RenderUtil.drawText(getArea(), TextJustification.MIDDLE_CENTER, I18N.localise("genetics.gui.analyst.mutations.unknown"), 11184810); } } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageProduce.java b/src/main/java/binnie/genetics/gui/AnalystPageProduce.java index 9481d41f..586e8061 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageProduce.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageProduce.java @@ -31,28 +31,28 @@ import binnie.extratrees.machines.fruitpress.FruitPressRecipes; import binnie.genetics.gui.bee.AnalystPageProducts; public abstract class AnalystPageProduce extends ControlAnalystPage { - public AnalystPageProduce(final IWidget parent, final Area area) { + public AnalystPageProduce(IWidget parent, Area area) { super(parent, area); } - protected Collection getAllProducts(final ItemStack key) { - final Collection products = new UniqueItemStackSet(); - products.addAll(this.getCentrifuge(key)); - products.addAll(this.getSqueezer(key)); + protected Collection getAllProducts(ItemStack key) { + Collection products = new UniqueItemStackSet(); + products.addAll(getCentrifuge(key)); + products.addAll(getSqueezer(key)); products.add(FurnaceRecipes.instance().getSmeltingResult(key)); - products.addAll(this.getCrafting(key)); + products.addAll(getCrafting(key)); return products; } - public Collection getCentrifuge(final ItemStack stack) { - final List products = new ArrayList<>(); - for (final ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes()) { + public Collection getCentrifuge(ItemStack stack) { + List products = new ArrayList<>(); + for (ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes()) { boolean isRecipe = false; if (stack.isItemEqual(recipe.getInput())) { isRecipe = true; } if (isRecipe) { - for (final Object obj : recipe.getAllProducts().keySet()) { + for (Object obj : recipe.getAllProducts().keySet()) { if (obj instanceof ItemStack) { products.add((ItemStack) obj); } @@ -62,11 +62,11 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return products; } - public NonNullList getSqueezer(final ItemStack stack) { - final NonNullList products = NonNullList.create(); + public NonNullList getSqueezer(ItemStack stack) { + NonNullList products = NonNullList.create(); for (ISqueezerRecipe recipe : RecipeManagers.squeezerManager.recipes()) { boolean isRecipe = false; - for (final Object obj : recipe.getResources()) { + for (Object obj : recipe.getResources()) { if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) { isRecipe = true; } @@ -80,13 +80,13 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return products; } - public Collection getCrafting(final ItemStack stack) { - final List products = new ArrayList<>(); - for (final Object recipeO : CraftingManager.getInstance().getRecipeList()) { + public Collection getCrafting(ItemStack stack) { + List products = new ArrayList<>(); + for (Object recipeO : CraftingManager.getInstance().getRecipeList()) { if (recipeO instanceof ShapelessRecipes) { - final ShapelessRecipes recipe = (ShapelessRecipes) recipeO; + ShapelessRecipes recipe = (ShapelessRecipes) recipeO; boolean match = true; - for (final Object rec : recipe.recipeItems) { + for (Object rec : recipe.recipeItems) { if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) { match = false; } @@ -96,9 +96,9 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { } } if (recipeO instanceof ShapedRecipes) { - final ShapedRecipes recipe2 = (ShapedRecipes) recipeO; + ShapedRecipes recipe2 = (ShapedRecipes) recipeO; boolean match = true; - for (final Object rec2 : recipe2.recipeItems) { + for (Object rec2 : recipe2.recipeItems) { if (rec2 != null && (!(rec2 instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec2))) { match = false; } @@ -108,9 +108,9 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { } } if (recipeO instanceof ShapelessOreRecipe) { - final ShapelessOreRecipe recipe3 = (ShapelessOreRecipe) recipeO; + ShapelessOreRecipe recipe3 = (ShapelessOreRecipe) recipeO; boolean match = true; - for (final Object rec : recipe3.getInput()) { + for (Object rec : recipe3.getInput()) { if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) { match = false; } @@ -124,20 +124,20 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return products; } - public Collection getAllFluids(final ItemStack stack) { - final List products = new ArrayList<>(); - products.addAll(this.getSqueezerFluid(stack)); + public Collection getAllFluids(ItemStack stack) { + List products = new ArrayList<>(); + products.addAll(getSqueezerFluid(stack)); if (FruitPressRecipes.getOutput(stack) != null) { products.add(FruitPressRecipes.getOutput(stack)); } return products; } - public Collection getSqueezerFluid(final ItemStack stack) { - final List products = new ArrayList<>(); - for (final ISqueezerRecipe recipe : RecipeManagers.squeezerManager.recipes()) { + public Collection getSqueezerFluid(ItemStack stack) { + List products = new ArrayList<>(); + for (ISqueezerRecipe recipe : RecipeManagers.squeezerManager.recipes()) { boolean isRecipe = false; - for (final Object obj : recipe.getResources()) { + for (Object obj : recipe.getResources()) { if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) { isRecipe = true; } @@ -149,8 +149,8 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return products; } - protected Collection getAllProducts(final FluidStack stack) { - final Collection fluids = new UniqueFluidStackSet(); + protected Collection getAllProducts(FluidStack stack) { + Collection fluids = new UniqueFluidStackSet(); fluids.add(BreweryRecipes.getOutput(stack)); fluids.add(DistilleryRecipes.getOutput(stack, 0)); fluids.add(DistilleryRecipes.getOutput(stack, 1)); @@ -158,36 +158,36 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return fluids; } - protected Collection getAllProductsAndFluids(final Collection collection) { - final Collection products = new UniqueItemStackSet(); - for (final ItemStack stack : collection) { - products.addAll(this.getAllProducts(stack)); + protected Collection getAllProductsAndFluids(Collection collection) { + Collection products = new UniqueItemStackSet(); + for (ItemStack stack : collection) { + products.addAll(getAllProducts(stack)); } - final Collection products2 = new UniqueItemStackSet(); - for (final ItemStack stack2 : products) { - products2.addAll(this.getAllProducts(stack2)); + Collection products2 = new UniqueItemStackSet(); + for (ItemStack stack2 : products) { + products2.addAll(getAllProducts(stack2)); } - final Collection products3 = new UniqueItemStackSet(); - for (final ItemStack stack3 : products2) { - products3.addAll(this.getAllProducts(stack3)); + Collection products3 = new UniqueItemStackSet(); + for (ItemStack stack3 : products2) { + products3.addAll(getAllProducts(stack3)); } products.addAll(products2); products.addAll(products3); - final Collection allFluids = new UniqueFluidStackSet(); - for (final ItemStack stack4 : collection) { - allFluids.addAll(this.getAllFluids(stack4)); + Collection allFluids = new UniqueFluidStackSet(); + for (ItemStack stack4 : collection) { + allFluids.addAll(getAllFluids(stack4)); } - final Collection fluids2 = new UniqueFluidStackSet(); - for (final FluidStack stack5 : allFluids) { - fluids2.addAll(this.getAllProducts(stack5)); + Collection fluids2 = new UniqueFluidStackSet(); + for (FluidStack stack5 : allFluids) { + fluids2.addAll(getAllProducts(stack5)); } - final Collection fluids3 = new UniqueFluidStackSet(); - for (final FluidStack stack6 : fluids2) { - fluids3.addAll(this.getAllProducts(stack6)); + Collection fluids3 = new UniqueFluidStackSet(); + for (FluidStack stack6 : fluids2) { + fluids3.addAll(getAllProducts(stack6)); } allFluids.addAll(fluids2); allFluids.addAll(fluids3); - for (final FluidStack fluid : allFluids) { + for (FluidStack fluid : allFluids) { ItemStack container = AnalystPageProducts.getContainer(fluid); if (container != null) { products.add(container); @@ -196,21 +196,21 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return products; } - protected int getRefined(final String string, int y, final Collection products) { - new ControlTextCentered(this, y, string).setColour(this.getColour()); + protected int getRefined(String string, int y, Collection products) { + new ControlTextCentered(this, y, string).setColor(getColor()); y += 10; - final int maxBiomePerLine = (this.width() + 2 - 16) / 18; - final int biomeListX = (this.width() - (Math.min(maxBiomePerLine, products.size()) * 18 - 2)) / 2; + int maxBiomePerLine = (width() + 2 - 16) / 18; + int biomeListX = (width() - (Math.min(maxBiomePerLine, products.size()) * 18 - 2)) / 2; int dx = 0; int dy = 0; - for (final ItemStack soilStack : products) { + for (ItemStack soilStack : products) { if (dx >= 18 * maxBiomePerLine) { dx = 0; dy += 18; } - final FluidStack fluid = FluidUtil.getFluidContained(soilStack); + FluidStack fluid = FluidUtil.getFluidContained(soilStack); soilStack.setCount(1); - final ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy, soilStack, fluid == null); + ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy, soilStack, fluid == null); if (fluid != null) { display.addTooltip(fluid.getLocalizedName()); } diff --git a/src/main/java/binnie/genetics/gui/ControlAnalystChromosome.java b/src/main/java/binnie/genetics/gui/ControlAnalystChromosome.java index 15ebc877..dad0933e 100644 --- a/src/main/java/binnie/genetics/gui/ControlAnalystChromosome.java +++ b/src/main/java/binnie/genetics/gui/ControlAnalystChromosome.java @@ -28,37 +28,37 @@ public class ControlAnalystChromosome extends Control implements ITooltip { Texture Homozygous; Texture Heterozygous; - public ControlAnalystChromosome(final IWidget parent, final int x, final int y, final ISpeciesRoot root, final IChromosomeType type, final IAllele allele0, final IAllele allele1) { + public ControlAnalystChromosome(IWidget parent, int x, int y, ISpeciesRoot root, IChromosomeType type, IAllele allele0, IAllele allele1) { super(parent, x, y, 16, 22); - this.Homozygous = new StandardTexture(0, 0, 16, 22, BinnieCoreTexture.GUIAnalyst); - this.Heterozygous = new StandardTexture(16, 0, 16, 22, BinnieCoreTexture.GUIAnalyst); - this.addAttribute(Attribute.MouseOver); + Homozygous = new StandardTexture(0, 0, 16, 22, BinnieCoreTexture.GUIAnalyst); + Heterozygous = new StandardTexture(16, 0, 16, 22, BinnieCoreTexture.GUIAnalyst); + addAttribute(Attribute.MouseOver); this.root = root; - this.chromosomeType = type; + chromosomeType = type; this.allele0 = allele0; this.allele1 = allele1; } public boolean isHomozygous() { - return this.allele0.getUID().equals(this.allele1.getUID()); + return allele0.getUID().equals(allele1.getUID()); } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { super.onRenderBackground(guiWidth, guiHeight); - CraftGUI.render.texture(this.isHomozygous() ? this.Homozygous : this.Heterozygous, Point.ZERO); + CraftGUI.render.texture(isHomozygous() ? Homozygous : Heterozygous, Point.ZERO); } @Override - public void getTooltip(final Tooltip tooltip) { - final BreedingSystem system = Binnie.GENETICS.getSystem(this.root); - tooltip.add(system.getChromosomeName(this.chromosomeType)); - if (this.isHomozygous()) { - tooltip.add(system.getAlleleName(this.chromosomeType, this.allele0)); + public void getTooltip(Tooltip tooltip) { + BreedingSystem system = Binnie.GENETICS.getSystem(root); + tooltip.add(system.getChromosomeName(chromosomeType)); + if (isHomozygous()) { + tooltip.add(system.getAlleleName(chromosomeType, allele0)); } else { - tooltip.add("Active: " + system.getAlleleName(this.chromosomeType, this.allele0)); - tooltip.add("Inactive: " + system.getAlleleName(this.chromosomeType, this.allele1)); + tooltip.add("Active: " + system.getAlleleName(chromosomeType, allele0)); + tooltip.add("Inactive: " + system.getAlleleName(chromosomeType, allele1)); } } } diff --git a/src/main/java/binnie/genetics/gui/ControlAnalystPage.java b/src/main/java/binnie/genetics/gui/ControlAnalystPage.java index 41e233b1..a32b6dbf 100644 --- a/src/main/java/binnie/genetics/gui/ControlAnalystPage.java +++ b/src/main/java/binnie/genetics/gui/ControlAnalystPage.java @@ -7,9 +7,9 @@ import binnie.core.craftgui.controls.core.Control; import binnie.core.craftgui.geometry.Area; public abstract class ControlAnalystPage extends Control { - public ControlAnalystPage(final IWidget parent, final Area area) { + public ControlAnalystPage(IWidget parent, Area area) { super(parent, area); - this.hide(); + hide(); } @Override @@ -18,11 +18,11 @@ public abstract class ControlAnalystPage extends Control { public abstract String getTitle(); - protected String getTimeString(final int time) { - final int seconds = time / 20; - final int minutes = seconds / 60; - final int hours = minutes / 60; - final DecimalFormat df = new DecimalFormat("#.0"); + protected String getTimeString(int time) { + int seconds = time / 20; + int minutes = seconds / 60; + int hours = minutes / 60; + DecimalFormat df = new DecimalFormat("#.0"); if (hours > 1) { return df.format(hours) + " hours"; } diff --git a/src/main/java/binnie/genetics/gui/ControlBiome.java b/src/main/java/binnie/genetics/gui/ControlBiome.java index a9978a2a..1d48472e 100644 --- a/src/main/java/binnie/genetics/gui/ControlBiome.java +++ b/src/main/java/binnie/genetics/gui/ControlBiome.java @@ -21,54 +21,54 @@ public class ControlBiome extends Control implements ITooltip { private final Biome biome; private String iconCategory; - public ControlBiome(final IWidget parent, final int x, final int y, final int w, final int h, final Biome biome) { + public ControlBiome(IWidget parent, int x, int y, int w, int h, Biome biome) { super(parent, x, y, w, h); - this.iconCategory = "plains"; + iconCategory = "plains"; this.biome = biome; } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.MOUNTAIN) || BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.HILLS)) { - this.iconCategory = "hills"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.MOUNTAIN) || BiomeDictionary.hasType(biome, BiomeDictionary.Type.HILLS)) { + iconCategory = "hills"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.SANDY)) { - this.iconCategory = "desert"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY)) { + iconCategory = "desert"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.SNOWY)) { - this.iconCategory = "snow"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.SNOWY)) { + iconCategory = "snow"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.FOREST)) { - this.iconCategory = "forest"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.FOREST)) { + iconCategory = "forest"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.SWAMP)) { - this.iconCategory = "swamp"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.SWAMP)) { + iconCategory = "swamp"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.JUNGLE)) { - this.iconCategory = "jungle"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.JUNGLE)) { + iconCategory = "jungle"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.COLD) && BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.FOREST)) { - this.iconCategory = "taiga"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.COLD) && BiomeDictionary.hasType(biome, BiomeDictionary.Type.FOREST)) { + iconCategory = "taiga"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.MUSHROOM)) { - this.iconCategory = "mushroom"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.MUSHROOM)) { + iconCategory = "mushroom"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.OCEAN)) { - this.iconCategory = "ocean"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.OCEAN)) { + iconCategory = "ocean"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.NETHER)) { - this.iconCategory = "nether"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.NETHER)) { + iconCategory = "nether"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.END)) { - this.iconCategory = "end"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.END)) { + iconCategory = "end"; } - TextureAtlasSprite sprite = ForestryAPI.textureManager.getDefault("habitats/" + this.iconCategory); + TextureAtlasSprite sprite = ForestryAPI.textureManager.getDefault("habitats/" + iconCategory); RenderUtil.drawGuiSprite(Point.ZERO, sprite); } @Override - public void getTooltip(final Tooltip tooltip) { - tooltip.add(this.biome.getBiomeName().replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2")); + public void getTooltip(Tooltip tooltip) { + tooltip.add(biome.getBiomeName().replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2")); } } diff --git a/src/main/java/binnie/genetics/gui/ControlChromoPicker.java b/src/main/java/binnie/genetics/gui/ControlChromoPicker.java index 23c4d9fb..a5a45729 100644 --- a/src/main/java/binnie/genetics/gui/ControlChromoPicker.java +++ b/src/main/java/binnie/genetics/gui/ControlChromoPicker.java @@ -24,23 +24,23 @@ public class ControlChromoPicker extends Control implements ITooltip { IChromosomeType type; ControlChromosome parent; - public ControlChromoPicker(final ControlChromosome parent, final int x, final int y, final IChromosomeType chromo) { + public ControlChromoPicker(ControlChromosome parent, int x, int y, IChromosomeType chromo) { super(parent, x, y, 16, 16); - this.Selected = new StandardTexture(160, 18, 16, 16, ExtraBeeTexture.GUIPunnett); - this.Texture = new StandardTexture(160, 34, 16, 16, ExtraBeeTexture.GUIPunnett); - this.type = chromo; - this.addAttribute(Attribute.MouseOver); + Selected = new StandardTexture(160, 18, 16, 16, ExtraBeeTexture.GUIPunnett); + Texture = new StandardTexture(160, 34, 16, 16, ExtraBeeTexture.GUIPunnett); + type = chromo; + addAttribute(Attribute.MouseOver); this.parent = parent; - this.addSelfEventHandler(new EventWidget.StartMouseOver.Handler() { + addSelfEventHandler(new EventWidget.StartMouseOver.Handler() { @Override - public void onEvent(final EventWidget.StartMouseOver event) { - ControlChromoPicker.this.callEvent(new EventValueChanged(ControlChromoPicker.this.getWidget(), ControlChromoPicker.this.type)); + public void onEvent(EventWidget.StartMouseOver event) { + callEvent(new EventValueChanged(getWidget(), type)); } }); - this.addSelfEventHandler(new EventWidget.EndMouseOver.Handler() { + addSelfEventHandler(new EventWidget.EndMouseOver.Handler() { @Override - public void onEvent(final EventWidget.EndMouseOver event) { - ControlChromoPicker.this.callEvent(new EventValueChanged<>(ControlChromoPicker.this.getWidget(), null)); + public void onEvent(EventWidget.EndMouseOver event) { + callEvent(new EventValueChanged<>(getWidget(), null)); } }); } @@ -49,13 +49,13 @@ public class ControlChromoPicker extends Control implements ITooltip { @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { super.onRenderBackground(guiWidth, guiHeight); - final boolean selected = this.isMouseOver(); - final Texture text = selected ? this.Selected : this.Texture; + boolean selected = isMouseOver(); + Texture text = selected ? Selected : Texture; CraftGUI.render.texture(text, Point.ZERO); } @Override - public void getTooltip(final Tooltip tooltip) { - tooltip.add(Binnie.GENETICS.getSystem(this.parent.getRoot()).getChromosomeName(this.type)); + public void getTooltip(Tooltip tooltip) { + tooltip.add(Binnie.GENETICS.getSystem(parent.getRoot()).getChromosomeName(type)); } } diff --git a/src/main/java/binnie/genetics/gui/ControlChromosome.java b/src/main/java/binnie/genetics/gui/ControlChromosome.java index 7dd36c50..397a16eb 100644 --- a/src/main/java/binnie/genetics/gui/ControlChromosome.java +++ b/src/main/java/binnie/genetics/gui/ControlChromosome.java @@ -34,25 +34,25 @@ public class ControlChromosome extends Control implements IControlValue { - public ControlGenesisOption(final ControlList parent, final Gene gene, final int y) { + public ControlGenesisOption(ControlList parent, Gene gene, int y) { super(parent, gene, y); } String getAlleleName() { - return this.getValue().getAlleleName(); + return getValue().getAlleleName(); } String getChromosomeName() { - return this.getValue().getShortChromosomeName(); + return getValue().getShortChromosomeName(); } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { super.onRenderBackground(guiWidth, guiHeight); - RenderUtil.drawText(new Area(0, 0, 70, 22), TextJustification.MIDDLE_CENTER, this.getChromosomeName(), this.getColour()); - RenderUtil.drawText(new Area(75, 0, 80, 22), TextJustification.MIDDLE_CENTER, this.getAlleleName(), this.getColour()); - RenderUtil.drawSolidRect(new Area(70, 2, 1, 16), -16777216 + this.getColour()); + RenderUtil.drawText(new Area(0, 0, 70, 22), TextJustification.MIDDLE_CENTER, getChromosomeName(), getColor()); + RenderUtil.drawText(new Area(75, 0, 80, 22), TextJustification.MIDDLE_CENTER, getAlleleName(), getColor()); + RenderUtil.drawSolidRect(new Area(70, 2, 1, 16), -16777216 + getColor()); } } diff --git a/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java b/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java index 94a30fb3..9e92a75b 100644 --- a/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java +++ b/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java @@ -13,24 +13,24 @@ import binnie.core.craftgui.minecraft.control.ControlItemDisplay; import binnie.core.genetics.BreedingSystem; public class ControlIndividualDisplay extends ControlItemDisplay implements ITooltip { - public ControlIndividualDisplay(final IWidget parent, final int x, final int y, final IIndividual ind) { + public ControlIndividualDisplay(IWidget parent, int x, int y, IIndividual ind) { this(parent, x, y, 16, ind); } - public ControlIndividualDisplay(final IWidget parent, final int x, final int y, final int size, final IIndividual ind) { + public ControlIndividualDisplay(IWidget parent, int x, int y, int size, IIndividual ind) { super(parent, x, y, size); - final BreedingSystem system = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); - this.setItemStack(system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType())); - this.setTooltip(); + BreedingSystem system = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); + setItemStack(system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType())); + setTooltip(); } @Override - public void getTooltip(final Tooltip tooltip) { - final ItemStack stack = this.getItemStack(); + public void getTooltip(Tooltip tooltip) { + ItemStack stack = getItemStack(); if (stack.isEmpty()) { return; } - final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack); + IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack); if (ind == null) { return; } diff --git a/src/main/java/binnie/genetics/gui/ControlToleranceBar.java b/src/main/java/binnie/genetics/gui/ControlToleranceBar.java index 934f2c56..3cfbd843 100644 --- a/src/main/java/binnie/genetics/gui/ControlToleranceBar.java +++ b/src/main/java/binnie/genetics/gui/ControlToleranceBar.java @@ -25,57 +25,57 @@ public abstract class ControlToleranceBar> extends Control imp EnumSet fullSet; private Class enumClass; - public ControlToleranceBar(final IWidget parent, final int x, final int y, final int width, final int height, final Class clss) { + public ControlToleranceBar(IWidget parent, int x, int y, int width, int height, Class clss) { super(parent, x, y, width, height); - this.addAttribute(Attribute.MouseOver); - this.enumClass = clss; - this.tolerated = EnumSet.noneOf(this.enumClass); - this.fullSet = EnumSet.allOf(this.enumClass); - if (this.enumClass == EnumTemperature.class) { - this.fullSet.remove(this.enumClass.cast(EnumTemperature.NONE)); + addAttribute(Attribute.MouseOver); + enumClass = clss; + tolerated = EnumSet.noneOf(enumClass); + fullSet = EnumSet.allOf(enumClass); + if (enumClass == EnumTemperature.class) { + fullSet.remove(enumClass.cast(EnumTemperature.NONE)); } } @Override - public void getTooltip(final Tooltip list) { - final int types = this.fullSet.size(); - final int type = this.getRelativeMousePosition().x() / (this.getSize().x() / types); - for (final T tol : this.fullSet) { - if (tol.ordinal() - ((this.enumClass == EnumTemperature.class) ? 1 : 0) == type) { - list.add((this.tolerated.contains(tol) ? "" : TextFormatting.DARK_GRAY) + this.getName(tol)); + public void getTooltip(Tooltip list) { + int types = fullSet.size(); + int type = getRelativeMousePosition().x() / (getSize().x() / types); + for (T tol : fullSet) { + if (tol.ordinal() - ((enumClass == EnumTemperature.class) ? 1 : 0) == type) { + list.add((tolerated.contains(tol) ? "" : TextFormatting.DARK_GRAY) + getName(tol)); } } } - protected abstract String getName(final T p0); + protected abstract String getName(T p0); - protected abstract int getColour(final T p0); + protected abstract int getColour(T p0); @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawGradientRect(this.getArea(), -1431655766, -1431655766); - final int w = this.getArea().width() / this.fullSet.size(); + RenderUtil.drawGradientRect(getArea(), -1431655766, -1431655766); + int w = getArea().width() / fullSet.size(); int t = 0; - for (final T value : this.fullSet) { - final int col = (this.tolerated.contains(value) ? -16777216 : 855638016) + this.getColour(value); - final Border inset = new Border(this.tolerated.contains(value) ? 1 : 3); - RenderUtil.drawGradientRect(new Area(w * t, 0, w, this.height()).inset(inset), col, col); + for (T value : fullSet) { + int col = (tolerated.contains(value) ? -16777216 : 855638016) + getColour(value); + Border inset = new Border(tolerated.contains(value) ? 1 : 3); + RenderUtil.drawGradientRect(new Area(w * t, 0, w, height()).inset(inset), col, col); ++t; } } - public void setValues(final T value, final EnumTolerance enumTol) { - this.tolerated.clear(); - final Tolerance tol = Tolerance.get(enumTol); - for (final T full : this.fullSet) { + public void setValues(T value, EnumTolerance enumTol) { + tolerated.clear(); + Tolerance tol = Tolerance.get(enumTol); + for (T full : fullSet) { if (full.ordinal() > value.ordinal() + tol.getBounds()[1]) { continue; } if (full.ordinal() < value.ordinal() + tol.getBounds()[0]) { continue; } - this.tolerated.add(full); + tolerated.add(full); } } } diff --git a/src/main/java/binnie/genetics/gui/ControlTooltip.java b/src/main/java/binnie/genetics/gui/ControlTooltip.java index 87099cd0..1be24c7f 100644 --- a/src/main/java/binnie/genetics/gui/ControlTooltip.java +++ b/src/main/java/binnie/genetics/gui/ControlTooltip.java @@ -6,11 +6,11 @@ import binnie.core.craftgui.Tooltip; import binnie.core.craftgui.controls.core.Control; public class ControlTooltip extends Control implements ITooltip { - public ControlTooltip(final IWidget parent, final int x, final int y, final int w, final int h) { + public ControlTooltip(IWidget parent, int x, int y, int w, int h) { super(parent, x, y, w, h); } @Override - public void getTooltip(final Tooltip tooltip) { + public void getTooltip(Tooltip tooltip) { } } diff --git a/src/main/java/binnie/genetics/gui/WindowAnalyst.java b/src/main/java/binnie/genetics/gui/WindowAnalyst.java index f3e91825..b121fc32 100644 --- a/src/main/java/binnie/genetics/gui/WindowAnalyst.java +++ b/src/main/java/binnie/genetics/gui/WindowAnalyst.java @@ -83,23 +83,23 @@ public class WindowAnalyst extends Window { private Control analystNone; private ControlSlide slideUpInv; - public WindowAnalyst(final EntityPlayer player, @Nullable final IInventory inventory, final Side side, final boolean database, final boolean master) { + public WindowAnalyst(EntityPlayer player, @Nullable IInventory inventory, Side side, boolean database, boolean master) { super(312, 230, player, inventory, side); - this.baseWidget = null; - this.tabBar = null; - this.analystPages = new ArrayList<>(); - this.analystPageSize = null; - this.isDatabase = false; - this.isMaster = false; - this.lockedSearch = false; - this.current = null; - this.currentSystem = null; - this.isDatabase = database; - this.isMaster = master; - this.lockedSearch = this.isDatabase; + baseWidget = null; + tabBar = null; + analystPages = new ArrayList<>(); + analystPageSize = null; + isDatabase = false; + isMaster = false; + lockedSearch = false; + current = null; + currentSystem = null; + isDatabase = database; + isMaster = master; + lockedSearch = isDatabase; } - public static GeneticsGUI.WindowFactory create(final boolean database, final boolean master) { + public static GeneticsGUI.WindowFactory create(boolean database, boolean master) { return (player, inventory, side) -> new WindowAnalyst(player, inventory, side, database, master); } @@ -114,59 +114,59 @@ public class WindowAnalyst extends Window { } private void setupValidators() { - if (!this.isDatabase) { - this.getWindowInventory().setValidator(0, new SlotValidator.Individual() { + if (!isDatabase) { + getWindowInventory().setValidator(0, new SlotValidator.Individual() { @Override - public boolean isValid(final ItemStack itemStack) { - return Analyser.isAnalysed(itemStack) || (Analyser.isAnalysable(itemStack) && !WindowAnalyst.this.getWindowInventory().getStackInSlot(1).isEmpty()); + public boolean isValid(ItemStack itemStack) { + return Analyser.isAnalysed(itemStack) || (Analyser.isAnalysable(itemStack) && !getWindowInventory().getStackInSlot(1).isEmpty()); } }); - this.getWindowInventory().setValidator(1, new SlotValidator.Item(GeneticsItems.DNADye.get(1), ModuleMachine.spriteDye)); + getWindowInventory().setValidator(1, new SlotValidator.Item(GeneticsItems.DNADye.get(1), ModuleMachine.spriteDye)); } } @Override public void initialiseServer() { - for (final BreedingSystem system : Binnie.GENETICS.getActiveSystems()) { + for (BreedingSystem system : Binnie.GENETICS.getActiveSystems()) { ISpeciesRoot root = system.getSpeciesRoot(); if (root != null) { - final IBreedingTracker tracker = root.getBreedingTracker(this.getWorld(), this.getUsername()); + IBreedingTracker tracker = root.getBreedingTracker(getWorld(), getUsername()); if (tracker != null) { - tracker.synchToPlayer(this.getPlayer()); + tracker.synchToPlayer(getPlayer()); } } } - this.setupValidators(); + setupValidators(); } @Override @SideOnly(Side.CLIENT) public void initialiseClient() { - this.setTitle(this.isDatabase ? (this.isMaster ? "Master Registry" : "Registry") : "Analyst"); - final BreedingSystem system = Binnie.GENETICS.beeBreedingSystem; - final IIndividual ind = system.getDefaultIndividual(); - final ItemStack stack = system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()); - this.getWindowInventory().createSlot(0); - this.baseWidget = new Widget(this); + setTitle(isDatabase ? (isMaster ? "Master Registry" : "Registry") : "Analyst"); + BreedingSystem system = Binnie.GENETICS.beeBreedingSystem; + IIndividual ind = system.getDefaultIndividual(); + ItemStack stack = system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()); + getWindowInventory().createSlot(0); + baseWidget = new Widget(this); int x = 16; - final int y = 28; - if (this.isDatabase) { - for (final BreedingSystem syst : Binnie.GENETICS.getActiveSystems()) { + int y = 28; + if (isDatabase) { + for (BreedingSystem syst : Binnie.GENETICS.getActiveSystems()) { new Control(this, x, y, 20, 20) { @Override public void initialise() { - this.addAttribute(Attribute.MouseOver); - this.addSelfEventHandler(new EventMouse.Down.Handler() { + addAttribute(Attribute.MouseOver); + addSelfEventHandler(new EventMouse.Down.Handler() { @Override @SideOnly(Side.CLIENT) - public void onEvent(final EventMouse.Down event) { - WindowAnalyst.this.setSystem(syst); + public void onEvent(EventMouse.Down event) { + setSystem(syst); } }); } @Override - public void getTooltip(final Tooltip tooltip) { + public void getTooltip(Tooltip tooltip) { tooltip.add(syst.getName()); } @@ -174,11 +174,11 @@ public class WindowAnalyst extends Window { @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { RenderUtil.setColour(syst.getColour()); - final int outset = (WindowAnalyst.this.getSystem() == syst) ? 1 : 0; - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea().outset(outset)); - if (WindowAnalyst.this.getSystem() == syst) { + int outset = (getSystem() == syst) ? 1 : 0; + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().outset(outset)); + if (getSystem() == syst) { RenderUtil.setColour(1140850688 + syst.getColour()); - CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().outset(outset)); + CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(outset)); } RenderUtil.drawItem(new Point(2, 2), syst.getItemStackRepresentitive()); } @@ -190,177 +190,177 @@ public class WindowAnalyst extends Window { x += 22; new ControlSlot.Builder(this, x, y + 1).assign(InventoryType.Window, 1); x += 26; - this.setupValidators(); + setupValidators(); } - this.tabBar = new Control(this, x, 28, this.width() - 16 - x, 20); - this.analystPanel = new Panel(this, 16, 54, 280, 164, MinecraftGUI.PanelType.Outline) { + tabBar = new Control(this, x, 28, width() - 16 - x, 20); + analystPanel = new Panel(this, 16, 54, 280, 164, MinecraftGUI.PanelType.Outline) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawGradientRect(this.getArea(), 1157627903, 1728053247); + RenderUtil.drawGradientRect(getArea(), 1157627903, 1728053247); super.onRenderBackground(guiWidth, guiHeight); } @Override public void initialise() { - this.setColour(4473924); - final int sectionWidth = (this.width() - 8 - 4) / 2; - WindowAnalyst.this.leftPage = new ControlScrollableContent(this, 3, 3, sectionWidth + 2, this.height() - 8 + 2, 0) { + setColor(4473924); + int sectionWidth = (width() - 8 - 4) / 2; + leftPage = new ControlScrollableContent(this, 3, 3, sectionWidth + 2, height() - 8 + 2, 0) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (this.getContent() == null) { + if (getContent() == null) { return; } - RenderUtil.setColour(this.getContent().getColour()); - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea()); + RenderUtil.setColour(getContent().getColor()); + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea()); } }; - new ControlScrollBar(this, sectionWidth + 2 - 3, 6, 3, this.height() - 8 + 2 - 6, WindowAnalyst.this.leftPage) { + new ControlScrollBar(this, sectionWidth + 2 - 3, 6, 3, height() - 8 + 2 - 6, leftPage) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (!this.isEnabled()) { + if (!isEnabled()) { return; } - if (WindowAnalyst.this.leftPage.getContent() == null) { + if (leftPage.getContent() == null) { return; } - RenderUtil.drawGradientRect(this.getArea(), 1140850688 + WindowAnalyst.this.leftPage.getContent().getColour(), 1140850688 + WindowAnalyst.this.leftPage.getContent().getColour()); - RenderUtil.drawSolidRect(this.getRenderArea(), WindowAnalyst.this.leftPage.getContent().getColour()); + RenderUtil.drawGradientRect(getArea(), 1140850688 + leftPage.getContent().getColor(), 1140850688 + leftPage.getContent().getColor()); + RenderUtil.drawSolidRect(getRenderArea(), leftPage.getContent().getColor()); } }; - WindowAnalyst.this.rightPage = new ControlScrollableContent(this, 3 + sectionWidth + 4, 3, sectionWidth + 2, this.height() - 8 + 2, 0) { + rightPage = new ControlScrollableContent(this, 3 + sectionWidth + 4, 3, sectionWidth + 2, height() - 8 + 2, 0) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (this.getContent() == null) { + if (getContent() == null) { return; } - RenderUtil.setColour(this.getContent().getColour()); - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea()); + RenderUtil.setColour(getContent().getColor()); + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea()); } }; - new ControlScrollBar(this, sectionWidth + 2 - 3 + sectionWidth + 4, 6, 3, this.height() - 8 + 2 - 6, WindowAnalyst.this.rightPage) { + new ControlScrollBar(this, sectionWidth + 2 - 3 + sectionWidth + 4, 6, 3, height() - 8 + 2 - 6, rightPage) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (!this.isEnabled()) { + if (!isEnabled()) { return; } - if (WindowAnalyst.this.rightPage.getContent() == null) { + if (rightPage.getContent() == null) { return; } - RenderUtil.drawGradientRect(this.getArea(), 1140850688 + WindowAnalyst.this.rightPage.getContent().getColour(), 1140850688 + WindowAnalyst.this.rightPage.getContent().getColour()); - RenderUtil.drawSolidRect(this.getRenderArea(), WindowAnalyst.this.rightPage.getContent().getColour()); + RenderUtil.drawGradientRect(getArea(), 1140850688 + rightPage.getContent().getColor(), 1140850688 + rightPage.getContent().getColor()); + RenderUtil.drawSolidRect(getRenderArea(), rightPage.getContent().getColor()); } }; - WindowAnalyst.this.analystPageSize = new Area(1, 1, sectionWidth, this.height() - 8); + analystPageSize = new Area(1, 1, sectionWidth, height() - 8); } }; - if (!this.isDatabase) { - this.slideUpInv = new ControlSlide(this, (this.getSize().x() - 244) / 2, this.getSize().y() - 80 + 1, 244, 80, Position.BOTTOM); - new ControlPlayerInventory(this.slideUpInv, true); - this.slideUpInv.setSlide(false); + if (!isDatabase) { + slideUpInv = new ControlSlide(this, (getSize().x() - 244) / 2, getSize().y() - 80 + 1, 244, 80, Position.BOTTOM); + new ControlPlayerInventory(slideUpInv, true); + slideUpInv.setSlide(false); } - this.addEventHandler(new EventKey.Down.Handler() { + addEventHandler(new EventKey.Down.Handler() { @Override - public void onEvent(final EventKey.Down event) { + public void onEvent(EventKey.Down event) { if (event.getKey() == 205) { - WindowAnalyst.this.shiftPages(true); + shiftPages(true); } if (event.getKey() == 203) { - WindowAnalyst.this.shiftPages(false); + shiftPages(false); } } }); - if (!this.isDatabase) { - this.analystNone = new Control(this.analystPanel, 0, 0, this.analystPanel.width(), this.analystPanel.height()) { + if (!isDatabase) { + analystNone = new Control(analystPanel, 0, 0, analystPanel.width(), analystPanel.height()) { @Override public void initialise() { - new ControlTextCentered(this, 20, "Add a bee, tree, flower or butterfly to the top left slot. DNA Dye is required if it has not been analysed yet. This dye can also convert vanilla items to breedable individuals.").setColour(4473924); + new ControlTextCentered(this, 20, "Add a bee, tree, flower or butterfly to the top left slot. DNA Dye is required if it has not been analysed yet. This dye can also convert vanilla items to breedable individuals.").setColor(4473924); new ControlPlayerInventory(this); } }; } - this.setIndividual(null); - this.setSystem(Binnie.GENETICS.beeBreedingSystem); + setIndividual(null); + setSystem(Binnie.GENETICS.beeBreedingSystem); } @SideOnly(Side.CLIENT) - public void updatePages(final boolean systemChange) { + public void updatePages(boolean systemChange) { int oldLeft = -1; int oldRight = -1; if (!systemChange) { - oldLeft = this.analystPages.indexOf(this.leftPage.getContent()); - oldRight = this.analystPages.indexOf(this.rightPage.getContent()); + oldLeft = analystPages.indexOf(leftPage.getContent()); + oldRight = analystPages.indexOf(rightPage.getContent()); } ControlAnalystPage databasePage = null; - if (this.isDatabase && !systemChange) { - databasePage = ((this.analystPages.size() > 0) ? this.analystPages.get(0) : null); + if (isDatabase && !systemChange) { + databasePage = ((analystPages.size() > 0) ? analystPages.get(0) : null); } - this.analystPages.clear(); - this.setPage(this.leftPage, null); - this.setPage(this.rightPage, null); - if (this.isDatabase) { - this.analystPages.add((databasePage != null) ? databasePage : new AnalystPageDatabase(this.analystPanel, this.analystPageSize, this.currentSystem, this.isMaster)); + analystPages.clear(); + setPage(leftPage, null); + setPage(rightPage, null); + if (isDatabase) { + analystPages.add((databasePage != null) ? databasePage : new AnalystPageDatabase(analystPanel, analystPageSize, currentSystem, isMaster)); } - if (this.current != null) { - this.analystPages.add(new AnalystPageDescription(this.analystPanel, this.analystPageSize, this.current)); - this.analystPages.add(new AnalystPageGenome(this.analystPanel, this.analystPageSize, true, this.current)); - if (!this.isDatabase) { - this.analystPages.add(new AnalystPageGenome(this.analystPanel, this.analystPageSize, false, this.current)); - this.analystPages.add(new AnalystPageKaryogram(this.analystPanel, this.analystPageSize, this.current)); + if (current != null) { + analystPages.add(new AnalystPageDescription(analystPanel, analystPageSize, current)); + analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, true, current)); + if (!isDatabase) { + analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, false, current)); + analystPages.add(new AnalystPageKaryogram(analystPanel, analystPageSize, current)); } - if (!(this.current instanceof ITree)) { - this.analystPages.add(new AnalystPageClimate(this.analystPanel, this.analystPageSize, this.current)); + if (!(current instanceof ITree)) { + analystPages.add(new AnalystPageClimate(analystPanel, analystPageSize, current)); } - if (this.current instanceof IBee) { - this.analystPages.add(new AnalystPageProducts(this.analystPanel, this.analystPageSize, (IBee) this.current)); - } else if (this.current instanceof ITree) { - this.analystPages.add(new AnalystPageFruit(this.analystPanel, this.analystPageSize, (ITree) this.current)); - this.analystPages.add(new AnalystPageWood(this.analystPanel, this.analystPageSize, (ITree) this.current)); - } else if (this.current instanceof IFlower) { - this.analystPages.add(new AnalystPageSoil(this.analystPanel, this.analystPageSize, (IFlower) this.current)); - } else if (this.current instanceof IButterfly) { - this.analystPages.add(new AnalystPageSpecimen(this.analystPanel, this.analystPageSize, (IButterfly) this.current)); + if (current instanceof IBee) { + analystPages.add(new AnalystPageProducts(analystPanel, analystPageSize, (IBee) current)); + } else if (current instanceof ITree) { + analystPages.add(new AnalystPageFruit(analystPanel, analystPageSize, (ITree) current)); + analystPages.add(new AnalystPageWood(analystPanel, analystPageSize, (ITree) current)); + } else if (current instanceof IFlower) { + analystPages.add(new AnalystPageSoil(analystPanel, analystPageSize, (IFlower) current)); + } else if (current instanceof IButterfly) { + analystPages.add(new AnalystPageSpecimen(analystPanel, analystPageSize, (IButterfly) current)); } - this.analystPages.add(new AnalystPageBiology(this.analystPanel, this.analystPageSize, this.current)); - if (this.current instanceof IBee || this.current instanceof IButterfly) { - this.analystPages.add(new AnalystPageBehaviour(this.analystPanel, this.analystPageSize, this.current)); - } else if (this.current instanceof ITree) { - this.analystPages.add(new AnalystPageGrowth(this.analystPanel, this.analystPageSize, this.current)); - } else if (this.current instanceof IFlower) { - this.analystPages.add(new AnalystPageAppearance(this.analystPanel, this.analystPageSize, (IFlower) this.current)); + analystPages.add(new AnalystPageBiology(analystPanel, analystPageSize, current)); + if (current instanceof IBee || current instanceof IButterfly) { + analystPages.add(new AnalystPageBehaviour(analystPanel, analystPageSize, current)); + } else if (current instanceof ITree) { + analystPages.add(new AnalystPageGrowth(analystPanel, analystPageSize, current)); + } else if (current instanceof IFlower) { + analystPages.add(new AnalystPageAppearance(analystPanel, analystPageSize, (IFlower) current)); } - this.analystPages.add(new AnalystPageMutations(this.analystPanel, this.analystPageSize, this.current, this.isMaster)); + analystPages.add(new AnalystPageMutations(analystPanel, analystPageSize, current, isMaster)); } - this.tabBar.deleteAllChildren(); - if (this.analystPages.size() > 0) { - final int width = this.tabBar.width() / this.analystPages.size(); + tabBar.deleteAllChildren(); + if (analystPages.size() > 0) { + int width = tabBar.width() / analystPages.size(); int x = 0; - for (final ControlAnalystPage page : this.analystPages) { - new ControlTooltip(this.tabBar, x, 0, width, this.tabBar.height()) { + for (ControlAnalystPage page : analystPages) { + new ControlTooltip(tabBar, x, 0, width, tabBar.height()) { ControlAnalystPage value; @Override - public void getTooltip(final Tooltip tooltip) { - tooltip.add(this.value.getTitle()); + public void getTooltip(Tooltip tooltip) { + tooltip.add(value.getTitle()); } @Override protected void initialise() { super.initialise(); - this.addAttribute(Attribute.MouseOver); - this.value = page; - this.addSelfEventHandler(new EventMouse.Down.Handler() { + addAttribute(Attribute.MouseOver); + value = page; + addSelfEventHandler(new EventMouse.Down.Handler() { @Override - public void onEvent(final EventMouse.Down event) { - final int currentIndex = WindowAnalyst.this.analystPages.indexOf(WindowAnalyst.this.rightPage.getContent()); - int clickedIndex = WindowAnalyst.this.analystPages.indexOf(value); - if (WindowAnalyst.this.isDatabase) { + public void onEvent(EventMouse.Down event) { + int currentIndex = analystPages.indexOf(rightPage.getContent()); + int clickedIndex = analystPages.indexOf(value); + if (isDatabase) { if (clickedIndex != 0 && clickedIndex != currentIndex) { - WindowAnalyst.this.setPage(WindowAnalyst.this.rightPage, value); + setPage(rightPage, value); } } else { if (clickedIndex < 0) { @@ -369,10 +369,10 @@ public class WindowAnalyst extends Window { if (clickedIndex < currentIndex) { ++clickedIndex; } - WindowAnalyst.this.setPage(WindowAnalyst.this.rightPage, null); - WindowAnalyst.this.setPage(WindowAnalyst.this.leftPage, null); - WindowAnalyst.this.setPage(WindowAnalyst.this.rightPage, WindowAnalyst.this.analystPages.get(clickedIndex)); - WindowAnalyst.this.setPage(WindowAnalyst.this.leftPage, WindowAnalyst.this.analystPages.get(clickedIndex - 1)); + setPage(rightPage, null); + setPage(leftPage, null); + setPage(rightPage, analystPages.get(clickedIndex)); + setPage(leftPage, analystPages.get(clickedIndex - 1)); } } }); @@ -381,63 +381,63 @@ public class WindowAnalyst extends Window { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - final boolean active = this.value == WindowAnalyst.this.leftPage.getContent() || this.value == WindowAnalyst.this.rightPage.getContent(); - RenderUtil.setColour((active ? -16777216 : 1140850688) + this.value.getColour()); - CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().inset(1)); - RenderUtil.setColour(this.value.getColour()); - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea().inset(1)); + boolean active = value == leftPage.getContent() || value == rightPage.getContent(); + RenderUtil.setColour((active ? -16777216 : 1140850688) + value.getColor()); + CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1)); + RenderUtil.setColour(value.getColor()); + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().inset(1)); super.onRenderBackground(guiWidth, guiHeight); } }; x += width; } - this.setPage(this.leftPage, this.analystPages.get((oldLeft >= 0) ? oldLeft : 0)); - if (this.analystPages.size() > 1) { - this.setPage(this.rightPage, this.analystPages.get((oldRight >= 0) ? oldRight : 1)); + setPage(leftPage, analystPages.get((oldLeft >= 0) ? oldLeft : 0)); + if (analystPages.size() > 1) { + setPage(rightPage, analystPages.get((oldRight >= 0) ? oldRight : 1)); } } } - public void shiftPages(final boolean right) { - if (this.analystPages.size() < 2) { + public void shiftPages(boolean right) { + if (analystPages.size() < 2) { return; } - final int leftIndex = this.analystPages.indexOf(this.leftPage.getContent()); - final int rightIndex = this.analystPages.indexOf(this.rightPage.getContent()); - if (right && rightIndex + 1 >= this.analystPages.size()) { + int leftIndex = analystPages.indexOf(leftPage.getContent()); + int rightIndex = analystPages.indexOf(rightPage.getContent()); + if (right && rightIndex + 1 >= analystPages.size()) { return; } - if (!this.lockedSearch && !right && leftIndex <= 0) { + if (!lockedSearch && !right && leftIndex <= 0) { return; } - if (!this.lockedSearch && !right && rightIndex <= 1) { + if (!lockedSearch && !right && rightIndex <= 1) { return; } - final int newRightIndex = rightIndex + (right ? 1 : -1); - final int newLeftIndex = this.lockedSearch ? 0 : (newRightIndex - 1); + int newRightIndex = rightIndex + (right ? 1 : -1); + int newLeftIndex = lockedSearch ? 0 : (newRightIndex - 1); float oldRightPercent = 0; float oldLeftPercent = 0; if (newLeftIndex == rightIndex) { - oldRightPercent = this.rightPage.getPercentageIndex(); + oldRightPercent = rightPage.getPercentageIndex(); } if (newRightIndex == leftIndex) { - oldLeftPercent = this.leftPage.getPercentageIndex(); + oldLeftPercent = leftPage.getPercentageIndex(); } - this.setPage(this.leftPage, null); - this.setPage(this.rightPage, null); - this.setPage(this.leftPage, this.analystPages.get(newLeftIndex)); - this.setPage(this.rightPage, this.analystPages.get(newRightIndex)); - this.analystPages.get(newLeftIndex).show(); + setPage(leftPage, null); + setPage(rightPage, null); + setPage(leftPage, analystPages.get(newLeftIndex)); + setPage(rightPage, analystPages.get(newRightIndex)); + analystPages.get(newLeftIndex).show(); if (oldRightPercent != 0) { - this.leftPage.setPercentageIndex(oldRightPercent); + leftPage.setPercentageIndex(oldRightPercent); } if (oldLeftPercent != 0) { - this.rightPage.setPercentageIndex(oldLeftPercent); + rightPage.setPercentageIndex(oldLeftPercent); } } - public void setPage(final ControlScrollableContent side, @Nullable final ControlAnalystPage page) { - final ControlAnalystPage existingPage = (ControlAnalystPage) side.getContent(); + public void setPage(ControlScrollableContent side, @Nullable ControlAnalystPage page) { + ControlAnalystPage existingPage = (ControlAnalystPage) side.getContent(); if (existingPage != null) { existingPage.hide(); side.setScrollableContent(null); @@ -456,58 +456,58 @@ public class WindowAnalyst extends Window { WindowInventory inv = getWindowInventory(); ItemStack stack = inv.getStackInSlot(0); if (!stack.isEmpty() && !Analyser.isAnalysed(stack)) { - inv.setInventorySlotContents(0, Analyser.analyse(stack, this.getWorld(), this.getUsername())); + inv.setInventorySlotContents(0, Analyser.analyse(stack, getWorld(), getUsername())); inv.decrStackSize(1, 1); } - if (this.isClient()) { + if (isClient()) { //noinspection MethodCallSideOnly - this.setStack(stack); + setStack(stack); } } @SideOnly(Side.CLIENT) - public void setStack(final ItemStack stack) { - final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack); - this.setIndividual(ind); + public void setStack(ItemStack stack) { + IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack); + setIndividual(ind); } public IIndividual getIndividual() { - return this.current; + return current; } @SideOnly(Side.CLIENT) - public void setIndividual(final IIndividual ind) { - if (!this.isDatabase) { + public void setIndividual(IIndividual ind) { + if (!isDatabase) { if (ind == null) { - this.analystNone.show(); - this.slideUpInv.hide(); + analystNone.show(); + slideUpInv.hide(); } else { - this.analystNone.hide(); - this.slideUpInv.show(); + analystNone.hide(); + slideUpInv.show(); } } - if (ind == this.current || (ind != null && this.current != null && ind.isGeneticEqual(this.current))) { + if (ind == current || (ind != null && current != null && ind.isGeneticEqual(current))) { return; } - final boolean systemChange = (this.current = ind) != null && ind.getGenome().getSpeciesRoot() != this.getSystem().getSpeciesRoot(); + boolean systemChange = (current = ind) != null && ind.getGenome().getSpeciesRoot() != getSystem().getSpeciesRoot(); if (systemChange) { - this.currentSystem = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); + currentSystem = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); } - this.updatePages(systemChange); + updatePages(systemChange); } public BreedingSystem getSystem() { - return this.currentSystem; + return currentSystem; } @SideOnly(Side.CLIENT) - public void setSystem(final BreedingSystem system) { - if (system == this.currentSystem) { + public void setSystem(BreedingSystem system) { + if (system == currentSystem) { return; } - this.currentSystem = system; - this.current = null; - this.updatePages(true); + currentSystem = system; + current = null; + updatePages(true); } } diff --git a/src/main/java/binnie/genetics/gui/bee/AnalystPageProducts.java b/src/main/java/binnie/genetics/gui/bee/AnalystPageProducts.java index 9a495cab..3b0d9ce3 100644 --- a/src/main/java/binnie/genetics/gui/bee/AnalystPageProducts.java +++ b/src/main/java/binnie/genetics/gui/bee/AnalystPageProducts.java @@ -39,64 +39,73 @@ import binnie.extratrees.kitchen.craftgui.ControlFluidDisplay; import binnie.genetics.gui.AnalystPageProduce; public class AnalystPageProducts extends AnalystPageProduce { - public AnalystPageProducts(final IWidget parent, final Area area, final IBee ind) { + public AnalystPageProducts(IWidget parent, Area area, IBee ind) { super(parent, area); - this.setColour(13382400); - final IBeeGenome genome = ind.getGenome(); - final float speed = genome.getSpeed(); - final float modeSpeed = Binnie.GENETICS.getBeeRoot().getBeekeepingMode(BinnieCore.getBinnieProxy().getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f); + setColor(0xcc3300); + IBeeGenome genome = ind.getGenome(); + float speed = genome.getSpeed(); + float modeSpeed = Binnie.GENETICS.getBeeRoot().getBeekeepingMode(BinnieCore.getBinnieProxy().getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f); + int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); + y += 12; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.produces.rate") + ": " + Binnie.GENETICS.beeBreedingSystem.getAlleleName(EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED))).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.produces.rate") + ": " + Binnie.GENETICS.beeBreedingSystem.getAlleleName(EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED))).setColor(getColor()); + y += 20; - final Collection refinedProducts = new UniqueItemStackSet(); - final Collection productList = new UniqueItemStackSet(); - final Collection specialtyList = new UniqueItemStackSet(); + Collection refinedProducts = new UniqueItemStackSet(); + Collection productList = new UniqueItemStackSet(); + Collection specialtyList = new UniqueItemStackSet(); Map products = new HashMap<>(); products.putAll(genome.getPrimary().getProductChances()); products.putAll(genome.getSecondary().getProductChances()); + if (!products.isEmpty()) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.natural")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.natural")).setColor(getColor()); y += 12; - for (final Map.Entry entry : products.entrySet()) { + for (Map.Entry entry : products.entrySet()) { if (!productList.add(entry.getKey())) { continue; } - refinedProducts.addAll(this.getAllProducts(entry.getKey())); - this.createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed); + refinedProducts.addAll(getAllProducts(entry.getKey())); + createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed); y += 18; } y += 12; } + products = genome.getPrimary().getSpecialtyChances(); if (!products.isEmpty()) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.specialty")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.specialty")).setColor(getColor()); y += 12; - for (final Map.Entry entry : products.entrySet()) { - refinedProducts.addAll(this.getAllProducts(entry.getKey())); - this.createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed); + for (Map.Entry entry : products.entrySet()) { + refinedProducts.addAll(getAllProducts(entry.getKey())); + createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed); y += 18; } y += 12; } - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.refined")).setColour(this.getColour()); + + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.refined")).setColor(getColor()); + y += 12; Collection level2Products = new UniqueItemStackSet(); - for (final ItemStack stack : refinedProducts) { - level2Products.addAll(this.getAllProducts(stack)); + for (ItemStack stack : refinedProducts) { + level2Products.addAll(getAllProducts(stack)); } + refinedProducts.addAll(level2Products); level2Products = new UniqueItemStackSet(); - for (final ItemStack stack : refinedProducts) { - level2Products.addAll(this.getAllProducts(stack)); + for (ItemStack stack : refinedProducts) { + level2Products.addAll(getAllProducts(stack)); } + refinedProducts.addAll(level2Products); - final Collection allFluids = new ArrayList<>(); - for (final ItemStack stack2 : refinedProducts) { - for (final FluidStack addition : this.getAllFluids(stack2)) { + Collection allFluids = new ArrayList<>(); + for (ItemStack stack2 : refinedProducts) { + for (FluidStack addition : getAllFluids(stack2)) { boolean alreadyIn = false; - for (final FluidStack existing : allFluids) { + for (FluidStack existing : allFluids) { if (existing.isFluidEqual(addition)) { alreadyIn = true; } @@ -106,42 +115,44 @@ public class AnalystPageProducts extends AnalystPageProduce { } } } - final int maxBiomePerLine = (int) ((this.width() + 2.0f - 16.0f) / 18.0f); - final int biomeListX = (this.width() - (Math.min(maxBiomePerLine, allFluids.size() + refinedProducts.size()) * 18 - 2)) / 2; + + int maxBiomePerLine = (int) ((width() + 2.0f - 16.0f) / 18.0f); + int biomeListX = (width() - (Math.min(maxBiomePerLine, allFluids.size() + refinedProducts.size()) * 18 - 2)) / 2; int dx = 0; int dy = 0; - for (final ItemStack soilStack : refinedProducts) { + for (ItemStack soilStack : refinedProducts) { if (dx >= 18 * maxBiomePerLine) { dx = 0; dy += 18; } - final ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy); + ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy); display.setItemStack(soilStack); display.setTooltip(); dx += 18; } - for (final FluidStack soilStack2 : allFluids) { + + for (FluidStack soilStack2 : allFluids) { if (dx >= 18 * maxBiomePerLine) { dx = 0; dy += 18; } ItemStack container = getContainer(soilStack2); if (container == null) { - final ControlFluidDisplay display2 = new ControlFluidDisplay(this, biomeListX + dx, y + dy); + ControlFluidDisplay display2 = new ControlFluidDisplay(this, biomeListX + dx, y + dy); display2.setFluidStack(soilStack2); display2.setTooltip(); } else { - final ControlItemDisplay display3 = new ControlItemDisplay(this, biomeListX + dx, y + dy); + ControlItemDisplay display3 = new ControlItemDisplay(this, biomeListX + dx, y + dy); display3.setItemStack(container); display3.setTooltip(); } dx += 18; } - this.setSize(new Point(this.width(), y + dy + 18 + 8)); + setSize(new Point(width(), y + dy + 18 + 8)); } @Nullable - public static ItemStack getContainer(final FluidStack fluidStack) { + public static ItemStack getContainer(FluidStack fluidStack) { ItemStack[] containers = { new ItemStack(Items.GLASS_BOTTLE), new ItemStack(Items.BUCKET) @@ -153,43 +164,43 @@ public class AnalystPageProducts extends AnalystPageProduce { return fluidHandler.getContainer(); } } - return null; } - private void createProductEntry(final ItemStack key, final Float value, final int y, final float speed) { - final ControlItemDisplay item = new ControlItemDisplay(this, 16, y) { + private void createProductEntry(ItemStack key, Float value, int y, float speed) { + ControlItemDisplay item = new ControlItemDisplay(this, 16, y) { @Override @SideOnly(Side.CLIENT) - public void getTooltip(final Tooltip tooltip) { + public void getTooltip(Tooltip tooltip) { super.getTooltip(tooltip); - final Collection products = AnalystPageProducts.this.getCentrifuge(key); + Collection products = getCentrifuge(key); if (!products.isEmpty()) { tooltip.add(I18N.localise("genetics.gui.analyst.products.centrifuges") + ": "); - for (final ItemStack prod : products) { - final NBTTagCompound nbt = new NBTTagCompound(); + for (ItemStack prod : products) { + NBTTagCompound nbt = new NBTTagCompound(); prod.writeToNBT(nbt); tooltip.add(prod, prod.getDisplayName()); } } - final Collection liquids = AnalystPageProducts.this.getSqueezer(key); + Collection liquids = getSqueezer(key); if (!liquids.isEmpty()) { tooltip.add(I18N.localise("genetics.gui.analyst.products.squeezes") + ": "); - for (final ItemStack prod2 : liquids) { - final NBTTagCompound nbt2 = new NBTTagCompound(); + for (ItemStack prod2 : liquids) { + NBTTagCompound nbt2 = new NBTTagCompound(); prod2.writeToNBT(nbt2); tooltip.add(prod2, prod2.getDisplayName()); } } } }; + item.setTooltip(); - final ControlText textWidget = new ControlTextCentered(this, y + 4, ""); - textWidget.setColour(this.getColour()); + ControlText textWidget = new ControlTextCentered(this, y + 4, ""); + textWidget.setColor(getColor()); CraftGUIUtil.moveWidget(textWidget, new Point(12, 0)); item.setItemStack(key); - final int time = (int) (PluginApiculture.ticksPerBeeWorkCycle * 100.0 / (speed * value)); - textWidget.setValue(I18N.localise("genetics.gui.analyst.products.every") + " " + this.getTimeString(time)); + int time = (int) (PluginApiculture.ticksPerBeeWorkCycle * 100.0 / (speed * value)); + textWidget.setValue(I18N.localise("genetics.gui.analyst.products.every") + " " + getTimeString(time)); } @Override diff --git a/src/main/java/binnie/genetics/gui/bee/database/ControlBiomes.java b/src/main/java/binnie/genetics/gui/bee/database/ControlBiomes.java index ee956bea..265e678e 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/ControlBiomes.java +++ b/src/main/java/binnie/genetics/gui/bee/database/ControlBiomes.java @@ -25,49 +25,48 @@ import binnie.core.craftgui.resource.minecraft.CraftGUITexture; public class ControlBiomes extends Control implements ITooltip { List tolerated; - public ControlBiomes(final IWidget parent, final int x, final int y, final int width, final int height) { + public ControlBiomes(IWidget parent, int x, int y, int width, int height) { super(parent, x, y, width * 16, height * 16); - this.tolerated = new ArrayList<>(); - this.addAttribute(Attribute.MouseOver); + tolerated = new ArrayList<>(); + addAttribute(Attribute.MouseOver); } @Override - public void getTooltip(final Tooltip list) { - if (this.tolerated.isEmpty()) { + public void getTooltip(Tooltip list) { + if (tolerated.isEmpty()) { return; } - final int x = (int) (this.getRelativeMousePosition().x() / 16.0f); - final int y = (int) (this.getRelativeMousePosition().y() / 16.0f); - final int i = x + y * 8; - if (i < this.tolerated.size()) { - Biome biome = Biome.getBiome(this.tolerated.get(i)); - if (biome != null) { - list.add(biome.getBiomeName()); - } + + int x = (int) (getRelativeMousePosition().x() / 16.0f); + int y = (int) (getRelativeMousePosition().y() / 16.0f); + int i = x + y * 8; + if (i >= tolerated.size()) { + return; + } + + Biome biome = Biome.getBiome(tolerated.get(i)); + if (biome != null) { + list.add(biome.getBiomeName()); } } @Override @SideOnly(Side.CLIENT) public void onRenderForeground(int guiWidth, int guiHeight) { - for (int i = 0; i < this.tolerated.size(); ++i) { - final int x = i % 8 * 16; - final int y = i / 8 * 16; + for (int i = 0; i < tolerated.size(); ++i) { + int x = i % 8 * 16; + int y = i / 8 * 16; if (Biome.getBiome(i) != null) { //TODO FIND COLOR //CraftGUI.Render.colour(Biome.getBiome(i).color); - } CraftGUI.render.texture(CraftGUITexture.Button, new Area(x, y, 16, 16)); } } - public void setSpecies(final IAlleleBeeSpecies species) { - this.tolerated.clear(); - if (species == null) { - return; - } - final IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(Binnie.GENETICS.getBeeRoot().getTemplate(species)); - final IBee bee = Binnie.GENETICS.getBeeRoot().getBee(genome); + public void setSpecies(IAlleleBeeSpecies species) { + tolerated.clear(); + IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(Binnie.GENETICS.getBeeRoot().getTemplate(species)); + IBee bee = Binnie.GENETICS.getBeeRoot().getBee(genome); } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/ControlClimateBar.java b/src/main/java/binnie/genetics/gui/bee/database/ControlClimateBar.java index 3a6eddaf..bdc38517 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/ControlClimateBar.java +++ b/src/main/java/binnie/genetics/gui/bee/database/ControlClimateBar.java @@ -25,131 +25,135 @@ import binnie.core.craftgui.renderer.RenderUtil; import binnie.core.craftgui.resource.minecraft.CraftGUITexture; public class ControlClimateBar extends Control implements ITooltip { + private final int[] TEMP_COLORS = new int[]{ + 0x00fffb, + 0x78bbff, + 0x4fff30, + 0xffff00, + 0xffa200, + 0xff0000 + }; + private final int[] HUMID_COLORS = new int[]{ + 0xffe7a3, + 0x1aff00, + 0x307cff + }; + boolean isHumidity; List tolerated; - int[] tempColours; - int[] humidColours; - public ControlClimateBar(final IWidget parent, final int x, final int y, final int width, final int height) { - super(parent, x, y, width, height); - this.isHumidity = false; - this.tolerated = new ArrayList<>(); - this.tempColours = new int[]{65531, 7912447, 5242672, 16776960, 16753152, 16711680}; - this.humidColours = new int[]{16770979, 1769216, 3177727}; - this.addAttribute(Attribute.MouseOver); + public ControlClimateBar(IWidget parent, int x, int y, int width, int height) { + this(parent, x, y, width, height, false); } - public ControlClimateBar(final IWidget parent, final int x, final int y, final int width, final int height, final boolean humidity) { + public ControlClimateBar(IWidget parent, int x, int y, int width, int height, boolean humidity) { super(parent, x, y, width, height); - this.isHumidity = false; - this.tolerated = new ArrayList<>(); - this.tempColours = new int[]{65531, 7912447, 5242672, 16776960, 16753152, 16711680}; - this.humidColours = new int[]{16770979, 1769216, 3177727}; - this.addAttribute(Attribute.MouseOver); - this.isHumidity = true; + isHumidity = false; + tolerated = new ArrayList<>(); + addAttribute(Attribute.MouseOver); + isHumidity = humidity; } @Override - public void getTooltip(final Tooltip list) { - if (this.tolerated.isEmpty()) { + public void getTooltip(Tooltip list) { + if (tolerated.isEmpty()) { return; } - final int types = this.isHumidity ? 3 : 6; - final int type = (int) ((int) (this.getRelativeMousePosition().x() - 1.0f) / ((this.getSize().x() - 2.0f) / types)); - if (!this.tolerated.contains(type)) { + + int types = isHumidity ? 3 : 6; + int type = (int) ((int) (getRelativeMousePosition().x() - 1.0f) / ((getSize().x() - 2.0f) / types)); + if (!tolerated.contains(type) || type >= types) { return; } - if (type < types) { - if (this.isHumidity) { - list.add(EnumHumidity.values()[type].name); - } else { - list.add(EnumTemperature.values()[type + 1].name); - } + + if (isHumidity) { + list.add(EnumHumidity.values()[type].name); + } else { + list.add(EnumTemperature.values()[type + 1].name); } } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - CraftGUI.render.texture(CraftGUITexture.EnergyBarBack, this.getArea()); - final int types = this.isHumidity ? 3 : 6; - final int w = (int) ((this.getSize().x() - 2.0f) / types); + CraftGUI.render.texture(CraftGUITexture.EnergyBarBack, getArea()); + int types = isHumidity ? 3 : 6; + int w = (int) ((getSize().x() - 2.0f) / types); for (int i = 0; i < types; ++i) { - final int x = i * w; - if (this.tolerated.contains(i)) { - int colour = 0; - if (this.isHumidity) { - colour = this.humidColours[i]; + int x = i * w; + if (tolerated.contains(i)) { + int color; + if (isHumidity) { + color = HUMID_COLORS[i]; } else { - colour = this.tempColours[i]; + color = TEMP_COLORS[i]; } - RenderUtil.drawSolidRect(new Area(x + 1, 1, w, this.getSize().y() - 2), colour); + RenderUtil.drawSolidRect(new Area(x + 1, 1, w, getSize().y() - 2), color); } } - CraftGUI.render.texture(CraftGUITexture.EnergyBarGlass, this.getArea()); + CraftGUI.render.texture(CraftGUITexture.EnergyBarGlass, getArea()); } - public void setSpecies(final IAlleleBeeSpecies species) { - this.tolerated.clear(); - if (species == null) { - return; - } + public void setSpecies(IAlleleBeeSpecies species) { + tolerated.clear(); int main; EnumTolerance tolerance; - final IAllele[] template = Binnie.GENETICS.getBeeRoot().getTemplate(species); - final IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(template); + IAllele[] template = Binnie.GENETICS.getBeeRoot().getTemplate(species); + IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(template); - if (!this.isHumidity) { + if (!isHumidity) { main = species.getTemperature().ordinal() - 1; tolerance = genome.getToleranceTemp(); } else { main = species.getHumidity().ordinal(); tolerance = genome.getToleranceHumid(); } - this.tolerated.add(main); + + tolerated.add(main); switch (tolerance) { case BOTH_5: case UP_5: { - this.tolerated.add(main + 5); + tolerated.add(main + 5); } case BOTH_4: case UP_4: { - this.tolerated.add(main + 4); + tolerated.add(main + 4); } case BOTH_3: case UP_3: { - this.tolerated.add(main + 3); + tolerated.add(main + 3); } case BOTH_2: case UP_2: { - this.tolerated.add(main + 2); + tolerated.add(main + 2); } case BOTH_1: case UP_1: { - this.tolerated.add(main + 1); + tolerated.add(main + 1); break; } } + switch (tolerance) { case BOTH_5: case DOWN_5: { - this.tolerated.add(main - 5); + tolerated.add(main - 5); } case BOTH_4: case DOWN_4: { - this.tolerated.add(main - 4); + tolerated.add(main - 4); } case BOTH_3: case DOWN_3: { - this.tolerated.add(main - 3); + tolerated.add(main - 3); } case BOTH_2: case DOWN_2: { - this.tolerated.add(main - 2); + tolerated.add(main - 2); } case BOTH_1: case DOWN_1: { - this.tolerated.add(main - 1); + tolerated.add(main - 1); break; } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java b/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java index 3b413549..7b23684c 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java +++ b/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java @@ -20,50 +20,54 @@ public class ControlProductsBox extends ControlListBox strings = new ArrayList<>(); - if (this.type == Type.Products) { - for (final Map.Entry entry : species.getProductChances().entrySet()) { - strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue())); - } - } else { - for (final Map.Entry entry : species.getSpecialtyChances().entrySet()) { - strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue())); - } - } - this.setOptions(strings); + public void setSpecies(IAlleleBeeSpecies species) { + if (species == this.species || (this.species = species) == null) { + return; } + + IAllele[] template = Binnie.GENETICS.getBeeRoot().getTemplate(species.getUID()); + if (template == null) { + return; + } + + IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(template); + float speed = genome.getSpeed(); + float modeSpeed = Binnie.GENETICS.getBeeRoot().getBeekeepingMode(BinnieCore.getBinnieProxy().getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f); + List strings = new ArrayList<>(); + + if (type == Type.PRODUCTS) { + for (Map.Entry entry : species.getProductChances().entrySet()) { + strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue())); + } + } else { + for (Map.Entry entry : species.getSpecialtyChances().entrySet()) { + strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue())); + } + } + setOptions(strings); } enum Type { - Products, - Specialties + PRODUCTS, + SPECIALTIES } class Product { ItemStack item; float chance; - public Product(final ItemStack item, final float chance) { + public Product(ItemStack item, float chance) { this.item = item; this.chance = chance; } diff --git a/src/main/java/binnie/genetics/gui/bee/database/ControlProductsItem.java b/src/main/java/binnie/genetics/gui/bee/database/ControlProductsItem.java index ba4c678d..132b82e3 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/ControlProductsItem.java +++ b/src/main/java/binnie/genetics/gui/bee/database/ControlProductsItem.java @@ -11,27 +11,26 @@ import binnie.core.craftgui.geometry.Point; import binnie.core.craftgui.minecraft.control.ControlItemDisplay; public class ControlProductsItem extends ControlOption { - ControlItemDisplay item; + private ControlItemDisplay item; - public ControlProductsItem(final ControlList controlList, final ControlProductsBox.Product value, final int y) { + public ControlProductsItem(ControlList controlList, ControlProductsBox.Product value, int y) { super(controlList, value, y); - (this.item = new ControlItemDisplay(this, 4, 4)).setTooltip(); - final ControlText textWidget = new ControlTextCentered(this, 2, ""); + (item = new ControlItemDisplay(this, 4, 4)).setTooltip(); + ControlText textWidget = new ControlTextCentered(this, 2, ""); CraftGUIUtil.moveWidget(textWidget, new Point(12, 0)); - if (value != null) { - this.item.setItemStack(value.item); - final int time = (int) (55000.0 / value.chance); - final int seconds = time / 20; - final int minutes = seconds / 60; - final int hours = minutes / 60; - final DecimalFormat df = new DecimalFormat("#.0"); - if (hours > 1) { - textWidget.setValue("Every " + df.format(hours) + " hours"); - } else if (minutes > 1) { - textWidget.setValue("Every " + df.format(minutes) + " min."); - } else { - textWidget.setValue("Every " + df.format(seconds) + " sec."); - } + item.setItemStack(value.item); + int time = (int) (55000.0 / value.chance); + int seconds = time / 20; + int minutes = seconds / 60; + int hours = minutes / 60; + DecimalFormat df = new DecimalFormat("#.0"); + + if (hours > 1) { + textWidget.setValue("Every " + df.format(hours) + " hours"); + } else if (minutes > 1) { + textWidget.setValue("Every " + df.format(minutes) + " min."); + } else { + textWidget.setValue("Every " + df.format(seconds) + " sec."); } } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesClimate.java b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesClimate.java index d9b6541f..1bc62c6a 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesClimate.java +++ b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesClimate.java @@ -13,19 +13,19 @@ public class PageSpeciesClimate extends PageSpecies { ControlClimateBar humidBar; ControlBiomes biomes; - public PageSpeciesClimate(final IWidget parent, final DatabaseTab tab) { + public PageSpeciesClimate(IWidget parent, DatabaseTab tab) { super(parent, tab); new ControlTextCentered(this, 8, "Climate"); - this.tempBar = new ControlClimateBar(this, 8, 24, 128, 12); - this.humidBar = new ControlClimateBar(this, 8, 42, 128, 12, true); + tempBar = new ControlClimateBar(this, 8, 24, 128, 12); + humidBar = new ControlClimateBar(this, 8, 42, 128, 12, true); new ControlTextCentered(this, 70, "Biomes"); - this.biomes = new ControlBiomes(this, 8, 90, 8, 4); + biomes = new ControlBiomes(this, 8, 90, 8, 4); } @Override - public void onValueChanged(final IAlleleSpecies species) { - this.tempBar.setSpecies((IAlleleBeeSpecies) species); - this.humidBar.setSpecies((IAlleleBeeSpecies) species); - this.biomes.setSpecies((IAlleleBeeSpecies) species); + public void onValueChanged(IAlleleSpecies species) { + tempBar.setSpecies((IAlleleBeeSpecies) species); + humidBar.setSpecies((IAlleleBeeSpecies) species); + biomes.setSpecies((IAlleleBeeSpecies) species); } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java index 03a49f66..f92e3e4b 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java +++ b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java @@ -33,7 +33,7 @@ public class PageSpeciesGenome extends PageSpecies { ControlText flowerText; ControlText effectText; - public PageSpeciesGenome(final IWidget parent, final DatabaseTab tab) { + public PageSpeciesGenome(IWidget parent, DatabaseTab tab) { super(parent, tab); title = new ControlTextCentered(this, 8, I18N.localise("extrabees.gui.database.tab.species.genome")); new ControlText(this, new Area(0, 32, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.speed"), TextJustification.TOP_RIGHT); @@ -46,20 +46,20 @@ public class PageSpeciesGenome extends PageSpecies { new ControlText(this, new Area(0, 121, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.rain"), TextJustification.TOP_RIGHT); new ControlText(this, new Area(0, 138, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.flower"), TextJustification.TOP_RIGHT); new ControlText(this, new Area(0, 155, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.effect"), TextJustification.TOP_RIGHT); - final int x = 72; - this.speedText = new ControlText(this, new Area(x, 32, 72, 30), "", TextJustification.TOP_LEFT); - this.lifespanText = new ControlText(this, new Area(x, 44, 72, 30), "", TextJustification.TOP_LEFT); - this.fertilityText = new ControlText(this, new Area(x, 56, 72, 30), "", TextJustification.TOP_LEFT); - this.floweringText = new ControlText(this, new Area(x, 68, 72, 30), "", TextJustification.TOP_LEFT); - this.territoryText = new ControlText(this, new Area(x, 80, 72, 30), "", TextJustification.TOP_LEFT); - this.nocturnalText = new ControlText(this, new Area(x, 97, 72, 30), "", TextJustification.TOP_LEFT); - this.caveDwellingText = new ControlText(this, new Area(x, 109, 72, 30), "", TextJustification.TOP_LEFT); - this.tolerantFlyerText = new ControlText(this, new Area(x, 121, 72, 30), "", TextJustification.TOP_LEFT); - this.flowerText = new ControlText(this, new Area(x, 138, 72, 30), "", TextJustification.TOP_LEFT); - this.effectText = new ControlText(this, new Area(x, 155, 72, 30), "", TextJustification.TOP_LEFT); + int x = 72; + speedText = new ControlText(this, new Area(x, 32, 72, 30), "", TextJustification.TOP_LEFT); + lifespanText = new ControlText(this, new Area(x, 44, 72, 30), "", TextJustification.TOP_LEFT); + fertilityText = new ControlText(this, new Area(x, 56, 72, 30), "", TextJustification.TOP_LEFT); + floweringText = new ControlText(this, new Area(x, 68, 72, 30), "", TextJustification.TOP_LEFT); + territoryText = new ControlText(this, new Area(x, 80, 72, 30), "", TextJustification.TOP_LEFT); + nocturnalText = new ControlText(this, new Area(x, 97, 72, 30), "", TextJustification.TOP_LEFT); + caveDwellingText = new ControlText(this, new Area(x, 109, 72, 30), "", TextJustification.TOP_LEFT); + tolerantFlyerText = new ControlText(this, new Area(x, 121, 72, 30), "", TextJustification.TOP_LEFT); + flowerText = new ControlText(this, new Area(x, 138, 72, 30), "", TextJustification.TOP_LEFT); + effectText = new ControlText(this, new Area(x, 155, 72, 30), "", TextJustification.TOP_LEFT); } - public static String rateFlowering(final int flowering) { + public static String rateFlowering(int flowering) { if (flowering >= 99) { return AlleleHelper.toDisplay(EnumAllele.Flowering.MAXIMUM); } @@ -84,7 +84,7 @@ public class PageSpeciesGenome extends PageSpecies { return AlleleHelper.toDisplay(EnumAllele.Flowering.SLOWEST); } - public static String rateSpeed(final float speed) { + public static String rateSpeed(float speed) { if (speed >= 1.7f) { return AlleleHelper.toDisplay(EnumAllele.Speed.FASTEST); } @@ -106,7 +106,7 @@ public class PageSpeciesGenome extends PageSpecies { return AlleleHelper.toDisplay(EnumAllele.Speed.SLOWEST); } - public static String rateLifespan(final int life) { + public static String rateLifespan(int life) { if (life >= 70) { return AlleleHelper.toDisplay(EnumAllele.Lifespan.LONGEST); } @@ -134,7 +134,7 @@ public class PageSpeciesGenome extends PageSpecies { return AlleleHelper.toDisplay(EnumAllele.Lifespan.SHORTEST); } - public static String tolerated(final boolean t) { + public static String tolerated(boolean t) { if (t) { return I18N.localise("extrabees.gui.database.tab.species.genome.tolerated"); } @@ -142,37 +142,41 @@ public class PageSpeciesGenome extends PageSpecies { } @Override - public void onValueChanged(final IAlleleSpecies species) { - final IAllele[] template = Binnie.GENETICS.getBeeRoot().getTemplate(species.getUID()); - if (template != null) { - final IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(template); - final IBee bee = Binnie.GENETICS.getBeeRoot().getBee(genome); - this.speedText.setValue(rateSpeed(genome.getSpeed())); - this.lifespanText.setValue(rateLifespan(genome.getLifespan())); - this.fertilityText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.children", genome.getFertility())); - this.floweringText.setValue(rateFlowering(genome.getFlowering())); - final Vec3i area = genome.getTerritory(); - this.territoryText.setValue(area.getX() + "x" + area.getY() + "x" + area.getZ()); - String behavior = I18N.localise("extrabees.gui.database.tab.species.genome.daytime"); - if (genome.getPrimary().isNocturnal()) { - behavior = I18N.localise("extrabees.gui.database.tab.species.genome.nighttime"); - } - if (genome.getNeverSleeps()) { - behavior = I18N.localise("extrabees.gui.database.tab.species.genome.allDay"); - } - this.nocturnalText.setValue(behavior); - if (genome.getCaveDwelling()) { - this.caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.notNeeded")); - } else { - this.caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.required")); - } - this.tolerantFlyerText.setValue(tolerated(genome.getToleratesRain())); - if (genome.getFlowerProvider() != null) { - this.flowerText.setValue(genome.getFlowerProvider().getDescription()); - } else { - this.flowerText.setValue(AlleleHelper.toDisplay(EnumTolerance.NONE)); - } - this.effectText.setValue(genome.getEffect().getName()); + public void onValueChanged(IAlleleSpecies species) { + IAllele[] template = Binnie.GENETICS.getBeeRoot().getTemplate(species.getUID()); + if (template == null) { + return; } + + IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(template); + IBee bee = Binnie.GENETICS.getBeeRoot().getBee(genome); + speedText.setValue(rateSpeed(genome.getSpeed())); + lifespanText.setValue(rateLifespan(genome.getLifespan())); + fertilityText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.children", genome.getFertility())); + floweringText.setValue(rateFlowering(genome.getFlowering())); + Vec3i area = genome.getTerritory(); + territoryText.setValue(area.getX() + "x" + area.getY() + "x" + area.getZ()); + String behavior = I18N.localise("extrabees.gui.database.tab.species.genome.daytime"); + if (genome.getPrimary().isNocturnal()) { + behavior = I18N.localise("extrabees.gui.database.tab.species.genome.nighttime"); + } + if (genome.getNeverSleeps()) { + behavior = I18N.localise("extrabees.gui.database.tab.species.genome.allDay"); + } + + nocturnalText.setValue(behavior); + if (genome.getCaveDwelling()) { + caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.notNeeded")); + } else { + caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.required")); + } + + tolerantFlyerText.setValue(tolerated(genome.getToleratesRain())); + if (genome.getFlowerProvider() != null) { + flowerText.setValue(genome.getFlowerProvider().getDescription()); + } else { + flowerText.setValue(AlleleHelper.toDisplay(EnumTolerance.NONE)); + } + effectText.setValue(genome.getEffect().getName()); } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesProducts.java b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesProducts.java index f2170539..7366195b 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesProducts.java +++ b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesProducts.java @@ -10,22 +10,22 @@ import binnie.core.craftgui.database.DatabaseTab; import binnie.core.craftgui.database.PageSpecies; public class PageSpeciesProducts extends PageSpecies { - ControlText pageSpeciesProducts_Title; - ControlProductsBox pageSpeciesProducts_Products; - ControlText pageSpeciesProducts_Title2; - ControlProductsBox pageSpeciesProducts_Specialties; + ControlText title; + ControlProductsBox productsBox; + ControlText title2; + ControlProductsBox specialitiesBox; - public PageSpeciesProducts(final IWidget parent, final DatabaseTab tab) { + public PageSpeciesProducts(IWidget parent, DatabaseTab tab) { super(parent, tab); - this.pageSpeciesProducts_Title = new ControlTextCentered(this, 8, "Products"); - this.pageSpeciesProducts_Products = new ControlProductsBox(this, 4, 20, 136, 48, ControlProductsBox.Type.Products); - this.pageSpeciesProducts_Title2 = new ControlTextCentered(this, 68, "Specialties"); - this.pageSpeciesProducts_Specialties = new ControlProductsBox(this, 4, 80, 136, 48, ControlProductsBox.Type.Specialties); + title = new ControlTextCentered(this, 8, "Products"); + productsBox = new ControlProductsBox(this, 4, 20, 136, 48, ControlProductsBox.Type.PRODUCTS); + title2 = new ControlTextCentered(this, 68, "Specialties"); + specialitiesBox = new ControlProductsBox(this, 4, 80, 136, 48, ControlProductsBox.Type.SPECIALTIES); } @Override - public void onValueChanged(final IAlleleSpecies species) { - this.pageSpeciesProducts_Products.setSpecies((IAlleleBeeSpecies) species); - this.pageSpeciesProducts_Specialties.setSpecies((IAlleleBeeSpecies) species); + public void onValueChanged(IAlleleSpecies species) { + productsBox.setSpecies((IAlleleBeeSpecies) species); + specialitiesBox.setSpecies((IAlleleBeeSpecies) species); } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/WindowApiaristDatabase.java b/src/main/java/binnie/genetics/gui/bee/database/WindowApiaristDatabase.java index d7a18e88..9f19bbe7 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/WindowApiaristDatabase.java +++ b/src/main/java/binnie/genetics/gui/bee/database/WindowApiaristDatabase.java @@ -20,27 +20,27 @@ import binnie.core.craftgui.minecraft.Window; import binnie.genetics.Genetics; public class WindowApiaristDatabase extends WindowAbstractDatabase { - public WindowApiaristDatabase(final EntityPlayer player, final Side side, final boolean nei) { + public WindowApiaristDatabase(EntityPlayer player, Side side, boolean nei) { super(player, side, nei, Binnie.GENETICS.beeBreedingSystem, 110); } - public static Window create(final EntityPlayer player, final Side side, final boolean nei) { + public static Window create(EntityPlayer player, Side side, boolean nei) { return new WindowApiaristDatabase(player, side, nei); } @Override @SideOnly(Side.CLIENT) protected void addTabs() { - new PageSpeciesOverview(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.overview", 0)); - new PageSpeciesClassification(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.classification", 0)); - new PageSpeciesGenome(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.genome", 0)); - new PageSpeciesProducts(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.products", 0)); - new PageSpeciesClimate(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.climate", 0)); - new PageSpeciesResultant(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.resultant", 0)); - new PageSpeciesMutations(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.further", 0)); - new PageBranchOverview(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(Genetics.instance, "branches.overview", 0)); - new PageBranchSpecies(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(Genetics.instance, "branches.species", 0)); - new PageBreeder(this.getInfoPages(Mode.BREEDER), this.getUsername(), new DatabaseTab(Genetics.instance, "breeder", 0)); + new PageSpeciesOverview(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.overview", 0)); + new PageSpeciesClassification(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.classification", 0)); + new PageSpeciesGenome(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.genome", 0)); + new PageSpeciesProducts(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.products", 0)); + new PageSpeciesClimate(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.climate", 0)); + new PageSpeciesResultant(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.resultant", 0)); + new PageSpeciesMutations(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.further", 0)); + new PageBranchOverview(getInfoPages(Mode.BRANCHES), new DatabaseTab(Genetics.instance, "branches.overview", 0)); + new PageBranchSpecies(getInfoPages(Mode.BRANCHES), new DatabaseTab(Genetics.instance, "branches.species", 0)); + new PageBreeder(getInfoPages(Mode.BREEDER), getUsername(), new DatabaseTab(Genetics.instance, "breeder", 0)); } @Override @@ -54,28 +54,28 @@ public class WindowApiaristDatabase extends WindowAbstractDatabase { } enum SpeciesTab { - Overview(255), - Genome(16776960), - Productivity(65535), - Climate(16711680), - ResultantMutations(16711935), - FurtherMutations(65280); + Overview(0x00ff), + Genome(0xffff00), + Productivity(0x00ffff), + Climate(0xff0000), + ResultantMutations(0xff00ff), + FurtherMutations(0xff00); - public int colour; + public int color; - SpeciesTab(final int colour) { - this.colour = colour; + SpeciesTab(int color) { + this.color = color; } } enum BranchesTab { - Overview(255), - Species(16711680); + Overview(0x0000ff), + Species(0xff0000); - public int colour; + public int color; - BranchesTab(final int colour) { - this.colour = colour; + BranchesTab(int color) { + this.color = color; } } } diff --git a/src/main/java/binnie/genetics/gui/butterfly/AnalystPageSpecimen.java b/src/main/java/binnie/genetics/gui/butterfly/AnalystPageSpecimen.java index 0eba33db..85012856 100644 --- a/src/main/java/binnie/genetics/gui/butterfly/AnalystPageSpecimen.java +++ b/src/main/java/binnie/genetics/gui/butterfly/AnalystPageSpecimen.java @@ -12,14 +12,14 @@ import binnie.genetics.gui.ControlAnalystPage; import binnie.genetics.gui.ControlIndividualDisplay; public class AnalystPageSpecimen extends ControlAnalystPage { - public AnalystPageSpecimen(final IWidget parent, final Area area, final IButterfly ind) { + public AnalystPageSpecimen(IWidget parent, Area area, IButterfly ind) { super(parent, area); - this.setColour(3355443); + setColor(3355443); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; - final int w = Math.round((this.width() - 16) * ind.getSize()); - new ControlIndividualDisplay(this, (this.width() - w) / 2, y + (this.width() - w) / 2, w, ind); + int w = Math.round((width() - 16) * ind.getSize()); + new ControlIndividualDisplay(this, (width() - w) / 2, y + (width() - w) / 2, w, ind); } @Override diff --git a/src/main/java/binnie/genetics/gui/flower/AnalystPageAppearance.java b/src/main/java/binnie/genetics/gui/flower/AnalystPageAppearance.java index 598a1af9..7a3dc9c5 100644 --- a/src/main/java/binnie/genetics/gui/flower/AnalystPageAppearance.java +++ b/src/main/java/binnie/genetics/gui/flower/AnalystPageAppearance.java @@ -23,30 +23,30 @@ import binnie.core.util.I18N; import binnie.genetics.gui.ControlAnalystPage; public class AnalystPageAppearance extends ControlAnalystPage { - public AnalystPageAppearance(final IWidget parent, final Area area, final IFlower flower) { + public AnalystPageAppearance(IWidget parent, Area area, IFlower flower) { super(parent, area); - this.setColour(3355443); + setColor(3355443); int y = 4; IFlowerGenome genome = flower.getGenome(); - final IAlleleSpecies species = genome.getPrimary(); - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + IAlleleSpecies species = genome.getPrimary(); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; - final ControlColorDisplay a = new ControlColorDisplay(this, this.width() / 2 - 28, y, genome.getPrimaryColor()); + ControlColorDisplay a = new ControlColorDisplay(this, width() / 2 - 28, y, genome.getPrimaryColor()); a.addTooltip(I18N.localise("genetics.gui.analyst.appearance.primary")); - final ControlColorDisplay b = new ControlColorDisplay(this, this.width() / 2 - 8, y, genome.getSecondaryColor()); + ControlColorDisplay b = new ControlColorDisplay(this, width() / 2 - 8, y, genome.getSecondaryColor()); b.addTooltip(I18N.localise("genetics.gui.analyst.appearance.secondary")); - final ControlColorDisplay c = new ControlColorDisplay(this, this.width() / 2 + 12, y, genome.getStemColor()); + ControlColorDisplay c = new ControlColorDisplay(this, width() / 2 + 12, y, genome.getStemColor()); c.addTooltip(I18N.localise("genetics.gui.analyst.appearance.stem")); y += 26; IFlowerType type = genome.getType(); - final int sections = type.getSections(); - final int width = (sections > 1) ? 50 : 100; - new ControlIconDisplay(this, (this.width() - width) / 2, y - ((sections == 1) ? 0 : 0)) { + int sections = type.getSections(); + int width = (sections > 1) ? 50 : 100; + new ControlIconDisplay(this, (width() - width) / 2, y - ((sections == 1) ? 0 : 0)) { @Override @SideOnly(Side.CLIENT) public void onRenderForeground(int guiWidth, int guiHeight) { GlStateManager.pushMatrix(); - final float scale = width / 16.0f; + float scale = width / 16.0f; int dy = (sections > 1) ? 16 : 0; GlStateManager.scale(scale, scale, 1.0f); RenderUtil.setColour(flower.getGenome().getStemColor().getColor(false)); diff --git a/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java b/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java index 1661cb22..24c942b4 100644 --- a/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java +++ b/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java @@ -26,30 +26,30 @@ import binnie.genetics.gui.ControlAnalystPage; import binnie.genetics.gui.ControlToleranceBar; public class AnalystPageSoil extends ControlAnalystPage { - public AnalystPageSoil(final IWidget parent, final Area area, final IFlower flower) { + public AnalystPageSoil(IWidget parent, Area area, IFlower flower) { super(parent, area); - this.setColour(6697728); - final EnumMoisture moisture = flower.getGenome().getPrimary().getMoisture(); - final EnumTolerance moistureTol = flower.getGenome().getToleranceMoisture(); - final EnumAcidity pH = flower.getGenome().getPrimary().getPH(); - final EnumTolerance pHTol = flower.getGenome().getTolerancePH(); + setColor(6697728); + EnumMoisture moisture = flower.getGenome().getPrimary().getMoisture(); + EnumTolerance moistureTol = flower.getGenome().getToleranceMoisture(); + EnumAcidity pH = flower.getGenome().getPrimary().getPH(); + EnumTolerance pHTol = flower.getGenome().getTolerancePH(); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.moisture"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.moisture"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - this.createMoisture(this, (this.width() - 100) / 2, y, 100, 10, moisture, moistureTol); + createMoisture(this, (width() - 100) / 2, y, 100, 10, moisture, moistureTol); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.ph"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.ph"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - this.createAcidity(this, (this.width() - 100) / 2, y, 100, 10, pH, pHTol); + createAcidity(this, (width() - 100) / 2, y, 100, 10, pH, pHTol); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.recommended"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.recommended"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; EnumMoisture recomMoisture = EnumMoisture.NORMAL; - final boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol); - final boolean canTolDamp = Tolerance.canTolerate(moisture, EnumMoisture.DAMP, moistureTol); - final boolean canTolDry = Tolerance.canTolerate(moisture, EnumMoisture.DRY, moistureTol); + boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol); + boolean canTolDamp = Tolerance.canTolerate(moisture, EnumMoisture.DAMP, moistureTol); + boolean canTolDry = Tolerance.canTolerate(moisture, EnumMoisture.DRY, moistureTol); if (canTolNormal) { if (canTolDamp && !canTolDry) { recomMoisture = EnumMoisture.DAMP; @@ -65,9 +65,9 @@ public class AnalystPageSoil extends ControlAnalystPage { } } EnumAcidity recomPH = EnumAcidity.NEUTRAL; - final boolean canTolNeutral = Tolerance.canTolerate(pH, EnumAcidity.NEUTRAL, pHTol); - final boolean canTolAcid = Tolerance.canTolerate(pH, EnumAcidity.ACID, pHTol); - final boolean canTolAlkaline = Tolerance.canTolerate(pH, EnumAcidity.ALKALINE, pHTol); + boolean canTolNeutral = Tolerance.canTolerate(pH, EnumAcidity.NEUTRAL, pHTol); + boolean canTolAcid = Tolerance.canTolerate(pH, EnumAcidity.ACID, pHTol); + boolean canTolAlkaline = Tolerance.canTolerate(pH, EnumAcidity.ALKALINE, pHTol); if (canTolNeutral) { if (canTolAcid && !canTolAlkaline) { recomPH = EnumAcidity.ACID; @@ -82,54 +82,54 @@ public class AnalystPageSoil extends ControlAnalystPage { recomPH = EnumAcidity.ALKALINE; } } - final ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture)); - final ControlItemDisplay recomSoil = new ControlItemDisplay(this, (this.width() - 24) / 2, y, 24); + ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture)); + ControlItemDisplay recomSoil = new ControlItemDisplay(this, (width() - 24) / 2, y, 24); recomSoil.setItemStack(stack); recomSoil.setTooltip(); y += 32; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.other"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.other"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - final List stacks = new ArrayList<>(); - for (final EnumAcidity a : EnumSet.range(EnumAcidity.ACID, EnumAcidity.ALKALINE)) { - for (final EnumMoisture b : EnumSet.range(EnumMoisture.DRY, EnumMoisture.DAMP)) { + List stacks = new ArrayList<>(); + for (EnumAcidity a : EnumSet.range(EnumAcidity.ACID, EnumAcidity.ALKALINE)) { + for (EnumMoisture b : EnumSet.range(EnumMoisture.DRY, EnumMoisture.DAMP)) { if (Tolerance.canTolerate(pH, a, pHTol) && Tolerance.canTolerate(moisture, b, moistureTol) && (a != recomPH || b != recomMoisture)) { stacks.add(new ItemStack(Botany.soil, 1, BlockSoil.getMeta(a, b))); } } } - final int soilListWidth = 17 * stacks.size() - 1; - final int soilListX = (this.width() - soilListWidth) / 2; + int soilListWidth = 17 * stacks.size() - 1; + int soilListX = (width() - soilListWidth) / 2; int t = 0; - for (final ItemStack soilStack : stacks) { - final ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y); + for (ItemStack soilStack : stacks) { + ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y); display.setItemStack(soilStack); display.setTooltip(); } } - protected void createMoisture(final IWidget parent, final int x, final int y, final int w, final int h, final EnumMoisture value, final EnumTolerance tol) { + protected void createMoisture(IWidget parent, int x, int y, int w, int h, EnumMoisture value, EnumTolerance tol) { new ControlToleranceBar(parent, x, y, w, h, EnumMoisture.class) { @Override - protected String getName(final EnumMoisture value) { + protected String getName(EnumMoisture value) { return value.getLocalisedName(false); } @Override - protected int getColour(final EnumMoisture value) { + protected int getColour(EnumMoisture value) { return (new int[]{13434828, 6737151, 3368703})[value.ordinal()]; } }.setValues(value, tol); } - protected void createAcidity(final IWidget parent, final int x, final int y, final int w, final int h, final EnumAcidity value, final EnumTolerance tol) { + protected void createAcidity(IWidget parent, int x, int y, int w, int h, EnumAcidity value, EnumTolerance tol) { new ControlToleranceBar(parent, x, y, w, h, EnumAcidity.class) { @Override - protected String getName(final EnumAcidity value) { + protected String getName(EnumAcidity value) { return value.getLocalisedName(false); } @Override - protected int getColour(final EnumAcidity value) { + protected int getColour(EnumAcidity value) { return (new int[]{16711782, 65280, 26367})[value.ordinal()]; } }.setValues(value, tol); diff --git a/src/main/java/binnie/genetics/gui/punnett/ControlChromosome.java b/src/main/java/binnie/genetics/gui/punnett/ControlChromosome.java index 6569c38e..909a517c 100644 --- a/src/main/java/binnie/genetics/gui/punnett/ControlChromosome.java +++ b/src/main/java/binnie/genetics/gui/punnett/ControlChromosome.java @@ -17,32 +17,32 @@ import binnie.core.craftgui.renderer.RenderUtil; public class ControlChromosome extends Control implements IControlValue, ITooltip { private IChromosomeType value; - protected ControlChromosome(final IWidget parent, final int x, final int y, final IChromosomeType type) { + protected ControlChromosome(IWidget parent, int x, int y, IChromosomeType type) { super(parent, x, y, 16, 16); - this.value = type; - this.addAttribute(Attribute.MouseOver); + value = type; + addAttribute(Attribute.MouseOver); } @Override public IChromosomeType getValue() { - return this.value; + return value; } @Override - public void setValue(final IChromosomeType value) { + public void setValue(IChromosomeType value) { this.value = value; } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - CraftGUI.render.texture(ExtraBeeGUITexture.Chromosome, this.getArea()); + CraftGUI.render.texture(ExtraBeeGUITexture.Chromosome, getArea()); RenderUtil.setColour(16711680); - CraftGUI.render.texture(ExtraBeeGUITexture.Chromosome2, this.getArea()); + CraftGUI.render.texture(ExtraBeeGUITexture.Chromosome2, getArea()); } @Override - public void getTooltip(final Tooltip tooltip) { - tooltip.add(this.value.getName()); + public void getTooltip(Tooltip tooltip) { + tooltip.add(value.getName()); } } diff --git a/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java b/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java index 27e0da36..a0919b7a 100644 --- a/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java +++ b/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java @@ -22,7 +22,7 @@ public class ControlPunnett extends Control { static int boxWidth = 80; static int boxHeight = 28; - protected ControlPunnett(final IWidget parent, final int x, final int y) { + protected ControlPunnett(IWidget parent, int x, int y) { super(parent, x, y, ControlPunnett.boxWidth * 3, ControlPunnett.boxWidth * 3); } @@ -35,21 +35,21 @@ public class ControlPunnett extends Control { RenderUtil.drawSolidRect(new Area(ControlPunnett.boxWidth * 2, ControlPunnett.boxHeight / 2, 1, Math.round(ControlPunnett.boxHeight * 2.5f)), 11184810); } - public void setup(final IChromosomeType chromosome, final IIndividual ind1, final IIndividual ind2, final ISpeciesRoot root) { - this.deleteAllChildren(); + public void setup(IChromosomeType chromosome, IIndividual ind1, IIndividual ind2, ISpeciesRoot root) { + deleteAllChildren(); if (chromosome == null || ind1 == null || ind2 == null || root == null) { return; } - final IAllele primary1 = ind1.getGenome().getActiveAllele(chromosome); - final IAllele primary2 = ind2.getGenome().getActiveAllele(chromosome); - final IAllele secondary1 = ind1.getGenome().getInactiveAllele(chromosome); - final IAllele secondary2 = ind2.getGenome().getInactiveAllele(chromosome); + IAllele primary1 = ind1.getGenome().getActiveAllele(chromosome); + IAllele primary2 = ind2.getGenome().getActiveAllele(chromosome); + IAllele secondary1 = ind1.getGenome().getInactiveAllele(chromosome); + IAllele secondary2 = ind2.getGenome().getInactiveAllele(chromosome); int x = 1; int y = 1; - for (final IAllele allele1 : new IAllele[]{primary1, secondary1}) { + for (IAllele allele1 : new IAllele[]{primary1, secondary1}) { y = 1; - for (final IAllele allele2 : new IAllele[]{primary2, secondary2}) { - final List alleles = new LinkedList<>(); + for (IAllele allele2 : new IAllele[]{primary2, secondary2}) { + List alleles = new LinkedList<>(); if (allele1.isDominant() && !allele2.isDominant()) { alleles.add(allele1); } else if (allele2.isDominant() && !allele1.isDominant()) { @@ -61,17 +61,17 @@ public class ControlPunnett extends Control { } } StringBuilder text = new StringBuilder(); - for (final IAllele allele3 : alleles) { + for (IAllele allele3 : alleles) { text.append(allele3.getName()).append(": ").append(25.0f / alleles.size()).append("%\n"); } - new ControlText(this, new Area(x * ControlPunnett.boxWidth, ControlPunnett.boxHeight * y, ControlPunnett.boxWidth, ControlPunnett.boxHeight), text.toString(), TextJustification.TOP_CENTER).setColour(11184810); + new ControlText(this, new Area(x * ControlPunnett.boxWidth, ControlPunnett.boxHeight * y, ControlPunnett.boxWidth, ControlPunnett.boxHeight), text.toString(), TextJustification.TOP_CENTER).setColor(11184810); ++y; } ++x; } - new ControlText(this, new Area(ControlPunnett.boxWidth, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TOP_CENTER).setColour(11184810); - new ControlText(this, new Area(ControlPunnett.boxWidth * 2, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TOP_CENTER).setColour(11184810); - new ControlText(this, new Area(0, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TOP_CENTER).setColour(11184810); - new ControlText(this, new Area(0, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TOP_CENTER).setColour(11184810); + new ControlText(this, new Area(ControlPunnett.boxWidth, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TOP_CENTER).setColor(11184810); + new ControlText(this, new Area(ControlPunnett.boxWidth * 2, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TOP_CENTER).setColor(11184810); + new ControlText(this, new Area(0, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TOP_CENTER).setColor(11184810); + new ControlText(this, new Area(0, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TOP_CENTER).setColor(11184810); } } diff --git a/src/main/java/binnie/genetics/gui/punnett/WindowPunnettSquare.java b/src/main/java/binnie/genetics/gui/punnett/WindowPunnettSquare.java index de242bde..8e0f69a7 100644 --- a/src/main/java/binnie/genetics/gui/punnett/WindowPunnettSquare.java +++ b/src/main/java/binnie/genetics/gui/punnett/WindowPunnettSquare.java @@ -33,12 +33,12 @@ public class WindowPunnettSquare extends Window { @Nullable ISpeciesRoot root; - public WindowPunnettSquare(final EntityPlayer player, final IInventory inventory, final Side side) { + public WindowPunnettSquare(EntityPlayer player, IInventory inventory, Side side) { super(245, 205, player, inventory, side); - this.root = null; + root = null; } - public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) { + public static Window create(EntityPlayer player, IInventory inventory, Side side) { return new WindowPunnettSquare(player, inventory, side); } @@ -55,16 +55,16 @@ public class WindowPunnettSquare extends Window { @Override @SideOnly(Side.CLIENT) public void initialiseClient() { - this.setTitle("Punnett Square"); + setTitle("Punnett Square"); CraftGUI.render.setStyleSheet(new StyleSheetPunnett()); } static class StyleSheetPunnett extends StyleSheet { public StyleSheetPunnett() { - this.textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, texture, 32, 32, 32, 32)); - this.textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, texture)); - this.textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, texture)); - this.textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, texture)); + textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, texture, 32, 32, 32, 32)); + textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, texture)); + textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, texture)); + textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, texture)); } } diff --git a/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java b/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java index 0ad818ce..20abd1d0 100644 --- a/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java +++ b/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java @@ -32,12 +32,12 @@ import binnie.genetics.gui.ControlBiome; import binnie.genetics.gui.ControlToleranceBar; public class AnalystPageClimate extends ControlAnalystPage { - public AnalystPageClimate(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageClimate(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(26163); - final EnumTemperature temp = ind.getGenome().getPrimary().getTemperature(); + setColor(26163); + EnumTemperature temp = ind.getGenome().getPrimary().getTemperature(); EnumTolerance tempTol = EnumTolerance.NONE; - final EnumHumidity humid = ind.getGenome().getPrimary().getHumidity(); + EnumHumidity humid = ind.getGenome().getPrimary().getHumidity(); EnumTolerance humidTol = EnumTolerance.NONE; if (ind instanceof IBee) { tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE)).getValue(); @@ -52,28 +52,28 @@ public class AnalystPageClimate extends ControlAnalystPage { humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE)).getValue(); } int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.temp"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.temp"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - this.createTemperatureBar(this, (this.width() - 100) / 2, y, 100, 10, temp, tempTol); + createTemperatureBar(this, (width() - 100) / 2, y, 100, 10, temp, tempTol); y += 16; if (!(ind instanceof IFlower)) { - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.hum"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.hum"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - this.createHumidity(this, (this.width() - 100) / 2, y, 100, 10, humid, humidTol); + createHumidity(this, (width() - 100) / 2, y, 100, 10, humid, humidTol); y += 16; } - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.biomes"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.biomes"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - final List biomes = new ArrayList<>(); - for (final Biome biome : Biome.EXPLORATION_BIOMES_LIST) { //TODO check + List biomes = new ArrayList<>(); + for (Biome biome : Biome.EXPLORATION_BIOMES_LIST) { //TODO check if (biome != null && biome != Biomes.FROZEN_OCEAN && Tolerance.canTolerate(temp, EnumTemperature.getFromBiome(biome), tempTol) && Tolerance.canTolerate(humid, EnumHumidity.getFromValue(biome.getRainfall()), humidTol)) { boolean match = false; - for (final Biome eBiome : biomes) { + for (Biome eBiome : biomes) { if (biome.getBiomeName().contains(eBiome.getBiomeName()) && EnumHumidity.getFromValue(eBiome.getRainfall()) == EnumHumidity.getFromValue(biome.getRainfall()) && EnumTemperature.getFromBiome(eBiome) == EnumTemperature.getFromBiome(biome)) { match = true; } @@ -83,11 +83,11 @@ public class AnalystPageClimate extends ControlAnalystPage { } } } - final int maxBiomePerLine = (this.width() + 2 - 16) / 18; - final int biomeListX = (this.width() - (Math.min(maxBiomePerLine, biomes.size()) * 18 - 2)) / 2; + int maxBiomePerLine = (width() + 2 - 16) / 18; + int biomeListX = (width() - (Math.min(maxBiomePerLine, biomes.size()) * 18 - 2)) / 2; int dx = 0; int dy = 0; - for (final Biome biome2 : biomes) { + for (Biome biome2 : biomes) { new ControlBiome(this, biomeListX + dx, y + dy, 16, 16, biome2); dx += 18; if (dx >= 18 * maxBiomePerLine) { @@ -95,32 +95,32 @@ public class AnalystPageClimate extends ControlAnalystPage { dy += 18; } } - this.setSize(new Point(this.width(), y + dy + 18 + 8)); + setSize(new Point(width(), y + dy + 18 + 8)); } - protected void createTemperatureBar(final IWidget parent, final int x, final int y, final int w, final int h, final EnumTemperature value, final EnumTolerance tol) { + protected void createTemperatureBar(IWidget parent, int x, int y, int w, int h, EnumTemperature value, EnumTolerance tol) { new ControlToleranceBar(parent, x, y, w, h, EnumTemperature.class) { @Override - protected String getName(final EnumTemperature value) { + protected String getName(EnumTemperature value) { return value.name; } @Override - protected int getColour(final EnumTemperature value) { + protected int getColour(EnumTemperature value) { return (new int[]{65531, 7912447, 5242672, 16776960, 16753152, 16711680})[value.ordinal() - 1]; } }.setValues(value, tol); } - protected void createHumidity(final IWidget parent, final int x, final int y, final int w, final int h, final EnumHumidity value, final EnumTolerance tol) { + protected void createHumidity(IWidget parent, int x, int y, int w, int h, EnumHumidity value, EnumTolerance tol) { new ControlToleranceBar(parent, x, y, w, h, EnumHumidity.class) { @Override - protected String getName(final EnumHumidity value) { + protected String getName(EnumHumidity value) { return value.name; } @Override - protected int getColour(final EnumHumidity value) { + protected int getColour(EnumHumidity value) { return (new int[]{16770979, 1769216, 3177727})[value.ordinal()]; } }.setValues(value, tol); diff --git a/src/main/java/binnie/genetics/gui/tree/AnalystPageFruit.java b/src/main/java/binnie/genetics/gui/tree/AnalystPageFruit.java index 13516a1e..0755c7c5 100644 --- a/src/main/java/binnie/genetics/gui/tree/AnalystPageFruit.java +++ b/src/main/java/binnie/genetics/gui/tree/AnalystPageFruit.java @@ -30,24 +30,24 @@ import binnie.core.util.UniqueItemStackSet; import binnie.genetics.gui.AnalystPageProduce; public class AnalystPageFruit extends AnalystPageProduce { - public AnalystPageFruit(final IWidget parent, final Area area, final ITree ind) { + public AnalystPageFruit(IWidget parent, Area area, ITree ind) { super(parent, area); - this.setColour(13382400); - final ITreeGenome genome = ind.getGenome(); + setColor(13382400); + ITreeGenome genome = ind.getGenome(); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.fruit.yield") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD))).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.fruit.yield") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD))).setColor(getColor()); y += 20; - final Collection products = new UniqueItemStackSet(); - final Collection specialties = new UniqueItemStackSet(); - final Collection wiid = new UniqueItemStackSet(); + Collection products = new UniqueItemStackSet(); + Collection specialties = new UniqueItemStackSet(); + Collection wiid = new UniqueItemStackSet(); products.addAll(ind.getProducts().keySet()); specialties.addAll(ind.getSpecialties().keySet()); try { if (ind.getGenome().getFruitProvider() instanceof FruitProviderPod) { - final FruitProviderPod pod = (FruitProviderPod) ind.getGenome().getFruitProvider(); - final Field f = FruitProviderPod.class.getDeclaredField("drops"); + FruitProviderPod pod = (FruitProviderPod) ind.getGenome().getFruitProvider(); + Field f = FruitProviderPod.class.getDeclaredField("drops"); f.setAccessible(true); Collections.addAll(products, ((Map) f.get(pod)).keySet().toArray(new ItemStack[0])); } @@ -55,48 +55,48 @@ public class AnalystPageFruit extends AnalystPageProduce { throw Throwables.propagate(e); } if (products.size() > 0) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.natural")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.natural")).setColor(getColor()); y += 10; - final int w = products.size() * 18 - 2; - final int i = 0; - for (final ItemStack stack : products) { - final ControlItemDisplay d = new ControlItemDisplay(this, (this.width() - w) / 2 + 18 * i, y); + int w = products.size() * 18 - 2; + int i = 0; + for (ItemStack stack : products) { + ControlItemDisplay d = new ControlItemDisplay(this, (width() - w) / 2 + 18 * i, y); d.setTooltip(); d.setItemStack(stack); } y += 26; } if (specialties.size() > 0) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.specialty")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.specialty")).setColor(getColor()); y += 10; - final int w = products.size() * 18 - 2; - final int i = 0; - for (final ItemStack stack : specialties) { - final ControlItemDisplay d = new ControlItemDisplay(this, (this.width() - w) / 2 + 18 * i, y); + int w = products.size() * 18 - 2; + int i = 0; + for (ItemStack stack : specialties) { + ControlItemDisplay d = new ControlItemDisplay(this, (width() - w) / 2 + 18 * i, y); d.setTooltip(); d.setItemStack(stack); } y += 26; } - final Collection allProducts = new UniqueItemStackSet(); + Collection allProducts = new UniqueItemStackSet(); allProducts.addAll(products); allProducts.addAll(specialties); - final Collection refinedProducts = new UniqueItemStackSet(); - refinedProducts.addAll(this.getAllProductsAndFluids(allProducts)); + Collection refinedProducts = new UniqueItemStackSet(); + refinedProducts.addAll(getAllProductsAndFluids(allProducts)); if (refinedProducts.size() > 0) { - y = this.getRefined(I18N.localise("genetics.gui.analyst.fruit.refined"), y, refinedProducts); + y = getRefined(I18N.localise("genetics.gui.analyst.fruit.refined"), y, refinedProducts); y += 8; } if (products.size() == 0 && specialties.size() == 0) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.noFruits")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.noFruits")).setColor(getColor()); y += 28; } - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.possible")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.possible")).setColor(getColor()); y += 12; - final Collection fruitAlleles = Binnie.GENETICS.getChromosomeMap(Binnie.GENETICS.getTreeRoot()).get(EnumTreeChromosome.FRUITS); - for (final IFruitFamily fam : ind.getGenome().getPrimary().getSuitableFruit()) { - final Collection stacks = new UniqueItemStackSet(); - for (final IAllele a : fruitAlleles) { + Collection fruitAlleles = Binnie.GENETICS.getChromosomeMap(Binnie.GENETICS.getTreeRoot()).get(EnumTreeChromosome.FRUITS); + for (IFruitFamily fam : ind.getGenome().getPrimary().getSuitableFruit()) { + Collection stacks = new UniqueItemStackSet(); + for (IAllele a : fruitAlleles) { if (((IAlleleFruit) a).getProvider().getFamily() == fam) { stacks.addAll(((IAlleleFruit) a).getProvider().getProducts().keySet()); stacks.addAll(((IAlleleFruit) a).getProvider().getSpecialty().keySet()); @@ -107,8 +107,8 @@ public class AnalystPageFruit extends AnalystPageProduce { if (!(((IAlleleFruit) a).getProvider() instanceof FruitProviderPod)) { continue; } - final FruitProviderPod pod2 = (FruitProviderPod) ((IAlleleFruit) a).getProvider(); - final Field field = FruitProviderPod.class.getDeclaredField("drops"); + FruitProviderPod pod2 = (FruitProviderPod) ((IAlleleFruit) a).getProvider(); + Field field = FruitProviderPod.class.getDeclaredField("drops"); field.setAccessible(true); Collections.addAll(stacks, ((Map) field.get(pod2)).keySet().toArray(new ItemStack[0])); } @@ -117,10 +117,10 @@ public class AnalystPageFruit extends AnalystPageProduce { } } } - y = this.getRefined(TextFormatting.ITALIC + fam.getName(), y, stacks); + y = getRefined(TextFormatting.ITALIC + fam.getName(), y, stacks); y += 2; } - this.setSize(new Point(this.width(), y + 8)); + setSize(new Point(width(), y + 8)); } @Override diff --git a/src/main/java/binnie/genetics/gui/tree/AnalystPageGrowth.java b/src/main/java/binnie/genetics/gui/tree/AnalystPageGrowth.java index 4094667e..04cd9277 100644 --- a/src/main/java/binnie/genetics/gui/tree/AnalystPageGrowth.java +++ b/src/main/java/binnie/genetics/gui/tree/AnalystPageGrowth.java @@ -15,23 +15,23 @@ import binnie.core.util.I18N; import binnie.genetics.gui.ControlAnalystPage; public class AnalystPageGrowth extends ControlAnalystPage { - public AnalystPageGrowth(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageGrowth(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(3355443); + setColor(3355443); int y = 4; - final IAlleleSpecies species = ind.getGenome().getPrimary(); - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + IAlleleSpecies species = ind.getGenome().getPrimary(); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; if (ind instanceof ITree) { - final ITree tree = (ITree) ind; - final int mat = tree.getGenome().getMaturationTime(); - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.mature")).setColour(this.getColour()); + ITree tree = (ITree) ind; + int mat = tree.getGenome().getMaturationTime(); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.mature")).setColor(getColor()); y += 12; - new ControlTextCentered(this, y, TextFormatting.BOLD + this.getTimeString(Math.round(1373.3999f * mat))).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.BOLD + getTimeString(Math.round(1373.3999f * mat))).setColor(getColor()); y += 22; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.height") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT))).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.height") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT))).setColor(getColor()); y += 12; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.girth") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH))).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.girth") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH))).setColor(getColor()); } } diff --git a/src/main/java/binnie/genetics/gui/tree/AnalystPageWood.java b/src/main/java/binnie/genetics/gui/tree/AnalystPageWood.java index 06e87f5c..c7eb6830 100644 --- a/src/main/java/binnie/genetics/gui/tree/AnalystPageWood.java +++ b/src/main/java/binnie/genetics/gui/tree/AnalystPageWood.java @@ -27,12 +27,12 @@ import binnie.genetics.item.ModuleItems; @SideOnly(Side.CLIENT) public class AnalystPageWood extends AnalystPageProduce { - public AnalystPageWood(final IWidget parent, final Area area, final ITree ind) { + public AnalystPageWood(IWidget parent, Area area, ITree ind) { super(parent, area); - this.setColour(6697728); - final ITreeGenome genome = ind.getGenome(); + setColor(6697728); + ITreeGenome genome = ind.getGenome(); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; if (((IAlleleBoolean) ind.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF)).getValue()) { new ControlIconDisplay(this, (width() - 16) / 2, y, ModuleItems.iconNoFire).addTooltip(I18N.localise("genetics.gui.analyst.wood.fireproof")); @@ -40,39 +40,39 @@ public class AnalystPageWood extends AnalystPageProduce { new ControlIconDisplay(this, (width() - 16) / 2, y, ModuleItems.iconFire).addTooltip(I18N.localise("genetics.gui.analyst.wood.flammable")); } y += 30; - final Collection products = new UniqueItemStackSet(); + Collection products = new UniqueItemStackSet(); - final IAlleleTreeSpecies treeSpecies = genome.getPrimary(); - final ItemStack stackWood = treeSpecies.getWoodProvider().getWoodStack(); + IAlleleTreeSpecies treeSpecies = genome.getPrimary(); + ItemStack stackWood = treeSpecies.getWoodProvider().getWoodStack(); if (!stackWood.isEmpty()) { products.add(stackWood); } products.addAll(ind.getGenome().getFruitProvider().getProducts().keySet()); if (products.size() > 0) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.logs")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.logs")).setColor(getColor()); y += 10; - final int w = products.size() * 18 - 2; - final int i = 0; - for (final ItemStack stack : products) { - final ControlItemDisplay d = new ControlItemDisplay(this, (this.width() - w) / 2 + 18 * i, y); + int w = products.size() * 18 - 2; + int i = 0; + for (ItemStack stack : products) { + ControlItemDisplay d = new ControlItemDisplay(this, (width() - w) / 2 + 18 * i, y); d.setTooltip(); d.setItemStack(stack); } y += 26; } - final Collection allProducts = new UniqueItemStackSet(); + Collection allProducts = new UniqueItemStackSet(); allProducts.addAll(products); - final Collection refinedProducts = new UniqueItemStackSet(); - refinedProducts.addAll(this.getAllProductsAndFluids(allProducts)); + Collection refinedProducts = new UniqueItemStackSet(); + refinedProducts.addAll(getAllProductsAndFluids(allProducts)); if (refinedProducts.size() > 0) { - y = this.getRefined(I18N.localise("genetics.gui.analyst.wood.refined"), y, refinedProducts); + y = getRefined(I18N.localise("genetics.gui.analyst.wood.refined"), y, refinedProducts); y += 8; } if (products.size() == 0) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.noFruits")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.noFruits")).setColor(getColor()); y += 28; } - this.setSize(new Point(this.width(), y + 8)); + setSize(new Point(width(), y + 8)); } @Override diff --git a/src/main/java/binnie/genetics/item/ItemAnalyst.java b/src/main/java/binnie/genetics/item/ItemAnalyst.java index e2014e7b..9477bcf4 100644 --- a/src/main/java/binnie/genetics/item/ItemAnalyst.java +++ b/src/main/java/binnie/genetics/item/ItemAnalyst.java @@ -27,7 +27,7 @@ public class ItemAnalyst extends ItemCore { @Override public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { - Genetics.proxy.openGui(GeneticsGUI.Analyst, playerIn, playerIn.getPosition()); + Genetics.proxy.openGui(GeneticsGUI.ANALYST, playerIn, playerIn.getPosition()); return super.onItemRightClick(worldIn, playerIn, handIn); } diff --git a/src/main/java/binnie/genetics/item/ItemBeeDictionary.java b/src/main/java/binnie/genetics/item/ItemBeeDictionary.java index 19a04fb0..3aa61658 100644 --- a/src/main/java/binnie/genetics/item/ItemBeeDictionary.java +++ b/src/main/java/binnie/genetics/item/ItemBeeDictionary.java @@ -56,9 +56,9 @@ public class ItemBeeDictionary extends Item implements IItemModelRegister { final ItemStack itemStack = playerIn.getHeldItem(handIn); final GeneticsGUI id; if (itemStack.getItemDamage() == 0) { - id = GeneticsGUI.BeeDatabase; + id = GeneticsGUI.BEE_DATABASE; } else { - id = GeneticsGUI.BeeDatabaseNEI; + id = GeneticsGUI.BEE_DATABASE_NEI; } Genetics.proxy.openGui(id, playerIn, playerIn.getPosition()); diff --git a/src/main/java/binnie/genetics/item/ItemDatabase.java b/src/main/java/binnie/genetics/item/ItemDatabase.java index 387b2042..3faae161 100644 --- a/src/main/java/binnie/genetics/item/ItemDatabase.java +++ b/src/main/java/binnie/genetics/item/ItemDatabase.java @@ -48,9 +48,9 @@ public class ItemDatabase extends ItemCore { ItemStack itemStack = player.getHeldItem(hand); final GeneticsGUI id; if (isMaster(itemStack)) { - id = GeneticsGUI.DatabaseNEI; + id = GeneticsGUI.DATABASE_NEI; } else { - id = GeneticsGUI.Database; + id = GeneticsGUI.DATABASE; } Genetics.proxy.openGui(id, player, player.getPosition()); diff --git a/src/main/java/binnie/genetics/item/ItemGene.java b/src/main/java/binnie/genetics/item/ItemGene.java index f1886ef6..6d10c2f3 100644 --- a/src/main/java/binnie/genetics/item/ItemGene.java +++ b/src/main/java/binnie/genetics/item/ItemGene.java @@ -65,7 +65,7 @@ public abstract class ItemGene extends ItemCore implements IColoredItem { public int getColorFromItemstack(ItemStack stack, int tintIndex) { IGeneItem gene = this.getGeneItem(stack); if (gene != null) { - return gene.getColour(tintIndex); + return gene.getColor(tintIndex); } return 16777215; } diff --git a/src/main/java/binnie/genetics/item/ItemMasterRegistry.java b/src/main/java/binnie/genetics/item/ItemMasterRegistry.java index fbb7767b..dcb6cf41 100644 --- a/src/main/java/binnie/genetics/item/ItemMasterRegistry.java +++ b/src/main/java/binnie/genetics/item/ItemMasterRegistry.java @@ -27,7 +27,7 @@ public class ItemMasterRegistry extends ItemCore { @Override public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { - Genetics.proxy.openGui(GeneticsGUI.MasterRegistry, playerIn, playerIn.getPosition()); + Genetics.proxy.openGui(GeneticsGUI.MASTER_REGISTRY, playerIn, playerIn.getPosition()); return super.onItemRightClick(worldIn, playerIn, handIn); } diff --git a/src/main/java/binnie/genetics/item/ItemPunnettSquare.java b/src/main/java/binnie/genetics/item/ItemPunnettSquare.java index 0f091a1e..296413b0 100644 --- a/src/main/java/binnie/genetics/item/ItemPunnettSquare.java +++ b/src/main/java/binnie/genetics/item/ItemPunnettSquare.java @@ -28,7 +28,7 @@ public class ItemPunnettSquare extends Item { @Override public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if (handIn == EnumHand.MAIN_HAND) { - Genetics.proxy.openGui(GeneticsGUI.PunnettSquare, playerIn, playerIn.getPosition()); + Genetics.proxy.openGui(GeneticsGUI.PUNNETT_SQUARE, playerIn, playerIn.getPosition()); } ItemStack itemStack = playerIn.getHeldItem(handIn); return new ActionResult<>(EnumActionResult.PASS, itemStack); diff --git a/src/main/java/binnie/genetics/item/ItemRegistry.java b/src/main/java/binnie/genetics/item/ItemRegistry.java index b19c26c9..8c763924 100644 --- a/src/main/java/binnie/genetics/item/ItemRegistry.java +++ b/src/main/java/binnie/genetics/item/ItemRegistry.java @@ -27,7 +27,7 @@ public class ItemRegistry extends ItemCore { @Override public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { - Genetics.proxy.openGui(GeneticsGUI.Registry, playerIn, playerIn.getPosition()); + Genetics.proxy.openGui(GeneticsGUI.REGISTRY, playerIn, playerIn.getPosition()); return super.onItemRightClick(worldIn, playerIn, handIn); } diff --git a/src/main/java/binnie/genetics/item/ItemSequence.java b/src/main/java/binnie/genetics/item/ItemSequence.java index 8dd49ede..fb85aac7 100644 --- a/src/main/java/binnie/genetics/item/ItemSequence.java +++ b/src/main/java/binnie/genetics/item/ItemSequence.java @@ -111,18 +111,18 @@ public class ItemSequence extends ItemCore implements IItemAnalysable, IItemChar } @Override - public int getCharges(final ItemStack itemStack) { - return itemStack.getMaxDamage() - itemStack.getItemDamage(); + public int getCharges(final ItemStack stack) { + return stack.getMaxDamage() - stack.getItemDamage(); } @Override - public int getMaxCharges(ItemStack itemStack) { - return itemStack.getMaxDamage(); + public int getMaxCharges(ItemStack stack) { + return stack.getMaxDamage(); } @Override - public ISpeciesRoot getSpeciesRoot(ItemStack itemStack) { - final SequencerItem seq = SequencerItem.create(itemStack); + public ISpeciesRoot getSpeciesRoot(ItemStack stack) { + final SequencerItem seq = SequencerItem.create(stack); Preconditions.checkNotNull(seq, "Cannot getSpeciesRoot from itemstack that is not a valid item sequence"); return seq.getSpeciesRoot(); } diff --git a/src/main/java/binnie/genetics/item/ItemSerum.java b/src/main/java/binnie/genetics/item/ItemSerum.java index a5d188b3..c3d58925 100644 --- a/src/main/java/binnie/genetics/item/ItemSerum.java +++ b/src/main/java/binnie/genetics/item/ItemSerum.java @@ -44,13 +44,13 @@ public class ItemSerum extends ItemGene implements IItemSerum { } @Override - public int getCharges(ItemStack itemStack) { - return itemStack.getMaxDamage() - itemStack.getItemDamage(); + public int getCharges(ItemStack stack) { + return stack.getMaxDamage() - stack.getItemDamage(); } @Override - public int getMaxCharges(ItemStack itemStack) { - return itemStack.getMaxDamage(); + public int getMaxCharges(ItemStack stack) { + return stack.getMaxDamage(); } @SideOnly(Side.CLIENT) @@ -72,15 +72,15 @@ public class ItemSerum extends ItemGene implements IItemSerum { } @Override - public IGene[] getGenes(ItemStack itemStack) { - GeneItem geneItem = this.getGeneItem(itemStack); + public IGene[] getGenes(ItemStack stack) { + GeneItem geneItem = this.getGeneItem(stack); Preconditions.checkNotNull(geneItem, "Cannot get genes from itemStack that is not a valid serum."); return new IGene[]{geneItem.getGene()}; } @Override - public ISpeciesRoot getSpeciesRoot(ItemStack itemStack) { - GeneItem geneItem = this.getGeneItem(itemStack); + public ISpeciesRoot getSpeciesRoot(ItemStack stack) { + GeneItem geneItem = this.getGeneItem(stack); Preconditions.checkNotNull(geneItem, "Cannot get species root from itemStack that is not a valid serum."); return geneItem.getSpeciesRoot(); } diff --git a/src/main/java/binnie/genetics/item/ItemSerumArray.java b/src/main/java/binnie/genetics/item/ItemSerumArray.java index fa155e34..eb9cf26e 100644 --- a/src/main/java/binnie/genetics/item/ItemSerumArray.java +++ b/src/main/java/binnie/genetics/item/ItemSerumArray.java @@ -44,13 +44,13 @@ public class ItemSerumArray extends ItemGene implements IItemSerum { } @Override - public int getCharges(final ItemStack itemStack) { - return itemStack.getMaxDamage() - itemStack.getItemDamage(); + public int getCharges(final ItemStack stack) { + return stack.getMaxDamage() - stack.getItemDamage(); } @Override - public int getMaxCharges(ItemStack itemStack) { - return itemStack.getMaxDamage(); + public int getMaxCharges(ItemStack stack) { + return stack.getMaxDamage(); } @Override diff --git a/src/main/java/binnie/genetics/machine/LaboratoryMachine.java b/src/main/java/binnie/genetics/machine/LaboratoryMachine.java index f2f569fd..1ad48c6e 100644 --- a/src/main/java/binnie/genetics/machine/LaboratoryMachine.java +++ b/src/main/java/binnie/genetics/machine/LaboratoryMachine.java @@ -53,7 +53,7 @@ public enum LaboratoryMachine implements IMachineType { public static class PackageLabMachine extends GeneticMachine.PackageGeneticBase { public PackageLabMachine() { - super("lab_machine", GeneticsTexture.LabMachine, 16777215, false); + super("lab_machine", GeneticsTexture.LAB_MACHINE, 16777215, false); } @Override diff --git a/src/main/java/binnie/genetics/machine/acclimatiser/PackageAcclimatiser.java b/src/main/java/binnie/genetics/machine/acclimatiser/PackageAcclimatiser.java index 09782015..653fc726 100644 --- a/src/main/java/binnie/genetics/machine/acclimatiser/PackageAcclimatiser.java +++ b/src/main/java/binnie/genetics/machine/acclimatiser/PackageAcclimatiser.java @@ -18,12 +18,12 @@ import binnie.genetics.machine.GeneticMachine; public class PackageAcclimatiser extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageAcclimatiser() { - super("acclimatiser", GeneticsTexture.Acclimatiser, 9857609, true); + super("acclimatiser", GeneticsTexture.ACCLIMATISER, 9857609, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Acclimatiser); + new ComponentGeneticGUI(machine, GeneticsGUI.ACCLIMATISER); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotTarget = inventory.addSlot(Acclimatiser.SLOT_TARGET, "process"); slotTarget.setValidator(new SlotValidator.Individual()); diff --git a/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java b/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java index 9596e72e..ba2efab6 100644 --- a/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java +++ b/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java @@ -22,8 +22,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowAcclimatiser extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 64, 64, 64, GeneticsTexture.GUIProcess3); - static Texture Progress = new StandardTexture(0, 64, 64, 64, GeneticsTexture.GUIProcess3); + static Texture ProgressBase = new StandardTexture(0, 64, 64, 64, GeneticsTexture.GUI_PROCESS_3); + static Texture Progress = new StandardTexture(0, 64, 64, 64, GeneticsTexture.GUI_PROCESS_3); public WindowAcclimatiser(final EntityPlayer player, final IInventory inventory, final Side side) { super(280, 198, player, inventory, side); diff --git a/src/main/java/binnie/genetics/machine/analyser/PackageAnalyser.java b/src/main/java/binnie/genetics/machine/analyser/PackageAnalyser.java index 7520b461..72540238 100644 --- a/src/main/java/binnie/genetics/machine/analyser/PackageAnalyser.java +++ b/src/main/java/binnie/genetics/machine/analyser/PackageAnalyser.java @@ -21,12 +21,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackageAnalyser extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageAnalyser() { - super("analyser", GeneticsTexture.Analyser, 9961727, true); + super("analyser", GeneticsTexture.ANALYSER, 9961727, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Analyser); + new ComponentGeneticGUI(machine, GeneticsGUI.ANALYSER); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); for (InventorySlot slot : inventory.addSlotArray(Analyser.SLOT_RESERVE, "input")) { slot.setValidator(new SlotValidatorUnanalysed()); diff --git a/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java b/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java index 6915ec91..efbefdd9 100644 --- a/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java +++ b/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java @@ -27,8 +27,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowAnalyser extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, GeneticsTexture.GUIProcess3); - static Texture Progress = new StandardTexture(0, 201, 142, 17, GeneticsTexture.GUIProcess3); + static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, GeneticsTexture.GUI_PROCESS_3); + static Texture Progress = new StandardTexture(0, 201, 142, 17, GeneticsTexture.GUI_PROCESS_3); public WindowAnalyser(final EntityPlayer player, final IInventory inventory, final Side side) { super(220, 210, player, inventory, side); @@ -38,14 +38,14 @@ public class WindowAnalyser extends WindowMachine { @SideOnly(Side.CLIENT) public void initialiseClient() { super.initialiseClient(); - WindowAnalyser.ProgressBase = new StandardTexture(0, 51, 66, 40, GeneticsTexture.GUIProcess); - WindowAnalyser.Progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUIProcess); + WindowAnalyser.ProgressBase = new StandardTexture(0, 51, 66, 40, GeneticsTexture.GUI_PROCESS); + WindowAnalyser.Progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUI_PROCESS); int x = 16; final int y = 32; new ControlSlotArray.Builder(this, x, y, 2, 3).create(Analyser.SLOT_RESERVE); x += 28; new ControlSlot.Builder(this, x, y + 54 + 8).assign(13); - new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColour(10040319); + new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColor(10040319); new ControlEnergyBar(this, x + 24 + 16, y + 54 + 8 + 1, 60, 16, Position.LEFT); new ControlErrorState(this, x + 24 + 16 + 60 + 16, y + 54 + 8 + 1); x -= 28; diff --git a/src/main/java/binnie/genetics/machine/genepool/PackageGenepool.java b/src/main/java/binnie/genetics/machine/genepool/PackageGenepool.java index ed0148d5..51e5fe13 100644 --- a/src/main/java/binnie/genetics/machine/genepool/PackageGenepool.java +++ b/src/main/java/binnie/genetics/machine/genepool/PackageGenepool.java @@ -28,12 +28,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackageGenepool extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageGenepool() { - super("genepool", GeneticsTexture.Genepool, 12661942, true); + super("genepool", GeneticsTexture.GENEPOOL, 12661942, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Genepool); + new ComponentGeneticGUI(machine, GeneticsGUI.GENEPOOL); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotEnzyme = inventory.addSlot(Genepool.SLOT_ENZYME, "enzyme"); slotEnzyme.setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.spriteEnzyme)); diff --git a/src/main/java/binnie/genetics/machine/genepool/WindowGenepool.java b/src/main/java/binnie/genetics/machine/genepool/WindowGenepool.java index 7aa9dce8..ee645600 100644 --- a/src/main/java/binnie/genetics/machine/genepool/WindowGenepool.java +++ b/src/main/java/binnie/genetics/machine/genepool/WindowGenepool.java @@ -26,8 +26,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowGenepool extends WindowMachine { - static Texture ProgressBase = new StandardTexture(64, 0, 130, 21, GeneticsTexture.GUIProcess3); - static Texture Progress = new StandardTexture(64, 21, 130, 21, GeneticsTexture.GUIProcess3); + static Texture ProgressBase = new StandardTexture(64, 0, 130, 21, GeneticsTexture.GUI_PROCESS_3); + static Texture Progress = new StandardTexture(64, 21, 130, 21, GeneticsTexture.GUI_PROCESS_3); public WindowGenepool(final EntityPlayer player, final IInventory inventory, final Side side) { super(280, 198, player, inventory, side); @@ -52,7 +52,7 @@ public class WindowGenepool extends WindowMachine { new ControlLiquidTank(this, x, y).setTankID(0); new ControlEnergyBar(this, 21, 115, 16, 60, Position.BOTTOM); new ControlSlot.Builder(this, 121, 82).assign(7); - new ControlSlotCharge(this, 143, 82, 7).setColour(15722671); + new ControlSlotCharge(this, 143, 82, 7).setColor(15722671); new ControlErrorState(this, 181, 83); new ControlPlayerInventory(this); } diff --git a/src/main/java/binnie/genetics/machine/incubator/PackageIncubator.java b/src/main/java/binnie/genetics/machine/incubator/PackageIncubator.java index 81d9de83..8af3ffc5 100644 --- a/src/main/java/binnie/genetics/machine/incubator/PackageIncubator.java +++ b/src/main/java/binnie/genetics/machine/incubator/PackageIncubator.java @@ -16,12 +16,12 @@ import binnie.genetics.machine.GeneticMachine; public class PackageIncubator extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageIncubator() { - super("incubator", GeneticsTexture.Incubator, 16767313, true); + super("incubator", GeneticsTexture.INCUBATOR, 16767313, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Incubator); + new ComponentGeneticGUI(machine, GeneticsGUI.INCUBATOR); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); for (InventorySlot slot : inventory.addSlotArray(Incubator.SLOT_QUEUE, "input")) { slot.forbidExtraction(); diff --git a/src/main/java/binnie/genetics/machine/incubator/WindowIncubator.java b/src/main/java/binnie/genetics/machine/incubator/WindowIncubator.java index dbcdbf12..58dc2cb5 100644 --- a/src/main/java/binnie/genetics/machine/incubator/WindowIncubator.java +++ b/src/main/java/binnie/genetics/machine/incubator/WindowIncubator.java @@ -25,8 +25,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowIncubator extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 91, 38, 32, GeneticsTexture.GUIProcess); - static Texture Progress = new StandardTexture(38, 91, 38, 32, GeneticsTexture.GUIProcess); + static Texture ProgressBase = new StandardTexture(0, 91, 38, 32, GeneticsTexture.GUI_PROCESS); + static Texture Progress = new StandardTexture(38, 91, 38, 32, GeneticsTexture.GUI_PROCESS); public WindowIncubator(final EntityPlayer player, final IInventory inventory, final Side side) { super(228, 196, player, inventory, side); diff --git a/src/main/java/binnie/genetics/machine/inoculator/PackageInoculator.java b/src/main/java/binnie/genetics/machine/inoculator/PackageInoculator.java index 273af27c..95c0e948 100644 --- a/src/main/java/binnie/genetics/machine/inoculator/PackageInoculator.java +++ b/src/main/java/binnie/genetics/machine/inoculator/PackageInoculator.java @@ -28,12 +28,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackageInoculator extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageInoculator() { - super("inoculator", GeneticsTexture.Inoculator, 14819893, true); + super("inoculator", GeneticsTexture.INOCULATOR, 14819893, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Inoculator); + new ComponentGeneticGUI(machine, GeneticsGUI.INOCULATOR); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotSerumVial = inventory.addSlot(Inoculator.SLOT_SERUM_VIAL, "serum.active"); slotSerumVial.forbidInteraction(); diff --git a/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java b/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java index f27fbe3f..bfb9a1d8 100644 --- a/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java +++ b/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java @@ -27,8 +27,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowInoculator extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUIProcess2); - static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUIProcess2); + static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUI_PROCESS_2); + static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUI_PROCESS_2); public WindowInoculator(final EntityPlayer player, final IInventory inventory, final Side side) { super(266, 240, player, inventory, side); diff --git a/src/main/java/binnie/genetics/machine/isolator/PackageIsolator.java b/src/main/java/binnie/genetics/machine/isolator/PackageIsolator.java index e5e1750f..bcd3b73e 100644 --- a/src/main/java/binnie/genetics/machine/isolator/PackageIsolator.java +++ b/src/main/java/binnie/genetics/machine/isolator/PackageIsolator.java @@ -29,12 +29,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackageIsolator extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageIsolator() { - super("isolator", GeneticsTexture.Isolator, 16740111, true); + super("isolator", GeneticsTexture.ISOLATOR, 16740111, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Isolator); + new ComponentGeneticGUI(machine, GeneticsGUI.ISOLATOR); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotEnzyme = inventory.addSlot(Isolator.SLOT_ENZYME, "enzyme"); slotEnzyme.setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.spriteEnzyme)); diff --git a/src/main/java/binnie/genetics/machine/isolator/WindowIsolator.java b/src/main/java/binnie/genetics/machine/isolator/WindowIsolator.java index 527b17ff..7dc329e7 100644 --- a/src/main/java/binnie/genetics/machine/isolator/WindowIsolator.java +++ b/src/main/java/binnie/genetics/machine/isolator/WindowIsolator.java @@ -26,8 +26,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowIsolator extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, GeneticsTexture.GUIProcess3); - static Texture Progress = new StandardTexture(0, 201, 142, 17, GeneticsTexture.GUIProcess3); + static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, GeneticsTexture.GUI_PROCESS_3); + static Texture Progress = new StandardTexture(0, 201, 142, 17, GeneticsTexture.GUI_PROCESS_3); public WindowIsolator(final EntityPlayer player, final IInventory inventory, final Side side) { super(330, 208, player, inventory, side); @@ -47,7 +47,7 @@ public class WindowIsolator extends WindowMachine { x += 18; new ControlSlot.Builder(this, x, y + 3).assign(5); new ControlSlot.Builder(this, x, y + 36 + 3).assign(0); - new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColour(15722671); + new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColor(15722671); x += 18; new ControlProgress(this, x, y + 3, WindowIsolator.ProgressBase, WindowIsolator.Progress, Position.LEFT); x += 142; diff --git a/src/main/java/binnie/genetics/machine/polymeriser/PackagePolymeriser.java b/src/main/java/binnie/genetics/machine/polymeriser/PackagePolymeriser.java index ab84487e..9583e12b 100644 --- a/src/main/java/binnie/genetics/machine/polymeriser/PackagePolymeriser.java +++ b/src/main/java/binnie/genetics/machine/polymeriser/PackagePolymeriser.java @@ -27,12 +27,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackagePolymeriser extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackagePolymeriser() { - super("polymeriser", GeneticsTexture.Polymeriser, 58819, true); + super("polymeriser", GeneticsTexture.POLYMERISER, 58819, true); } @Override public void createMachine(Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Replicator); + new ComponentGeneticGUI(machine, GeneticsGUI.POLYMERISER); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); //Slot Gold InventorySlot slotGold = inventory.addSlot(Polymeriser.SLOT_GOLD, "catalyst"); diff --git a/src/main/java/binnie/genetics/machine/polymeriser/WindowPolymeriser.java b/src/main/java/binnie/genetics/machine/polymeriser/WindowPolymeriser.java index 61568bf3..89dc3f49 100644 --- a/src/main/java/binnie/genetics/machine/polymeriser/WindowPolymeriser.java +++ b/src/main/java/binnie/genetics/machine/polymeriser/WindowPolymeriser.java @@ -26,8 +26,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowPolymeriser extends WindowMachine { - static Texture ProgressBase = new StandardTexture(76, 170, 160, 79, GeneticsTexture.GUIProcess); - static Texture Progress = new StandardTexture(76, 91, 160, 79, GeneticsTexture.GUIProcess); + static Texture ProgressBase = new StandardTexture(76, 170, 160, 79, GeneticsTexture.GUI_PROCESS); + static Texture Progress = new StandardTexture(76, 91, 160, 79, GeneticsTexture.GUI_PROCESS); public WindowPolymeriser(final EntityPlayer player, final IInventory inventory, final Side side) { super(278, 212, player, inventory, side); @@ -49,7 +49,7 @@ public class WindowPolymeriser extends WindowMachine { new ControlEnergyBar(this, x + 120, 96, 64, 16, Position.LEFT); x += 40; new ControlSlot.Builder(this, x + 30, y + 18 + 8).assign(1); - new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColour(16766976); + new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColor(16766976); x += 138; new ControlSlotArray.Builder(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED); final ControlErrorState errorState = new ControlErrorState(this, 244, 97); diff --git a/src/main/java/binnie/genetics/machine/sequencer/PackageSequencer.java b/src/main/java/binnie/genetics/machine/sequencer/PackageSequencer.java index df9f601d..b6223884 100644 --- a/src/main/java/binnie/genetics/machine/sequencer/PackageSequencer.java +++ b/src/main/java/binnie/genetics/machine/sequencer/PackageSequencer.java @@ -22,7 +22,7 @@ import binnie.genetics.machine.ModuleMachine; public class PackageSequencer extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageSequencer() { - super("sequencer", GeneticsTexture.Sequencer, 12058418, true); + super("sequencer", GeneticsTexture.SEQUENCER, 12058418, true); Sequencer.fxSeqA = Binnie.RESOURCE.getBlockSprite(Genetics.instance, "fx/sequencer.a"); Sequencer.fxSeqG = Binnie.RESOURCE.getBlockSprite(Genetics.instance, "fx/sequencer.g"); Sequencer.fxSeqT = Binnie.RESOURCE.getBlockSprite(Genetics.instance, "fx/sequencer.t"); @@ -31,7 +31,7 @@ public class PackageSequencer extends GeneticMachine.PackageGeneticBase implemen @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Sequencer); + new ComponentGeneticGUI(machine, GeneticsGUI.SEQUENCER); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotDye = inventory.addSlot(Sequencer.SLOT_DYE, "dye"); slotDye.setValidator(new SlotValidator.Item(GeneticsItems.FluorescentDye.get(1), ModuleMachine.spriteDye)); diff --git a/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java b/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java index 214d6e19..531fa03e 100644 --- a/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java +++ b/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java @@ -30,8 +30,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowSequencer extends WindowMachine { - static Texture ProgressBase = new StandardTexture(64, 114, 98, 9, GeneticsTexture.GUIProcess3); - static Texture Progress = new StandardTexture(64, 123, 98, 9, GeneticsTexture.GUIProcess3); + static Texture ProgressBase = new StandardTexture(64, 114, 98, 9, GeneticsTexture.GUI_PROCESS_3); + static Texture Progress = new StandardTexture(64, 123, 98, 9, GeneticsTexture.GUI_PROCESS_3); ControlText slotText; public WindowSequencer(final EntityPlayer player, final IInventory inventory, final Side side) { @@ -67,7 +67,7 @@ public class WindowSequencer extends WindowMachine { y += 20; final ControlSlot slotDye = new ControlSlot.Builder(this, x, y).assign(0); x += 20; - new ControlSlotCharge(this, x, y, 0).setColour(16750848); + new ControlSlotCharge(this, x, y, 0).setColor(16750848); x += 32; new ControlEnergyBar(this, x, y, 60, 16, Position.LEFT); x += 92; diff --git a/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java b/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java index 2c27ffc8..22fd2287 100644 --- a/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java +++ b/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java @@ -24,12 +24,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackageSplicer extends AdvGeneticMachine.PackageAdvGeneticBase implements IMachineInformation { public PackageSplicer() { - super("splicer", GeneticsTexture.Splicer, 14819893, true); + super("splicer", GeneticsTexture.SPLICER, 14819893, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Splicer); + new ComponentGeneticGUI(machine, GeneticsGUI.SPLICER); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotSerumVial = inventory.addSlot(Splicer.SLOT_SERUM_VIAL, "serum.active"); slotSerumVial.forbidInteraction(); diff --git a/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java b/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java index 91702b58..75a3d94f 100644 --- a/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java +++ b/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java @@ -26,8 +26,8 @@ import binnie.genetics.machine.craftgui.WindowMachine; import binnie.genetics.machine.inoculator.Inoculator; public class WindowSplicer extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUIProcess2); - static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUIProcess2); + static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUI_PROCESS_2); + static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUI_PROCESS_2); public WindowSplicer(final EntityPlayer player, final IInventory inventory, final Side side) { super(280, 240, player, inventory, side); diff --git a/src/main/resources/assets/genetics/lang/en_US.lang b/src/main/resources/assets/genetics/lang/en_US.lang index a2d70b09..50246550 100644 --- a/src/main/resources/assets/genetics/lang/en_US.lang +++ b/src/main/resources/assets/genetics/lang/en_US.lang @@ -53,6 +53,7 @@ genetics.errors.genepool.insufficient.ethanol.desc=Insufficient Ethanol genetics.errors.genepool.insufficient.enzyme.desc=Insufficient Enzyme genetics.machine.lab_machine.lab_machine=Lab Stand +genetics.machine.lab_machine.lab_machine.info= genetics.machine.lab_machine.analyser=Analyser genetics.machine.lab_machine.analyser.info=The Analyser takes breedable individuals and DNA sequencers and analyses them to determine the genes present. This requires DNA Dye, created from purple dye and glowstone From 5be32a2a3a459ccc0c8a2b004d6fa37036ba54d9 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 28 Jul 2017 20:47:03 -0700 Subject: [PATCH 07/13] Set up gradle for jenkins and auto-upload to curse --- build.gradle | 43 +++++++++++++++++++++++++++++++++++++++++++ gradle.properties | 1 + 2 files changed, 44 insertions(+) diff --git a/build.gradle b/build.gradle index d94686db..3682aecd 100644 --- a/build.gradle +++ b/build.gradle @@ -11,8 +11,15 @@ buildscript { } } +plugins { + id "com.matthewprenger.cursegradle" version "1.0.9" + id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.32" +} + apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'idea' +apply plugin: 'maven' + sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -92,3 +99,39 @@ uploadArchives { } } } + +task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) { + filePath = "changelog.html" + untaggedName = "Current release ${project.version}" + fromCommit = "5a3850c2642e535656d090d1473054d5fa8d3331" + toRef = "HEAD" + templateContent = """ +Alpha version. Do not create a world you care about with this version, it may break things severely.
+Please help the project by trying it out and reporting issues here.
+{{#tags}} +

{{name}}

+
    + {{#commits}} +
  • {{{message}}} - {{authorName}}
  • + {{/commits}} +
+{{/tags}} +""" +} + +curseforge { + apiKey = project.hasProperty('curseforge_apikey') ? project.curseforge_apikey : '0' + project { + id = curse_project_id + changelog = file('changelog.html') + changelogType = 'html' + releaseType = 'alpha' + relations { + requiredLibrary 'forestry' + } + } +} + +afterEvaluate { + tasks.curseforge223525.dependsOn.add(makeChangelog) +} diff --git a/gradle.properties b/gradle.properties index 6d2fcf63..47100562 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,6 +5,7 @@ org.gradle.jvmargs=-Xmx3G mcversion=1.11.2 forgeversion=13.20.1.2393 mcp_mappings=snapshot_20161220 +curse_project_id=223525 forestry_version=5.3.4.132 ic2_version=2.7.71-ex111 From 0101eae8f898dfe77132f471432f92e4d5b95159 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 28 Jul 2017 20:56:54 -0700 Subject: [PATCH 08/13] Make gradlew executable --- gradlew | 0 gradlew.bat | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 gradlew mode change 100644 => 100755 gradlew.bat diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/gradlew.bat b/gradlew.bat old mode 100644 new mode 100755 From f73667c1730e9ecc4eb3bdf412d44fba59afb396 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 28 Jul 2017 21:38:27 -0700 Subject: [PATCH 09/13] Fix grade git changelog --- build.gradle | 18 ++++-------------- changelog.mustache | 10 ++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 changelog.mustache diff --git a/build.gradle b/build.gradle index 3682aecd..5baaabbb 100644 --- a/build.gradle +++ b/build.gradle @@ -8,17 +8,18 @@ buildscript { } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' + classpath "gradle.plugin.se.bjurr.gitchangelog:git-changelog-gradle-plugin:1.47" } } plugins { id "com.matthewprenger.cursegradle" version "1.0.9" - id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.32" } apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'idea' apply plugin: 'maven' +apply plugin: "se.bjurr.gitchangelog.git-changelog-gradle-plugin" sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -103,20 +104,9 @@ uploadArchives { task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) { filePath = "changelog.html" untaggedName = "Current release ${project.version}" - fromCommit = "5a3850c2642e535656d090d1473054d5fa8d3331" + fromCommit = "dbc5c1a564c39e4a9c042411d1bdbe450985ce2c" toRef = "HEAD" - templateContent = """ -Alpha version. Do not create a world you care about with this version, it may break things severely.
-Please help the project by trying it out and reporting issues here.
-{{#tags}} -

{{name}}

-
    - {{#commits}} -
  • {{{message}}} - {{authorName}}
  • - {{/commits}} -
-{{/tags}} -""" + templateContent = file('changelog.mustache').getText('UTF-8') } curseforge { diff --git a/changelog.mustache b/changelog.mustache new file mode 100644 index 00000000..1b015bea --- /dev/null +++ b/changelog.mustache @@ -0,0 +1,10 @@ +Alpha version. Do not create a world you care about with this version, it may break things severely.
+Please help the project by trying it out and reporting issues here.
+{{#tags}} +

{{name}}

+
    + {{#commits}} +
  • {{{message}}} - {{authorName}}
  • + {{/commits}} +
+{{/tags}} \ No newline at end of file From 703e99e916a3e411095854fd7ecbed43b10d4859 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 28 Jul 2017 21:47:08 -0700 Subject: [PATCH 10/13] Bump version for first 1.11.2 release --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 47100562..2e76ad16 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,7 @@ forestry_version=5.3.4.132 ic2_version=2.7.71-ex111 version_major=2 -version_minor=0 +version_minor=1 version_patch=0 jei_version=4.5.0.292 From bc310023df442ae62f0d951d707e4924e491acb7 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 28 Jul 2017 21:48:22 -0700 Subject: [PATCH 11/13] Fix version number in filename --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5baaabbb..6f18adb4 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ targetCompatibility = JavaVersion.VERSION_1_8 version = version_major + '.' + version_minor + '.' + version_patch if (System.getenv("BUILD_NUMBER") != null) { - version = version + "-" + System.getenv("BUILD_NUMBER") + version = version + "." + System.getenv("BUILD_NUMBER") } group = "binnie" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "binnie-mods-1.11.2" From 4edd2e9d5de94716391f920966e355dcaa5d89f4 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 28 Jul 2017 22:11:49 -0700 Subject: [PATCH 12/13] Update mcmodinfo --- build.gradle | 3 ++ src/main/java/binnie/botany/Botany.java | 6 ++- src/main/java/binnie/core/BinnieCore.java | 2 +- src/main/java/binnie/extrabees/ExtraBees.java | 6 ++- .../java/binnie/extratrees/ExtraTrees.java | 6 ++- src/main/java/binnie/genetics/Genetics.java | 1 - src/main/resources/mcmod.info | 42 +++++++++---------- 7 files changed, 39 insertions(+), 27 deletions(-) diff --git a/build.gradle b/build.gradle index 6f18adb4..5d512cfa 100644 --- a/build.gradle +++ b/build.gradle @@ -35,6 +35,9 @@ minecraft { version = mcversion + "-" + forgeversion mappings = mcp_mappings runDir = "run" + + replace '@VERSION@', project.version + replace '@BUILD_NUMBER@', getBuildNumber() } repositories { diff --git a/src/main/java/binnie/botany/Botany.java b/src/main/java/binnie/botany/Botany.java index 1783ac12..51068314 100644 --- a/src/main/java/binnie/botany/Botany.java +++ b/src/main/java/binnie/botany/Botany.java @@ -60,7 +60,11 @@ import binnie.core.network.BinniePacketHandler; import binnie.core.network.IPacketID; import binnie.core.proxy.IProxyCore; -@Mod(modid = Constants.BOTANY_MOD_ID, name = "Binnie's Botany", useMetadata = true, dependencies = "required-after:" + Constants.CORE_MOD_ID) +@Mod( + modid = Constants.BOTANY_MOD_ID, + name = "Binnie's Botany", + dependencies = "required-after:" + Constants.CORE_MOD_ID +) public class Botany extends AbstractMod { public static final float AGE_CHANCE = 0.2f; diff --git a/src/main/java/binnie/core/BinnieCore.java b/src/main/java/binnie/core/BinnieCore.java index edfc82ec..d9858445 100644 --- a/src/main/java/binnie/core/BinnieCore.java +++ b/src/main/java/binnie/core/BinnieCore.java @@ -55,7 +55,7 @@ import binnie.core.triggers.ModuleTrigger; @Mod( modid = Constants.CORE_MOD_ID, name = "Binnie Core", - useMetadata = true, + version = "@VERSION@", dependencies = "required-after:forge@[13.20.0.2279,);" + "required-after:forestry@[5.3.4.102,);" + "after:jei@[4.3.1,);" diff --git a/src/main/java/binnie/extrabees/ExtraBees.java b/src/main/java/binnie/extrabees/ExtraBees.java index 1121a94d..70f1c39d 100644 --- a/src/main/java/binnie/extrabees/ExtraBees.java +++ b/src/main/java/binnie/extrabees/ExtraBees.java @@ -51,7 +51,11 @@ import binnie.extrabees.utils.config.ConfigHandler; import binnie.extrabees.utils.config.ConfigurationMain; import binnie.extrabees.worldgen.ExtraBeesWorldGenerator; -@Mod(modid = ExtraBees.MODID, name = "Binnie's Extra Bees", useMetadata = true, dependencies = "required-after:" + Constants.CORE_MOD_ID) +@Mod( + modid = ExtraBees.MODID, + name = "Binnie's Extra Bees", + dependencies = "required-after:" + Constants.CORE_MOD_ID +) public class ExtraBees { public static final String MODID = "extrabees"; diff --git a/src/main/java/binnie/extratrees/ExtraTrees.java b/src/main/java/binnie/extratrees/ExtraTrees.java index e227ec12..65b86c0b 100644 --- a/src/main/java/binnie/extratrees/ExtraTrees.java +++ b/src/main/java/binnie/extratrees/ExtraTrees.java @@ -49,7 +49,11 @@ import binnie.extratrees.kitchen.ModuleKitchen; import binnie.extratrees.machines.ModuleMachine; import binnie.extratrees.proxy.Proxy; -@Mod(modid = Constants.EXTRA_TREES_MOD_ID, name = "Binnie's Extra Trees", useMetadata = true, dependencies = "required-after:" + Constants.CORE_MOD_ID) +@Mod( + modid = Constants.EXTRA_TREES_MOD_ID, + name = "Binnie's Extra Trees", + dependencies = "required-after:" + Constants.CORE_MOD_ID +) public class ExtraTrees extends AbstractMod { @SuppressWarnings("NullableProblems") diff --git a/src/main/java/binnie/genetics/Genetics.java b/src/main/java/binnie/genetics/Genetics.java index 58ffc707..d7a86acd 100644 --- a/src/main/java/binnie/genetics/Genetics.java +++ b/src/main/java/binnie/genetics/Genetics.java @@ -37,7 +37,6 @@ import binnie.genetics.proxy.Proxy; @Mod( modid = Constants.GENETICS_MOD_ID, name = "Binnie's Genetics", - useMetadata = true, dependencies = "required-after:" + Constants.CORE_MOD_ID ) public class Genetics extends AbstractMod { diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index b98ed776..78f40d0d 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,11 +1,11 @@ [ { - "modid": "BinnieCore", + "modid": "binniecore", "name": "Binnie Core", "description": "Base mod for Binnie's Mods, with lots of common code.", - "version": "2.0-pre14", - "mcversion": "1.7.10", - "url": "http://minecraft.curseforge.com/mc-mods/223525-binnies-mods", + "version": "${version}", + "mcversion": "${mcversion}", + "url": "https://minecraft.curseforge.com/projects/binnies-mods", "updateUrl": "", "authorList": [ "Binnie" ], "credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others", @@ -13,16 +13,14 @@ "parent": "", "requiredMods": [ "forestry" ], "dependencies": [ "forestry" ], - "dependants" : [ ], - "useDependencyInformation" : true }, { - "modid": "ExtraBees", + "modid": "extrabees", "name": "Binnie's Extra Bees", "description": "Adds new bees and products to expand the bee breeding in Forestry.", - "version": "2.0-pre14", - "mcversion": "1.7.10", - "url": "http://minecraft.curseforge.com/mc-mods/223525-binnies-mods", + "version": "${version}", + "mcversion": "${mcversion}", + "url": "https://minecraft.curseforge.com/projects/binnies-mods", "updateUrl": "", "authorList": [ "Binnie" ], "credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others", @@ -31,12 +29,12 @@ "dependencies": [ "BinnieCore" ] }, { - "modid": "ExtraTrees", + "modid": "extratrees", "name": "Binnie's Extra Trees", "description": "Adds new trees, aesthetic blocks and alcohol production.", - "version": "2.0-pre14", - "mcversion": "1.7.10", - "url": "http://minecraft.curseforge.com/mc-mods/223525-binnies-mods", + "version": "${version}", + "mcversion": "${mcversion}", + "url": "https://minecraft.curseforge.com/projects/binnies-mods", "updateUrl": "", "authorList": [ "Binnie" ], "credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others", @@ -45,12 +43,12 @@ "dependencies": [ "BinnieCore" ] }, { - "modid": "Botany", + "modid": "botany", "name": "Binnie's Botany", "description": "Adds breedable flowers.", - "version": "2.0-pre14", - "mcversion": "1.7.10", - "url": "http://minecraft.curseforge.com/mc-mods/223525-binnies-mods", + "version": "${version}", + "mcversion": "${mcversion}", + "url": "https://minecraft.curseforge.com/projects/binnies-mods", "updateUrl": "", "authorList": [ "Binnie" ], "credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others", @@ -59,12 +57,12 @@ "dependencies": [ "BinnieCore" ] }, { - "modid": "Genetics", + "modid": "genetics", "name": "Binnie's Genetics", "description": "Adds genetic manipulation for bees, trees, butterflies and flowers.", - "version": "2.0-pre14", - "mcversion": "1.7.10", - "url": "http://minecraft.curseforge.com/mc-mods/223525-binnies-mods", + "version": "${version}", + "mcversion": "${mcversion}", + "url": "https://minecraft.curseforge.com/projects/binnies-mods", "updateUrl": "", "authorList": [ "Binnie" ], "credits": "Thanks to Sengir, MysteriousAges, Xizzzy and many others", From c51a9273f93f79ff1a357b54dce538df16bcf3b2 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 28 Jul 2017 22:38:29 -0700 Subject: [PATCH 13/13] Fix gradle --- build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5d512cfa..c3f64525 100644 --- a/build.gradle +++ b/build.gradle @@ -37,7 +37,6 @@ minecraft { runDir = "run" replace '@VERSION@', project.version - replace '@BUILD_NUMBER@', getBuildNumber() } repositories {