From bfce8549a22de356d8dda8f0b56cec0f690292c3 Mon Sep 17 00:00:00 2001 From: radfast Date: Sun, 26 Jan 2020 17:09:53 +0000 Subject: [PATCH] Update: smaller wood items can be smelted to make Fragmented Carbon. --- .../core/tile/TileEntityElectricFurnace.java | 11 ++++++++--- .../planets/mars/items/ItemCarbonFragments.java | 6 ++++++ .../planets/mars/recipe/RecipeManagerMars.java | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java index 5c26d6d96c..467b89993c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java @@ -7,6 +7,7 @@ import micdoodle8.mods.galacticraft.core.energy.tile.EnergyStorageTile; import micdoodle8.mods.galacticraft.core.energy.tile.TileBaseElectricBlockWithInventory; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; +import micdoodle8.mods.galacticraft.planets.mars.items.MarsItems; import micdoodle8.mods.miccore.Annotations.NetworkedField; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; @@ -15,6 +16,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.EnumFacing; import net.minecraft.util.NonNullList; import net.minecraftforge.fml.relauncher.Side; @@ -147,14 +149,17 @@ else if (this.processTicks > 0 && this.processTicks < this.processTimeRequired) */ public boolean canProcess() { - if (this.getInventory().get(1).isEmpty()) + ItemStack stack = this.getInventory().get(1); + if (stack.isEmpty()) { return false; } - ItemStack result = FurnaceRecipes.instance().getSmeltingResult(this.getInventory().get(1)); + ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack); if (result.isEmpty()) { - return false; + int burnable = TileEntityFurnace.getItemBurnTime(stack); + if (burnable >= 200 && burnable < 400) result = new ItemStack(MarsItems.carbonFragments); //this includes most wooden tools, doors, stairs, boats etc but not saplings and sticks + else return false; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemCarbonFragments.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemCarbonFragments.java index 2eed8375e7..e5a6976b7d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemCarbonFragments.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemCarbonFragments.java @@ -39,4 +39,10 @@ public EnumSortCategoryItem getCategory(int meta) { return EnumSortCategoryItem.GENERAL; } + + @Override + public int getItemBurnTime(ItemStack itemStack) + { + return 200; + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java index 4e856a96fb..3323f45794 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java @@ -34,6 +34,7 @@ public static void addUniversalRecipes() FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MarsBlocks.marsBlock, 1, 1), new ItemStack(GCItems.basicItem, 1, 4), 1.0F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MarsBlocks.marsBlock, 1, 2), new ItemStack(MarsItems.marsItemBasic, 1, 2), 0.2F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MarsBlocks.marsBlock, 1, 3), new ItemStack(Items.IRON_INGOT), 0.2F); + FurnaceRecipes.instance().addSmeltingRecipeForBlock(Blocks.PLANKS, new ItemStack(MarsItems.carbonFragments), 0.0F); // Schematic HashMap input = new HashMap();