Печка 1.12.2

Версия Minecraft
1.12.2
API
Forge
25
2
0
Есть печка с 4-мя слотами (1-топливо,2-вывод и 3-4-ингредиенты)

Всё работает, но после приготовления, предметы остаются в слотах, а результат не появляется, и начинает заново готовить, в чём может быть ошибка? (топливо уходит)


Файлы:

Java:
package ru.wertyfiregames.craftablecreatures.block;

import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import ru.wertyfiregames.craftablecreatures.CraftableCreatures;
import ru.wertyfiregames.craftablecreatures.creativetab.CCCreativeTabs;
import ru.wertyfiregames.craftablecreatures.tileentity.TileEntitySoulExtractor;

import javax.annotation.Nullable;
import java.util.Random;

public class BlockSoulExtractor extends BlockDefault implements ITileEntityProvider {
    public static final PropertyDirection FACING = BlockHorizontal.FACING;
    public static final PropertyBool EXTRACTING = PropertyBool.create("extracting");

    public BlockSoulExtractor() {
        super(Material.IRON, "soulExtractor", "soul_extractor", CCCreativeTabs.tabCraftableCreatures,
                "pickaxe", 2, 5f, 10f);
        this.setDefaultState(this.getDefaultState().withProperty(FACING, EnumFacing.NORTH).withProperty(EXTRACTING,
                false));
    }

    @Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune) {
        return Item.getItemFromBlock(CCBlocks.SOUL_EXTRACTOR);
    }

    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
                                    EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
        if (!worldIn.isRemote) {
            playerIn.openGui(CraftableCreatures.INSTANCE, CraftableCreatures.GUI_SOUL_EXTRACTOR, worldIn, pos.getX(),
                    pos.getY(), pos.getZ());
        }

        return true;
    }

    @Override
    public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
        if (!worldIn.isRemote) {
            IBlockState north = worldIn.getBlockState(pos.north());
            IBlockState south = worldIn.getBlockState(pos.south());
            IBlockState west = worldIn.getBlockState(pos.west());
            IBlockState east = worldIn.getBlockState(pos.east());
            EnumFacing face = state.getValue(FACING);

            if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) face = EnumFacing.SOUTH;
            else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) face = EnumFacing.SOUTH;
            else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) face = EnumFacing.EAST;
            else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) face = EnumFacing.WEST;
            worldIn.setBlockState(pos, state.withProperty(FACING, face), 2);
        }
    }

    public static void setState(boolean isActive, World worldIn, BlockPos pos) {
        IBlockState state = worldIn.getBlockState(pos);
        TileEntity tile = worldIn.getTileEntity(pos);

        if (isActive) worldIn.setBlockState(pos, CCBlocks.SOUL_EXTRACTOR.getDefaultState().withProperty(FACING,
                state.getValue(FACING)).withProperty(EXTRACTING, true), 3);
        else worldIn.setBlockState(pos, CCBlocks.SOUL_EXTRACTOR.getDefaultState().withProperty(FACING, state.getValue(FACING))
                .withProperty(EXTRACTING, false), 3);

        if (tile != null) {
            tile.validate();
            worldIn.setTileEntity(pos, tile);
        }
    }

    @Nullable
    @Override
    public TileEntity createNewTileEntity(World worldIn, int meta) {
        return new TileEntitySoulExtractor();
    }

    @Override
    public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
        return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
    }

    @Override
    public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
        worldIn.setBlockState(pos, this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);
    }

    @Override
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
        TileEntitySoulExtractor tile = (TileEntitySoulExtractor) worldIn.getTileEntity(pos);
        InventoryHelper.dropInventoryItems(worldIn, pos, tile);
        worldIn.removeTileEntity(pos);
    }

    @Override
    public EnumBlockRenderType getRenderType(IBlockState state) {
        return EnumBlockRenderType.MODEL;
    }

    @Override
    public IBlockState withRotation(IBlockState state, Rotation rot) {
        return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
    }

    @Override
    public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
        return state.withRotation(mirrorIn.toRotation(state.getValue(FACING)));
    }

    @Override
    protected BlockStateContainer createBlockState() {
        return new BlockStateContainer(this, EXTRACTING, FACING);
    }

    @Override
    public IBlockState getStateFromMeta(int meta) {
        EnumFacing facing = EnumFacing.getFront(meta);
        if (facing.getAxis() == EnumFacing.Axis.Y) facing = EnumFacing.NORTH;
        return this.getDefaultState().withProperty(FACING, facing);
    }

    @Override
    public int getMetaFromState(IBlockState state) {
        return (state.getValue(FACING)).getIndex();
    }
}

