mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-22 13:09:44 +00:00
refactor: port PacketScheduler to Java
IScheduledPacketPart is descriptor-identical and schedulePacket is unchanged. TScheduledPacketPart.read stays abstract: TMultiPart declares read, so a default would be shadowed and a part would silently read a description instead of a mask. The dispatch that lived in the $class helper is now the interface static readMask, with the one-line forwarder documented on read. writeScheduled and readScheduled became defaults. TMultiPart declares neither, and empty bodies are what mixing the Scala trait in already gave a Scala implementor -- only Java implementors ever had to write them out. sendScheduled is public because the reference's private[multipart] reaches the handler package and Java has no equivalent scope. An unsupported mask width now throws IllegalArgumentException rather than scala.MatchError; both are RuntimeException and the map is still left uncleared on that path, as before. Dropped PacketScheduler$, TScheduledPacketPart$class and two closure classes, none referenced in bytecode or by reflective name. 118 plain-JVM tests and 18 Forge server tests pass.
This commit is contained in:
1 parent
3ad25f56cb
commit
40bb1b71b7
9 files changed
+267
-123
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package codechicken.multipart;
|
||||
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
|
||||
/** Callback interface for PacketScheduler. */
|
||||
public interface IScheduledPacketPart {
|
||||
|
||||
/** Write scheduled data to the packet, mask is the cumulative mask from calls to schedulePacket. */
|
||||
void writeScheduled(long mask, MCDataOutput packet);
|
||||
|
||||
/**
|
||||
* Returns the width (in bytes) of the data type required to hold all valid mask bits. Valid values are 1, 2, 4 and
|
||||
* 8.
|
||||
*/
|
||||
int maskWidth();
|
||||
|
||||
/**
|
||||
* Read data matching mask. Establishes a method for subclasses to override. This should be called from read.
|
||||
*/
|
||||
void readScheduled(long mask, MCDataInput packet);
|
||||
}
|
||||
Reference in new issue
Block a user