Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mrolas.muchMoney.common.gui.container;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- import mrolas.muchMoney.common.gui.container.slot.SlotCoin;
- import mrolas.muchMoney.common.item.Items;
- import mrolas.muchMoney.common.tileEntities.TileEntityShopStop;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.inventory.Container;
- import net.minecraft.inventory.ICrafting;
- import net.minecraft.inventory.Slot;
- import net.minecraft.item.ItemStack;
- public class ContainerShopStop
- extends Container
- {
- TileEntityShopStop shopStop;
- public ContainerShopStop (InventoryPlayer inventory, TileEntityShopStop entity)
- {
- this.shopStop = entity;
- //HotBar
- for (int x = 0; x < 9; x++)
- {
- addSlotToContainer(new Slot(inventory, x, 8 + 18*x, 232));
- }
- //Player Inventory
- for (int y = 0; y < 3; y++)
- {
- for (int x = 0; x < 9; x++)
- {
- addSlotToContainer(new Slot(inventory, 9 + x + 9*y, 8 + 18*x, 174 + 18*y));
- }
- }
- //Coin Slots
- for (int x = 0; x < 5; x++)
- {
- addSlotToContainer(new SlotCoin(entity, x, 8 + 18*x, 144));
- }
- //Item Slot
- addSlotToContainer(new Slot(entity, 5, 125, 144));
- }
- @Override
- public boolean canInteractWith(EntityPlayer entityplayer)
- {
- return shopStop.isUseableByPlayer(entityplayer);
- }
- public TileEntityShopStop getShopStop()
- {
- return this.shopStop;
- }
- @Override
- public ItemStack transferStackInSlot(EntityPlayer player, int i)
- {
- Slot slot = getSlot(i);
- if (slot != null && slot.getHasStack())
- {
- ItemStack stack = slot.getStack();
- ItemStack result = stack.copy();
- if (i >= 36)
- {
- if (!mergeItemStack(stack, 0, 36, false))
- {
- return null;
- }
- }
- else if (stack.itemID != Items.coin.itemID || !mergeItemStack(stack, 36, 41, false))
- {
- return null;
- }
- if (stack.stackSize == 0)
- {
- slot.putStack(null);
- }
- else
- {
- slot.onSlotChanged();
- }
- slot.onPickupFromSlot(player, stack);
- return result;
- }
- return null;
- }
- @Override
- public void addCraftingToCrafters (ICrafting player)
- {
- super.addCraftingToCrafters(player);
- }
- @Override
- @SideOnly(Side.CLIENT)
- public void updateProgressBar (int id, int data)
- {
- }
- @Override
- public void detectAndSendChanges ()
- {
- super.detectAndSendChanges();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement