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
FieldsModifier and TypeFieldDescriptionfinal net.minecraft.world.inventory.CraftingContainerThe crafting matrix inventory (2x2).final net.minecraft.world.inventory.ResultContainerThe 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
ConstructorsConstructorDescriptionContainerCrafting(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 TypeMethodDescriptionbooleanbooleancanTakeItemForPickAll(net.minecraft.world.item.ItemStack stack, net.minecraft.world.inventory.Slot slotIn) voidclicked(int slotId, int clickedButton, @NotNull net.minecraft.world.inventory.ClickType mode, @NotNull net.minecraft.world.entity.player.Player playerIn) static ContainerCraftingfromFriendlyByteBuf(int windowId, net.minecraft.world.entity.player.Inventory inv, net.minecraft.network.RegistryFriendlyByteBuf packetBuffer) Deserialize packet buffer to container instance.net.minecraft.world.inventory.CraftingContainergetInv()Get the craft matrix inv.intGetter for the module id.net.minecraft.world.entity.player.PlayerGetter for the player.net.minecraft.core.BlockPosgetPos()Get for the container position.List<net.minecraft.world.item.ItemStack> Get for the remaining items.net.minecraft.world.level.LevelGetter for the world obj.net.minecraft.world.item.ItemStackhandleSlotClick(net.minecraft.world.inventory.Slot slot, net.minecraft.world.item.ItemStack stack) Handle a slot click.booleanGetter for completeness.@NotNull net.minecraft.world.item.ItemStackquickMoveStack(net.minecraft.world.entity.player.Player playerIn, int index) voidslotsChanged(net.minecraft.world.Container inventoryIn) Callback for when the crafting matrix is changed.booleanstillValid(@NotNull net.minecraft.world.entity.player.Player playerIn) voidSwitch 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
-
Field Details
-
craftMatrix
public final net.minecraft.world.inventory.CraftingContainer craftMatrixThe crafting matrix inventory (2x2). -
craftResult
public final net.minecraft.world.inventory.ResultContainer craftResultThe 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.RegistryFriendlyByteBuf 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:
slotsChangedin classnet.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:
stillValidin classnet.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:
clickedin classnet.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:
quickMoveStackin classnet.minecraft.world.inventory.AbstractContainerMenu
-
canTakeItemForPickAll
public boolean canTakeItemForPickAll(net.minecraft.world.item.ItemStack stack, net.minecraft.world.inventory.Slot slotIn) - Overrides:
canTakeItemForPickAllin classnet.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
Get for the remaining items.- Returns:
-
getModuleId
public int getModuleId()Getter for the module id.- Returns:
- the id.
-