Minecraft 1.18.2 support

This commit is contained in:
md_5 2022-03-01 02:00:00 +11:00
parent f4f94d3b56
commit 7e47490e70
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
3 changed files with 20 additions and 1 deletions

View File

@ -37,6 +37,7 @@ public class ProtocolConstants
public static final int MINECRAFT_1_17 = 755; public static final int MINECRAFT_1_17 = 755;
public static final int MINECRAFT_1_17_1 = 756; public static final int MINECRAFT_1_17_1 = 756;
public static final int MINECRAFT_1_18 = 757; public static final int MINECRAFT_1_18 = 757;
public static final int MINECRAFT_1_18_2 = 758;
public static final List<String> SUPPORTED_VERSIONS; public static final List<String> SUPPORTED_VERSIONS;
public static final List<Integer> SUPPORTED_VERSION_IDS; public static final List<Integer> SUPPORTED_VERSION_IDS;
@ -85,7 +86,8 @@ public class ProtocolConstants
ProtocolConstants.MINECRAFT_1_16_4, ProtocolConstants.MINECRAFT_1_16_4,
ProtocolConstants.MINECRAFT_1_17, ProtocolConstants.MINECRAFT_1_17,
ProtocolConstants.MINECRAFT_1_17_1, ProtocolConstants.MINECRAFT_1_17_1,
ProtocolConstants.MINECRAFT_1_18 ProtocolConstants.MINECRAFT_1_18,
ProtocolConstants.MINECRAFT_1_18_2
); );
if ( SNAPSHOT_SUPPORT ) if ( SNAPSHOT_SUPPORT )

View File

@ -498,6 +498,20 @@ public class Commands extends DefinedPacket
return "brigadier:string"; return "brigadier:string";
} }
}; };
private static final ArgumentSerializer<String> RAW_STRING = new ArgumentSerializer<String>()
{
@Override
protected String read(ByteBuf buf)
{
return DefinedPacket.readString( buf );
}
@Override
protected void write(ByteBuf buf, String t)
{
DefinedPacket.writeString( t, buf );
}
};
static static
{ {
@ -551,6 +565,8 @@ public class Commands extends DefinedPacket
PROVIDERS.put( "minecraft:test_argument", VOID ); // 1.16, debug PROVIDERS.put( "minecraft:test_argument", VOID ); // 1.16, debug
PROVIDERS.put( "minecraft:test_class", VOID ); // 1.16, debug PROVIDERS.put( "minecraft:test_class", VOID ); // 1.16, debug
PROVIDERS.put( "minecraft:angle", VOID ); // 1.16.2 PROVIDERS.put( "minecraft:angle", VOID ); // 1.16.2
PROVIDERS.put( "minecraft:resource", RAW_STRING ); // 1.18.2
PROVIDERS.put( "minecraft:resource_or_tag", RAW_STRING ); // 1.18.2
} }
private static ArgumentType<?> read(String key, ByteBuf buf) private static ArgumentType<?> read(String key, ByteBuf buf)

View File

@ -72,6 +72,7 @@ public abstract class EntityMap
case ProtocolConstants.MINECRAFT_1_17_1: case ProtocolConstants.MINECRAFT_1_17_1:
return EntityMap_1_16_2.INSTANCE_1_17; return EntityMap_1_16_2.INSTANCE_1_17;
case ProtocolConstants.MINECRAFT_1_18: case ProtocolConstants.MINECRAFT_1_18:
case ProtocolConstants.MINECRAFT_1_18_2:
return EntityMap_1_16_2.INSTANCE_1_18; return EntityMap_1_16_2.INSTANCE_1_18;
} }
throw new RuntimeException( "Version " + version + " has no entity map" ); throw new RuntimeException( "Version " + version + " has no entity map" );