public abstract class UContainer
extends net.minecraft.inventory.container.Container
Modifier and Type | Class and Description |
---|---|
static interface |
UContainer.SlotHandlerFunction
Used as a function to customize slots with the append methods
|
static interface |
UContainer.SlotInventoryFunction
Used as a function to customize slots with the append methods
|
Constructor and Description |
---|
UContainer(net.minecraft.inventory.container.ContainerType<?> type,
int id)
Creates a new container
|
Modifier and Type | Method and Description |
---|---|
protected <E extends BufferReferenceHolder> |
addClientToServerTracker(E holder)
Adds a new
BufferReferenceHolder that will sync values from the client to the server. |
protected <E extends BufferReferenceHolder> |
addServerToClientTracker(E holder)
Adds a new
BufferReferenceHolder that will sync values from the server to the client. |
protected void |
appendInventory(net.minecraft.inventory.IInventory inventory,
int inventoryHeight,
int inventoryWidth,
int x,
int y)
This methods can add any
IInventory to the container. |
protected void |
appendInventory(net.minecraft.inventory.IInventory inventory,
UContainer.SlotInventoryFunction function,
int inventoryHeight,
int inventoryWidth,
int x,
int y)
This methods can add any
IInventory to the container. |
protected void |
appendInventory(net.minecraftforge.items.IItemHandler handler,
int inventoryHeight,
int inventoryWidth,
int x,
int y)
This methods can add any
IItemHandler to the container. |
protected void |
appendInventory(net.minecraftforge.items.IItemHandler handler,
UContainer.SlotHandlerFunction function,
int inventoryHeight,
int inventoryWidth,
int x,
int y)
This methods can add any
IItemHandler to the container. |
protected void |
appendPlayerInventory(net.minecraft.entity.player.PlayerInventory playerInventory,
int x,
int y)
This methods adds a player inventory to the container.
|
boolean |
canInteractWith(net.minecraft.entity.player.PlayerEntity player)
Player can interact with this container
|
void |
detectAndSendChanges()
We use this method to send the tracked values to the client
|
void |
updateTrackedServerToClient()
We use this method to send the tracked values to the server
|
void |
updateValue(BufferPropertyContainerMessage message,
net.minecraftforge.fml.LogicalSide side)
INTERNAL.
|
addListener, addSlot, areItemsAndTagsEqual, assertIntArraySize, assertInventorySize, calcRedstone, calcRedstoneFromInventory, canAddItemToSlot, canDragIntoSlot, canMergeSlot, clearContainer, computeStackSize, enchantItem, extractDragMode, getCanCraft, getDragEvent, getInventory, getNextTransactionID, getQuickcraftMask, getSlot, getType, isValidDragMode, isWithinUsableDistance, mergeItemStack, onContainerClosed, onCraftMatrixChanged, putStackInSlot, removeListener, resetDrag, setAll, setCanCraft, slotClick, trackInt, trackIntArray, transferStackInSlot, updateProgressBar
public UContainer(net.minecraft.inventory.container.ContainerType<?> type, int id)
type
- Container typeid
- Window idprotected <E extends BufferReferenceHolder> E addServerToClientTracker(E holder)
BufferReferenceHolder
that will sync values from the server to the client.holder
- Buffer reference holderprotected <E extends BufferReferenceHolder> E addClientToServerTracker(E holder)
BufferReferenceHolder
that will sync values from the client to the server. UContainerScreen
. If not you must manually call
updateTrackedServerToClient()
every time you update values on the client that should be synced to the
server.holder
- Buffer reference holderpublic void updateValue(BufferPropertyContainerMessage message, net.minecraftforge.fml.LogicalSide side)
message
- Messageside
- Side to handle the packet onpublic void detectAndSendChanges()
detectAndSendChanges
in class net.minecraft.inventory.container.Container
public void updateTrackedServerToClient()
public boolean canInteractWith(net.minecraft.entity.player.PlayerEntity player)
canInteractWith
in class net.minecraft.inventory.container.Container
protected void appendPlayerInventory(net.minecraft.entity.player.PlayerInventory playerInventory, int x, int y)
playerInventory
- Player inventoryx
- Start xy
- Start yprotected void appendInventory(net.minecraft.inventory.IInventory inventory, int inventoryHeight, int inventoryWidth, int x, int y)
IInventory
to the container. You can specialize the inventory height (slot rows) and
width (slot columns).inventory
- Some inventoryinventoryHeight
- Slot rowsinventoryWidth
- Slot columnsx
- Start xy
- Start yprotected void appendInventory(net.minecraft.inventory.IInventory inventory, UContainer.SlotInventoryFunction function, int inventoryHeight, int inventoryWidth, int x, int y)
IInventory
to the container. You can specialize the inventory height (slot rows) and
width (slot columns). You must supplier a function that create a slot. With this you can set your own slot.
implementations.inventory
- Some inventoryfunction
- Function to create a slot.inventoryHeight
- Slot rowsinventoryWidth
- Slot columnsx
- Start xy
- Start yprotected void appendInventory(net.minecraftforge.items.IItemHandler handler, int inventoryHeight, int inventoryWidth, int x, int y)
IItemHandler
to the container. You can specialize the inventory height (slot rows)
and width (slot columns).handler
- Some item handlerinventoryHeight
- Slot rowsinventoryWidth
- Slot columnsx
- Start xy
- Start yprotected void appendInventory(net.minecraftforge.items.IItemHandler handler, UContainer.SlotHandlerFunction function, int inventoryHeight, int inventoryWidth, int x, int y)
IItemHandler
to the container. You can specialize the inventory height (slot rows)
and width (slot columns). You must supplier a function that create a slot. With this you can set your own slot.
implementations.handler
- Some item handlerfunction
- Function to create a slot.inventoryHeight
- Slot rowsinventoryWidth
- Slot columnsx
- Start xy
- Start y