From 52ee2538d0a22eec03a4a85746667fb3710b66cc Mon Sep 17 00:00:00 2001 From: HbmMods Date: Wed, 4 Apr 2018 22:17:24 +0200 Subject: [PATCH] Meteorite configs, AGP support for diesel gen, selenium functionality --- com/hbm/inventory/gui/GUIMachineDiesel.java | 2 +- com/hbm/main/MainRegistry.java | 3 + com/hbm/packet/AuxGaugePacket.java | 11 +- .../machine/TileEntityMachineDiesel.java | 2 + .../TileEntityMachineSeleniumEngine.java | 19 +- com/hbm/world/Meteorite.java | 231 +++++++++--------- 6 files changed, 141 insertions(+), 127 deletions(-) diff --git a/com/hbm/inventory/gui/GUIMachineDiesel.java b/com/hbm/inventory/gui/GUIMachineDiesel.java index aea20724e..77367056a 100644 --- a/com/hbm/inventory/gui/GUIMachineDiesel.java +++ b/com/hbm/inventory/gui/GUIMachineDiesel.java @@ -31,7 +31,7 @@ public class GUIMachineDiesel extends GuiInfoContainer { super.drawScreen(mouseX, mouseY, f); diFurnace.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 69 - 52, 16, 52); - this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 69 - 52, 16, 52, diFurnace.power, diFurnace.maxPower); + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 69 - 52, 16, 52, diFurnace.power, diFurnace.powerCap); String[] text = new String[] { "Accepted Fuels:", " Diesel (500 HE/t)", diff --git a/com/hbm/main/MainRegistry.java b/com/hbm/main/MainRegistry.java index 2d92a9217..0aef077a2 100644 --- a/com/hbm/main/MainRegistry.java +++ b/com/hbm/main/MainRegistry.java @@ -395,6 +395,8 @@ public class MainRegistry public static boolean enableMeteorStrikes = true; public static boolean enableMeteorShowers = true; public static boolean enableMeteorTails = true; + public static boolean enableSpecialMeteors = true; + public static int uraniumSpawn = 7; public static int titaniumSpawn = 8; public static int sulfurSpawn = 5; @@ -1248,6 +1250,7 @@ public class MainRegistry enableMeteorStrikes = config.get(Configuration.CATEGORY_GENERAL, "1.09_enableMeteorStrikes", true).getBoolean(true); enableMeteorShowers = config.get(Configuration.CATEGORY_GENERAL, "1.10_enableMeteorShowers", true).getBoolean(true); enableMeteorTails = config.get(Configuration.CATEGORY_GENERAL, "1.11_enableMeteorTails", true).getBoolean(true); + enableSpecialMeteors = config.get(Configuration.CATEGORY_GENERAL, "1.12_enableSpecialMeteors", true).getBoolean(true); Property PuraniumSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.00_uraniumSpawnrate", 7); PuraniumSpawn.comment = "Ammount of uranium ore veins per chunk"; diff --git a/com/hbm/packet/AuxGaugePacket.java b/com/hbm/packet/AuxGaugePacket.java index 01adf4b92..8778c7652 100644 --- a/com/hbm/packet/AuxGaugePacket.java +++ b/com/hbm/packet/AuxGaugePacket.java @@ -7,6 +7,7 @@ import com.hbm.tileentity.bomb.TileEntityTurretCheapo; import com.hbm.tileentity.machine.TileEntityAMSBase; import com.hbm.tileentity.machine.TileEntityAMSEmitter; import com.hbm.tileentity.machine.TileEntityAMSLimiter; +import com.hbm.tileentity.machine.TileEntityMachineDiesel; import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine; import cpw.mods.fml.common.network.simpleimpl.IMessage; @@ -104,8 +105,16 @@ public class AuxGaugePacket implements IMessage { } if (te instanceof TileEntityMachineSeleniumEngine) { TileEntityMachineSeleniumEngine selenium = (TileEntityMachineSeleniumEngine)te; + + if(m.id == 0) + selenium.pistonCount = m.value; + if(m.id == 1) + selenium.powerCap = m.value; + } + if (te instanceof TileEntityMachineDiesel) { + TileEntityMachineDiesel selenium = (TileEntityMachineDiesel)te; - selenium.pistonCount = m.value; + selenium.powerCap = m.value; } } catch (Exception x) { } diff --git a/com/hbm/tileentity/machine/TileEntityMachineDiesel.java b/com/hbm/tileentity/machine/TileEntityMachineDiesel.java index 7cf1fb4a7..a8d7db37a 100644 --- a/com/hbm/tileentity/machine/TileEntityMachineDiesel.java +++ b/com/hbm/tileentity/machine/TileEntityMachineDiesel.java @@ -14,6 +14,7 @@ import com.hbm.items.ModItems; import com.hbm.items.special.ItemBattery; import com.hbm.lib.Library; import com.hbm.packet.AuxElectricityPacket; +import com.hbm.packet.AuxGaugePacket; import com.hbm.packet.PacketDispatcher; import net.minecraft.entity.player.EntityPlayer; @@ -238,6 +239,7 @@ public class TileEntityMachineDiesel extends TileEntity implements ISidedInvento generate(); PacketDispatcher.wrapper.sendToAll(new AuxElectricityPacket(xCoord, yCoord, zCoord, power)); + PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, (int)powerCap, 0)); } } diff --git a/com/hbm/tileentity/machine/TileEntityMachineSeleniumEngine.java b/com/hbm/tileentity/machine/TileEntityMachineSeleniumEngine.java index f43ffaf2d..7ecb3d290 100644 --- a/com/hbm/tileentity/machine/TileEntityMachineSeleniumEngine.java +++ b/com/hbm/tileentity/machine/TileEntityMachineSeleniumEngine.java @@ -31,8 +31,8 @@ public class TileEntityMachineSeleniumEngine extends TileEntity implements ISide public long power; public int soundCycle = 0; - public static final long maxPower = 100000; - public long powerCap = 100000; + public static final long maxPower = 250000; + public long powerCap = 250000; public int age = 0; public List list = new ArrayList(); public FluidTank tank; @@ -230,10 +230,12 @@ public class TileEntityMachineSeleniumEngine extends TileEntity implements ISide // Battery Item power = Library.chargeItemsFromTE(slots, 13, power, powerCap); - generate(); + if(this.pistonCount > 2) + generate(); PacketDispatcher.wrapper.sendToAll(new AuxElectricityPacket(xCoord, yCoord, zCoord, power)); PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, pistonCount, 0)); + PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, (int)powerCap, 1)); } } @@ -286,18 +288,15 @@ public class TileEntityMachineSeleniumEngine extends TileEntity implements ISide if (soundCycle >= 3) soundCycle = 0; - //if (this.superTimer > 0) - // soundCycle = 0; - tank.setFill(tank.getFill() - 10); + tank.setFill(tank.getFill() - this.pistonCount * 10); if (tank.getFill() < 0) tank.setFill(0); - if (power + getHEFromFuel() <= powerCap) { - power += getHEFromFuel(); - } else { + power += getHEFromFuel() * Math.pow(this.pistonCount, 1.15D); + + if(power > powerCap) power = powerCap; - } } } } diff --git a/com/hbm/world/Meteorite.java b/com/hbm/world/Meteorite.java index 4a281f06f..b59a277ab 100644 --- a/com/hbm/world/Meteorite.java +++ b/com/hbm/world/Meteorite.java @@ -34,121 +34,122 @@ public class Meteorite { e.attackEntityFrom(ModDamageSource.meteorite, 1000); } - switch(rand.nextInt(300)) { - case 0: - //Meteor-only tiny meteorite - List list0 = new ArrayList(); - list0.add(new ItemStack(ModBlocks.block_meteor)); - generateBox(world, rand, x, y, z, list0); - return; - case 1: - //Large ore-only meteorite - List list1 = new ArrayList(); - list1.addAll(this.getRandomOre(rand)); - int i = list1.size(); - for(int j = 0; j < i; j++) - list1.add(new ItemStack(Blocks.stone)); - generateSphere7x7(world, rand, x, y, z, list1); - return; - case 2: - //Medium ore-only meteorite - List list2 = new ArrayList(); - list2.addAll(this.getRandomOre(rand)); - int k = list2.size() / 2; - for(int j = 0; j < k; j++) - list2.add(new ItemStack(Blocks.stone)); - generateSphere5x5(world, rand, x, y, z, list2); - return; - case 3: - //Small pure ore meteorite - List list3 = new ArrayList(); - list3.addAll(this.getRandomOre(rand)); - generateBox(world, rand, x, y, z, list3); - return; - case 4: - //Bamboozle - world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 15F, true); - ExplosionLarge.spawnRubble(world, x, y, z, 25); - return; - case 5: - //Large treasure-only meteorite - List list4 = new ArrayList(); - list4.add(new ItemStack(ModBlocks.block_meteor_treasure)); - list4.add(new ItemStack(ModBlocks.block_meteor_broken)); - generateSphere7x7(world, rand, x, y, z, list4); - return; - case 6: - //Medium treasure-only meteorite - List list5 = new ArrayList(); - list5.add(new ItemStack(ModBlocks.block_meteor_treasure)); - list5.add(new ItemStack(ModBlocks.block_meteor_treasure)); - list5.add(new ItemStack(ModBlocks.block_meteor_broken)); - generateSphere5x5(world, rand, x, y, z, list5); - return; - case 7: - //Small pure treasure meteorite - List list6 = new ArrayList(); - list6.add(new ItemStack(ModBlocks.block_meteor_treasure)); - generateBox(world, rand, x, y, z, list6); - return; - case 8: - //Large nuclear meteorite - List list7 = new ArrayList(); - list7.add(new ItemStack(ModBlocks.block_meteor_treasure)); - List list8 = new ArrayList(); - list8.add(new ItemStack(ModBlocks.toxic_block)); - generateSphere7x7(world, rand, x, y, z, list7); - generateSphere5x5(world, rand, x, y, z, list8); - return; - case 9: - //Giant ore meteorite - List list9 = new ArrayList(); - list9.add(new ItemStack(ModBlocks.block_meteor_broken)); - generateSphere9x9(world, rand, x, y, z, list9); - generateSphere7x7(world, rand, x, y, z, this.getRandomOre(rand)); - return; - case 10: - //Tainted Meteorite - List list10 = new ArrayList(); - list10.add(new ItemStack(ModBlocks.block_meteor_broken)); - generateSphere5x5(world, rand, x, y, z, list10); - world.setBlock(x, y, z, ModBlocks.taint); - return; - case 11: - //Atomic meteorite - EntityNukeExplosionMK3 entity0 = new EntityNukeExplosionMK3(world); - entity0.posX = x + 0.5D; - entity0.posY = y + 0.5D; - entity0.posZ = z + 0.5D; - entity0.destructionRange = MainRegistry.fatmanRadius; - entity0.speed = MainRegistry.blastSpeed; - entity0.coefficient = 10.0F; - - world.spawnEntityInWorld(entity0); - if(MainRegistry.polaroidID == 11) - if(rand.nextInt(100) >= 0) - { - ExplosionParticleB.spawnMush(world, x, y - 3, z); - } else { - ExplosionParticle.spawnMush(world, x, y - 3, z); - } - else - if(rand.nextInt(100) == 0) - { - ExplosionParticleB.spawnMush(world, x, y - 3, z); - } else { - ExplosionParticle.spawnMush(world, x, y - 3, z); - } - return; - case 12: - //Star Blaster - world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 10F, true); - ItemStack stack = new ItemStack(ModItems.gun_b92); - stack.setStackDisplayName("§9Star Blaster§r"); - EntityItem blaster = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack); - world.spawnEntityInWorld(blaster); - return; - } + if(MainRegistry.enableSpecialMeteors) + switch(rand.nextInt(300)) { + case 0: + //Meteor-only tiny meteorite + List list0 = new ArrayList(); + list0.add(new ItemStack(ModBlocks.block_meteor)); + generateBox(world, rand, x, y, z, list0); + return; + case 1: + //Large ore-only meteorite + List list1 = new ArrayList(); + list1.addAll(this.getRandomOre(rand)); + int i = list1.size(); + for(int j = 0; j < i; j++) + list1.add(new ItemStack(Blocks.stone)); + generateSphere7x7(world, rand, x, y, z, list1); + return; + case 2: + //Medium ore-only meteorite + List list2 = new ArrayList(); + list2.addAll(this.getRandomOre(rand)); + int k = list2.size() / 2; + for(int j = 0; j < k; j++) + list2.add(new ItemStack(Blocks.stone)); + generateSphere5x5(world, rand, x, y, z, list2); + return; + case 3: + //Small pure ore meteorite + List list3 = new ArrayList(); + list3.addAll(this.getRandomOre(rand)); + generateBox(world, rand, x, y, z, list3); + return; + case 4: + //Bamboozle + world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 15F, true); + ExplosionLarge.spawnRubble(world, x, y, z, 25); + return; + case 5: + //Large treasure-only meteorite + List list4 = new ArrayList(); + list4.add(new ItemStack(ModBlocks.block_meteor_treasure)); + list4.add(new ItemStack(ModBlocks.block_meteor_broken)); + generateSphere7x7(world, rand, x, y, z, list4); + return; + case 6: + //Medium treasure-only meteorite + List list5 = new ArrayList(); + list5.add(new ItemStack(ModBlocks.block_meteor_treasure)); + list5.add(new ItemStack(ModBlocks.block_meteor_treasure)); + list5.add(new ItemStack(ModBlocks.block_meteor_broken)); + generateSphere5x5(world, rand, x, y, z, list5); + return; + case 7: + //Small pure treasure meteorite + List list6 = new ArrayList(); + list6.add(new ItemStack(ModBlocks.block_meteor_treasure)); + generateBox(world, rand, x, y, z, list6); + return; + case 8: + //Large nuclear meteorite + List list7 = new ArrayList(); + list7.add(new ItemStack(ModBlocks.block_meteor_treasure)); + List list8 = new ArrayList(); + list8.add(new ItemStack(ModBlocks.toxic_block)); + generateSphere7x7(world, rand, x, y, z, list7); + generateSphere5x5(world, rand, x, y, z, list8); + return; + case 9: + //Giant ore meteorite + List list9 = new ArrayList(); + list9.add(new ItemStack(ModBlocks.block_meteor_broken)); + generateSphere9x9(world, rand, x, y, z, list9); + generateSphere7x7(world, rand, x, y, z, this.getRandomOre(rand)); + return; + case 10: + //Tainted Meteorite + List list10 = new ArrayList(); + list10.add(new ItemStack(ModBlocks.block_meteor_broken)); + generateSphere5x5(world, rand, x, y, z, list10); + world.setBlock(x, y, z, ModBlocks.taint); + return; + case 11: + //Atomic meteorite + EntityNukeExplosionMK3 entity0 = new EntityNukeExplosionMK3(world); + entity0.posX = x + 0.5D; + entity0.posY = y + 0.5D; + entity0.posZ = z + 0.5D; + entity0.destructionRange = MainRegistry.fatmanRadius; + entity0.speed = MainRegistry.blastSpeed; + entity0.coefficient = 10.0F; + + world.spawnEntityInWorld(entity0); + if(MainRegistry.polaroidID == 11) + if(rand.nextInt(100) >= 0) + { + ExplosionParticleB.spawnMush(world, x, y - 3, z); + } else { + ExplosionParticle.spawnMush(world, x, y - 3, z); + } + else + if(rand.nextInt(100) == 0) + { + ExplosionParticleB.spawnMush(world, x, y - 3, z); + } else { + ExplosionParticle.spawnMush(world, x, y - 3, z); + } + return; + case 12: + //Star Blaster + world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 10F, true); + ItemStack stack = new ItemStack(ModItems.gun_b92); + stack.setStackDisplayName("§9Star Blaster§r"); + EntityItem blaster = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack); + world.spawnEntityInWorld(blaster); + return; + } switch(rand.nextInt(3)) { case 0: