Fix #1441 Centrifuge preview slot should show item being centrifuged, not its result

This commit is contained in:
Nedelosk committed 2016-10-18 14:10:30 +02:00
1 parent 2d25754731
commit 64f64f2b5c
2 files changed
+10 -14

No files matched your search

@@ -118,12 +118,11 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
@Override
public boolean workCycle() {
if (tryAddPending()) {
setCurrentPreviewItem();
return true;
}
if (!pendingProducts.isEmpty()) {
setCurrentPreviewItem();
craftPreviewInventory.setInventorySlotContents(0, null);
return false;
}
@@ -134,10 +133,13 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
// We are done, add products to queue
Collection<ItemStack> products = currentRecipe.getProducts(worldObj.rand);
pendingProducts.addAll(products);
getInternalInventory().decrStackSize(InventoryCentrifuge.SLOT_RESOURCE, 1);
setCurrentPreviewItem();
//Add Item to preview slot.
ItemStack previewStack = getInternalInventory().getStackInSlot(InventoryCentrifuge.SLOT_RESOURCE).copy();
previewStack.stackSize=1;
craftPreviewInventory.setInventorySlotContents(0, previewStack);
getInternalInventory().decrStackSize(InventoryCentrifuge.SLOT_RESOURCE, 1);
return true;
}
@@ -166,6 +168,9 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
if (added) {
pendingProducts.pop();
if(pendingProducts.isEmpty()){
craftPreviewInventory.setInventorySlotContents(0, null);
}
}
getErrorLogic().setCondition(!added, EnumErrorCode.NO_SPACE_INVENTORY);
@@ -265,14 +270,6 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
public IInventory getCraftPreviewInventory() {
return craftPreviewInventory;
}
private void setCurrentPreviewItem(){
if(!pendingProducts.isEmpty()){
craftPreviewInventory.setInventorySlotContents(0, pendingProducts.peek());
}else{
craftPreviewInventory.setInventorySlotContents(0, null);
}
}
@Override
public void handleItemStackForDisplay(ItemStack itemStack) {
@@ -39,7 +39,6 @@ import forestry.api.core.IStateMapperRegister;
import forestry.api.lepidopterology.ButterflyManager;
import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IButterfly;
import forestry.core.blocks.IMachineProperties;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileUtil;
import forestry.lepidopterology.blocks.property.PropertyCocoon;