Java:
package ru.wertyfiregames.craftablecreatures.tileentity;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ITickable;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import ru.wertyfiregames.craftablecreatures.block.BlockSoulExtractor;
import ru.wertyfiregames.craftablecreatures.block.CCBlocks;
import ru.wertyfiregames.craftablecreatures.item.CCItems;
import ru.wertyfiregames.craftablecreatures.recipe.SoulExtractorRecipes;

import javax.annotation.Nullable;

public class TileEntitySoulExtractor extends TileEntity implements IInventory, ITickable {
    private NonNullList<ItemStack> inventory = NonNullList.withSize(4, ItemStack.EMPTY);
    private String title;

    private int burnTime,
            currentBurnTime,
            cookTime,
            totalCookTime;

    @Override
    public String getName() {
        return this.hasCustomName() ? this.title : "container.soulExtractor";
    }

    @Override
    public boolean hasCustomName() {
        return title != null && !title.isEmpty();
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Nullable
    @Override
    public ITextComponent getDisplayName() {
        return this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName());
    }

    @Override
    public int getSizeInventory() {
        return this.inventory.size();
    }

    @Override
    public boolean isEmpty() {
        for (ItemStack stack : this.inventory) {
            if (!stack.isEmpty()) return false;
        }
        return true;
    }

    @Override
    public ItemStack getStackInSlot(int index) {
        return this.inventory.get(index);
    }

    @Override
    public ItemStack decrStackSize(int index, int count) {
        return ItemStackHelper.getAndSplit(this.inventory, index, count);
    }

    @Override
    public ItemStack removeStackFromSlot(int index) {
        return ItemStackHelper.getAndRemove(this.inventory, index);
    }

    @Override
    public void setInventorySlotContents(int index, ItemStack stack) {
        ItemStack stack1 = this.inventory.get(index);
        boolean flag = !stack.isEmpty() && stack.isItemEqual(stack1) && ItemStack.areItemStackTagsEqual(stack, stack1);
        this.inventory.set(index, stack);

        if (stack.getCount() > this.getInventoryStackLimit())
            stack.setCount(this.getInventoryStackLimit());
        if (index + 1 == 1 && !flag) {
            ItemStack stack2 = this.inventory.get(index + 1);
            this.totalCookTime = this.getCookTime(stack, stack2);
            this.cookTime = 0;
            this.markDirty();
        }
    }

    @Override
    public void readFromNBT(NBTTagCompound compound) {
        super.readFromNBT(compound);
        inventory = NonNullList.withSize(this.getSizeInventory(), ItemStack.EMPTY);
        ItemStackHelper.loadAllItems(compound, inventory);
        this.burnTime = compound.getInteger("BurnTime");
        this.cookTime = compound.getInteger("CookTime");
        this.totalCookTime = compound.getInteger("TotalCookTime");
        this.currentBurnTime = getItemBurnTime(this.inventory.get(2));

        if (compound.hasKey("CustomName", 8)) this.setTitle(compound.getString("CustomName"));
    }

    @Override
    public NBTTagCompound writeToNBT(NBTTagCompound compound) {
        super.writeToNBT(compound);
        compound.setInteger("BurnTime", this.burnTime);
        compound.setInteger("CookTime", this.cookTime);
        compound.setInteger("TotalCookTime", this.totalCookTime);
        ItemStackHelper.saveAllItems(compound, this.inventory);

        if (this.hasCustomName()) compound.setString("CustomName", this.title);
        return compound;
    }

    @Override
    public int getInventoryStackLimit() {
        return 64;
    }

    public boolean isBurning() {
        return this.burnTime > 0;
    }

    @SideOnly(Side.CLIENT)
    public static boolean isBurning(IInventory inventory) {
        return inventory.getField(0) > 0;
    }

