<commit_before>/**
 * This class was created by <Professorvennie>. It's distributed as
 * part of the Machinery Craft Mod. Get the Source Code in github:
 * https://github.com/Professorvennie/MachineryCraft
 *
 * Machinery Craft is Open Source and distributed under a
 * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
 * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
 * */
package com.professorvennie.machinerycraft.machines.bronze.charger;

import com.professorvennie.machinerycraft.api.steam.ISteamPoweredItem;
import com.professorvennie.machinerycraft.lib.Names;
import com.professorvennie.machinerycraft.machines.bronze.TileEntityBasicSteamMachine;
import net.minecraft.item.ItemStack;

/**
 * Created by ProfessorVennie on 10/4/2014 at 4:11 PM.
 */
public class TileEntityBronzeCharger extends TileEntityBasicSteamMachine {

    public TileEntityBronzeCharger() {
        super(Names.Containers.BRONZE_CHARGER);
    }

    @Override
    public int getSizeInventory() {
        return 4;
    }

    @Override
    public void updateEntity() {
        super.updateEntity();

        if (!worldObj.isRemote) {
            if (inventory[2] != null && inventory[2].getItem() instanceof ISteamPoweredItem) {
                ItemStack itemStack = inventory[2];
                int steam = itemStack.stackTagCompound.getInteger("Steam");
                int cap = ((ISteamPoweredItem) itemStack.getItem()).getSteamCapacity();
                if (steam < cap && canWork) {
                    if (this.tank.getFluidAmount() >= 10) {
                        itemStack.stackTagCompound.setInteger("Steam", steam + 10);
                        tank.getFluid().amount -= 10;
                    }
                } else if (steam == cap && canWork) {
                    inventory[3] = inventory[2].copy();
                    inventory[2] = null;
                }
            }
        }
    }<commit_msg>more work on charger<commit_after>/**
 * This class was created by <Professorvennie>. It's distributed as
 * part of the Machinery Craft Mod. Get the Source Code in github:
 * https://github.com/Professorvennie/MachineryCraft
 *
 * Machinery Craft is Open Source and distributed under a
 * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
 * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
 * */
package com.professorvennie.machinerycraft.machines.bronze.charger;

import com.professorvennie.machinerycraft.api.steam.ISteamPoweredItem;
import com.professorvennie.machinerycraft.items.ModItems;
import com.professorvennie.machinerycraft.lib.Names;
import com.professorvennie.machinerycraft.machines.bronze.TileEntityBasicSteamMachine;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;

/**
 * Created by ProfessorVennie on 10/4/2014 at 4:11 PM.
 */
public class TileEntityBronzeCharger extends TileEntityBasicSteamMachine {

    public TileEntityBronzeCharger() {
        super(Names.Containers.BRONZE_CHARGER);
        slots_bottom = new int[]{1, 3};
        slots_sides = new int[]{0};
        slots_top = new int[]{2};
    }

    @Override
    public int getSizeInventory() {
        return 4;
    }

    @Override
    public void updateEntity() {
        super.updateEntity();

        if (!worldObj.isRemote) {
            if (inventory[2] != null && inventory[2].getItem() instanceof ISteamPoweredItem) {
                ItemStack itemStack = inventory[2];
                int steam = itemStack.stackTagCompound.getInteger("Steam");
                int cap = ((ISteamPoweredItem) itemStack.getItem()).getSteamCapacity();
                if (steam < cap && canWork) {
                    if (this.tank.getFluidAmount() >= 10) {
                        itemStack.stackTagCompound.setInteger("Steam", steam + 10);
                        tank.getFluid().amount -= 10;
                    }
                } else if (steam == cap && canWork) {
                    inventory[3] = inventory[2].copy();
                    inventory[2] = null;
                }
            }
        }
    }

    @Override
    public boolean isItemValidForSlot(int slot, ItemStack itemStack) {
        if (slot == 2 && itemStack.getItem() instanceof ISteamPoweredItem)
            return true;
        else if (slot == 0 && itemStack.getItem() == ModItems.steamBucket)
            return true;
        else if (slot == 1 && itemStack.getItem() == Items.bucket)
            return true;
        else
            return false;
    }

    @Override
    public boolean canExtractItem(int slot, ItemStack itemStack, int i2) {
        if (slot == 3 || slot == 1)
            return true;
        return false;
    }
{'fraction_non_alphanumeric': 0.10692899914456801, 'fraction_numerical': 0.013686911890504704, 'mean_word_length': 2.3989825581395348, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2149724', 'n_tokens_mistral': 1444, 'n_tokens_neox': 1344, 'n_words': 297}