From 288ea56b4c69eaf3bbd4709db95e370bec4f8e6c Mon Sep 17 00:00:00 2001 From: HbmMods Date: Thu, 11 Feb 2016 08:36:54 +0100 Subject: [PATCH] Finished Factories! --- assets/hbm/lang/de_DE.lang | 13 + assets/hbm/lang/en_US.lang | 13 + ...ced_alloy.png => block_advanced_alloy.png} | Bin assets/hbm/textures/gui/factory_advanced.png | Bin 0 -> 2250 bytes assets/hbm/textures/gui/factory_titanium.png | Bin 2204 -> 2246 bytes .../textures/items/factory_core_advanced.png | Bin 0 -> 301 bytes .../textures/items/factory_core_titanium.png | Bin 0 -> 304 bytes .../textures/items/ingot_advanced_alloy.png | Bin 0 -> 283 bytes .../textures/items/plate_advanced_alloy.png | Bin 0 -> 270 bytes com/hbm/blocks/FactoryCoreAdvanced.java | 79 +++ com/hbm/blocks/FactoryCoreTitanium.java | 80 +++ com/hbm/blocks/FactoryHatch.java | 125 +++- com/hbm/blocks/ModBlocks.java | 9 +- com/hbm/blocks/TileEntityCoreAdvanced.java | 621 ++++++++++++++++++ com/hbm/blocks/TileEntityCoreTitanium.java | 437 ++++++++++++ com/hbm/blocks/TileEntityMachineBattery.java | 10 + com/hbm/blocks/TileEntityMachineCoal.java | 10 + .../blocks/TileEntityMachineGenerator.java | 10 + com/hbm/gui/ContainerCoreAdvanced.java | 124 ++++ com/hbm/gui/ContainerCoreTitanium.java | 119 ++++ com/hbm/gui/GUICoreAdvanced.java | 52 ++ com/hbm/gui/GUICoreTitanium.java | 53 ++ com/hbm/gui/MachineRecipes.java | 5 + com/hbm/interfaces/IFactory.java | 15 + com/hbm/items/ItemBattery.java | 4 +- com/hbm/items/ModItems.java | 14 + com/hbm/main/CraftingManager.java | 10 + com/hbm/main/GUIHandler.java | 38 ++ com/hbm/main/MainRegistry.java | 4 + 29 files changed, 1836 insertions(+), 9 deletions(-) rename assets/hbm/textures/blocks/{block_reinforced_alloy.png => block_advanced_alloy.png} (100%) create mode 100644 assets/hbm/textures/gui/factory_advanced.png create mode 100644 assets/hbm/textures/items/factory_core_advanced.png create mode 100644 assets/hbm/textures/items/factory_core_titanium.png create mode 100644 assets/hbm/textures/items/ingot_advanced_alloy.png create mode 100644 assets/hbm/textures/items/plate_advanced_alloy.png create mode 100644 com/hbm/blocks/FactoryCoreAdvanced.java create mode 100644 com/hbm/blocks/FactoryCoreTitanium.java create mode 100644 com/hbm/blocks/TileEntityCoreAdvanced.java create mode 100644 com/hbm/blocks/TileEntityCoreTitanium.java create mode 100644 com/hbm/gui/ContainerCoreAdvanced.java create mode 100644 com/hbm/gui/ContainerCoreTitanium.java create mode 100644 com/hbm/gui/GUICoreAdvanced.java create mode 100644 com/hbm/gui/GUICoreTitanium.java create mode 100644 com/hbm/interfaces/IFactory.java diff --git a/assets/hbm/lang/de_DE.lang b/assets/hbm/lang/de_DE.lang index 8d71dd252..5788e4457 100644 --- a/assets/hbm/lang/de_DE.lang +++ b/assets/hbm/lang/de_DE.lang @@ -99,6 +99,17 @@ tile.launch_pad.name=Raketenabschussrampe container.launchPad=Raketenabschussrampe tile.book_guide.name=Hbm's Nuclear Tech Mod Handbuch +tile.factory_titanium_hull.name=Einfache Fabrikshülle +tile.factory_titanium_furnace.name=Einfache Fabrikzugriffsluke +tile.factory_titanium_core.name=Einfache Fabrikkernkomponente +item.factory_core_titanium.name=Einfacher Fabrikenergiecluster +container.factoryTitanium=Einfache Fabrik +tile.factory_advanced_hull.name=Fortgeschrittene Fabrikshülle +tile.factory_advanced_furnace.name=Fortgeschrittene Fabrikzugriffsluke +tile.factory_advanced_core.name=Fortgeschrittene Fabrikkernkomponente +item.factory_core_advanced.name=Fortgeschrittene Fabrikenergiecluster +container.factoryAdvanced=Fortgeschrittene Fabrik + tile.test_nuke.name=Test Atombombe item.ingot_uranium.name=Uranbarren @@ -124,6 +135,8 @@ item.plate_schrabidium.name=Schrabidiumplatte item.ingot_schrabidium.name=Schrabidiumbarren item.nugget_schrabidium.name=Schrabidiumnugget item.plate_copper.name=Kupferplatte +item.ingot_advanced_alloy.name=Fortgeschrittene Legierung +item.plate_advanced_alloy.name=Fortgeschrittene Legierungsplatte item.nugget_u235.name=U235-Nugget item.nugget_u238.name=U238-Nugget diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index acd0bfaaa..28c614532 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -99,6 +99,17 @@ tile.launch_pad.name=Missile Launch Pad container.launchPad=Missile Launch Pad tile.book_guide.name=Hbm's Nuclear Tech Mod Manual +tile.factory_titanium_hull.name=Basic Factory Casing +tile.factory_titanium_furnace.name=Basic Factory Access Hatch +tile.factory_titanium_core.name=Basic Factory Core Component +item.factory_core_titanium.name=Basic Factory Energy Cluster +container.factoryTitanium=Basic Factory +tile.factory_advanced_hull.name=Advanced Factory Casing +tile.factory_advanced_furnace.name=Advanced Factory Access Hatch +tile.factory_advanced_core.name=Advanced Factory Core Component +item.factory_core_advanced.name=Advanced Factory Energy Cluster +container.factoryAdvanced=Advanced Factory + tile.test_nuke.name=Test Nuke item.ingot_uranium.name=Uranium Ingot @@ -124,6 +135,8 @@ item.plate_schrabidium.name=Schrabidium Plate item.ingot_schrabidium.name=Schrabidium Ingot item.nugget_schrabidium.name=Schrabidium Nugget item.plate_copper.name=Copper Plate +item.ingot_advanced_alloy.name=Advanced Alloy Ingot +item.plate_advanced_alloy.name=Advanced Alloy Plate item.nugget_u235.name=U235 Nugget item.nugget_u238.name=U238 Nugget diff --git a/assets/hbm/textures/blocks/block_reinforced_alloy.png b/assets/hbm/textures/blocks/block_advanced_alloy.png similarity index 100% rename from assets/hbm/textures/blocks/block_reinforced_alloy.png rename to assets/hbm/textures/blocks/block_advanced_alloy.png diff --git a/assets/hbm/textures/gui/factory_advanced.png b/assets/hbm/textures/gui/factory_advanced.png new file mode 100644 index 0000000000000000000000000000000000000000..9868c4b8a99e724c17373e2638604331117870f2 GIT binary patch literal 2250 zcmeHIeKeG56u<9`(S$UqQ?u2nX{F6NzCuna^P0$zChIF^+A)(9VW=iV%=D!!qU^{i zS)FWK>uX6xWajKLl+TT(e56PwWl*Vc3})X^^w0je|84iY@43Hw&vWnd+~4y&_epeT zIM35rssjM?T;c zEkNsqs{;5f2J#}I=m3<4LFFDO3x-~M=(mH{HZWuf?@d9u7F4UDW*6Mw35}lc_YRP` zLdRCqyo?LTL z_#O;T?125B1w55=j4*2FM$r8Z0q9q0e&jW+Sb{mpd?#PNXZT)z6!%~tL~w(7d^27k zpJHuhVYVUEDxQJ$7Yi3h2d`+hqEjB(Ye7ojrYr6#yJOAul>#n%b&7&S_o;6pCms>6 ze17%C^-aZrhFe+>Z{IvH+RAUN%qA19ZBhhPMdl>rW61sP?7JwWb(j#bsVS2_x|jlC z8yjn100VcJKoYk1l)kgyTW=%-#g&F_CYp9PExFJ3&teE_#gE~Q3#!REXWfV`<}{JW z80pJ5F~LR(M_H!R0Uj!kUHIJ7=fWzYjrF*{8&Z<(ua%zQlz5_AuFKRX521_J@+RDl zFT@Qt>nvC2f|Ha)VUM3p9mm}dU9+scfQ73LRzJDE()i}>C3RtOa)?31@a=OlWp1?g z8Jq~}j^x=!NgmwCwe_m^?WHa<8?)JTAjpi`7?W3ufQoZR`1Q&;z(END!edSec! zGGsn$3Nk)28@Ogjf|Xl40vjGCkXJNZ63r%l7=CLO!;^x(AQ2hgwg7W! zcwT|Z*tO)s;Rm0B%RBTeD|5npa5E8f@uOJ`oI4luym#xlI|E2;CD{b@@yVFHLSBi$k?E7A|dC;YkFIrA5+MH_H~3 zCdLZOv9HuUdJvewS4J|C(py=$lD=yh+=(jl6Fnx|AJTe?ku&}S=NIdw&PA7t1BBM` zVptbn1Yy)ECNQ$>jtq^qTSXN;EsK};D_C-Kc3I58gO|_ztKud>;>2H2+eZUEA}D8m!R(xHvH!3u&C={{ZD` B8Mpud literal 0 HcmV?d00001 diff --git a/assets/hbm/textures/gui/factory_titanium.png b/assets/hbm/textures/gui/factory_titanium.png index d48f427925883e7503b8cad0c3dd20a027d7fdd3..2e24e9a2062b7d039621d19c3d8138c9dfe23e35 100644 GIT binary patch delta 1120 zcmbOucua6Z2n*K%1_r(Zj9J$@IVZ=lsMqUwx;TbZ#J#lqyt?*1$m+`?`#YpKouT!tmG&J7=AcFfUT z(|soGmPE&{7n}c{=eWAKe%s8ckC_hteIt8dM}v4nAfq`$GE*Ic8_Oh?3tuhbW_dL; zWiq{(pOo%#K=iX z>L}-d3PEuO^{XC24(lKMUQ@q4+e>Y&=~B*s{%oc59`f{ivj|GI?h!oK?E>}`J- z*ZjHmNa~r;0&8X&CX>s2oU`Q^cimsToiXC~YE4Fm-PVSO|AIXI$~x+w=mJrW+3y%; zWm?xMUitUk{3FMMe`hZ!ot3=c@J9H+hwWR!jGyj~4PJD2uEai5Gl_bJuRE8Wwc=w8 z)0adEKHH-^*fQ=H*X!18(Y3N>dUdnCM7GMBRpo;Di+552EYp5HR(iqr;KueFGE8fZ z2`Jb+*I6F@=k=z?g4qoPdt*=iYI@%14vq*A@l{qA&SnU<`@i`%DDFVfzv6ucBS`AP zJ!1|a1&L-UhP$orlPi|T_t(~|^+qsf++EoH@Y1m~Wsph`fX6bJxBK_6jcz@RTi#td zUXbhFUklRm!sB&Pg+aa@^LFsh6wruOFH^!Mqq#WF%#1A)D zZWaWq021I72}^$r4R^i#)*!h$lX1(pTgMA(!=d)wT-NFVdQ&MBb@0CPUUCjbBd delta 1078 zcmX>mI7e_p2n*Li1_r)^j5{V~znvV%qF&GB>Eakt5%>1a^P<@fB5jFJzTB%Wta{J; z`k#J}#19s&2a2aGKSjR({jb9&dv@%+i4)RQm#$c)G*|0)*Qy!ICpSAxy!7)t{~K1R zhUSo4w~fVDFqV8_VParl*pjyyNHQ=WaRm3J!_j-e7s?nGut#42$*;Yw16C%xS1-Hao9T&7Hh%ACGUhQ)zkP7uiJWEnY?rit zmHn4nSaoH4eWazH!Jc`->;`%hxDTvwFk?t&`pMA4(ZX`!>y33~%N!eLF#MWU>dX|$ z$iw-B)gX1Bsfs4 zs*Y@8%ZT^Xoo;`0+D&knKfZRXOc|sQ1YnvVocphTg(;t_XSh}VviQ#J zi@Eog2<9`~y}V22{h8anU?m^|<~OiFowX%U3mG~xS%CV1p{&cW<@>GYJNB=>z0Xtm z9z)f(m-R(8PPg+w(qM35*I7{7g@6yY&u*0hr9uXV6VeIinHOlidaO2?*&+1B4b7Cg zf2Ic>9#)un%QZUe#lzIFde4hI2a6dZI5OHER5Ext7_*#bT_Ada=iq0?3>FjT4|5o@ z7|#mqIc(2TdrB^0p6!7cpbGv4^;dwpm^FecIWkV4UGwhG=Q^o1_b)AxYU@e7?5BPK*B`41RMhYahP(S^Pc!&aTS$-|kwA>&Ne^dwT1tef<9V z-+v!JU(e1jZ(FzN|CiIZ%ir7A{Q2_p=4YUqy>*N4+X^Cb8Uuqo*sBg@4544eZRUsD TOo-jv0uu6c^>bP0l+XkK@%5_j diff --git a/assets/hbm/textures/items/factory_core_advanced.png b/assets/hbm/textures/items/factory_core_advanced.png new file mode 100644 index 0000000000000000000000000000000000000000..0ae9ed3eb3d043b44ac2b98b44cb47d0770e68e3 GIT binary patch literal 301 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXPIMM=Lb}?+SA1` z#KM2=q>a3X9C%!HQyIFhyg9(J@Vtbig0%rxkd>5KqS9jdm(ugk_c<)82rBvc{$-bN zXl{h-myR9V`K9mZ$*x~5VVF{++Hm|Q^LdGvOg}7nmW#-5bWqE`U7Q{nmOSg38qSezG literal 0 HcmV?d00001 diff --git a/assets/hbm/textures/items/factory_core_titanium.png b/assets/hbm/textures/items/factory_core_titanium.png new file mode 100644 index 0000000000000000000000000000000000000000..40b868a01998f863e423f580f09b3767fe19420e GIT binary patch literal 304 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt33 zJ}`M~P2gE5B^$ sbJ?(mRUq-p31;gGAqEMTHPu#i(NYb@k-PbUZe?KbboFyt=akR{0IpSJ_5c6? literal 0 HcmV?d00001 diff --git a/assets/hbm/textures/items/ingot_advanced_alloy.png b/assets/hbm/textures/items/ingot_advanced_alloy.png new file mode 100644 index 0000000000000000000000000000000000000000..cecfb0b8eaa1eec1217493102c394dacc98d74aa GIT binary patch literal 283 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXPIMM=Lb|X)6>N< z#KQmTgwvc21_G?x+0UCPaBNH9mCHHIXA{w7evpl&djlJH=N=VlbHyVSLh?KsDaZK# zrYlcm`ev4|)418##?8r7cW+Se;|{k)K?+`bIQ06$JU9#WP9!_9FnU;hQh3;Ng!_Sk zdyr6s_hH!${)e~chDJ@=aUf1QiBa=GuY%z(^(3RFhA9pqT*n3ZQam3DRO;5+EaDbF W$uYw}Gh-vrkqn-$elF{r5}E+n0#~;H literal 0 HcmV?d00001 diff --git a/assets/hbm/textures/items/plate_advanced_alloy.png b/assets/hbm/textures/items/plate_advanced_alloy.png new file mode 100644 index 0000000000000000000000000000000000000000..dcea22779351fe9e3095707beb1d0c60eb4b5193 GIT binary patch literal 270 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXPIMM=Lb~NB|yPi3BFo*lC1 zn~yWBP^ytw&Y0l1fKfqRDR}~0NzY}5AcHo>CrN9Xjy(R)!*KKA+Q+)Knty=qV(@hJ Kb6Mw<&;$SiLReA& literal 0 HcmV?d00001 diff --git a/com/hbm/blocks/FactoryCoreAdvanced.java b/com/hbm/blocks/FactoryCoreAdvanced.java new file mode 100644 index 000000000..81d13029e --- /dev/null +++ b/com/hbm/blocks/FactoryCoreAdvanced.java @@ -0,0 +1,79 @@ +package com.hbm.blocks; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class FactoryCoreAdvanced extends BlockContainer { + + private final Random field_149933_a = new Random(); + private static boolean keepInventory; + + protected FactoryCoreAdvanced(Material p_i45386_1_) { + super(p_i45386_1_); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileEntityCoreAdvanced(); + } + + @Override + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) + { + if (!keepInventory) + { + TileEntityCoreAdvanced tileentityfurnace = (TileEntityCoreAdvanced)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + + if (tileentityfurnace != null) + { + for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) + { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + + if (itemstack != null) + { + float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + + while (itemstack.stackSize > 0) + { + int j1 = this.field_149933_a.nextInt(21) + 10; + + if (j1 > itemstack.stackSize) + { + j1 = itemstack.stackSize; + } + + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + + if (itemstack.hasTagCompound()) + { + entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); + } + + float f3 = 0.05F; + entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } + + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } + + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } +} diff --git a/com/hbm/blocks/FactoryCoreTitanium.java b/com/hbm/blocks/FactoryCoreTitanium.java new file mode 100644 index 000000000..efd66639a --- /dev/null +++ b/com/hbm/blocks/FactoryCoreTitanium.java @@ -0,0 +1,80 @@ +package com.hbm.blocks; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class FactoryCoreTitanium extends BlockContainer { + + private final Random field_149933_a = new Random(); + private static boolean keepInventory; + + protected FactoryCoreTitanium(Material p_i45386_1_) { + super(p_i45386_1_); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileEntityCoreTitanium(); + } + + @Override + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) + { + if (!keepInventory) + { + TileEntityCoreTitanium tileentityfurnace = (TileEntityCoreTitanium)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + + if (tileentityfurnace != null) + { + for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) + { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + + if (itemstack != null) + { + float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + + while (itemstack.stackSize > 0) + { + int j1 = this.field_149933_a.nextInt(21) + 10; + + if (j1 > itemstack.stackSize) + { + j1 = itemstack.stackSize; + } + + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + + if (itemstack.hasTagCompound()) + { + entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); + } + + float f3 = 0.05F; + entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } + + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } + + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } + +} diff --git a/com/hbm/blocks/FactoryHatch.java b/com/hbm/blocks/FactoryHatch.java index 41736f3c1..f79cd9721 100644 --- a/com/hbm/blocks/FactoryHatch.java +++ b/com/hbm/blocks/FactoryHatch.java @@ -15,6 +15,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -106,22 +107,136 @@ public class FactoryHatch extends Block { } } - /*@Override + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) { return true; } else if(!player.isSneaking()) { - TileEntityNukeFurnace entity = (TileEntityNukeFurnace) world.getTileEntity(x, y, z); - if(entity != null) + if(this == ModBlocks.factory_titanium_furnace) { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_furnace, world, x, y, z); + if(world.getBlockMetadata(x, y, z) == 2) + { + if(world.getTileEntity(x, y, z + 1) instanceof TileEntityCoreTitanium) + { + if(((TileEntityCoreTitanium)world.getTileEntity(x, y, z + 1)).isStructureValid(world)) + { + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_titanium, world, x, y, z + 1); + } else { + player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Structure not valid!")); + } + } else { + player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Core not found!")); + } + } + if(world.getBlockMetadata(x, y, z) == 3) + { + if(world.getTileEntity(x, y, z - 1) instanceof TileEntityCoreTitanium) + { + if(((TileEntityCoreTitanium)world.getTileEntity(x, y, z - 1)).isStructureValid(world)) + { + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_titanium, world, x, y, z - 1); + } else { + player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Structure not valid!")); + } + } else { + player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Core not found!")); + } + } + if(world.getBlockMetadata(x, y, z) == 4) + { + if(world.getTileEntity(x + 1, y, z) instanceof TileEntityCoreTitanium) + { + if(((TileEntityCoreTitanium)world.getTileEntity(x + 1, y, z)).isStructureValid(world)) + { + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_titanium, world, x + 1, y, z); + } else { + player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Structure not valid!")); + } + } else { + player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Core not found!")); + } + } + if(world.getBlockMetadata(x, y, z) == 5) + { + if(world.getTileEntity(x - 1, y, z) instanceof TileEntityCoreTitanium) + { + if(((TileEntityCoreTitanium)world.getTileEntity(x - 1, y, z)).isStructureValid(world)) + { + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_titanium, world, x - 1, y, z); + } else { + player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Structure not valid!")); + } + } else { + player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Core not found!")); + } + } + } + + if(this == ModBlocks.factory_advanced_furnace) + { + if(world.getBlockMetadata(x, y, z) == 2) + { + if(world.getTileEntity(x, y, z + 1) instanceof TileEntityCoreAdvanced) + { + if(((TileEntityCoreAdvanced)world.getTileEntity(x, y, z + 1)).isStructureValid(world)) + { + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_advanced, world, x, y, z + 1); + } else { + player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Structure not valid!")); + } + } else { + player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Core not found!")); + } + } + if(world.getBlockMetadata(x, y, z) == 3) + { + if(world.getTileEntity(x, y, z - 1) instanceof TileEntityCoreAdvanced) + { + if(((TileEntityCoreAdvanced)world.getTileEntity(x, y, z - 1)).isStructureValid(world)) + { + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_advanced, world, x, y, z - 1); + } else { + player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Structure not valid!")); + } + } else { + player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Core not found!")); + } + } + if(world.getBlockMetadata(x, y, z) == 4) + { + if(world.getTileEntity(x + 1, y, z) instanceof TileEntityCoreAdvanced) + { + if(((TileEntityCoreAdvanced)world.getTileEntity(x + 1, y, z)).isStructureValid(world)) + { + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_advanced, world, x + 1, y, z); + } else { + player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Structure not valid!")); + } + } else { + player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Core not found!")); + } + } + if(world.getBlockMetadata(x, y, z) == 5) + { + if(world.getTileEntity(x - 1, y, z) instanceof TileEntityCoreAdvanced) + { + if(((TileEntityCoreAdvanced)world.getTileEntity(x - 1, y, z)).isStructureValid(world)) + { + FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_advanced, world, x - 1, y, z); + } else { + player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Structure not valid!")); + } + } else { + player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Core not found!")); + } + } } return true; } else { return false; } - }*/ + } } diff --git a/com/hbm/blocks/ModBlocks.java b/com/hbm/blocks/ModBlocks.java index eead5aea2..aaa7e5825 100644 --- a/com/hbm/blocks/ModBlocks.java +++ b/com/hbm/blocks/ModBlocks.java @@ -57,6 +57,7 @@ public class ModBlocks { public static Block block_waste; public static Block block_beryllium; public static Block block_schrabidium; + public static Block block_advanced_alloy; public static Block reinforced_brick; public static Block reinforced_glass; @@ -175,10 +176,12 @@ public class ModBlocks { public static Block factory_titanium_hull; public static Block factory_titanium_furnace; public static Block factory_titanium_core; + public static final int guiID_factory_titanium = 24; public static Block factory_advanced_hull; public static Block factory_advanced_furnace; public static Block factory_advanced_core; + public static final int guiID_factory_advanced = 25; public static Block launch_pad; public static Block launch_pad_generic; @@ -251,6 +254,7 @@ public class ModBlocks { block_waste = new BlockOre(Material.iron).setBlockName("block_waste").setCreativeTab(MainRegistry.tabBlock).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_waste"); block_beryllium = new BlockGeneric(Material.iron).setBlockName("block_beryllium").setCreativeTab(MainRegistry.tabBlock).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_beryllium"); block_schrabidium = new BlockGeneric(Material.iron).setBlockName("block_schrabidium").setCreativeTab(MainRegistry.tabBlock).setHardness(5.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":block_schrabidium"); + block_advanced_alloy = new BlockGeneric(Material.iron).setBlockName("block_advanced_alloy").setCreativeTab(MainRegistry.tabBlock).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_advanced_alloy"); reinforced_brick = new BlockGeneric(Material.rock).setBlockName("reinforced_brick").setCreativeTab(MainRegistry.tabBlock).setLightOpacity(15).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_brick"); reinforced_glass = new ReinforcedBlock(Material.glass).setBlockName("reinforced_glass").setCreativeTab(MainRegistry.tabBlock).setLightOpacity(0).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_glass"); @@ -340,10 +344,10 @@ public class ModBlocks { factory_titanium_hull = new BlockGeneric(Material.iron).setBlockName("factory_titanium_hull").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_titanium_hull"); factory_titanium_furnace = new FactoryHatch(Material.iron).setBlockName("factory_titanium_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_titanium_furnace"); - factory_titanium_core = new BlockGeneric(Material.iron).setBlockName("factory_titanium_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_titanium_core"); + factory_titanium_core = new FactoryCoreTitanium(Material.iron).setBlockName("factory_titanium_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_titanium_core"); factory_advanced_hull = new BlockGeneric(Material.iron).setBlockName("factory_advanced_hull").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_advanced_hull"); factory_advanced_furnace = new FactoryHatch(Material.iron).setBlockName("factory_advanced_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_advanced_furnace"); - factory_advanced_core = new BlockGeneric(Material.iron).setBlockName("factory_advanced_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_advanced_core"); + factory_advanced_core = new FactoryCoreAdvanced(Material.iron).setBlockName("factory_advanced_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_advanced_core"); launch_pad = new LaunchPad(Material.iron).setBlockName("launch_pad").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabNuke).setBlockTextureName(RefStrings.MODID + ":launch_pad"); launch_pad_generic = new LaunchPad(Material.iron).setBlockName("launch_pad_generic").setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":launch_pad"); @@ -406,6 +410,7 @@ public class ModBlocks { GameRegistry.registerBlock(block_niter, block_niter.getUnlocalizedName()); GameRegistry.registerBlock(block_copper, block_copper.getUnlocalizedName()); GameRegistry.registerBlock(block_red_copper, block_red_copper.getUnlocalizedName()); + GameRegistry.registerBlock(block_advanced_alloy, block_advanced_alloy.getUnlocalizedName()); GameRegistry.registerBlock(block_tungsten, block_tungsten.getUnlocalizedName()); GameRegistry.registerBlock(block_aluminium, block_aluminium.getUnlocalizedName()); GameRegistry.registerBlock(block_fluorite, block_fluorite.getUnlocalizedName()); diff --git a/com/hbm/blocks/TileEntityCoreAdvanced.java b/com/hbm/blocks/TileEntityCoreAdvanced.java new file mode 100644 index 000000000..5fa757c37 --- /dev/null +++ b/com/hbm/blocks/TileEntityCoreAdvanced.java @@ -0,0 +1,621 @@ +package com.hbm.blocks; + +import com.hbm.interfaces.IFactory; +import com.hbm.items.ModItems; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class TileEntityCoreAdvanced extends TileEntity implements ISidedInventory, IFactory { + + public int progress = 0; + public int power = 0; + public final static int processTime = 100; + public final static int maxPower = ModItems.factory_core_advanced.getMaxDamage(); + private ItemStack slots[]; + + private String customName; + + public TileEntityCoreAdvanced() { + slots = new ItemStack[27]; + } + @Override + public int getSizeInventory() { + return slots.length; + } + + @Override + public ItemStack getStackInSlot(int i) { + return slots[i]; + } + + @Override + public ItemStack getStackInSlotOnClosing(int i) { + if(slots[i] != null) + { + ItemStack itemStack = slots[i]; + slots[i] = null; + return itemStack; + } else { + return null; + } + } + + @Override + public void setInventorySlotContents(int i, ItemStack itemStack) { + slots[i] = itemStack; + if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) + { + itemStack.stackSize = getInventoryStackLimit(); + } + } + + @Override + public String getInventoryName() { + return this.hasCustomInventoryName() ? this.customName : "container.factoryAdvanced"; + } + + @Override + public boolean hasCustomInventoryName() { + return this.customName != null && this.customName.length() > 0; + } + + public void setCustomName(String name) { + this.customName = name; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player) { + if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) + { + return false; + }else{ + return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64; + } + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemStack) { + return true; + } + + @Override + public ItemStack decrStackSize(int i, int j) { + if(slots[i] != null) + { + if(slots[i].stackSize <= j) + { + ItemStack itemStack = slots[i]; + slots[i] = null; + return itemStack; + } + ItemStack itemStack1 = slots[i].splitStack(j); + if (slots[i].stackSize == 0) + { + slots[i] = null; + } + + return itemStack1; + } else { + return null; + } + } + + @Override + public int[] getAccessibleSlotsFromSide(int p_94128_1_) { + return null; + } + + @Override + public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) { + return false; + } + + @Override + public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) { + return false; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + NBTTagList list = nbt.getTagList("items", 10); + + this.progress = nbt.getShort("cookTime"); + slots = new ItemStack[getSizeInventory()]; + + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound nbt1 = list.getCompoundTagAt(i); + byte b0 = nbt1.getByte("slot"); + if(b0 >= 0 && b0 < slots.length) + { + slots[b0] = ItemStack.loadItemStackFromNBT(nbt1); + } + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setShort("cookTime", (short) progress); + NBTTagList list = new NBTTagList(); + + for(int i = 0; i < slots.length; i++) + { + if(slots[i] != null) + { + NBTTagCompound nbt1 = new NBTTagCompound(); + nbt1.setByte("slot", (byte)i); + slots[i].writeToNBT(nbt1); + list.appendTag(nbt1); + } + } + nbt.setTag("items", list); + } + + @Override + public boolean isStructureValid(World world) { + if(world.getBlock(this.xCoord, this.yCoord, this.zCoord) == ModBlocks.factory_advanced_core && + world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord - 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord - 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord - 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord + 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord + 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord + 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord - 1, this.yCoord, this.zCoord - 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord, this.yCoord, this.zCoord - 1) == ModBlocks.factory_advanced_furnace && + world.getBlock(this.xCoord + 1, this.yCoord, this.zCoord - 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord - 1, this.yCoord, this.zCoord) == ModBlocks.factory_advanced_furnace && + world.getBlock(this.xCoord + 1, this.yCoord, this.zCoord) == ModBlocks.factory_advanced_furnace && + world.getBlock(this.xCoord - 1, this.yCoord, this.zCoord + 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord, this.yCoord, this.zCoord + 1) == ModBlocks.factory_advanced_furnace && + world.getBlock(this.xCoord + 1, this.yCoord, this.zCoord + 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord - 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord - 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord - 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord + 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord + 1) == ModBlocks.factory_advanced_hull && + world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord + 1) == ModBlocks.factory_advanced_hull) + { + return true; + } + return false; + } + + public int getPowerScaled(int i) { + return (power * i) / maxPower; + } + + public int getProgressScaled(int i) { + return (progress * i) / processTime; + } + + public boolean isProcessable(ItemStack item) { + if(item != null) + { + return FurnaceRecipes.smelting().getSmeltingResult(item) != null; + } else { + return false; + } + } + + @Override + public void updateEntity() { + if(this.slots[22] != null && this.slots[22].getItem() == ModItems.factory_core_advanced) + { + this.power = ModItems.factory_core_advanced.getMaxDamage() - this.slots[22].getItemDamage(); + } else { + this.power = 0; + } + + if(this.slots[9] == null) + { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null && isProcessable(slots[i])) + { + slots[9] = slots[i].copy(); + slots[i] = null; + break; + } + } + } else { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null) + { + if(slots[i].getItem() == slots[9].getItem() && slots[i].getItemDamage() == slots[9].getItemDamage()) + { + if(slots[9].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) + { + slots[9].stackSize += slots[i].stackSize; + slots[i] = null; + } else { + int j = slots[9].getMaxStackSize() - slots[9].stackSize; + slots[9].stackSize += j; + slots[i].stackSize -= j; + } + break; + } + } + } + } + + if(this.slots[10] == null) + { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null && isProcessable(slots[i])) + { + slots[10] = slots[i].copy(); + slots[i] = null; + break; + } + } + } else { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null) + { + if(slots[i].getItem() == slots[10].getItem() && slots[i].getItemDamage() == slots[10].getItemDamage()) + { + if(slots[10].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) + { + slots[10].stackSize += slots[i].stackSize; + slots[i] = null; + } else { + int j = slots[10].getMaxStackSize() - slots[10].stackSize; + slots[10].stackSize += j; + slots[i].stackSize -= j; + } + break; + } + } + } + } + + if(this.slots[23] == null) + { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null && isProcessable(slots[i])) + { + slots[23] = slots[i].copy(); + slots[i] = null; + break; + } + } + } else { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null) + { + if(slots[i].getItem() == slots[23].getItem() && slots[i].getItemDamage() == slots[23].getItemDamage()) + { + if(slots[23].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) + { + slots[23].stackSize += slots[i].stackSize; + slots[i] = null; + } else { + int j = slots[23].getMaxStackSize() - slots[23].stackSize; + slots[23].stackSize += j; + slots[i].stackSize -= j; + } + break; + } + } + } + } + + if(this.slots[24] == null) + { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null && isProcessable(slots[i])) + { + slots[24] = slots[i].copy(); + slots[i] = null; + break; + } + } + } else { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null) + { + if(slots[i].getItem() == slots[24].getItem() && slots[i].getItemDamage() == slots[24].getItemDamage()) + { + if(slots[24].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) + { + slots[24].stackSize += slots[i].stackSize; + slots[i] = null; + } else { + int j = slots[24].getMaxStackSize() - slots[24].stackSize; + slots[24].stackSize += j; + slots[i].stackSize -= j; + } + break; + } + } + } + } + + if(this.power > 0 && (isProcessable(slots[9]) || isProcessable(slots[10]) || isProcessable(slots[23]) || isProcessable(slots[24])) && isStructureValid(worldObj)) + { + this.progress += 1; + this.slots[22].setItemDamage(this.slots[22].getItemDamage() + 1); + } else { + this.progress = 0; + } + + if(slots[9] != null && slots[11] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[9]).getItem() != slots[11].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[9]).getItemDamage() != slots[11].getItemDamage())) + { + this.progress = 0; + } + + if(slots[10] != null && slots[12] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[10]).getItem() != slots[12].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[10]).getItemDamage() != slots[12].getItemDamage())) + { + this.progress = 0; + } + + if(slots[23] != null && slots[25] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[23]).getItem() != slots[25].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[23]).getItemDamage() != slots[25].getItemDamage())) + { + this.progress = 0; + } + + if(slots[24] != null && slots[26] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[24]).getItem() != slots[26].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[24]).getItemDamage() != slots[26].getItemDamage())) + { + this.progress = 0; + } + + if(this.progress >= this.processTime) + { + if(this.slots[9] != null && isProcessable(this.slots[9])) + { + ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[9]); + if(slots[11] == null) + { + slots[11] = itemStack.copy(); + }else if(slots[11].isItemEqual(itemStack)) { + slots[11].stackSize += itemStack.stackSize; + } + if(slots[9].stackSize <= 0) + { + slots[9] = new ItemStack(slots[9].getItem().setFull3D()); + }else{ + slots[9].stackSize--; + } + if(slots[9].stackSize <= 0) + { + slots[9] = null; + } + } + if(this.slots[10] != null && isProcessable(this.slots[10])) + { + ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[10]); + if(slots[12] == null) + { + slots[12] = itemStack.copy(); + }else if(slots[12].isItemEqual(itemStack)) { + slots[12].stackSize += itemStack.stackSize; + } + if(slots[10].stackSize <= 0) + { + slots[10] = new ItemStack(slots[10].getItem().setFull3D()); + }else{ + slots[10].stackSize--; + } + if(slots[10].stackSize <= 0) + { + slots[10] = null; + } + } + if(this.slots[23] != null && isProcessable(this.slots[23])) + { + ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[23]); + if(slots[25] == null) + { + slots[25] = itemStack.copy(); + }else if(slots[25].isItemEqual(itemStack)) { + slots[25].stackSize += itemStack.stackSize; + } + if(slots[23].stackSize <= 0) + { + slots[23] = new ItemStack(slots[23].getItem().setFull3D()); + }else{ + slots[23].stackSize--; + } + if(slots[23].stackSize <= 0) + { + slots[23] = null; + } + } + if(this.slots[24] != null && isProcessable(this.slots[24])) + { + ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[24]); + if(slots[26] == null) + { + slots[26] = itemStack.copy(); + }else if(slots[26].isItemEqual(itemStack)) { + slots[26].stackSize += itemStack.stackSize; + } + if(slots[24].stackSize <= 0) + { + slots[24] = new ItemStack(slots[24].getItem().setFull3D()); + }else{ + slots[24].stackSize--; + } + if(slots[24].stackSize <= 0) + { + slots[24] = null; + } + } + + this.progress = 0; + } + + if(this.slots[11] != null) + { + for(int i = 0; i < 9; i++) + { + int j = i + 13; + if(slots[j] != null) + { + if(slots[j].getItem() == slots[11].getItem() && slots[j].getItemDamage() == slots[11].getItemDamage()) + { + if(slots[j].stackSize < slots[j].getMaxStackSize()) + { + if(slots[j].stackSize + slots[11].stackSize <= slots[11].getMaxStackSize()) + { + slots[j].stackSize += slots[11].stackSize; + slots[11] = null; + break; + } else { + int k = slots[j].getMaxStackSize() - slots[j].stackSize; + if(k < 0) + { + slots[j].stackSize += k; + slots[11].stackSize -= k; + break; + } + } + } + } + } else { + slots[j] = slots[11].copy(); + slots[11] = null; + break; + } + } + } + + if(this.slots[12] != null) + { + for(int i = 0; i < 9; i++) + { + int j = i + 13; + if(slots[j] != null) + { + if(slots[j].getItem() == slots[12].getItem() && slots[j].getItemDamage() == slots[12].getItemDamage()) + { + if(slots[j].stackSize < slots[j].getMaxStackSize()) + { + if(slots[j].stackSize + slots[12].stackSize <= slots[12].getMaxStackSize()) + { + slots[j].stackSize += slots[12].stackSize; + slots[12] = null; + break; + } else { + int k = slots[j].getMaxStackSize() - slots[j].stackSize; + if(k < 0) + { + slots[j].stackSize += k; + slots[12].stackSize -= k; + break; + } + } + } + } + } else { + slots[j] = slots[12].copy(); + slots[12] = null; + break; + } + } + } + + if(this.slots[25] != null) + { + for(int i = 0; i < 9; i++) + { + int j = i + 13; + if(slots[j] != null) + { + if(slots[j].getItem() == slots[25].getItem() && slots[j].getItemDamage() == slots[25].getItemDamage()) + { + if(slots[j].stackSize < slots[j].getMaxStackSize()) + { + if(slots[j].stackSize + slots[25].stackSize <= slots[25].getMaxStackSize()) + { + slots[j].stackSize += slots[25].stackSize; + slots[25] = null; + break; + } else { + int k = slots[j].getMaxStackSize() - slots[j].stackSize; + if(k < 0) + { + slots[j].stackSize += k; + slots[25].stackSize -= k; + break; + } + } + } + } + } else { + slots[j] = slots[25].copy(); + slots[25] = null; + break; + } + } + } + + if(this.slots[26] != null) + { + for(int i = 0; i < 9; i++) + { + int j = i + 13; + if(slots[j] != null) + { + if(slots[j].getItem() == slots[26].getItem() && slots[j].getItemDamage() == slots[26].getItemDamage()) + { + if(slots[j].stackSize < slots[j].getMaxStackSize()) + { + if(slots[j].stackSize + slots[26].stackSize <= slots[26].getMaxStackSize()) + { + slots[j].stackSize += slots[26].stackSize; + slots[26] = null; + break; + } else { + int k = slots[j].getMaxStackSize() - slots[j].stackSize; + if(k < 0) + { + slots[j].stackSize += k; + slots[26].stackSize -= k; + break; + } + } + } + } + } else { + slots[j] = slots[26].copy(); + slots[26] = null; + break; + } + } + } + } +} diff --git a/com/hbm/blocks/TileEntityCoreTitanium.java b/com/hbm/blocks/TileEntityCoreTitanium.java new file mode 100644 index 000000000..8de9fe209 --- /dev/null +++ b/com/hbm/blocks/TileEntityCoreTitanium.java @@ -0,0 +1,437 @@ +package com.hbm.blocks; + +import com.hbm.interfaces.IFactory; +import com.hbm.items.ModItems; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class TileEntityCoreTitanium extends TileEntity implements ISidedInventory, IFactory { + + public int progress = 0; + public int power = 0; + public final static int processTime = 200; + public final static int maxPower = ModItems.factory_core_titanium.getMaxDamage(); + private ItemStack slots[]; + + private String customName; + + public TileEntityCoreTitanium() { + slots = new ItemStack[23]; + } + @Override + public int getSizeInventory() { + return slots.length; + } + + @Override + public ItemStack getStackInSlot(int i) { + return slots[i]; + } + + @Override + public ItemStack getStackInSlotOnClosing(int i) { + if(slots[i] != null) + { + ItemStack itemStack = slots[i]; + slots[i] = null; + return itemStack; + } else { + return null; + } + } + + @Override + public void setInventorySlotContents(int i, ItemStack itemStack) { + slots[i] = itemStack; + if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) + { + itemStack.stackSize = getInventoryStackLimit(); + } + } + + @Override + public String getInventoryName() { + return this.hasCustomInventoryName() ? this.customName : "container.factoryTitanium"; + } + + @Override + public boolean hasCustomInventoryName() { + return this.customName != null && this.customName.length() > 0; + } + + public void setCustomName(String name) { + this.customName = name; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player) { + if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) + { + return false; + }else{ + return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64; + } + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemStack) { + return true; + } + + @Override + public ItemStack decrStackSize(int i, int j) { + if(slots[i] != null) + { + if(slots[i].stackSize <= j) + { + ItemStack itemStack = slots[i]; + slots[i] = null; + return itemStack; + } + ItemStack itemStack1 = slots[i].splitStack(j); + if (slots[i].stackSize == 0) + { + slots[i] = null; + } + + return itemStack1; + } else { + return null; + } + } + + @Override + public int[] getAccessibleSlotsFromSide(int p_94128_1_) { + return null; + } + + @Override + public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) { + return false; + } + + @Override + public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) { + return false; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + NBTTagList list = nbt.getTagList("items", 10); + + this.progress = nbt.getShort("cookTime"); + slots = new ItemStack[getSizeInventory()]; + + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound nbt1 = list.getCompoundTagAt(i); + byte b0 = nbt1.getByte("slot"); + if(b0 >= 0 && b0 < slots.length) + { + slots[b0] = ItemStack.loadItemStackFromNBT(nbt1); + } + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setShort("cookTime", (short) progress); + NBTTagList list = new NBTTagList(); + + for(int i = 0; i < slots.length; i++) + { + if(slots[i] != null) + { + NBTTagCompound nbt1 = new NBTTagCompound(); + nbt1.setByte("slot", (byte)i); + slots[i].writeToNBT(nbt1); + list.appendTag(nbt1); + } + } + nbt.setTag("items", list); + } + + @Override + public boolean isStructureValid(World world) { + if(world.getBlock(this.xCoord, this.yCoord, this.zCoord) == ModBlocks.factory_titanium_core && + world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord - 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord - 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord - 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord + 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord + 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord + 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord - 1, this.yCoord, this.zCoord - 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord, this.yCoord, this.zCoord - 1) == ModBlocks.factory_titanium_furnace && + world.getBlock(this.xCoord + 1, this.yCoord, this.zCoord - 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord - 1, this.yCoord, this.zCoord) == ModBlocks.factory_titanium_furnace && + world.getBlock(this.xCoord + 1, this.yCoord, this.zCoord) == ModBlocks.factory_titanium_furnace && + world.getBlock(this.xCoord - 1, this.yCoord, this.zCoord + 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord, this.yCoord, this.zCoord + 1) == ModBlocks.factory_titanium_furnace && + world.getBlock(this.xCoord + 1, this.yCoord, this.zCoord + 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord - 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord - 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord - 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord + 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord + 1) == ModBlocks.factory_titanium_hull && + world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord + 1) == ModBlocks.factory_titanium_hull) + { + return true; + } + return false; + } + + public int getPowerScaled(int i) { + return (power * i) / maxPower; + } + + public int getProgressScaled(int i) { + return (progress * i) / processTime; + } + + public boolean isProcessable(ItemStack item) { + if(item != null) + { + return FurnaceRecipes.smelting().getSmeltingResult(item) != null; + } else { + return false; + } + } + + @Override + public void updateEntity() { + if(this.slots[22] != null && this.slots[22].getItem() == ModItems.factory_core_titanium) + { + this.power = ModItems.factory_core_titanium.getMaxDamage() - this.slots[22].getItemDamage(); + } else { + this.power = 0; + } + + if(this.slots[9] == null) + { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null && isProcessable(slots[i])) + { + slots[9] = slots[i].copy(); + slots[i] = null; + break; + } + } + } else { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null) + { + if(slots[i].getItem() == slots[9].getItem() && slots[i].getItemDamage() == slots[9].getItemDamage()) + { + if(slots[9].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) + { + slots[9].stackSize += slots[i].stackSize; + slots[i] = null; + } else { + int j = 64 - slots[9].stackSize; + slots[9].stackSize += j; + slots[i].stackSize -= j; + } + break; + } + } + } + } + + if(this.slots[10] == null) + { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null && isProcessable(slots[i])) + { + slots[10] = slots[i].copy(); + slots[i] = null; + break; + } + } + } else { + for(int i = 0; i < 9; i++) + { + if(slots[i] != null) + { + if(slots[i].getItem() == slots[10].getItem() && slots[i].getItemDamage() == slots[10].getItemDamage()) + { + if(slots[10].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) + { + slots[10].stackSize += slots[i].stackSize; + slots[i] = null; + } else { + int j = 64 - slots[10].stackSize; + slots[10].stackSize += j; + slots[i].stackSize -= j; + } + break; + } + } + } + } + + if(this.power > 0 && (isProcessable(slots[9]) || isProcessable(slots[10])) && isStructureValid(worldObj)) + { + this.progress += 1; + this.slots[22].setItemDamage(this.slots[22].getItemDamage() + 1); + } else { + this.progress = 0; + } + + if(slots[9] != null && slots[11] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[9]).getItem() != slots[11].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[9]).getItemDamage() != slots[11].getItemDamage())) + { + this.progress = 0; + } + + if(slots[10] != null && slots[12] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[10]).getItem() != slots[12].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[10]).getItemDamage() != slots[12].getItemDamage())) + { + this.progress = 0; + } + + if(this.progress >= this.processTime) + { + if(this.slots[9] != null && isProcessable(this.slots[9])) + { + ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[9]); + if(slots[11] == null) + { + slots[11] = itemStack.copy(); + }else if(slots[11].isItemEqual(itemStack)) { + slots[11].stackSize += itemStack.stackSize; + } + if(slots[9].stackSize <= 0) + { + slots[9] = new ItemStack(slots[9].getItem().setFull3D()); + }else{ + slots[9].stackSize--; + } + if(slots[9].stackSize <= 0) + { + slots[9] = null; + } + } + if(this.slots[10] != null && isProcessable(this.slots[10])) + { + ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[10]); + if(slots[12] == null) + { + slots[12] = itemStack.copy(); + }else if(slots[12].isItemEqual(itemStack)) { + slots[12].stackSize += itemStack.stackSize; + } + if(slots[10].stackSize <= 0) + { + slots[10] = new ItemStack(slots[10].getItem().setFull3D()); + }else{ + slots[10].stackSize--; + } + if(slots[10].stackSize <= 0) + { + slots[10] = null; + } + } + + this.progress = 0; + } + + if(this.slots[11] != null) + { + for(int i = 0; i < 9; i++) + { + int j = i + 13; + if(slots[j] != null) + { + if(slots[j].getItem() == slots[11].getItem() && slots[j].getItemDamage() == slots[11].getItemDamage()) + { + if(slots[j].stackSize < slots[j].getMaxStackSize()) + { + if(slots[j].stackSize + slots[11].stackSize <= slots[11].getMaxStackSize()) + { + slots[j].stackSize += slots[11].stackSize; + slots[11] = null; + break; + } else { + int k = slots[j].getMaxStackSize() - slots[j].stackSize; + if(k < 0) + { + slots[j].stackSize += k; + slots[11].stackSize -= k; + break; + } + } + } + } + } else { + slots[j] = slots[11].copy(); + slots[11] = null; + break; + } + } + } + + if(this.slots[12] != null) + { + for(int i = 0; i < 9; i++) + { + int j = i + 13; + if(slots[j] != null) + { + if(slots[j].getItem() == slots[12].getItem() && slots[j].getItemDamage() == slots[12].getItemDamage()) + { + if(slots[j].stackSize < slots[j].getMaxStackSize()) + { + if(slots[j].stackSize + slots[12].stackSize <= slots[12].getMaxStackSize()) + { + slots[j].stackSize += slots[12].stackSize; + slots[12] = null; + break; + } else { + int k = slots[j].getMaxStackSize() - slots[j].stackSize; + if(k < 0) + { + slots[j].stackSize += k; + slots[12].stackSize -= k; + break; + } + } + } + } + } else { + slots[j] = slots[12].copy(); + slots[12] = null; + break; + } + } + } + } + +} diff --git a/com/hbm/blocks/TileEntityMachineBattery.java b/com/hbm/blocks/TileEntityMachineBattery.java index 8db59eb14..d26ffc49a 100644 --- a/com/hbm/blocks/TileEntityMachineBattery.java +++ b/com/hbm/blocks/TileEntityMachineBattery.java @@ -472,6 +472,16 @@ public class TileEntityMachineBattery extends TileEntity implements ISidedInvent power -= 100; slots[1].setItemDamage(slots[1].getItemDamage() - 1); } + if(power - 100 >= 0 && slots[1] != null && slots[1].getItem() == ModItems.factory_core_titanium && slots[1].getItemDamage() > 0) + { + power -= 100; + slots[1].setItemDamage(slots[1].getItemDamage() - 1); + } + if(power - 100 >= 0 && slots[1] != null && slots[1].getItem() == ModItems.factory_core_advanced && slots[1].getItemDamage() > 0) + { + power -= 100; + slots[1].setItemDamage(slots[1].getItemDamage() - 1); + } if(/*power + 100 <= maxPower && */slots[0] != null && slots[0].getItem() == ModItems.battery_creative) { diff --git a/com/hbm/blocks/TileEntityMachineCoal.java b/com/hbm/blocks/TileEntityMachineCoal.java index 8d59039b6..6b8d2d16f 100644 --- a/com/hbm/blocks/TileEntityMachineCoal.java +++ b/com/hbm/blocks/TileEntityMachineCoal.java @@ -245,6 +245,16 @@ public class TileEntityMachineCoal extends TileEntity implements ISidedInventory power -= 100; slots[2].setItemDamage(slots[2].getItemDamage() - 1); } + if(power - 100 >= 0 && slots[2] != null && slots[2].getItem() == ModItems.factory_core_titanium && slots[2].getItemDamage() > 0) + { + power -= 100; + slots[2].setItemDamage(slots[2].getItemDamage() - 1); + } + if(power - 100 >= 0 && slots[2] != null && slots[2].getItem() == ModItems.factory_core_advanced && slots[2].getItemDamage() > 0) + { + power -= 100; + slots[2].setItemDamage(slots[2].getItemDamage() - 1); + } //Electric Furnace if(worldObj.getBlock(xCoord + 1, yCoord, zCoord) instanceof MachineElectricFurnace) diff --git a/com/hbm/blocks/TileEntityMachineGenerator.java b/com/hbm/blocks/TileEntityMachineGenerator.java index 9f22a2534..96fe6c51d 100644 --- a/com/hbm/blocks/TileEntityMachineGenerator.java +++ b/com/hbm/blocks/TileEntityMachineGenerator.java @@ -779,6 +779,16 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve power -= 100; slots[11].setItemDamage(slots[11].getItemDamage() - 1); } + if(power - 100 >= 0 && slots[11] != null && slots[11].getItem() == ModItems.factory_core_titanium && slots[11].getItemDamage() > 0) + { + power -= 100; + slots[11].setItemDamage(slots[11].getItemDamage() - 1); + } + if(power - 100 >= 0 && slots[11] != null && slots[11].getItem() == ModItems.factory_core_advanced && slots[11].getItemDamage() > 0) + { + power -= 100; + slots[11].setItemDamage(slots[11].getItemDamage() - 1); + } } public void attemptPower(int i) { diff --git a/com/hbm/gui/ContainerCoreAdvanced.java b/com/hbm/gui/ContainerCoreAdvanced.java new file mode 100644 index 000000000..6aba513c7 --- /dev/null +++ b/com/hbm/gui/ContainerCoreAdvanced.java @@ -0,0 +1,124 @@ +package com.hbm.gui; + +import com.hbm.blocks.TileEntityCoreAdvanced; +import com.hbm.blocks.TileEntityCoreTitanium; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerCoreAdvanced extends Container { + + private TileEntityCoreAdvanced diFurnace; + private int progress; + private int power; + + public ContainerCoreAdvanced(InventoryPlayer invPlayer, TileEntityCoreAdvanced tedf) { + + diFurnace = tedf; + + //Input Storage + this.addSlotToContainer(new Slot(tedf, 0, 8, 18)); + this.addSlotToContainer(new Slot(tedf, 1, 26, 18)); + this.addSlotToContainer(new Slot(tedf, 2, 44, 18)); + this.addSlotToContainer(new Slot(tedf, 3, 62, 18)); + this.addSlotToContainer(new Slot(tedf, 4, 80, 18)); + this.addSlotToContainer(new Slot(tedf, 5, 98, 18)); + this.addSlotToContainer(new Slot(tedf, 6, 116, 18)); + this.addSlotToContainer(new Slot(tedf, 7, 134, 18)); + this.addSlotToContainer(new Slot(tedf, 8, 152, 18)); + //Inputs + this.addSlotToContainer(new Slot(tedf, 9, 8, 54)); + this.addSlotToContainer(new Slot(tedf, 10, 8, 72)); + //Outputs + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 11, 134, 54)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 12, 134, 72)); + //Output Storage + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 13, 8, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 14, 26, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 15, 44, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 16, 62, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 17, 80, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 18, 98, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 19, 116, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 20, 134, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 21, 152, 108)); + //Power Cell + this.addSlotToContainer(new Slot(tedf, 22, 44, 72)); + //More Inputs + this.addSlotToContainer(new Slot(tedf, 23, 26, 54)); + this.addSlotToContainer(new Slot(tedf, 24, 26, 72)); + //More Outputs + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 25, 152, 54)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 26, 152, 72)); + + for(int i = 0; i < 3; i++) + { + for(int j = 0; j < 9; j++) + { + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56)); + } + } + + for(int i = 0; i < 9; i++) + { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56)); + } + } + + @Override + public void addCraftingToCrafters(ICrafting crafting) { + super.addCraftingToCrafters(crafting); + crafting.sendProgressBarUpdate(this, 0, this.diFurnace.progress); + crafting.sendProgressBarUpdate(this, 1, this.diFurnace.power); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) + { + return null; + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return diFurnace.isUseableByPlayer(player); + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + + for(int i = 0; i < this.crafters.size(); i++) + { + ICrafting par1 = (ICrafting)this.crafters.get(i); + + if(this.progress != this.diFurnace.progress) + { + par1.sendProgressBarUpdate(this, 0, this.diFurnace.progress); + } + + if(this.power != this.diFurnace.power) + { + par1.sendProgressBarUpdate(this, 1, this.diFurnace.power); + } + } + + this.progress = this.diFurnace.progress; + this.power = this.diFurnace.power; + } + + @Override + public void updateProgressBar(int i, int j) { + if(i == 0) + { + diFurnace.progress = j; + } + if(i == 1) + { + diFurnace.power = j; + } + } +} diff --git a/com/hbm/gui/ContainerCoreTitanium.java b/com/hbm/gui/ContainerCoreTitanium.java new file mode 100644 index 000000000..078436d96 --- /dev/null +++ b/com/hbm/gui/ContainerCoreTitanium.java @@ -0,0 +1,119 @@ +package com.hbm.gui; + +import com.hbm.blocks.TileEntityCoreTitanium; +import com.hbm.blocks.TileEntityMachineGenerator; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerCoreTitanium extends Container { + + private TileEntityCoreTitanium diFurnace; + private int progress; + private int power; + + public ContainerCoreTitanium(InventoryPlayer invPlayer, TileEntityCoreTitanium tedf) { + + diFurnace = tedf; + + //Input Storage + this.addSlotToContainer(new Slot(tedf, 0, 8, 18)); + this.addSlotToContainer(new Slot(tedf, 1, 26, 18)); + this.addSlotToContainer(new Slot(tedf, 2, 44, 18)); + this.addSlotToContainer(new Slot(tedf, 3, 62, 18)); + this.addSlotToContainer(new Slot(tedf, 4, 80, 18)); + this.addSlotToContainer(new Slot(tedf, 5, 98, 18)); + this.addSlotToContainer(new Slot(tedf, 6, 116, 18)); + this.addSlotToContainer(new Slot(tedf, 7, 134, 18)); + this.addSlotToContainer(new Slot(tedf, 8, 152, 18)); + //Inputs + this.addSlotToContainer(new Slot(tedf, 9, 8, 54)); + this.addSlotToContainer(new Slot(tedf, 10, 8, 72)); + //Outputs + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 11, 152, 54)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 12, 152, 72)); + //Output Storage + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 13, 8, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 14, 26, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 15, 44, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 16, 62, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 17, 80, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 18, 98, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 19, 116, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 20, 134, 108)); + this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 21, 152, 108)); + //Power Cell + this.addSlotToContainer(new Slot(tedf, 22, 44, 72)); + + for(int i = 0; i < 3; i++) + { + for(int j = 0; j < 9; j++) + { + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56)); + } + } + + for(int i = 0; i < 9; i++) + { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56)); + } + } + + @Override + public void addCraftingToCrafters(ICrafting crafting) { + super.addCraftingToCrafters(crafting); + crafting.sendProgressBarUpdate(this, 0, this.diFurnace.progress); + crafting.sendProgressBarUpdate(this, 1, this.diFurnace.power); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) + { + return null; + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return diFurnace.isUseableByPlayer(player); + } + + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + + for(int i = 0; i < this.crafters.size(); i++) + { + ICrafting par1 = (ICrafting)this.crafters.get(i); + + if(this.progress != this.diFurnace.progress) + { + par1.sendProgressBarUpdate(this, 0, this.diFurnace.progress); + } + + if(this.power != this.diFurnace.power) + { + par1.sendProgressBarUpdate(this, 1, this.diFurnace.power); + } + } + + this.progress = this.diFurnace.progress; + this.power = this.diFurnace.power; + } + + @Override + public void updateProgressBar(int i, int j) { + if(i == 0) + { + diFurnace.progress = j; + } + if(i == 1) + { + diFurnace.power = j; + } + } + +} diff --git a/com/hbm/gui/GUICoreAdvanced.java b/com/hbm/gui/GUICoreAdvanced.java new file mode 100644 index 000000000..1e2944c8e --- /dev/null +++ b/com/hbm/gui/GUICoreAdvanced.java @@ -0,0 +1,52 @@ +package com.hbm.gui; + +import org.lwjgl.opengl.GL11; + +import com.hbm.blocks.TileEntityCoreAdvanced; +import com.hbm.blocks.TileEntityCoreTitanium; +import com.hbm.lib.RefStrings; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +public class GUICoreAdvanced extends GuiContainer { + + private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/factory_advanced.png"); + private TileEntityCoreAdvanced diFurnace; + + public GUICoreAdvanced(InventoryPlayer invPlayer, TileEntityCoreAdvanced tedf) { + super(new ContainerCoreAdvanced(invPlayer, tedf)); + diFurnace = tedf; + + this.xSize = 176; + this.ySize = 222; + } + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j) { + String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName()); + + this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + + if(diFurnace.power > 0) { + int i = diFurnace.getPowerScaled(52); + drawTexturedModalRect(guiLeft + 62, guiTop + 72, 0, 240, i, 16); + } + + if(diFurnace.progress > 0) { + int j = diFurnace.getProgressScaled(90); + drawTexturedModalRect(guiLeft + 43, guiTop + 53, 0, 222, j, 18); + } + } +} diff --git a/com/hbm/gui/GUICoreTitanium.java b/com/hbm/gui/GUICoreTitanium.java new file mode 100644 index 000000000..251fef901 --- /dev/null +++ b/com/hbm/gui/GUICoreTitanium.java @@ -0,0 +1,53 @@ +package com.hbm.gui; + +import org.lwjgl.opengl.GL11; + +import com.hbm.blocks.TileEntityCoreTitanium; +import com.hbm.blocks.TileEntityMachineGenerator; +import com.hbm.lib.RefStrings; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.util.ResourceLocation; + +public class GUICoreTitanium extends GuiContainer { + + private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/factory_titanium.png"); + private TileEntityCoreTitanium diFurnace; + + public GUICoreTitanium(InventoryPlayer invPlayer, TileEntityCoreTitanium tedf) { + super(new ContainerCoreTitanium(invPlayer, tedf)); + diFurnace = tedf; + + this.xSize = 176; + this.ySize = 222; + } + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j) { + String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName()); + + this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + + if(diFurnace.power > 0) { + int i = diFurnace.getPowerScaled(52); + drawTexturedModalRect(guiLeft + 62, guiTop + 72, 0, 240, i, 16); + } + + if(diFurnace.progress > 0) { + int j = diFurnace.getProgressScaled(90); + drawTexturedModalRect(guiLeft + 43, guiTop + 53, 0, 222, j, 18); + } + } +} diff --git a/com/hbm/gui/MachineRecipes.java b/com/hbm/gui/MachineRecipes.java index ba2f76c24..bcc7cb235 100644 --- a/com/hbm/gui/MachineRecipes.java +++ b/com/hbm/gui/MachineRecipes.java @@ -53,6 +53,11 @@ public class MachineRecipes { return new ItemStack(ModItems.canister_fuel, 1); } + + if(item == ModItems.ingot_red_copper && item2 == ModItems.ingot_steel || item == ModItems.ingot_steel && item2 == ModItems.ingot_red_copper) { + return new ItemStack(ModItems.ingot_advanced_alloy, 2); + } + return null; } diff --git a/com/hbm/interfaces/IFactory.java b/com/hbm/interfaces/IFactory.java new file mode 100644 index 000000000..03c69be50 --- /dev/null +++ b/com/hbm/interfaces/IFactory.java @@ -0,0 +1,15 @@ +package com.hbm.interfaces; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface IFactory { + + boolean isStructureValid(World world); + + public int getPowerScaled(int i); + + public int getProgressScaled(int i); + + public boolean isProcessable(ItemStack item); +} diff --git a/com/hbm/items/ItemBattery.java b/com/hbm/items/ItemBattery.java index a7b169226..1d181a890 100644 --- a/com/hbm/items/ItemBattery.java +++ b/com/hbm/items/ItemBattery.java @@ -16,7 +16,7 @@ public class ItemBattery extends Item { @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { - if(itemstack.getItem() != ModItems.fusion_core) + if(itemstack.getItem() != ModItems.fusion_core && itemstack.getItem() != ModItems.factory_core_titanium && itemstack.getItem() != ModItems.factory_core_advanced) { list.add("Energy stored: " + ((this.getMaxDamage() - this.getDamage(itemstack)) * 100) + " HE"); } else { @@ -39,7 +39,7 @@ public class ItemBattery extends Item { return EnumRarity.rare; } - if(this == ModItems.fusion_core) + if(this == ModItems.fusion_core || this == ModItems.factory_core_titanium || this == ModItems.factory_core_advanced) { return EnumRarity.uncommon; } diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index 660ba29d3..525c99734 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -53,6 +53,7 @@ public class ModItems { public static Item nugget_plutonium_fuel; public static Item nugget_mox_fuel; public static Item nugget_schrabidium_fuel; + public static Item ingot_advanced_alloy; public static Item nugget_uranium; public static Item nugget_u235; @@ -79,6 +80,7 @@ public class ModItems { public static Item nugget_beryllium; public static Item plate_gold; public static Item hazmat_cloth; + public static Item plate_advanced_alloy; public static Item powder_lead; public static Item powder_neptunium; @@ -354,6 +356,9 @@ public class ModItems { public static Item fusion_core; + public static Item factory_core_titanium; + public static Item factory_core_advanced; + public static Item ingot_euphemium; public static Item nugget_euphemium; public static Item rod_quad_euphemium; @@ -449,6 +454,7 @@ public class ModItems { nugget_plutonium_fuel = new Item().setUnlocalizedName("nugget_plutonium_fuel").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":nugget_plutonium"); nugget_mox_fuel = new Item().setUnlocalizedName("nugget_mox_fuel").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":nugget_mox_fuel"); nugget_schrabidium_fuel = new Item().setUnlocalizedName("nugget_schrabidium_fuel").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":nugget_schrabidium_fuel"); + ingot_advanced_alloy = new Item().setUnlocalizedName("ingot_advanced_alloy").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":ingot_advanced_alloy"); niter = new Item().setUnlocalizedName("niter").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":salpeter"); ingot_copper = new Item().setUnlocalizedName("ingot_copper").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":ingot_copper"); @@ -466,6 +472,7 @@ public class ModItems { plate_schrabidium = new ItemCustomLore().setUnlocalizedName("plate_schrabidium").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":plate_schrabidium"); plate_copper = new Item().setUnlocalizedName("plate_copper").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":plate_copper"); plate_gold = new Item().setUnlocalizedName("plate_gold").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":plate_gold"); + plate_advanced_alloy = new Item().setUnlocalizedName("plate_advanced_alloy").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":plate_advanced_alloy"); nugget_uranium = new Item().setUnlocalizedName("nugget_uranium").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":nugget_uranium"); nugget_u235 = new Item().setUnlocalizedName("nugget_u235").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":nugget_uranium"); @@ -747,6 +754,9 @@ public class ModItems { battery_creative = new Item().setUnlocalizedName("battery_creative").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":battery_creative"); fusion_core = new ItemBattery(5000).setUnlocalizedName("fusion_core").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fusion_core"); + + factory_core_titanium = new ItemBattery(70400).setUnlocalizedName("factory_core_titanium").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":factory_core_titanium"); + factory_core_advanced = new ItemBattery(41600).setUnlocalizedName("factory_core_advanced").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":factory_core_advanced"); nuke_starter_kit = new ItemStarterKit().setUnlocalizedName("nuke_starter_kit").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":nuke_starter_kit"); nuke_advanced_kit = new ItemStarterKit().setUnlocalizedName("nuke_advanced_kit").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":nuke_advanced_kit"); @@ -839,6 +849,7 @@ public class ModItems { GameRegistry.registerItem(ingot_titanium, ingot_titanium.getUnlocalizedName()); GameRegistry.registerItem(ingot_copper, ingot_copper.getUnlocalizedName()); GameRegistry.registerItem(ingot_red_copper, ingot_red_copper.getUnlocalizedName()); + GameRegistry.registerItem(ingot_advanced_alloy, ingot_advanced_alloy.getUnlocalizedName()); GameRegistry.registerItem(ingot_tungsten, ingot_tungsten.getUnlocalizedName()); GameRegistry.registerItem(ingot_aluminium, ingot_aluminium.getUnlocalizedName()); GameRegistry.registerItem(ingot_steel, ingot_steel.getUnlocalizedName()); @@ -888,6 +899,7 @@ public class ModItems { GameRegistry.registerItem(neutron_reflector, neutron_reflector.getUnlocalizedName()); GameRegistry.registerItem(plate_schrabidium, plate_schrabidium.getUnlocalizedName()); GameRegistry.registerItem(plate_copper, plate_copper.getUnlocalizedName()); + GameRegistry.registerItem(plate_advanced_alloy, plate_advanced_alloy.getUnlocalizedName()); GameRegistry.registerItem(plate_gold, plate_gold.getUnlocalizedName()); GameRegistry.registerItem(hazmat_cloth, hazmat_cloth.getUnlocalizedName()); @@ -990,6 +1002,8 @@ public class ModItems { GameRegistry.registerItem(battery_schrabidium, battery_schrabidium.getUnlocalizedName()); GameRegistry.registerItem(battery_creative, battery_creative.getUnlocalizedName()); GameRegistry.registerItem(fusion_core, fusion_core.getUnlocalizedName()); + GameRegistry.registerItem(factory_core_titanium, factory_core_titanium.getUnlocalizedName()); + GameRegistry.registerItem(factory_core_advanced, factory_core_advanced.getUnlocalizedName()); //Fuelrods GameRegistry.registerItem(rod_empty, rod_empty.getUnlocalizedName()); diff --git a/com/hbm/main/CraftingManager.java b/com/hbm/main/CraftingManager.java index 7f608aae3..5dc94109f 100644 --- a/com/hbm/main/CraftingManager.java +++ b/com/hbm/main/CraftingManager.java @@ -337,6 +337,16 @@ public class CraftingManager { GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_battery), 1), new Object[] { "TLT", "RIR", "TST", 'T', ModItems.ingot_tungsten, 'I', ModItems.ingot_red_copper, 'R', ModItems.wire_red_copper, 'S', Item.getItemFromBlock(ModBlocks.block_sulfur), 'L', Item.getItemFromBlock(ModBlocks.block_lead) }); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_coal_off), 1), new Object[] { "STS", "SCS", "SFS", 'S', ModItems.ingot_steel, 'T', ModItems.tank_steel, 'C', ModItems.ingot_red_copper, 'F', Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off) }); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.factory_titanium_hull), 1), new Object[] { "PIP", "I I", "PIP", 'P', ModItems.plate_titanium, 'I', ModItems.ingot_titanium }); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.factory_titanium_furnace), 1), new Object[] { "HMH", "MFM", "HMH", 'H', Item.getItemFromBlock(ModBlocks.factory_titanium_hull), 'M', ModItems.motor, 'F', Item.getItemFromBlock(Blocks.furnace) }); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.factory_titanium_core), 1), new Object[] { "HPH", "PCP", "HPH", 'H', Item.getItemFromBlock(ModBlocks.factory_titanium_hull), 'C', ModItems.circuit_aluminium, 'P', Item.getItemFromBlock(Blocks.piston) }); + GameRegistry.addRecipe(new ItemStack(ModItems.factory_core_titanium, 1, ModItems.factory_core_titanium.getMaxDamage()), new Object[] { "BRB", "RHR", "BRB", 'B', new ItemStack(ModItems.battery_generic, 1, ModItems.battery_generic.getMaxDamage()), 'R', Item.getItemFromBlock(Blocks.redstone_block), 'H', Item.getItemFromBlock(ModBlocks.factory_titanium_hull) }); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.factory_advanced_hull), 1), new Object[] { "PIP", "I I", "PIP", 'P', ModItems.plate_advanced_alloy, 'I', ModItems.ingot_advanced_alloy }); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.factory_advanced_furnace), 1), new Object[] { "HMH", "MFM", "HMH", 'H', Item.getItemFromBlock(ModBlocks.factory_advanced_hull), 'M', ModItems.motor, 'F', Item.getItemFromBlock(Blocks.furnace) }); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.factory_advanced_core), 1), new Object[] { "HPH", "PCP", "HPH", 'H', Item.getItemFromBlock(ModBlocks.factory_advanced_hull), 'C', ModItems.circuit_red_copper, 'P', Item.getItemFromBlock(Blocks.piston) }); + GameRegistry.addRecipe(new ItemStack(ModItems.factory_core_advanced, 1, ModItems.factory_core_advanced.getMaxDamage()), new Object[] { "BLB", "SHS", "BLB", 'B', new ItemStack(ModItems.battery_advanced, 1, ModItems.battery_advanced.getMaxDamage()), 'S', Item.getItemFromBlock(ModBlocks.block_sulfur), 'L', Item.getItemFromBlock(ModBlocks.block_lead), 'H', Item.getItemFromBlock(ModBlocks.factory_advanced_hull) }); + GameRegistry.addRecipe(new ItemStack(ModItems.factory_core_advanced, 1, ModItems.factory_core_advanced.getMaxDamage()), new Object[] { "BSB", "LHL", "BSB", 'B', new ItemStack(ModItems.battery_advanced, 1, ModItems.battery_advanced.getMaxDamage()), 'S', Item.getItemFromBlock(ModBlocks.block_sulfur), 'L', Item.getItemFromBlock(ModBlocks.block_lead), 'H', Item.getItemFromBlock(ModBlocks.factory_advanced_hull) }); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.brick_light), 8), new Object[] { "FBF", "BFB", "FBF", 'F', Blocks.fence, 'B', Blocks.brick_block }); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.brick_concrete), 8), new Object[] { "FBF", "BFB", "FBF", 'F', Blocks.iron_bars, 'B', Blocks.stone }); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.brick_obsidian), 8), new Object[] { "FBF", "BFB", "FBF", 'F', Blocks.iron_bars, 'B', Blocks.obsidian }); diff --git a/com/hbm/main/GUIHandler.java b/com/hbm/main/GUIHandler.java index d1d6167dd..cddf79538 100644 --- a/com/hbm/main/GUIHandler.java +++ b/com/hbm/main/GUIHandler.java @@ -2,6 +2,8 @@ package com.hbm.main; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.TileEntityBombMulti; +import com.hbm.blocks.TileEntityCoreAdvanced; +import com.hbm.blocks.TileEntityCoreTitanium; import com.hbm.blocks.TileEntityDiFurnace; import com.hbm.blocks.TileEntityLaunchPad; import com.hbm.blocks.TileEntityMachineBattery; @@ -26,6 +28,8 @@ import com.hbm.blocks.TileEntityTestNuke; import com.hbm.gui.ContainerBombMulti; import com.hbm.gui.ContainerDiFurnace; import com.hbm.gui.ContainerCentrifuge; +import com.hbm.gui.ContainerCoreAdvanced; +import com.hbm.gui.ContainerCoreTitanium; import com.hbm.gui.ContainerElectricFurnace; import com.hbm.gui.ContainerGenerator; import com.hbm.gui.ContainerLaunchPadTier1; @@ -46,6 +50,8 @@ import com.hbm.gui.ContainerRtgFurnace; import com.hbm.gui.ContainerTestNuke; import com.hbm.gui.ContainerUF6Tank; import com.hbm.gui.GUIBombMulti; +import com.hbm.gui.GUICoreAdvanced; +import com.hbm.gui.GUICoreTitanium; import com.hbm.gui.GUILaunchPadTier1; import com.hbm.gui.GUIMachineBattery; import com.hbm.gui.GUIMachineCentrifuge; @@ -257,6 +263,22 @@ public class GUIHandler implements IGuiHandler { return new ContainerLaunchPadTier1(player.inventory, (TileEntityLaunchPad) entity); } } + + case ModBlocks.guiID_factory_titanium: + { + if(entity instanceof TileEntityCoreTitanium) + { + return new ContainerCoreTitanium(player.inventory, (TileEntityCoreTitanium) entity); + } + } + + case ModBlocks.guiID_factory_advanced: + { + if(entity instanceof TileEntityCoreAdvanced) + { + return new ContainerCoreAdvanced(player.inventory, (TileEntityCoreAdvanced) entity); + } + } } return null; } @@ -445,6 +467,22 @@ public class GUIHandler implements IGuiHandler { return new GUILaunchPadTier1(player.inventory, (TileEntityLaunchPad) entity); } } + + case ModBlocks.guiID_factory_titanium: + { + if(entity instanceof TileEntityCoreTitanium) + { + return new GUICoreTitanium(player.inventory, (TileEntityCoreTitanium) entity); + } + } + + case ModBlocks.guiID_factory_advanced: + { + if(entity instanceof TileEntityCoreAdvanced) + { + return new GUICoreAdvanced(player.inventory, (TileEntityCoreAdvanced) entity); + } + } } } return null; diff --git a/com/hbm/main/MainRegistry.java b/com/hbm/main/MainRegistry.java index 45e13b778..5699dcaa1 100644 --- a/com/hbm/main/MainRegistry.java +++ b/com/hbm/main/MainRegistry.java @@ -17,6 +17,8 @@ import cpw.mods.fml.common.ModMetadata; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.TileEntityBombMulti; +import com.hbm.blocks.TileEntityCoreAdvanced; +import com.hbm.blocks.TileEntityCoreTitanium; import com.hbm.blocks.TileEntityDecoBlock; import com.hbm.blocks.TileEntityDecoPoleSatelliteReceiver; import com.hbm.blocks.TileEntityDecoPoleTop; @@ -191,6 +193,8 @@ public class MainRegistry GameRegistry.registerTileEntity(TileEntityYellowBarrel.class, "tileentity_nukebarrel"); GameRegistry.registerTileEntity(TileEntityLaunchPad.class, "tileentity_launch1"); GameRegistry.registerTileEntity(TileEntityDecoBlock.class, "tileentity_deco"); + GameRegistry.registerTileEntity(TileEntityCoreTitanium.class, "tileentity_core_titanium"); + GameRegistry.registerTileEntity(TileEntityCoreAdvanced.class, "tileentity_core_advanced"); EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true); EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);