Class ContainerCrafting

java.lang.Object
net.minecraft.world.inventory.AbstractContainerMenu
com.minecolonies.api.inventory.container.ContainerCrafting

public class ContainerCrafting extends net.minecraft.world.inventory.AbstractContainerMenu
Crafting container for the recipe teaching of normal crafting recipes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final net.minecraft.world.inventory.CraftingContainer
    The crafting matrix inventory (2x2).
    final net.minecraft.world.inventory.ResultContainer
    The crafting matrix inventory (2x2 or 3x3).

    Fields inherited from class net.minecraft.world.inventory.AbstractContainerMenu

    CARRIED_SLOT_SIZE, containerId, QUICKCRAFT_HEADER_CONTINUE, QUICKCRAFT_HEADER_END, QUICKCRAFT_HEADER_START, QUICKCRAFT_TYPE_CHARITABLE, QUICKCRAFT_TYPE_CLONE, QUICKCRAFT_TYPE_GREEDY, SLOT_CLICKED_OUTSIDE, slots
  • Constructor Summary

    Constructors
    Constructor
    Description
    ContainerCrafting(int windowId, net.minecraft.world.entity.player.Inventory inv, boolean complete, net.minecraft.core.BlockPos pos, int moduleId)
    Creates a crafting container.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    boolean
    canTakeItemForPickAll(net.minecraft.world.item.ItemStack stack, net.minecraft.world.inventory.Slot slotIn)
     
    void
    clicked(int slotId, int clickedButton, @NotNull net.minecraft.world.inventory.ClickType mode, @NotNull net.minecraft.world.entity.player.Player playerIn)
     
    fromFriendlyByteBuf(int windowId, net.minecraft.world.entity.player.Inventory inv, net.minecraft.network.FriendlyByteBuf packetBuffer)
    Deserialize packet buffer to container instance.
    net.minecraft.world.inventory.CraftingContainer
    Get the craft matrix inv.
    int
    Getter for the module id.
    net.minecraft.world.entity.player.Player
    Getter for the player.
    net.minecraft.core.BlockPos
    Get for the container position.
    List<net.minecraft.world.item.ItemStack>
    Get for the remaining items.
    net.minecraft.world.level.Level
    Getter for the world obj.
    net.minecraft.world.item.ItemStack
    handleSlotClick(net.minecraft.world.inventory.Slot slot, net.minecraft.world.item.ItemStack stack)
    Handle a slot click.
    boolean
    Getter for completeness.
    @NotNull net.minecraft.world.item.ItemStack
    quickMoveStack(net.minecraft.world.entity.player.Player playerIn, int index)
     
    void
    slotsChanged(net.minecraft.world.Container inventoryIn)
    Callback for when the crafting matrix is changed.
    boolean
    stillValid(@NotNull net.minecraft.world.entity.player.Player playerIn)
     
    void
    Switch to the next possible recipe (when more than one are available).

    Methods inherited from class net.minecraft.world.inventory.AbstractContainerMenu

    addDataSlot, addDataSlots, addSlot, addSlotListener, broadcastChanges, broadcastFullState, canDragTo, canItemQuickReplace, checkContainerDataCount, checkContainerSize, clearContainer, clickMenuButton, findSlot, getCarried, getItems, getQuickcraftHeader, getQuickcraftMask, getQuickCraftPlaceCount, getQuickcraftType, getRedstoneSignalFromBlockEntity, getRedstoneSignalFromContainer, getSlot, getStateId, getType, incrementStateId, initializeContents, isValidQuickcraftType, isValidSlotIndex, moveItemStackTo, removed, removeSlotListener, resetQuickCraft, resumeRemoteUpdates, sendAllDataToRemote, setCarried, setData, setItem, setRemoteCarried, setRemoteSlot, setRemoteSlotNoCopy, setSynchronizer, stillValid, suppressRemoteUpdates, transferState

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • craftMatrix

      public final net.minecraft.world.inventory.CraftingContainer craftMatrix
      The crafting matrix inventory (2x2).
    • craftResult

      public final net.minecraft.world.inventory.ResultContainer craftResult
      The crafting matrix inventory (2x2 or 3x3).
  • Constructor Details

    • ContainerCrafting

      public ContainerCrafting(int windowId, net.minecraft.world.entity.player.Inventory inv, boolean complete, net.minecraft.core.BlockPos pos, int moduleId)
      Creates a crafting container.
      Parameters:
      windowId - the window id.
      inv - the inventory.
      moduleId - the module id.
  • Method Details

    • fromFriendlyByteBuf

      public static ContainerCrafting fromFriendlyByteBuf(int windowId, net.minecraft.world.entity.player.Inventory inv, net.minecraft.network.FriendlyByteBuf packetBuffer)
      Deserialize packet buffer to container instance.
      Parameters:
      windowId - the id of the window.
      inv - the player inventory.
      packetBuffer - network buffer
      Returns:
      new instance
    • slotsChanged

      public void slotsChanged(net.minecraft.world.Container inventoryIn)
      Callback for when the crafting matrix is changed.
      Overrides:
      slotsChanged in class net.minecraft.world.inventory.AbstractContainerMenu
    • canSwitchRecipes

      public boolean canSwitchRecipes()
      Returns:
      true if recipe switching is possible.
    • switchRecipes

      public void switchRecipes()
      Switch to the next possible recipe (when more than one are available).
    • stillValid

      public boolean stillValid(@NotNull @NotNull net.minecraft.world.entity.player.Player playerIn)
      Specified by:
      stillValid in class net.minecraft.world.inventory.AbstractContainerMenu
    • clicked

      public void clicked(int slotId, int clickedButton, @NotNull @NotNull net.minecraft.world.inventory.ClickType mode, @NotNull @NotNull net.minecraft.world.entity.player.Player playerIn)
      Overrides:
      clicked in class net.minecraft.world.inventory.AbstractContainerMenu
    • handleSlotClick

      public net.minecraft.world.item.ItemStack handleSlotClick(net.minecraft.world.inventory.Slot slot, net.minecraft.world.item.ItemStack stack)
      Handle a slot click.
      Parameters:
      slot - the clicked slot.
      stack - the used stack.
      Returns:
      the result.
    • quickMoveStack

      @NotNull public @NotNull net.minecraft.world.item.ItemStack quickMoveStack(net.minecraft.world.entity.player.Player playerIn, int index)
      Specified by:
      quickMoveStack in class net.minecraft.world.inventory.AbstractContainerMenu
    • canTakeItemForPickAll

      public boolean canTakeItemForPickAll(net.minecraft.world.item.ItemStack stack, net.minecraft.world.inventory.Slot slotIn)
      Overrides:
      canTakeItemForPickAll in class net.minecraft.world.inventory.AbstractContainerMenu
    • getWorldObj

      public net.minecraft.world.level.Level getWorldObj()
      Getter for the world obj.
      Returns:
      the world obj.
    • getPlayer

      public net.minecraft.world.entity.player.Player getPlayer()
      Getter for the player.
      Returns:
      the player.
    • isComplete

      public boolean isComplete()
      Getter for completeness.
      Returns:
      true if 3x3 and false for 2x2.
    • getInv

      public net.minecraft.world.inventory.CraftingContainer getInv()
      Get the craft matrix inv.
      Returns:
      the inv.
    • getPos

      public net.minecraft.core.BlockPos getPos()
      Get for the container position.
      Returns:
      the position.
    • getRemainingItems

      public List<net.minecraft.world.item.ItemStack> getRemainingItems()
      Get for the remaining items.
      Returns:
    • getModuleId

      public int getModuleId()
      Getter for the module id.
      Returns:
      the id.