From 08c9f4285c5102c8410f9b377912a490a0be0735 Mon Sep 17 00:00:00 2001 From: Boblet Date: Fri, 28 Oct 2022 14:51:11 +0200 Subject: [PATCH] some finishing touches, crucible smelting conversion --- src/main/java/com/hbm/blocks/ModBlocks.java | 3 + .../handlers/ScrapsCraftingHandler.java | 63 ++++++++++ .../radiation/ChunkRadiationHandlerNT.java | 114 +++++++++++++++++- .../com/hbm/inventory/OreDictManager.java | 2 + .../inventory/material/MatDistribution.java | 4 +- .../java/com/hbm/inventory/material/Mats.java | 61 ++++++---- .../hbm/inventory/material/NTMMaterial.java | 16 ++- .../recipes/BlastFurnaceRecipes.java | 9 +- .../inventory/recipes/CrucibleRecipes.java | 30 ++--- .../java/com/hbm/main/CraftingManager.java | 2 + .../machine/TileEntityCrucible.java | 4 +- src/main/resources/assets/hbm/lang/de_DE.lang | 9 ++ src/main/resources/assets/hbm/lang/en_US.lang | 9 ++ .../assets/hbm/textures/blocks/block_slag.png | Bin 0 -> 423 bytes 14 files changed, 275 insertions(+), 51 deletions(-) create mode 100644 src/main/java/com/hbm/crafting/handlers/ScrapsCraftingHandler.java create mode 100644 src/main/resources/assets/hbm/textures/blocks/block_slag.png diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 93d652205..289fc2614 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -259,6 +259,7 @@ public class ModBlocks { public static Block block_semtex; public static Block block_c4; public static Block block_smore; + public static Block block_slag; public static Block block_australium; public static Block block_weidanium; @@ -1523,6 +1524,7 @@ public class ModBlocks { block_semtex = new BlockPlasticExplosive(Material.tnt).setBlockName("block_semtex").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(2.0F).setBlockTextureName(RefStrings.MODID + ":block_semtex"); block_c4 = new BlockPlasticExplosive(Material.tnt).setBlockName("block_c4").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(2.0F).setBlockTextureName(RefStrings.MODID + ":block_c4"); block_smore = new BlockPillar(Material.rock, RefStrings.MODID + ":block_smore_top").setBlockName("block_smore").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":block_smore_side"); + block_slag = new BlockBeaconable(Material.iron).setBlockName("block_slag").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_slag"); block_australium = new BlockBeaconable(Material.iron).setBlockName("block_australium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_australium"); block_weidanium = new BlockBeaconable(Material.iron).setBlockName("block_weidanium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_weidanium"); @@ -2628,6 +2630,7 @@ public class ModBlocks { GameRegistry.registerBlock(block_semtex, block_semtex.getUnlocalizedName()); GameRegistry.registerBlock(block_c4, block_c4.getUnlocalizedName()); GameRegistry.registerBlock(block_smore, block_smore.getUnlocalizedName()); + GameRegistry.registerBlock(block_slag, block_slag.getUnlocalizedName()); //Bottlecap Blocks GameRegistry.registerBlock(block_cap_nuka, block_cap_nuka.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/crafting/handlers/ScrapsCraftingHandler.java b/src/main/java/com/hbm/crafting/handlers/ScrapsCraftingHandler.java new file mode 100644 index 000000000..2e5835f1b --- /dev/null +++ b/src/main/java/com/hbm/crafting/handlers/ScrapsCraftingHandler.java @@ -0,0 +1,63 @@ +package com.hbm.crafting.handlers; + +import com.hbm.inventory.material.Mats.MaterialStack; +import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemScraps; + +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.World; + +public class ScrapsCraftingHandler implements IRecipe { + + @Override + public boolean matches(InventoryCrafting inventory, World world) { + + MaterialStack mat = null; + for(int i = 0; i < 9; i++) { + ItemStack stack = inventory.getStackInRowAndColumn(i % 3, i / 3); + + if(stack == null) continue; + if(stack.getItem() != ModItems.scraps) return false; + if(mat != null) return false; + + mat = ItemScraps.getMats(stack); + if(mat.amount > 2) return false; + } + + return mat != null; + } + + @Override + public ItemStack getCraftingResult(InventoryCrafting inventory) { + + MaterialStack mat = null; + for(int i = 0; i < 9; i++) { + ItemStack stack = inventory.getStackInRowAndColumn(i % 3, i / 3); + + if(stack == null) continue; + if(stack.getItem() != ModItems.scraps) return null; + if(mat != null) return null; + + mat = ItemScraps.getMats(stack); + if(mat.amount > 2) return null; + } + + if(mat == null) return null; + + ItemStack scrap = ItemScraps.create(new MaterialStack(mat.material, mat.amount / 2)); + scrap.stackSize = 2; + return scrap; + } + + @Override + public int getRecipeSize() { + return 1; + } + + @Override + public ItemStack getRecipeOutput() { + return new ItemStack(ModItems.scraps); + } +} diff --git a/src/main/java/com/hbm/handler/radiation/ChunkRadiationHandlerNT.java b/src/main/java/com/hbm/handler/radiation/ChunkRadiationHandlerNT.java index 80bb3f515..c95c180d5 100644 --- a/src/main/java/com/hbm/handler/radiation/ChunkRadiationHandlerNT.java +++ b/src/main/java/com/hbm/handler/radiation/ChunkRadiationHandlerNT.java @@ -7,8 +7,8 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Queue; import java.util.Set; @@ -18,7 +18,6 @@ import com.hbm.util.fauxpointtwelve.BlockPos; import cpw.mods.fml.common.gameevent.TickEvent; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -218,7 +217,116 @@ public class ChunkRadiationHandlerNT extends ChunkRadiationHandler { } public static void updateRadiation() { - // TODO // + long time = System.currentTimeMillis(); + //long lTime = System.nanoTime(); + for(WorldRadiationData w : worldMap.values()){ + //Avoid concurrent modification + List itrActive = new ArrayList<>(w.activePockets); + Iterator itr = itrActive.iterator(); + while(itr.hasNext()){ + RadPocket p = itr.next(); + BlockPos pos = p.parent.parent.getWorldPos(p.parent.yLevel); + + /*PlayerChunkMapEntry entry = ((WorldServer)w.world).getPlayerManager().getEntry(p.parent.parent.chunk.x, p.parent.parent.chunk.z); + if(entry == null || entry.getWatchingPlayers().isEmpty()){ + //I shouldn't have to do this, but I ran into some issues with chunks not getting unloaded? + //In any case, marking it for unload myself shouldn't cause any problems + ((WorldServer)w.world).getChunkProvider().queueUnload(p.parent.parent.chunk); + }*/ // !!! + + //Lower the radiation a bit, and mark the parent chunk as dirty so the radiation gets saved + p.radiation *= 0.999F; + p.radiation -= 0.05F; + p.parent.parent.chunk.isModified = true; + if(p.radiation <= 0) { + //If there's no more radiation, set it to 0 and remove + p.radiation = 0; + p.accumulatedRads = 0; + itr.remove(); + p.parent.parent.chunk.isModified = true; + continue; + } + + /*if(p.radiation > RadiationConfig.fogRad && w.world != null && w.world.rand.nextInt(RadiationConfig.fogCh) == 0) { + //Fog calculation works slightly differently here to account for the 3d nature of the system + //We just try 10 random coordinates of the sub chunk + //If the coordinate is inside this pocket and the block at the coordinate is air, + //use it to spawn a rad particle at that block and break + //Also only spawn it if it's close to the ground, otherwise you get a giant fart when nukes go off. + for(int i = 0; i < 10; i ++){ + BlockPos randPos = new BlockPos(w.world.rand.nextInt(16), w.world.rand.nextInt(16), w.world.rand.nextInt(16)); + if(p.parent.pocketsByBlock == null || p.parent.pocketsByBlock[randPos.getX()*16*16+randPos.getY()*16+randPos.getZ()] == p){ + randPos = randPos.add(p.parent.parent.getWorldPos(p.parent.yLevel)); + IBlockState state = w.world.getBlockState(randPos); + Vec3d rPos = new Vec3d(randPos.getX()+0.5, randPos.getY()+0.5, randPos.getZ()+0.5); + RayTraceResult trace = w.world.rayTraceBlocks(rPos, rPos.addVector(0, -6, 0)); + if(state.getBlock().isAir(state, w.world, randPos) && trace != null && trace.typeOfHit == Type.BLOCK){ + PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(randPos.getX()+0.5F, randPos.getY()+0.5F, randPos.getZ()+0.5F, 3), new TargetPoint(w.world.provider.getDimension(), randPos.getX(), randPos.getY(), randPos.getZ(), 100)); + break; + } + } + } + }*/ + + //Count the number of connections to other pockets we have + float count = 0; + for(ForgeDirection e : ForgeDirection.VALID_DIRECTIONS){ + count += p.connectionIndices[e.ordinal()].size(); + } + float amountPer = 0.7F/count; + if(count == 0 || p.radiation < 1){ + //Don't update if we have no connections or our own radiation is less than 1. Prevents micro radiation bleeding. + amountPer = 0; + } + if(p.radiation > 0 && amountPer > 0){ + //Only update other values if this one has radiation to update with + for(ForgeDirection e : ForgeDirection.VALID_DIRECTIONS){ + //For every direction, get the block pos for the next sub chunk in that direction. + //If it's not loaded or it's out of bounds, do nothhing + BlockPos nPos = pos.offset(e, 16); + if(!p.parent.parent.chunk.worldObj.blockExists(nPos.getX(), nPos.getY(), nPos.getZ()) || nPos.getY() < 0 || nPos.getY() > 255) + continue; + if(p.connectionIndices[e.ordinal()].size() == 1 && p.connectionIndices[e.ordinal()].get(0) == -1){ + //If the chunk in this direction isn't loaded, load it + rebuildChunkPockets(p.parent.parent.chunk.worldObj.getChunkFromBlockCoords(nPos.getX(), nPos.getZ()), nPos.getY() >> 4); + } else { + //Else, For every pocket this chunk is connected to in this direction, add radiation to it + //Also add those pockets to the active pockets set + SubChunkRadiationStorage sc2 = getSubChunkStorage(p.parent.parent.chunk.worldObj, nPos.getX(), nPos.getY(), nPos.getZ()); + for(int idx : p.connectionIndices[e.ordinal()]){ + //Only accumulated rads get updated so the system doesn't interfere with itself while working + sc2.pockets[idx].accumulatedRads += p.radiation*amountPer; + w.activePockets.add(sc2.pockets[idx]); + } + } + } + } + if(amountPer != 0){ + p.accumulatedRads += p.radiation * 0.3F; + } + //Make sure we only use around 20 ms max per tick, to help reduce lag. + //The lag should die down by itself after a few minutes when all radioactive chunks get built. + if(System.currentTimeMillis()-time > 20){ + break; + } + } + //Remove the ones that reached 0 and set the actual radiation values to the accumulated values + itr = w.activePockets.iterator(); + while(itr.hasNext()){ + RadPocket p = itr.next(); + p.radiation = p.accumulatedRads; + p.accumulatedRads = 0; + if(p.radiation <= 0){ + itr.remove(); + } + } + } + //System.out.println(System.nanoTime()-lTime); + //Should ideally never happen because of the 20 ms limit, + //but who knows, maybe it will, and it's nice to have debug output if it does + if(System.currentTimeMillis()-time > 50){ + System.out.println("Rads took too long: " + (System.currentTimeMillis()-time)); + } } public static void markChunkForRebuild(World world, int x, int y, int z){ diff --git a/src/main/java/com/hbm/inventory/OreDictManager.java b/src/main/java/com/hbm/inventory/OreDictManager.java index 04777ef6a..dec6b081f 100644 --- a/src/main/java/com/hbm/inventory/OreDictManager.java +++ b/src/main/java/com/hbm/inventory/OreDictManager.java @@ -195,6 +195,7 @@ public class OreDictManager { public static final DictFrame VOLCANIC = new DictFrame("Volcanic"); public static final DictFrame HEMATITE = new DictFrame("Hematite"); public static final DictFrame MALACHITE = new DictFrame("Malachite"); + public static final DictFrame SLAG = new DictFrame("Slag"); /* * HAZARDS, MISC */ @@ -364,6 +365,7 @@ public class OreDictManager { VOLCANIC .gem(gem_volcanic) .ore(basalt_gem); HEMATITE .ore(fromOne(stone_resource, EnumStoneType.HEMATITE)); MALACHITE .ore(fromOne(stone_resource, EnumStoneType.MALACHITE)); + SLAG .block(block_slag); /* * HAZARDS, MISC diff --git a/src/main/java/com/hbm/inventory/material/MatDistribution.java b/src/main/java/com/hbm/inventory/material/MatDistribution.java index 0544c6ea0..2f39e4f2b 100644 --- a/src/main/java/com/hbm/inventory/material/MatDistribution.java +++ b/src/main/java/com/hbm/inventory/material/MatDistribution.java @@ -82,8 +82,8 @@ public class MatDistribution extends SerializableRecipe { registerOre(OreDictManager.CO.ore(), MAT_COBALT, INGOT.q(1), MAT_STONE, QUART.q(1)); registerOre(OreDictManager.REDSTONE.ore(), MAT_REDSTONE, INGOT.q(4), MAT_STONE, QUART.q(1)); - registerOre(OreDictManager.HEMATITE.ore(), MAT_HEMATITE, INGOT.q(3)); - registerOre(OreDictManager.MALACHITE.ore(), MAT_MALACHITE, INGOT.q(3)); + registerOre(OreDictManager.HEMATITE.ore(), MAT_HEMATITE, INGOT.q(4)); + registerOre(OreDictManager.MALACHITE.ore(), MAT_MALACHITE, INGOT.q(4)); registerEntry(ModItems.powder_flux, MAT_FLUX, DUST.q(1)); } diff --git a/src/main/java/com/hbm/inventory/material/Mats.java b/src/main/java/com/hbm/inventory/material/Mats.java index e6966d34c..b9d8a855b 100644 --- a/src/main/java/com/hbm/inventory/material/Mats.java +++ b/src/main/java/com/hbm/inventory/material/Mats.java @@ -13,6 +13,7 @@ import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.material.NTMMaterial.SmeltingBehavior; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemScraps; +import com.hbm.util.I18nUtil; import com.hbm.util.ItemStackUtil; import net.minecraft.item.ItemStack; @@ -47,18 +48,19 @@ public class Mats { //Vanilla and vanilla-like public static final NTMMaterial MAT_STONE = makeSmeltable(_VS + 00, df("Stone"), 0x4D2F23).omitAutoGen(); - public static final NTMMaterial MAT_COAL = makeAdditive( 1400, COAL, 0x583434).omitAutoGen(); - public static final NTMMaterial MAT_LIGNITE = makeAdditive( 1401, LIGNITE, 0x715444); - public static final NTMMaterial MAT_COALCOKE = makeAdditive( 1410, COALCOKE, 0x3B3B3B); - public static final NTMMaterial MAT_PETCOKE = makeAdditive( 1411, PETCOKE, 0x71645C); - public static final NTMMaterial MAT_LIGCOKE = makeAdditive( 1412, LIGCOKE, 0x725644); - public static final NTMMaterial MAT_GRAPHITE = makeAdditive( 1420, GRAPHITE, 0x666666); + public static final NTMMaterial MAT_CARBON = makeAdditive( 1499, df("Carbon"), 0xD0D0D0).omitAutoGen(); + public static final NTMMaterial MAT_COAL = make( 1400, COAL) .setConversion(MAT_CARBON, 0.8D).omitAutoGen(); + public static final NTMMaterial MAT_LIGNITE = make( 1401, LIGNITE) .setConversion(MAT_CARBON, 0.5D); + public static final NTMMaterial MAT_COALCOKE = make( 1410, COALCOKE) .setConversion(MAT_CARBON, 0.8D); + public static final NTMMaterial MAT_PETCOKE = make( 1411, PETCOKE) .setConversion(MAT_CARBON, 0.8D); + public static final NTMMaterial MAT_LIGCOKE = make( 1412, LIGCOKE) .setConversion(MAT_CARBON, 0.8D); + public static final NTMMaterial MAT_GRAPHITE = make( 1420, GRAPHITE) .setConversion(MAT_CARBON, 1D); public static final NTMMaterial MAT_IRON = makeSmeltable(2600, IRON, 0xFFA259).omitAutoGen(); public static final NTMMaterial MAT_GOLD = makeSmeltable(7900, GOLD, 0xE8D754).omitAutoGen(); public static final NTMMaterial MAT_REDSTONE = makeSmeltable(_VS + 01, REDSTONE, 0xFF1000).omitAutoGen(); public static final NTMMaterial MAT_OBSIDIAN = makeSmeltable(_VS + 02, df("Obsidian"), 0x3D234D).omitAutoGen(); - public static final NTMMaterial MAT_HEMATITE = makeAdditive( 2601, HEMATITE, 0x6E463D); - public static final NTMMaterial MAT_MALACHITE = makeAdditive( 2901, MALACHITE, 0x61AF87); + public static final NTMMaterial MAT_HEMATITE = makeAdditive( 2601, HEMATITE, 0x6E463D).omitAutoGen(); + public static final NTMMaterial MAT_MALACHITE = makeAdditive( 2901, MALACHITE, 0x61AF87).omitAutoGen(); //Radioactive public static final NTMMaterial MAT_URANIUM = makeSmeltable(9200, U, 0x9AA196).setShapes(NUGGET, BILLET, INGOT, DUST, BLOCK); @@ -72,22 +74,22 @@ public class Mats { public static final NTMMaterial MAT_PU239 = makeSmeltable(9439, PU239, 0x78817E).setShapes(NUGGET, BILLET, INGOT, BLOCK); public static final NTMMaterial MAT_PU240 = makeSmeltable(9440, PU240, 0x78817E).setShapes(NUGGET, BILLET, INGOT, BLOCK); public static final NTMMaterial MAT_PU241 = makeSmeltable(9441, PU241, 0x78817E).setShapes(NUGGET, BILLET, INGOT, BLOCK); - public static final NTMMaterial MAT_RGA = makeSmeltable(9501, AMRG, 0).setShapes(NUGGET, BILLET, INGOT, BLOCK); - public static final NTMMaterial MAT_AM241 = makeSmeltable(9541, AM241, 0).setShapes(NUGGET, BILLET, INGOT, BLOCK); - public static final NTMMaterial MAT_AM242 = makeSmeltable(9542, AM242, 0).setShapes(NUGGET, BILLET, INGOT, BLOCK); - public static final NTMMaterial MAT_NEPTUNIUM = makeSmeltable(9337, NP237, 0).setShapes(NUGGET, BILLET, INGOT, DUST, BLOCK); - public static final NTMMaterial MAT_POLONIUM = makeSmeltable(8410, PO210, 0).setShapes(NUGGET, BILLET, INGOT, DUST, BLOCK); + public static final NTMMaterial MAT_RGA = makeSmeltable(9501, AMRG, 0x93767B).setShapes(NUGGET, BILLET, INGOT, BLOCK); + public static final NTMMaterial MAT_AM241 = makeSmeltable(9541, AM241, 0x93767B).setShapes(NUGGET, BILLET, INGOT, BLOCK); + public static final NTMMaterial MAT_AM242 = makeSmeltable(9542, AM242, 0x93767B).setShapes(NUGGET, BILLET, INGOT, BLOCK); + public static final NTMMaterial MAT_NEPTUNIUM = makeSmeltable(9337, NP237, 0x647064).setShapes(NUGGET, BILLET, INGOT, DUST, BLOCK); + public static final NTMMaterial MAT_POLONIUM = makeSmeltable(8410, PO210, 0x563A26).setShapes(NUGGET, BILLET, INGOT, DUST, BLOCK); public static final NTMMaterial MAT_TECHNIETIUM = makeSmeltable(4399, TC99, 0xCADFDF).setShapes(NUGGET, BILLET, INGOT, BLOCK); public static final NTMMaterial MAT_RADIUM = makeSmeltable(8826, RA226, 0xE9FAF6).setShapes(NUGGET, BILLET, INGOT, DUST, BLOCK); - public static final NTMMaterial MAT_ACTINIUM = makeSmeltable(8927, AC227, 0).setShapes(NUGGET, BILLET, INGOT); - public static final NTMMaterial MAT_CO60 = makeSmeltable(2760, CO60, 0).setShapes(NUGGET, BILLET, INGOT, DUST); - public static final NTMMaterial MAT_AU198 = makeSmeltable(7998, AU198, 0).setShapes(NUGGET, BILLET, INGOT, DUST); - public static final NTMMaterial MAT_PB209 = makeSmeltable(8209, PB209, 0).setShapes(NUGGET, BILLET, INGOT, DUST); + public static final NTMMaterial MAT_ACTINIUM = makeSmeltable(8927, AC227, 0x958989).setShapes(NUGGET, BILLET, INGOT); + public static final NTMMaterial MAT_CO60 = makeSmeltable(2760, CO60, 0x8F72AE).setShapes(NUGGET, BILLET, INGOT, DUST); + public static final NTMMaterial MAT_AU198 = makeSmeltable(7998, AU198, 0xE8D754).setShapes(NUGGET, BILLET, INGOT, DUST); + public static final NTMMaterial MAT_PB209 = makeSmeltable(8209, PB209, 0x7B535D).setShapes(NUGGET, BILLET, INGOT, DUST); public static final NTMMaterial MAT_SCHRABIDIUM = makeSmeltable(12626, SA326, 0x32FFFF).setShapes(NUGGET, WIRE, BILLET, INGOT, DUST, PLATE, BLOCK); - public static final NTMMaterial MAT_SOLINIUM = makeSmeltable(12627, SA327, 0).setShapes(NUGGET, BILLET, INGOT, BLOCK); - public static final NTMMaterial MAT_SCHRABIDATE = makeSmeltable(12600, SBD, 0).setShapes(INGOT, DUST, BLOCK); - public static final NTMMaterial MAT_SCHRARANIUM = makeSmeltable(12601, SRN, 0).setShapes(INGOT, BLOCK); - public static final NTMMaterial MAT_GHIORSIUM = makeSmeltable(12836, GH336, 0).setShapes(NUGGET, BILLET, INGOT, BLOCK); + public static final NTMMaterial MAT_SOLINIUM = makeSmeltable(12627, SA327, 0x72B6B0).setShapes(NUGGET, BILLET, INGOT, BLOCK); + public static final NTMMaterial MAT_SCHRABIDATE = makeSmeltable(12600, SBD, 0x6589B4).setShapes(INGOT, DUST, BLOCK); + public static final NTMMaterial MAT_SCHRARANIUM = makeSmeltable(12601, SRN, 0x24AFAC).setShapes(INGOT, BLOCK); + public static final NTMMaterial MAT_GHIORSIUM = makeSmeltable(12836, GH336, 0xC6C6A1).setShapes(NUGGET, BILLET, INGOT, BLOCK); //Base metals public static final NTMMaterial MAT_TITANIUM = makeSmeltable(2200, TI, 0xA99E79).setShapes(INGOT, DUST, PLATE, BLOCK); @@ -115,7 +117,7 @@ public class Mats { public static final NTMMaterial MAT_MAGTUNG = makeSmeltable(_AS + 8, MAGTUNG, 0x22A2A2).setShapes(INGOT, DUST, BLOCK); public static final NTMMaterial MAT_CMB = makeSmeltable(_AS + 9, CMB, 0x6F6FB4).setShapes(INGOT, DUST, PLATE, BLOCK); public static final NTMMaterial MAT_FLUX = makeAdditive(_AS + 10, df("Flux"), 0xDECCAD).setShapes(DUST); - public static final NTMMaterial MAT_SLAG = makeAdditive(_AS + 11, df("Slag"), 0x6C6562).setShapes(BLOCK); + public static final NTMMaterial MAT_SLAG = makeAdditive(_AS + 11, SLAG, 0x6C6562).setShapes(BLOCK); public static NTMMaterial make(int id, DictFrame dict) { return new NTMMaterial(id, dict); @@ -177,6 +179,13 @@ public class Mats { return list; } + + public static List getSmeltingMaterialsFromItem(ItemStack stack) { + List baseMats = getMaterialsFromItem(stack); + List smelting = new ArrayList(); + baseMats.forEach(x -> smelting.add(new MaterialStack(x.material.smeltsInto, (int) (x.amount * x.material.smeltingRatio)))); + return smelting; + } public static class MaterialStack { //final fields to prevent accidental changing @@ -204,10 +213,10 @@ public class Mats { amount -= NUGGET.q(nuggets); int quanta = amount; - if(blocks > 0) format += blocks + " Blocks "; - if(ingots > 0) format += ingots + " Ingots "; - if(nuggets > 0) format += nuggets + " Nuggets "; - if(quanta > 0) format += quanta + " Quanta "; + if(blocks > 0) format += (blocks == 1 ? I18nUtil.resolveKey("matshape.block", blocks) : I18nUtil.resolveKey("matshape.blocks", blocks)); + if(ingots > 0) format += (ingots == 1 ? I18nUtil.resolveKey("matshape.ingot", ingots) : I18nUtil.resolveKey("matshape.ingots", ingots)); + if(nuggets > 0) format += (nuggets == 1 ? I18nUtil.resolveKey("matshape.nugget", nuggets) : I18nUtil.resolveKey("matshape.nuggets", nuggets)); + if(quanta > 0) format += (quanta == 1 ? I18nUtil.resolveKey("matshape.quantum", quanta) : I18nUtil.resolveKey("matshape.quanta", quanta)); return format.trim(); } diff --git a/src/main/java/com/hbm/inventory/material/NTMMaterial.java b/src/main/java/com/hbm/inventory/material/NTMMaterial.java index edf79333c..6c7ad0dc6 100644 --- a/src/main/java/com/hbm/inventory/material/NTMMaterial.java +++ b/src/main/java/com/hbm/inventory/material/NTMMaterial.java @@ -17,11 +17,17 @@ public class NTMMaterial { public int solidColor = 0xFF4A00; //TODO public int moltenColor = 0xFF4A00; + public NTMMaterial smeltsInto; + public double smeltingRatio; + public NTMMaterial(int id, DictFrame dict) { this.names = dict.mats; this.id = id; + this.smeltsInto = this; + this.smeltingRatio = 1.0D; + for(String name : dict.mats) { Mats.matByName.put(name, this); } @@ -34,6 +40,12 @@ public class NTMMaterial { return "hbmmat." + this.names[0].toLowerCase(); } + public NTMMaterial setConversion(NTMMaterial mat, double mult) { + this.smeltsInto = mat; + this.smeltingRatio = mult; + return this; + } + /** Shapes for autogen */ public NTMMaterial setShapes(MaterialShapes... shapes) { this.shapes = shapes; @@ -58,10 +70,10 @@ public class NTMMaterial { } public static enum SmeltingBehavior { - NOT_SMELTABLE, //anything that can't be smelted or otherwise doesn't belong in a smelter, like diamond + NOT_SMELTABLE, //anything that can't be smelted or otherwise doesn't belong in a smelter, like diamond. may also include things that are smeltable but turn into a different type VAPORIZES, //can't be smelted because the material would skadoodle BREAKS, //can't be smelted because the material doesn't survive the temperatures - SMELTABLE, //metal, mostly + SMELTABLE, //mostly metal ADDITIVE //stuff like coal which isn't smeltable but can be put in a crucible anyway } } diff --git a/src/main/java/com/hbm/inventory/recipes/BlastFurnaceRecipes.java b/src/main/java/com/hbm/inventory/recipes/BlastFurnaceRecipes.java index 4657e1175..88ebcd006 100644 --- a/src/main/java/com/hbm/inventory/recipes/BlastFurnaceRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/BlastFurnaceRecipes.java @@ -41,8 +41,13 @@ public class BlastFurnaceRecipes { } static { - addRecipe(IRON, COAL, new ItemStack(ModItems.ingot_steel, 2)); - addRecipe(IRON, ANY_COKE, new ItemStack(ModItems.ingot_steel, 2)); + /* STEEL */ + addRecipe(IRON, COAL, new ItemStack(ModItems.ingot_steel, 1)); + addRecipe(IRON, ANY_COKE, new ItemStack(ModItems.ingot_steel, 1)); + addRecipe(IRON.ore(), COAL, new ItemStack(ModItems.ingot_steel, 2)); + addRecipe(IRON.ore(), ANY_COKE, new ItemStack(ModItems.ingot_steel, 3)); + addRecipe(IRON.ore(), new ComparableStack(ModItems.powder_flux), new ItemStack(ModItems.ingot_steel, 3)); + addRecipe(CU, REDSTONE, new ItemStack(ModItems.ingot_red_copper, 2)); addRecipe(STEEL, MINGRADE, new ItemStack(ModItems.ingot_advanced_alloy, 2)); addRecipe(W, COAL, new ItemStack(ModItems.neutron_reflector, 2)); diff --git a/src/main/java/com/hbm/inventory/recipes/CrucibleRecipes.java b/src/main/java/com/hbm/inventory/recipes/CrucibleRecipes.java index 88e5d83bf..723088c6e 100644 --- a/src/main/java/com/hbm/inventory/recipes/CrucibleRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/CrucibleRecipes.java @@ -47,21 +47,21 @@ public class CrucibleRecipes extends SerializableRecipe { int n = MaterialShapes.NUGGET.q(1); int i = MaterialShapes.INGOT.q(1); - recipes.add(new CrucibleRecipe(0, "crucible.steel", 1, new ItemStack(ModItems.ingot_steel)) - .inputs(new MaterialStack(Mats.MAT_IRON, n), new MaterialStack(Mats.MAT_COAL, n)) - .outputs(new MaterialStack(Mats.MAT_STEEL, n))); + recipes.add(new CrucibleRecipe(0, "crucible.steel", 2, new ItemStack(ModItems.ingot_steel)) + .inputs(new MaterialStack(Mats.MAT_IRON, n * 2), new MaterialStack(Mats.MAT_CARBON, n)) + .outputs(new MaterialStack(Mats.MAT_STEEL, n * 2))); - recipes.add(new CrucibleRecipe(6, "crucible.steel_flux", 9, new ItemStack(ModItems.ingot_steel)) + /*recipes.add(new CrucibleRecipe(6, "crucible.steel_flux", 9, new ItemStack(ModItems.ingot_steel)) .inputs(new MaterialStack(Mats.MAT_IRON, i), new MaterialStack(Mats.MAT_COAL, n * 4), new MaterialStack(Mats.MAT_FLUX, n)) - .outputs(new MaterialStack(Mats.MAT_STEEL, i))); + .outputs(new MaterialStack(Mats.MAT_STEEL, i)));*/ //TODO: unify coal types into carbon with varying yield - recipes.add(new CrucibleRecipe(7, "crucible.hematite", 9, DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.HEMATITE)) - .inputs(new MaterialStack(Mats.MAT_HEMATITE, i), new MaterialStack(Mats.MAT_FLUX, n)) - .outputs(new MaterialStack(Mats.MAT_IRON, i))); + recipes.add(new CrucibleRecipe(7, "crucible.hematite", 6, DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.HEMATITE)) + .inputs(new MaterialStack(Mats.MAT_HEMATITE, i * 2), new MaterialStack(Mats.MAT_FLUX, n * 2)) + .outputs(new MaterialStack(Mats.MAT_IRON, i), new MaterialStack(Mats.MAT_SLAG, n * 3))); - recipes.add(new CrucibleRecipe(8, "crucible.malachite", 9, DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.MALACHITE)) - .inputs(new MaterialStack(Mats.MAT_MALACHITE, i), new MaterialStack(Mats.MAT_FLUX, n)) - .outputs(new MaterialStack(Mats.MAT_COPPER, i))); + recipes.add(new CrucibleRecipe(8, "crucible.malachite", 6, DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.MALACHITE)) + .inputs(new MaterialStack(Mats.MAT_MALACHITE, i * 2), new MaterialStack(Mats.MAT_FLUX, n * 2)) + .outputs(new MaterialStack(Mats.MAT_COPPER, i), new MaterialStack(Mats.MAT_SLAG, n * 3))); recipes.add(new CrucibleRecipe(1, "crucible.redcopper", 2, new ItemStack(ModItems.ingot_red_copper)) .inputs(new MaterialStack(Mats.MAT_COPPER, n), new MaterialStack(Mats.MAT_REDSTONE, n)) @@ -76,11 +76,11 @@ public class CrucibleRecipes extends SerializableRecipe { .outputs(new MaterialStack(Mats.MAT_DURA, n * 4))); recipes.add(new CrucibleRecipe(4, "crucible.ferro", 3, new ItemStack(ModItems.ingot_ferrouranium)) - .inputs(new MaterialStack(Mats.MAT_STEEL, n * 2), new MaterialStack(Mats.MAT_U238, n), new MaterialStack(Mats.MAT_COAL, n)) + .inputs(new MaterialStack(Mats.MAT_STEEL, n * 2), new MaterialStack(Mats.MAT_U238, n)) .outputs(new MaterialStack(Mats.MAT_FERRO, n * 3))); recipes.add(new CrucibleRecipe(5, "crucible.tcalloy", 9, new ItemStack(ModItems.ingot_tcalloy)) - .inputs(new MaterialStack(Mats.MAT_STEEL, n * 8), new MaterialStack(Mats.MAT_TECHNIETIUM, n), new MaterialStack(Mats.MAT_COAL, n * 4)) + .inputs(new MaterialStack(Mats.MAT_STEEL, n * 8), new MaterialStack(Mats.MAT_TECHNIETIUM, n)) .outputs(new MaterialStack(Mats.MAT_TCALLOY, i))); registerMoldsForNEI(); @@ -219,6 +219,8 @@ public class CrucibleRecipes extends SerializableRecipe { HashMap> map = new HashMap(); for(NTMMaterial material : Mats.orderedList) { + double mult = material.smeltingRatio; + material = material.smeltsInto; for(MaterialShapes shape : MaterialShapes.allShapes) { //TODO: buffer these @@ -227,7 +229,7 @@ public class CrucibleRecipes extends SerializableRecipe { if(!ores.isEmpty()) { List stacks = new ArrayList(); - stacks.add(ItemScraps.create(new MaterialStack(material, shape.q(1)))); + stacks.add(ItemScraps.create(new MaterialStack(material, (int) (shape.q(1) * mult)))); map.put(new OreDictStack(name), stacks); } } diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 6100c7882..b7f36e23c 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -59,11 +59,13 @@ public class CraftingManager { GameRegistry.addRecipe(new MKUCraftingHandler()); GameRegistry.addRecipe(new ToolboxCraftingHandler()); GameRegistry.addRecipe(new CargoShellCraftingHandler()); + GameRegistry.addRecipe(new ScrapsCraftingHandler()); //TODO: find out what this actually did RecipeSorter.register("hbm:rbmk", RBMKFuelCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); RecipeSorter.register("hbm:toolbox", ToolboxCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); RecipeSorter.register("hbm:cargo", CargoShellCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); + RecipeSorter.register("hbm:scraps", ScrapsCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); RecipeSorter.register("hbm:mku", MKUCraftingHandler.class, RecipeSorter.Category.SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCrucible.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCrucible.java index 91a84d522..1056ef9ed 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCrucible.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCrucible.java @@ -262,7 +262,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro if(this.progress >= processTime) { this.progress = 0; - List materials = Mats.getMaterialsFromItem(slots[slot]); + List materials = Mats.getSmeltingMaterialsFromItem(slots[slot]); CrucibleRecipe recipe = getLoadedRecipe(); for(MaterialStack material : materials) { @@ -335,7 +335,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro public boolean isItemSmeltable(ItemStack stack) { - List materials = Mats.getMaterialsFromItem(stack); + List materials = Mats.getSmeltingMaterialsFromItem(stack); //if there's no materials in there at all, don't smelt if(materials.isEmpty()) diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 964cb6045..9b981952a 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -720,6 +720,15 @@ hbmmat.uranium238=Uran-238 hbmmat.whitephosphorus=Weißer Phosphor hbmmat.workersalloy=Desh +matshape.block=%s Block +matshape.blocks=%s Blöcke +matshape.ingot=%s Barren +matshape.ingots=%s Barren +matshape.nugget=%s Nugget +matshape.nuggets=%s Nuggets +matshape.quantum=%s Quantum +matshape.quanta=%s Quanta + info.asbestos=Meine Lunge brennt. info.coaldust=Das Atmen fällt mir schwer. info.coil=Spulenstärke diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 14cc5391c..10b965797 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -948,6 +948,15 @@ hbmmat.uranium238=Uranium-238 hbmmat.whitephosphorus=White Phosphorus hbmmat.workersalloy=Desh +matshape.block=%s Block +matshape.blocks=%s Blocks +matshape.ingot=%s Ingot +matshape.ingots=%s Ingots +matshape.nugget=%s Nugget +matshape.nuggets=%s Nuggets +matshape.quantum=%s Quantum +matshape.quanta=%s Quanta + info.asbestos=My lungs are burning. info.coaldust=It's hard to breathe here. info.coil=Coil Strength diff --git a/src/main/resources/assets/hbm/textures/blocks/block_slag.png b/src/main/resources/assets/hbm/textures/blocks/block_slag.png new file mode 100644 index 0000000000000000000000000000000000000000..d8ea11f73f10009812446eb6c062899e40737756 GIT binary patch literal 423 zcmV;Y0a*TtP)SO(o1`!x19sb{V!6q{*z}>&`2=ZIDsXKBAMgw zpWl_4^xo;c0}v6I8JUTm-aBT-7y~ooJWn2v2L@nfxcd#{I1WlFm>H@mr2uS@-aB4v zy)|jtoRf&yO}%$oYnT~pEyfrCUjTs2WUWOh<+eg8h0G)~nR7DdL_;5s2cDT56~Ns$ zZ7~oVfH^1bz5!j+MPJ`$MnuqBBQyE=`N7PnweGbxz!(E}$K8pDt%*)Ca`)Y+Aue^b zLht=1obInR?!KMyh}cslmi*UbfkgzzaqxUT8Do5HJkOIkC!f!Ui1-iSx`xDTt!-eJ zr=l(Ubn0E=)>_HT?SxB|tC(hX1Ja$cA^-q?yF~$y&61z2!-|zQ(?{#ff zV3d>0q_xIci{m)HE~r?7Uc+>av+TU~cto()y8Ve-K@9-4R@{9%5D}c`$v*)*HiH+c R_>lkr002ovPDHLkV1oU>y*2;< literal 0 HcmV?d00001