Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.darki.util;
- 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;
- public class containerMel extends Container {
- @Override
- public boolean canInteractWith(EntityPlayer playerIn) {
- return true;
- }
- public containerMel(IInventory playerInv, teMel tm) {
- int i = -18;
- int j;
- int k;
- for (j = 0; j < 14; ++j){
- for (k = 0; k < 3; ++k) {
- //Input
- this.addSlotToContainer(new Slot(playerInv, 1, 34, 17));
- this.addSlotToContainer(new Slot(playerInv, 1, 34, 35));
- this.addSlotToContainer(new Slot(playerInv, 1, 34, 54));
- this.addSlotToContainer(new Slot(playerInv, 1, 126, 17));
- this.addSlotToContainer(new Slot(playerInv, 1, 126, 35));
- this.addSlotToContainer(new Slot(playerInv, 1, 126, 54));
- //Output
- this.addSlotToContainer(new Slot(playerInv, 1, 80, 35));
- }
- }
- for (j = 0; j < 9; ++j) {
- this.addSlotToContainer(new Slot(playerInv, j, 8 + j * 18, 160 + i));
- }
- }
- public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
- ItemStack itemstack = null;
- Slot slot = (Slot)this.inventorySlots.get(index);
- if (slot != null && slot.getHasStack()) {
- ItemStack itemstack1 = slot.getStack();
- itemstack = itemstack1.copy();
- if (index < 27) {
- if (!this.mergeItemStack(itemstack1, 27, this.inventorySlots.size(), true)) {
- return null;
- }
- }
- else if(!this.mergeItemStack(itemstack1, 0, 27, false)) {
- return null;
- }
- if (itemstack1.stackSize == 0) {
- slot.putStack((ItemStack)null);
- }
- else {
- slot.onSlotChanged();
- }
- }
- return itemstack;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement