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_name=ForgeCraft
mod_version=1.3.2
mod_version=1.3.21
forge_version=14.22.0.2463
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_PREFIX = 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 DEPENDENCIES = "required-after:forge@[14.21.0,2344,);" + "required-after:primal@[0.5,);";

View File

@@ -19,6 +19,7 @@ import nmd.primal.core.common.helper.NBTHelper;
import nmd.primal.core.common.helper.RecipeHelper;
import nmd.primal.forgecraft.blocks.Forge;
import nmd.primal.forgecraft.crafting.ForgeCrafting;
import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.util.ToolNBT;
import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
@@ -179,10 +180,14 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
private void craftingManager() {
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());
if (recipe != null) {
NBTTagCompound stackCompound = null;
if(stack.hasTagCompound()){
stackCompound=stack.getTagCompound().copy();
}
if(i == 2){
if (this.getHeat() >= recipe.getHeatThreshold()) {
cookCounter2++;
@@ -191,11 +196,13 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
cookCounter2--;
}
if (cookCounter2 >= recipe.getIdealTime()) {
if (NBTHelper.hasTag(stack, "tags")) {
NBTHelper.setBoolean(stack, "hot", true);
} else this.setSlotStack(i, recipe.getOutput());
ItemStack outputStack = recipe.getOutput();
outputStack.setItemDamage(stack.getItemDamage());
if(outputStack.getItem() instanceof ToolPart) {
outputStack.setTagCompound(stackCompound);
outputStack.getSubCompound("tags").setBoolean("hot", true);
}
this.setSlotStack(i, outputStack);
cookCounter2 = 0;
}
}
@@ -207,10 +214,13 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
cookCounter3--;
}
if (cookCounter3 >= recipe.getIdealTime()) {
if (NBTHelper.hasTag(stack, "tags")) {
NBTHelper.setBoolean(stack, "hot", true);
} else this.setSlotStack(i, recipe.getOutput());
ItemStack outputStack = recipe.getOutput();
outputStack.setItemDamage(stack.getItemDamage());
if(outputStack.getItem() instanceof ToolPart) {
outputStack.setTagCompound(stackCompound);
outputStack.getSubCompound("tags").setBoolean("hot", true);
}
this.setSlotStack(i, outputStack);
cookCounter3 = 0;
}
@@ -223,12 +233,14 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
cookCounter4--;
}
if (cookCounter4 >= recipe.getIdealTime()) {
if (NBTHelper.hasTag(stack, "tags")) {
NBTHelper.setBoolean(stack, "hot", true);
cookCounter4 = 0;
} else this.setSlotStack(i, recipe.getOutput());
ItemStack outputStack = recipe.getOutput();
outputStack.setItemDamage(stack.getItemDamage());
//System.out.println(stackCompound.getCompoundTag("tags"));
if(outputStack.getItem() instanceof ToolPart) {
outputStack.setTagCompound(stackCompound);
outputStack.getSubCompound("tags").setBoolean("hot", true);
}
this.setSlotStack(i, outputStack);
cookCounter4 = 0;
}
}
@@ -240,11 +252,13 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
cookCounter5--;
}
if (cookCounter5 >= recipe.getIdealTime()) {
if (NBTHelper.hasTag(stack, "tags")) {
NBTHelper.setBoolean(stack, "hot", true);
} else this.setSlotStack(i, recipe.getOutput());
ItemStack outputStack = recipe.getOutput();
outputStack.setItemDamage(stack.getItemDamage());
if(outputStack.getItem() instanceof ToolPart) {
outputStack.setTagCompound(stackCompound);
outputStack.getSubCompound("tags").setBoolean("hot", true);
}
this.setSlotStack(i, outputStack);
cookCounter5 = 0;
}
}
@@ -256,21 +270,16 @@ public class TileForge extends TileBaseSlot implements ITickable, ToolNBT{
cookCounter6--;
}
if (cookCounter6 >= recipe.getIdealTime()) {
if (NBTHelper.hasTag(stack, "tags")) {
NBTHelper.setBoolean(stack, "hot", true);
} else this.setSlotStack(i, recipe.getOutput());
ItemStack outputStack = recipe.getOutput();
outputStack.setItemDamage(stack.getItemDamage());
if(outputStack.getItem() instanceof ToolPart) {
outputStack.setTagCompound(stackCompound);
outputStack.getSubCompound("tags").setBoolean("hot", true);
}
this.setSlotStack(i, outputStack);
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",
"name": "Kitsu's Forgecraft",
"description": "Forged with sweat and blood",
"version": "1.3.2",
"version": "1.3.21",
"mcversion": "1.12.0",
"url": "",
"updateUrl": "",