diff --git a/src/main/java/com/hbm/blocks/machine/MachinePWRController.java b/src/main/java/com/hbm/blocks/machine/MachinePWRController.java index f5c2b0ef9..045822100 100644 --- a/src/main/java/com/hbm/blocks/machine/MachinePWRController.java +++ b/src/main/java/com/hbm/blocks/machine/MachinePWRController.java @@ -90,12 +90,14 @@ public class MachinePWRController extends BlockContainer { private static HashMap assembly = new HashMap(); private static HashMap fuelRods = new HashMap(); + private static HashMap sources = new HashMap(); private static boolean errored; private static final int maxSize = 1024; public void assemble(World world, int x, int y, int z, EntityPlayer player) { assembly.clear(); fuelRods.clear(); + sources.clear(); assembly.put(new BlockPos(x, y, z), this); ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)).getOpposite(); @@ -103,7 +105,7 @@ public class MachinePWRController extends BlockContainer { errored = false; floodFill(world, x + dir.offsetX, y, z + dir.offsetZ, player); - if(fuelRods.size() == 0) errored = true; + if(fuelRods.size() == 0 || sources.size() == 0) errored = true; TileEntityPWRController controller = (TileEntityPWRController) world.getTileEntity(x, y, z); @@ -136,6 +138,7 @@ public class MachinePWRController extends BlockContainer { assembly.clear(); fuelRods.clear(); + sources.clear(); } private void floodFill(World world, int x, int y, int z, EntityPlayer player) { @@ -159,6 +162,7 @@ public class MachinePWRController extends BlockContainer { if(isValidCore(block)) { assembly.put(pos, block); if(block == ModBlocks.pwr_fuel) fuelRods.put(pos, block); + if(block == ModBlocks.pwr_neutron_source) sources.put(pos, block); floodFill(world, x + 1, y, z, player); floodFill(world, x - 1, y, z, player); floodFill(world, x, y + 1, z, player); diff --git a/src/main/java/com/hbm/crafting/WeaponRecipes.java b/src/main/java/com/hbm/crafting/WeaponRecipes.java index f8f149b7f..b9bb2aba5 100644 --- a/src/main/java/com/hbm/crafting/WeaponRecipes.java +++ b/src/main/java/com/hbm/crafting/WeaponRecipes.java @@ -168,65 +168,65 @@ public class WeaponRecipes { //Ammo assemblies CraftingManager.addRecipeAuto(new ItemStack(ModItems.pellet_flechette, 1), new Object[] { " L ", " L ", "LLL", 'L', PB.nugget() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.pellet_claws, 1), new Object[] { " X ", "X X", " XX", 'X', STEEL.plate() }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_iron, 24), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_iron, 24), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_steel, 24), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_steel, 24), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", " P", 'I', U235.ingot(), 'G', ModItems.cordite, 'C', KEY_CLEARGLASS, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", " P", 'I', PU239.ingot(), 'G', ModItems.cordite, 'C', KEY_CLEARGLASS, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", " P", 'I', ModItems.trinitite, 'G', ModItems.cordite, 'C', KEY_CLEARGLASS, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", " P", 'I', ModItems.nuclear_waste_tiny, 'G', ModItems.cordite, 'C', KEY_CLEARGLASS, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_gold, 24), new Object[] { " I", "GC", " P", 'I', GOLD.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_schrabidium, 6), new Object[] { " I ", "GCN", " P ", 'I', SA326.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357, 'N', ModItems.billet_yharonite }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nightmare, 24), new Object[] { " I", "GC", " P", 'I', W.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_desh, 24), new Object[] { " I", "GC", " P", 'I', DESH.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'P', ModItems.primer_357 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_smg, 32), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_smg, 32), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_556, 32), new Object[] { " I", "GC", " P", 'I', STEEL.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(ModItems.ammo_556.stackFromEnum(30, Ammo556mm.K), new Object[] { "G", "C", "P", 'G', ANY_GUNPOWDER.dust(), 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", " P", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lacunae, 32), new Object[] { " I", "GC", " P", 'I', CU.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9, 'P', ModItems.primer_9 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nopip, 24), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_44, 'P', ModItems.primer_44 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nopip, 24), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_44, 'P', ModItems.primer_44 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_12gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.cordite, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_12gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_12gauge.stackFromEnum(12, Ammo12Gauge.PERCUSSION), new Object[] { "G", "C", "P", 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_4gauge, 12), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.SLUG), new Object[] { " I ", "GCL", " P ", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.FLECHETTE), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_flechette, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", " P ", 'I', ModBlocks.tnt, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(6, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", " P ", 'I', ANY_PLASTICEXPLOSIVE.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.MINING), new Object[] { " I ", "GCL", " P ", 'I', ModBlocks.det_miner, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_iron, 24), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_iron, 24), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_steel, 24), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_steel, 24), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", 'I', U235.ingot(), 'G', ModItems.cordite, 'C', KEY_CLEARGLASS }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", 'I', PU239.ingot(), 'G', ModItems.cordite, 'C', KEY_CLEARGLASS }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", 'I', ModItems.trinitite, 'G', ModItems.cordite, 'C', KEY_CLEARGLASS }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lead, 24), new Object[] { " I", "GC", 'I', ModItems.nuclear_waste_tiny, 'G', ModItems.cordite, 'C', KEY_CLEARGLASS }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_gold, 24), new Object[] { " I", "GC", 'I', GOLD.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_schrabidium, 6), new Object[] { " I ", "GCN", 'I', SA326.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357, 'N', ModItems.billet_yharonite }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nightmare, 24), new Object[] { " I", "GC", 'I', W.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_desh, 24), new Object[] { " I", "GC", 'I', DESH.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_357 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_smg, 32), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_smg, 32), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_556, 32), new Object[] { " I", "GC", 'I', STEEL.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(ModItems.ammo_556.stackFromEnum(30, Ammo556mm.K), new Object[] { "G", "C", 'G', ANY_GUNPOWDER.dust(), 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_uzi, 32), new Object[] { " I", "GC", 'I', IRON.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_lacunae, 32), new Object[] { " I", "GC", 'I', CU.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_9 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nopip, 24), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_44 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nopip, 24), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.ballistite, 'C', ModItems.casing_44 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_12gauge, 12), new Object[] { " I ", "GCL", 'I', ModItems.pellet_buckshot, 'G', ModItems.cordite, 'C', ModItems.casing_buckshot, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_12gauge, 12), new Object[] { " I ", "GCL", 'I', ModItems.pellet_buckshot, 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_12gauge.stackFromEnum(12, Ammo12Gauge.PERCUSSION), new Object[] { "G", "C", 'G', ModItems.ballistite, 'C', ModItems.casing_buckshot }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_4gauge, 12), new Object[] { " I ", "GCL", 'I', ModItems.pellet_buckshot, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.SLUG), new Object[] { " I ", "GCL", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(12, Ammo4Gauge.FLECHETTE), new Object[] { " I ", "GCL", 'I', ModItems.pellet_flechette, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", 'I', ModBlocks.tnt, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(6, Ammo4Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", 'I', ANY_PLASTICEXPLOSIVE.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); + CraftingManager.addRecipeAuto(ModItems.ammo_4gauge.stackFromEnum(4, Ammo4Gauge.MINING), new Object[] { " I ", "GCL", 'I', ModBlocks.det_miner, 'G', ModItems.cordite, 'C', ModItems.casing_50, 'L', ModItems.plate_polymer }); CraftingManager.addShapelessAuto(ModItems.ammo_4gauge.stackFromEnum(Ammo4Gauge.QUACK), new Object[] { ModItems.ammo_4gauge, ModItems.nugget_bismuth, ModItems.nugget_tantalium, ModItems.ball_dynamite }); - CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.STOCK), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_buckshot, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', CU.plate() }); - CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.SLUG), new Object[] { " I ", "GCL", " P ", 'I', PB.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', CU.plate() }); - CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_cluster, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', CU.plate() }); - CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(20, Ammo20Gauge.FLECHETTE), new Object[] { " I ", "GCL", " P ", 'I', ModItems.pellet_flechette, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot, 'L', CU.plate() }); - CraftingManager.addRecipeAuto(ModItems.ammo_357.stackFromEnum(6, Ammo357Magnum.NIGHTMARE2), new Object[] { "I", "C", "P", 'I', ModItems.powder_power, 'C', ModItems.casing_buckshot, 'P', ModItems.primer_buckshot }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_calamity, 12), new Object[] { " I ", "GCG", " P ", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50 }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_actionexpress, 12), new Object[] { " I", "GC", " P", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50, 'P', ModItems.primer_50 }); + CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.STOCK), new Object[] { " I ", "GCL", 'I', ModItems.pellet_buckshot, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'L', CU.plate() }); + CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.SLUG), new Object[] { " I ", "GCL", 'I', PB.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'L', CU.plate() }); + CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(12, Ammo20Gauge.EXPLOSIVE), new Object[] { " I ", "GCL", 'I', ModItems.pellet_cluster, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'L', CU.plate() }); + CraftingManager.addRecipeAuto(ModItems.ammo_20gauge.stackFromEnum(20, Ammo20Gauge.FLECHETTE), new Object[] { " I ", "GCL", 'I', ModItems.pellet_flechette, 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_buckshot, 'L', CU.plate() }); + CraftingManager.addRecipeAuto(ModItems.ammo_357.stackFromEnum(6, Ammo357Magnum.NIGHTMARE2), new Object[] { "I", "C", 'I', ModItems.powder_power, 'C', ModItems.casing_buckshot }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_calamity, 12), new Object[] { " I ", "GCG", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_actionexpress, 12), new Object[] { " I", "GC", 'I', PB.ingot(), 'G', ModItems.cordite, 'C', ModItems.casing_50 }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_nuke, 1), new Object[] { " WP", "SEP", " WP", 'W', ModItems.wire_aluminium, 'P', STEEL.plate(), 'S', ModItems.hull_small_steel, 'E', ANY_HIGHEXPLOSIVE.ingot() }); CraftingManager.addRecipeAuto(ModItems.ammo_dart.stackFromEnum(16, AmmoDart.GPS), new Object[] { "IPI", "ICI", "IPI", 'I', ModItems.plate_polymer, 'P', IRON.plate(), 'C', new ItemStack(ModItems.fluid_tank_lead_full, 1, Fluids.WATZ.getID()) }); CraftingManager.addRecipeAuto(ModItems.ammo_dart.stackFromEnum(16, AmmoDart.NERF), new Object[] { "I", "I", 'I', ModItems.plate_polymer }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_45, 32), " I", "GC", " P", 'I', CU.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_44, 'P', ModItems.primer_44); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_762, 32), " I", "GC", " P", 'I', CU.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_9); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_45, 32), " I", "GC", 'I', CU.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_44); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_762, 32), " I", "GC", 'I', CU.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50); CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_luna, 4), new Object[] { " B ", "GCG", "GPG", 'B', FERRO.ingot(), 'G', ModItems.powder_nitan_mix, 'C', ModItems.casing_50, 'P', ModItems.powder_power}); //Folly shells CraftingManager.addRecipeAuto(new ItemStack(ModItems.folly_bullet, 1), new Object[] { " S ", "STS", "SMS", 'S', STAR.ingot(), 'T', ModItems.powder_magic, 'M', ModBlocks.block_meteor }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.folly_bullet_nuclear, 1), new Object[] { " N ", "UTU", "UTU", 'N', ModItems.ammo_nuke, 'U', IRON.ingot(), 'T', W.block() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.folly_bullet_du, 1), new Object[] { " U ", "UDU", "UTU", 'U', U238.block(), 'D', DESH.block(), 'T', W.block() }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.folly_shell, 1), new Object[] { "IPI", "IPI", "IMI", 'I', IRON.ingot(), 'P', IRON.plate(), 'M', ModItems.primer_50 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.folly_shell, 1), new Object[] { "IPI", "IPI", "IMI", 'I', IRON.ingot(), 'P', IRON.plate(), 'M', ANY_SMOKELESS.dust() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_folly, 1), new Object[] { " B ", "MEM", " S ", 'B', ModItems.folly_bullet, 'M', ModItems.powder_magic, 'E', ModItems.powder_power, 'S', ModItems.folly_shell }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_folly_nuclear, 1), new Object[] { " B ", "EEE", " S ", 'B', ModItems.folly_bullet_nuclear, 'E', ModBlocks.det_charge, 'S', ModItems.folly_shell }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_folly_du, 1), new Object[] { " B ", "EEE", " S ", 'B', ModItems.folly_bullet_du, 'E', ModBlocks.det_charge, 'S', ModItems.folly_shell }); //Rockets - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_rocket, 1), new Object[] { " T ", "GCG", " P ", 'T', ModItems.ball_dynamite, 'G', ModItems.rocket_fuel, 'C', ModItems.hull_small_aluminium, 'P', ModItems.primer_50 });// I got tired of changing *all* of them, the stock one is always the first one anyway - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_rocket, 2), new Object[] { " T ", "GCG", " P ", 'T', ANY_PLASTICEXPLOSIVE.ingot(), 'G', ModItems.rocket_fuel, 'C', ModItems.hull_small_aluminium, 'P', ModItems.primer_50 }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_rocket, 1), new Object[] { "T", "C", "G", 'T', ModItems.ball_dynamite, 'G', ModItems.rocket_fuel, 'C', ModItems.hull_small_aluminium, });// I got tired of changing *all* of them, the stock one is always the first one anyway + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_rocket, 2), new Object[] { "T", "C", "G", 'T', ANY_PLASTICEXPLOSIVE.ingot(), 'G', ModItems.rocket_fuel, 'C', ModItems.hull_small_aluminium }); CraftingManager.addRecipeAuto(ModItems.ammo_rocket.stackFromEnum(AmmoRocket.HE), new Object[] { "G", "R", 'G', ANY_PLASTICEXPLOSIVE.ingot(), 'R', ModItems.ammo_rocket }); CraftingManager.addRecipeAuto(ModItems.ammo_rocket.stackFromEnum(AmmoRocket.INCENDIARY), new Object[] { "G", "R", 'G', P_RED.dust(), 'R', ModItems.ammo_rocket }); CraftingManager.addRecipeAuto(ModItems.ammo_rocket.stackFromEnum(AmmoRocket.PHOSPHORUS), new Object[] { "G", "R", 'G', P_WHITE.ingot(), 'R', ModItems.ammo_rocket }); @@ -245,15 +245,15 @@ public class WeaponRecipes { CraftingManager.addRecipeAuto(ModItems.ammo_rocket.stackFromEnum(2, AmmoRocket.RPC), new Object[] { "BP ", "CBH", " DR", 'B', ModItems.blades_steel, 'P', STEEL.plate(), 'C', Fluids.BIOFUEL.getDict(1000), 'H', ModItems.hull_small_steel, 'D', ModItems.piston_selenium, 'R', ModItems.ammo_rocket }); //Stinger Rockets - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_stinger_rocket, 2), "CE ", "FSF", " P ", 'C', ModItems.circuit_aluminium, 'E', ANY_PLASTICEXPLOSIVE.ingot(), 'F', ModItems.rocket_fuel, 'S', ModItems.hull_small_aluminium, 'P', ModItems.primer_50); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_stinger_rocket, 2), "CE ", " S ", " F ", 'C', ModItems.circuit_aluminium, 'E', ANY_PLASTICEXPLOSIVE.ingot(), 'F', ModItems.rocket_fuel, 'S', ModItems.hull_small_aluminium); CraftingManager.addRecipeAuto(ModItems.ammo_stinger_rocket.stackFromEnum(AmmoStinger.HE), new Object[] { "S", "R", 'S', ANY_PLASTICEXPLOSIVE.ingot(), 'R', ModItems.ammo_stinger_rocket }); CraftingManager.addRecipeAuto(ModItems.ammo_stinger_rocket.stackFromEnum(AmmoStinger.INCENDIARY), new Object[] { "S", "R", 'S', P_RED.dust(), 'R', ModItems.ammo_stinger_rocket }); CraftingManager.addRecipeAuto(ModItems.ammo_stinger_rocket.stackFromEnum(AmmoStinger.NUCLEAR), new Object[] { "RPR", "PSP", "RPR", 'R', ModItems.neutron_reflector, 'P', PU239.nugget(), 'S', ModItems.ammo_stinger_rocket.stackFromEnum(AmmoStinger.HE) }); CraftingManager.addRecipeAuto(ModItems.ammo_stinger_rocket.stackFromEnum(AmmoStinger.BONES), new Object[] { " C ", "SKR", " P ", 'C', ModItems.fallout, 'S', SR90.dust(), 'K', ModItems.ammo_stinger_rocket, 'R', RA226.dust(), 'P', PU.dust() }); //40mm grenades - CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_grenade, 2), new Object[] { " T ", "GCI", " P ", 'T', ANY_HIGHEXPLOSIVE.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'I', IRON.plate() }); - CraftingManager.addRecipeAuto(ModItems.ammo_grenade.stackFromEnum(2, AmmoGrenade.TRACER), new Object[] { " T ", "GCI", " P ", 'T', LAPIS.dust(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_50, 'I', IRON.plate() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_grenade, 2), new Object[] { " T ", "GCI", 'T', ANY_HIGHEXPLOSIVE.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'I', IRON.plate() }); + CraftingManager.addRecipeAuto(ModItems.ammo_grenade.stackFromEnum(2, AmmoGrenade.TRACER), new Object[] { " T ", "GCI", 'T', LAPIS.dust(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'I', IRON.plate() }); CraftingManager.addRecipeAuto(ModItems.ammo_grenade.stackFromEnum(2, AmmoGrenade.HE), new Object[] { "GIG", 'G', ModItems.ammo_grenade, 'I', ANY_PLASTICEXPLOSIVE.ingot() }); CraftingManager.addRecipeAuto(ModItems.ammo_grenade.stackFromEnum(2, AmmoGrenade.INCENDIARY), new Object[] { "GIG", 'G', ModItems.ammo_grenade, 'I', P_RED.dust() }); CraftingManager.addRecipeAuto(ModItems.ammo_grenade.stackFromEnum(2, AmmoGrenade.PHOSPHORUS), new Object[] { "GIG", 'G', ModItems.ammo_grenade, 'I', P_WHITE.ingot() }); diff --git a/src/main/java/com/hbm/handler/pollution/PollutionHandler.java b/src/main/java/com/hbm/handler/pollution/PollutionHandler.java index 0ba128f52..6ddf72eec 100644 --- a/src/main/java/com/hbm/handler/pollution/PollutionHandler.java +++ b/src/main/java/com/hbm/handler/pollution/PollutionHandler.java @@ -153,8 +153,10 @@ public class PollutionHandler { public String getDataDir(WorldServer world) { String dir = world.getSaveHandler().getWorldDirectory().getAbsolutePath(); - if(world.provider.dimensionId != 0) { - dir += File.separator + "DIM" + world.provider.dimensionId; + // Crucible and probably Thermos provide dimId by themselves + String dimId = File.separator + "DIM" + world.provider.dimensionId; + if(world.provider.dimensionId != 0 && !dir.endsWith(dimId)) { + dir += dimId; } dir += File.separator + "data"; return dir; diff --git a/src/main/java/com/hbm/inventory/container/ContainerPWR.java b/src/main/java/com/hbm/inventory/container/ContainerPWR.java index 92b638808..ff6cc84fa 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerPWR.java +++ b/src/main/java/com/hbm/inventory/container/ContainerPWR.java @@ -23,7 +23,7 @@ public class ContainerPWR extends Container { for(int i = 0; i < 3; i++) { for(int j = 0; j < 9; j++) { - this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 108 + i * 18)); + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 106 + i * 18)); } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIPWR.java b/src/main/java/com/hbm/inventory/gui/GUIPWR.java index 5e1e18999..af7130a47 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIPWR.java +++ b/src/main/java/com/hbm/inventory/gui/GUIPWR.java @@ -3,14 +3,19 @@ package com.hbm.inventory.gui; import org.lwjgl.opengl.GL11; import com.hbm.inventory.container.ContainerPWR; +import com.hbm.items.ModItems; import com.hbm.lib.RefStrings; import com.hbm.render.util.GaugeUtil; import com.hbm.render.util.GaugeUtil.Gauge; import com.hbm.tileentity.machine.TileEntityPWRController; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; public class GUIPWR extends GuiInfoContainer { @@ -33,19 +38,43 @@ public class GUIPWR extends GuiInfoContainer { this.drawCustomInfoStat(x, y, guiLeft + 115, guiTop + 31, 18, 18, x, y, new String[] { "Core: " + String.format("%,d", controller.coreHeat) + " / " + String.format("%,d", controller.coreHeatCapacity) + " TU" }); this.drawCustomInfoStat(x, y, guiLeft + 151, guiTop + 31, 18, 18, x, y, new String[] { "Hull: " + String.format("%,d", controller.hullHeat) + " / " + String.format("%,d", controller.hullHeatCapacity) + " TU" }); - int timeLeft = (controller.processTime - controller.progress) / 20; - this.drawCustomInfoStat(x, y, guiLeft + 52, guiTop + 31, 36, 18, x, y, new String[] { "Cycle: " + (timeLeft / 60) + ":" + String.format("%02d", timeLeft % 60)}); + //TODO: calculate some prediction using extrapolation (or some math sector that ends with -ic) + //int timeLeft = (controller.processTime - controller.progress) / 20; + //this.drawCustomInfoStat(x, y, guiLeft + 52, guiTop + 31, 36, 18, x, y, new String[] { "Cycle: " + (timeLeft / 60) + ":" + String.format("%02d", timeLeft % 60)}); + + + if(controller.typeLoaded != -1 && controller.amountLoaded > 0) { + ItemStack display = new ItemStack(ModItems.pwr_fuel, 1, controller.typeLoaded); + if(guiLeft + 88 <= x && guiLeft + 88 + 18 > x && guiTop + 4 < y && guiTop + 4 + 18 >= y) this.renderToolTip(display, x, y); + } controller.tanks[0].renderTankInfo(this, x, y, guiLeft + 8, guiTop + 5, 16, 52); controller.tanks[1].renderTankInfo(this, x, y, guiLeft + 26, guiTop + 5, 16, 52); } + + @Override + protected void drawItemStack(ItemStack stack, int x, int y, String label) { + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + itemRender.zLevel = 200.0F; + FontRenderer font = null; + if(stack != null) font = stack.getItem().getFontRenderer(stack); + if(font == null) font = fontRendererObj; + itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), stack, x, y); + GL11.glScaled(0.5, 0.5, 0.5); + itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), stack, (x + font.getStringWidth(label) / 4) * 2, (y + 15) * 2, label); + this.zLevel = 0.0F; + itemRender.zLevel = 0.0F; + GL11.glPopMatrix(); + } @Override protected void drawGuiContainerForegroundLayer(int i, int j) { this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); double scale = 1.25; - String flux = String.format("%,.1f", 10000.0D); + String flux = String.format("%,.1f", controller.flux); GL11.glScaled(1 / scale, 1 / scale, 1); this.fontRendererObj.drawString(flux, (int) (165 * scale - this.fontRendererObj.getStringWidth(flux)), (int)(64 * scale), 0x00ff00); GL11.glScaled(scale, scale, 1); @@ -60,7 +89,13 @@ public class GUIPWR extends GuiInfoContainer { if(System.currentTimeMillis() % 1000 < 500) drawTexturedModalRect(guiLeft + 147, guiTop, 176, 14, 26, 26); - GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 115, guiTop + 31, this.zLevel, 0.1D); - GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 151, guiTop + 31, this.zLevel, 0.4D); + GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 115, guiTop + 31, this.zLevel, (double) controller.coreHeat / (double) controller.coreHeatCapacity); + GaugeUtil.renderGauge(Gauge.ROUND_SMALL, guiLeft + 151, guiTop + 31, this.zLevel, (double) controller.hullHeat / (double) controller.hullHeatCapacity); + + if(controller.typeLoaded != -1 && controller.amountLoaded > 0) { + ItemStack display = new ItemStack(ModItems.pwr_fuel, 1, controller.typeLoaded); + this.drawItemStack(display, guiLeft + 89, guiTop + 5, EnumChatFormatting.YELLOW + "" + controller.amountLoaded + "/" + controller.rodCount); + RenderHelper.enableGUIStandardItemLighting(); + } } } diff --git a/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java b/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java index 4c041eaea..e5b244fc5 100644 --- a/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java +++ b/src/main/java/com/hbm/inventory/gui/GuiInfoContainer.java @@ -100,6 +100,19 @@ public abstract class GuiInfoContainer extends GuiContainer { return this.fontRendererObj; } + protected void drawItemStack(ItemStack stack, int x, int y, String label) { + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + itemRender.zLevel = 200.0F; + FontRenderer font = null; + if(stack != null) font = stack.getItem().getFontRenderer(stack); + if(font == null) font = fontRendererObj; + itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), stack, x, y); + itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), stack, x, y, label); + this.zLevel = 0.0F; + itemRender.zLevel = 0.0F; + } + protected void drawStackText(List lines, int x, int y, FontRenderer font) { if(!lines.isEmpty()) { diff --git a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java index 2c37aaa5d..88cbdd9a7 100644 --- a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java @@ -626,7 +626,6 @@ public class AssemblerRecipes { makeRecipe(new ComparableStack(ModItems.ammo_75bolt, 2, ItemAmmoEnums.Ammo75Bolt.STOCK.ordinal()), new AStack[] { new OreDictStack(STEEL.plate(), 2), new OreDictStack(CU.plate(), 1), - new ComparableStack(ModItems.primer_50, 5), new ComparableStack(ModItems.casing_50, 5), new OreDictStack(ANY_PLASTICEXPLOSIVE.ingot(), 2), new ComparableStack(ModItems.cordite, 3), @@ -636,7 +635,6 @@ public class AssemblerRecipes { makeRecipe(new ComparableStack(ModItems.ammo_75bolt, 2, ItemAmmoEnums.Ammo75Bolt.INCENDIARY.ordinal()), new AStack[] { new OreDictStack(STEEL.plate(), 2), new OreDictStack(CU.plate(), 1), - new ComparableStack(ModItems.primer_50, 5), new ComparableStack(ModItems.casing_50, 5), new OreDictStack(ANY_PLASTICEXPLOSIVE.ingot(), 3), new ComparableStack(ModItems.cordite, 3), @@ -646,7 +644,6 @@ public class AssemblerRecipes { makeRecipe(new ComparableStack(ModItems.ammo_75bolt, 2, ItemAmmoEnums.Ammo75Bolt.HE.ordinal()), new AStack[] { new OreDictStack(STEEL.plate(), 2), new OreDictStack(CU.plate(), 1), - new ComparableStack(ModItems.primer_50, 5), new ComparableStack(ModItems.casing_50, 5), new OreDictStack(ANY_HIGHEXPLOSIVE.ingot(), 5), new ComparableStack(ModItems.cordite, 5), diff --git a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java index 1a488b9cb..fea2e23b0 100644 --- a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java @@ -524,11 +524,6 @@ public class AnvilRecipes { constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(CU.plate()), new AnvilOutput(new ItemStack(ModItems.casing_9))).setTier(1)); constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(CU.plate()), new AnvilOutput(new ItemStack(ModItems.casing_50))).setTier(1)); constructionRecipes.add(new AnvilConstructionRecipe(new OreDictStack(CU.plate()), new AnvilOutput(new ItemStack(ModItems.casing_buckshot))).setTier(1)); - constructionRecipes.add(new AnvilConstructionRecipe(new AStack[] {new OreDictStack(IRON.plate()), new ComparableStack(Items.redstone)}, new AnvilOutput(new ItemStack(ModItems.primer_357))).setTier(1)); - constructionRecipes.add(new AnvilConstructionRecipe(new AStack[] {new OreDictStack(IRON.plate()), new ComparableStack(Items.redstone)}, new AnvilOutput(new ItemStack(ModItems.primer_44))).setTier(1)); - constructionRecipes.add(new AnvilConstructionRecipe(new AStack[] {new OreDictStack(IRON.plate()), new ComparableStack(Items.redstone)}, new AnvilOutput(new ItemStack(ModItems.primer_9))).setTier(1)); - constructionRecipes.add(new AnvilConstructionRecipe(new AStack[] {new OreDictStack(IRON.plate()), new ComparableStack(Items.redstone)}, new AnvilOutput(new ItemStack(ModItems.primer_50))).setTier(1)); - constructionRecipes.add(new AnvilConstructionRecipe(new AStack[] {new OreDictStack(IRON.plate()), new ComparableStack(Items.redstone)}, new AnvilOutput(new ItemStack(ModItems.primer_buckshot))).setTier(1)); Object[][] recs = new Object[][] { {ModItems.ammo_12gauge.stackFromEnum(20, Ammo12Gauge.STOCK), P_RED.dust(), ModItems.ammo_12gauge.stackFromEnum(20, Ammo12Gauge.INCENDIARY), 2}, diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index a5144423e..ba2d0ba6c 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -609,11 +609,6 @@ public class ModItems { public static Item mechanism_launcher_2; public static Item mechanism_special; - public static Item primer_357; - public static Item primer_44; - public static Item primer_9; - public static Item primer_50; - public static Item primer_buckshot; public static Item casing_357; public static Item casing_44; public static Item casing_9; @@ -3100,11 +3095,6 @@ public class ModItems { mechanism_launcher_1 = new Item().setUnlocalizedName("mechanism_launcher_1").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":mechanism_5"); mechanism_launcher_2 = new Item().setUnlocalizedName("mechanism_launcher_2").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":mechanism_6"); mechanism_special = new Item().setUnlocalizedName("mechanism_special").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":mechanism_7"); - primer_357 = new Item().setUnlocalizedName("primer_357").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":primer_357"); - primer_44 = new Item().setUnlocalizedName("primer_44").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":primer_44"); - primer_9 = new Item().setUnlocalizedName("primer_9").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":primer_9"); - primer_50 = new Item().setUnlocalizedName("primer_50").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":primer_50"); - primer_buckshot = new Item().setUnlocalizedName("primer_buckshot").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":primer_buckshot"); casing_357 = new Item().setUnlocalizedName("casing_357").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":casing_357"); casing_44 = new Item().setUnlocalizedName("casing_44").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":casing_44"); casing_9 = new Item().setUnlocalizedName("casing_9").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":casing_9"); @@ -6179,13 +6169,6 @@ public class ModItems { GameRegistry.registerItem(mechanism_launcher_2, mechanism_launcher_2.getUnlocalizedName()); GameRegistry.registerItem(mechanism_special, mechanism_special.getUnlocalizedName()); - //Primers - GameRegistry.registerItem(primer_357, primer_357.getUnlocalizedName()); - GameRegistry.registerItem(primer_44, primer_44.getUnlocalizedName()); - GameRegistry.registerItem(primer_9, primer_9.getUnlocalizedName()); - GameRegistry.registerItem(primer_50, primer_50.getUnlocalizedName()); - GameRegistry.registerItem(primer_buckshot, primer_buckshot.getUnlocalizedName()); - //Casings GameRegistry.registerItem(casing_357, casing_357.getUnlocalizedName()); GameRegistry.registerItem(casing_44, casing_44.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/machine/ItemPWRFuel.java b/src/main/java/com/hbm/items/machine/ItemPWRFuel.java index 95198f494..d60aca579 100644 --- a/src/main/java/com/hbm/items/machine/ItemPWRFuel.java +++ b/src/main/java/com/hbm/items/machine/ItemPWRFuel.java @@ -1,6 +1,16 @@ package com.hbm.items.machine; +import java.util.List; + import com.hbm.items.ItemEnumMulti; +import com.hbm.util.EnumUtil; +import com.hbm.util.function.Function; +import com.hbm.util.function.Function.FunctionLogarithmic; +import com.hbm.util.function.Function.FunctionSqrt; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; public class ItemPWRFuel extends ItemEnumMulti { @@ -9,18 +19,40 @@ public class ItemPWRFuel extends ItemEnumMulti { } public static enum EnumPWRFuel { - MEU, - HEU233, - HEU235, - MEN, - HEN237, - MOX, - MEP, - HEP239, - HEP241, - MEA, - HEA242, - HES326, - HES327; + MEU( 05.0D, new FunctionLogarithmic(25)), + HEU233( 07.5D, new FunctionSqrt(25)), + HEU235( 07.5D, new FunctionSqrt(25)), + MEN( 07.5D, new FunctionLogarithmic(25)), + HEN237( 07.5D, new FunctionSqrt(25)), + MOX( 07.5D, new FunctionLogarithmic(25)), + MEP( 07.5D, new FunctionLogarithmic(25)), + HEP239( 10.0D, new FunctionSqrt(25)), + HEP241( 10.0D, new FunctionSqrt(25)), + MEA( 07.5D, new FunctionLogarithmic(25)), + HEA242( 10.0D, new FunctionSqrt(25)), + HES326( 15.0D, new FunctionSqrt(25)), + HES327( 15.0D, new FunctionSqrt(25)); + + public double yield = 1_000_000_000; + public double heatEmission; + public Function function; + + private EnumPWRFuel(double heatEmission, Function function) { + this.heatEmission = heatEmission; + this.function = function; + } + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + + EnumPWRFuel num = EnumUtil.grabEnumSafely(EnumPWRFuel.class, stack.getItemDamage()); + + String color = EnumChatFormatting.GOLD + ""; + String reset = EnumChatFormatting.RESET + ""; + + list.add(color + "Heat per flux: " + reset + num.heatEmission + " TU"); + list.add(color + "Reacton function: " + reset + num.function.getLabelForFuel()); + list.add(color + "Fuel type: " + reset + num.function.getDangerFromFuel()); } } diff --git a/src/main/java/com/hbm/lib/HbmChestContents.java b/src/main/java/com/hbm/lib/HbmChestContents.java index 957b10940..045896b42 100644 --- a/src/main/java/com/hbm/lib/HbmChestContents.java +++ b/src/main/java/com/hbm/lib/HbmChestContents.java @@ -34,8 +34,6 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.ammo_20gauge, 0, 2, 6, 3), new WeightedRandomChestContent(ModItems.casing_9, 0, 4, 10, 3), new WeightedRandomChestContent(ModItems.casing_50, 0, 4, 10, 3), - new WeightedRandomChestContent(ModItems.primer_9, 0, 4, 10, 3), - new WeightedRandomChestContent(ModItems.primer_50, 0, 4, 10, 3), new WeightedRandomChestContent(ModItems.cordite, 0, 4, 6, 5), new WeightedRandomChestContent(ModItems.battery_generic, 0, 1, 1, 4), new WeightedRandomChestContent(ModItems.battery_advanced, 0, 1, 1, 2), diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index 438847446..d17a16610 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -959,8 +959,8 @@ public class MainRegistry { config.save(); try { - if(GeneralConfig.enableThermosPreventer && Class.forName("thermos.Thermos") != null) { - throw new IllegalStateException("The mod tried to start on a Thermos server and therefore stopped. To allow the server to start on Thermos, change the appropriate " + if(GeneralConfig.enableThermosPreventer && Class.forName("thermos.ThermosClassTransformer") != null) { + throw new IllegalStateException("The mod tried to start on a Thermos or it's fork server and therefore stopped. To allow the server to start on Thermos, change the appropriate " + "config entry (0.00 in hbm.cfg). This was done because, by default, Thermos " + "uses a so-called \"optimization\" feature that reduces tile ticking a lot, which will inevitably break a lot of machines. Most people aren't even aware " + "of this, and start blaming random mods for all their stuff breaking. In order to adjust or even disable this feature, edit \"tileentities.yml\" in your " @@ -1161,6 +1161,11 @@ public class MainRegistry { ignoreMappings.add("hbm:item.canned_kerosene"); ignoreMappings.add("hbm:item.canned_recursion"); ignoreMappings.add("hbm:item.canned_bark"); + ignoreMappings.add("hbm:item.primer_357"); + ignoreMappings.add("hbm:item.primer_44"); + ignoreMappings.add("hbm:item.primer_9"); + ignoreMappings.add("hbm:item.primer_50"); + ignoreMappings.add("hbm:item.primer_buckshot"); /// REMAP /// remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses); diff --git a/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java b/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java index 988d683b8..58c6d15e0 100644 --- a/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java +++ b/src/main/java/com/hbm/tileentity/TileEntityMachineBase.java @@ -102,17 +102,16 @@ public abstract class TileEntityMachineBase extends TileEntityLoadedBase impleme @Override public ItemStack decrStackSize(int slot, int amount) { - if(slots[slot] != null) - { - if(slots[slot].stackSize <= amount) - { + if(slots[slot] != null) { + + if(slots[slot].stackSize <= amount) { ItemStack itemStack = slots[slot]; slots[slot] = null; return itemStack; } + ItemStack itemStack1 = slots[slot].splitStack(amount); - if (slots[slot].stackSize == 0) - { + if(slots[slot].stackSize == 0) { slots[slot] = null; } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java index 1e860e007..564df30ac 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java @@ -4,35 +4,46 @@ import java.util.HashMap; import java.util.Map.Entry; import com.hbm.blocks.ModBlocks; +import com.hbm.interfaces.IControlReceiver; import com.hbm.inventory.container.ContainerPWR; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.trait.FT_Heatable; import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingType; import com.hbm.inventory.gui.GUIPWR; +import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemPWRFuel.EnumPWRFuel; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.util.EnumUtil; import com.hbm.util.fauxpointtwelve.BlockPos; import net.minecraft.block.Block; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityPWRController extends TileEntityMachineBase implements IGUIProvider { +public class TileEntityPWRController extends TileEntityMachineBase implements IGUIProvider, IControlReceiver { public FluidTank[] tanks; public int coreHeat; - public int coreHeatCapacity; + public static final int coreHeatCapacity = 25_000_000; public int hullHeat; - public int hullHeatCapacity; + public static final int hullHeatCapacity = 25_000_000; + public double flux; + public int rodLevel; public int rodTarget; - public int progress; - public int processTime; + + public int typeLoaded; + public int amountLoaded; + public double progress; + public double processTime; public int rodCount; public int connections; @@ -51,6 +62,7 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG this.tanks[1] = new FluidTank(Fluids.COOLANT_HOT, 128_000); } + /** The initial creation of the reactor, does all the pre-calculation and whatnot */ public void setup(HashMap partMap, HashMap rodMap) { rodCount = 0; @@ -129,12 +141,92 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG this.tanks[0].setType(2, slots); setupTanks(); + if((typeLoaded == -1 || amountLoaded <= 0) && slots[0] != null && slots[0].getItem() == ModItems.pwr_fuel) { + typeLoaded = slots[0].getItemDamage(); + amountLoaded++; + this.decrStackSize(0, 1); + this.markChanged(); + } else if(slots[0] != null && slots[0].getItem() == ModItems.pwr_fuel && slots[0].getItemDamage() == typeLoaded && amountLoaded < rodCount){ + amountLoaded++; + this.decrStackSize(0, 1); + this.markChanged(); + } + + if(this.rodTarget > this.rodLevel) this.rodLevel++; + if(this.rodTarget < this.rodLevel) this.rodLevel--; + + int newFlux = this.sourceCount * 20; + + if(typeLoaded != -1 && amountLoaded > 0) { + + EnumPWRFuel fuel = EnumUtil.grabEnumSafely(EnumPWRFuel.class, typeLoaded); + double usedRods = getTotalProcessMultiplier(); + double fluxPerRod = this.flux / this.rodCount; + double outputPerRod = fuel.function.effonix(fluxPerRod); + double totalOutput = outputPerRod * amountLoaded * usedRods; + double totalHeatOutput = totalOutput * fuel.heatEmission; + + this.coreHeat += totalHeatOutput; + newFlux += totalOutput; + + this.processTime = (int) fuel.yield; + this.progress += totalOutput; + + if(this.progress >= this.processTime) { + this.progress -= this.processTime; + + if(slots[1] == null) { + slots[1] = new ItemStack(ModItems.pwr_fuel_hot, 1, typeLoaded); + } else if(slots[1].getItem() == ModItems.pwr_fuel_hot && slots[1].getItemDamage() == typeLoaded && slots[1].stackSize < slots[1].getMaxStackSize()) { + slots[1].stackSize++; + } + + this.markChanged(); + } + } + + if(this.amountLoaded <= 0) { + this.typeLoaded = -1; + } + + /* CORE COOLING */ + double coreCoolingApproachNum = getXOverE(this.heatexCount, 10) / 2D; + int averageCoreHeat = (this.coreHeat + this.hullHeat) / 2; + this.coreHeat -= (coreHeat - averageCoreHeat) * coreCoolingApproachNum; + this.hullHeat -= (hullHeat - averageCoreHeat) * coreCoolingApproachNum; + + this.hullHeat *= 0.99D; + + this.flux = newFlux; + NBTTagCompound data = new NBTTagCompound(); tanks[0].writeToNBT(data, "t0"); tanks[1].writeToNBT(data, "t1"); + data.setInteger("rodCount", rodCount); + data.setInteger("coreHeat", coreHeat); + data.setInteger("hullHeat", hullHeat); + data.setDouble("flux", flux); + data.setDouble("processTime", processTime); + data.setDouble("progress", progress); + data.setInteger("typeLoaded", typeLoaded); + data.setInteger("amountLoaded", amountLoaded); + this.networkPack(data, 150); } } + public void networkUnpack(NBTTagCompound nbt) { + tanks[0].readFromNBT(nbt, "t0"); + tanks[1].readFromNBT(nbt, "t1"); + rodCount = nbt.getInteger("rodCount"); + coreHeat = nbt.getInteger("coreHeat"); + hullHeat = nbt.getInteger("hullHeat"); + flux = nbt.getDouble("flux"); + processTime = nbt.getDouble("processTime"); + progress = nbt.getDouble("progress"); + typeLoaded = nbt.getInteger("typeLoaded"); + amountLoaded = nbt.getInteger("amountLoaded"); + } + protected void setupTanks() { FT_Heatable trait = tanks[0].getTankType().getTrait(FT_Heatable.class); @@ -147,6 +239,20 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG tanks[1].setTankType(trait.getFirstStep().typeProduced); } + public double getTotalProcessMultiplier() { + double totalConnections = this.connections + this.connectionsControlled * (1D - (this.rodLevel / 100D)); + double connectionsEff = connectinFunc(totalConnections); + return connectionsEff; + } + + public double connectinFunc(double connections) { + return connections / 10D * (1D - getXOverE(connections, 300D)) + connections / 150D * getXOverE(connections, 300D); + } + + public double getXOverE(double x, double d) { + return 1 - Math.pow(Math.E, -x / d); + } + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -161,6 +267,19 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG nbt.setBoolean("assembled", assembled); } + @Override + public boolean hasPermission(EntityPlayer player) { + return this.isUseableByPlayer(player); + } + + @Override + public void receiveControl(NBTTagCompound data) { + + if(data.hasKey("control")) { + this.rodTarget = MathHelper.clamp_int(data.getInteger("control"), 0, 100); + } + } + @Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerPWR(player.inventory, this); diff --git a/src/main/java/com/hbm/util/function/Function.java b/src/main/java/com/hbm/util/function/Function.java index 544328e5c..4e8cc26b9 100644 --- a/src/main/java/com/hbm/util/function/Function.java +++ b/src/main/java/com/hbm/util/function/Function.java @@ -15,6 +15,7 @@ public abstract class Function { protected double div = 1D; protected double off = 0; + //the german prononciation of f(x) - "F von X", tee hee public abstract double effonix(double x); public abstract String getLabelForFuel(); public abstract String getDangerFromFuel(); diff --git a/src/main/resources/assets/hbm/textures/items/primer_357.png b/src/main/resources/assets/hbm/textures/items/primer_357.png deleted file mode 100644 index c20411ce7..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/primer_357.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/primer_44.png b/src/main/resources/assets/hbm/textures/items/primer_44.png deleted file mode 100644 index 1b7fd5435..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/primer_44.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/primer_50.png b/src/main/resources/assets/hbm/textures/items/primer_50.png deleted file mode 100644 index 17bee59b9..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/primer_50.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/primer_9.png b/src/main/resources/assets/hbm/textures/items/primer_9.png deleted file mode 100644 index e88ab382f..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/primer_9.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/primer_buckshot.png b/src/main/resources/assets/hbm/textures/items/primer_buckshot.png deleted file mode 100644 index 701799005..000000000 Binary files a/src/main/resources/assets/hbm/textures/items/primer_buckshot.png and /dev/null differ