Syncing and Large Packet Completion

This commit is contained in:
Kam committed 2025-01-29 18:25:34 -05:00
1 parent dcf3a0d8b0
commit de56032118
39 files changed
+648 -862

No files matched your search

@@ -6,6 +6,8 @@ import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
public abstract class AbstractPacket {
@@ -16,11 +18,22 @@ public abstract class AbstractPacket {
buf.writeInt(packetChannel.getChannelType().ordinal());
buf.writeInt(getType().ordinal());
sendData(buf);
return new FMLProxyPacket(buf, getChannel().getChannelName());
} catch (Exception ignored) {}
return new FMLProxyPacket(buf, packetChannel.getChannelName());
} catch (Exception e) {
// For debugging, you might want to log it
e.printStackTrace();
}
return null;
}
public List<FMLProxyPacket> generatePackets() {
FMLProxyPacket single = generatePacket();
if (single == null) {
return Collections.emptyList();
}
return Collections.singletonList(single);
}
public abstract Enum getType();
public abstract PacketChannel getChannel();
public abstract void sendData(ByteBuf out) throws IOException;