Skip to content

Commit

Permalink
made bombers use nbt, designators in chest loot, fizz sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
HbmMods committed Aug 24, 2018
1 parent 510994b commit 0a6eb23
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 13 deletions.
30 changes: 28 additions & 2 deletions com/hbm/entity/logic/EntityBomber.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,36 @@ public void entityInit() {
}

@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);
Expand Down
1 change: 1 addition & 0 deletions com/hbm/entity/projectile/EntityBombletZeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void onUpdate() {
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) {
Expand Down
21 changes: 17 additions & 4 deletions com/hbm/lib/HbmChestContents.java
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand Down
12 changes: 6 additions & 6 deletions com/hbm/lib/HbmWorldGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -349,23 +349,23 @@ private void generateSurface(World world, Random rand, int i, int j) {
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) {
int x = i + rand.nextInt(16);
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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion com/hbm/lib/RefStrings.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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
Expand Down

0 comments on commit 0a6eb23

Please sign in to comment.