-
-
Save DiabolicaTrix/b162d609e1244316fcb1d126546fe81f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package xyz.diabolicatrixlab.showcasemod.container; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.inventory.Container; | |
import net.minecraft.inventory.IInventory; | |
import net.minecraft.inventory.Slot; | |
import net.minecraft.item.ItemStack; | |
import net.minecraftforge.items.CapabilityItemHandler; | |
import net.minecraftforge.items.IItemHandler; | |
import net.minecraftforge.items.SlotItemHandler; | |
import xyz.diabolicatrixlab.showcasemod.tileentity.TileEntityShowcase; | |
public class ContainerShowcase extends Container { | |
private TileEntityShowcase te; | |
public ContainerShowcase(IInventory playerInv, TileEntityShowcase te) { | |
this.te = te; | |
this.addSlots(); | |
this.addInventorySlots(playerInv); | |
} | |
@Override | |
public boolean canInteractWith(EntityPlayer playerIn) { | |
return te.canInteractWith(playerIn); | |
} | |
private void addInventorySlots(IInventory inv){ | |
for(int row = 0; row < 3; row++){ | |
for(int col = 0; col < 9; col++){ | |
int x = 8 + col * 18; | |
int y = 101 + row * 18; | |
this.addSlotToContainer(new Slot(inv, col + row * 9 + 10, x, y)); | |
} | |
} | |
for(int col = 0; col < 9; col++){ | |
int x = 8 + col * 18; | |
int y = 89 + 70; | |
this.addSlotToContainer(new Slot(inv, col, x, y)); | |
} | |
} | |
private void addSlots() | |
{ | |
IItemHandler itemHandler = this.te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); | |
this.addSlotToContainer(new SlotShowcase(itemHandler, te, 0, 112, 21)); | |
} | |
@Override | |
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { | |
return ItemStack.EMPTY; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment