fixed heating of damaged tools

This commit is contained in:
Mohammad-Ali Minaie
2017-09-04 21:30:58 -04:00
parent 622a3f4b17
commit f0377332d8
5 changed files with 58 additions and 49 deletions

View File

@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx3G
mod_group=nmd.primal.forgecraft mod_group=nmd.primal.forgecraft
mod_name=ForgeCraft mod_name=ForgeCraft
mod_version=1.3.2 mod_version=1.3.21
forge_version=14.22.0.2463 forge_version=14.22.0.2463
mcp_mappings=snapshot_20170624 mcp_mappings=snapshot_20170624

View File

@@ -17,7 +17,7 @@ public class ModInfo {
public static final String MOD_CONFIG = "primal/" + MOD_ID; public static final String MOD_CONFIG = "primal/" + MOD_ID;
//public static final String MOD_PREFIX = MOD_ID + ":"; //public static final String MOD_PREFIX = MOD_ID + ":";
public static final String MOD_CHANNEL = MOD_ID; public static final String MOD_CHANNEL = MOD_ID;
public static final String MOD_VERSION = "1.3.2"; public static final String MOD_VERSION = "1.3.21";
public static final String MC_VERSIONS = "[1.12.0, 1.13.0)"; public static final String MC_VERSIONS = "[1.12.0, 1.13.0)";
public static final String DEPENDENCIES = "required-after:forge@[14.21.0,2344,);" + "required-after:primal@[0.5,);"; public static final String DEPENDENCIES = "required-after:forge@[14.21.0,2344,);" + "required-after:primal@[0.5,);";

View File

@@ -739,7 +739,7 @@ public class ModCrafting {
/***Makes a Hot Iron PickaxeHead***/ /***Makes a Hot Iron PickaxeHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.pickaxehead, ModItems.pickaxehead,
new ItemStack(ModItems.pickaxehead, 1 ), new ItemStack(ModItems.pickaxehead, 1),
800, 800,
160, 160,
400, 400,
@@ -750,7 +750,7 @@ public class ModCrafting {
/***Makes a Hot Clean Iron PickaxeHead***/ /***Makes a Hot Clean Iron PickaxeHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.cleanironpickaxehead, ModItems.cleanironpickaxehead,
new ItemStack(ModItems.cleanironpickaxehead, 1 ), new ItemStack(ModItems.cleanironpickaxehead, 1),
800, 800,
160, 160,
400, 400,
@@ -761,7 +761,7 @@ public class ModCrafting {
/***Makes a Hot Steel PickaxeHead***/ /***Makes a Hot Steel PickaxeHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.steelpickaxehead, ModItems.steelpickaxehead,
new ItemStack(ModItems.steelpickaxehead, 1 ), new ItemStack(ModItems.steelpickaxehead, 1),
1000, 1000,
160, 160,
400, 400,
@@ -774,7 +774,7 @@ public class ModCrafting {
/***Makes a Hot Iron AxeHead***/ /***Makes a Hot Iron AxeHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.ironaxehead, ModItems.ironaxehead,
new ItemStack(ModItems.ironaxehead, 1 ), new ItemStack(ModItems.ironaxehead, 1),
800, 800,
160, 160,
400, 400,
@@ -784,7 +784,7 @@ public class ModCrafting {
/***Makes a Hot Clean Iron AxeHead***/ /***Makes a Hot Clean Iron AxeHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.cleanironaxehead, ModItems.cleanironaxehead,
new ItemStack(ModItems.cleanironaxehead, 1 ), new ItemStack(ModItems.cleanironaxehead, 1),
800, 800,
160, 160,
400, 400,
@@ -794,7 +794,7 @@ public class ModCrafting {
/***Makes a Hot Steel AxeHead***/ /***Makes a Hot Steel AxeHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.steelaxehead, ModItems.steelaxehead,
new ItemStack(ModItems.steelaxehead, 1 ), new ItemStack(ModItems.steelaxehead, 1),
800, 800,
160, 160,
400, 400,
@@ -806,7 +806,7 @@ public class ModCrafting {
/***Makes a Hot Iron ShovelHead***/ /***Makes a Hot Iron ShovelHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.ironshovelhead, ModItems.ironshovelhead,
new ItemStack(ModItems.ironshovelhead, 1 ), new ItemStack(ModItems.ironshovelhead, 1),
800, 800,
160, 160,
400, 400,
@@ -816,7 +816,7 @@ public class ModCrafting {
/***Makes a Hot Clean Iron ShovelHead***/ /***Makes a Hot Clean Iron ShovelHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.cleanironshovelhead, ModItems.cleanironshovelhead,
new ItemStack(ModItems.cleanironshovelhead, 1 ), new ItemStack(ModItems.cleanironshovelhead, 1),
800, 800,
160, 160,
400, 400,
@@ -826,7 +826,7 @@ public class ModCrafting {
/***Makes a Hot Steel ShovelHead***/ /***Makes a Hot Steel ShovelHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.steelshovelhead, ModItems.steelshovelhead,
new ItemStack(ModItems.steelshovelhead, 1 ), new ItemStack(ModItems.steelshovelhead, 1),
800, 800,
160, 160,
400, 400,
@@ -838,7 +838,7 @@ public class ModCrafting {
/***Makes a Hot Iron HoeHead***/ /***Makes a Hot Iron HoeHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.ironhoehead, ModItems.ironhoehead,
new ItemStack(ModItems.ironhoehead, 1 ), new ItemStack(ModItems.ironhoehead, 1),
800, 800,
160, 160,
400, 400,
@@ -848,7 +848,7 @@ public class ModCrafting {
/***Makes a Hot Clean Iron HoeHead***/ /***Makes a Hot Clean Iron HoeHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.cleanironhoehead, ModItems.cleanironhoehead,
new ItemStack(ModItems.cleanironhoehead, 1 ), new ItemStack(ModItems.cleanironhoehead, 1),
800, 800,
160, 160,
400, 400,
@@ -858,7 +858,7 @@ public class ModCrafting {
/***Makes a Hot Steel HoeHead***/ /***Makes a Hot Steel HoeHead***/
ForgeCrafting.addRecipe( ForgeCrafting.addRecipe(
ModItems.steelhoehead, ModItems.steelhoehead,
new ItemStack(ModItems.steelhoehead, 1 ), new ItemStack(ModItems.steelhoehead, 1),
800, 800,
160, 160,
400, 400,

View File

@@ -19,6 +19,7 @@ import nmd.primal.core.common.helper.NBTHelper;
import nmd.primal.core.common.helper.RecipeHelper; import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.forgecraft.blocks.Forge; import nmd.primal.forgecraft.blocks.Forge;
import nmd.primal.forgecraft.crafting.ForgeCrafting; import nmd.primal.forgecraft.crafting.ForgeCrafting;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.util.ToolNBT; import nmd.primal.forgecraft.util.ToolNBT;
import static nmd.primal.core.common.helper.FireHelper.makeSmoke; import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
@@ -179,10 +180,14 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
private void craftingManager() { private void craftingManager() {
for (int i = 2; i < this.getSlotListSize(); i++) { for (int i = 2; i < this.getSlotListSize(); i++) {
ItemStack stack = this.getSlotStack(i); ItemStack stack = this.getSlotStack(i).copy();
ForgeCrafting recipe = ForgeCrafting.getRecipe(stack.getItem()); ForgeCrafting recipe = ForgeCrafting.getRecipe(stack.getItem());
if (recipe != null) { if (recipe != null) {
NBTTagCompound stackCompound = null;
if(stack.hasTagCompound()){
stackCompound=stack.getTagCompound().copy();
}
if(i == 2){ if(i == 2){
if (this.getHeat() >= recipe.getHeatThreshold()) { if (this.getHeat() >= recipe.getHeatThreshold()) {
cookCounter2++; cookCounter2++;
@@ -191,11 +196,13 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
cookCounter2--; cookCounter2--;
} }
if (cookCounter2 >= recipe.getIdealTime()) { if (cookCounter2 >= recipe.getIdealTime()) {
ItemStack outputStack = recipe.getOutput();
if (NBTHelper.hasTag(stack, "tags")) { outputStack.setItemDamage(stack.getItemDamage());
NBTHelper.setBoolean(stack, "hot", true); if(outputStack.getItem() instanceof ToolPart) {
} else this.setSlotStack(i, recipe.getOutput()); outputStack.setTagCompound(stackCompound);
outputStack.getSubCompound("tags").setBoolean("hot", true);
}
this.setSlotStack(i, outputStack);
cookCounter2 = 0; cookCounter2 = 0;
} }
} }
@@ -207,10 +214,13 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
cookCounter3--; cookCounter3--;
} }
if (cookCounter3 >= recipe.getIdealTime()) { if (cookCounter3 >= recipe.getIdealTime()) {
ItemStack outputStack = recipe.getOutput();
if (NBTHelper.hasTag(stack, "tags")) { outputStack.setItemDamage(stack.getItemDamage());
NBTHelper.setBoolean(stack, "hot", true); if(outputStack.getItem() instanceof ToolPart) {
} else this.setSlotStack(i, recipe.getOutput()); outputStack.setTagCompound(stackCompound);
outputStack.getSubCompound("tags").setBoolean("hot", true);
}
this.setSlotStack(i, outputStack);
cookCounter3 = 0; cookCounter3 = 0;
} }
@@ -223,12 +233,14 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
cookCounter4--; cookCounter4--;
} }
if (cookCounter4 >= recipe.getIdealTime()) { if (cookCounter4 >= recipe.getIdealTime()) {
ItemStack outputStack = recipe.getOutput();
if (NBTHelper.hasTag(stack, "tags")) { outputStack.setItemDamage(stack.getItemDamage());
NBTHelper.setBoolean(stack, "hot", true); //System.out.println(stackCompound.getCompoundTag("tags"));
cookCounter4 = 0; if(outputStack.getItem() instanceof ToolPart) {
} else this.setSlotStack(i, recipe.getOutput()); outputStack.setTagCompound(stackCompound);
outputStack.getSubCompound("tags").setBoolean("hot", true);
}
this.setSlotStack(i, outputStack);
cookCounter4 = 0; cookCounter4 = 0;
} }
} }
@@ -240,11 +252,13 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
cookCounter5--; cookCounter5--;
} }
if (cookCounter5 >= recipe.getIdealTime()) { if (cookCounter5 >= recipe.getIdealTime()) {
ItemStack outputStack = recipe.getOutput();
if (NBTHelper.hasTag(stack, "tags")) { outputStack.setItemDamage(stack.getItemDamage());
NBTHelper.setBoolean(stack, "hot", true); if(outputStack.getItem() instanceof ToolPart) {
} else this.setSlotStack(i, recipe.getOutput()); outputStack.setTagCompound(stackCompound);
outputStack.getSubCompound("tags").setBoolean("hot", true);
}
this.setSlotStack(i, outputStack);
cookCounter5 = 0; cookCounter5 = 0;
} }
} }
@@ -256,21 +270,16 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
cookCounter6--; cookCounter6--;
} }
if (cookCounter6 >= recipe.getIdealTime()) { if (cookCounter6 >= recipe.getIdealTime()) {
ItemStack outputStack = recipe.getOutput();
if (NBTHelper.hasTag(stack, "tags")) { outputStack.setItemDamage(stack.getItemDamage());
NBTHelper.setBoolean(stack, "hot", true); if(outputStack.getItem() instanceof ToolPart) {
} else this.setSlotStack(i, recipe.getOutput()); outputStack.setTagCompound(stackCompound);
outputStack.getSubCompound("tags").setBoolean("hot", true);
}
this.setSlotStack(i, outputStack);
cookCounter6 = 0; cookCounter6 = 0;
} }
} }
/*
System.out.println(state.getValue(IngotBall.ACTIVE) + " : " + recipe.getStartState());
System.out.println(cookCounter + " : " + recipe.getIdealTime());
System.out.println(this.heat + " : " + recipe.getHeatThreshold());
System.out.println("========");
*/
} }
} }
} }

View File

@@ -2,7 +2,7 @@
"modid": "forgecraft", "modid": "forgecraft",
"name": "Kitsu's Forgecraft", "name": "Kitsu's Forgecraft",
"description": "Forged with sweat and blood", "description": "Forged with sweat and blood",
"version": "1.3.2", "version": "1.3.21",
"mcversion": "1.12.0", "mcversion": "1.12.0",
"url": "", "url": "",
"updateUrl": "", "updateUrl": "",