diff --git a/gradle.properties b/gradle.properties index f1a9549c5..6efd5257d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,4 +11,4 @@ credits=HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion al \ Sten89 (models), Pixelguru26 (textures), TheBlueHat (textures), Alcater (GUI textures, porting), impbk2002 (project settings),\ \ OvermindDL1 (project settings), TehTemmie (reacher radiation function), Toshayo (satellite loot system, project settings), Silly541 (config for safe ME drives),\ \ Voxelstice (OpenComputers integration, turbine spinup), martemen (project settings), Pvndols (thorium fuel recipe, gas turbine), JamesH2 (blood, nitric acid),\ - \ sdddddf80 (mixer recipe config), SuperCraftAlex (tooltips) \ No newline at end of file + \ sdddddf80 (recipe configs), SuperCraftAlex (tooltips) \ No newline at end of file diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index cc7647629..df260fd8e 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -3172,10 +3172,10 @@ public class ModBlocks { GameRegistry.registerBlock(machine_storage_drum, machine_storage_drum.getUnlocalizedName()); GameRegistry.registerBlock(machine_shredder, machine_shredder.getUnlocalizedName()); GameRegistry.registerBlock(machine_shredder_large, machine_shredder_large.getUnlocalizedName()); - GameRegistry.registerBlock(machine_well, machine_well.getUnlocalizedName()); - GameRegistry.registerBlock(machine_pumpjack, machine_pumpjack.getUnlocalizedName()); - GameRegistry.registerBlock(machine_fracking_tower, machine_fracking_tower.getUnlocalizedName()); - GameRegistry.registerBlock(machine_flare, ItemBlockBase.class, machine_flare.getUnlocalizedName()); + register(machine_well); + register(machine_pumpjack); + register(machine_fracking_tower); + register(machine_flare); register(machine_refinery); register(machine_vacuum_distill); GameRegistry.registerBlock(machine_fraction_tower, machine_fraction_tower.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/machine/MachineFluidTank.java b/src/main/java/com/hbm/blocks/machine/MachineFluidTank.java index 92b5e814f..9e1641ca2 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineFluidTank.java +++ b/src/main/java/com/hbm/blocks/machine/MachineFluidTank.java @@ -26,7 +26,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; @@ -89,27 +88,11 @@ public class MachineFluidTank extends BlockDummyable implements IPersistentInfoP this.makeExtra(world, x - dir.offsetX - 1, y, z - dir.offsetZ + 1); this.makeExtra(world, x - dir.offsetX - 1, y, z - dir.offsetZ - 1); } - - @Override - public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) { - - if(!player.capabilities.isCreativeMode) { - harvesters.set(player); - this.dropBlockAsItem(world, x, y, z, meta, 0); - harvesters.set(null); - } - } @Override public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { return IPersistentNBT.getDrops(world, x, y, z, this); } - - @Override - public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) { - player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1); - player.addExhaustion(0.025F); - } @Override public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) { diff --git a/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java b/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java index 5b198ed09..9383b3565 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java +++ b/src/main/java/com/hbm/blocks/machine/MachineFrackingTower.java @@ -1,19 +1,31 @@ package com.hbm.blocks.machine; +import java.util.ArrayList; +import java.util.List; + import com.hbm.blocks.BlockDummyable; +import com.hbm.blocks.IPersistentInfoProvider; import com.hbm.handler.MultiblockHandlerXR; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.main.MainRegistry; +import com.hbm.tileentity.IPersistentNBT; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.oil.TileEntityMachineFrackingTower; +import com.hbm.util.BobMathUtil; +import com.hbm.util.I18nUtil; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class MachineFrackingTower extends BlockDummyable { +public class MachineFrackingTower extends BlockDummyable implements IPersistentInfoProvider { public MachineFrackingTower() { super(Material.iron); @@ -89,4 +101,19 @@ public class MachineFrackingTower extends BlockDummyable { return true; } } + + @Override + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + return IPersistentNBT.getDrops(world, x, y, z, this); + } + + @Override + public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) { + list.add(EnumChatFormatting.GREEN + BobMathUtil.getShortNumber(persistentTag.getLong("power")) + "HE"); + for(int i = 0; i < 2; i++) { + FluidTank tank = new FluidTank(Fluids.NONE, 0); + tank.readFromNBT(persistentTag, "t" + i); + list.add(EnumChatFormatting.YELLOW + "" + tank.getFill() + "/" + tank.getMaxFill() + "mB " + I18nUtil.resolveKey(tank.getTankType().getUnlocalizedName())); + } + } } diff --git a/src/main/java/com/hbm/blocks/machine/MachineOilWell.java b/src/main/java/com/hbm/blocks/machine/MachineOilWell.java index 6e0e85968..bdd36a179 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineOilWell.java +++ b/src/main/java/com/hbm/blocks/machine/MachineOilWell.java @@ -1,18 +1,30 @@ package com.hbm.blocks.machine; +import java.util.ArrayList; +import java.util.List; + import com.hbm.blocks.BlockDummyable; +import com.hbm.blocks.IPersistentInfoProvider; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.main.MainRegistry; +import com.hbm.tileentity.IPersistentNBT; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.oil.TileEntityMachineOilWell; +import com.hbm.util.BobMathUtil; +import com.hbm.util.I18nUtil; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class MachineOilWell extends BlockDummyable { +public class MachineOilWell extends BlockDummyable implements IPersistentInfoProvider { public MachineOilWell() { super(Material.iron); @@ -63,4 +75,19 @@ public class MachineOilWell extends BlockDummyable { return true; } } + + @Override + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + return IPersistentNBT.getDrops(world, x, y, z, this); + } + + @Override + public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) { + list.add(EnumChatFormatting.GREEN + BobMathUtil.getShortNumber(persistentTag.getLong("power")) + "HE"); + for(int i = 0; i < 2; i++) { + FluidTank tank = new FluidTank(Fluids.NONE, 0); + tank.readFromNBT(persistentTag, "t" + i); + list.add(EnumChatFormatting.YELLOW + "" + tank.getFill() + "/" + tank.getMaxFill() + "mB " + I18nUtil.resolveKey(tank.getTankType().getUnlocalizedName())); + } + } } diff --git a/src/main/java/com/hbm/blocks/machine/MachinePumpjack.java b/src/main/java/com/hbm/blocks/machine/MachinePumpjack.java index 311995331..89169d863 100644 --- a/src/main/java/com/hbm/blocks/machine/MachinePumpjack.java +++ b/src/main/java/com/hbm/blocks/machine/MachinePumpjack.java @@ -1,19 +1,31 @@ package com.hbm.blocks.machine; +import java.util.ArrayList; +import java.util.List; + import com.hbm.blocks.BlockDummyable; +import com.hbm.blocks.IPersistentInfoProvider; import com.hbm.handler.MultiblockHandlerXR; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.main.MainRegistry; +import com.hbm.tileentity.IPersistentNBT; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.oil.TileEntityMachinePumpjack; +import com.hbm.util.BobMathUtil; +import com.hbm.util.I18nUtil; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class MachinePumpjack extends BlockDummyable { +public class MachinePumpjack extends BlockDummyable implements IPersistentInfoProvider { public MachinePumpjack() { super(Material.iron); @@ -76,4 +88,19 @@ public class MachinePumpjack extends BlockDummyable { return true; } } + + @Override + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + return IPersistentNBT.getDrops(world, x, y, z, this); + } + + @Override + public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) { + list.add(EnumChatFormatting.GREEN + BobMathUtil.getShortNumber(persistentTag.getLong("power")) + "HE"); + for(int i = 0; i < 2; i++) { + FluidTank tank = new FluidTank(Fluids.NONE, 0); + tank.readFromNBT(persistentTag, "t" + i); + list.add(EnumChatFormatting.YELLOW + "" + tank.getFill() + "/" + tank.getMaxFill() + "mB " + I18nUtil.resolveKey(tank.getTankType().getUnlocalizedName())); + } + } } diff --git a/src/main/java/com/hbm/inventory/OreDictManager.java b/src/main/java/com/hbm/inventory/OreDictManager.java index 58a863dea..803de8b08 100644 --- a/src/main/java/com/hbm/inventory/OreDictManager.java +++ b/src/main/java/com/hbm/inventory/OreDictManager.java @@ -488,11 +488,11 @@ public class OreDictManager { String dyeName = "dye" + dyes[i]; OreDictionary.registerOre(dyeName, new ItemStack(ModItems.chemical_dye, 1, i)); - OreDictionary.registerOre("dye", new ItemStack(ModItems.chemical_dye, 1, i)); OreDictionary.registerOre(dyeName, new ItemStack(ModItems.crayon, 1, i)); - OreDictionary.registerOre("dye", new ItemStack(ModItems.crayon, 1, i)); } + OreDictionary.registerOre("dye", new ItemStack(chemical_dye, 1, OreDictionary.WILDCARD_VALUE)); + OreDictionary.registerOre("dye", new ItemStack(crayon, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("dyeRed", cinnebar); OreDictionary.registerOre("dye", cinnebar); @@ -513,7 +513,7 @@ public class OreDictManager { OreDictionary.registerOre("dyeGray", fromOne(oil_tar, EnumTarType.COAL)); OreDictionary.registerOre("dyeBrown", fromOne(oil_tar, EnumTarType.WOOD)); OreDictionary.registerOre("dyeCyan", fromOne(oil_tar, EnumTarType.WAX)); - OreDictionary.registerOre("dye", oil_tar); + OreDictionary.registerOre("dye", new ItemStack(oil_tar, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("blockGlass", glass_boron); OreDictionary.registerOre("blockGlass", glass_lead); diff --git a/src/main/java/com/hbm/inventory/recipes/BreederRecipes.java b/src/main/java/com/hbm/inventory/recipes/BreederRecipes.java index 76d9f4a9b..7503b3dec 100644 --- a/src/main/java/com/hbm/inventory/recipes/BreederRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/BreederRecipes.java @@ -1,20 +1,28 @@ package com.hbm.inventory.recipes; +import java.io.IOException; import java.util.HashMap; import java.util.Map; +import java.util.Map.Entry; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.stream.JsonWriter; +import com.hbm.inventory.RecipesCommon.AStack; import com.hbm.inventory.RecipesCommon.ComparableStack; +import com.hbm.inventory.recipes.loader.SerializableRecipe; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemBreedingRod.*; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class BreederRecipes { +public class BreederRecipes extends SerializableRecipe { private static HashMap recipes = new HashMap(); - - public static void registerRecipes() { + + @Override + public void registerDefaults() { setRecipe(BreedingRodType.LITHIUM, BreedingRodType.TRITIUM, 200); setRecipe(BreedingRodType.CO, BreedingRodType.CO60, 100); @@ -73,4 +81,40 @@ public class BreederRecipes { } } + @Override + public String getFileName() { + return "hbmBreeder.json"; + } + + @Override + public Object getRecipeObject() { + return recipes; + } + + @Override + public void readRecipe(JsonElement recipe) { + JsonObject obj = (JsonObject) recipe; + + AStack in = this.readAStack(obj.get("input").getAsJsonArray()); + int flux = obj.get("flux").getAsInt(); + ItemStack out = this.readItemStack(obj.get("output").getAsJsonArray()); + recipes.put(((ComparableStack) in), new BreederRecipe(out, flux)); + } + + @Override + public void writeRecipe(Object recipe, JsonWriter writer) throws IOException { + Entry rec = (Entry) recipe; + ComparableStack in = rec.getKey(); + + writer.name("input"); + this.writeAStack(in, writer); + writer.name("flux").value(rec.getValue().flux); + writer.name("output"); + this.writeItemStack(rec.getValue().output, writer); + } + + @Override + public void deleteRecipes() { + recipes.clear(); + } } diff --git a/src/main/java/com/hbm/inventory/recipes/CombinationRecipes.java b/src/main/java/com/hbm/inventory/recipes/CombinationRecipes.java index c0cbc39d6..fa3b7ffaa 100644 --- a/src/main/java/com/hbm/inventory/recipes/CombinationRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/CombinationRecipes.java @@ -1,15 +1,21 @@ package com.hbm.inventory.recipes; +import java.io.IOException; import java.util.HashMap; import java.util.Map.Entry; import static com.hbm.inventory.OreDictManager.*; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.stream.JsonWriter; import com.hbm.inventory.FluidStack; import com.hbm.inventory.OreDictManager.DictFrame; +import com.hbm.inventory.RecipesCommon.AStack; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.RecipesCommon.OreDictStack; import com.hbm.inventory.fluid.Fluids; +import com.hbm.inventory.recipes.loader.SerializableRecipe; import com.hbm.items.ItemEnums.EnumBriquetteType; import com.hbm.items.ItemEnums.EnumCokeType; import com.hbm.items.ItemEnums.EnumTarType; @@ -20,11 +26,12 @@ import com.hbm.util.Tuple.Pair; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -public class CombinationRecipes { +public class CombinationRecipes extends SerializableRecipe { private static HashMap> recipes = new HashMap(); - - public static void register() { + + @Override + public void registerDefaults() { recipes.put(COAL.gem(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), new FluidStack(Fluids.COALCREOSOTE, 100))); recipes.put(COAL.dust(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), new FluidStack(Fluids.COALCREOSOTE, 100))); recipes.put(new ComparableStack(DictFrame.fromOne(ModItems.briquette, EnumBriquetteType.COAL)), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), new FluidStack(Fluids.COALCREOSOTE, 150))); @@ -94,4 +101,60 @@ public class CombinationRecipes { return recipes; } + + @Override + public String getFileName() { + return "hbmCombination.json"; + } + + @Override + public Object getRecipeObject() { + return recipes; + } + + @Override + public void readRecipe(JsonElement recipe) { + JsonObject obj = (JsonObject) recipe; + AStack in = this.readAStack(obj.get("input").getAsJsonArray()); + FluidStack fluid = null; + ItemStack out = null; + + if(obj.has("fluid")) fluid = this.readFluidStack(obj.get("fluid").getAsJsonArray()); + if(obj.has("output")) out = this.readItemStack(obj.get("output").getAsJsonArray()); + + if(in instanceof ComparableStack) { + recipes.put(((ComparableStack) in).makeSingular(), new Pair(out, fluid)); + } else if(in instanceof OreDictStack) { + recipes.put(((OreDictStack) in).name, new Pair(out, fluid)); + } + } + + @Override + public void writeRecipe(Object recipe, JsonWriter writer) throws IOException { + Entry rec = (Entry) recipe; + Object in = rec.getKey(); + Pair Pair = rec.getValue(); + ItemStack output = Pair.key; + FluidStack fluid = Pair.value; + + writer.name("input"); + if(in instanceof String) { + this.writeAStack(new OreDictStack((String) in), writer); + } else if(in instanceof ComparableStack) { + this.writeAStack((ComparableStack) in, writer); + } + if(output != null) { + writer.name("output"); + this.writeItemStack(output, writer); + } + if(fluid != null) { + writer.name("fluid"); + this.writeFluidStack(fluid, writer); + } + } + + @Override + public void deleteRecipes() { + recipes.clear(); + } } diff --git a/src/main/java/com/hbm/inventory/recipes/CrystallizerRecipes.java b/src/main/java/com/hbm/inventory/recipes/CrystallizerRecipes.java index 30dc782d0..577e98bdd 100644 --- a/src/main/java/com/hbm/inventory/recipes/CrystallizerRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/CrystallizerRecipes.java @@ -1,17 +1,24 @@ package com.hbm.inventory.recipes; +import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import static com.hbm.inventory.OreDictManager.*; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.stream.JsonWriter; import com.hbm.blocks.ModBlocks; import com.hbm.handler.imc.IMCCrystallizer; import com.hbm.inventory.FluidStack; +import com.hbm.inventory.RecipesCommon.AStack; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.RecipesCommon.OreDictStack; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; +import com.hbm.inventory.recipes.loader.SerializableRecipe; import com.hbm.items.ItemEnums.EnumTarType; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemChemicalDye.EnumChemDye; @@ -30,12 +37,13 @@ import net.minecraftforge.oredict.OreDictionary; //This time we're doing this right //...right? -public class CrystallizerRecipes { +public class CrystallizerRecipes extends SerializableRecipe { //'Object' is either a ComparableStack or the key for the ore dict private static HashMap, CrystallizerRecipe> recipes = new HashMap(); - - public static void register() { + + @Override + public void registerDefaults() { int baseTime = 600; int utilityTime = 100; @@ -212,4 +220,54 @@ public class CrystallizerRecipes { this.acidAmount = 500; } } + + @Override + public String getFileName() { + return "hbmCrystallizer.json"; + } + + @Override + public Object getRecipeObject() { + return recipes; + } + + @Override + public void readRecipe(JsonElement recipe) { + JsonObject obj = (JsonObject) recipe; + + ItemStack output = this.readItemStack(obj.get("output").getAsJsonArray()); + AStack input = this.readAStack(obj.get("input").getAsJsonArray()); + FluidStack fluid = this.readFluidStack(obj.get("fluid").getAsJsonArray()); + int duration = obj.get("duration").getAsInt(); + + CrystallizerRecipe cRecipe = new CrystallizerRecipe(output, duration); + cRecipe.acidAmount = fluid.fill; + if(input instanceof ComparableStack) { + recipes.put(new Pair(((ComparableStack) input).makeSingular(), fluid.type), cRecipe); + } else if(input instanceof OreDictStack) { + recipes.put(new Pair(((OreDictStack) input).name, fluid.type), cRecipe); + } + } + + @Override + public void writeRecipe(Object recipe, JsonWriter writer) throws IOException { + Entry rec = (Entry) recipe; + CrystallizerRecipe cRecipe = rec.getValue(); + Pair pair = rec.getKey(); + AStack input = pair.getKey() instanceof String ? new OreDictStack((String )pair.getKey()) : (ComparableStack) pair.getKey(); + FluidStack fluid = new FluidStack(pair.value, cRecipe.acidAmount); + + writer.name("duration").value(cRecipe.duration); + writer.name("fluid"); + this.writeFluidStack(fluid, writer); + writer.name("input"); + this.writeAStack(input, writer); + writer.name("output"); + this.writeItemStack(cRecipe.output, writer); + } + + @Override + public void deleteRecipes() { + recipes.clear(); + } } diff --git a/src/main/java/com/hbm/inventory/recipes/PressRecipes.java b/src/main/java/com/hbm/inventory/recipes/PressRecipes.java index b0dcb263b..1186eb481 100644 --- a/src/main/java/com/hbm/inventory/recipes/PressRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/PressRecipes.java @@ -1,12 +1,18 @@ package com.hbm.inventory.recipes; +import java.io.IOException; import java.util.HashMap; import java.util.Map.Entry; import static com.hbm.inventory.OreDictManager.*; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.stream.JsonWriter; import com.hbm.inventory.RecipesCommon.AStack; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.RecipesCommon.OreDictStack; +import com.hbm.inventory.recipes.loader.SerializableRecipe; import com.hbm.items.ItemEnums.EnumBriquetteType; import com.hbm.items.ItemAmmoEnums.Ammo357Magnum; import com.hbm.items.ItemAmmoEnums.Ammo556mm; @@ -20,7 +26,7 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class PressRecipes { +public class PressRecipes extends SerializableRecipe { public static HashMap, ItemStack> recipes = new HashMap(); @@ -42,8 +48,9 @@ public class PressRecipes { return null; } - - public static void register() { + + @Override + public void registerDefaults() { makeRecipe(StampType.FLAT, new OreDictStack(NETHERQUARTZ.dust()), Items.quartz); makeRecipe(StampType.FLAT, new OreDictStack(LAPIS.dust()), new ItemStack(Items.dye, 1, 4)); @@ -114,4 +121,43 @@ public class PressRecipes { public static void makeRecipe(StampType type, AStack in, ItemStack out) { recipes.put(new Pair(in, type), out); } + + @Override + public String getFileName() { + return "hbmPress.json"; + } + + @Override + public Object getRecipeObject() { + return recipes; + } + + @Override + public void readRecipe(JsonElement recipe) { + JsonObject obj = (JsonObject) recipe; + + AStack input = this.readAStack(obj.get("input").getAsJsonArray()); + StampType stamp = StampType.valueOf(obj.get("stamp").getAsString().toUpperCase()); + ItemStack output = this.readItemStack(obj.get("output").getAsJsonArray()); + + if(stamp != null) { + makeRecipe(stamp, input, output); + } + } + + @Override + public void writeRecipe(Object recipe, JsonWriter writer) throws IOException { + Entry, ItemStack> entry = (Entry, ItemStack>) recipe; + + writer.name("input"); + this.writeAStack(entry.getKey().getKey(), writer); + writer.name("stamp").value(entry.getKey().getValue().name().toLowerCase()); + writer.name("output"); + this.writeItemStack(entry.getValue(), writer); + } + + @Override + public void deleteRecipes() { + recipes.clear(); + } } diff --git a/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java b/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java index e786e20d7..1dc2895a4 100644 --- a/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java +++ b/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java @@ -39,15 +39,19 @@ public abstract class SerializableRecipe { */ public static void registerAllHandlers() { + recipeHandlers.add(new PressRecipes()); recipeHandlers.add(new BlastFurnaceRecipes()); recipeHandlers.add(new ShredderRecipes()); recipeHandlers.add(new ChemplantRecipes()); + recipeHandlers.add(new CombinationRecipes()); recipeHandlers.add(new CrucibleRecipes()); recipeHandlers.add(new CentrifugeRecipes()); + recipeHandlers.add(new CrystallizerRecipes()); recipeHandlers.add(new FractionRecipes()); recipeHandlers.add(new CrackingRecipes()); recipeHandlers.add(new LiquefactionRecipes()); recipeHandlers.add(new SolidificationRecipes()); + recipeHandlers.add(new BreederRecipes()); recipeHandlers.add(new CyclotronRecipes()); recipeHandlers.add(new HadronRecipes()); recipeHandlers.add(new FuelPoolRecipes()); @@ -211,7 +215,7 @@ public abstract class SerializableRecipe { ComparableStack comp = (ComparableStack) astack; writer.value("item"); //ITEM identifier writer.value(Item.itemRegistry.getNameForObject(comp.toStack().getItem())); //item name - if(comp.stacksize != 1) writer.value(comp.stacksize); //stack size + if(comp.stacksize != 1 || comp.meta > 0) writer.value(comp.stacksize); //stack size if(comp.meta > 0) writer.value(comp.meta); //metadata } if(astack instanceof OreDictStack) { diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index 441c8627d..1b3af8b6b 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -775,17 +775,13 @@ public class MainRegistry { @EventHandler public static void PostLoad(FMLPostInitializationEvent PostEvent) { - CrystallizerRecipes.register(); TileEntityNukeFurnace.registerFuels(); - BreederRecipes.registerRecipes(); AssemblerRecipes.loadRecipes(); MagicRecipes.register(); SILEXRecipes.register(); AnvilRecipes.register(); - PressRecipes.register(); RefineryRecipes.registerRefinery(); GasCentrifugeRecipes.register(); - CombinationRecipes.register(); //the good stuff SerializableRecipe.registerAllHandlers(); diff --git a/src/main/java/com/hbm/main/ModEventHandlerImpact.java b/src/main/java/com/hbm/main/ModEventHandlerImpact.java index c278a2c5e..fbad76c79 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerImpact.java +++ b/src/main/java/com/hbm/main/ModEventHandlerImpact.java @@ -138,7 +138,7 @@ public class ModEventHandlerImpact { TomSaveData data = TomSaveData.getLastCachedOrNull(); - if(event.biome == null) { + if(data == null || event.biome == null) { return; } diff --git a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityOilDrillBase.java b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityOilDrillBase.java index 8ddfb7867..307c87f9e 100644 --- a/src/main/java/com/hbm/tileentity/machine/oil/TileEntityOilDrillBase.java +++ b/src/main/java/com/hbm/tileentity/machine/oil/TileEntityOilDrillBase.java @@ -16,6 +16,7 @@ import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.lib.Library; import com.hbm.tileentity.IConfigurableMachine; import com.hbm.tileentity.IGUIProvider; +import com.hbm.tileentity.IPersistentNBT; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.util.BobMathUtil; import com.hbm.util.Tuple; @@ -33,8 +34,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; -public abstract class TileEntityOilDrillBase extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IFluidStandardTransceiver, IConfigurableMachine, IGUIProvider { - +public abstract class TileEntityOilDrillBase extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IFluidStandardTransceiver, IConfigurableMachine, IPersistentNBT, IGUIProvider { + public int indicator = 0; public long power; @@ -54,6 +55,7 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); + this.power = nbt.getLong("power"); for(int i = 0; i < this.tanks.length; i++) this.tanks[i].readFromNBT(nbt, "t" + i); } @@ -62,10 +64,32 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); + nbt.setLong("power", power); for(int i = 0; i < this.tanks.length; i++) this.tanks[i].writeToNBT(nbt, "t" + i); } + @Override + public void writeNBT(NBTTagCompound nbt) { + + boolean empty = power == 0; + for(FluidTank tank : tanks) if(tank.getFill() > 0) empty = false; + + if(!empty) { + nbt.setLong("power", power); + for(int i = 0; i < this.tanks.length; i++) { + this.tanks[i].writeToNBT(nbt, "t" + i); + } + } + } + + @Override + public void readNBT(NBTTagCompound nbt) { + this.power = nbt.getLong("power"); + for(int i = 0; i < this.tanks.length; i++) + this.tanks[i].readFromNBT(nbt, "t" + i); + } + public int speedLevel; public int energyLevel; public int overLevel; diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_base.png b/src/main/resources/assets/hbm/textures/blocks/modgen_base.png deleted file mode 100644 index 1b3599da6..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_base.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_base_blank.png b/src/main/resources/assets/hbm/textures/blocks/modgen_base_blank.png deleted file mode 100644 index f11af6732..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_base_blank.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_base_core.png b/src/main/resources/assets/hbm/textures/blocks/modgen_base_core.png deleted file mode 100644 index e8baf735b..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_base_core.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_base_panel.png b/src/main/resources/assets/hbm/textures/blocks/modgen_base_panel.png deleted file mode 100644 index 797ad0159..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_base_panel.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_battery.png b/src/main/resources/assets/hbm/textures/blocks/modgen_battery.png deleted file mode 100644 index 8a6898a6e..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_battery.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_boiler.png b/src/main/resources/assets/hbm/textures/blocks/modgen_boiler.png deleted file mode 100644 index 84b83831c..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_boiler.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_breeder.png b/src/main/resources/assets/hbm/textures/blocks/modgen_breeder.png deleted file mode 100644 index a9f11c948..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_breeder.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_control.png b/src/main/resources/assets/hbm/textures/blocks/modgen_control.png deleted file mode 100644 index abcc58f91..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_control.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_diesel.png b/src/main/resources/assets/hbm/textures/blocks/modgen_diesel.png deleted file mode 100644 index 9ef27d2f8..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_diesel.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer.png b/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer.png deleted file mode 100644 index fccadf412..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer_blue.png b/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer_blue.png deleted file mode 100644 index 0e07dd3a0..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer_blue.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer_green.png b/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer_green.png deleted file mode 100644 index 6891b10b9..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer_green.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer_red.png b/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer_red.png deleted file mode 100644 index e8b87002c..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_enhancer_red.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_fluid_in.png b/src/main/resources/assets/hbm/textures/blocks/modgen_fluid_in.png deleted file mode 100644 index 3ffcb7840..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_fluid_in.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_fluid_out.png b/src/main/resources/assets/hbm/textures/blocks/modgen_fluid_out.png deleted file mode 100644 index abfe76d52..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_fluid_out.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_heater.png b/src/main/resources/assets/hbm/textures/blocks/modgen_heater.png deleted file mode 100644 index b0c2dcfea..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_heater.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_heater_lit.png b/src/main/resources/assets/hbm/textures/blocks/modgen_heater_lit.png deleted file mode 100644 index 6462a5f6b..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_heater_lit.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_nuclear.png b/src/main/resources/assets/hbm/textures/blocks/modgen_nuclear.png deleted file mode 100644 index c33073dc2..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_nuclear.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_nuclear2.png b/src/main/resources/assets/hbm/textures/blocks/modgen_nuclear2.png deleted file mode 100644 index 1e50d2e32..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_nuclear2.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_nuclear3.png b/src/main/resources/assets/hbm/textures/blocks/modgen_nuclear3.png deleted file mode 100644 index 2f41896db..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_nuclear3.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_port.png b/src/main/resources/assets/hbm/textures/blocks/modgen_port.png deleted file mode 100644 index 00ee51d05..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_port.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_power.png b/src/main/resources/assets/hbm/textures/blocks/modgen_power.png deleted file mode 100644 index be2c10aae..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_power.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_smelter.png b/src/main/resources/assets/hbm/textures/blocks/modgen_smelter.png deleted file mode 100644 index fc53a4c5d..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_smelter.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_smelter_lit.png b/src/main/resources/assets/hbm/textures/blocks/modgen_smelter_lit.png deleted file mode 100644 index b410ca5b9..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_smelter_lit.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_tank.png b/src/main/resources/assets/hbm/textures/blocks/modgen_tank.png deleted file mode 100644 index 848275f7d..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_tank.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_thermo.png b/src/main/resources/assets/hbm/textures/blocks/modgen_thermo.png deleted file mode 100644 index faafa6d07..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_thermo.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_turbine.png b/src/main/resources/assets/hbm/textures/blocks/modgen_turbine.png deleted file mode 100644 index 3ae51eaa5..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_turbine.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/blocks/modgen_vent.png b/src/main/resources/assets/hbm/textures/blocks/modgen_vent.png deleted file mode 100644 index 37852fc4d..000000000 Binary files a/src/main/resources/assets/hbm/textures/blocks/modgen_vent.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/items/chem_icon_PET.png b/src/main/resources/assets/hbm/textures/items/chem_icon_PET.png new file mode 100644 index 000000000..afa54e96b Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/chem_icon_PET.png differ diff --git a/src/main/resources/assets/hbm/textures/items/chem_icon_TATB.png b/src/main/resources/assets/hbm/textures/items/chem_icon_TATB.png new file mode 100644 index 000000000..bb413aed8 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/chem_icon_TATB.png differ diff --git a/src/main/resources/assets/hbm/textures/items/stick_tatb.png b/src/main/resources/assets/hbm/textures/items/stick_tatb.png new file mode 100644 index 000000000..6dd88af75 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/stick_tatb.png differ diff --git a/src/main/resources/assets/hbm/textures/models/tank/tank_HEAVYOIL.png b/src/main/resources/assets/hbm/textures/models/tank/tank_HEAVYOIL.png index e29ec2b47..c56d419d4 100644 Binary files a/src/main/resources/assets/hbm/textures/models/tank/tank_HEAVYOIL.png and b/src/main/resources/assets/hbm/textures/models/tank/tank_HEAVYOIL.png differ diff --git a/src/main/resources/assets/hbm/textures/models/tank/tank_HEAVYOIL_VACUUM.png b/src/main/resources/assets/hbm/textures/models/tank/tank_HEAVYOIL_VACUUM.png new file mode 100644 index 000000000..7ec520222 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/tank/tank_HEAVYOIL_VACUUM.png differ diff --git a/src/main/resources/assets/hbm/textures/models/tank/tank_LIGHTOIL_VACUUM.png b/src/main/resources/assets/hbm/textures/models/tank/tank_LIGHTOIL_VACUUM.png new file mode 100644 index 000000000..e7d7b38a8 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/tank/tank_LIGHTOIL_VACUUM.png differ diff --git a/src/main/resources/assets/hbm/textures/models/tank/tank_REFORMATE.png b/src/main/resources/assets/hbm/textures/models/tank/tank_REFORMATE.png new file mode 100644 index 000000000..e11563206 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/tank/tank_REFORMATE.png differ diff --git a/src/main/resources/assets/hbm/textures/models/tank/tank_SOURGAS.png b/src/main/resources/assets/hbm/textures/models/tank/tank_SOURGAS.png new file mode 100644 index 000000000..6e0cc3dd7 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/tank/tank_SOURGAS.png differ diff --git a/src/main/resources/assets/hbm/textures/models/tank/tank_XYLENE.png b/src/main/resources/assets/hbm/textures/models/tank/tank_XYLENE.png new file mode 100644 index 000000000..5a162a90a Binary files /dev/null and b/src/main/resources/assets/hbm/textures/models/tank/tank_XYLENE.png differ