From 5dec1e9cbb74781bae6b13b6404b6691441a616f Mon Sep 17 00:00:00 2001 From: HbmMods Date: Mon, 10 Sep 2018 21:32:47 +0200 Subject: [PATCH] cut grenades, taint creeper, fixed orbital laser targeting --- assets/hbm/lang/de_DE.lang | 5 + assets/hbm/lang/en_US.lang | 5 + .../textures/entity/creeper_armor_taint.png | Bin 0 -> 1647 bytes assets/hbm/textures/items/grenade_breach.png | Bin 0 -> 322 bytes assets/hbm/textures/items/grenade_burst.png | Bin 0 -> 387 bytes assets/hbm/textures/items/grenade_mirv.png | Bin 0 -> 371 bytes assets/hbm/textures/items/grenade_smart.png | Bin 0 -> 312 bytes assets/hbm/textures/items/key.png | Bin 0 -> 220 bytes assets/hbm/textures/items/padlock.png | Bin 0 -> 225 bytes com/hbm/blocks/bomb/BlockTaint.java | 21 +- .../entity/grenade/EntityGrenadeBreach.java | 37 ++ .../entity/grenade/EntityGrenadeBurst.java | 60 +++ .../entity/grenade/EntityGrenadeGascan.java | 1 - com/hbm/entity/grenade/EntityGrenadeMIRV.java | 62 +++ .../entity/grenade/EntityGrenadeSmart.java | 43 ++ .../mob/EntityAITaintedCreeperSwell.java | 71 ++++ com/hbm/entity/mob/EntityTaintedCreeper.java | 379 ++++++++++++++++++ com/hbm/explosion/ExplosionNukeGeneric.java | 5 + .../inventory/gui/GUIScreenSatInterface.java | 4 +- com/hbm/items/ModItems.java | 14 + com/hbm/items/special/ItemStarterKit.java | 4 + com/hbm/items/tool/ItemWiring.java | 2 +- com/hbm/items/weapon/ItemGrenade.java | 16 + com/hbm/main/ClientProxy.java | 5 + com/hbm/main/CraftingManager.java | 4 + com/hbm/main/MainRegistry.java | 38 ++ com/hbm/potion/HbmPotion.java | 4 +- .../render/entity/RenderTaintedCreeper.java | 191 +++++++++ 28 files changed, 964 insertions(+), 7 deletions(-) create mode 100644 assets/hbm/textures/entity/creeper_armor_taint.png create mode 100644 assets/hbm/textures/items/grenade_breach.png create mode 100644 assets/hbm/textures/items/grenade_burst.png create mode 100644 assets/hbm/textures/items/grenade_mirv.png create mode 100644 assets/hbm/textures/items/grenade_smart.png create mode 100644 assets/hbm/textures/items/key.png create mode 100644 assets/hbm/textures/items/padlock.png create mode 100644 com/hbm/entity/grenade/EntityGrenadeBreach.java create mode 100644 com/hbm/entity/grenade/EntityGrenadeBurst.java create mode 100644 com/hbm/entity/grenade/EntityGrenadeMIRV.java create mode 100644 com/hbm/entity/grenade/EntityGrenadeSmart.java create mode 100644 com/hbm/entity/mob/EntityAITaintedCreeperSwell.java create mode 100644 com/hbm/entity/mob/EntityTaintedCreeper.java create mode 100644 com/hbm/render/entity/RenderTaintedCreeper.java diff --git a/assets/hbm/lang/de_DE.lang b/assets/hbm/lang/de_DE.lang index 2c8f61d3f..6e68fb16b 100644 --- a/assets/hbm/lang/de_DE.lang +++ b/assets/hbm/lang/de_DE.lang @@ -1048,6 +1048,10 @@ item.grenade_black_hole.name=Schwarzes-Loch-Granate item.grenade_cloud.name=Gefäß voll Wolke item.grenade_pink_cloud.name=Gefäß voll pinker Wolke item.ullapool_caber.name=Ullapool'sche Stiel +item.grenade_smart.name=Smart-Granate +item.grenade_mirv.name=MIRV-Granate +item.grenade_breach.name=Durchbruchgranate +item.grenade_burst.name=Gräbergranate item.rod_uranium_fuel.name=Urankernbrennstoffzelle item.rod_dual_uranium_fuel.name=Doppelte Urankernbrennstoffzelle @@ -1257,6 +1261,7 @@ entity.hbm.entity_bullet.name=Patrone entity.hbm.entity_rocket.name=Rakete entity.hbm.entity_schrabnel.name=Schrabnel entity.entity_mob_nuclear_creeper.name=Nuklearer Creeper +entity.entity_mob_tainted_creeper.name=Verseuchter Creeper entity.entity_mob_hunter_chopper.name=Jagdschrauber entity.entity_cyber_crab.name=Cyber-Krabbe diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index 9b465ad8e..fe6cec1e3 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -1048,6 +1048,10 @@ item.grenade_black_hole.name=Black Hole Grenade item.grenade_cloud.name=Jar of Cloud item.grenade_pink_cloud.name=Jar of Pink Cloud item.ullapool_caber.name=Ullapool Caber +item.grenade_smart.name=Smart Grenade +item.grenade_mirv.name=MIRV Grenade +item.grenade_breach.name=Breaching Grenade +item.grenade_burst.name=Digger Grenade item.rod_uranium_fuel.name=Uranium Fuel Rod item.rod_dual_uranium_fuel.name=Uranium Dual Fuel Rod @@ -1257,6 +1261,7 @@ entity.hbm.entity_bullet.name=Bullet entity.hbm.entity_rocket.name=Rocket entity.hbm.entity_schrabnel.name=Schrabnel entity.entity_mob_nuclear_creeper.name=Nuclear Creeper +entity.entity_mob_tainted_creeper.name=Tainted Creeper entity.entity_mob_hunter_chopper.name=Hunter Chopper entity.entity_cyber_crab.name=Cyber Crab diff --git a/assets/hbm/textures/entity/creeper_armor_taint.png b/assets/hbm/textures/entity/creeper_armor_taint.png new file mode 100644 index 0000000000000000000000000000000000000000..fad613e60449ab8da02e3fb773f40c2a5b53eeca GIT binary patch literal 1647 zcmV-#29WuQP)o7_NV&iRFZ24QGjPj^Tu}tYw4<`4UDrA(mqt=e`^( zv_umjZk35KYZ$xQ#+WsBjcs$ro{<>W#;v6-p@j&stUUMOt*WW+uIlc|>^-#E?e402 z>wTYke>Gz{zyXl=oH53@wzXjLq(jz!+nL+Z`~*7`n;1a8x{Z zZ>@#PtqWieKo@`qaK|kiSA_AM-q+9Z@#nL|;PIUv&=LavaS6Y|5j~iwccz;|>te$n z_HqR|zkf>e_5qyG8aCnMdbpfo!dd{o!k3x^Z2)Z`sQO83d&vFYv?(-!uoj@T;=!+Q zz%6Esgk)VFIyYa=-#NQCCQU#6k{KA*f>QSwBP+nmDnJK!T%bprDPq7P&{-$fS!e<@ z0UTi|7ECvXfCt3&5NMh$#vK>Yg9*6f;_Tj7`HYM_24f_i|C7%M$+Fgpmw4~f?3xIRMf-Zn@cI+bb#P6RVNCDLi%2M zokeA{Io8)Vo*P+_w}w1cR^R}@5Ws2j45JY%N{6+8Xtqa}X&y;G?zp7T5oL2l$3pp! zy{xlcG~v(=FrFKn|c3mnvvu9`>whtL$7gv?>3Hso>0IHDx6K$2hb<>D;#(xHYMIc zlN=8`aW!IfnG|D!U*V)I%b5Mu9rzUv86K~rHc*gOiR&RL;FK&T&oFmf(mbbo>BapD z2b#dUjbj?W2Yh%mQ&u;viMIwP>x(Edu=^SeiFxRfEa_ZhDM)9C5m6Cc5sD)5_lSP= zP08FkafDuwkju(r^ZH>eKv4CU3bnc5j;k!KU-EhMV3G-w3HEe^B{d~nZe3(8E}rXW zI*nyYSb6@XqRM8x3Rl0pFB~wq-GO9ISPRtVuN!(u)g7CJDf7&Qq`2*j%8l8^>)u>O z2OA~fEmv$Ul7JbtMsz`-pi%Y*$@-r1@yhMSbvmsqng|z@^1IC0TE%*q~(_87E zWD`b)+ag6s2AChV#pWW-`*(rq=5XGclFuVxc6U@dGfQ`zUf+056=R>)C~Lva&6kiB zs;x&D*TeGp0ft(t`}7NKu0Nk#zvKqci08>p2Sz3Ae)FOnB_pUNN}hjE3=|Z`0dRJ2 ztP(KB7{kBfw`I;uWuw+Ci0I{^pDiKLh@lr9Y4{bcEU0_tbncy5bNh;@E4#i&w7K3| zi)5KVrL1^6S5#2-p&O2|Y(m8y7dTxsA~a(11;2hUdvQzABjHy#@XDUXrlD$tuAp=e zz&Y^Ok8kLI;WKaqpjG~u*kC*sa*^5H5imB>xh$}Kg`n!^3M!i>vTdfa#+h)eeM+B$ zst^435sZ;yucK?7#{TLKR9i?|f;+CY3M`B1<`9_Be5Ra0&)ac8sr7Voh;$=F2O4oQ ze&-->9xHSW<6tiM`Tf&{C!4Gfh}IF&Se4I)-oA2d{+t=5IUOJq!dgIQc#v#mNx>MS{6im8biRYCuZpvxXaP_7mB~DmBcd-? z)&*>xU%kbh8Dp@hj3jzP1x;eX;jLX`8LjFFEkV&E5ne&1*s}Rzl1DGJYz5pxkee?% zflN!~=2cFi)$Vd$+Z;t7L>58m<7M5l-OSU9h_g>a^l?}xFrD&w?@Zx&aitNS(JU{B$HZg3+1x(u}mWhlDn6^!P zHtY8fmiYPh=*;F<9G}kd{D`0U>*Hy#MC&X376Bm7bLUTi_szp#((B9G`ezPbdlgx$ UDTG|&DF6Tf07*qoM6N<$g1lpjj{pDw literal 0 HcmV?d00001 diff --git a/assets/hbm/textures/items/grenade_burst.png b/assets/hbm/textures/items/grenade_burst.png new file mode 100644 index 0000000000000000000000000000000000000000..82f4261f3dfb289ea15fc63390075663098133f7 GIT binary patch literal 387 zcmV-}0et?6P)$S31R~=5% zR9h?-h~pSU1OSMlNd8Em4DVVCZKJ}N9DBmq$+HS{ozXl#U{hbIw5XhIO zo7VR0^DW-8yEa0Tui95pI$&lnGn&r`tZ(`L zKhf;I?DkL%#B9Ywp#uwVhqtpcZx{X>o{Jm|1{PpE9+%v7I(7CoT!)v-r5A=F^Z6X5 z6abUS#2zKE52aMOTp|Y}4DUYBxnc8V2>L#q_gmWSb|sF}!TI$Y-Qg=bH;95lgU$`J z*{pV0A} z5lNC*5upe&y1fRXAYU0y)-fVd6RADpE(U-sM#xK87_5#NlK?7+H0)kkiQ^7jFTvA913D`)m5bRTk z%8AKtZr93ScK3{(4h%dVvv1y;g}<)AN2Y0N0P;K^xw0(1vkTwjwrztf%V?SgDJ1|! zQJ7x|*d?VL+b8m4gw5p}s@HT|O`Hf;uNOp7G>PMNaD4W{dh?9xHG_nm0@Z7(s&Wf7^rhnJS4@0=r>=YwDITz;ZCVK_qM4)<2xYS-uH=TDP*tTsv>!90CZQJ-DoN@4Y zI|S>a1*^k=I1zluPj`cJMDH)`ivUp9bucUNa3h^f_t!4>Kk5^`1C;c@N0_Am0000< KMNUMnLSTZu|ACbN literal 0 HcmV?d00001 diff --git a/assets/hbm/textures/items/key.png b/assets/hbm/textures/items/key.png new file mode 100644 index 0000000000000000000000000000000000000000..403bbd9fc50be8995281136c6bbccdb0d0823315 GIT binary patch literal 220 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#VfFVdQ&MBb@08PeF>;M1& literal 0 HcmV?d00001 diff --git a/assets/hbm/textures/items/padlock.png b/assets/hbm/textures/items/padlock.png new file mode 100644 index 0000000000000000000000000000000000000000..da8f9d34e3de66690fa22f14708c0e00b5b35c43 GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf`TeR|`Sb=H$YvzU2A^dg?0vsAYwhHdme-v)SQwnn z%)G3!G-g@ff$h9*PvGkrB^zkWkr!|Cr3TI%r5GBv}OL|JsuV list = new ArrayList(); PotionEffect effect = new PotionEffect(HbmPotion.taint.id, 15 * 20, level); effect.setCurativeItems(list); - if(entity instanceof EntityLivingBase) - if(world.rand.nextInt(50) == 0) + + if(entity instanceof EntityLivingBase) { + if(world.rand.nextInt(50) == 0) { ((EntityLivingBase)entity).addPotionEffect(effect); + } + } + + if(entity instanceof EntityCreeper) { + EntityTaintedCreeper creep = new EntityTaintedCreeper(world); + creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); + + System.out.println(entity.getClass().toString()); + + if(!world.isRemote) { + entity.setDead(); + world.spawnEntityInWorld(creep); + } + } } } diff --git a/com/hbm/entity/grenade/EntityGrenadeBreach.java b/com/hbm/entity/grenade/EntityGrenadeBreach.java new file mode 100644 index 000000000..710012a90 --- /dev/null +++ b/com/hbm/entity/grenade/EntityGrenadeBreach.java @@ -0,0 +1,37 @@ +package com.hbm.entity.grenade; + +import com.hbm.explosion.ExplosionLarge; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class EntityGrenadeBreach extends EntityGrenadeBase { + + public EntityGrenadeBreach(World p_i1773_1_) + { + super(p_i1773_1_); + } + + public EntityGrenadeBreach(World p_i1774_1_, EntityLivingBase p_i1774_2_) + { + super(p_i1774_1_, p_i1774_2_); + } + + public EntityGrenadeBreach(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) + { + super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_); + } + + @Override + public void explode() { + + if (!this.worldObj.isRemote) + { + if(rand.nextInt(10) == 0) + this.setDead(); + ExplosionLarge.explode(worldObj, posX, posY, posZ, 2.5F, false, false, false); + } + } +} diff --git a/com/hbm/entity/grenade/EntityGrenadeBurst.java b/com/hbm/entity/grenade/EntityGrenadeBurst.java new file mode 100644 index 000000000..1911f8b15 --- /dev/null +++ b/com/hbm/entity/grenade/EntityGrenadeBurst.java @@ -0,0 +1,60 @@ +package com.hbm.entity.grenade; + +import com.hbm.items.ModItems; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class EntityGrenadeBurst extends EntityGrenadeBase { + + public EntityGrenadeBurst(World p_i1773_1_) + { + super(p_i1773_1_); + } + + public EntityGrenadeBurst(World p_i1774_1_, EntityLivingBase p_i1774_2_) + { + super(p_i1774_1_, p_i1774_2_); + } + + public EntityGrenadeBurst(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) + { + super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_); + } + + @Override + public void onUpdate() { + super.onUpdate(); + + if(this.ticksExisted > 20 && !worldObj.isRemote) { + this.setDead(); + + for(int i = 0; i < 8; i++) { + + EntityGrenadeBreach grenade = new EntityGrenadeBreach(worldObj); + grenade.posX = posX; + grenade.posY = posY; + grenade.posZ = posZ; + grenade.motionX = rand.nextGaussian() * 0.1D; + grenade.motionY = -0.25D; + grenade.motionZ = rand.nextGaussian() * 0.1D; + + worldObj.spawnEntityInWorld(grenade); + } + } + } + + @Override + public void explode() { + + if (!this.worldObj.isRemote) + { + this.setDead(); + worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY, posZ, new ItemStack(ModItems.grenade_burst))); + } + } +} diff --git a/com/hbm/entity/grenade/EntityGrenadeGascan.java b/com/hbm/entity/grenade/EntityGrenadeGascan.java index 6f5d27ec1..414347d80 100644 --- a/com/hbm/entity/grenade/EntityGrenadeGascan.java +++ b/com/hbm/entity/grenade/EntityGrenadeGascan.java @@ -7,7 +7,6 @@ import net.minecraft.world.World; public class EntityGrenadeGascan extends EntityGrenadeBase { - private static final String __OBFID = "CL_00001722"; public EntityGrenadeGascan(World p_i1773_1_) { diff --git a/com/hbm/entity/grenade/EntityGrenadeMIRV.java b/com/hbm/entity/grenade/EntityGrenadeMIRV.java new file mode 100644 index 000000000..fd7a79ea1 --- /dev/null +++ b/com/hbm/entity/grenade/EntityGrenadeMIRV.java @@ -0,0 +1,62 @@ +package com.hbm.entity.grenade; + +import com.hbm.explosion.ExplosionLarge; +import com.hbm.items.ModItems; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class EntityGrenadeMIRV extends EntityGrenadeBase { + + public EntityGrenadeMIRV(World p_i1773_1_) + { + super(p_i1773_1_); + } + + public EntityGrenadeMIRV(World p_i1774_1_, EntityLivingBase p_i1774_2_) + { + super(p_i1774_1_, p_i1774_2_); + } + + public EntityGrenadeMIRV(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) + { + super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_); + } + + @Override + public void onUpdate() { + super.onUpdate(); + + if(this.ticksExisted > 20 && !worldObj.isRemote) { + this.setDead(); + + for(int i = 0; i < 8; i++) { + + EntityGrenadeSmart grenade = new EntityGrenadeSmart(worldObj); + grenade.posX = posX; + grenade.posY = posY; + grenade.posZ = posZ; + grenade.motionX = motionX + rand.nextGaussian() * 0.25D; + grenade.motionY = motionY + rand.nextGaussian() * 0.25D; + grenade.motionZ = motionZ + rand.nextGaussian() * 0.25D; + grenade.ticksExisted = 10; + + worldObj.spawnEntityInWorld(grenade); + } + } + } + + @Override + public void explode() { + + if (!this.worldObj.isRemote) + { + this.setDead(); + worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY, posZ, new ItemStack(ModItems.grenade_mirv))); + } + } +} diff --git a/com/hbm/entity/grenade/EntityGrenadeSmart.java b/com/hbm/entity/grenade/EntityGrenadeSmart.java new file mode 100644 index 000000000..159522055 --- /dev/null +++ b/com/hbm/entity/grenade/EntityGrenadeSmart.java @@ -0,0 +1,43 @@ +package com.hbm.entity.grenade; + +import com.hbm.explosion.ExplosionLarge; +import com.hbm.items.ModItems; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class EntityGrenadeSmart extends EntityGrenadeBase { + + public EntityGrenadeSmart(World p_i1773_1_) + { + super(p_i1773_1_); + } + + public EntityGrenadeSmart(World p_i1774_1_, EntityLivingBase p_i1774_2_) + { + super(p_i1774_1_, p_i1774_2_); + } + + public EntityGrenadeSmart(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) + { + super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_); + } + + @Override + public void explode() { + + if (!this.worldObj.isRemote) + { + this.setDead(); + + if(this.ticksExisted > 10) + ExplosionLarge.explode(worldObj, posX, posY, posZ, 5.0F, true, false, false); + else + worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY, posZ, new ItemStack(ModItems.grenade_smart))); + } + } +} diff --git a/com/hbm/entity/mob/EntityAITaintedCreeperSwell.java b/com/hbm/entity/mob/EntityAITaintedCreeperSwell.java new file mode 100644 index 000000000..149aa3ec3 --- /dev/null +++ b/com/hbm/entity/mob/EntityAITaintedCreeperSwell.java @@ -0,0 +1,71 @@ +package com.hbm.entity.mob; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; + +public class EntityAITaintedCreeperSwell extends EntityAIBase { + /** The creeper that is swelling. */ + EntityTaintedCreeper swellingCreeper; + /** The creeper's attack target. This is used for the changing of the creeper's state. */ + EntityLivingBase creeperAttackTarget; + private static final String __OBFID = "CL_00001614"; + + public EntityAITaintedCreeperSwell(EntityTaintedCreeper p_i1655_1_) + { + this.swellingCreeper = p_i1655_1_; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + @Override + public boolean shouldExecute() + { + EntityLivingBase entitylivingbase = this.swellingCreeper.getAttackTarget(); + return this.swellingCreeper.getCreeperState() > 0 || entitylivingbase != null && this.swellingCreeper.getDistanceSqToEntity(entitylivingbase) < 9.0D; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + @Override + public void startExecuting() + { + this.swellingCreeper.getNavigator().clearPathEntity(); + this.creeperAttackTarget = this.swellingCreeper.getAttackTarget(); + } + + /** + * Resets the task + */ + @Override + public void resetTask() + { + this.creeperAttackTarget = null; + } + + /** + * Updates the task + */ + @Override + public void updateTask() + { + if (this.creeperAttackTarget == null) + { + this.swellingCreeper.setCreeperState(-1); + } + else if (this.swellingCreeper.getDistanceSqToEntity(this.creeperAttackTarget) > 49.0D) + { + this.swellingCreeper.setCreeperState(-1); + } + else if (!this.swellingCreeper.getEntitySenses().canSee(this.creeperAttackTarget)) + { + this.swellingCreeper.setCreeperState(-1); + } + else + { + this.swellingCreeper.setCreeperState(1); + } + } +} diff --git a/com/hbm/entity/mob/EntityTaintedCreeper.java b/com/hbm/entity/mob/EntityTaintedCreeper.java new file mode 100644 index 000000000..4fbe0b27d --- /dev/null +++ b/com/hbm/entity/mob/EntityTaintedCreeper.java @@ -0,0 +1,379 @@ +package com.hbm.entity.mob; + +import java.util.HashSet; +import java.util.List; + +import com.hbm.blocks.ModBlocks; +import com.hbm.items.ModItems; +import com.hbm.lib.Library; +import com.hbm.lib.ModDamageSource; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class EntityTaintedCreeper extends EntityMob { + /** + * Time when this creeper was last in an active state (Messed up code here, probably causes creeper animation to go + * weird) + */ + private int lastActiveTime; + /** The amount of time since the creeper was close enough to the player to ignite */ + private int timeSinceIgnited; + private int fuseTime = 30; + /** Explosion radius for this creeper. */ + private int explosionRadius = 20; + private static final String __OBFID = "CL_00001684"; + + public EntityTaintedCreeper(World p_i1733_1_) + { + super(p_i1733_1_); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAITaintedCreeperSwell(this)); + this.tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0D, false)); + this.tasks.addTask(4, new EntityAIWander(this, 0.8D)); + this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(6, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); + this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); + this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityOcelot.class, 0, true)); + } + + @Override + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(15.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35D); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + @Override + public boolean isAIEnabled() + { + return true; + } + + /** + * The number of iterations PathFinder.getSafePoint will execute before giving up. + */ + @Override + public int getMaxSafePointTries() + { + return this.getAttackTarget() == null ? 3 : 3 + (int)(this.getHealth() - 1.0F); + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + @Override + protected void fall(float p_70069_1_) + { + super.fall(p_70069_1_); + this.timeSinceIgnited = (int)(this.timeSinceIgnited + p_70069_1_ * 1.5F); + + if (this.timeSinceIgnited > this.fuseTime - 5) + { + this.timeSinceIgnited = this.fuseTime - 5; + } + } + + @Override + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte) - 1)); + this.dataWatcher.addObject(17, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(18, Byte.valueOf((byte)0)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + @Override + public void writeEntityToNBT(NBTTagCompound p_70014_1_) + { + super.writeEntityToNBT(p_70014_1_); + + if (this.dataWatcher.getWatchableObjectByte(17) == 1) + { + p_70014_1_.setBoolean("powered", true); + } + + p_70014_1_.setShort("Fuse", (short)this.fuseTime); + p_70014_1_.setByte("ExplosionRadius", (byte)this.explosionRadius); + p_70014_1_.setBoolean("ignited", this.func_146078_ca()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + @Override + public void readEntityFromNBT(NBTTagCompound p_70037_1_) + { + super.readEntityFromNBT(p_70037_1_); + this.dataWatcher.updateObject(17, Byte.valueOf((byte)(p_70037_1_.getBoolean("powered") ? 1 : 0))); + + if (p_70037_1_.hasKey("Fuse", 99)) + { + this.fuseTime = p_70037_1_.getShort("Fuse"); + } + + if (p_70037_1_.hasKey("ExplosionRadius", 99)) + { + this.explosionRadius = p_70037_1_.getByte("ExplosionRadius"); + } + + if (p_70037_1_.getBoolean("ignited")) + { + this.func_146079_cb(); + } + } + + /** + * Called to update the entity's position/logic. + */ + @Override + public void onUpdate() + { + if (this.isEntityAlive()) + { + this.lastActiveTime = this.timeSinceIgnited; + + if (this.func_146078_ca()) + { + this.setCreeperState(1); + } + + int i = this.getCreeperState(); + + if (i > 0 && this.timeSinceIgnited == 0) + { + this.playSound("creeper.primed", 1.0F * 30 / 75, 0.5F); + } + + this.timeSinceIgnited += i; + + if (this.timeSinceIgnited < 0) + { + this.timeSinceIgnited = 0; + } + + if (this.timeSinceIgnited >= this.fuseTime) + { + this.timeSinceIgnited = this.fuseTime; + this.func_146077_cc(); + } + } + + super.onUpdate(); + + if(this.getHealth() < this.getMaxHealth() && this.ticksExisted % 10 == 0) + { + this.heal(1.0F); + } + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + @Override + protected String getHurtSound() + { + return "mob.creeper.say"; + } + + /** + * Returns the sound this mob makes on death. + */ + @Override + protected String getDeathSound() + { + return "mob.creeper.death"; + } + + /** + * Called when the mob's health reaches 0. + */ + @Override + public void onDeath(DamageSource p_70645_1_) + { + super.onDeath(p_70645_1_); + } + + @Override + public boolean attackEntityAsMob(Entity p_70652_1_) + { + return true; + } + + /** + * Returns true if the creeper is powered by a lightning bolt. + */ + public boolean getPowered() + { + return this.dataWatcher.getWatchableObjectByte(17) == 1; + } + + /** + * Params: (Float)Render tick. Returns the intensity of the creeper's flash when it is ignited. + */ + @SideOnly(Side.CLIENT) + public float getCreeperFlashIntensity(float p_70831_1_) + { + return (this.lastActiveTime + (this.timeSinceIgnited - this.lastActiveTime) * p_70831_1_) / (this.fuseTime - 2); + } + + @Override + protected Item getDropItem() + { + return Item.getItemFromBlock(Blocks.tnt); + } + + /** + * Returns the current state of creeper, -1 is idle, 1 is 'in fuse' + */ + public int getCreeperState() + { + return this.dataWatcher.getWatchableObjectByte(16); + } + + /** + * Sets the state of creeper, -1 to idle and 1 to be 'in fuse' + */ + public void setCreeperState(int p_70829_1_) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)p_70829_1_)); + } + + /** + * Called when a lightning bolt hits the entity. + */ + @Override + public void onStruckByLightning(EntityLightningBolt p_70077_1_) + { + super.onStruckByLightning(p_70077_1_); + this.dataWatcher.updateObject(17, Byte.valueOf((byte)1)); + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + @Override + protected boolean interact(EntityPlayer p_70085_1_) + { + ItemStack itemstack = p_70085_1_.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.flint_and_steel) + { + this.worldObj.playSoundEffect(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "fire.ignite", 1.0F, this.rand.nextFloat() * 0.4F + 0.8F); + p_70085_1_.swingItem(); + + if (!this.worldObj.isRemote) + { + this.func_146079_cb(); + itemstack.damageItem(1, p_70085_1_); + return true; + } + } + + return super.interact(p_70085_1_); + } + + private void func_146077_cc() + { + if (!this.worldObj.isRemote) + { + boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"); + + if (this.getPowered()) + { + this.explosionRadius *= 3; + } + + worldObj.newExplosion(this, posX, posY, posZ, 5.0F, false, false); + + if(this.getPowered()) + { + + for(int i = 0; i < 255; i++) { + int a = rand.nextInt(15) + (int)posX - 7; + int b = rand.nextInt(15) + (int)posY - 7; + int c = rand.nextInt(15) + (int)posZ - 7; + if(worldObj.getBlock(a, b, c).isReplaceable(worldObj, a, b, c) && hasPosNeightbour(worldObj, a, b, c)) + worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3) + 5, 2); + } + + } else { + + for(int i = 0; i < 85; i++) { + int a = rand.nextInt(7) + (int)posX - 3; + int b = rand.nextInt(7) + (int)posY - 3; + int c = rand.nextInt(7) + (int)posZ - 3; + if(worldObj.getBlock(a, b, c).isReplaceable(worldObj, a, b, c) && hasPosNeightbour(worldObj, a, b, c)) + worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(6) + 10, 2); + } + } + + this.setDead(); + } + } + + public static boolean hasPosNeightbour(World world, int x, int y, int z) { + Block b0 = world.getBlock(x + 1, y, z); + Block b1 = world.getBlock(x, y + 1, z); + Block b2 = world.getBlock(x, y, z + 1); + Block b3 = world.getBlock(x - 1, y, z); + Block b4 = world.getBlock(x, y - 1, z); + Block b5 = world.getBlock(x, y, z - 1); + boolean b = (b0.renderAsNormalBlock() && b0.getMaterial().isOpaque()) || + (b1.renderAsNormalBlock() && b1.getMaterial().isOpaque()) || + (b2.renderAsNormalBlock() && b2.getMaterial().isOpaque()) || + (b3.renderAsNormalBlock() && b3.getMaterial().isOpaque()) || + (b4.renderAsNormalBlock() && b4.getMaterial().isOpaque()) || + (b5.renderAsNormalBlock() && b5.getMaterial().isOpaque()); + return b; + } + + public boolean func_146078_ca() + { + return this.dataWatcher.getWatchableObjectByte(18) != 0; + } + + public void func_146079_cb() + { + this.dataWatcher.updateObject(18, Byte.valueOf((byte)1)); + } + + public void setPowered(int power) { + this.dataWatcher.updateObject(17, power); + } +} diff --git a/com/hbm/explosion/ExplosionNukeGeneric.java b/com/hbm/explosion/ExplosionNukeGeneric.java index 673649420..a78719f66 100644 --- a/com/hbm/explosion/ExplosionNukeGeneric.java +++ b/com/hbm/explosion/ExplosionNukeGeneric.java @@ -40,6 +40,7 @@ import com.hbm.interfaces.ISource; import com.hbm.items.ModItems; import com.hbm.lib.Library; import com.hbm.lib.ModDamageSource; +import com.hbm.tileentity.bomb.TileEntityTurretBase; import com.hbm.tileentity.machine.TileEntityDummy; import cofh.api.energy.IEnergyProvider; @@ -623,6 +624,10 @@ public class ExplosionNukeGeneric { if(random.nextInt(5) <= 1) world.setBlock(x, y, z, ModBlocks.block_electrical_scrap); } + if (te != null && te instanceof TileEntityTurretBase) { + + ((TileEntityTurretBase)te).ammo = 0; + } if((b == ModBlocks.fusion_conductor || b == ModBlocks.fwatz_conductor || b == ModBlocks.fusion_motor || b == ModBlocks.fusion_heater || b == ModBlocks.fwatz_computer) && random.nextInt(10) == 0) world.setBlock(x, y, z, ModBlocks.block_electrical_scrap); } diff --git a/com/hbm/inventory/gui/GUIScreenSatInterface.java b/com/hbm/inventory/gui/GUIScreenSatInterface.java index 3fdd4d2d4..7da383089 100644 --- a/com/hbm/inventory/gui/GUIScreenSatInterface.java +++ b/com/hbm/inventory/gui/GUIScreenSatInterface.java @@ -74,8 +74,8 @@ public class GUIScreenSatInterface extends GuiScreen { mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBleep"), 1.0F)); - int x = (int)player.posX - guiLeft + i - 8 - 100; - int z = (int)player.posZ - guiTop + j - 8 - 100; + int x = this.x - guiLeft + i - 8 - 100; + int z = this.z - guiTop + j - 8 - 100; PacketDispatcher.wrapper.sendToServer(new SatLaserPacket(x, z, connectedSat.satelliteID)); } } diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index 5e616bcdb..8deb7bca6 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -825,6 +825,11 @@ public class ModItems { public static Item grenade_pink_cloud; public static Item ullapool_caber; + public static Item grenade_smart; + public static Item grenade_mirv; + public static Item grenade_breach; + public static Item grenade_burst; + public static Item weaponized_starblaster_cell; public static Item bomb_waffle; @@ -2061,6 +2066,11 @@ public class ModItems { grenade_cloud = new ItemGrenade().setUnlocalizedName("grenade_cloud").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":grenade_cloud"); grenade_pink_cloud = new ItemGrenade().setUnlocalizedName("grenade_pink_cloud").setCreativeTab(null).setTextureName(RefStrings.MODID + ":grenade_pink_cloud"); ullapool_caber = new WeaponSpecial(MainRegistry.enumToolMaterialSteel).setUnlocalizedName("ullapool_caber").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":ullapool_caber"); + + grenade_smart = new ItemGrenade().setUnlocalizedName("grenade_smart").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":grenade_smart"); + grenade_mirv = new ItemGrenade().setUnlocalizedName("grenade_mirv").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":grenade_mirv"); + grenade_breach = new ItemGrenade().setUnlocalizedName("grenade_breach").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":grenade_breach"); + grenade_burst = new ItemGrenade().setUnlocalizedName("grenade_burst").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":grenade_burst"); weaponized_starblaster_cell = new WeaponizedCell().setUnlocalizedName("weaponized_starblaster_cell").setMaxStackSize(1).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_b92_ammo_weaponized"); @@ -3503,6 +3513,10 @@ public class ModItems { GameRegistry.registerItem(grenade_gas, grenade_gas.getUnlocalizedName()); GameRegistry.registerItem(grenade_cloud, grenade_cloud.getUnlocalizedName()); GameRegistry.registerItem(grenade_pink_cloud, grenade_pink_cloud.getUnlocalizedName()); + GameRegistry.registerItem(grenade_smart, grenade_smart.getUnlocalizedName()); + GameRegistry.registerItem(grenade_mirv, grenade_mirv.getUnlocalizedName()); + GameRegistry.registerItem(grenade_breach, grenade_breach.getUnlocalizedName()); + GameRegistry.registerItem(grenade_burst, grenade_burst.getUnlocalizedName()); GameRegistry.registerItem(grenade_pulse, grenade_pulse.getUnlocalizedName()); GameRegistry.registerItem(grenade_plasma, grenade_plasma.getUnlocalizedName()); GameRegistry.registerItem(grenade_tau, grenade_tau.getUnlocalizedName()); diff --git a/com/hbm/items/special/ItemStarterKit.java b/com/hbm/items/special/ItemStarterKit.java index 6187450be..fb0ebd927 100644 --- a/com/hbm/items/special/ItemStarterKit.java +++ b/com/hbm/items/special/ItemStarterKit.java @@ -244,6 +244,10 @@ public class ItemStarterKit extends Item { player.inventory.addItemStackToInventory(new ItemStack(ModItems.grenade_gas, 16)); player.inventory.addItemStackToInventory(new ItemStack(ModItems.grenade_cloud, 16)); player.inventory.addItemStackToInventory(new ItemStack(ModItems.grenade_pink_cloud, 16)); + player.inventory.addItemStackToInventory(new ItemStack(ModItems.grenade_smart, 16)); + player.inventory.addItemStackToInventory(new ItemStack(ModItems.grenade_mirv, 16)); + player.inventory.addItemStackToInventory(new ItemStack(ModItems.grenade_breach, 16)); + player.inventory.addItemStackToInventory(new ItemStack(ModItems.grenade_burst, 16)); player.inventory.addItemStackToInventory(new ItemStack(ModItems.grenade_pulse, 16)); player.inventory.addItemStackToInventory(new ItemStack(ModItems.grenade_plasma, 16)); player.inventory.addItemStackToInventory(new ItemStack(ModItems.grenade_tau, 16)); diff --git a/com/hbm/items/tool/ItemWiring.java b/com/hbm/items/tool/ItemWiring.java index b5844a037..a155a2fdd 100644 --- a/com/hbm/items/tool/ItemWiring.java +++ b/com/hbm/items/tool/ItemWiring.java @@ -71,7 +71,7 @@ public class ItemWiring extends Item { list.add("Wire start y: " + itemstack.stackTagCompound.getInteger("y")); list.add("Wire start z: " + itemstack.stackTagCompound.getInteger("z")); } else { - list.add("Richt-click poles to connect"); + list.add("Right-click poles to connect"); } } diff --git a/com/hbm/items/weapon/ItemGrenade.java b/com/hbm/items/weapon/ItemGrenade.java index f1b20183f..2eb380fdc 100644 --- a/com/hbm/items/weapon/ItemGrenade.java +++ b/com/hbm/items/weapon/ItemGrenade.java @@ -2,6 +2,8 @@ package com.hbm.items.weapon; import com.hbm.entity.grenade.EntityGrenadeASchrab; import com.hbm.entity.grenade.EntityGrenadeBlackHole; +import com.hbm.entity.grenade.EntityGrenadeBreach; +import com.hbm.entity.grenade.EntityGrenadeBurst; import com.hbm.entity.grenade.EntityGrenadeCloud; import com.hbm.entity.grenade.EntityGrenadeCluster; import com.hbm.entity.grenade.EntityGrenadeElectric; @@ -12,6 +14,7 @@ import com.hbm.entity.grenade.EntityGrenadeGas; import com.hbm.entity.grenade.EntityGrenadeGascan; import com.hbm.entity.grenade.EntityGrenadeGeneric; import com.hbm.entity.grenade.EntityGrenadeLemon; +import com.hbm.entity.grenade.EntityGrenadeMIRV; import com.hbm.entity.grenade.EntityGrenadeMk2; import com.hbm.entity.grenade.EntityGrenadeNuclear; import com.hbm.entity.grenade.EntityGrenadeNuke; @@ -21,6 +24,7 @@ import com.hbm.entity.grenade.EntityGrenadePoison; import com.hbm.entity.grenade.EntityGrenadePulse; import com.hbm.entity.grenade.EntityGrenadeSchrabidium; import com.hbm.entity.grenade.EntityGrenadeShrapnel; +import com.hbm.entity.grenade.EntityGrenadeSmart; import com.hbm.entity.grenade.EntityGrenadeStrong; import com.hbm.entity.grenade.EntityGrenadeTau; import com.hbm.entity.grenade.EntityGrenadeZOMG; @@ -123,6 +127,18 @@ public class ItemGrenade extends Item { if (this == ModItems.grenade_pink_cloud) { p_77659_2_.spawnEntityInWorld(new EntityGrenadePC(p_77659_2_, p_77659_3_)); } + if (this == ModItems.grenade_smart) { + p_77659_2_.spawnEntityInWorld(new EntityGrenadeSmart(p_77659_2_, p_77659_3_)); + } + if (this == ModItems.grenade_mirv) { + p_77659_2_.spawnEntityInWorld(new EntityGrenadeMIRV(p_77659_2_, p_77659_3_)); + } + if (this == ModItems.grenade_breach) { + p_77659_2_.spawnEntityInWorld(new EntityGrenadeBreach(p_77659_2_, p_77659_3_)); + } + if (this == ModItems.grenade_burst) { + p_77659_2_.spawnEntityInWorld(new EntityGrenadeBurst(p_77659_2_, p_77659_3_)); + } } return p_77659_1_; diff --git a/com/hbm/main/ClientProxy.java b/com/hbm/main/ClientProxy.java index c60c24322..1f5dd0d1e 100644 --- a/com/hbm/main/ClientProxy.java +++ b/com/hbm/main/ClientProxy.java @@ -141,6 +141,10 @@ public class ClientProxy extends ServerProxy RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeGascan.class, new RenderSnowball(ModItems.grenade_gascan)); RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeCloud.class, new RenderSnowball(ModItems.grenade_cloud)); RenderingRegistry.registerEntityRenderingHandler(EntityGrenadePC.class, new RenderSnowball(ModItems.grenade_pink_cloud)); + RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeSmart.class, new RenderSnowball(ModItems.grenade_smart)); + RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeMIRV.class, new RenderSnowball(ModItems.grenade_mirv)); + RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeBreach.class, new RenderSnowball(ModItems.grenade_breach)); + RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeBurst.class, new RenderSnowball(ModItems.grenade_burst)); RenderingRegistry.registerEntityRenderingHandler(EntitySchrab.class, new RenderFlare()); @@ -333,6 +337,7 @@ public class ClientProxy extends ServerProxy MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.steel_scaffold), new ItemRenderDecoBlock()); RenderingRegistry.registerEntityRenderingHandler(EntityNuclearCreeper.class, new RenderNuclearCreeper()); + RenderingRegistry.registerEntityRenderingHandler(EntityTaintedCreeper.class, new RenderTaintedCreeper()); RenderingRegistry.registerEntityRenderingHandler(EntityHunterChopper.class, new RenderHunterChopper()); RenderingRegistry.registerEntityRenderingHandler(EntityCyberCrab.class, new RenderCyberCrab()); diff --git a/com/hbm/main/CraftingManager.java b/com/hbm/main/CraftingManager.java index e2351051b..901ac84e7 100644 --- a/com/hbm/main/CraftingManager.java +++ b/com/hbm/main/CraftingManager.java @@ -807,6 +807,10 @@ public class CraftingManager { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.grenade_lemon, 1), new Object[] { ModItems.lemon, ModItems.grenade_strong })); //GameRegistry.addRecipe(new ItemStack(ModItems.grenade_black_hole, 1), new Object[] { " C ", "PBP", "PCP", 'C', ModItems.coil_advanced_alloy, 'P', ModItems.ingot_polymer, 'B', ModItems.black_hole }); GameRegistry.addShapelessRecipe(new ItemStack(ModItems.gun_moist_nugget, 12), new Object[] { Items.bread, Items.wheat, Items.cooked_chicken, Items.egg }); + GameRegistry.addRecipe(new ItemStack(ModItems.grenade_smart, 4), new Object[] { " A ", "ACA", " A ", 'A', ModItems.grenade_strong, 'C', ModItems.circuit_aluminium }); + GameRegistry.addRecipe(new ItemStack(ModItems.grenade_mirv, 1), new Object[] { "GGG", "GCG", "GGG", 'G', ModItems.grenade_smart, 'C', ModItems.grenade_generic }); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.grenade_breach, 1), new Object[] { "G", "G", "P", 'G', ModItems.grenade_smart, 'P', "plateSaturnite" })); + GameRegistry.addRecipe(new ItemStack(ModItems.grenade_burst, 1), new Object[] { "GGG", "GCG", "GGG", 'G', ModItems.grenade_breach, 'C', ModItems.grenade_generic }); GameRegistry.addRecipe(new ItemStack(ModItems.bomb_waffle, 1), new Object[] { "WEW", "MPM", "WEW", 'W', Items.wheat, 'E', Items.egg, 'M', Items.milk_bucket, 'P', ModItems.man_core }); GameRegistry.addRecipe(new ItemStack(ModItems.schnitzel_vegan, 3), new Object[] { "RWR", "WPW", "RWR", 'W', ModItems.nuclear_waste, 'R', Items.reeds, 'P', Items.pumpkin_seeds }); diff --git a/com/hbm/main/MainRegistry.java b/com/hbm/main/MainRegistry.java index be566b7a3..9b53827f0 100644 --- a/com/hbm/main/MainRegistry.java +++ b/com/hbm/main/MainRegistry.java @@ -66,6 +66,8 @@ import com.hbm.entity.effect.EntityRagingVortex; import com.hbm.entity.effect.EntityVortex; import com.hbm.entity.grenade.EntityGrenadeASchrab; import com.hbm.entity.grenade.EntityGrenadeBlackHole; +import com.hbm.entity.grenade.EntityGrenadeBreach; +import com.hbm.entity.grenade.EntityGrenadeBurst; import com.hbm.entity.grenade.EntityGrenadeCloud; import com.hbm.entity.grenade.EntityGrenadeCluster; import com.hbm.entity.grenade.EntityGrenadeElectric; @@ -76,6 +78,7 @@ import com.hbm.entity.grenade.EntityGrenadeGas; import com.hbm.entity.grenade.EntityGrenadeGascan; import com.hbm.entity.grenade.EntityGrenadeGeneric; import com.hbm.entity.grenade.EntityGrenadeLemon; +import com.hbm.entity.grenade.EntityGrenadeMIRV; import com.hbm.entity.grenade.EntityGrenadeMk2; import com.hbm.entity.grenade.EntityGrenadeNuclear; import com.hbm.entity.grenade.EntityGrenadeNuke; @@ -85,6 +88,7 @@ import com.hbm.entity.grenade.EntityGrenadePoison; import com.hbm.entity.grenade.EntityGrenadePulse; import com.hbm.entity.grenade.EntityGrenadeSchrabidium; import com.hbm.entity.grenade.EntityGrenadeShrapnel; +import com.hbm.entity.grenade.EntityGrenadeSmart; import com.hbm.entity.grenade.EntityGrenadeStrong; import com.hbm.entity.grenade.EntityGrenadeTau; import com.hbm.entity.grenade.EntityGrenadeZOMG; @@ -130,6 +134,7 @@ import com.hbm.entity.missile.EntityTestMissile; import com.hbm.entity.mob.EntityCyberCrab; import com.hbm.entity.mob.EntityHunterChopper; import com.hbm.entity.mob.EntityNuclearCreeper; +import com.hbm.entity.mob.EntityTaintedCreeper; import com.hbm.entity.particle.EntityBSmokeFX; import com.hbm.entity.particle.EntityChlorineFX; import com.hbm.entity.particle.EntityCloudFX; @@ -793,10 +798,15 @@ public class MainRegistry EntityRegistry.registerModEntity(EntityBombletZeta.class, "entity_zeta", 109, this, 1000, 1, true); EntityRegistry.registerModEntity(EntityOrangeFX.class, "entity_agent_orange", 110, this, 1000, 1, true); EntityRegistry.registerModEntity(EntityDeathBlast.class, "entity_laser_blast", 111, this, 1000, 1, true); + EntityRegistry.registerModEntity(EntityGrenadeSmart.class, "entity_grenade_smart", 112, this, 250, 1, true); + EntityRegistry.registerModEntity(EntityGrenadeMIRV.class, "entity_grenade_mirv", 113, this, 250, 1, true); + EntityRegistry.registerModEntity(EntityGrenadeBreach.class, "entity_grenade_breach", 114, this, 250, 1, true); + EntityRegistry.registerModEntity(EntityGrenadeBurst.class, "entity_grenade_burst", 115, this, 250, 1, true); EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00); EntityRegistry.registerGlobalEntityID(EntityHunterChopper.class, "entity_mob_hunter_chopper", EntityRegistry.findGlobalUniqueEntityId(), 0x000020, 0x2D2D72); EntityRegistry.registerGlobalEntityID(EntityCyberCrab.class, "entity_cyber_crab", EntityRegistry.findGlobalUniqueEntityId(), 0xAAAAAA, 0x444444); + EntityRegistry.registerGlobalEntityID(EntityTaintedCreeper.class, "entity_mob_tainted_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x813b9b, 0xd71fdd); ForgeChunkManager.setForcedChunkLoadingCallback(this, new LoadingCallback() { @@ -978,6 +988,34 @@ public class MainRegistry { return new EntityGrenadePC(p_82499_1_, p_82499_2_.getX(), p_82499_2_.getY(), p_82499_2_.getZ()); } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_smart, new BehaviorProjectileDispense() { + + protected IProjectile getProjectileEntity(World p_82499_1_, IPosition p_82499_2_) + { + return new EntityGrenadeSmart(p_82499_1_, p_82499_2_.getX(), p_82499_2_.getY(), p_82499_2_.getZ()); + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_mirv, new BehaviorProjectileDispense() { + + protected IProjectile getProjectileEntity(World p_82499_1_, IPosition p_82499_2_) + { + return new EntityGrenadeMIRV(p_82499_1_, p_82499_2_.getX(), p_82499_2_.getY(), p_82499_2_.getZ()); + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_breach, new BehaviorProjectileDispense() { + + protected IProjectile getProjectileEntity(World p_82499_1_, IPosition p_82499_2_) + { + return new EntityGrenadeBreach(p_82499_1_, p_82499_2_.getX(), p_82499_2_.getY(), p_82499_2_.getZ()); + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_burst, new BehaviorProjectileDispense() { + + protected IProjectile getProjectileEntity(World p_82499_1_, IPosition p_82499_2_) + { + return new EntityGrenadeBurst(p_82499_1_, p_82499_2_.getX(), p_82499_2_.getY(), p_82499_2_.getZ()); + } }); } diff --git a/com/hbm/potion/HbmPotion.java b/com/hbm/potion/HbmPotion.java index 0d33de57e..9d558c4d2 100644 --- a/com/hbm/potion/HbmPotion.java +++ b/com/hbm/potion/HbmPotion.java @@ -2,6 +2,7 @@ package com.hbm.potion; import java.lang.reflect.Field; +import com.hbm.entity.mob.EntityTaintedCreeper; import com.hbm.explosion.ExplosionLarge; import com.hbm.lib.ModDamageSource; import com.hbm.main.MainRegistry; @@ -74,7 +75,8 @@ public class HbmPotion extends Potion { if(this == taint) { - entity.attackEntityFrom(ModDamageSource.taint, (level + 1)); + if(!(entity instanceof EntityTaintedCreeper)) + entity.attackEntityFrom(ModDamageSource.taint, (level + 1)); } if(this == radiation) { diff --git a/com/hbm/render/entity/RenderTaintedCreeper.java b/com/hbm/render/entity/RenderTaintedCreeper.java new file mode 100644 index 000000000..1fa96f110 --- /dev/null +++ b/com/hbm/render/entity/RenderTaintedCreeper.java @@ -0,0 +1,191 @@ +package com.hbm.render.entity; + +import org.lwjgl.opengl.GL11; + +import com.hbm.entity.mob.EntityTaintedCreeper; +import com.hbm.lib.RefStrings; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelCreeper; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class RenderTaintedCreeper extends RenderLiving +{ + private static final ResourceLocation armoredCreeperTextures = new ResourceLocation(RefStrings.MODID + ":" + "textures/entity/creeper_armor_taint.png"); + private static final ResourceLocation creeperTextures = new ResourceLocation(RefStrings.MODID + ":" + "textures/entity/creeper_tainted.png"); + /** The creeper model. */ + private ModelBase creeperModel = new ModelCreeper(2.0F); + private static final String __OBFID = "CL_00000985"; + + public RenderTaintedCreeper() + { + super(new ModelCreeper(), 0.5F); + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityTaintedCreeper p_77041_1_, float p_77041_2_) + { + float f1 = p_77041_1_.getCreeperFlashIntensity(p_77041_2_); + float f2 = 1.0F + MathHelper.sin(f1 * 100.0F) * f1 * 0.01F; + + if (f1 < 0.0F) + { + f1 = 0.0F; + } + + if (f1 > 1.0F) + { + f1 = 1.0F; + } + + f1 *= f1; + f1 *= f1; + float f3 = (1.0F + f1 * 0.4F) * f2; + float f4 = (1.0F + f1 * 0.1F) / f2; + GL11.glScalef(f3, f4, f3); + } + + /** + * Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime + */ + protected int getColorMultiplier(EntityTaintedCreeper p_77030_1_, float p_77030_2_, float p_77030_3_) + { + float f2 = p_77030_1_.getCreeperFlashIntensity(p_77030_3_); + + if ((int)(f2 * 10.0F) % 2 == 0) + { + return 0; + } + else + { + int i = (int)(f2 * 0.2F * 255.0F); + + if (i < 0) + { + i = 0; + } + + if (i > 255) + { + i = 255; + } + + short short1 = 255; + short short2 = 255; + short short3 = 255; + return i << 24 | short1 << 16 | short2 << 8 | short3; + } + } + + /** + * Queries whether should render the specified pass or not. + */ + protected int shouldRenderPass(EntityTaintedCreeper p_77032_1_, int p_77032_2_, float p_77032_3_) + { + if (p_77032_1_.getPowered()) + { + if (p_77032_1_.isInvisible()) + { + GL11.glDepthMask(false); + } + else + { + GL11.glDepthMask(true); + } + + if (p_77032_2_ == 1) + { + float f1 = p_77032_1_.ticksExisted + p_77032_3_; + this.bindTexture(armoredCreeperTextures); + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glLoadIdentity(); + float f2 = f1 * 0.01F; + float f3 = f1 * 0.01F; + GL11.glTranslatef(f2, f3, 0.0F); + this.setRenderPassModel(this.creeperModel); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glEnable(GL11.GL_BLEND); + float f4 = 0.5F; + GL11.glColor4f(f4, f4, f4, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + return 1; + } + + if (p_77032_2_ == 2) + { + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glLoadIdentity(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + } + } + + return -1; + } + + protected int inheritRenderPass(EntityTaintedCreeper p_77035_1_, int p_77035_2_, float p_77035_3_) + { + return -1; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityTaintedCreeper p_110775_1_) + { + return creeperTextures; + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + @Override + protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_) + { + this.preRenderCallback((EntityTaintedCreeper)p_77041_1_, p_77041_2_); + } + + /** + * Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime + */ + @Override + protected int getColorMultiplier(EntityLivingBase p_77030_1_, float p_77030_2_, float p_77030_3_) + { + return this.getColorMultiplier((EntityTaintedCreeper)p_77030_1_, p_77030_2_, p_77030_3_); + } + + /** + * Queries whether should render the specified pass or not. + */ + @Override + protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_) + { + return this.shouldRenderPass((EntityTaintedCreeper)p_77032_1_, p_77032_2_, p_77032_3_); + } + + @Override + protected int inheritRenderPass(EntityLivingBase p_77035_1_, int p_77035_2_, float p_77035_3_) + { + return this.inheritRenderPass((EntityTaintedCreeper)p_77035_1_, p_77035_2_, p_77035_3_); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) + { + return this.getEntityTexture((EntityTaintedCreeper)p_110775_1_); + } +}