Record Class FileTransferPacket
java.lang.Object
java.lang.Record
net.frozenblock.lib.image_transfer.FileTransferPacket
- All Implemented Interfaces:
net.fabricmc.fabric.api.networking.v1.FabricPacket
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.fabricmc.fabric.api.networking.v1.PacketType<FileTransferPacket> -
Constructor Summary
ConstructorsConstructorDescriptionFileTransferPacket(String transferPath, String fileName, boolean request, byte[] bytes) Creates an instance of aFileTransferPacketrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]bytes()Returns the value of thebytesrecord component.static @NotNull FileTransferPacketstatic @NotNull FileTransferPacketcreate(@NotNull net.minecraft.network.FriendlyByteBuf buf) static @NotNull FileTransferPacketcreateRequest(String directory, String fileName) final booleanIndicates whether some other object is "equal to" this one.fileName()Returns the value of thefileNamerecord component.net.fabricmc.fabric.api.networking.v1.PacketType<?> getType()final inthashCode()Returns a hash code value for this object.booleanrequest()Returns the value of therequestrecord component.static voidsendToPlayer(File file, String transferPath, net.minecraft.server.level.ServerPlayer player) final StringtoString()Returns a string representation of this record class.Returns the value of thetransferPathrecord component.voidwrite(@NotNull net.minecraft.network.FriendlyByteBuf buf)
-
Field Details
-
PACKET_TYPE
public static final net.fabricmc.fabric.api.networking.v1.PacketType<FileTransferPacket> PACKET_TYPE
-
-
Constructor Details
-
FileTransferPacket
Creates an instance of aFileTransferPacketrecord class.- Parameters:
transferPath- the value for thetransferPathrecord componentfileName- the value for thefileNamerecord componentrequest- the value for therequestrecord componentbytes- the value for thebytesrecord component
-
-
Method Details
-
create
@NotNull public static @NotNull FileTransferPacket create(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) -
create
@NotNull public static @NotNull FileTransferPacket create(String destPath, @NotNull @NotNull File file) throws IOException - Throws:
IOException
-
createRequest
-
sendToPlayer
public static void sendToPlayer(File file, String transferPath, net.minecraft.server.level.ServerPlayer player) throws IOException - Throws:
IOException
-
write
public void write(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) - Specified by:
writein interfacenet.fabricmc.fabric.api.networking.v1.FabricPacket
-
getType
public net.fabricmc.fabric.api.networking.v1.PacketType<?> getType()- Specified by:
getTypein interfacenet.fabricmc.fabric.api.networking.v1.FabricPacket
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
transferPath
Returns the value of thetransferPathrecord component.- Returns:
- the value of the
transferPathrecord component
-
fileName
Returns the value of thefileNamerecord component.- Returns:
- the value of the
fileNamerecord component
-
request
public boolean request()Returns the value of therequestrecord component.- Returns:
- the value of the
requestrecord component
-
bytes
public byte[] bytes()Returns the value of thebytesrecord component.- Returns:
- the value of the
bytesrecord component
-