Fixup Soul Forge crafting
This commit is contained in:
parent
e3cef5ee76
commit
2d3f86aaf8
|
@ -11,6 +11,7 @@ import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -115,28 +116,26 @@ public class TileSoulForge extends TileInventory implements ITickable, IDemonWil
|
||||||
if (recipe == null)
|
if (recipe == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ItemStack outputStack = recipe.getOutput();
|
|
||||||
ItemStack currentOutputStack = getStackInSlot(outputSlot);
|
ItemStack currentOutputStack = getStackInSlot(outputSlot);
|
||||||
if (outputStack.isEmpty())
|
if (recipe.getOutput().isEmpty())
|
||||||
return false;
|
return false;
|
||||||
if (currentOutputStack.isEmpty())
|
if (currentOutputStack.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
if (!currentOutputStack.isItemEqual(outputStack))
|
if (!currentOutputStack.isItemEqual(recipe.getOutput()))
|
||||||
return false;
|
return false;
|
||||||
int result = currentOutputStack.getCount() + outputStack.getCount();
|
int result = currentOutputStack.getCount() + recipe.getOutput().getCount();
|
||||||
return result <= getInventoryStackLimit() && result <= currentOutputStack.getMaxStackSize();
|
return result <= getInventoryStackLimit() && result <= currentOutputStack.getMaxStackSize();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void craftItem(RecipeTartaricForge recipe) {
|
public void craftItem(RecipeTartaricForge recipe) {
|
||||||
if (this.canCraft(recipe)) {
|
if (this.canCraft(recipe)) {
|
||||||
ItemStack outputStack = recipe.getOutput();
|
|
||||||
ItemStack currentOutputStack = getStackInSlot(outputSlot);
|
ItemStack currentOutputStack = getStackInSlot(outputSlot);
|
||||||
|
|
||||||
if (currentOutputStack.isEmpty()) {
|
if (currentOutputStack.isEmpty()) {
|
||||||
setInventorySlotContents(outputSlot, outputStack);
|
setInventorySlotContents(outputSlot, recipe.getOutput().copy());
|
||||||
} else if (currentOutputStack.getItem() == currentOutputStack.getItem()) {
|
} else if (ItemHandlerHelper.canItemStacksStack(currentOutputStack, recipe.getOutput())) {
|
||||||
currentOutputStack.grow(outputStack.getCount());
|
currentOutputStack.grow(recipe.getOutput().getCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
consumeInventory();
|
consumeInventory();
|
||||||
|
|
|
@ -17,8 +17,8 @@ public class ContainerSoulForge extends Container {
|
||||||
this.tileForge = tileForge;
|
this.tileForge = tileForge;
|
||||||
this.addSlotToContainer(new Slot(tileForge, 0, 8, 15));
|
this.addSlotToContainer(new Slot(tileForge, 0, 8, 15));
|
||||||
this.addSlotToContainer(new Slot(tileForge, 1, 80, 15));
|
this.addSlotToContainer(new Slot(tileForge, 1, 80, 15));
|
||||||
this.addSlotToContainer(new Slot(tileForge, 2, 80, 87));
|
this.addSlotToContainer(new Slot(tileForge, 2, 8, 87));
|
||||||
this.addSlotToContainer(new Slot(tileForge, 3, 8, 87));
|
this.addSlotToContainer(new Slot(tileForge, 3, 80, 87));
|
||||||
this.addSlotToContainer(new SlotSoul(tileForge, TileSoulForge.soulSlot, 152, 51));
|
this.addSlotToContainer(new SlotSoul(tileForge, TileSoulForge.soulSlot, 152, 51));
|
||||||
this.addSlotToContainer(new SlotOutput(tileForge, TileSoulForge.outputSlot, 44, 51));
|
this.addSlotToContainer(new SlotOutput(tileForge, TileSoulForge.outputSlot, 44, 51));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue