From 3e87a889ae044d0aa914a95f6b1ed7668a4c4eb3 Mon Sep 17 00:00:00 2001 From: Sunstrike Date: Tue, 10 Sep 2013 00:00:49 +0100 Subject: [PATCH 1/7] Change _Sunstrike cape to point at different file. --- capes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/capes.txt b/capes.txt index 5cc201aa..0963576e 100644 --- a/capes.txt +++ b/capes.txt @@ -1,7 +1,7 @@ mDiyo:https://dl.dropboxusercontent.com/u/42769935/mCape.png fuj1n:https://dl.dropboxusercontent.com/s/i6gra1pc6gxawwz/capeTCLogo.png progwml6:https://dl.dropboxusercontent.com/s/i6gra1pc6gxawwz/capeTCLogo.png -_Sunstrike:https://dl.dropboxusercontent.com/s/i6gra1pc6gxawwz/capeTCLogo.png +_Sunstrike:http://talon.sunstrike.io/files/sun_cape.png Fudgy_Fetus:https://dl.dropboxusercontent.com/u/27415688/fudgecape.png Vexatos:https://dl.dropboxusercontent.com/u/57704711/Dokumente/Speziell/Minecraft/Public/TCape.png pillbox:https://raw.github.com/mDiyo/TinkersConstruct/master/capes/default_orange.png From bbeed32c56a4779d9cb81d6951d6174e2db76c6d Mon Sep 17 00:00:00 2001 From: GraxRabble Date: Tue, 10 Sep 2013 22:52:28 -0400 Subject: [PATCH 2/7] Fixed leaf fletching dup --- src/tconstruct/blocks/logic/PartBuilderLogic.java | 2 ++ src/tconstruct/common/TContent.java | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tconstruct/blocks/logic/PartBuilderLogic.java b/src/tconstruct/blocks/logic/PartBuilderLogic.java index ae643d32..07a7924e 100644 --- a/src/tconstruct/blocks/logic/PartBuilderLogic.java +++ b/src/tconstruct/blocks/logic/PartBuilderLogic.java @@ -61,6 +61,8 @@ public class PartBuilderLogic extends InventoryLogic implements ISidedInventory if (!craftedTop && inventory[0] != null) { int value = PatternBuilder.instance.getPartValue(inventory[2]); + if (value == 0) /* hack to plug up future dups */ + value = 2; IPattern item = (IPattern) inventory[0].getItem(); int cost = item != null ? item.getPatternCost(inventory[0]) : 0; if (value > 0 && cost > 0) diff --git a/src/tconstruct/common/TContent.java b/src/tconstruct/common/TContent.java index cdce2a51..98665d5e 100644 --- a/src/tconstruct/common/TContent.java +++ b/src/tconstruct/common/TContent.java @@ -1143,7 +1143,8 @@ public class TContent implements IFuelHandler TConstructRegistry.addBowstringMaterial(0, 2, new ItemStack(Item.silk), new ItemStack(bowstring, 1, 0), 1F, 1F, 1f); //String TConstructRegistry.addFletchingMaterial(0, 2, new ItemStack(Item.feather), new ItemStack(fletching, 1, 0), 100F, 0F, 0.05F); //Feather - TConstructRegistry.addFletchingMaterial(1, 2, new ItemStack(Block.leaves), new ItemStack(fletching, 1, 1), 75F, 0F, 0.2F); //Leaves + for (int i = 0; i < 4; i++ ) + TConstructRegistry.addFletchingMaterial(1, 2, new ItemStack(Block.leaves, 1, i), new ItemStack(fletching, 1, 1), 75F, 0F, 0.2F); //All four vanialla Leaves TConstructRegistry.addFletchingMaterial(2, 2, new ItemStack(materials, 1, 1), new ItemStack(fletching, 1, 2), 100F, 0F, 0.12F); //Slime TConstructRegistry.addFletchingMaterial(3, 2, new ItemStack(materials, 1, 17), new ItemStack(fletching, 1, 3), 100F, 0F, 0.12F); //BlueSlime @@ -2320,4 +2321,4 @@ public class TContent implements IFuelHandler return 26400; return 0; } -} \ No newline at end of file +} From 8c2a1c483ca415a091726bcad5c7a79c6fb83fc6 Mon Sep 17 00:00:00 2001 From: GraxRabble Date: Wed, 11 Sep 2013 04:21:27 -0400 Subject: [PATCH 3/7] removed the hack and left only the vanilla leaf fix --- src/tconstruct/blocks/logic/PartBuilderLogic.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/tconstruct/blocks/logic/PartBuilderLogic.java b/src/tconstruct/blocks/logic/PartBuilderLogic.java index 07a7924e..ae643d32 100644 --- a/src/tconstruct/blocks/logic/PartBuilderLogic.java +++ b/src/tconstruct/blocks/logic/PartBuilderLogic.java @@ -61,8 +61,6 @@ public class PartBuilderLogic extends InventoryLogic implements ISidedInventory if (!craftedTop && inventory[0] != null) { int value = PatternBuilder.instance.getPartValue(inventory[2]); - if (value == 0) /* hack to plug up future dups */ - value = 2; IPattern item = (IPattern) inventory[0].getItem(); int cost = item != null ? item.getPatternCost(inventory[0]) : 0; if (value > 0 && cost > 0) From 70bf94571dcb803142389234f5f2b10044dca195 Mon Sep 17 00:00:00 2001 From: Sunstrike Date: Wed, 11 Sep 2013 19:47:18 +0100 Subject: [PATCH 4/7] Don't mind me, being mildly OCD about formatting... --- README.md | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 4a4f8ad2..05e686a3 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,27 @@ -Tinkers' Construct -http://www.minecraftforum.net/topic/1659892-tinkers-construct/ +#[Tinkers' Construct](http://www.minecraftforum.net/topic/1659892-tinkers-construct/) Modify all the things, then do it again! Melt down any metals you find. Turn everything into golems! -To compile from source: use apache ant(http://ant.apache.org/bindownload.cgi) -run ant in the tinkers construct directory +##Compile from Source +Run [Apache Ant](http://ant.apache.org/bindownload.cgi) in the repository root: `ant package` -For all issue reporting; please include the following: - * Minecraft Version - * TinkersConstruct Version - * Forge Version - * Versions of any mods related to the issue - * If there is a crash involved, describe how you got it to crash and the forge crash log - * Any relevant screenshots are greatly appreciated. +##Issue reporting +Please include the following: +* Minecraft version +* TinkersConstruct version +* Forge version/build +* Versions of any mods potentially related to the issue +* Any relevant screenshots are greatly appreciated. +* For crashes: + * Steps to reproduce + * ForgeModLoader-client-0.log (the FML log) from the root folder of the client -Most code is public domain under Creative Commons 0: http://creativecommons.org/publicdomain/zero/1.0/ -Textures and binaries are licensed under Creative Commons 3: http://creativecommons.org/licenses/by/3.0/ -Any alternate licenses are noted where appropriate +##Licenses +Most code is public domain under [Creative Commons 0](http://creativecommons.org/publicdomain/zero/1.0/). + +Textures and binaries are licensed under [Creative Commons 3](http://creativecommons.org/licenses/by/3.0/). + +Any alternate licenses are noted where appropriate. From cc43c2a493a48563d5dacd52ffe9e13019e41e82 Mon Sep 17 00:00:00 2001 From: mDiyo Date: Wed, 11 Sep 2013 12:14:42 -0700 Subject: [PATCH 5/7] Remove extra book recipe --- src/tconstruct/common/TContent.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/tconstruct/common/TContent.java b/src/tconstruct/common/TContent.java index 98665d5e..993d135e 100644 --- a/src/tconstruct/common/TContent.java +++ b/src/tconstruct/common/TContent.java @@ -1636,9 +1636,6 @@ public class TContent implements IFuelHandler if (PHConstruct.stencilTableCrafting) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolStationWood, 1, 10), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', "plankWood")); - GameRegistry.addShapelessRecipe(new ItemStack(Item.book, 1, 0), new ItemStack(blankPattern, 1, 0), new ItemStack(blankPattern, 1, 0), new ItemStack(Item.paper, 1, 0), new ItemStack( - Item.paper, 1, 0), new ItemStack(Item.paper, 1, 0), new ItemStack(Item.silk, 1, 0)); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blankPattern, 1, 0), "ps", "sp", 'p', "plankWood", 's', "stickWood")); GameRegistry.addRecipe(new ItemStack(manualBook), "wp", 'w', new ItemStack(blankPattern, 1, 0), 'p', Item.paper); GameRegistry.addShapelessRecipe(new ItemStack(manualBook, 2, 0), new ItemStack(manualBook, 1, 0), Item.book); From 631935c921b25ac49a70a3187cb170478e008f1c Mon Sep 17 00:00:00 2001 From: mDiyo Date: Wed, 11 Sep 2013 13:02:54 -0700 Subject: [PATCH 6/7] Remove Skill textures --- .../assets/tinker/textures/skill/Float48x.png | Bin 1882 -> 0 bytes .../assets/tinker/textures/skill/Jump48x.png | Bin 1925 -> 0 bytes .../assets/tinker/textures/skill/Wall16x.png | Bin 583 -> 0 bytes .../assets/tinker/textures/skill/Wall32x.png | Bin 951 -> 0 bytes .../assets/tinker/textures/skill/Wall48x.png | Bin 1317 -> 0 bytes 5 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 resources/assets/tinker/textures/skill/Float48x.png delete mode 100644 resources/assets/tinker/textures/skill/Jump48x.png delete mode 100644 resources/assets/tinker/textures/skill/Wall16x.png delete mode 100644 resources/assets/tinker/textures/skill/Wall32x.png delete mode 100644 resources/assets/tinker/textures/skill/Wall48x.png diff --git a/resources/assets/tinker/textures/skill/Float48x.png b/resources/assets/tinker/textures/skill/Float48x.png deleted file mode 100644 index 37cc41c750fb7c744e00cadf693e8fcd9f2d687d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1882 zcmV-g2c`IlP)wQjU4hN+of zt+i_EXSG$uSG8JdxPA7#&yVLhpU3B6k|iS9#VhBW_xbUh;YpIRJ$>sRlCt@12wD#y@vG#taA<;;u`nq$8Y~DFi+>w z9C;V&&*1CyHc6z&$?8GHLUdr+KB|9X?n(Adsr;Fym;sA5rT)frK ztaTIQeWsQzG}Zl1*#jo8_|Z-BkX_D9hFwu7ew~}LY$s{y;^}fJx~zrYs-yY*4!`cs?D#GaHh38VJ&>;#)JS8t6R$pOF6S0khUM zdiJ_m>l@w7^?TV@&D(TQW#&4r$C6kUOQ*|+S-uYS@hu;(haTTn9W^smBc0>y0kb#$ z>OS(!-nif31N))swR1B+ZSAK%U%Fn7~IH+STVXw0RZH?#^R;$qd;*Hq zd0sLXR<*+0_6_Z6${(<>=BVL!gVkb5`nWEPWwE5q4G+73)$MU*2hn>w`0ZupZPH|?>;Wt5PBA~76i$^c ztV@?IzOwEl%_uu!mFV^m`$?q-g?$pT2du3>9r$X`>9F+Xku0q6wP8eepp zv9Gmo1ovTXYiWJ@2GyrCWp4I>Zw{VyTRgCqEr(1DUt-iMs#&na;;KeMkFalqUOU^w zoNq7mfb0R)M>>cavFck$Yhr9(>opIHh4KBjUnOYO=uh4#)r|f_)48B!52!tU(d`1q zF1gxc7bzyIXdZe=?JiRTs|VO4pwV2ZrygUK@J@-JJz!7smH!+)!hRa?)4Jy&dqBNU z*0*$eU=_rkX0fViEm>1nAb&u^6K{wgb}(-h;-?(Y_~%tmC)r<4d&JkcQ4x(}sTWw+ zzRo8Ww|Bq8V2k1<$ z<97q}24*s`t}B1QfivCiKzp}4c&5kuo_5&oB3|P>V$^W`L0II}N)C1D;?_r=dcqt0 zw(bBOd3_5t*#i#$b&H1t(qG7PoIRlFT(3J) z%JtyqYo4sNJ?Y}sw|zVxzJ1f?dh-YTasIlekL*!zBhaC#MGe=n<+|7xYt+}J^|zGu zd9K#-8yd&=;%?akj$iC^CobL~j)M!ZeFEzzq^78GZJ}2{JuDX0A8gjw*v{m4i}S3_ z9&qaNP3Dqt`IcDYOWcfDYo)JQdkQhvU`hM)S!4Avui5rcA8Y9w*#laxRNUz+w+Q$x z@H^Ru<(&8geCY|X`o2$l#9~qV-%R!K^BHmMm$`-c>R0jyv~^WnYu9bpb`?~_7HL)A z*HNw3iy!)Jj`}LJr2Va*#-Y!=!M4J)Mav#=w!7bR$DQrzckSM97Ykiusxf))iM8#% zzo465EUC+4hK;FTp!s251UhDB4>)&iz@6*8<1H8vyx%KU^bV>q8s#G$rq=cWEZafv za1L>-)AxihpKXWqWDmH|H|Q>07vNh|4-CXQ(ax(zzL}%-hJQDIK0Db~jz=$`1aUd%^7 zqFOp5?TtNAM~&5o^9OX_9`@V|^!T`^0>7wtlcqIBCt@w|Zu3utd$I@I7T;Cx42d)qJSak&&auk!* zUiPVne96-+>C-ugNs}IZOZwt`*0eu+KxOD}cWdZ@$J@Jt_gQC4zSk=u&-E0;mmJkf zf2a|ypqseRW8M#Yh|M0*Km5@1i0wW258WNr5EnF9)N*~$?uj1iZN4}M7CQIDdc<~z zg70nifWeW+Zty;MBzS-1k?2;_*yIV(v^MCr-oBCM(PMhGCaKFF@G|oM0WX?=00FP` Uq9a^_%K!iX07*qoM6N<$f|{n?)&Kwi diff --git a/resources/assets/tinker/textures/skill/Jump48x.png b/resources/assets/tinker/textures/skill/Jump48x.png deleted file mode 100644 index ae2caadcff2a2b044d9711eaab415ec2e467be13..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1925 zcmV;02YUF4P)a4mpfD_t__J|0n2Nnj^ad z!hF9UxTJvDUmkR`*Bt^JbaU3B50*HMF?WdkIkryv>|sT#7G|({?fV6x^`Cz9mV2}4 zJDM5KRgU9>X#sOLR=Rl`4ud^RcHRbvH*!q)>JZmpUO22PbaZ@Z3V1kT9?YG;_Io#1 z_A@HkBBwmuloYU__!l=HKz1`@0ovjt;vXTrv#Emk`0)6+7<#P50-Rlpb7l8t+{Hl7 zLvo0ufJIw=75wJ0*x1F8Q~RvL<3kaPxAJ_Rp>r_~{GzQK+q}PJE5}IzOTVpRlvKGT z>I*PlQo=br{#ggtJSioV{?n_!Y+t+A|G}u&pU-9p5vr|6=lD> zj{z&nP8eVe*l`qcCN_EQVGeyOLXUsCHtUC(VNNz5b|(d_+I7mU+I<>;*1+>7hukja zRzi&69CNSjdp85EC2M-wN=$sXVI|E5P%i9F3Ru0r0Z_vvu1nyEsfQrE5V<9Rg78LKZNDA0ib=hP4vEXkz)@*#VA>IzqrM4gArlvlR znR^!c!|iV(7KFLole@z_dxsz?ptP>lmDRSo(%Ke4E5&G$D?>j9@b;6|W3V3W`jQ$C zj7#fUG9qUExX8`g^B&c|x|;hSb!oHf*jA4nF5Th5d013^Y8aGnw{b&1srR- z`CNzvSUwgI_r|avK%9$_6i@}ps^)G0S_Q^{Cb7!NQan=s98ujr&{r}cSz#dQieh$y}^JNC_2{{7o$T2Vb^q!=ElUH)?WLwUi zy3z|ipbc#<3*b19aW5UIZ&LjMS^+wf=Fv=;PciNhOFMN3*Xa$&b3ONBO;SMp-?!Z# zh<1VcWP4pbAd|-!EFOx->tCT2kgaFbM={S)#5tSiI4PjvYM(n(5O=&^sD_?>IUZ|c z5ruk?YcO+l2iKx+ciLQETEL&z?g0A9o&y_zJaTHWhU?h&)1jJ+1#rFXw{tY+J(|-z;X z-_Hxso}_@Qw@2L7zG1M45drvpVukOZ8pBaOpu^PS(e@pIwH>r4J2PW(zP}^*9nzB& zaJ_%jUB4qh-$Hqhkx(bxHRZ@>i%0A6Tst!5JnAcShuN1D&^0g)7|Y-WVvw!Io+ofm zh~xYi9iN#8Jx|v&NB*GZ#rhciv9y5hyW@fhcWY2A#0bv=g3o+5AN&C2;u&#o=m|X5 zSbiccAa`#9aNnaB;@&*^Sw2Uc))<};YB@K-^?6$x*A(jKKFs?$Xn{)#=o@|zVRCAJ zs8Fr|d>#6e4D3f>B z_WL`;CIt*lJOVssdmsHrZdf^tGaOp1<$BNE7v9&~e0C06$t5#A~u28x26ZRjB+O<^(_LJLhRaYKd5plen`DP00eV9Xk1tvQsm(vD`c z;J^v<*U2A8MR{9KdKv6bQ0GZ!;4#nJrQN{b!Ncc$U*7MJ_j#FP$0y)_U~mb|u6R^k z%G@2?Ve!TVSk}@|UbqPJSEo>i1MPs7alwhXsym^q5z1nRU>HM(cLX)xhnZ0UyI{G( ztxYoI5#g4cL3mc*3G?UnCWY`Go;huOfSPc7lfo9Palwq+pGPb+tKGUnsK(D$6oXb;8(*Qy)t&9ygVdVUHLSK=d1M^61b%bwZy3PyM6 zQ9bW?iK(_D3QwXQ;t9dgJe(7bjgjV+ro)S>66XG<$1Y;5>cnzWTIFUcCR( zM+0Kq-}oxZ!Y{Avw_!c};orY}_qqSt^R9atT9C`-z;PU~EDM^=CNvriO08Cddc6+a zZZ}YuBng;oHVeA0gK3&z7{(C_g#rx*=`70vBg-;1_$D7Tl*?uMT9D53JTU2W8Z=FV zVzEfUkgBSnC<>HHB|2)5&T-su0{mO2(*fJIq1Wp{yWNIXt3}7h34(O|K9fu)M9eX=#L$wClU!@aPf`#e4f7OhY#~NofbqQ5kR8RD2Sp6sZ4T(c3kgX`6LJeF>LL}i zSfA8|g}8Suu3Q$}xE=4zy>ohU&W*{{MHfHLYyLBH9&YrN}hS;YV*s?`6I1!<(|^v;>A0U%;?R#(B(1EPY=hIJl$U zWXQpvmcWhWmdPG*eZ|Ba6Duui&7NbsYwI;QUmpdpanrVC9n%u?mcC`{tu-xyJL|7a zUOAKR9AjVvj~?N%@R9$E-tKD&_zMRRAl}&R$(RE$eD8b({2o+0)cb9J+y;sV6iZ7W zT>W73kqA}ZcMZ7sZBfi09|OT-T2Mx6vK+6B{08p2=fh-ozEg@^;gv~aKg4} zw|@}woSF#w;AGHd-Z(VdLp_1V&yP&Lz!MwwI1ya8IMNbO*POLxjAxdAErHz2ug>gQ zZC05_rwh4#f*z!kZm-jaMcW*=PZIF^{eT#T0kv8UwzjsYEtktsEEYScR;!TD=V5bm z6E-$BNY`jIpi-&0)^l7>AP@i~olX;LYirbIG8qBR$>Ufo2H|iRCMG5*AZy*|Ij#qt zAgZD4l#v}yPfvr-=cApXL$`X4>p>@oYK%rIa-euTP7d&Bor3k!b6jx(a+Yi;?}X=g z914Z#2n&URw#$C>;sp3EQmGW}3XfI>=a6VL3R6>45Q#)+JU2H-I($^vcdHj~fIFO# z%J}#=wP-UrIVoN*9$z<2KYHyE;$uRvgpg9HL_wO(Ce-V7*xufz-D1hf<%Vy7wQls{ z3OFP6?q+6Y#3SqVx}EO6m)`LoKnMJS6Nv;F;I8Bv=2xt~cDMSj{{Uypb&kiyB_!{V zccVJ)SMT@_$h!#!gB^9=>k8cJyZ!@wl<0u#T;3T6kUthRv3~U0KY#)}HvC|)PO+}B zY_i!b)owDGqa_&eKy}g$dAI+fcRT?kJ~qiIO<>Qruy47n5oEE2^ Zz#jnJI!9lH+gktt002ovPDHLkV1iH9!qor( diff --git a/resources/assets/tinker/textures/skill/Wall48x.png b/resources/assets/tinker/textures/skill/Wall48x.png deleted file mode 100644 index ba3ce08c805effd36eb4e44fbfcbb287ae2abe07..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1317 zcmV+=1={+FP)+-xOE; zn{D4ZQSDd_)pB&}#&-tE*!NCIyH8$#Oy*wdhYvy&Mir?-oc$+HddhlL;V`-F5&CZ_gDI@YT=&H^ru{R+(rB=2clL^-zYjki6p z9&LHPZMZm=MR4-XY~%T1ezWI;*P18ftki2A$}fwT z3}`*eYtpaeJo9`#^{ty+vU=_;;M)D?8oB3imB$`%el@4p2={lC+)+9OZ!8l=;O;Z* zwQ?MfPd>`Av~P~7{p(zI+y%7ccNO-a<-smQ9_;Bc>y(V-rGD>3QheV>{v07W_ScxN z2-c&W&Bd4;TT71V=}52V&H}DKd;w8~>koeucwyj57!$?h&CT6RI*iyqI*$yvbd zM~4arMsm`He+$l?Mi8fT2>r!Z5P$TF_^5yL=5GUScL?#~fwJ*plnze#k|%?4xfq?( zA;obPkXn097+O72Qo{~_U^|T?AekNpL7c6I_|etsU7mzN21b92z%-VW>Q>rgBf zVQFazCMPFhVPS#R^Z7i<+1Xj*F~Z=>oEutOTY-^CBw%!Ol+fSbPdW^c&1Q{0olXY= z*TUk+2%}JWkZ1bGbvj z8+Kx0@O>vB?~~k(?(S}Lgffup3fQ|@OTOlxYM59rdn3#ax-d-3Q8iIj=0kT1002^WPWzMDmRxso}YinyG zXKW+ag1EKj%ba~zNcLxZ`tklr6bc3E#naQ%Ff}zr4oamG_2!k8mC*Rk_kg^g4Evt) zIFrekqNRNpeCK;#P0*3$P7jKzpa`fMN2T z1xV+7oKi23a(sOJ#Lk7quXu$Ja)lnf%00000NkvXXu0mjf4~L9S From 65b851c460af935d3a203ea900752032991bbf17 Mon Sep 17 00:00:00 2001 From: Zerokyuuni Date: Tue, 10 Sep 2013 10:21:00 -0400 Subject: [PATCH 7/7] Tinker and Blade 2: Warconstruct --- src/mods/battlegear2/api/IArrowContainer.java | 55 +++++++ .../battlegear2/api/IArrowContainer2.java | 99 +++++++++++++ src/mods/battlegear2/api/IBackStabbable.java | 14 ++ .../battlegear2/api/IBattlegearWeapon.java | 70 +++++++++ src/mods/battlegear2/api/IDyable.java | 31 ++++ .../battlegear2/api/IExtendedReachWeapon.java | 12 ++ src/mods/battlegear2/api/IHeraldyArmour.java | 11 ++ src/mods/battlegear2/api/IHeraldyItem.java | 77 ++++++++++ .../battlegear2/api/IHitTimeModifier.java | 15 ++ .../battlegear2/api/IPenetrateWeapon.java | 13 ++ src/mods/battlegear2/api/IPotionEffect.java | 23 +++ src/mods/battlegear2/api/IShield.java | 54 +++++++ src/mods/battlegear2/api/ISpecialEffect.java | 16 ++ .../battlegear2/api/OffhandAttackEvent.java | 21 +++ .../battlegear2/api/PlayerEventChild.java | 32 ++++ .../battlegear2/api/QuiverArrowEvent.java | 29 ++++ .../battlegear2/api/QuiverArrowRegistry.java | 42 ++++++ .../api/heraldry/HeraldryData.java | 138 ++++++++++++++++++ .../api/heraldry/IHeraldryItem.java | 59 ++++++++ .../api/quiver/IArrowContainer.java | 55 +++++++ .../api/quiver/IArrowContainer2.java | 99 +++++++++++++ .../api/quiver/QuiverArrowEvent.java | 30 ++++ .../api/quiver/QuiverArrowRegistry.java | 42 ++++++ .../api/weapons/IBackStabbable.java | 14 ++ .../api/weapons/IBattlegearWeapon.java | 70 +++++++++ .../api/weapons/IExtendedReachWeapon.java | 12 ++ .../api/weapons/IHitTimeModifier.java | 15 ++ .../api/weapons/IPenetrateWeapon.java | 13 ++ .../api/weapons/IPotionEffect.java | 23 +++ .../api/weapons/ISpecialEffect.java | 16 ++ .../api/weapons/OffhandAttackEvent.java | 22 +++ src/tconstruct/items/tools/Arrow.java | 5 + src/tconstruct/items/tools/Battleaxe.java | 15 ++ src/tconstruct/items/tools/Chisel.java | 14 ++ src/tconstruct/items/tools/Cleaver.java | 21 +++ src/tconstruct/items/tools/Excavator.java | 20 +++ src/tconstruct/items/tools/Hammer.java | 20 +++ src/tconstruct/items/tools/Hatchet.java | 5 + src/tconstruct/items/tools/LumberAxe.java | 20 +++ src/tconstruct/items/tools/Mattock.java | 20 +++ src/tconstruct/items/tools/Pickaxe.java | 5 + src/tconstruct/items/tools/Scythe.java | 19 +++ src/tconstruct/items/tools/Shortbow.java | 20 +++ src/tconstruct/items/tools/Shovel.java | 5 + src/tconstruct/library/tools/ToolCore.java | 50 ++++++- src/tconstruct/library/tools/Weapon.java | 2 + src/tconstruct/util/PHConstruct.java | 6 + 47 files changed, 1467 insertions(+), 2 deletions(-) create mode 100644 src/mods/battlegear2/api/IArrowContainer.java create mode 100644 src/mods/battlegear2/api/IArrowContainer2.java create mode 100644 src/mods/battlegear2/api/IBackStabbable.java create mode 100644 src/mods/battlegear2/api/IBattlegearWeapon.java create mode 100644 src/mods/battlegear2/api/IDyable.java create mode 100644 src/mods/battlegear2/api/IExtendedReachWeapon.java create mode 100644 src/mods/battlegear2/api/IHeraldyArmour.java create mode 100644 src/mods/battlegear2/api/IHeraldyItem.java create mode 100644 src/mods/battlegear2/api/IHitTimeModifier.java create mode 100644 src/mods/battlegear2/api/IPenetrateWeapon.java create mode 100644 src/mods/battlegear2/api/IPotionEffect.java create mode 100644 src/mods/battlegear2/api/IShield.java create mode 100644 src/mods/battlegear2/api/ISpecialEffect.java create mode 100644 src/mods/battlegear2/api/OffhandAttackEvent.java create mode 100644 src/mods/battlegear2/api/PlayerEventChild.java create mode 100644 src/mods/battlegear2/api/QuiverArrowEvent.java create mode 100644 src/mods/battlegear2/api/QuiverArrowRegistry.java create mode 100644 src/mods/battlegear2/api/heraldry/HeraldryData.java create mode 100644 src/mods/battlegear2/api/heraldry/IHeraldryItem.java create mode 100644 src/mods/battlegear2/api/quiver/IArrowContainer.java create mode 100644 src/mods/battlegear2/api/quiver/IArrowContainer2.java create mode 100644 src/mods/battlegear2/api/quiver/QuiverArrowEvent.java create mode 100644 src/mods/battlegear2/api/quiver/QuiverArrowRegistry.java create mode 100644 src/mods/battlegear2/api/weapons/IBackStabbable.java create mode 100644 src/mods/battlegear2/api/weapons/IBattlegearWeapon.java create mode 100644 src/mods/battlegear2/api/weapons/IExtendedReachWeapon.java create mode 100644 src/mods/battlegear2/api/weapons/IHitTimeModifier.java create mode 100644 src/mods/battlegear2/api/weapons/IPenetrateWeapon.java create mode 100644 src/mods/battlegear2/api/weapons/IPotionEffect.java create mode 100644 src/mods/battlegear2/api/weapons/ISpecialEffect.java create mode 100644 src/mods/battlegear2/api/weapons/OffhandAttackEvent.java diff --git a/src/mods/battlegear2/api/IArrowContainer.java b/src/mods/battlegear2/api/IArrowContainer.java new file mode 100644 index 00000000..cd77ab2b --- /dev/null +++ b/src/mods/battlegear2/api/IArrowContainer.java @@ -0,0 +1,55 @@ +package mods.battlegear2.api; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +@Deprecated +public interface IArrowContainer{ + + /** + * + * @param stack The {@link #ItemStack} representing this item + * @param bow The bow trying to use this container + * @param player The {@link #EntityPlayer} using the bow + * @return true if the item contains at least one arrow + */ + public boolean hasArrowFor(ItemStack stack, ItemStack bow, EntityPlayer player); + /** + * The arrow spawned when bow is used with this non empty container equipped + * @param stack The {@link #ItemStack} representing this item + * @param charge Amount of charge in the bow, ranging from 0.2F to 2.0F + * @param player The {@link #EntityPlayer} using the bow + * @param world + * @return the arrow entity to spawn when bow is used + */ + public EntityArrow getArrowType(ItemStack stack, World world, EntityPlayer player, float charge); + /** + * Action to take after an arrow has been fired + * Usually equal to removing an arrow from the container + * @param player The {@link #EntityPlayer} using the bow + * @param world + * @param stack The {@link #ItemStack} representing this item + * @param bow The bow which fired + * @param arrow the arrow fired + */ + public void onArrowFired(World world, EntityPlayer player, ItemStack stack, ItemStack bow, EntityArrow arrow); + /** + * Called before the arrow is fired from this container + * @param arrowEvent Used to decide bow damage, bow sound and arrow enchantment + */ + public void onPreArrowFired(QuiverArrowEvent arrowEvent); + /** + * Called when the container is put on a crafting bench with vanilla arrows + * @param stack + * @return True to receive {@link #addArrows(ItemStack, int)} + */ + public boolean isCraftableWithArrows(ItemStack stack); + /** + * Crafts the item with vanilla arrows + * @param stack + * @param arrows Number of vanilla arrows on the crafting bench + * @return Number of vanilla arrows that couldn't fit in + */ + public int addArrows(ItemStack stack, int arrows); +} diff --git a/src/mods/battlegear2/api/IArrowContainer2.java b/src/mods/battlegear2/api/IArrowContainer2.java new file mode 100644 index 00000000..31e7635d --- /dev/null +++ b/src/mods/battlegear2/api/IArrowContainer2.java @@ -0,0 +1,99 @@ +package mods.battlegear2.api; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface IArrowContainer2 { + + /** + * Returns the maximum amout of slots in the arrow container + * @param container {@link #ItemStack} representing this item + * @return the amount of slots + */ + public int getSlotCount(ItemStack container); + + /** + * Returns the currently selected slot in the arrow container + * @param container {@link #ItemStack} representing this item + * @return the currently selected slot + */ + public int getSelectedSlot(ItemStack container); + + /** + * Sets the currently selected slot to the given value + * @param container {@link #ItemStack} representing this item + * @param newSlot the new slot index + */ + public void setSelectedSlot(ItemStack container, int newSlot); + + /** + * Returns the itemStack in the currently selected slot + * @param container The {@link #ItemStack} representing this item + * @param slot the slot index + * @return The {@link #ItemStack} in the given slot. + */ + public ItemStack getStackInSlot(ItemStack container, int slot); + + /** + * Sets places the given item stack in the give slot + * @param container {@link #ItemStack} representing this item + * @param slot the slot index + * @param container {@link #ItemStack} representing the new stack + */ + public void setStackInSlot(ItemStack container, int slot, ItemStack stack); + + + /** + * + * @param container The {@link #ItemStack} representing this item + * @param bow The bow trying to use this container + * @param player The {@link #EntityPlayer} using the bow + * @return true if the item contains at least one arrow in the selected slot + */ + public boolean hasArrowFor(ItemStack container, ItemStack bow, EntityPlayer player, int slot); + + /** + * The arrow spawned when bow is used with this non empty container equipped + * @param container The {@link #ItemStack} representing this item + * @param charge Amount of charge in the bow, ranging from 0.2F to 2.0F + * @param player The {@link #EntityPlayer} using the bow + * @param world + * @return the arrow entity to spawn when bow is used + */ + public EntityArrow getArrowType(ItemStack container, World world, EntityPlayer player, float charge); + /** + * Action to take after an arrow has been fired + * Usually equal to removing an arrow from the container + * @param player The {@link #EntityPlayer} using the bow + * @param world + * @param container The {@link #ItemStack} representing this item + * @param bow The bow which fired + * @param arrow the arrow fired + */ + public void onArrowFired(World world, EntityPlayer player, ItemStack container, ItemStack bow, EntityArrow arrow); + /** + * Called before the arrow is fired from this container + * @param arrowEvent Used to decide bow damage, bow sound and arrow enchantment + */ + public void onPreArrowFired(QuiverArrowEvent arrowEvent); + /** + * Called when the container is put on a crafting bench with other items + * @param container The {@link #ItemStack} representing this item + * @param arrowStack The {@link #ItemStack} representing other items + * @return True to receive {@link #addArrows(ItemStack, ItemStack)} + */ + public boolean isCraftableWithArrows(ItemStack contaner, ItemStack arrowStack); + + /** + * Crafts the item with the items from {@link #isCraftableWithArrows(ItemStack, ItemStack)} + * @param container The {@link #ItemStack} representing this item + * @param arrows Another valid item on the crafting bench + * @return Number of arrows that couldn't fit in + */ + public ItemStack addArrows(ItemStack container, ItemStack newStack); + + + +} diff --git a/src/mods/battlegear2/api/IBackStabbable.java b/src/mods/battlegear2/api/IBackStabbable.java new file mode 100644 index 00000000..021dad12 --- /dev/null +++ b/src/mods/battlegear2/api/IBackStabbable.java @@ -0,0 +1,14 @@ +package mods.battlegear2.api; + +import net.minecraft.entity.EntityLivingBase; + +public interface IBackStabbable { + + /** + * Action to perform on back stabbing + * @param entityHit + * @param entityHitting + * @return true if it adds an hitting action + */ + public boolean onBackStab(EntityLivingBase entityHit, EntityLivingBase entityHitting); +} diff --git a/src/mods/battlegear2/api/IBattlegearWeapon.java b/src/mods/battlegear2/api/IBattlegearWeapon.java new file mode 100644 index 00000000..688d6755 --- /dev/null +++ b/src/mods/battlegear2/api/IBattlegearWeapon.java @@ -0,0 +1,70 @@ +package mods.battlegear2.api; + +import cpw.mods.fml.relauncher.Side; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; + +public interface IBattlegearWeapon { + + /** + * Returns true if the weapon will allow other weapons to be placed in the partner offhand slot + */ + public boolean willAllowOffhandWeapon(); + + /** + * Will allow shield + */ + public boolean willAllowShield(); + + /** + * Returns true if the weapon be dual wielded in the offhand slot + */ + public boolean isOffhandHandDualWeapon(); + + /** + * Returns true if the weapon should always be sheathed on the back, false if it should be sheathed on the hip + */ + public boolean sheatheOnBack(); + + /** + * Perform any function when the item is held in the offhand and the user right clicks an entity. + * This is generally used to attack an entity with the offhand item. If this is the case the event should + * be canceled to prevent any default right clicking events (Eg Villager Trading) + * + * @param event the OffhandAttackEvent that was generated + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + * @return true if the off hand swing animation should be performed + */ + public boolean offhandAttackEntity(OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + /** + * Perform any function when the item is held in the offhand and the user right clicks "Air". + * + * @param event the PlayerInteractEvent that was generated + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + * @return true if the off hand swing animation should be performed + */ + public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + /** + * Perform any function when the item is held in the offhand and the user right clicks a block. + * Note that this will happen prior to the activation of any activation functions of blocks + * + * @param event the PlayerInteractEvent that was generated + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + */ + public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + /** + * Perform any passive effects on each game tick when the item is held in the offhand + * + * @param effectiveSide the effective side the method was called from + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + */ + public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem); + +} \ No newline at end of file diff --git a/src/mods/battlegear2/api/IDyable.java b/src/mods/battlegear2/api/IDyable.java new file mode 100644 index 00000000..a5be9d7e --- /dev/null +++ b/src/mods/battlegear2/api/IDyable.java @@ -0,0 +1,31 @@ +package mods.battlegear2.api; + + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +//This is a tempory fix until we get the heradry system up and running +public interface IDyable { + + /** + * Return whether the specified armor ItemStack has a color. + */ + public boolean hasColor(ItemStack par1ItemStack); + + + /** + * Return the color for the specified armor ItemStack. + */ + public int getColor(ItemStack par1ItemStack); + + public void setColor(ItemStack dyable, int rgb); + + /** + * Remove the color from the specified armor ItemStack. + */ + public void removeColor(ItemStack par1ItemStack); + + public int getDefaultColor(ItemStack par1ItemStack); + + +} diff --git a/src/mods/battlegear2/api/IExtendedReachWeapon.java b/src/mods/battlegear2/api/IExtendedReachWeapon.java new file mode 100644 index 00000000..a9cefa90 --- /dev/null +++ b/src/mods/battlegear2/api/IExtendedReachWeapon.java @@ -0,0 +1,12 @@ +package mods.battlegear2.api; + +import net.minecraft.item.ItemStack; + +public interface IExtendedReachWeapon { + /** + * The distance the weapon will hit (note this will ONLY work for main hand weapons) + * @param stack + * @return + */ + public float getReachModifierInBlocks(ItemStack stack); +} diff --git a/src/mods/battlegear2/api/IHeraldyArmour.java b/src/mods/battlegear2/api/IHeraldyArmour.java new file mode 100644 index 00000000..a32e64a2 --- /dev/null +++ b/src/mods/battlegear2/api/IHeraldyArmour.java @@ -0,0 +1,11 @@ +package mods.battlegear2.api; + + +import mods.battlegear2.heraldry.HeraldyPattern; + +public interface IHeraldyArmour extends IHeraldyItem{ + + public String getBaseArmourPath(int armourSlot); + + public String getPatternArmourPath(HeraldyPattern pattern, int armourSlot); +} diff --git a/src/mods/battlegear2/api/IHeraldyItem.java b/src/mods/battlegear2/api/IHeraldyItem.java new file mode 100644 index 00000000..1f188ee5 --- /dev/null +++ b/src/mods/battlegear2/api/IHeraldyItem.java @@ -0,0 +1,77 @@ +package mods.battlegear2.api; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; + +@Deprecated +public interface IHeraldyItem { + + public enum HeraldyRenderPassess{ + /** + * The first render pass. This will use the items base icon coloured the primary colour + */ + PrimaryColourBase, + /** + * The second render pass. This will use the selected pattern overlayed on top of the base icon with the apropriate colour + */ + SecondaryColourPattern, + /** + * The third render pass. The sigil(s) will be rendered on top of the pattern in the apropriate positions + */ + Sigil, + /** + * Fourth render pass. The items trim icon will be rendered in the secondady colour + */ + SecondaryColourTrim, + /** + * Fifth Render pass, the Items post render icon will be rendered in the default colour + */ + PostRenderIcon + } + + /** + * Returns the "base" icon. This icon will be coloured the primary colour + */ + public Icon getBaseIcon(ItemStack stack); + /** + * Returns the trim icon, This will be coloured the secondary colour + */ + public Icon getTrimIcon(ItemStack stack); + /** + * Returns the post render icon, this Icon will render after all other rendering passess in it's default colour + */ + public Icon getPostRenderIcon(ItemStack stack); + + + /** + * Returns true if the given itemstack has heraldy attached + */ + public boolean hasHeraldry(ItemStack stack); + /** + * Returns the current heraldy code, this will only be called on ItemStacks that have been found to have heraldrybackup using the hasHeraldryMethod + */ + public byte[] getHeraldryCode(ItemStack stack); + + /** + * Saves the given heraldy code in the given stack. It is recommended to use the stacks NBT Tag compound for this + */ + public void setHeraldryCode(ItemStack stack, byte[] code); + + /** + * Removes the heraldy code from the item + */ + public void removeHeraldry(ItemStack item); + + /** + * Returns true if the default renderer should perform the given render pass + */ + public boolean shouldDoPass(HeraldyRenderPassess pass); + + /** + * Returns true if the default renderer should be used. + * If the method returns true, the default renderer will be attached. + * If this method returns false it is the modders responsibility to attach an appropriate renderer + */ + public boolean useDefaultRenderer(); + +} diff --git a/src/mods/battlegear2/api/IHitTimeModifier.java b/src/mods/battlegear2/api/IHitTimeModifier.java new file mode 100644 index 00000000..dae76ee0 --- /dev/null +++ b/src/mods/battlegear2/api/IHitTimeModifier.java @@ -0,0 +1,15 @@ +package mods.battlegear2.api; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +public interface IHitTimeModifier { + /** + * + * @param entityHit + * @return The amount to modify the hit shield + */ + public int getHitTime(ItemStack stack, EntityLivingBase entityHit); + +} diff --git a/src/mods/battlegear2/api/IPenetrateWeapon.java b/src/mods/battlegear2/api/IPenetrateWeapon.java new file mode 100644 index 00000000..435fb5d9 --- /dev/null +++ b/src/mods/battlegear2/api/IPenetrateWeapon.java @@ -0,0 +1,13 @@ +package mods.battlegear2.api; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +public interface IPenetrateWeapon { + /** + * The amount of damage bypassing armor + * @param stack The {@link net.minecraft.item.ItemStack} representative of the item dealing the hit. + * @return the amount of damage that bypasses armour + */ + public int getPenetratingPower(ItemStack stack); +} diff --git a/src/mods/battlegear2/api/IPotionEffect.java b/src/mods/battlegear2/api/IPotionEffect.java new file mode 100644 index 00000000..94912c80 --- /dev/null +++ b/src/mods/battlegear2/api/IPotionEffect.java @@ -0,0 +1,23 @@ +package mods.battlegear2.api; + + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.potion.PotionEffect; + +import java.util.Map; + +public interface IPotionEffect { + + + /** + * Returns a map containing the potion effects to apply to an entity hit by the weapon. Each effect + * has a float value associated with the chance of applying the effect. Note that the "dice roll" only + * occurs once so any value under this roll will be applied. + * + * @param entityHit The entity the effect will be applied to. + * @param entityHitting + * @return A Map of {@link PotionEffect} with chance value ranging from 0 to 1, to be dealt to the entityHit + */ + public Map getEffectsOnHit(EntityLivingBase entityHit, EntityLivingBase entityHitting); + +} diff --git a/src/mods/battlegear2/api/IShield.java b/src/mods/battlegear2/api/IShield.java new file mode 100644 index 00000000..de9a81bf --- /dev/null +++ b/src/mods/battlegear2/api/IShield.java @@ -0,0 +1,54 @@ +package mods.battlegear2.api; + + +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; + +public interface IShield { + + /** + * Gets the decay rate for the stamina bar when the shield is in use. + * The value should be between 0 and 1. The duration of maximum blocking can be calculated + * by 1/decayRate/20. + * + * @param shield The {@link #ItemStack} representing the shield + * @return a value between 0 & 1 representing the decay rate per tick + */ + public float getDecayRate(ItemStack shield); + + /** + * Returns true if the current shield can and should block the given damage source + * + * @param shield The {@link #ItemStack} representing the shield + * @param source The {@link #DamageSource} representing the current damage + * @return true if the shield can block the given damage type + */ + public boolean canBlock(ItemStack shield, DamageSource source); + + /** + * Gets the extra decay rate to the stamina bar when the shield is damaged + * + * @param shield The {@link #ItemStack} representing the shield + * @param amount The amount of damage the shield has absorbed + * @return a value between 0 & 1 representing the decay rate + */ + public float getDamageDecayRate(ItemStack shield, float amount); + + /** + * Returns the block angle in degrees that the shield can block. + * This angle is taken as 0 degrees being directly in front of the player. The shield + * will block between -blockAngle to blockangle + * @param shield The {@link #ItemStack} representing the shield + * @return The maximum angle the shield should be able to block at + */ + public float getBlockAngle(ItemStack shield); + + + /** + * Returns the time a shield bash should take to be preformed. A shield bash will disallow actions + * for the number of ticks given and will knockback an oponent at time/2 + * + * @return The amount of ticks the shield bash animation will play + */ + public int getBashTimer(ItemStack shield); +} diff --git a/src/mods/battlegear2/api/ISpecialEffect.java b/src/mods/battlegear2/api/ISpecialEffect.java new file mode 100644 index 00000000..ab0d02c1 --- /dev/null +++ b/src/mods/battlegear2/api/ISpecialEffect.java @@ -0,0 +1,16 @@ +package mods.battlegear2.api; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; + +public interface ISpecialEffect { + /** + * + * @param entityHit The entity the effect will be applied to. + * @param entityHitting + * @return true if it adds an hitting action + */ + public boolean performEffects(EntityLivingBase entityHit, EntityLivingBase entityHitting); +} diff --git a/src/mods/battlegear2/api/OffhandAttackEvent.java b/src/mods/battlegear2/api/OffhandAttackEvent.java new file mode 100644 index 00000000..3de16f1f --- /dev/null +++ b/src/mods/battlegear2/api/OffhandAttackEvent.java @@ -0,0 +1,21 @@ +package mods.battlegear2.api; + +import net.minecraft.entity.Entity; +import net.minecraftforge.event.entity.player.EntityInteractEvent; +import net.minecraftforge.event.entity.player.PlayerEvent; + +public class OffhandAttackEvent extends PlayerEventChild { + + public boolean swingOffhand = true; + public boolean shouldAttack = true; + public EntityInteractEvent event; + + public OffhandAttackEvent(EntityInteractEvent parent) { + super(parent); + this.event = parent; + } + + public Entity getTarget() { + return event.target; + } +} \ No newline at end of file diff --git a/src/mods/battlegear2/api/PlayerEventChild.java b/src/mods/battlegear2/api/PlayerEventChild.java new file mode 100644 index 00000000..654952c0 --- /dev/null +++ b/src/mods/battlegear2/api/PlayerEventChild.java @@ -0,0 +1,32 @@ +package mods.battlegear2.api; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.event.Event.Result; +import net.minecraftforge.event.entity.player.PlayerEvent; + +public class PlayerEventChild extends PlayerEvent{ + + public PlayerEvent parent; + + public PlayerEventChild(PlayerEvent parent) { + super(parent.entityPlayer); + this.parent = parent; + } + + public void setCancelParentEvent(boolean cancel) { + parent.setCanceled(cancel); + } + + @Override + public void setCanceled(boolean cancel) { + super.setCanceled(cancel); + parent.setCanceled(cancel); + } + + @Override + public void setResult(Result value) { + super.setResult(value); + parent.setResult(value); + } +} diff --git a/src/mods/battlegear2/api/QuiverArrowEvent.java b/src/mods/battlegear2/api/QuiverArrowEvent.java new file mode 100644 index 00000000..df6df620 --- /dev/null +++ b/src/mods/battlegear2/api/QuiverArrowEvent.java @@ -0,0 +1,29 @@ +package mods.battlegear2.api; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.ArrowLooseEvent; +import net.minecraftforge.event.entity.player.PlayerEvent; + +public class QuiverArrowEvent extends PlayerEventChild{ + + public int bowDamage = 1; + public float bowSoundVolume = 1.0F; + public boolean addEnchantments = true; + public ArrowLooseEvent event; + + public QuiverArrowEvent(ArrowLooseEvent parent) { + super(parent); + this.event = parent; + } + + public ItemStack getBow() + { + return event.bow; + } + + public int getCharge() + { + return event.charge; + } +} diff --git a/src/mods/battlegear2/api/QuiverArrowRegistry.java b/src/mods/battlegear2/api/QuiverArrowRegistry.java new file mode 100644 index 00000000..8787a2d9 --- /dev/null +++ b/src/mods/battlegear2/api/QuiverArrowRegistry.java @@ -0,0 +1,42 @@ +package mods.battlegear2.api; + +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.ItemStack; + +import java.util.Comparator; +import java.util.Map; +import java.util.TreeMap; + +public class QuiverArrowRegistry { + + private static Map> map = new TreeMap>(new StackComparator()); + + public static void addArrowToRegistry(int itemId, int itemMetadata, Class entityArrow){ + ItemStack stack = new ItemStack(itemId, 1, itemMetadata); + map.put(stack, entityArrow); + } + + public static Class getArrowClass(ItemStack stack){ + return map.get(stack); + } + + static class StackComparator implements Comparator { + @Override + public int compare(ItemStack stack, ItemStack stack2) { + + if(stack == stack2){ + return 0; + }else{ + + int idDiff = stack.itemID - stack2.itemID; + if(idDiff != 0){ + return idDiff; + }else + return stack.getItemDamage() - stack2.getItemDamage(); + } + + } + } + + +} diff --git a/src/mods/battlegear2/api/heraldry/HeraldryData.java b/src/mods/battlegear2/api/heraldry/HeraldryData.java new file mode 100644 index 00000000..46fc6ec7 --- /dev/null +++ b/src/mods/battlegear2/api/heraldry/HeraldryData.java @@ -0,0 +1,138 @@ +package mods.battlegear2.api.heraldry; + +import mods.battlegear2.utils.BattlegearUtils; + +import java.io.*; +import java.util.Arrays; + +public class HeraldryData { + + + public static final int RED = 1; + public static final int GREEN = 2; + public static final int BLUE = 3; + + private byte pattern; + private short crest; + private byte crestPosition; + private int[] colours = new int[5]; + + private byte helm; + private byte banner; + + private byte[] byteArray = null; + + public HeraldryData(int pattern, int pattern_col_1, int pattern_col_2, int pattern_col_3, int crest, int crest_col_1, int crest_col_2, int crest_position, int helm, int banner) { + this.pattern = (byte) pattern; + this.crest = (short) crest; + colours = new int[]{pattern_col_1, pattern_col_2, pattern_col_3, crest_col_1, crest_col_2}; + this.crestPosition = (byte) crest_position; + this.helm = (byte) helm; + this.banner = (byte) banner; + } + + public HeraldryData(byte pattern, int pattern_col_1, int pattern_col_2, int pattern_col_3){ + this(pattern, pattern_col_1, pattern_col_2, pattern_col_3, 0, 0, 0,0, 0, 0); + } + + public HeraldryData(byte[] data){ + DataInputStream input = null; + + try{ + input = new DataInputStream(new ByteArrayInputStream(data)); + + pattern = input.readByte();; + crest = input.readShort(); + crestPosition = input.readByte(); + colours= new int[5]; + for(int i = 0; i < colours.length; i++){ + colours[i] = input.readInt(); + } + + helm = input.readByte(); + banner = input.readByte(); + + byteArray = Arrays.copyOf(data, data.length); + + }catch (Exception e){ + e.printStackTrace(); + }finally { + BattlegearUtils.closeStream(input); + } + } + + public static HeraldryData getDefault() { + return new HeraldryData(10, 0xFF000000, 0xFFFFFFFF, 0xFFFFFF00, 0, 0xFF000000, 0xFF000000, 0, 0, 0); + } + + public byte[] getByteArray(){ + + if(byteArray != null){ + return byteArray; + } + + DataOutputStream output = null; + + ByteArrayOutputStream bos = null; + + try{ + bos = new ByteArrayOutputStream(); + output = new DataOutputStream(bos); + + output.writeByte(pattern); + output.writeShort(crest); + output.writeByte(crestPosition); + for(int i = 0; i < 5; i++){ + output.writeInt(colours[i]); + } + + output.writeByte(helm); + output.writeByte(banner); + + return bos.toByteArray(); + } catch (Exception e){ + e.printStackTrace(); + } finally { + BattlegearUtils.closeStream(output); + } + + return null; + } + + public int getColourChanel(int colour, int chanelNo){ + switch (chanelNo){ + case RED: + return (colours[colour] >> 16) & 0xFF; + case GREEN: + return (colours[colour] >> 8) & 0xFF; + case BLUE: + return (colours[colour] >> 0) & 0xFF; + default: + return (colours[colour] >> 16) & 0xFF; + } + } + + public byte getPattern() { + return pattern; + } + + public int getColour(int i) { + return colours[i]; + } + + @Override + public String toString() { + return byteArrayToHex(getByteArray()); + } + + public static String byteArrayToHex(byte[] a) { + StringBuilder sb = new StringBuilder(); + for(byte b: a) + sb.append(String.format("%02x", b&0xff)); + return sb.toString(); + } + + public short getCrest() { + return crest; + } +} diff --git a/src/mods/battlegear2/api/heraldry/IHeraldryItem.java b/src/mods/battlegear2/api/heraldry/IHeraldryItem.java new file mode 100644 index 00000000..040d1013 --- /dev/null +++ b/src/mods/battlegear2/api/heraldry/IHeraldryItem.java @@ -0,0 +1,59 @@ +package mods.battlegear2.api.heraldry; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; + +public interface IHeraldryItem { + + public enum HeraldyRenderPassess{ + Pattern, + SecondaryColourTrim, + PostRenderIcon + } + + /** + * Returns the "base" icon. This icon will be coloured the primary colour + */ + public Icon getBaseIcon(ItemStack stack); + /** + * Returns the trim icon, This will be coloured the secondary colour + */ + public Icon getTrimIcon(ItemStack stack); + /** + * Returns the post render icon, this Icon will render after all other rendering passess in it's default colour + */ + public Icon getPostRenderIcon(ItemStack stack); + + + /** + * Returns true if the given itemstack has heraldy attached + */ + public boolean hasHeraldry(ItemStack stack); + /** + * Returns the current heraldy code, this will only be called on ItemStacks that have been found to have heraldry using the hasHeraldryMethod + */ + public byte[] getHeraldry(ItemStack stack); + + /** + * Saves the given heraldry code in the given stack. It is recommended to save the Byte array representation of the crest in the NBT + */ + public void setHeraldry(ItemStack stack, byte[] data); + + /** + * Removes the heraldry code from the item + */ + public void removeHeraldry(ItemStack item); + + /** + * Returns true if the default renderer should perform the given render pass + */ + public boolean shouldDoPass(HeraldyRenderPassess pass); + + /** + * Returns true if the default renderer should be used. + * If the method returns true, the default renderer will be attached. + * If this method returns false it is the modders responsibility to attach an appropriate renderer + */ + public boolean useDefaultRenderer(); + +} diff --git a/src/mods/battlegear2/api/quiver/IArrowContainer.java b/src/mods/battlegear2/api/quiver/IArrowContainer.java new file mode 100644 index 00000000..fe8c6733 --- /dev/null +++ b/src/mods/battlegear2/api/quiver/IArrowContainer.java @@ -0,0 +1,55 @@ +package mods.battlegear2.api.quiver; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +@Deprecated +public interface IArrowContainer{ + + /** + * + * @param stack The {@link #ItemStack} representing this item + * @param bow The bow trying to use this container + * @param player The {@link #EntityPlayer} using the bow + * @return true if the item contains at least one arrow + */ + public boolean hasArrowFor(ItemStack stack, ItemStack bow, EntityPlayer player); + /** + * The arrow spawned when bow is used with this non empty container equipped + * @param stack The {@link #ItemStack} representing this item + * @param charge Amount of charge in the bow, ranging from 0.2F to 2.0F + * @param player The {@link #EntityPlayer} using the bow + * @param world + * @return the arrow entity to spawn when bow is used + */ + public EntityArrow getArrowType(ItemStack stack, World world, EntityPlayer player, float charge); + /** + * Action to take after an arrow has been fired + * Usually equal to removing an arrow from the container + * @param player The {@link #EntityPlayer} using the bow + * @param world + * @param stack The {@link #ItemStack} representing this item + * @param bow The bow which fired + * @param arrow the arrow fired + */ + public void onArrowFired(World world, EntityPlayer player, ItemStack stack, ItemStack bow, EntityArrow arrow); + /** + * Called before the arrow is fired from this container + * @param arrowEvent Used to decide bow damage, bow sound and arrow enchantment + */ + public void onPreArrowFired(QuiverArrowEvent arrowEvent); + /** + * Called when the container is put on a crafting bench with vanilla arrows + * @param stack + * @return True to receive {@link #addArrows(ItemStack, int)} + */ + public boolean isCraftableWithArrows(ItemStack stack); + /** + * Crafts the item with vanilla arrows + * @param stack + * @param arrows Number of vanilla arrows on the crafting bench + * @return Number of vanilla arrows that couldn't fit in + */ + public int addArrows(ItemStack stack, int arrows); +} diff --git a/src/mods/battlegear2/api/quiver/IArrowContainer2.java b/src/mods/battlegear2/api/quiver/IArrowContainer2.java new file mode 100644 index 00000000..9ad1355e --- /dev/null +++ b/src/mods/battlegear2/api/quiver/IArrowContainer2.java @@ -0,0 +1,99 @@ +package mods.battlegear2.api.quiver; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface IArrowContainer2 { + + /** + * Returns the maximum amout of slots in the arrow container + * @param container {@link #ItemStack} representing this item + * @return the amount of slots + */ + public int getSlotCount(ItemStack container); + + /** + * Returns the currently selected slot in the arrow container + * @param container {@link #ItemStack} representing this item + * @return the currently selected slot + */ + public int getSelectedSlot(ItemStack container); + + /** + * Sets the currently selected slot to the given value + * @param container {@link #ItemStack} representing this item + * @param newSlot the new slot index + */ + public void setSelectedSlot(ItemStack container, int newSlot); + + /** + * Returns the itemStack in the currently selected slot + * @param container The {@link #ItemStack} representing this item + * @param slot the slot index + * @return The {@link #ItemStack} in the given slot. + */ + public ItemStack getStackInSlot(ItemStack container, int slot); + + /** + * Sets places the given item stack in the give slot + * @param container {@link #ItemStack} representing this item + * @param slot the slot index + * @param container {@link #ItemStack} representing the new stack + */ + public void setStackInSlot(ItemStack container, int slot, ItemStack stack); + + + /** + * + * @param container The {@link #ItemStack} representing this item + * @param bow The bow trying to use this container + * @param player The {@link #EntityPlayer} using the bow + * @return true if the item contains at least one arrow in the selected slot + */ + public boolean hasArrowFor(ItemStack container, ItemStack bow, EntityPlayer player, int slot); + + /** + * The arrow spawned when bow is used with this non empty container equipped + * @param container The {@link #ItemStack} representing this item + * @param charge Amount of charge in the bow, ranging from 0.2F to 2.0F + * @param player The {@link #EntityPlayer} using the bow + * @param world + * @return the arrow entity to spawn when bow is used + */ + public EntityArrow getArrowType(ItemStack container, World world, EntityPlayer player, float charge); + /** + * Action to take after an arrow has been fired + * Usually equal to removing an arrow from the container + * @param player The {@link #EntityPlayer} using the bow + * @param world + * @param container The {@link #ItemStack} representing this item + * @param bow The bow which fired + * @param arrow the arrow fired + */ + public void onArrowFired(World world, EntityPlayer player, ItemStack container, ItemStack bow, EntityArrow arrow); + /** + * Called before the arrow is fired from this container + * @param arrowEvent Used to decide bow damage, bow sound and arrow enchantment + */ + public void onPreArrowFired(QuiverArrowEvent arrowEvent); + /** + * Called when the container is put on a crafting bench with other items + * @param container The {@link #ItemStack} representing this item + * @param arrowStack The {@link #ItemStack} representing other items + * @return True to receive {@link #addArrows(ItemStack, ItemStack)} + */ + public boolean isCraftableWithArrows(ItemStack contaner, ItemStack arrowStack); + + /** + * Crafts the item with the items from {@link #isCraftableWithArrows(ItemStack, ItemStack)} + * @param container The {@link #ItemStack} representing this item + * @param arrows Another valid item on the crafting bench + * @return Number of arrows that couldn't fit in + */ + public ItemStack addArrows(ItemStack container, ItemStack newStack); + + + +} diff --git a/src/mods/battlegear2/api/quiver/QuiverArrowEvent.java b/src/mods/battlegear2/api/quiver/QuiverArrowEvent.java new file mode 100644 index 00000000..f410261a --- /dev/null +++ b/src/mods/battlegear2/api/quiver/QuiverArrowEvent.java @@ -0,0 +1,30 @@ +package mods.battlegear2.api.quiver; + +import mods.battlegear2.api.PlayerEventChild; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.ArrowLooseEvent; +import net.minecraftforge.event.entity.player.PlayerEvent; + +public class QuiverArrowEvent extends PlayerEventChild{ + + public int bowDamage = 1; + public float bowSoundVolume = 1.0F; + public boolean addEnchantments = true; + public ArrowLooseEvent event; + + public QuiverArrowEvent(ArrowLooseEvent parent) { + super(parent); + this.event = parent; + } + + public ItemStack getBow() + { + return event.bow; + } + + public int getCharge() + { + return event.charge; + } +} diff --git a/src/mods/battlegear2/api/quiver/QuiverArrowRegistry.java b/src/mods/battlegear2/api/quiver/QuiverArrowRegistry.java new file mode 100644 index 00000000..072930c2 --- /dev/null +++ b/src/mods/battlegear2/api/quiver/QuiverArrowRegistry.java @@ -0,0 +1,42 @@ +package mods.battlegear2.api.quiver; + +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.ItemStack; + +import java.util.Comparator; +import java.util.Map; +import java.util.TreeMap; + +public class QuiverArrowRegistry { + + private static Map> map = new TreeMap>(new StackComparator()); + + public static void addArrowToRegistry(int itemId, int itemMetadata, Class entityArrow){ + ItemStack stack = new ItemStack(itemId, 1, itemMetadata); + map.put(stack, entityArrow); + } + + public static Class getArrowClass(ItemStack stack){ + return map.get(stack); + } + + static class StackComparator implements Comparator { + @Override + public int compare(ItemStack stack, ItemStack stack2) { + + if(stack == stack2){ + return 0; + }else{ + + int idDiff = stack.itemID - stack2.itemID; + if(idDiff != 0){ + return idDiff; + }else + return stack.getItemDamage() - stack2.getItemDamage(); + } + + } + } + + +} diff --git a/src/mods/battlegear2/api/weapons/IBackStabbable.java b/src/mods/battlegear2/api/weapons/IBackStabbable.java new file mode 100644 index 00000000..36025eca --- /dev/null +++ b/src/mods/battlegear2/api/weapons/IBackStabbable.java @@ -0,0 +1,14 @@ +package mods.battlegear2.api.weapons; + +import net.minecraft.entity.EntityLivingBase; + +public interface IBackStabbable { + + /** + * Action to perform on back stabbing + * @param entityHit + * @param entityHitting + * @return true if it adds an hitting action + */ + public boolean onBackStab(EntityLivingBase entityHit, EntityLivingBase entityHitting); +} diff --git a/src/mods/battlegear2/api/weapons/IBattlegearWeapon.java b/src/mods/battlegear2/api/weapons/IBattlegearWeapon.java new file mode 100644 index 00000000..ccdceb5e --- /dev/null +++ b/src/mods/battlegear2/api/weapons/IBattlegearWeapon.java @@ -0,0 +1,70 @@ +package mods.battlegear2.api.weapons; + +import cpw.mods.fml.relauncher.Side; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; + +public interface IBattlegearWeapon { + + /** + * Returns true if the weapon will allow other weapons to be placed in the partner offhand slot + */ + public boolean willAllowOffhandWeapon(); + + /** + * Will allow shield + */ + public boolean willAllowShield(); + + /** + * Returns true if the weapon be dual wielded in the offhand slot + */ + public boolean isOffhandHandDualWeapon(); + + /** + * Returns true if the weapon should always be sheathed on the back, false if it should be sheathed on the hip + */ + public boolean sheatheOnBack(); + + /** + * Perform any function when the item is held in the offhand and the user right clicks an entity. + * This is generally used to attack an entity with the offhand item. If this is the case the event should + * be canceled to prevent any default right clicking events (Eg Villager Trading) + * + * @param event the OffhandAttackEvent that was generated + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + * @return true if the off hand swing animation should be performed + */ + public boolean offhandAttackEntity(OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + /** + * Perform any function when the item is held in the offhand and the user right clicks "Air". + * + * @param event the PlayerInteractEvent that was generated + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + * @return true if the off hand swing animation should be performed + */ + public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + /** + * Perform any function when the item is held in the offhand and the user right clicks a block. + * Note that this will happen prior to the activation of any activation functions of blocks + * + * @param event the PlayerInteractEvent that was generated + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + */ + public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem); + + /** + * Perform any passive effects on each game tick when the item is held in the offhand + * + * @param effectiveSide the effective side the method was called from + * @param mainhandItem the ItemStack currently being held in the right hand + * @param offhandItem the ItemStack currently being held in the left hand + */ + public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem); + +} \ No newline at end of file diff --git a/src/mods/battlegear2/api/weapons/IExtendedReachWeapon.java b/src/mods/battlegear2/api/weapons/IExtendedReachWeapon.java new file mode 100644 index 00000000..fce70604 --- /dev/null +++ b/src/mods/battlegear2/api/weapons/IExtendedReachWeapon.java @@ -0,0 +1,12 @@ +package mods.battlegear2.api.weapons; + +import net.minecraft.item.ItemStack; + +public interface IExtendedReachWeapon { + /** + * The distance the weapon will hit (note this will ONLY work for main hand weapons) + * @param stack + * @return + */ + public float getReachModifierInBlocks(ItemStack stack); +} diff --git a/src/mods/battlegear2/api/weapons/IHitTimeModifier.java b/src/mods/battlegear2/api/weapons/IHitTimeModifier.java new file mode 100644 index 00000000..38afe94e --- /dev/null +++ b/src/mods/battlegear2/api/weapons/IHitTimeModifier.java @@ -0,0 +1,15 @@ +package mods.battlegear2.api.weapons; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +public interface IHitTimeModifier { + /** + * + * @param entityHit + * @return The amount to modify the hit shield + */ + public int getHitTime(ItemStack stack, EntityLivingBase entityHit); + +} diff --git a/src/mods/battlegear2/api/weapons/IPenetrateWeapon.java b/src/mods/battlegear2/api/weapons/IPenetrateWeapon.java new file mode 100644 index 00000000..ae959c99 --- /dev/null +++ b/src/mods/battlegear2/api/weapons/IPenetrateWeapon.java @@ -0,0 +1,13 @@ +package mods.battlegear2.api.weapons; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +public interface IPenetrateWeapon { + /** + * The amount of damage bypassing armor + * @param stack The {@link net.minecraft.item.ItemStack} representative of the item dealing the hit. + * @return the amount of damage that bypasses armour + */ + public int getPenetratingPower(ItemStack stack); +} diff --git a/src/mods/battlegear2/api/weapons/IPotionEffect.java b/src/mods/battlegear2/api/weapons/IPotionEffect.java new file mode 100644 index 00000000..a310ee17 --- /dev/null +++ b/src/mods/battlegear2/api/weapons/IPotionEffect.java @@ -0,0 +1,23 @@ +package mods.battlegear2.api.weapons; + + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.potion.PotionEffect; + +import java.util.Map; + +public interface IPotionEffect { + + + /** + * Returns a map containing the potion effects to apply to an entity hit by the weapon. Each effect + * has a float value associated with the chance of applying the effect. Note that the "dice roll" only + * occurs once so any value under this roll will be applied. + * + * @param entityHit The entity the effect will be applied to. + * @param entityHitting + * @return A Map of {@link PotionEffect} with chance value ranging from 0 to 1, to be dealt to the entityHit + */ + public Map getEffectsOnHit(EntityLivingBase entityHit, EntityLivingBase entityHitting); + +} diff --git a/src/mods/battlegear2/api/weapons/ISpecialEffect.java b/src/mods/battlegear2/api/weapons/ISpecialEffect.java new file mode 100644 index 00000000..9f52e9bb --- /dev/null +++ b/src/mods/battlegear2/api/weapons/ISpecialEffect.java @@ -0,0 +1,16 @@ +package mods.battlegear2.api.weapons; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; + +public interface ISpecialEffect { + /** + * + * @param entityHit The entity the effect will be applied to. + * @param entityHitting + * @return true if it adds an hitting action + */ + public boolean performEffects(EntityLivingBase entityHit, EntityLivingBase entityHitting); +} diff --git a/src/mods/battlegear2/api/weapons/OffhandAttackEvent.java b/src/mods/battlegear2/api/weapons/OffhandAttackEvent.java new file mode 100644 index 00000000..273b1d5f --- /dev/null +++ b/src/mods/battlegear2/api/weapons/OffhandAttackEvent.java @@ -0,0 +1,22 @@ +package mods.battlegear2.api.weapons; + +import mods.battlegear2.api.PlayerEventChild; +import net.minecraft.entity.Entity; +import net.minecraftforge.event.entity.player.EntityInteractEvent; +import net.minecraftforge.event.entity.player.PlayerEvent; + +public class OffhandAttackEvent extends PlayerEventChild { + + public boolean swingOffhand = true; + public boolean shouldAttack = true; + public EntityInteractEvent event; + + public OffhandAttackEvent(EntityInteractEvent parent) { + super(parent); + this.event = parent; + } + + public Entity getTarget() { + return event.target; + } +} \ No newline at end of file diff --git a/src/tconstruct/items/tools/Arrow.java b/src/tconstruct/items/tools/Arrow.java index 33d03b41..27dea1d8 100644 --- a/src/tconstruct/items/tools/Arrow.java +++ b/src/tconstruct/items/tools/Arrow.java @@ -225,4 +225,9 @@ public class Arrow extends ToolCore } } } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } } diff --git a/src/tconstruct/items/tools/Battleaxe.java b/src/tconstruct/items/tools/Battleaxe.java index ca117580..fe9edb20 100644 --- a/src/tconstruct/items/tools/Battleaxe.java +++ b/src/tconstruct/items/tools/Battleaxe.java @@ -300,4 +300,19 @@ public class Battleaxe extends HarvestTool world.playAuxSFX(2001, x, y, z, woodID + (meta << 12)); return super.onBlockStartBreak(stack, x, y, z, player); } + + @Override + public boolean willAllowOffhandWeapon() { + return false; + } + + @Override + public boolean willAllowShield() { + return false; + } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } } diff --git a/src/tconstruct/items/tools/Chisel.java b/src/tconstruct/items/tools/Chisel.java index e64a348f..0b012a82 100644 --- a/src/tconstruct/items/tools/Chisel.java +++ b/src/tconstruct/items/tools/Chisel.java @@ -226,4 +226,18 @@ public class Chisel extends ToolCore return new String[] { "utility" }; } + @Override + public boolean willAllowOffhandWeapon() { + return false; + } + + @Override + public boolean willAllowShield() { + return false; + } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } } diff --git a/src/tconstruct/items/tools/Cleaver.java b/src/tconstruct/items/tools/Cleaver.java index 59d28e69..7d0dc27f 100644 --- a/src/tconstruct/items/tools/Cleaver.java +++ b/src/tconstruct/items/tools/Cleaver.java @@ -3,6 +3,7 @@ package tconstruct.items.tools; import tconstruct.common.TContent; import tconstruct.library.tools.AbilityHelper; import tconstruct.library.tools.Weapon; +import tconstruct.util.PHConstruct; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -161,4 +162,24 @@ public class Cleaver extends Weapon entity.swingProgressInt /= 2; return false; }*/ + + @Override + public boolean willAllowOffhandWeapon() { + return false; + } + + @Override + public boolean willAllowShield() { + return PHConstruct.isCleaverTwoHanded; + } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } + + @Override + public boolean sheatheOnBack() { + return true; + } } diff --git a/src/tconstruct/items/tools/Excavator.java b/src/tconstruct/items/tools/Excavator.java index cc99bdba..d6bd8288 100644 --- a/src/tconstruct/items/tools/Excavator.java +++ b/src/tconstruct/items/tools/Excavator.java @@ -293,4 +293,24 @@ public class Excavator extends HarvestTool } return super.getStrVsBlock(stack, block, meta); } + + @Override + public boolean willAllowOffhandWeapon() { + return false; + } + + @Override + public boolean willAllowShield() { + return false; + } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } + + @Override + public boolean sheatheOnBack() { + return true; + } } diff --git a/src/tconstruct/items/tools/Hammer.java b/src/tconstruct/items/tools/Hammer.java index 927e1341..dc3e2ee3 100644 --- a/src/tconstruct/items/tools/Hammer.java +++ b/src/tconstruct/items/tools/Hammer.java @@ -399,4 +399,24 @@ public class Hammer extends HarvestTool { return new String[] { "weapon", "harvest", "melee", "bludgeoning" }; } + + @Override + public boolean willAllowOffhandWeapon() { + return false; + } + + @Override + public boolean willAllowShield() { + return false; + } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } + + @Override + public boolean sheatheOnBack() { + return true; + } } diff --git a/src/tconstruct/items/tools/Hatchet.java b/src/tconstruct/items/tools/Hatchet.java index 2baad903..d0e3dda6 100644 --- a/src/tconstruct/items/tools/Hatchet.java +++ b/src/tconstruct/items/tools/Hatchet.java @@ -104,4 +104,9 @@ public class Hatchet extends HarvestTool { return "axe"; } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } } diff --git a/src/tconstruct/items/tools/LumberAxe.java b/src/tconstruct/items/tools/LumberAxe.java index 7e11e124..78119489 100644 --- a/src/tconstruct/items/tools/LumberAxe.java +++ b/src/tconstruct/items/tools/LumberAxe.java @@ -400,4 +400,24 @@ public class LumberAxe extends HarvestTool { return 1; } + + @Override + public boolean willAllowOffhandWeapon() { + return false; + } + + @Override + public boolean willAllowShield() { + return false; + } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } + + @Override + public boolean sheatheOnBack() { + return true; + } } diff --git a/src/tconstruct/items/tools/Mattock.java b/src/tconstruct/items/tools/Mattock.java index 47570f57..624ed60f 100644 --- a/src/tconstruct/items/tools/Mattock.java +++ b/src/tconstruct/items/tools/Mattock.java @@ -140,4 +140,24 @@ public class Mattock extends DualHarvestTool } return true; } + + @Override + public boolean willAllowOffhandWeapon() { + return false; + } + + @Override + public boolean willAllowShield() { + return false; + } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } + + @Override + public boolean sheatheOnBack() { + return true; + } } \ No newline at end of file diff --git a/src/tconstruct/items/tools/Pickaxe.java b/src/tconstruct/items/tools/Pickaxe.java index ce995f87..ac2ed5ff 100644 --- a/src/tconstruct/items/tools/Pickaxe.java +++ b/src/tconstruct/items/tools/Pickaxe.java @@ -68,4 +68,9 @@ public class Pickaxe extends HarvestTool { return "pickaxe"; } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } } diff --git a/src/tconstruct/items/tools/Scythe.java b/src/tconstruct/items/tools/Scythe.java index 080dfc11..0a5f986c 100644 --- a/src/tconstruct/items/tools/Scythe.java +++ b/src/tconstruct/items/tools/Scythe.java @@ -218,4 +218,23 @@ public class Scythe extends Weapon return true; } + @Override + public boolean willAllowOffhandWeapon() { + return false; + } + + @Override + public boolean willAllowShield() { + return false; + } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } + + @Override + public boolean sheatheOnBack() { + return true; + } } diff --git a/src/tconstruct/items/tools/Shortbow.java b/src/tconstruct/items/tools/Shortbow.java index 90e1654a..da72a52a 100644 --- a/src/tconstruct/items/tools/Shortbow.java +++ b/src/tconstruct/items/tools/Shortbow.java @@ -191,4 +191,24 @@ public class Shortbow extends BowBase } //return TConstructRegistry.getMaterial(type).ability(); } + + @Override + public boolean willAllowOffhandWeapon() { + return false; + } + + @Override + public boolean willAllowShield() { + return false; + } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } + + @Override + public boolean sheatheOnBack() { + return true; + } } diff --git a/src/tconstruct/items/tools/Shovel.java b/src/tconstruct/items/tools/Shovel.java index bc9d8a22..255000de 100644 --- a/src/tconstruct/items/tools/Shovel.java +++ b/src/tconstruct/items/tools/Shovel.java @@ -89,6 +89,11 @@ public class Shovel extends HarvestTool { return "shovel"; } + + @Override + public boolean isOffhandHandDualWeapon() { + return false; + } /*@Override public Icon getIcon (ItemStack stack, int renderPass) diff --git a/src/tconstruct/library/tools/ToolCore.java b/src/tconstruct/library/tools/ToolCore.java index b567d6b2..537fe00a 100644 --- a/src/tconstruct/library/tools/ToolCore.java +++ b/src/tconstruct/library/tools/ToolCore.java @@ -13,6 +13,8 @@ import tconstruct.library.ActiveToolMod; import tconstruct.library.TConstructRegistry; import tconstruct.library.crafting.ToolBuilder; +import mods.battlegear2.api.weapons.IBattlegearWeapon; +import mods.battlegear2.api.weapons.OffhandAttackEvent; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -26,6 +28,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Icon; import net.minecraft.world.World; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -55,7 +58,7 @@ import cpw.mods.fml.relauncher.SideOnly; * @see ToolMod */ -public abstract class ToolCore extends Item implements ICustomElectricItem, IBoxable +public abstract class ToolCore extends Item implements ICustomElectricItem, IBoxable, IBattlegearWeapon { protected Random random = new Random(); protected int damageVsEntity; @@ -615,7 +618,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity) { AbilityHelper.onLeftClickEntity(stack, player, entity, this, 0); - return true; + return false; } @Override @@ -937,4 +940,47 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox return tags.getCompoundTag("InfiTool").getInteger("Damage"); } + + @Override + public boolean willAllowOffhandWeapon() { + return true; + } + + @Override + public boolean willAllowShield() { + return true; + } + + @Override + public boolean isOffhandHandDualWeapon() { + return true; + } + + @Override + public boolean sheatheOnBack() { + return false; + } + + @Override + public boolean offhandAttackEntity(OffhandAttackEvent event, + ItemStack mainhandItem, ItemStack offhandItem) { + return true; + } + + @Override + public boolean offhandClickAir(PlayerInteractEvent event, + ItemStack mainhandItem, ItemStack offhandItem) { + return true; + } + + @Override + public boolean offhandClickBlock(PlayerInteractEvent event, + ItemStack mainhandItem, ItemStack offhandItem) { + return true; + } + + @Override + public void performPassiveEffects(Side effectiveSide, + ItemStack mainhandItem, ItemStack offhandItem) { + } } diff --git a/src/tconstruct/library/tools/Weapon.java b/src/tconstruct/library/tools/Weapon.java index ed95c69d..0f8f5e59 100644 --- a/src/tconstruct/library/tools/Weapon.java +++ b/src/tconstruct/library/tools/Weapon.java @@ -125,4 +125,6 @@ public abstract class Weapon extends ToolCore public static Material[] web = new Material[] { Material.web }; public static Material[] none = new Material[0]; + + } diff --git a/src/tconstruct/util/PHConstruct.java b/src/tconstruct/util/PHConstruct.java index 07577ba0..8f18bf95 100644 --- a/src/tconstruct/util/PHConstruct.java +++ b/src/tconstruct/util/PHConstruct.java @@ -361,6 +361,9 @@ public class PHConstruct cfgDimBlackList = config.get("DimBlackList", "SlimeIslandDimBlacklist",new int[]{}).getIntList(); slimeIslGenDim0Only = config.get("DimBlackList","GenerateSlimeIslandInDim0Only" , false).getBoolean(false); + //Addon stuff + isCleaverTwoHanded = config.get("Battlegear", "Can Cleavers have shields", true).getBoolean(true); + /* Save the configuration file */ config.save(); @@ -681,4 +684,7 @@ public class PHConstruct //dimensionblacklist public static boolean slimeIslGenDim0Only; public static int[] cfgDimBlackList; + + //Addon stuff + public static boolean isCleaverTwoHanded; }