Skip to content

Instantly share code, notes, and snippets.

@JayZX535
Last active October 8, 2017 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayZX535/5d8b2947ca41ca03c073fee163ff4317 to your computer and use it in GitHub Desktop.
Save JayZX535/5d8b2947ca41ca03c073fee163ff4317 to your computer and use it in GitHub Desktop.
package com.wildcraft.wildcraft.items.util.container;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.lwjgl.opengl.GL11;
import com.google.common.collect.Lists;
import com.wildcraft.wildcraft.entity.canine.EntityWildCraftCanine;
import com.wildcraft.wildcraft.entity.canine.EntityWildCraftWolf;
import com.wildcraft.wildcraft.items.genetics.WCGeneTester;
import com.wildcraft.wildcraft.util.WildCraftSlotBasic;
import com.wildcraft.wildcraft.util.WildCraftSlotRestrict;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.IInventoryChangedListener;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemNameTag;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.SlotItemHandler;
public class WCGeneTesterContainer extends Container{
private WCGeneTester genetester;
public WCGeneTesterContainer(IInventory playerInv, WCGeneTester genetester)
{
this.genetester = genetester;
IItemHandler handler = genetester.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
this.addSlotToContainer(new WildCraftSlotRestrict(handler, 0, 180, 4, -1));
int xPos = 7;
int yPos = 98;
for (int y = 0; y < 3; ++y) {
for (int x = 0; x < 9; ++x) {
this.addSlotToContainer(new Slot(playerInv, x + y * 9 + 9, xPos + x * 18, yPos + y * 18));
}
}
for (int x = 0; x < 9; ++x) {
this.addSlotToContainer(new Slot(playerInv, x, xPos + x * 18, yPos + 58));
}
}
@Override
public boolean canInteractWith(EntityPlayer playerIn) {
return !playerIn.isSpectator();
}
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment