From 0a6eb23fb8c5cdbe1f47ed4f143ab69ad3f6850d Mon Sep 17 00:00:00 2001 From: HbmMods Date: Fri, 24 Aug 2018 21:46:20 +0200 Subject: [PATCH] made bombers use nbt, designators in chest loot, fizz sounds --- com/hbm/entity/logic/EntityBomber.java | 30 +++++++++++++++++-- .../entity/projectile/EntityBombletZeta.java | 1 + com/hbm/lib/HbmChestContents.java | 21 ++++++++++--- com/hbm/lib/HbmWorldGen.java | 12 ++++---- com/hbm/lib/RefStrings.java | 2 +- 5 files changed, 53 insertions(+), 13 deletions(-) diff --git a/com/hbm/entity/logic/EntityBomber.java b/com/hbm/entity/logic/EntityBomber.java index b58bfe4fe..50757df26 100644 --- a/com/hbm/entity/logic/EntityBomber.java +++ b/com/hbm/entity/logic/EntityBomber.java @@ -254,10 +254,36 @@ public class EntityBomber extends Entity { } @Override - protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { } + protected void readEntityFromNBT(NBTTagCompound nbt) { + ticksExisted = nbt.getInteger("ticksExisted"); + bombStart = nbt.getInteger("bombStart"); + bombStop = nbt.getInteger("bombStop"); + bombRate = nbt.getInteger("bombRate"); + type = nbt.getInteger("type"); + + int i = 1; + + int rand = this.rand.nextInt(101); + + if(rand < 50) + i = 1; + else if(rand > 50) + i = 2; + else + i = 0; + + this.getDataWatcher().updateObject(16, (byte)i); + this.setSize(8.0F, 4.0F); + } @Override - protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { } + protected void writeEntityToNBT(NBTTagCompound nbt) { + nbt.setInteger("ticksExisted", ticksExisted); + nbt.setInteger("bombStart", bombStart); + nbt.setInteger("bombStop", bombStop); + nbt.setInteger("bombRate", bombRate); + nbt.setInteger("type", type); + } protected void rotation() { float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); diff --git a/com/hbm/entity/projectile/EntityBombletZeta.java b/com/hbm/entity/projectile/EntityBombletZeta.java index bd63db30e..c17a6f997 100644 --- a/com/hbm/entity/projectile/EntityBombletZeta.java +++ b/com/hbm/entity/projectile/EntityBombletZeta.java @@ -55,6 +55,7 @@ public class EntityBombletZeta extends EntityThrowable { ExplosionChaos.burn(worldObj, (int)posX, (int)posY, (int)posZ, 7); } if(type == 2) { + worldObj.playSoundEffect((double)(posX + 0.5F), (double)(posY + 0.5F), (double)(posZ + 0.5F), "random.fizz", 5.0F, 2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F); ExplosionChaos.spawnChlorine(worldObj, this.posX + 0.5F - motionX, this.posY + 0.5F - motionY, this.posZ + 0.5F - motionZ, 75, 2, 0); } if(type == 4) { diff --git a/com/hbm/lib/HbmChestContents.java b/com/hbm/lib/HbmChestContents.java index d413485a3..9cf1dba51 100644 --- a/com/hbm/lib/HbmChestContents.java +++ b/com/hbm/lib/HbmChestContents.java @@ -60,7 +60,8 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.bottle_nuka, 0, 1, 3, 4), new WeightedRandomChestContent(ModItems.bottle_cherry, 0, 1, 1, 2), new WeightedRandomChestContent(ModItems.stealth_boy, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.cap_nuka, 0, 1, 15, 7) }; + new WeightedRandomChestContent(ModItems.cap_nuka, 0, 1, 15, 7), + new WeightedRandomChestContent(ModItems.bomb_caller, 0, 1, 2, 1) }; private static WeightedRandomChestContent[] expensive = new WeightedRandomChestContent[] { new WeightedRandomChestContent(ModItems.nugget_schrabidium, 0, 1, 1, 1), @@ -90,7 +91,12 @@ public class HbmChestContents { new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.red_barrel), 0, 1, 1, 6), new WeightedRandomChestContent(ModItems.canister_fuel, 0, 1, 2, 2), new WeightedRandomChestContent(ModItems.canister_biofuel, 0, 1, 2, 3), - new WeightedRandomChestContent(ModItems.gas_mask_m65, 60, 1, 1, 5) }; + new WeightedRandomChestContent(ModItems.gas_mask_m65, 60, 1, 1, 5), + new WeightedRandomChestContent(ModItems.bomb_caller, 0, 1, 2, 3), + new WeightedRandomChestContent(ModItems.bomb_caller, 1, 1, 2, 2), + new WeightedRandomChestContent(ModItems.bomb_caller, 2, 1, 2, 2), + new WeightedRandomChestContent(ModItems.bomb_caller, 3, 1, 2, 3), + new WeightedRandomChestContent(ModItems.bomb_caller, 4, 1, 2, 1) }; private static WeightedRandomChestContent[] nukeTrash = new WeightedRandomChestContent[] { new WeightedRandomChestContent(ModItems.nugget_u238, 0, 3, 12, 5), @@ -156,7 +162,11 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.stealth_boy, 0, 1, 1, 7), new WeightedRandomChestContent(ModItems.crate_caller, 0, 1, 1, 3), new WeightedRandomChestContent(ModItems.gas_mask_m65, 0, 1, 1, 5), - new WeightedRandomChestContent(ModItems.grenade_nuclear, 0, 1, 2, 2) }; + new WeightedRandomChestContent(ModItems.grenade_nuclear, 0, 1, 2, 2), + new WeightedRandomChestContent(ModItems.bomb_caller, 0, 1, 2, 3), + new WeightedRandomChestContent(ModItems.bomb_caller, 1, 1, 2, 3), + new WeightedRandomChestContent(ModItems.bomb_caller, 2, 1, 2, 2), + new WeightedRandomChestContent(ModItems.bomb_caller, 4, 1, 2, 1) }; private static WeightedRandomChestContent[] missile = new WeightedRandomChestContent[] { new WeightedRandomChestContent(ModItems.missile_generic, 0, 1, 1, 4), @@ -177,7 +187,10 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.fuel_tank_medium, 0, 1, 1, 5), new WeightedRandomChestContent(ModItems.fuel_tank_small, 0, 1, 1, 5), new WeightedRandomChestContent(ModItems.warhead_mirvlet, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.warhead_nuclear, 0, 1, 1, 1) }; + new WeightedRandomChestContent(ModItems.warhead_nuclear, 0, 1, 1, 1), + new WeightedRandomChestContent(ModItems.bomb_caller, 0, 1, 2, 1), + new WeightedRandomChestContent(ModItems.bomb_caller, 1, 1, 2, 1), + new WeightedRandomChestContent(ModItems.bomb_caller, 2, 1, 2, 1) }; private static WeightedRandomChestContent[] spaceship = new WeightedRandomChestContent[] { new WeightedRandomChestContent(ModItems.battery_advanced, 0, 1, 1, 5), diff --git a/com/hbm/lib/HbmWorldGen.java b/com/hbm/lib/HbmWorldGen.java index 33fa66a07..0e9d4ce7f 100644 --- a/com/hbm/lib/HbmWorldGen.java +++ b/com/hbm/lib/HbmWorldGen.java @@ -349,11 +349,11 @@ public class HbmWorldGen implements IWorldGenerator { int z = j + rand.nextInt(16); int y = world.getHeightValue(x, z); - if(world.getBlock(x, y - 1, z).canPlaceTorchOnTop(world, x, y - 1, z)) - world.setBlock(x, y, z, ModBlocks.broadcaster_pc, rand.nextInt(4) + 2, 2); + if(world.getBlock(x, y, z).canPlaceTorchOnTop(world, x, y, z)) + world.setBlock(x, y + 1, z, ModBlocks.broadcaster_pc, rand.nextInt(4) + 2, 2); if(MainRegistry.enableDebugMode) - MainRegistry.logger.info("[Debug] Successfully spawned corrupted broadcaster at " + x + " " + y +" " + z); + MainRegistry.logger.info("[Debug] Successfully spawned corrupted broadcaster at " + x + " " + (y + 1) +" " + z); } if (MainRegistry.enableMines && rand.nextInt(MainRegistry.minefreq) == 0) { @@ -361,11 +361,11 @@ public class HbmWorldGen implements IWorldGenerator { int z = j + rand.nextInt(16); int y = world.getHeightValue(x, z); - if(world.getBlock(x, y - 1, z).canPlaceTorchOnTop(world, x, y - 1, z)) - world.setBlock(x, y, z, ModBlocks.mine_ap); + if(world.getBlock(x, y, z).canPlaceTorchOnTop(world, x, y, z)) + world.setBlock(x, y + 1, z, ModBlocks.mine_ap); if(MainRegistry.enableDebugMode) - MainRegistry.logger.info("[Debug] Successfully spawned landmine at " + x + " " + y +" " + z); + MainRegistry.logger.info("[Debug] Successfully spawned landmine at " + x + " " + (y + 1) +" " + z); } } diff --git a/com/hbm/lib/RefStrings.java b/com/hbm/lib/RefStrings.java index f141d51f7..d5e322f35 100644 --- a/com/hbm/lib/RefStrings.java +++ b/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (2870)"; + public static final String VERSION = "1.0.27 BETA (2875)"; //HBM's Beta Naming Convention: //V T (X-Y-Z) //V -> next release version