From 86995f7ed8b6d0341ad8093329cc671bd3a44170 Mon Sep 17 00:00:00 2001 From: mDiyo Date: Sat, 2 Nov 2013 22:24:47 -0700 Subject: [PATCH] Stopgap for negative rendering in Smeltery air blocks, added SDX --- resources/assets/tinker/lang/en_US.lang | 1 + .../textures/blocks/sdx_bottom_blue.png | Bin 0 -> 175 bytes .../textures/blocks/sdx_bottom_green.png | Bin 0 -> 175 bytes .../tinker/textures/blocks/sdx_side_blue.png | Bin 0 -> 403 bytes .../tinker/textures/blocks/sdx_side_green.png | Bin 0 -> 401 bytes .../tinker/textures/blocks/sdx_top_blue.png | Bin 0 -> 492 bytes .../tinker/textures/blocks/sdx_top_green.png | Bin 0 -> 468 bytes .../tinker/textures/items/tinkerbook_blue.png | Bin 298 -> 468 bytes .../textures/items/tinkerbook_diary.png | Bin 298 -> 464 bytes .../textures/items/tinkerbook_green.png | Bin 295 -> 465 bytes .../textures/items/tinkerbook_smeltery.png | Bin 273 -> 436 bytes .../textures/items/tinkerbook_toolstation.png | Bin 284 -> 455 bytes src/tconstruct/blocks/SlimeExplosive.java | 148 +++++++++++ src/tconstruct/blocks/TConstructBlock.java | 11 + .../blocks/component/SmelteryComponent.java | 2 +- .../blocks/logic/AdaptiveSmelteryLogic.java | 40 ++- src/tconstruct/client/TProxyClient.java | 6 +- .../client/block/TankAirRender.java | 3 +- .../client/entity/item/ExplosiveRender.java | 98 ++++++++ .../client/gui/AdaptiveSmelteryGui.java | 7 + src/tconstruct/common/TContent.java | 14 +- .../entity/item/ExplosivePrimed.java | 144 +++++++++++ .../items/blocks/MetadataItemBlock.java | 18 ++ .../items/blocks/ToolForgeItemBlock.java | 27 -- .../blocks/AdaptiveInventoryLogic.java | 10 +- src/tconstruct/util/MiningExplosion.java | 231 ++++++++++++++++++ src/tconstruct/util/config/PHConstruct.java | 2 + 27 files changed, 709 insertions(+), 53 deletions(-) create mode 100644 resources/assets/tinker/textures/blocks/sdx_bottom_blue.png create mode 100644 resources/assets/tinker/textures/blocks/sdx_bottom_green.png create mode 100644 resources/assets/tinker/textures/blocks/sdx_side_blue.png create mode 100644 resources/assets/tinker/textures/blocks/sdx_side_green.png create mode 100644 resources/assets/tinker/textures/blocks/sdx_top_blue.png create mode 100644 resources/assets/tinker/textures/blocks/sdx_top_green.png create mode 100644 src/tconstruct/blocks/SlimeExplosive.java create mode 100644 src/tconstruct/client/entity/item/ExplosiveRender.java create mode 100644 src/tconstruct/entity/item/ExplosivePrimed.java create mode 100644 src/tconstruct/items/blocks/MetadataItemBlock.java delete mode 100644 src/tconstruct/items/blocks/ToolForgeItemBlock.java create mode 100644 src/tconstruct/util/MiningExplosion.java diff --git a/resources/assets/tinker/lang/en_US.lang b/resources/assets/tinker/lang/en_US.lang index a8850b8f..acfced64 100644 --- a/resources/assets/tinker/lang/en_US.lang +++ b/resources/assets/tinker/lang/en_US.lang @@ -284,6 +284,7 @@ tile.trap.barricade.spruce.name=Spruce Barricade tile.trap.barricade.birch.name=Birch Barricade tile.trap.barricade.jungle.name=Jungle Barricade tile.extractor.essence.name=Essence Extractor +tile.explosive.slime.name=SDX StorageMetals.Cobalt.name=Block of Cobalt StorageMetals.Ardite.name=Block of Ardite diff --git a/resources/assets/tinker/textures/blocks/sdx_bottom_blue.png b/resources/assets/tinker/textures/blocks/sdx_bottom_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..95f6f0f2d5ee4afdab2e0e48bebe076ef7419a31 GIT binary patch literal 175 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#E;kbkm-(-6J0}5!{5)M8Lo7}wPq|g`+@4wF&#tnzM&HvdjUsm3%*@QrC-3_5 zfWX=OnUWq)jST}hBwTNW|M~y>n`%r$WW*ehx|MZuyv-L4B$ff~P5rP)!Ls%YH_&7T MPgg&ebxsLQ0Qy2Rh5!Hn literal 0 HcmV?d00001 diff --git a/resources/assets/tinker/textures/blocks/sdx_bottom_green.png b/resources/assets/tinker/textures/blocks/sdx_bottom_green.png new file mode 100644 index 0000000000000000000000000000000000000000..0f13280af49c56192739a58a812c0ed1cf2479e4 GIT binary patch literal 175 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#E;kbkm-f5wPwxVS{5)M8Lo7}wm+VviI-iltZqCo63JHgfIdIKyZES2jSRKsC z3P)p?V3v$PTS5a8R7%QV6kI2ciV{!c7Tf=w|MT71=jh`85va>G z&}=tAQ|k~0!Vjw>Q zWpHv3<$2yNvMd9Nq8LE_Y8k#4o!>pQ|7ZRB0yO0cNUm=u!Nd2W<)r}X(=#ACNq{Ue)rWXrow|q@C}s`1{`xuf93!H002ovPDHLkV1kV%regpA literal 0 HcmV?d00001 diff --git a/resources/assets/tinker/textures/blocks/sdx_side_green.png b/resources/assets/tinker/textures/blocks/sdx_side_green.png new file mode 100644 index 0000000000000000000000000000000000000000..09421f69cf247a4850bed414379b1f8ba0898b64 GIT binary patch literal 401 zcmV;C0dD?@P)0003nNkl2u(`7k4zwyl2D3DP>4qYD+Rv z11Y6-Z7Td*~v&(CaiBAFgt0@5S#^c!dr0Ax#rVOn$UoVfCPOI{- zK<(oB?dN;51|Z5aW>@!oZ`MS4MiPWXd4^Jo^Zu*LNrKQdI4x_MEqrc2-buSd7-x75 zA983;mY7a!mn0?io4dmvq}?H=(?S8~c2a*eMN0{QQi_of)gDB72Eb@Ea&(naXsuC7 zSpt$?uUG9sxo96!N|GSNYxsOVJvdKlhwi{>w#8|8NP9eRGMbYm+r@m>pud{B)l^L{ zWW~ng>*WzCB|->dQ}RFvK@x;CC(Fv>^6rH-5#VIIm=hb1*m#b5p|5zg)+9mbrkC^o z+(COhAhislJY&}Iky2V&3Tanac?ZRmdT|#*keD@TcZjsKW8+c3xuZQE?BdOy2Zyl# iSC0SPf!FXkCjJGBIq9dV{(R>E0000m)>t4Z0004VNkl1vkV(Dh7 zaFEqbp_>i|>165D&EfE06pB+P!-(|0?C=dQ}Gt+mFNel-Ip8Uf(@esNu`HO3gU)&MA_m`A9_iblth&JNom^pKtEJ{9l=a?reZa!rxGdHA<<>md;o} zO%9AP#BP9~o#jG8ybVab5XG-&F>ceH4XPQ`>2U2|1}$N6O#K781mCf(>~_8Y0000< KMNUMnLSTZo;?Ye2 literal 0 HcmV?d00001 diff --git a/resources/assets/tinker/textures/items/tinkerbook_blue.png b/resources/assets/tinker/textures/items/tinkerbook_blue.png index cbe019a2357961399570e15997fcd1d4f14cafdf..8a1fe8308fa93f119edf695df2a97bfa67fe6efb 100644 GIT binary patch literal 468 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP)HxrYgK>FeNKzYVQPZ!4!i_=FZ8+tnhO0><_c1+*d z^3YUf&jMX@krs~GGJ3j}-;?qm- zyshy4LFi@G7qibbey=@u{QF+^f4jHDHWe5>|M~pphONu)-%c~(8_(atu;ukt2lZQ7tHWEXStkd5`gxDx!4sSQ*F6SjEcCCkvtFFm zyUy6DU+Rpy-sQsSF2~pcCV1%Z3N*AZtO*g*RAq4D__D%LWm=fq{^plEy5&p@<_d;s zd0Wi*c6o49c{ZG5|OT6sqfB)C)!k$Z?#auX10}Ou#Pgg&e IbxsLQ0LNUwegFUf literal 298 zcmV+_0oDGAP) zF$w}P5JmS2Uckaau(wh025y(i(!vYaT6%`GULvK}$axe7zTn4C7TryPy92-21m-_x zCfPL26jS^dv&HW5N&gD~gXMZ}I$Xk=+SAQ67)W*iWq7>aO`G;?Vu0R2vIFoi!H5Mz z06^FW0KPkeWCu`&NWi7#k}D8yg#@VvKn)X@T!C;4R6eY~K&k=YL<)ct^07>{CWK&e z&Y9`~K!O;fDK$)N$fajP@4ZR3pcsHU4Gf|#7&e3vjCntKAr%AY3i7Ste6=-o{udMj wNP)nRhl&k*dj}K)P#}XFRtGTN_y1_(36Y+gZ3W1a(EtDd07*qoM6N<$f}3b}nE(I) diff --git a/resources/assets/tinker/textures/items/tinkerbook_diary.png b/resources/assets/tinker/textures/items/tinkerbook_diary.png index ecfdbad2cda23df85ab932924900bacc96b3a984..7b823f254ea91429e094bc3423387d8b47013067 100644 GIT binary patch literal 464 zcmV;>0WbcEP)TRKj{+mP4B_?`@N6v`yTvvXsZ(Pwh>Lv4R0`)pI8QN z7#61o+W-WkA(WfZtVCM|3L&VrUMM)3u>dHQn^To&v!!01?JJp-l3Ke5z~1f_{V*V9 zT3p>cD2Wya`(c2U)CopIylzOr$p9#coizcbBx?Y!lS4`gfDi&JsbgnN1x_mPx*=9l zrymBmPL8~7LPV2~ws-N(fb1 z9Q1vkTBXQ)r!#J1-ZmoF$tg*^Vb#_P0Gm5Uq|<3?l_CI7?G6oZpiNC7E}6t4@N-?K z_3UeNdk~k@>vaHLAMX{oXd4$UlI!Hu{WoywUs$#Oe;QvuC#7L?>7rf$0000u!YgOEV`QncL#p43Cw@Y zOtNX3DW>=_+U4x=N&gD~gKfJoh0Fd;xAV?47)W*iWq7|HO{c@!!~ng4WC!43f)NXb z0D!O$0DN}_$qt|lk$_9fC08Ka3JFpTfEp$)xdP!9sC-y|fm8#)i4*`Q|(xV&AOSDy>5Q2VlNYO12_)`FSjc%$EZNAjgn-e9IQu5aN0ATNUm&w>C zo3nVjeO3}J2~Ng7rlk}3Q^G+&(JcTdiBU2EQj!dS?bt{u0T4o9S~^C_RA5{|I0!H; zoypk8c5KYD5oG|1ZXuNnC`k-UDOFxL2&lMK4!4hHQxHOMcX7{E<5CH-Ig4ygsLJ98 zDsC0e^QgCKjJ`&*CYogi!$J@-M90|38f%{OhIcj($*700000NkvXX Hu0mjfbD+7I literal 295 zcmV+?0oeYDP) zF$w}P5JmS2g0)x)9zoF?xZPHE+F5&-v|b{m*T{Jk2EO3OPlE0y!QFvhYy$HiGm~tZ zW{N3(jQM`{_@w^@fWi8(GM)VKP3^5U4F-}OKp9@{XVdPwF)=`IAlU(Um|(<$Apjuk z0|4L2AlU(wArf$Dx#S9jTOmQJ0Z_xlC08Ka0+kQzFOX^gIFSP2gnTSxt?}NQx~?qa5&syvPZz8C}`W3s;cnb z1Kg2hU#%_{i&iZO=4U_ig$=X$+TmL@%7!HRR zV>qABG)=?ha^ba8-R*YFX0xQIwMJ{5oON!Rrr~rtQP(xr+SJ4-B8lX-VQt$2uv{(~ zjYiaU4S==wZi-Pv;_-NlB9hK}y^h=MHr+p(9>3dz zQ3}K$3`7ea#G7~pe*|ylNxX{Z*+O7oJD9qqt;)86`LIIfkwojVyz$2Q_$c~c05LGe zh`je3Ip;)of^-L{8paq!)>;t*TnW-0U^7fGV!;pq5cUCp^%0Qn098XI;L>u*H4tva z9>^R3+Awj+H4turmJi>*LFNG9L>d4mqLJ-XZfCQx!QEQmkkW0^oDJ7BG zf{_5#)4(9w1;d6gf-&zmFQkzGKY^SuJoYab39t(SLmsLt45tIAg7h$)4&b@(|7XMs Xsr`kni+|oW00000NkvXXu0mjf+XHTQ diff --git a/resources/assets/tinker/textures/items/tinkerbook_toolstation.png b/resources/assets/tinker/textures/items/tinkerbook_toolstation.png index 35420beb46d424b46532e6649120123503d30554..5897ae9573a622a0ea36a2d9704105c55fc88d25 100644 GIT binary patch literal 455 zcmV;&0XY7NP)sD1PM3{(-guXq5&^BJ$> z$(AO!L#UoB9*@GOJB)OrQ7&x~t+^?HmhkmOk|f&TM)*Y27|(HekndV+WQEZ*#x-r? z`HaDM!gY$jGO2zOteNBhf^-{zWm&kUO|@KF!@m(egYg8{w27uMK}vlDJl$42y2FSw z+rl|6uv{)F==312nJCDjtX3esM?-Bw{3>U#4xwoDEP)vh3^0O&|b xuh#?MtzHMn;u?pNsDez z!3~2j3`JR?z4lV|R&@o&$Qa$C*Pb&;R>?f2vic?Xib)ZWSb(K}Ad&o^Y$u^8cmo|m&|O_1UMNyGQ!E^5DPZEqa_OM(;!7z`7PSTFZ8VI*y48#V2HcVV{4TM{u<->X(#0CH-(f~LiAIn^8LI@(~oX8FU62urq zxnW{ME(4-#=M`skZJ<_1v0~M+FMW)U=##~JXA{= meltingTemps[i] && !world.isRemote) { diff --git a/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java b/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java index 26f1b266..f4b0909a 100644 --- a/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java +++ b/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java @@ -44,7 +44,7 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc SmelteryScan structure = new SmelteryScan(this, TContent.smeltery, TContent.lavaTank); MultiFluidTank multitank = new MultiFluidTank(); SmelteryComponent smeltery = new SmelteryComponent(this, structure, multitank, 800); - + HashMap airUpdates = new HashMap(); int tick = 0; public MultiFluidTank getMultiTank () @@ -93,6 +93,9 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc } tick = 0; } + + if (airUpdates.size() > 0) + updateFluidBlocks(); } public void setUpdateFluids () @@ -282,7 +285,7 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc { //Calculate liquids in each block int size = structure.getAirLayerSize(); - HashMap blocks = new HashMap(); + //HashMap blocks = new HashMap(); for (FluidStack fluid : multitank.fluidlist) { @@ -299,22 +302,24 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc int height = 16 * (coord.y - baseY); int position = i % layerSize; - if (!blocks.containsKey(coord)) + if (!airUpdates.containsKey(coord)) { instance = new LiquidDataInstance(); - blocks.put(coord, instance); + airUpdates.put(coord, instance); } else { - instance = blocks.get(coord); + instance = airUpdates.get(coord); } - if (instance.openLayers() > 0) + if (instance.openLayers() > 0) //This is capable of sending negative liquid sizes to blocks without the stopgap check { if (position > data.blocksWithExtra) { //Calculate open layers int open = data.layers - height + 1; + if (open < 1) //Temporary stopgap check + continue; if (open > instance.openLayers()) open = instance.openLayers(); @@ -325,13 +330,15 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc //Subtract from total data.totalAmount -= newFluid.amount; - if (data.totalAmount < 0) + if (data.totalAmount <= 0) break; } else if (position == data.blocksWithExtra && data.leftovers > 0) { //Calculate open layers int open = data.layers - height + 1; + if (open < 1) //Temporary stopgap check + continue; boolean full = false; if (open > instance.openLayers()) { @@ -348,13 +355,15 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc //Subtract from total data.totalAmount -= newFluid.amount; - if (data.totalAmount < 0) + if (data.totalAmount <= 0) break; } else { //Calculate open layers int open = data.layers - height; + if (open < 1) //Temporary stopgap check + continue; if (open > instance.openLayers()) open = instance.openLayers(); @@ -365,7 +374,7 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc //Subtract from total data.totalAmount -= newFluid.amount; - if (data.totalAmount < 0) + if (data.totalAmount <= 0) break; } } @@ -373,8 +382,13 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc } //Distribute liquids to each block - Iterator iter = blocks.entrySet().iterator(); - while (iter.hasNext()) + } + + protected void updateFluidBlocks() + { + Iterator iter = airUpdates.entrySet().iterator(); + byte count = 0; + while (iter.hasNext() && count < 40) { Map.Entry pairs = (Map.Entry) iter.next(); CoordTuple coord = (CoordTuple) pairs.getKey(); @@ -383,10 +397,12 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc { ((TankAirLogic) te).overrideFluids(((LiquidDataInstance) pairs.getValue()).fluids); } + iter.remove(); + count++; } } - public void updateAir() + public void updateAir () { for (CoordTuple loc : structure.airCoords) worldObj.markBlockForUpdate(loc.x, loc.y, loc.z); diff --git a/src/tconstruct/client/TProxyClient.java b/src/tconstruct/client/TProxyClient.java index 9985b8d7..7a268e43 100644 --- a/src/tconstruct/client/TProxyClient.java +++ b/src/tconstruct/client/TProxyClient.java @@ -26,17 +26,20 @@ import net.minecraftforge.fluids.RenderBlockFluid; import org.lwjgl.opengl.GL11; import org.w3c.dom.Document; import tconstruct.TConstruct; +import tconstruct.blocks.SlimeExplosive; import tconstruct.blocks.logic.*; import tconstruct.client.armor.RenderArmorCast; import tconstruct.client.block.*; import tconstruct.client.entity.*; +import tconstruct.client.entity.item.ExplosiveRender; import tconstruct.client.entity.projectile.*; import tconstruct.client.gui.*; import tconstruct.client.pages.*; import tconstruct.client.tabs.*; import tconstruct.common.*; import tconstruct.entity.*; -import tconstruct.entity.item.EntityLandmineFirework; +import tconstruct.entity.item.*; +import tconstruct.entity.item.*; import tconstruct.entity.projectile.*; import tconstruct.inventory.ContainerLandmine; import tconstruct.library.TConstructRegistry; @@ -232,6 +235,7 @@ public class TProxyClient extends TProxyCommon RenderingRegistry.registerEntityRenderingHandler(DaggerEntity.class, new DaggerRenderCustom()); RenderingRegistry.registerEntityRenderingHandler(ArrowEntity.class, new ArrowRenderCustom()); RenderingRegistry.registerEntityRenderingHandler(EntityLandmineFirework.class, new RenderSnowball(Item.firework)); + RenderingRegistry.registerEntityRenderingHandler(ExplosivePrimed.class, new ExplosiveRender()); // RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class, // new PlayerArmorRender()); // <-- Works, woo! diff --git a/src/tconstruct/client/block/TankAirRender.java b/src/tconstruct/client/block/TankAirRender.java index 4c9640e0..7a6c298c 100644 --- a/src/tconstruct/client/block/TankAirRender.java +++ b/src/tconstruct/client/block/TankAirRender.java @@ -46,6 +46,7 @@ public class TankAirRender implements ISimpleBlockRenderingHandler for (FluidStack fluidstack : logic.getFluids()) { Fluid fluid = fluidstack.getFluid(); + //System.out.println("Base: "+getBaseAmount(base)+", Height: "+getHeightAmount(base, fluidstack.amount)+", fluid amount: "+fluidstack.amount); renderer.setRenderBounds(0.0, getBaseAmount(base), 0.0, 1.0, getHeightAmount(base, fluidstack.amount), 1.0); if (fluid.canBePlacedInWorld()) BlockSkinRenderHelper.renderMetadataBlock(Block.blocksList[fluid.getBlockID()], 0, x, y, z, renderer, world); @@ -57,7 +58,7 @@ public class TankAirRender implements ISimpleBlockRenderingHandler } return true; } - + private double getBaseAmount (int base) { return base / capacity; diff --git a/src/tconstruct/client/entity/item/ExplosiveRender.java b/src/tconstruct/client/entity/item/ExplosiveRender.java new file mode 100644 index 00000000..3d41277c --- /dev/null +++ b/src/tconstruct/client/entity/item/ExplosiveRender.java @@ -0,0 +1,98 @@ +package tconstruct.client.entity.item; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import tconstruct.common.TContent; +import tconstruct.entity.item.ExplosivePrimed; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ExplosiveRender extends Render +{ + private RenderBlocks blockRenderer = new RenderBlocks(); + + public ExplosiveRender() + { + this.shadowSize = 0.5F; + } + + public void renderPrimedTNT(ExplosivePrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9) + { + GL11.glPushMatrix(); + GL11.glTranslatef((float)par2, (float)par4, (float)par6); + float f2; + + if ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F) + { + f2 = 1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 1.0F) + { + f2 = 1.0F; + } + + f2 *= f2; + f2 *= f2; + float f3 = 1.0F + f2 * 0.3F; + GL11.glScalef(f3, f3, f3); + } + + f2 = (1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 100.0F) * 0.8F; + this.bindEntityTexture(par1EntityTNTPrimed); + this.blockRenderer.renderBlockAsItem(TContent.slimeExplosive, 0, par1EntityTNTPrimed.getBrightness(par9)); + + if (par1EntityTNTPrimed.fuse / 5 % 2 == 0) + { + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, f2); + this.blockRenderer.renderBlockAsItem(Block.tnt, 0, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + GL11.glPopMatrix(); + } + + protected ResourceLocation func_110808_a(ExplosivePrimed par1EntityTNTPrimed) + { + return TextureMap.locationBlocksTexture; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity par1Entity) + { + return this.func_110808_a((ExplosivePrimed)par1Entity); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render 0.0F; f1 -= f2 * 0.75F) + { + int l = MathHelper.floor_double(d0); + int i1 = MathHelper.floor_double(d1); + int j1 = MathHelper.floor_double(d2); + int k1 = this.world.getBlockId(l, i1, j1); + + if (k1 > 0) + { + Block block = Block.blocksList[k1]; + float f3 = this.exploder != null ? this.exploder.getBlockExplosionResistance(this, this.world, l, i1, j1, block) : block.getExplosionResistance(this.exploder, world, + l, i1, j1, explosionX, explosionY, explosionZ); + f1 -= (f3 + 0.8F) * f2 * 0.25f; + } + + if (f1 > 0.0F && (this.exploder == null || this.exploder.shouldExplodeBlock(this, this.world, l, i1, j1, k1, f1))) + { + hashset.add(new ChunkPosition(l, i1, j1)); + } + + d0 += d3 * (double) f2; + d1 += d4 * (double) f2; + d2 += d5 * (double) f2; + } + } + } + } + } + + this.affectedBlockPositions.addAll(hashset); + this.explosionSize *= 2.0F; + i = MathHelper.floor_double(this.explosionX - (double) this.explosionSize - 1.0D); + j = MathHelper.floor_double(this.explosionX + (double) this.explosionSize + 1.0D); + k = MathHelper.floor_double(this.explosionY - (double) this.explosionSize - 1.0D); + int l1 = MathHelper.floor_double(this.explosionY + (double) this.explosionSize + 1.0D); + int i2 = MathHelper.floor_double(this.explosionZ - (double) this.explosionSize - 1.0D); + int j2 = MathHelper.floor_double(this.explosionZ + (double) this.explosionSize + 1.0D); + List list = this.world.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getAABBPool().getAABB((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2)); + Vec3 vec3 = this.world.getWorldVec3Pool().getVecFromPool(this.explosionX, this.explosionY, this.explosionZ); + + for (int k2 = 0; k2 < list.size(); ++k2) + { + Entity entity = (Entity) list.get(k2); + double d7 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double) this.explosionSize; + + if (d7 <= 1.0D) + { + d0 = entity.posX - this.explosionX; + d1 = entity.posY + (double) entity.getEyeHeight() - this.explosionY; + d2 = entity.posZ - this.explosionZ; + double d8 = (double) MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2); + + if (d8 != 0.0D) + { + d0 /= d8; + d1 /= d8; + d2 /= d8; + double d9 = (double) this.world.getBlockDensity(vec3, entity.boundingBox); + double d10 = (1.0D - d7) * d9; + if (!(entity instanceof EntityItem)) + entity.attackEntityFrom(DamageSource.setExplosionSource(this), (float) ((int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.explosionSize + 1.0D))); + double d11 = EnchantmentProtection.func_92092_a(entity, d10); + entity.motionX += d0 * d11; + entity.motionY += d1 * d11; + entity.motionZ += d2 * d11; + + if (entity instanceof EntityPlayer) + { + this.field_77288_k.put((EntityPlayer) entity, this.world.getWorldVec3Pool().getVecFromPool(d0 * d10, d1 * d10, d2 * d10)); + } + } + } + } + + this.explosionSize = f; + } + + public void doExplosionB (boolean par1) + { + this.world.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.world.rand.nextFloat() - this.world.rand.nextFloat()) * 0.2F) * 0.7F); + + if (this.explosionSize >= 2.0F && this.isSmoking) + { + this.world.spawnParticle("hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); + } + else + { + this.world.spawnParticle("largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); + } + + Iterator iterator; + ChunkPosition chunkposition; + int i; + int j; + int k; + int l; + + if (this.isSmoking) + { + iterator = this.affectedBlockPositions.iterator(); + + while (iterator.hasNext()) + { + chunkposition = (ChunkPosition) iterator.next(); + i = chunkposition.x; + j = chunkposition.y; + k = chunkposition.z; + l = this.world.getBlockId(i, j, k); + + if (par1) + { + double d0 = (double) ((float) i + this.world.rand.nextFloat()); + double d1 = (double) ((float) j + this.world.rand.nextFloat()); + double d2 = (double) ((float) k + this.world.rand.nextFloat()); + double d3 = d0 - this.explosionX; + double d4 = d1 - this.explosionY; + double d5 = d2 - this.explosionZ; + double d6 = (double) MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); + d3 /= d6; + d4 /= d6; + d5 /= d6; + double d7 = 0.5D / (d6 / (double) this.explosionSize + 0.1D); + d7 *= (double) (this.world.rand.nextFloat() * this.world.rand.nextFloat() + 0.3F); + d3 *= d7; + d4 *= d7; + d5 *= d7; + this.world.spawnParticle("explode", (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5); + this.world.spawnParticle("smoke", d0, d1, d2, d3, d4, d5); + } + + if (l > 0) + { + Block block = Block.blocksList[l]; + + if (block.canDropFromExplosion(this)) + { + block.dropBlockAsItemWithChance(this.world, i, j, k, this.world.getBlockMetadata(i, j, k), 1.0F, 0); + } + + block.onBlockExploded(this.world, i, j, k, this); + } + } + } + + if (this.isFlaming) + { + iterator = this.affectedBlockPositions.iterator(); + + while (iterator.hasNext()) + { + chunkposition = (ChunkPosition) iterator.next(); + i = chunkposition.x; + j = chunkposition.y; + k = chunkposition.z; + l = this.world.getBlockId(i, j, k); + int i1 = this.world.getBlockId(i, j - 1, k); + + if (l == 0 && Block.opaqueCubeLookup[i1] && this.random.nextInt(3) == 0) + { + this.world.setBlock(i, j, k, Block.fire.blockID); + } + } + } + } +} diff --git a/src/tconstruct/util/config/PHConstruct.java b/src/tconstruct/util/config/PHConstruct.java index 696ddb76..435b3041 100644 --- a/src/tconstruct/util/config/PHConstruct.java +++ b/src/tconstruct/util/config/PHConstruct.java @@ -178,6 +178,7 @@ public class PHConstruct woolSlab1 = config.getBlock("Wool Slab 1", 3244).getInt(3244); woolSlab2 = config.getBlock("Wool Slab 2", 3245).getInt(3245); airTank = config.getBlock("Air Tank", 3246).getInt(3246); + slimeExplosive = config.getBlock("SDX", 3247).getInt(3247); castingChannel = config.getBlock("Casting Channel", 3249).getInt(3249); woodenRail = config.getBlock("Wooden Rail", 3250).getInt(3250); @@ -424,6 +425,7 @@ public class PHConstruct public static int barricadeSpruce; public static int barricadeBirch; public static int barricadeJungle; + public static int slimeExplosive; //InfiBlocks public static int speedBlock;