package tehnut.graves.compat;

import baubles.api.BaublesApi;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
import tehnut.graves.ConfigHandler;
import tehnut.graves.api.IGraveSaveable;
import tehnut.graves.tile.TileGrave;

public class CompatBaubles implements IGraveSaveable {

    @Override
    public boolean shouldHandle(EntityPlayer player) {
        return ConfigHandler.saveBaubles;
    }

    @Override
    public int handleInventory(TileGrave grave, EntityPlayer player, int offset) {
        IInventory baubles = BaublesApi.getBaubles(player);

        for (int slot = 0; slot < baubles.getSizeInventory(); slot++) {
            grave.getHandler().setStackInSlot(slot + offset, baubles.getStackInSlot(slot));
            baubles.setInventorySlotContents(slot, null);
        }

        return baubles.getSizeInventory();
    }

    @Override
    public void dropItems(EntityPlayer player) {
        IInventory baubles = BaublesApi.getBaubles(player);
        InventoryHelper.dropInventoryItems(player.getEntityWorld(), player.getPosition(), baubles);
        baubles.clear();
    }
}

@@ -59,53 +59,8 @@
 pi;%0A
-import net.minecraft.entity.item.EntityItem;%0A
 impo
@@ -100,24 +100,24 @@
 tityPlayer;%0A
+
 import net.m
@@ -199,45 +199,8 @@
 er;%0A
-import net.minecraft.item.ItemStack;%0A
 impo
@@ -227,24 +227,57 @@
 figHandler;%0A
+import tehnut.graves.api.IGrave;%0A
 import tehnu
@@ -308,45 +308,8 @@
 ble;
-%0Aimport tehnut.graves.tile.TileGrave;
 %0A%0Apu
@@ -529,12 +529,9 @@
 ory(
-Tile
+I
 Grav

Fix Baubles compat