Skip to content

Instantly share code, notes, and snippets.

@JayZX535
Created October 8, 2017 16:36
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/70d5040a2e2186854c8d22722818ca5f to your computer and use it in GitHub Desktop.
Save JayZX535/70d5040a2e2186854c8d22722818ca5f to your computer and use it in GitHub Desktop.
package com.wildcraft.wildcraft.util;
import com.wildcraft.wildcraft.items.collars.canine.WildCraftCanineCollar;
import com.wildcraft.wildcraft.items.genetics.WildCraftSyringe;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryBasic;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
import net.minecraftforge.items.IItemHandler;
public class WildCraftSlotRestrict extends WildCraftSlotBasic{
private static IInventory emptyInventory = new InventoryBasic("[Null]", true, 0);
private final IItemHandler itemHandler;
private final int index;
private int slottype;
public WildCraftSlotRestrict(IItemHandler handler, int index, int xPosition, int yPosition, int slottype) {
super(handler, index, xPosition, yPosition);
this.itemHandler = handler;
this.index = index;
this.slottype = slottype;
//SLOT TYPES:
//-1 genetic tester
//caniform- 0 (collar), 1 (armor), 2 (amulet)
}
@Override
public boolean isItemValid(ItemStack stack)
{
if (stack != null)
{
if (this.slottype == 0)
{
if (stack.getItem() instanceof WildCraftCanineCollar)
{
return true;
}
else
{
return false;
}
}
else if (this.slottype == -1)
{
if (stack.getItem() instanceof WildCraftSyringe)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment