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