public class NetworkHooks
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static org.apache.logging.log4j.Logger |
LOGGER |
private static it.unimi.dsi.fastutil.ints.Int2ObjectMap<DimensionType> |
trackingMap |
Constructor and Description |
---|
NetworkHooks() |
Modifier and Type | Method and Description |
---|---|
(package private) static void |
addCachedDimensionType(DimensionType dimensionType,
ResourceLocation dimName) |
static ConnectionType |
getConnectionType(java.util.function.Supplier<NetworkManager> connection) |
static DimensionType |
getDummyDimType(int dimension) |
static IPacket<?> |
getEntitySpawningPacket(Entity entity) |
static java.lang.String |
getFMLVersion(java.lang.String ip) |
static void |
handleClientLoginSuccess(NetworkManager manager) |
static boolean |
onCustomPayload(ICustomPacket<?> packet,
NetworkManager manager) |
static void |
openGui(ServerPlayerEntity player,
INamedContainerProvider containerSupplier)
Request to open a GUI on the client, from the server
Refer to
net.minecraftforge.fml.ExtensionPoint#GUIFACTORY for how to provide a function to consume
these GUI requests on the client. |
static void |
openGui(ServerPlayerEntity player,
INamedContainerProvider containerSupplier,
BlockPos pos)
Request to open a GUI on the client, from the server
Refer to
net.minecraftforge.fml.ExtensionPoint#GUIFACTORY for how to provide a function to consume
these GUI requests on the client. |
static void |
openGui(ServerPlayerEntity player,
INamedContainerProvider containerSupplier,
java.util.function.Consumer<PacketBuffer> extraDataWriter)
Request to open a GUI on the client, from the server
Refer to
net.minecraftforge.fml.ExtensionPoint#GUIFACTORY for how to provide a function to consume
these GUI requests on the client. |
static void |
registerClientLoginChannel(NetworkManager manager) |
static void |
registerServerLoginChannel(NetworkManager manager,
CHandshakePacket packet) |
static void |
sendDimensionDataPacket(NetworkManager manager,
ServerPlayerEntity player) |
static void |
sendMCRegistryPackets(NetworkManager manager,
java.lang.String direction) |
static boolean |
tickNegotiation(ServerLoginNetHandler netHandlerLoginServer,
NetworkManager networkManager,
ServerPlayerEntity player) |
static void |
validatePacketDirection(NetworkDirection packetDirection,
java.util.Optional<NetworkDirection> expectedDirection,
NetworkManager connection) |
private static boolean |
validateSideForProcessing(ICustomPacket<?> packet,
NetworkInstance ni,
NetworkManager manager) |
private static final org.apache.logging.log4j.Logger LOGGER
private static it.unimi.dsi.fastutil.ints.Int2ObjectMap<DimensionType> trackingMap
public static java.lang.String getFMLVersion(java.lang.String ip)
public static ConnectionType getConnectionType(java.util.function.Supplier<NetworkManager> connection)
public static boolean onCustomPayload(ICustomPacket<?> packet, NetworkManager manager)
private static boolean validateSideForProcessing(ICustomPacket<?> packet, NetworkInstance ni, NetworkManager manager)
public static void validatePacketDirection(NetworkDirection packetDirection, java.util.Optional<NetworkDirection> expectedDirection, NetworkManager connection)
public static void registerServerLoginChannel(NetworkManager manager, CHandshakePacket packet)
public static void registerClientLoginChannel(NetworkManager manager)
public static void sendMCRegistryPackets(NetworkManager manager, java.lang.String direction)
public static void sendDimensionDataPacket(NetworkManager manager, ServerPlayerEntity player)
public static void handleClientLoginSuccess(NetworkManager manager)
public static boolean tickNegotiation(ServerLoginNetHandler netHandlerLoginServer, NetworkManager networkManager, ServerPlayerEntity player)
public static void openGui(ServerPlayerEntity player, INamedContainerProvider containerSupplier)
net.minecraftforge.fml.ExtensionPoint#GUIFACTORY
for how to provide a function to consume
these GUI requests on the client.
The IInteractionObject#getGuiID()
is treated as a ResourceLocation
.
It should refer to a valid modId namespace, to trigger opening on the client.
The namespace is directly used to lookup the modId in the client side.player
- The player to open the GUI forcontainerSupplier
- A supplier of container properties including the registry name of the containerpublic static void openGui(ServerPlayerEntity player, INamedContainerProvider containerSupplier, BlockPos pos)
net.minecraftforge.fml.ExtensionPoint#GUIFACTORY
for how to provide a function to consume
these GUI requests on the client.
The IInteractionObject#getGuiID()
is treated as a ResourceLocation
.
It should refer to a valid modId namespace, to trigger opening on the client.
The namespace is directly used to lookup the modId in the client side.player
- The player to open the GUI forcontainerSupplier
- A supplier of container properties including the registry name of the containerpos
- A block pos, which will be encoded into the auxillary data for this requestpublic static void openGui(ServerPlayerEntity player, INamedContainerProvider containerSupplier, java.util.function.Consumer<PacketBuffer> extraDataWriter)
net.minecraftforge.fml.ExtensionPoint#GUIFACTORY
for how to provide a function to consume
these GUI requests on the client.
The IInteractionObject#getGuiID()
is treated as a ResourceLocation
.
It should refer to a valid modId namespace, to trigger opening on the client.
The namespace is directly used to lookup the modId in the client side.
The maximum size for #extraDataWriter is 32600 bytes.player
- The player to open the GUI forcontainerSupplier
- A supplier of container properties including the registry name of the containerextraDataWriter
- Consumer to write any additional data the GUI needspublic static DimensionType getDummyDimType(int dimension)
static void addCachedDimensionType(DimensionType dimensionType, ResourceLocation dimName)