Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.misterfrogger.quintuplinator.client;
- import me.misterfrogger.quintuplinator.SlotRestricted;
- import me.misterfrogger.quintuplinator.TileEntityPurificationChamber;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.inventory.Container;
- import net.minecraft.inventory.Slot;
- import net.minecraft.item.ItemStack;
- public class ContainerPurificationChamber extends Container {
- private TileEntityPurificationChamber te;
- public ContainerPurificationChamber(InventoryPlayer player, TileEntityPurificationChamber entity){
- this.te = entity;
- for(int x = 0;x < 9;x++){
- addSlotToContainer(new Slot(player, x, 8 + x * 18, 142));
- }
- for(int y = 0;y < 3;y++){
- for(int x = 0;x < 9;x++){
- addSlotToContainer(new Slot(player, 9 + x + y * 9, 8 + x * 18, 84 + y * 18));
- }
- }
- addSlotToContainer(new Slot(te, 0, 56, 35));
- addSlotToContainer(new SlotRestricted(te, 1, 116, 35));
- }
- @Override
- public boolean canInteractWith(EntityPlayer player){
- return te.isUseableByPlayer(player);
- }
- @Override
- public ItemStack transferStackInSlot(EntityPlayer player, int i){
- if(te.worldObj.isRemote) return null;
- 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(!mergeItemStack(stack, 36, 36 + te.getSizeInventory(), false)){
- return null;
- }
- if(stack.stackSize == 0){
- slot.putStack(null);
- }else{
- slot.onSlotChanged();
- }
- slot.onPickupFromSlot(player, stack);
- te.onInventoryChanged();
- return result;
- }
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment