2014-04-11 13:06:32 +02:00
|
|
|
package com.pahimar.ee3.tileentity;
|
|
|
|
|
2014-07-03 21:54:14 +02:00
|
|
|
import com.pahimar.ee3.item.ItemAlchemicalDust;
|
2014-07-07 21:31:10 +02:00
|
|
|
import com.pahimar.ee3.item.crafting.RecipeAludel;
|
2014-04-30 03:46:59 +02:00
|
|
|
import com.pahimar.ee3.network.PacketHandler;
|
|
|
|
import com.pahimar.ee3.network.message.MessageTileEntityAludel;
|
2015-02-25 06:03:59 +01:00
|
|
|
import com.pahimar.ee3.recipe.AludelRecipeManager;
|
2014-07-03 21:54:14 +02:00
|
|
|
import com.pahimar.ee3.reference.Names;
|
2014-07-04 22:11:39 +02:00
|
|
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
2014-07-03 22:00:25 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2014-04-11 13:06:32 +02:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.inventory.ISidedInventory;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2014-07-04 22:11:39 +02:00
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraft.nbt.NBTTagList;
|
2014-04-30 03:46:59 +02:00
|
|
|
import net.minecraft.network.Packet;
|
2014-07-03 21:54:14 +02:00
|
|
|
import net.minecraft.tileentity.TileEntityFurnace;
|
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
2014-04-11 13:06:32 +02:00
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
public class TileEntityAludel extends TileEntityEE implements ISidedInventory {
|
2014-04-11 13:06:32 +02:00
|
|
|
public static final int INVENTORY_SIZE = 4;
|
|
|
|
public static final int FUEL_INVENTORY_INDEX = 0;
|
|
|
|
public static final int INPUT_INVENTORY_INDEX = 1;
|
|
|
|
public static final int DUST_INVENTORY_INDEX = 2;
|
|
|
|
public static final int OUTPUT_INVENTORY_INDEX = 3;
|
2014-07-03 21:54:14 +02:00
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
public int deviceCookTime; // How much longer the Aludel will cook
|
|
|
|
public int fuelBurnTime; // The fuel value for the currently burning fuel
|
|
|
|
public int itemCookTime; // How long the current item has been "cooking"
|
2014-07-03 21:54:14 +02:00
|
|
|
|
2014-04-11 13:06:32 +02:00
|
|
|
public ItemStack outputItemStack;
|
2014-07-03 21:54:14 +02:00
|
|
|
|
2014-04-11 13:06:32 +02:00
|
|
|
public boolean hasGlassBell = false;
|
|
|
|
/**
|
|
|
|
* The ItemStacks that hold the items currently being used in the Aludel
|
|
|
|
*/
|
|
|
|
private ItemStack[] inventory;
|
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
public TileEntityAludel() {
|
2014-04-11 13:06:32 +02:00
|
|
|
inventory = new ItemStack[INVENTORY_SIZE];
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public int[] getAccessibleSlotsFromSide(int side) {
|
|
|
|
return side == ForgeDirection.DOWN.ordinal()
|
|
|
|
? new int[] { FUEL_INVENTORY_INDEX, OUTPUT_INVENTORY_INDEX }
|
|
|
|
: new int[] { INPUT_INVENTORY_INDEX,
|
|
|
|
DUST_INVENTORY_INDEX,
|
|
|
|
OUTPUT_INVENTORY_INDEX };
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, int side) {
|
|
|
|
if (worldObj.getTileEntity(xCoord, yCoord + 1, zCoord)
|
|
|
|
instanceof TileEntityGlassBell) {
|
2014-07-03 21:54:14 +02:00
|
|
|
return isItemValidForSlot(slotIndex, itemStack);
|
2023-01-03 17:47:36 +01:00
|
|
|
} else {
|
2014-07-03 21:54:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, int side) {
|
2014-07-03 21:54:14 +02:00
|
|
|
return slotIndex == OUTPUT_INVENTORY_INDEX;
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
2014-07-04 22:11:39 +02:00
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
2014-07-04 22:11:39 +02:00
|
|
|
super.readFromNBT(nbtTagCompound);
|
|
|
|
|
|
|
|
// Read in the ItemStacks in the inventory from NBT
|
2014-07-18 18:58:35 +02:00
|
|
|
NBTTagList tagList = nbtTagCompound.getTagList(Names.NBT.ITEMS, 10);
|
2014-07-04 22:11:39 +02:00
|
|
|
inventory = new ItemStack[this.getSizeInventory()];
|
2023-01-03 17:47:36 +01:00
|
|
|
for (int i = 0; i < tagList.tagCount(); ++i) {
|
2014-07-04 22:11:39 +02:00
|
|
|
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
|
|
|
|
byte slotIndex = tagCompound.getByte("Slot");
|
2023-01-03 17:47:36 +01:00
|
|
|
if (slotIndex >= 0 && slotIndex < inventory.length) {
|
2014-07-04 22:11:39 +02:00
|
|
|
inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceCookTime = nbtTagCompound.getInteger("deviceCookTime");
|
|
|
|
fuelBurnTime = nbtTagCompound.getInteger("fuelBurnTime");
|
|
|
|
itemCookTime = nbtTagCompound.getInteger("itemCookTime");
|
|
|
|
hasGlassBell = nbtTagCompound.getBoolean("hasGlassBell");
|
|
|
|
}
|
|
|
|
|
2014-04-11 13:06:32 +02:00
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public int getSizeInventory() {
|
2014-07-03 21:54:14 +02:00
|
|
|
return inventory.length;
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public ItemStack getStackInSlot(int slotIndex) {
|
2014-07-03 21:54:14 +02:00
|
|
|
return inventory[slotIndex];
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public ItemStack decrStackSize(int slotIndex, int decrementAmount) {
|
2014-07-03 21:54:14 +02:00
|
|
|
ItemStack itemStack = getStackInSlot(slotIndex);
|
2023-01-03 17:47:36 +01:00
|
|
|
if (itemStack != null) {
|
|
|
|
if (itemStack.stackSize <= decrementAmount) {
|
2014-07-03 21:54:14 +02:00
|
|
|
setInventorySlotContents(slotIndex, null);
|
2023-01-03 17:47:36 +01:00
|
|
|
} else {
|
2014-07-03 21:54:14 +02:00
|
|
|
itemStack = itemStack.splitStack(decrementAmount);
|
2023-01-03 17:47:36 +01:00
|
|
|
if (itemStack.stackSize == 0) {
|
2014-07-03 21:54:14 +02:00
|
|
|
setInventorySlotContents(slotIndex, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return itemStack;
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public ItemStack getStackInSlotOnClosing(int slotIndex) {
|
2014-07-03 21:54:14 +02:00
|
|
|
ItemStack itemStack = getStackInSlot(slotIndex);
|
2023-01-03 17:47:36 +01:00
|
|
|
if (itemStack != null) {
|
2014-07-03 21:54:14 +02:00
|
|
|
setInventorySlotContents(slotIndex, null);
|
|
|
|
}
|
|
|
|
return itemStack;
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public void setInventorySlotContents(int slotIndex, ItemStack itemStack) {
|
2014-07-03 21:54:14 +02:00
|
|
|
inventory[slotIndex] = itemStack;
|
2023-01-03 17:47:36 +01:00
|
|
|
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
|
2014-07-03 21:54:14 +02:00
|
|
|
itemStack.stackSize = getInventoryStackLimit();
|
|
|
|
}
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public String getInventoryName() {
|
2014-07-03 21:54:14 +02:00
|
|
|
return this.hasCustomName() ? this.getCustomName() : Names.Containers.ALUDEL;
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public boolean hasCustomInventoryName() {
|
2014-07-03 21:54:14 +02:00
|
|
|
return this.hasCustomName();
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public int getInventoryStackLimit() {
|
2014-07-03 21:54:14 +02:00
|
|
|
return 64;
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public boolean isUseableByPlayer(EntityPlayer entityPlayer) {
|
|
|
|
return this.worldObj.getTileEntity(xCoord, yCoord, zCoord) == this
|
|
|
|
&& entityPlayer.getDistanceSq(
|
|
|
|
(double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D
|
|
|
|
)
|
|
|
|
<= 64D;
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public void openInventory() {
|
2014-07-03 21:54:14 +02:00
|
|
|
// NOOP
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public void closeInventory() {
|
2014-07-03 21:54:14 +02:00
|
|
|
// NOOP
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
|
|
|
switch (slotIndex) {
|
|
|
|
case FUEL_INVENTORY_INDEX: {
|
2014-07-03 21:54:14 +02:00
|
|
|
return TileEntityFurnace.isItemFuel(itemStack);
|
|
|
|
}
|
2023-01-03 17:47:36 +01:00
|
|
|
case INPUT_INVENTORY_INDEX: {
|
2014-07-03 21:54:14 +02:00
|
|
|
return true;
|
|
|
|
}
|
2023-01-03 17:47:36 +01:00
|
|
|
case DUST_INVENTORY_INDEX: {
|
2014-07-03 21:54:14 +02:00
|
|
|
return itemStack.getItem() instanceof ItemAlchemicalDust;
|
|
|
|
}
|
2023-01-03 17:47:36 +01:00
|
|
|
default: {
|
2014-07-03 21:54:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|
2014-04-30 03:46:59 +02:00
|
|
|
|
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public void writeToNBT(NBTTagCompound nbtTagCompound) {
|
2014-07-04 22:11:39 +02:00
|
|
|
super.writeToNBT(nbtTagCompound);
|
|
|
|
|
|
|
|
// Write the ItemStacks in the inventory to NBT
|
|
|
|
NBTTagList tagList = new NBTTagList();
|
2023-01-03 17:47:36 +01:00
|
|
|
for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) {
|
|
|
|
if (inventory[currentIndex] != null) {
|
2014-07-04 22:11:39 +02:00
|
|
|
NBTTagCompound tagCompound = new NBTTagCompound();
|
|
|
|
tagCompound.setByte("Slot", (byte) currentIndex);
|
|
|
|
inventory[currentIndex].writeToNBT(tagCompound);
|
|
|
|
tagList.appendTag(tagCompound);
|
|
|
|
}
|
|
|
|
}
|
2014-07-18 18:58:35 +02:00
|
|
|
nbtTagCompound.setTag(Names.NBT.ITEMS, tagList);
|
2014-07-04 22:11:39 +02:00
|
|
|
nbtTagCompound.setInteger("deviceCookTime", deviceCookTime);
|
|
|
|
nbtTagCompound.setInteger("fuelBurnTime", fuelBurnTime);
|
|
|
|
nbtTagCompound.setInteger("itemCookTime", itemCookTime);
|
|
|
|
nbtTagCompound.setBoolean("hasGlassBell", hasGlassBell);
|
2014-04-30 03:46:59 +02:00
|
|
|
}
|
2014-07-03 22:00:25 +02:00
|
|
|
|
2014-07-04 22:11:39 +02:00
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public Packet getDescriptionPacket() {
|
|
|
|
return PacketHandler.INSTANCE.getPacketFrom(
|
|
|
|
new MessageTileEntityAludel(this, inventory[OUTPUT_INVENTORY_INDEX])
|
|
|
|
);
|
2014-07-03 22:00:25 +02:00
|
|
|
}
|
|
|
|
|
2014-07-04 22:11:39 +02:00
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public void updateEntity() {
|
2014-07-04 22:11:39 +02:00
|
|
|
boolean isBurning = this.deviceCookTime > 0;
|
|
|
|
boolean sendUpdate = false;
|
|
|
|
|
|
|
|
// If the Aludel still has burn time, decrement it
|
2023-01-03 17:47:36 +01:00
|
|
|
if (this.deviceCookTime > 0) {
|
2014-07-04 22:11:39 +02:00
|
|
|
this.deviceCookTime--;
|
2014-07-03 22:00:25 +02:00
|
|
|
}
|
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
if (!this.worldObj.isRemote) {
|
2014-07-04 22:11:39 +02:00
|
|
|
// Start "cooking" a new item, if we can
|
2023-01-03 17:47:36 +01:00
|
|
|
if (this.deviceCookTime == 0 && this.canInfuse()) {
|
|
|
|
this.fuelBurnTime = this.deviceCookTime
|
|
|
|
= TileEntityFurnace.getItemBurnTime(
|
|
|
|
this.inventory[FUEL_INVENTORY_INDEX]
|
|
|
|
);
|
2014-07-04 21:18:10 +02:00
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
if (this.deviceCookTime > 0) {
|
2014-07-04 22:11:39 +02:00
|
|
|
sendUpdate = true;
|
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
if (this.inventory[FUEL_INVENTORY_INDEX] != null) {
|
2014-07-04 22:11:39 +02:00
|
|
|
--this.inventory[FUEL_INVENTORY_INDEX].stackSize;
|
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
if (this.inventory[FUEL_INVENTORY_INDEX].stackSize == 0) {
|
|
|
|
this.inventory[FUEL_INVENTORY_INDEX]
|
|
|
|
= this.inventory[FUEL_INVENTORY_INDEX]
|
|
|
|
.getItem()
|
|
|
|
.getContainerItem(inventory[FUEL_INVENTORY_INDEX]);
|
2014-07-04 22:11:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Continue "cooking" the same item, if we can
|
2023-01-03 17:47:36 +01:00
|
|
|
if (this.deviceCookTime > 0 && this.canInfuse()) {
|
2014-07-04 22:11:39 +02:00
|
|
|
this.itemCookTime++;
|
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
if (this.itemCookTime == 200) {
|
2014-07-04 22:11:39 +02:00
|
|
|
this.itemCookTime = 0;
|
|
|
|
this.infuseItem();
|
|
|
|
sendUpdate = true;
|
|
|
|
}
|
2023-01-03 17:47:36 +01:00
|
|
|
} else {
|
2014-07-04 22:11:39 +02:00
|
|
|
this.itemCookTime = 0;
|
2014-07-04 21:18:10 +02:00
|
|
|
}
|
|
|
|
|
2014-07-04 22:11:39 +02:00
|
|
|
// If the state has changed, catch that something changed
|
2023-01-03 17:47:36 +01:00
|
|
|
if (isBurning != this.deviceCookTime > 0) {
|
2014-07-04 22:11:39 +02:00
|
|
|
sendUpdate = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
if (sendUpdate) {
|
2014-07-04 22:11:39 +02:00
|
|
|
this.markDirty();
|
|
|
|
this.state = this.deviceCookTime > 0 ? (byte) 1 : (byte) 0;
|
2023-01-03 17:47:36 +01:00
|
|
|
this.worldObj.addBlockEvent(
|
|
|
|
this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.state
|
|
|
|
);
|
|
|
|
PacketHandler.INSTANCE.sendToAllAround(
|
|
|
|
new MessageTileEntityAludel(this, inventory[OUTPUT_INVENTORY_INDEX]),
|
|
|
|
new NetworkRegistry.TargetPoint(
|
|
|
|
this.worldObj.provider.dimensionId,
|
|
|
|
(double) this.xCoord,
|
|
|
|
(double) this.yCoord,
|
|
|
|
(double) this.zCoord,
|
|
|
|
128d
|
|
|
|
)
|
|
|
|
);
|
|
|
|
this.worldObj.notifyBlockChange(
|
|
|
|
this.xCoord, this.yCoord, this.zCoord, this.getBlockType()
|
|
|
|
);
|
2014-07-04 21:18:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-06 20:21:03 +02:00
|
|
|
@Override
|
2023-01-03 17:47:36 +01:00
|
|
|
public void markDirty() {
|
|
|
|
PacketHandler.INSTANCE.sendToAllAround(
|
|
|
|
new MessageTileEntityAludel(this, inventory[OUTPUT_INVENTORY_INDEX]),
|
|
|
|
new NetworkRegistry.TargetPoint(
|
|
|
|
this.worldObj.provider.dimensionId,
|
|
|
|
(double) this.xCoord,
|
|
|
|
(double) this.yCoord,
|
|
|
|
(double) this.zCoord,
|
|
|
|
128d
|
|
|
|
)
|
|
|
|
);
|
2014-07-06 20:21:03 +02:00
|
|
|
|
|
|
|
worldObj.func_147451_t(xCoord, yCoord, zCoord);
|
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
if (hasGlassBell) {
|
2014-07-06 20:21:03 +02:00
|
|
|
worldObj.func_147451_t(xCoord, yCoord + 1, zCoord);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
private boolean canInfuse() {
|
|
|
|
if (!hasGlassBell || inventory[INPUT_INVENTORY_INDEX] == null
|
|
|
|
|| inventory[DUST_INVENTORY_INDEX] == null) {
|
2014-07-03 22:00:25 +02:00
|
|
|
return false;
|
2023-01-03 17:47:36 +01:00
|
|
|
} else {
|
|
|
|
ItemStack infusedItemStack = AludelRecipeManager.getInstance().getResult(
|
|
|
|
inventory[INPUT_INVENTORY_INDEX], inventory[DUST_INVENTORY_INDEX]
|
|
|
|
);
|
2014-07-03 22:00:25 +02:00
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
if (infusedItemStack == null) {
|
2014-07-03 22:00:25 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
if (inventory[OUTPUT_INVENTORY_INDEX] == null) {
|
2014-07-03 22:00:25 +02:00
|
|
|
return true;
|
2023-01-03 17:47:36 +01:00
|
|
|
} else {
|
|
|
|
boolean outputEquals
|
|
|
|
= this.inventory[OUTPUT_INVENTORY_INDEX].isItemEqual(infusedItemStack
|
|
|
|
);
|
|
|
|
int mergedOutputStackSize
|
|
|
|
= this.inventory[OUTPUT_INVENTORY_INDEX].stackSize
|
|
|
|
+ infusedItemStack.stackSize;
|
|
|
|
|
|
|
|
if (outputEquals) {
|
|
|
|
return mergedOutputStackSize <= getInventoryStackLimit()
|
|
|
|
&& mergedOutputStackSize <= infusedItemStack.getMaxStackSize();
|
2014-07-03 22:00:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2014-07-04 22:11:39 +02:00
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
public void infuseItem() {
|
|
|
|
if (this.canInfuse()) {
|
|
|
|
RecipeAludel recipe = AludelRecipeManager.getInstance().getRecipe(
|
|
|
|
inventory[INPUT_INVENTORY_INDEX], inventory[DUST_INVENTORY_INDEX]
|
|
|
|
);
|
2014-07-04 22:11:39 +02:00
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
if (this.inventory[OUTPUT_INVENTORY_INDEX] == null) {
|
2014-07-04 22:11:39 +02:00
|
|
|
this.inventory[OUTPUT_INVENTORY_INDEX] = recipe.getRecipeOutput().copy();
|
2023-01-03 17:47:36 +01:00
|
|
|
} else if (this.inventory[OUTPUT_INVENTORY_INDEX].isItemEqual(
|
|
|
|
recipe.getRecipeOutput()
|
|
|
|
)) {
|
|
|
|
inventory[OUTPUT_INVENTORY_INDEX].stackSize
|
|
|
|
+= recipe.getRecipeOutput().stackSize;
|
2014-07-04 22:11:39 +02:00
|
|
|
}
|
|
|
|
|
2023-01-03 17:47:36 +01:00
|
|
|
decrStackSize(
|
|
|
|
INPUT_INVENTORY_INDEX, recipe.getRecipeInputs()[0].getStackSize()
|
|
|
|
);
|
|
|
|
decrStackSize(
|
|
|
|
DUST_INVENTORY_INDEX, recipe.getRecipeInputs()[1].getStackSize()
|
|
|
|
);
|
2014-07-04 22:11:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2023-01-03 17:47:36 +01:00
|
|
|
public int getCookProgressScaled(int scale) {
|
2014-07-04 22:11:39 +02:00
|
|
|
return this.itemCookTime * scale / 200;
|
|
|
|
}
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2023-01-03 17:47:36 +01:00
|
|
|
public int getBurnTimeRemainingScaled(int scale) {
|
|
|
|
if (this.fuelBurnTime > 0) {
|
2014-07-04 22:11:39 +02:00
|
|
|
return this.deviceCookTime * scale / this.fuelBurnTime;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2014-04-11 13:06:32 +02:00
|
|
|
}
|