Fixes #295
This commit is contained in:
parent
5c95b238fa
commit
cc6dfbc3c4
3 changed files with 16 additions and 19 deletions
|
@ -53,7 +53,7 @@ public class IronAlloySmelterRecipeHandler extends GenericRecipeHander implement
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRecipeName() {
|
public String getRecipeName() {
|
||||||
return Reference.ironalloySmelteRecipe;
|
return Reference.alloySmelteRecipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
public class Reference {
|
public class Reference {
|
||||||
public static String alloySmelteRecipe = StatCollector.translateToLocal("techreborn.recipe.alloysmelter");
|
public static String alloySmelteRecipe = StatCollector.translateToLocal("techreborn.recipe.alloysmelter");
|
||||||
public static String ironalloySmelteRecipe = StatCollector.translateToLocal("techreborn.recipe.ironalloysmelter");
|
|
||||||
public static String assemblingMachineRecipe = StatCollector.translateToLocal("techreborn.recipe.assemblingmachine");
|
public static String assemblingMachineRecipe = StatCollector.translateToLocal("techreborn.recipe.assemblingmachine");
|
||||||
public static String blastFurnaceRecipe = StatCollector.translateToLocal("techreborn.recipe.blastfurnace");
|
public static String blastFurnaceRecipe = StatCollector.translateToLocal("techreborn.recipe.blastfurnace");
|
||||||
public static String centrifugeRecipe = StatCollector.translateToLocal("techreborn.recipe.centrifuge");
|
public static String centrifugeRecipe = StatCollector.translateToLocal("techreborn.recipe.centrifuge");
|
||||||
|
|
|
@ -42,31 +42,24 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
boolean flag = this.burnTime > 0;
|
boolean flag = this.burnTime > 0;
|
||||||
boolean flag1 = false;
|
boolean flag1 = false;
|
||||||
|
|
||||||
if (this.burnTime > 0) {
|
if (this.burnTime > 0) {
|
||||||
--this.burnTime;
|
--this.burnTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.worldObj.isRemote) {
|
if (!this.worldObj.isRemote) {
|
||||||
if (this.burnTime != 0 || getStackInSlot(input1) != null && getStackInSlot(fuel) != null) {
|
if (this.burnTime != 0 || getStackInSlot(input1) != null && getStackInSlot(fuel) != null) {
|
||||||
if (this.burnTime == 0 && this.canSmelt()) {
|
if (this.burnTime == 0 && this.canSmelt()) {
|
||||||
this.currentItemBurnTime = this.burnTime = getItemBurnTime(getStackInSlot(fuel));
|
this.currentItemBurnTime = this.burnTime = getItemBurnTime(getStackInSlot(fuel));
|
||||||
|
|
||||||
if (this.burnTime > 0) {
|
if (this.burnTime > 0) {
|
||||||
flag1 = true;
|
flag1 = true;
|
||||||
|
|
||||||
if (this.getStackInSlot(fuel) != null) {
|
if (this.getStackInSlot(fuel) != null) {
|
||||||
decrStackSize(fuel, 1);
|
decrStackSize(fuel, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isBurning() && this.canSmelt()) {
|
if (this.isBurning() && this.canSmelt()) {
|
||||||
++this.cookTime;
|
++this.cookTime;
|
||||||
|
|
||||||
if (this.cookTime == 200) {
|
if (this.cookTime == 200) {
|
||||||
this.cookTime = 0;
|
this.cookTime = 0;
|
||||||
this.smeltItem();
|
this.smeltItem();
|
||||||
|
@ -76,17 +69,14 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
this.cookTime = 0;
|
this.cookTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag != this.burnTime > 0) {
|
if (flag != this.burnTime > 0) {
|
||||||
flag1 = true;
|
flag1 = true;
|
||||||
//TODO sync on/off
|
//TODO sync on/off
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag1) {
|
if (flag1) {
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAllInputs(IBaseRecipeType recipeType) {
|
public boolean hasAllInputs(IBaseRecipeType recipeType) {
|
||||||
|
@ -151,18 +141,26 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
||||||
|
boolean hasAllRecipes = true;
|
||||||
for (ItemStack input : recipeType.getInputs()) {
|
for (ItemStack input : recipeType.getInputs()) {
|
||||||
if (ItemUtils.isItemEqual(input, getStackInSlot(input1), true, true, true)) {
|
if (ItemUtils.isItemEqual(input, getStackInSlot(input1), true, true, true) || ItemUtils.isItemEqual(input, getStackInSlot(input2), true, true, true)) {
|
||||||
this.decrStackSize(input1, input.stackSize);
|
|
||||||
} else if (ItemUtils.isItemEqual(input, getStackInSlot(input2), true, true, true)) {
|
} else {
|
||||||
this.decrStackSize(input2, input.stackSize);
|
hasAllRecipes = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(hasAllRecipes){
|
||||||
|
for (ItemStack input : recipeType.getInputs()) {
|
||||||
|
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
|
||||||
|
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true, recipeType.useOreDic())) {
|
||||||
|
inventory.decrStackSize(inputSlot, input.stackSize);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.decrStackSize(input1, 1);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue