diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java index 3fb6596b1..23ba136db 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerCoffeeMachine.java @@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.inventory.slot.SlotOutput; import ellpeck.actuallyadditions.items.InitItems; +import ellpeck.actuallyadditions.items.ItemCoffee; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityCoffeeMachine; @@ -33,13 +34,7 @@ public class ContainerCoffeeMachine extends Container{ for (int i = 0; i < 4; i++){ for (int j = 0; j < 2; j++){ - this.addSlotToContainer(new Slot(machine, j+i*2+3, 125+j*18, 6+i*18){ - @Override - public int getSlotStackLimit(){ - return 1; - } - - }); + this.addSlotToContainer(new Slot(machine, j+i*2+3, 125+j*18, 6+i*18)); } } @@ -111,6 +106,9 @@ public class ContainerCoffeeMachine extends Container{ if(currentStack.getItem() == InitItems.itemMisc && currentStack.getItemDamage() == TheMiscItems.CUP.ordinal()){ this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT+1, false); } + if(ItemCoffee.getIngredientFromStack(newStack) != null){ + this.mergeItemStack(newStack, 3, 10, false); + } } if(slot <= hotbarEnd && slot >= hotbarStart){ diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java index 13a59170a..222ac2470 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemCoffee.java @@ -62,10 +62,11 @@ public class ItemCoffee extends ItemFood implements INameableItem{ } public ItemCoffee(){ - super(2, 2.0F, false); + super(8, 5.0F, false); this.setMaxDamage(ConfigIntValues.COFFEE_DRINK_AMOUNT.getValue()-1); this.setAlwaysEdible(); this.setMaxStackSize(1); + this.setNoRepair(); } public static Ingredient getIngredientFromStack(ItemStack stack){ diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java index 195384333..31fbf5d2c 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java @@ -35,16 +35,19 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE @SuppressWarnings("unchecked") public void updateEntity(){ if(!worldObj.isRemote){ - if(this.isCanola(0) && this.storage.getEnergyStored() >= energyUsedPerTick && this.mbProducedPerCanola <= this.tank.getCapacity()-this.tank.getFluidAmount()){ - this.currentProcessTime++; - if(this.currentProcessTime >= this.maxTimeProcessing){ - this.currentProcessTime = 0; + if(this.isCanola(0) && this.mbProducedPerCanola <= this.tank.getCapacity()-this.tank.getFluidAmount()){ + if(this.storage.getEnergyStored() >= energyUsedPerTick){ + this.currentProcessTime++; + this.storage.extractEnergy(energyUsedPerTick, false); + if(this.currentProcessTime >= this.maxTimeProcessing){ + this.currentProcessTime = 0; - this.slots[0].stackSize--; - if(this.slots[0].stackSize == 0) this.slots[0] = null; + this.slots[0].stackSize--; + if(this.slots[0].stackSize == 0) this.slots[0] = null; - this.tank.fill(new FluidStack(InitBlocks.fluidCanolaOil, mbProducedPerCanola), true); - this.markDirty(); + this.tank.fill(new FluidStack(InitBlocks.fluidCanolaOil, mbProducedPerCanola), true); + this.markDirty(); + } } } else this.currentProcessTime = 0; @@ -58,8 +61,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE } } - if(this.currentProcessTime > 0) this.storage.extractEnergy(energyUsedPerTick, false); - if(this.tank.getFluidAmount() > 0){ WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, this.tank); } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java index a0a445880..64de879ad 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java @@ -41,7 +41,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements if(!worldObj.isRemote){ this.storeCoffee(); - if(this.brewTime > 0){ + if(this.brewTime > 0 || this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ this.brew(); } } @@ -59,41 +59,34 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements public void brew(){ if(!worldObj.isRemote){ - if(this.slots[SLOT_INPUT] != null && this.slots[SLOT_INPUT].getItem() == InitItems.itemMisc && this.slots[SLOT_INPUT].getItemDamage() == TheMiscItems.CUP.ordinal() && this.slots[SLOT_OUTPUT] == null && this.storage.getEnergyStored() >= energyUsePerTick && this.coffeeCacheAmount >= this.coffeeCacheUsePerItem){ - this.brewTime++; - if(this.brewTime >= this.maxBrewTime){ - this.brewTime = 0; - ItemStack output = new ItemStack(InitItems.itemCoffee); - while(getFirstAvailIngredient() > 0){ - int ingr = this.getFirstAvailIngredient(); - ItemCoffee.Ingredient ingredient = ItemCoffee.getIngredientFromStack(this.slots[ingr]); - if(ingredient != null){ - ingredient.effect(output); + if(this.slots[SLOT_INPUT] != null && this.slots[SLOT_INPUT].getItem() == InitItems.itemMisc && this.slots[SLOT_INPUT].getItemDamage() == TheMiscItems.CUP.ordinal() && this.slots[SLOT_OUTPUT] == null && this.coffeeCacheAmount >= this.coffeeCacheUsePerItem){ + if(this.storage.getEnergyStored() >= energyUsePerTick){ + this.brewTime++; + this.storage.extractEnergy(energyUsePerTick, false); + if(this.brewTime >= this.maxBrewTime){ + this.brewTime = 0; + ItemStack output = new ItemStack(InitItems.itemCoffee); + for(int i = 3; i < this.slots.length; i++){ + if(this.slots[i] != null && ItemCoffee.getIngredientFromStack((this.slots[i])) != null){ + ItemCoffee.Ingredient ingredient = ItemCoffee.getIngredientFromStack(this.slots[i]); + if(ingredient != null){ + ingredient.effect(output); + } + this.slots[i].stackSize--; + if(this.slots[i].stackSize <= 0) this.slots[i] = this.slots[i].getItem().getContainerItem(this.slots[i]); + } } - this.slots[ingr].stackSize--; - if(this.slots[ingr].stackSize <= 0) this.slots[ingr] = this.slots[ingr].getItem().getContainerItem(this.slots[ingr]); + this.slots[SLOT_OUTPUT] = output.copy(); + this.slots[SLOT_INPUT].stackSize--; + if(this.slots[SLOT_INPUT].stackSize <= 0) this.slots[SLOT_INPUT] = null; + this.coffeeCacheAmount -= this.coffeeCacheUsePerItem; } - this.slots[SLOT_OUTPUT] = output.copy(); - this.slots[SLOT_INPUT].stackSize--; - if(this.slots[SLOT_INPUT].stackSize <= 0) this.slots[SLOT_INPUT] = null; - this.coffeeCacheAmount -= this.coffeeCacheUsePerItem; } } else this.brewTime = 0; - - if(this.brewTime > 0) this.storage.extractEnergy(energyUsePerTick, false); } } - public int getFirstAvailIngredient(){ - for(int i = 3; i < this.slots.length; i++){ - if(this.slots[i] != null && this.slots[i].stackSize == 1 && ItemCoffee.getIngredientFromStack((this.slots[i])) != null){ - return i; - } - } - return 0; - } - @SideOnly(Side.CLIENT) public int getCoffeeScaled(int i){ return this.coffeeCacheAmount * i / this.coffeeCacheMaxAmount; @@ -127,7 +120,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements @Override public boolean isItemValidForSlot(int i, ItemStack stack){ - return (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()); + return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java index 1c30689b2..5cc3552f9 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java @@ -38,31 +38,30 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements boolean canSmeltOnFirst = this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1); boolean canSmeltOnSecond = this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2); - if(this.storage.getEnergyStored() >= energyUsePerTick){ - if(canSmeltOnFirst){ + + if(canSmeltOnFirst){ + if(this.storage.getEnergyStored() >= energyUsePerTick){ this.firstSmeltTime++; if(this.firstSmeltTime >= maxBurnTime){ this.finishBurning(SLOT_INPUT_1, SLOT_OUTPUT_1); this.firstSmeltTime = 0; } } - else this.firstSmeltTime = 0; + } + else this.firstSmeltTime = 0; - if(canSmeltOnSecond){ + if(canSmeltOnSecond){ + if(this.storage.getEnergyStored() >= energyUsePerTick){ this.secondSmeltTime++; if(this.secondSmeltTime >= maxBurnTime){ this.finishBurning(SLOT_INPUT_2, SLOT_OUTPUT_2); this.secondSmeltTime = 0; } } - else this.secondSmeltTime = 0; - } - else{ - this.firstSmeltTime = 0; - this.secondSmeltTime = 0; } + else this.secondSmeltTime = 0; - if(this.firstSmeltTime > 0 || this.secondSmeltTime > 0) this.storage.extractEnergy(energyUsePerTick, false); + if(this.storage.getEnergyStored() >= energyUsePerTick && this.firstSmeltTime > 0 || this.secondSmeltTime > 0) this.storage.extractEnergy(energyUsePerTick, false); } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java index 19d4fcf0c..f6ec5bc46 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java @@ -82,33 +82,31 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg boolean canCrushOnSecond = false; if(this.isDouble) canCrushOnSecond = this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); - if(this.storage.getEnergyStored() >= energyUsePerTick){ - if(canCrushOnFirst){ + if(canCrushOnFirst){ + if(this.storage.getEnergyStored() >= energyUsePerTick){ this.firstCrushTime++; if(this.firstCrushTime >= maxCrushTime){ this.finishCrushing(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2); this.firstCrushTime = 0; } } - else this.firstCrushTime = 0; + } + else this.firstCrushTime = 0; - if(this.isDouble){ - if(canCrushOnSecond){ + if(this.isDouble){ + if(canCrushOnSecond){ + if(this.storage.getEnergyStored() >= energyUsePerTick){ this.secondCrushTime++; if(this.secondCrushTime >= maxCrushTime){ this.finishCrushing(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); this.secondCrushTime = 0; } } - else this.secondCrushTime = 0; } - } - else{ - this.firstCrushTime = 0; - this.secondCrushTime = 0; + else this.secondCrushTime = 0; } - if(this.firstCrushTime > 0 || this.secondCrushTime > 0) this.storage.extractEnergy(energyUsePerTick, false); + if(this.storage.getEnergyStored() >= energyUsePerTick && this.firstCrushTime > 0 || this.secondCrushTime > 0) this.storage.extractEnergy(energyUsePerTick, false); } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java deleted file mode 100644 index 6cceea975..000000000 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java +++ /dev/null @@ -1,67 +0,0 @@ -package ellpeck.actuallyadditions.tile; - -import ellpeck.actuallyadditions.items.InitItems; -import ellpeck.actuallyadditions.items.ItemSpecialDrop; -import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; -import ellpeck.actuallyadditions.network.gui.IButtonReactor; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor{ - - public TileEntityXPSolidifier(){ - super(12, "xpSolidifier"); - } - - public int getFirstSlot(int itemsNeeded){ - for(int i = 0; i < this.slots.length; i++){ - if(this.slots[i] == null || this.slots[i].stackSize <= this.slots[i].getMaxStackSize()-itemsNeeded){ - return i; - } - } - return -1; - } - - @Override - public boolean canUpdate(){ - return false; - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack stack){ - return false; - } - - @Override - public boolean canInsertItem(int slot, ItemStack stack, int side){ - return this.isItemValidForSlot(slot, stack); - } - - @Override - public boolean canExtractItem(int slot, ItemStack stack, int side){ - return true; - } - - @Override - public void onButtonPressed(int buttonID, EntityPlayer player){ - if(!player.worldObj.isRemote){ - if(buttonID == 0 && player.experienceTotal >= ItemSpecialDrop.SOLID_XP_AMOUNT){ - int slot = this.getFirstSlot(1); - if(slot >= 0){ - if(this.slots[slot] != null){ - this.slots[slot].stackSize++; - } - else this.slots[slot] = new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()); - player.addExperience(ItemSpecialDrop.SOLID_XP_AMOUNT); - } - } - else if(buttonID == 1 && player.experienceTotal >= 64*ItemSpecialDrop.SOLID_XP_AMOUNT){ - int slot = this.getFirstSlot(64); - if(slot >= 0){ - this.slots[slot] = new ItemStack(InitItems.itemSpecialDrop, 64, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()); - player.addExperience(64*ItemSpecialDrop.SOLID_XP_AMOUNT); - } - } - } - } -} diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage1.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage1.png index 6e893add6..52a8b8b82 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage1.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage1.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage2.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage2.png index 8a5e090dd..90274425f 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage2.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage2.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage3.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage3.png index 61bc39cc0..ba3d2bf7c 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage3.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage3.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage4.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage4.png index b456db29d..60fb42c24 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage4.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage4.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage5.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage5.png index e2cbbc929..794403d4d 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage5.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage5.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage6.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage6.png index 01a879841..da8d1cfc1 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage6.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockCoffeeStage6.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage1.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage1.png index 2cf284b95..6543c9466 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage1.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage1.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage2.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage2.png index cea1ba434..9a48e693b 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage2.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage2.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage3.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage3.png index 892529aa2..0b4544dd1 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage3.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage3.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage4.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage4.png index 56e5e111b..a9aff1f14 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage4.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage4.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage5.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage5.png index df74ddd41..54abf3f7e 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage5.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage5.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage6.png b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage6.png index 65f70d259..d89928166 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage6.png and b/src/main/resources/assets/actuallyadditions/textures/blocks/blockFlaxStage6.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemCoffeeBeans.png b/src/main/resources/assets/actuallyadditions/textures/items/itemCoffeeBeans.png index 0eacb492f..94fdee80c 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/items/itemCoffeeBeans.png and b/src/main/resources/assets/actuallyadditions/textures/items/itemCoffeeBeans.png differ