All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minecraft.server.InventoryCraftResult Maven / Gradle / Ivy

package net.minecraft.server;

// CraftBukkit start

import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity;
// CraftBukkit end

public class InventoryCraftResult implements IInventory {

  private final ItemStack[] items = new ItemStack[1];

  // CraftBukkit start
  private int maxStack = MAX_STACK;

  public InventoryCraftResult() {
  }

  public ItemStack[] getContents() {
    return this.items;
  }

  public org.bukkit.inventory.InventoryHolder getOwner() {
    return null; // Result slots don't get an owner
  }

  // Don't need a transaction; the InventoryCrafting keeps track of it for us
  public void onOpen(CraftHumanEntity who) {
  }

  public void onClose(CraftHumanEntity who) {
  }

  public java.util.List getViewers() {
    return new java.util.ArrayList();
  }
  // CraftBukkit end

  public int getSize() {
    return 1;
  }

  public ItemStack getItem(int i) {
    return this.items[0];
  }

  public String getName() {
    return "Result";
  }

  public boolean hasCustomName() {
    return false;
  }

  public IChatBaseComponent getScoreboardDisplayName() {
    return this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatMessage(this.getName(), new Object[0]);
  }

  public ItemStack splitStack(int i, int j) {
    if (this.items[0] != null) {
      ItemStack itemstack = this.items[0];

      this.items[0] = null;
      return itemstack;
    } else {
      return null;
    }
  }

  public ItemStack splitWithoutUpdate(int i) {
    if (this.items[0] != null) {
      ItemStack itemstack = this.items[0];

      this.items[0] = null;
      return itemstack;
    } else {
      return null;
    }
  }

  public void setItem(int i, ItemStack itemstack) {
    this.items[0] = itemstack;
  }

  public int getMaxStackSize() {
    return maxStack; // CraftBukkit
  }

  public void setMaxStackSize(int size) {
    maxStack = size;
  }

  public void update() {
  }

  public boolean a(EntityHuman entityhuman) {
    return true;
  }

  public void startOpen(EntityHuman entityhuman) {
  }

  public void closeContainer(EntityHuman entityhuman) {
  }

  public boolean b(int i, ItemStack itemstack) {
    return true;
  }

  public int getProperty(int i) {
    return 0;
  }

  public void b(int i, int j) {
  }

  public int g() {
    return 0;
  }

  public void l() {
    for (int i = 0; i < this.items.length; ++i) {
      this.items[i] = null;
    }

  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy