T
- Tile entitypublic abstract class USyncedTileEntityContainer<T extends net.minecraft.tileentity.TileEntity & ISyncedTileEntity> extends USyncedContainer
ISyncedTileEntity
UContainer.SlotHandlerFunction, UContainer.SlotInventoryFunction
Modifier and Type | Field and Description |
---|---|
protected net.minecraft.entity.player.PlayerInventory |
playerInventory |
protected T |
tileEntity |
Constructor and Description |
---|
USyncedTileEntityContainer(net.minecraft.inventory.container.ContainerType<?> type,
int id,
net.minecraft.entity.player.PlayerInventory playerInventory,
net.minecraft.network.PacketBuffer buffer)
This is the client constructor for the container.
|
USyncedTileEntityContainer(net.minecraft.inventory.container.ContainerType<?> type,
int id,
net.minecraft.entity.player.PlayerInventory playerInventory,
net.minecraft.network.PacketBuffer buffer,
boolean init)
This is the client constructor for the container.
|
USyncedTileEntityContainer(net.minecraft.inventory.container.ContainerType<?> type,
int id,
net.minecraft.entity.player.PlayerInventory playerInventory,
T tileEntity)
This is the server constructor for the container.
|
USyncedTileEntityContainer(net.minecraft.inventory.container.ContainerType<?> type,
int id,
net.minecraft.entity.player.PlayerInventory playerInventory,
T tileEntity,
boolean init)
This is the server constructor for the container.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(net.minecraft.inventory.container.IContainerListener listener)
Is called when a new container listener is added to this container.
|
void |
detectAndSendChanges()
This method is called every tick and when changes take place.
|
protected net.minecraft.inventory.IInventory |
getInventoryOnDist(boolean server,
net.minecraft.inventory.IInventory inventory)
On the server side just returns the inventory.
|
T |
getTileEntity()
Gets the tile entity
|
void |
handleFromClient(net.minecraft.network.PacketBuffer buffer)
Calls the method on the tile entity.
|
void |
handleFromServer(net.minecraft.network.PacketBuffer buffer)
Calls the method on the tile entity.
|
protected abstract void |
init(boolean server)
Is called after the server and client constructor.
|
void |
sendToClient(net.minecraft.network.PacketBuffer buffer)
Calls the method on the tile entity.
|
void |
sendToServer(net.minecraft.network.PacketBuffer buffer)
Calls the method on the tile entity.
|
appendInventory, appendInventory, appendInventory, appendInventory, appendPlayerInventory, canInteractWith
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
sendDataToClient, sendDataToClient, sendDataToServer, sendDataToServer
protected final net.minecraft.entity.player.PlayerInventory playerInventory
protected final T extends net.minecraft.tileentity.TileEntity & ISyncedTileEntity tileEntity
public USyncedTileEntityContainer(net.minecraft.inventory.container.ContainerType<?> type, int id, net.minecraft.entity.player.PlayerInventory playerInventory, T tileEntity)
#init()
is called.type
- Container typeid
- Window idplayerInventory
- Player inventorytileEntity
- Tile entitypublic USyncedTileEntityContainer(net.minecraft.inventory.container.ContainerType<?> type, int id, net.minecraft.entity.player.PlayerInventory playerInventory, T tileEntity, boolean init)
type
- Container typeid
- Window idplayerInventory
- Player inventorytileEntity
- Tile entityinit
- If the constructor should call #init()
public USyncedTileEntityContainer(net.minecraft.inventory.container.ContainerType<?> type, int id, net.minecraft.entity.player.PlayerInventory playerInventory, net.minecraft.network.PacketBuffer buffer)
getClientTileEntity(PacketBuffer)
to get the tile
entity. The #init()
is called.type
- Container typeid
- Window idplayerInventory
- Player inventorybuffer
- Initial data (specified with NetworkHooks#openGui(player, containerSupplier,extraDataWriter)
)public USyncedTileEntityContainer(net.minecraft.inventory.container.ContainerType<?> type, int id, net.minecraft.entity.player.PlayerInventory playerInventory, net.minecraft.network.PacketBuffer buffer, boolean init)
getClientTileEntity(PacketBuffer)
to get the tile
entity.type
- Container typeid
- Window idplayerInventory
- Player inventorybuffer
- Initial data (specified with NetworkHooks#openGui(player, containerSupplier,extraDataWriter)
)init
- If the constructor should call #init()
protected abstract void init(boolean server)
server
- True if its the server side false otherwiseprotected net.minecraft.inventory.IInventory getInventoryOnDist(boolean server, net.minecraft.inventory.IInventory inventory)
Inventory
with the same size as the passed inventory.server
- True if is the server side false otherwiseinventory
- Inventory to decide onpublic T getTileEntity()
public void addListener(net.minecraft.inventory.container.IContainerListener listener)
IAutoSyncedTileEntity
.addListener
in class net.minecraft.inventory.container.Container
public void detectAndSendChanges()
IAutoSyncedTileEntity
.detectAndSendChanges
in class net.minecraft.inventory.container.Container
public void sendToClient(net.minecraft.network.PacketBuffer buffer)
#handleFromServer(buffer)
.
This method is for client -> server sync.buffer
- Packet bufferpublic void handleFromServer(net.minecraft.network.PacketBuffer buffer)
#sendToClient(buffer)
.
This method is for client -> server sync.buffer
- Packet bufferpublic void sendToServer(net.minecraft.network.PacketBuffer buffer)
#handleFromClient(buffer)
.
This method is for server -> client sync.buffer
- Packet bufferpublic void handleFromClient(net.minecraft.network.PacketBuffer buffer)
#sendToServer(buffer)
.
This method is for server -> client sync.buffer
- Packet buffer