    @Override
    public void update() {
        boolean flag = this.isBurning(),
                flag1 = false;
        if (this.isBurning()) --this.burnTime;

        if (!this.world.isRemote) {
            ItemStack stack = this.inventory.get(2);

            if (this.isBurning() || !stack.isEmpty() && !(((this.inventory.get(0)).isEmpty()) || (this.inventory.get(1)).isEmpty())) {
                if (!this.isBurning() && this.canSmelt()) {
                    this.burnTime = getItemBurnTime(stack);
                    this.currentBurnTime = this.burnTime;

                    if (this.isBurning()) {
                        flag1 = true;

                        if (!stack.isEmpty()) {
                            Item item = stack.getItem();
                            stack.shrink(1);

                            if (stack.isEmpty()) {
                                ItemStack stack1 = item.getContainerItem(stack);
                                inventory.set(2, stack1);
                            }
                        }
                    }
                }

                if (this.isBurning() && this.canSmelt()) {
                    ++this.cookTime;

                    if (this.cookTime == this.totalCookTime) {
                        this.cookTime = 0;
                        this.totalCookTime = this.getCookTime(inventory.get(0), inventory.get(1));
                        flag1 = true;
                    }
                } else this.cookTime = 0;
            } else if (!this.isBurning() && this.cookTime > 0) {
                this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.totalCookTime);
            }

            if (flag != isBurning()) {
                flag1 = true;
                BlockSoulExtractor.setState(this.isBurning(), this.world, this.pos);
            }
        }
        if (flag1) this.markDirty();
    }

    public int getCookTime(ItemStack input1, ItemStack input2) {
        return 200;
    }

    private boolean canSmelt() {
        if ((inventory.get(0)).isEmpty() || (inventory.get(1)).isEmpty()) return false;
        else {
            ItemStack result = SoulExtractorRecipes.get().getExtractingResult(inventory.get(0), inventory.get(1));
            if (result.isEmpty()) return false;
            else {
                ItemStack output = inventory.get(3);
                if (output.isEmpty()) return true;
                if (!output.isItemEqual(result)) return false;
                int res = output.getCount() + result.getCount();
                return res <= getInventoryStackLimit() && res <= output.getMaxStackSize();
            }
        }
    }

    public void smeltItem() {
        if (this.canSmelt()) {
            ItemStack input1 = inventory.get(0);
            ItemStack input2 = inventory.get(1);
            ItemStack result = SoulExtractorRecipes.get().getExtractingResult(input1, input2);
            ItemStack output = inventory.get(3);

            if (output.isEmpty()) inventory.set(3, result.copy());
            else if (output.getItem() == result.getItem()) output.grow(result.getCount());

            input1.shrink(1);
            input2.shrink(1);
        }
    }

    public static int getItemBurnTime(ItemStack fuel) {
        if (fuel.isEmpty()) return 0;
        else {
            Item item = fuel.getItem();

            if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR) {
                Block block = Block.getBlockFromItem(item);

                if (block == CCBlocks.BLUESTONE_ORE) return 1500;
                if (block == CCBlocks.BLUESTONE_BLOCK) return 16000;
            }

            if (item == CCItems.BLUESTONE) return 1600;

            return 0;
        }
    }

    public static boolean isItemFuel(ItemStack fuel) {
        return getItemBurnTime(fuel) > 0;
    }

    @Override
    public boolean isUsableByPlayer(EntityPlayer player) {
        return this.world.getTileEntity(this.pos) == this && player.getDistanceSq(this.pos.getX() + 0.5D,
                this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64;
    }

    @Override
    public void openInventory(EntityPlayer player) { }

    @Override
    public void closeInventory(EntityPlayer player) { }

    @Override
    public boolean isItemValidForSlot(int index, ItemStack stack) {
        if (index == 3) return false;
        else if (index != 2) return true;
        else return isItemFuel(stack);
    }

    public String getGuiID() {
        return "craftable_creatures:soul_extractor";
    }

    @Override
    public int getField(int ID) {
        switch (ID) {
            case 0:
                return this.burnTime;
            case 1:
                return this.currentBurnTime;
            case 2:
                return this.cookTime;
            case 3:
                return this.totalCookTime;
            default:
                return 0;
        }
    }

    @Override
    public void setField(int ID, int value) {
        switch (ID) {
            case 0:
                this.burnTime = value;
                break;
            case 1:
                this.currentBurnTime = value;
                break;
            case 2:
                this.cookTime = value;
                break;
            case 3:
                this.totalCookTime = value;
        }
    }

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

    public void clear() {
        inventory.clear();
    }
}

