@Override
  public ItemStack transferStackInSlot(EntityPlayer player, int id) {
    ItemStack stack = null;
    Slot slot = (Slot) this.inventorySlots.get(id);

    if (slot != null && slot.getHasStack()) {
      ItemStack stack1 = slot.getStack();
      stack = stack1.copy();

      ItemMatterUnit unit = ModuleCrafting.matterUnit;

      if (id < 4) { // tileInv->playerInv
        if (!this.mergeItemStack(stack1, 4, this.inventorySlots.size(), true)) return null;
      } else {
        // playerInv->tileInv
        if (unit.getMaterial(stack) == ModuleCrafting.imagPhase.mat) {
          if (!this.mergeItemStack(stack1, 2, 3, false)) return null;
        } else if (IFItemManager.instance.isSupported(stack)) {
          if (!this.mergeItemStack(stack1, 3, 4, false)) return null;
        } else {
          if (!this.mergeItemStack(stack1, 0, 1, false)) return null;
        }
      }

      if (stack1.stackSize == 0) {
        slot.putStack((ItemStack) null);
      } else {
        slot.onSlotChanged();
      }
    }

    return stack;
  }
Exemplo n.º 2
0
  public BlockImagPhase() {
    super(ModuleCrafting.fluidImagProj, Material.water);
    setCreativeTab(AcademyCraft.cct);
    setBlockName("ac_phase_liquid");
    setBlockTextureName("academy:black");

    this.setQuantaPerBlock(3);

    mat = new MatterMaterial("phase_liquid", this);
    ItemMatterUnit.addMatterMaterial(mat);

    MinecraftForge.EVENT_BUS.register(this);
  }