Don't use PacketBuffer#readString since it's client-only. (#4489)

Fixes #4488
This commit is contained in:
shartte
2020-07-22 10:22:28 +02:00
committed by GitHub
parent f7ef6eb772
commit 21aa5ce33b
5 changed files with 17 additions and 5 deletions
@@ -32,6 +32,15 @@ import appeng.core.sync.network.INetworkInfo;
import appeng.core.sync.network.NetworkHandler;
public abstract class BasePacket {
/**
* Sadly {@link PacketBuffer#readString()} gets inlined by Proguard which means
* it's not available on the Server. This field has the default string length
* that is used for writeString, which then also should be used for readString
* when it has no special length requirements.
*/
public static final int MAX_STRING_LENGTH = 32767;
private PacketBuffer p;
public void serverPacketData(final INetworkInfo manager, final PlayerEntity player) {
@@ -57,8 +57,8 @@ public class ConfigValuePacket extends BasePacket {
private final String Value;
public ConfigValuePacket(final PacketBuffer stream) {
this.Name = stream.readString();
this.Value = stream.readString();
this.Name = stream.readString(MAX_STRING_LENGTH);
this.Value = stream.readString(MAX_STRING_LENGTH);
}
// api