Код:
package ru.wertyfiregames.craftablecreatures.inventory;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import ru.wertyfiregames.craftablecreatures.recipe.SoulExtractorRecipes;
import ru.wertyfiregames.craftablecreatures.tileentity.TileEntitySoulExtractor;

public class ContainerSoulExtractor extends Container {
private final TileEntitySoulExtractor tile;
private int cookTime, totalCookTime, burnTime, currentBurnTime;

public ContainerSoulExtractor(InventoryPlayer player, TileEntitySoulExtractor soulExtractor) {
 tile = soulExtractor;

this.addSlotToContainer(new Slot(tile, 0, 56, 17));
this.addSlotToContainer(new Slot(tile, 1, 56, 53));
this.addSlotToContainer(new SlotSoulExtractorFuel(tile, 2, 15, 53));
this.addSlotToContainer(new SlotSoulExtractorOutput(player.player, tile, 3, 116, 35));

for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
this.addSlotToContainer(new Slot(player, x + y * 9 + 9, 8 + x * 18, 84 + y * 18));
            }
        }

for (int x = 0; x < 9; x++) {
this.addSlotToContainer(new Slot(player, x, 8 + x * 18, 142));
        }
    }

@Override
    public void addListener(IContainerListener listener) {
 super.addListener(listener);
listener.sendAllWindowProperties(this, tile);
    }

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

for (int i = 0; i < listeners.size(); i++) {
IContainerListener listener = listeners.get(i);

if (cookTime != tile.getField(2)) listener.sendWindowProperty(this,
2, tile.getField(2));
if (burnTime != tile.getField(0)) listener.sendWindowProperty(this,
0, tile.getField(0));
if (currentBurnTime != tile.getField(1)) listener.sendWindowProperty(this,
1, tile.getField(1));
if (totalCookTime != tile.getField(3)) listener.sendWindowProperty(this,
3, tile.getField(3));
        }

cookTime = tile.getField(2);
burnTime = tile.getField(0);
currentBurnTime = tile.getField(1);
totalCookTime = tile.getField(3);
    }

@Override
    public void updateProgressBar(int id, int data) {
 tile.setField(id, data);
    }

@Override
    public boolean canInteractWith(EntityPlayer playerIn) {
return tile.isUsableByPlayer(playerIn);
    }

@Override
    public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
ItemStack stack = ItemStack.EMPTY;
Slot slot = inventorySlots.get(index);

if (slot != null && slot.getHasStack()) {
            ItemStack stack1 = slot.getStack();
            stack = stack1.copy();

if (index == 3) {
if (!mergeItemStack(stack1, 4, 40, true)) return ItemStack.EMPTY;
                slot.onSlotChange(stack1, stack);
} else if (index != 2 && index != 1 && index != 0) {
Slot slot1 = inventorySlots.get(index + 1);

if (!SoulExtractorRecipes.get().getExtractingResult(stack1, slot1.getStack()).isEmpty()) {
if (!mergeItemStack(stack1, 0, 2, false)) {
return ItemStack.EMPTY;
} else if (TileEntitySoulExtractor.isItemFuel(stack1)) {
if (!mergeItemStack(stack1, 2, 3, false)) return ItemStack.EMPTY;
} else if (TileEntitySoulExtractor.isItemFuel(stack1)) {
if (!mergeItemStack(stack1, 2, 3, false)) return ItemStack.EMPTY;
} else if (TileEntitySoulExtractor.isItemFuel(stack1)) {
if (!mergeItemStack(stack1, 2, 3, false)) return ItemStack.EMPTY;
} else if (index >= 4 && index < 31) {
if (!mergeItemStack(stack1, 31 ,40, false)) return ItemStack.EMPTY;
} else if (index >= 31 && index < 40 && !mergeItemStack(stack1, 4, 31, false)) {
return ItemStack.EMPTY;
                    }
                }
} else if (!mergeItemStack(stack1, 4, 40, false)) {
return ItemStack.EMPTY;
            }

 if (stack1.isEmpty()) {
slot.putStack(ItemStack.EMPTY);
} else {
                slot.onSlotChanged();
            }

if (stack1.getCount() == stack.getCount()) return ItemStack.EMPTY;
            slot.onTake(playerIn, stack1);
        }

 return stack;
    }
}

