Skip to content

Commit

Permalink
Fix for #289
Browse files Browse the repository at this point in the history
  • Loading branch information
NightKosh committed Oct 19, 2018
1 parent 5a78af6 commit 873633e
Showing 1 changed file with 12 additions and 16 deletions.
@@ -1,12 +1,8 @@
package nightkosh.gravestone.core.compatibility;

import micdoodle8.mods.galacticraft.api.inventory.AccessInventoryGC;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import nightkosh.gravestone.api.GraveStoneAPI;
import nightkosh.gravestone.config.Config;
import nightkosh.gravestone.core.logger.GSLogger;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -25,18 +21,18 @@ protected CompatibilityGalacticraft() {
if (isModLoaded(MOD_ID) && Config.storeGalacticraftItems) {
GraveStoneAPI.graveGenerationAtDeath.addPlayerItemsHandler((player, source) -> {
List<ItemStack> items = new ArrayList<>();
IInventory inventory = AccessInventoryGC.getGCInventoryForPlayer((EntityPlayerMP) player);
if (inventory != null) {
for (int slot = 0; slot < inventory.getSizeInventory(); slot++) {
ItemStack stack = inventory.getStackInSlot(slot);
if (stack != null && !stack.isEmpty()) {
items.add(stack.copy());
inventory.setInventorySlotContents(slot, ItemStack.EMPTY);
}
}
} else {
GSLogger.logError("Can't save Galacticraft items!!!");
}
// IInventory inventory = AccessInventoryGC.getGCInventoryForPlayer((EntityPlayerMP) player);
// if (inventory != null) {
// for (int slot = 0; slot < inventory.getSizeInventory(); slot++) {
// ItemStack stack = inventory.getStackInSlot(slot);
// if (stack != null && !stack.isEmpty()) {
// items.add(stack.copy());
// inventory.setInventorySlotContents(slot, ItemStack.EMPTY);
// }
// }
// } else {
// GSLogger.logError("Can't save Galacticraft items!!!");
// }
return items;
});
}
Expand Down

0 comments on commit 873633e

Please sign in to comment.