public class PacketContainer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected net.minecraft.server.Packet |
handle |
protected int |
id |
protected StructureModifier<java.lang.Object> |
structureModifier |
Constructor and Description |
---|
PacketContainer(int id)
Creates a packet container for a new packet.
|
PacketContainer(int id,
net.minecraft.server.Packet handle)
Creates a packet container for an existing packet.
|
PacketContainer(int id,
net.minecraft.server.Packet handle,
StructureModifier<java.lang.Object> structure)
Creates a packet container for an existing packet.
|
Modifier and Type | Method and Description |
---|---|
StructureModifier<org.bukkit.entity.Entity> |
getEntityModifier(org.bukkit.World world)
Retrieves a read/write structure for entity objects.
|
net.minecraft.server.Packet |
getHandle()
Retrieves the underlying Minecraft packet.
|
int |
getID()
Retrieves the ID of this packet.
|
StructureModifier<org.bukkit.inventory.ItemStack[]> |
getItemArrayModifier()
Retrieves a read/write structure for arrays of ItemStacks.
|
StructureModifier<org.bukkit.inventory.ItemStack> |
getItemModifier()
Retrieves a read/write structure for ItemStack.
|
StructureModifier<java.lang.Object> |
getModifier()
Retrieves the generic structure modifier for this packet.
|
<T> StructureModifier<T> |
getSpecificModifier(java.lang.Class<T> primitiveType)
Retrieves a read/write structure for every field with the given type.
|
StructureModifier<org.bukkit.WorldType> |
getWorldTypeModifier()
Retrieves a read/write structure for the world type enum.
|
protected net.minecraft.server.Packet handle
protected int id
protected StructureModifier<java.lang.Object> structureModifier
public PacketContainer(int id)
id
- - ID of the packet to create.public PacketContainer(int id, net.minecraft.server.Packet handle)
id
- - ID of the given packet.handle
- - contained packet.public PacketContainer(int id, net.minecraft.server.Packet handle, StructureModifier<java.lang.Object> structure)
id
- - ID of the given packet.handle
- - contained packet.structure
- - structure modifier.public net.minecraft.server.Packet getHandle()
public StructureModifier<java.lang.Object> getModifier()
public <T> StructureModifier<T> getSpecificModifier(java.lang.Class<T> primitiveType)
primitiveType
- - the type to find.public StructureModifier<org.bukkit.inventory.ItemStack> getItemModifier()
This modifier will automatically marshall between the Bukkit ItemStack and the internal Minecraft ItemStack.
public StructureModifier<org.bukkit.inventory.ItemStack[]> getItemArrayModifier()
This modifier will automatically marshall between the Bukkit ItemStack and the internal Minecraft ItemStack.
public StructureModifier<org.bukkit.WorldType> getWorldTypeModifier()
This modifier will automatically marshall between the Bukkit world type and the internal Minecraft world type.
public StructureModifier<org.bukkit.entity.Entity> getEntityModifier(org.bukkit.World world)
Note that entities are transmitted by integer ID, and the type may not be enough to distinguish between entities and other values. Thus, this structure modifier MAY return null or invalid entities for certain fields. Using the correct index is essential.
public int getID()