Java Code Examples for net.minecraft.tileentity.TileEntityFurnace#isItemFuel()

The following examples show how to use net.minecraft.tileentity.TileEntityFurnace#isItemFuel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TileEntitySaltFurnace.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
    switch (i) {
        case 0:
            return TileEntityFurnace.isItemFuel(itemstack);
        case 2:
            return itemstack.isItemEqual(new ItemStack(Items.GLASS_BOTTLE, 1)) ||
                    itemstack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
    }
    return false;
}
 
Example 2
Source File: GuiAirCompressor.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void addPressureStatInfo(List<String> pressureStatText){
    super.addPressureStatInfo(pressureStatText);
    if(te.getBurnTimeRemainingScaled(12) > 0 || TileEntityFurnace.isItemFuel(te.getStackInSlot(0)) && te.redstoneAllows()) {
        pressureStatText.add("\u00a77Currently producing:");
        pressureStatText.add("\u00a70" + (double)Math.round(te.getBaseProduction() * te.getEfficiency() * te.getSpeedMultiplierFromUpgrades(te.getUpgradeSlots()) / 100) + " mL/tick.");
    }
}
 
Example 3
Source File: GuiAirCompressor.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void addProblems(List<String> textList){
    super.addProblems(textList);
    if(te.burnTime <= 0 && !TileEntityFurnace.isItemFuel(te.getStackInSlot(0))) {
        textList.add("\u00a77No fuel!");
        textList.add("\u00a70Insert any burnable item.");
    }
    List<Pair<ForgeDirection, IAirHandler>> teSurrounding = te.getConnectedPneumatics();
    if(teSurrounding.isEmpty()) {
        textList.add("\u00a77Air leaking!");
        textList.add("\u00a70Add pipes / machines");
        textList.add("\u00a70to the output.");
    }
}
 
Example 4
Source File: ContainerAirCompressor.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @param itemStack
 *            ItemStack to merge into inventory
 * @param start
 *            minimum slot to attempt fill
 * @param end
 *            maximum slot to attempt fill
 * @param backwards
 *            go backwards
 * @return true if stacks merged successfully public boolean
 *         mergeItemStack(itemStack, start, end, backwards)
 */

@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2){

    ItemStack var3 = null;
    Slot var4 = (Slot)inventorySlots.get(par2);

    if(var4 != null && var4.getHasStack()) {
        ItemStack var5 = var4.getStack();
        var3 = var5.copy();

        if(par2 < 5) {
            if(!mergeItemStack(var5, 5, 41, false)) return null;

            var4.onSlotChange(var5, var3);
        } else {
            if(var5.getItem() == Itemss.machineUpgrade) {
                if(!mergeItemStack(var5, 1, 5, false)) return null;
            } else if(TileEntityFurnace.isItemFuel(var5) && !mergeItemStack(var5, 0, 1, false)) return null;
            var4.onSlotChange(var5, var3);
        }

        if(var5.stackSize == 0) {
            var4.putStack((ItemStack)null);
        } else {
            var4.onSlotChanged();
        }

        if(var5.stackSize == var3.stackSize) return null;

        var4.onPickupFromSlot(par1EntityPlayer, var5);
    }

    return var3;
}
 
Example 5
Source File: TileEntityAirCompressor.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void updateEntity(){
    if(!worldObj.isRemote) {
        if(burnTime < curFuelUsage && inventory[0] != null && TileEntityFurnace.isItemFuel(inventory[0]) && redstoneAllows()) {
            burnTime += TileEntityFurnace.getItemBurnTime(inventory[0]);
            maxBurnTime = burnTime;

            inventory[0].stackSize--;
            if(inventory[0].stackSize == 0) {
                inventory[0] = inventory[0].getItem().getContainerItem(inventory[0]);
            }

        }

        curFuelUsage = (int)(getBaseProduction() * getSpeedUsageMultiplierFromUpgrades(getUpgradeSlots()) / 10);
        if(burnTime >= curFuelUsage) {
            burnTime -= curFuelUsage;
            if(!worldObj.isRemote) {
                addAir((int)(getBaseProduction() * getSpeedMultiplierFromUpgrades(getUpgradeSlots()) * getEfficiency() / 100D), ForgeDirection.UNKNOWN);
                onFuelBurn(curFuelUsage);
            }
        }
        isActive = burnTime > curFuelUsage;
    } else if(isActive) spawnBurningParticle();

    super.updateEntity();

}
 
Example 6
Source File: ContainerSaltFurnace.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
 */
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int index)
{
    // 0-3: Salt furnace inventory
    // 4-30: Player inventory
    // 31-39: Hot bar in the player inventory

    ItemStack itemStack = null;
    Slot slot = (Slot)this.inventorySlots.get(index);

    if (slot != null && slot.getHasStack())
    {
        ItemStack itemStack1 = slot.getStack();
        itemStack = itemStack1.copy();

        if (index == 1 || index == 3)
        {
            if (!this.mergeItemStack(itemStack1, 4, 40, true))
            {
                return ItemStack.EMPTY;
            }

            slot.onSlotChange(itemStack1, itemStack);
        }
        else if (index >= 4)
        {
            if (TileEntityFurnace.isItemFuel(itemStack1))
            {
                if (!this.mergeItemStack(itemStack1, 0, 1, false))
                {
                    return ItemStack.EMPTY;
                }
            }
            else if (itemStack1.getItem() == Items.GLASS_BOTTLE)
            {
                if (!this.mergeItemStack(itemStack1, 2, 3, false))
                {
                    return ItemStack.EMPTY;
                }
            }
            else if (index >= 4 && index < 31)
            {
                if (!this.mergeItemStack(itemStack1, 31, 40, false))
                {
                    return ItemStack.EMPTY;
                }
            }
            else if (index >= 31 && index < 40 && !this.mergeItemStack(itemStack1, 4, 31, false))
            {
                return ItemStack.EMPTY;
            }
        }
        else if (!this.mergeItemStack(itemStack1, 4, 40, false))
        {
            return ItemStack.EMPTY;
        }

        if (itemStack1.getCount() == 0)
        {
            slot.putStack(ItemStack.EMPTY);
        }
        else
        {
            slot.onSlotChanged();
        }

        if (itemStack1.getCount() == itemStack.getCount())
        {
            return ItemStack.EMPTY;
        }

        slot.onTake(par1EntityPlayer, itemStack1);
    }

    return itemStack;
}
 
Example 7
Source File: GTTileBaseFuelMachine.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
public boolean hasNewFuel() {
	return TileEntityFurnace.isItemFuel(this.inventory.get(getFuelSlot()));
}
 
Example 8
Source File: CapabilityMinecartDestination.java    From Signals with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isItemValidForSlot(int index, ItemStack stack){
    return stack == null || TileEntityFurnace.isItemFuel(stack);
}
 
Example 9
Source File: FuelInventory.java    From archimedes-ships with MIT License 4 votes vote down vote up
@Override
public boolean isItemValidForSlot(int i, ItemStack is)
{
	return i >= 0 && i < 4 && TileEntityFurnace.isItemFuel(is);
}
 
Example 10
Source File: TileEntityEngine.java    From archimedes-ships with MIT License 4 votes vote down vote up
@Override
public boolean isItemValidForSlot(int i, ItemStack is)
{
	return i >= 0 && i < 4 && TileEntityFurnace.isItemFuel(is);
}
 
Example 11
Source File: SlotFuel.java    From archimedes-ships with MIT License 4 votes vote down vote up
@Override
public boolean isItemValid(ItemStack itemstack)
{
	return TileEntityFurnace.isItemFuel(itemstack);
}