Код:
package ru.wertyfiregames.craftablecreatures.client.gui.inventory;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import ru.wertyfiregames.craftablecreatures.CraftableCreatures;
import ru.wertyfiregames.craftablecreatures.inventory.ContainerSoulExtractor;
import ru.wertyfiregames.craftablecreatures.tileentity.TileEntitySoulExtractor;

public class GuiSoulExtractor extends GuiContainer {
private static final ResourceLocation TEXTURES = new ResourceLocation(CraftableCreatures.getModId() +
 ":textures/gui/container/soul_extractor.png");
private final InventoryPlayer player;
private final TileEntitySoulExtractor tile;

public GuiSoulExtractor(InventoryPlayer player, TileEntitySoulExtractor soulExtractor) {
super(new ContainerSoulExtractor(player, soulExtractor));
this.player = player;
 tile = soulExtractor;
    }

@Override
    protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
String title = tile.getDisplayName().getUnformattedText();
fontRenderer.drawString(title, (xSize / 2 - fontRenderer.getStringWidth(title) / 2 + 3), 8, 4210752);
fontRenderer.drawString(player.getDisplayName().getUnformattedText(), 122, ySize - 96 + 2, 4210752);
    }

@Override
    protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color(1F, 1F, 1F, 1F);
mc.getTextureManager().bindTexture(TEXTURES);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);

if (TileEntitySoulExtractor.isBurning(tile)) {
int k = getBurnLeftScaled(13);
drawTexturedModalRect(guiLeft + 8, guiTop + 54 + 12 - k, 176, 12 - k, 14, k + 1);
        }

int l = getCookProgressScaled(41);
drawTexturedModalRect(guiLeft + 62, guiTop + 36, 176, 14, l + 1, 17);
    }

private int getBurnLeftScaled(int pixels) {
int i = tile.getField(1);
if (i == 0) i = 200;
return tile.getField(0) * pixels / i;
    }

private int getCookProgressScaled(int pixels) {
int i = tile.getField(2);
int j = tile.getField(3);
return j != 0 && i != 0 ? i * pixels / j : 0;
    }
}

Java:
package ru.wertyfiregames.craftablecreatures.recipe;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Maps;
import com.google.common.collect.Table;
import net.minecraft.item.ItemStack;
import ru.wertyfiregames.craftablecreatures.item.CCItems;

import java.util.Map;
import java.util.Map.Entry;

public class SoulExtractorRecipes {
    private static final SoulExtractorRecipes instance = new SoulExtractorRecipes();
    private final Table<ItemStack, ItemStack, ItemStack> extractingList = HashBasedTable.create();
    private final Map<ItemStack, Float> experienceList = Maps.newHashMap();

    public SoulExtractorRecipes() {
        addExtractingRecipe(new ItemStack(CCItems.SOUL_ELEMENT),
                new ItemStack(CCItems.SOUL_ELEMENT), new ItemStack(CCItems.BAT_WING), 10F);
    }

    public static SoulExtractorRecipes get() {
        return instance;
    }

    public void addExtractingRecipe(ItemStack output, ItemStack inputSoulType, ItemStack input, float exp) {
        if (getExtractingResult(inputSoulType, input) != net.minecraft.item.ItemStack.EMPTY) return;
        this.extractingList.put(inputSoulType, input, output);
        this.experienceList.put(output, exp);
    }

    public ItemStack getExtractingResult(ItemStack soul, ItemStack input) {
        for (Entry<ItemStack, Map<ItemStack, ItemStack>> entry : this.extractingList.columnMap().entrySet()) {
            if (this.compareItemStacks(soul, entry.getKey())) {
                for (Entry<ItemStack, ItemStack> entry1 : entry.getValue().entrySet()) {
                    if (this.compareItemStacks(input, entry1.getKey())) {
                        return entry1.getValue();
                    }
                }
            }
        }

        return net.minecraft.item.ItemStack.EMPTY;
    }

    private boolean compareItemStacks(ItemStack stack1, ItemStack stack2) {
        return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == 32767 || stack2.getMetadata() == stack1.getMetadata());
    }

    public Table<ItemStack, ItemStack, ItemStack> getDualExtractingList() {
        return this.extractingList;
    }

    public float getExtractingExp(ItemStack stack) {
        for (Entry<ItemStack, Float> entry : this.experienceList.entrySet()) {
            if (this.compareItemStacks(stack, entry.getKey())) {
                return entry.getValue();
            }
        }

        return 0.0F;
    }
}
 
Сверху