Class ItemInventoryContainer<I extends net.minecraft.world.item.Item>
java.lang.Object
net.minecraft.world.inventory.AbstractContainerMenu
org.cyclops.cyclopscore.inventory.container.ContainerExtended
org.cyclops.cyclopscore.inventory.container.ItemInventoryContainer<I>
- Type Parameters:
I
- The item instance.
- All Implemented Interfaces:
IContainerButtonClickAcceptorServer<ContainerExtended>
,IValueNotifiable
,IValueNotifier
public abstract class ItemInventoryContainer<I extends net.minecraft.world.item.Item>
extends ContainerExtended
A container for an item.
Implementations of this class will typically have two constructors,
which will look something like this:
// Called by the client-side screen factory public MyContainer(int id, PlayerInventory inventory, FriendlyByteBuf packetBuffer) { this(id, inventory, readItemIndex(packetBuffer), readHand(packetBuffer)); } // Called by the server-side container provider public MyContainer(int id, PlayerInventory inventory, int itemIndex, Hand hand) { super(RegistryEntries.CONTAINER_MY, id, inventory, itemIndex, hand); }
-
Field Summary
Fields inherited from class org.cyclops.cyclopscore.inventory.container.ContainerExtended
ITEMBOX, offsetX, offsetY, player
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
ConstructorDescriptionItemInventoryContainer
(net.minecraft.world.inventory.MenuType<?> type, int id, net.minecraft.world.entity.player.Inventory inventory, ItemLocation itemLocation) Make a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clicked
(int slotId, int arg, net.minecraft.world.inventory.ClickType clickType, net.minecraft.world.entity.player.Player player) protected net.minecraft.world.inventory.Slot
createNewSlot
(net.minecraft.world.Container inventory, int index, int x, int y) getItem()
Get the item instance.net.minecraft.world.item.ItemStack
getItemStack
(net.minecraft.world.entity.player.Player player) static net.minecraft.world.InteractionHand
readHand
(net.minecraft.network.FriendlyByteBuf packetBuffer) static int
readItemIndex
(net.minecraft.network.FriendlyByteBuf packetBuffer) boolean
stillValid
(net.minecraft.world.entity.player.Player player) Methods inherited from class org.cyclops.cyclopscore.inventory.container.ContainerExtended
addInventory, addPlayerArmorInventory, addPlayerInventory, addSlot, addSlotListener, adjustPhantomSlot, broadcastChanges, fillPhantomSlot, getNextValueId, getPlayerIInventory, getSizeInventory, getSlotRange, getSlotStart, getValue, getValueIds, getValueNotifiableType, initializeValues, moveItemStackTo, onButtonClick, onUpdate, putButtonAction, quickMoveStack, registerSyncedVariable, resetQuickCraft, setGuiValueListener, setSlotPosX, setSlotPosY, setValue
Methods inherited from class net.minecraft.world.inventory.AbstractContainerMenu
addDataSlot, addDataSlots, broadcastFullState, canDragTo, canItemQuickReplace, canTakeItemForPickAll, checkContainerDataCount, checkContainerSize, clearContainer, clickMenuButton, createCarriedSlotAccess, findSlot, getCarried, getItems, getQuickcraftHeader, getQuickcraftMask, getQuickCraftPlaceCount, getQuickcraftType, getRedstoneSignalFromBlockEntity, getRedstoneSignalFromContainer, getSlot, getStateId, getType, incrementStateId, initializeContents, isValidQuickcraftType, isValidSlotIndex, removed, removeSlotListener, resumeRemoteUpdates, sendAllDataToRemote, setCarried, setData, setItem, setRemoteCarried, setRemoteSlot, setRemoteSlotNoCopy, setSynchronizer, slotsChanged, stillValid, suppressRemoteUpdates, transferState
-
Field Details
-
item
-
itemLocation
-
-
Constructor Details
-
ItemInventoryContainer
public ItemInventoryContainer(@Nullable net.minecraft.world.inventory.MenuType<?> type, int id, net.minecraft.world.entity.player.Inventory inventory, ItemLocation itemLocation) Make a new instance.- Parameters:
type
- The container type.id
- The container id.inventory
- The player inventory.itemLocation
- The item location.
-
-
Method Details
-
readItemIndex
public static int readItemIndex(net.minecraft.network.FriendlyByteBuf packetBuffer) -
readHand
public static net.minecraft.world.InteractionHand readHand(net.minecraft.network.FriendlyByteBuf packetBuffer) -
getItem
Get the item instance.- Returns:
- The item.
-
stillValid
public boolean stillValid(net.minecraft.world.entity.player.Player player) - Specified by:
stillValid
in classnet.minecraft.world.inventory.AbstractContainerMenu
-
getItemStack
public net.minecraft.world.item.ItemStack getItemStack(net.minecraft.world.entity.player.Player player) -
createNewSlot
protected net.minecraft.world.inventory.Slot createNewSlot(net.minecraft.world.Container inventory, int index, int x, int y) - Overrides:
createNewSlot
in classContainerExtended
-
clicked
public void clicked(int slotId, int arg, net.minecraft.world.inventory.ClickType clickType, net.minecraft.world.entity.player.Player player) - Overrides:
clicked
in classContainerExtended
-