Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
Minecraft 1.18.2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
md-5 committed Feb 28, 2022
1 parent f4f94d3 commit 7e47490
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class ProtocolConstants
public static final int MINECRAFT_1_17 = 755;
public static final int MINECRAFT_1_17_1 = 756;
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<Integer> SUPPORTED_VERSION_IDS;

Expand Down Expand Up @@ -85,7 +86,8 @@ public class ProtocolConstants
ProtocolConstants.MINECRAFT_1_16_4,
ProtocolConstants.MINECRAFT_1_17,
ProtocolConstants.MINECRAFT_1_17_1,
ProtocolConstants.MINECRAFT_1_18
ProtocolConstants.MINECRAFT_1_18,
ProtocolConstants.MINECRAFT_1_18_2
);

if ( SNAPSHOT_SUPPORT )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,20 @@ protected String getKey()
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
{
Expand Down Expand Up @@ -551,6 +565,8 @@ protected String getKey()
PROVIDERS.put( "minecraft:test_argument", VOID ); // 1.16, debug
PROVIDERS.put( "minecraft:test_class", VOID ); // 1.16, debug
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public static EntityMap getEntityMap(int version)
case ProtocolConstants.MINECRAFT_1_17_1:
return EntityMap_1_16_2.INSTANCE_1_17;
case ProtocolConstants.MINECRAFT_1_18:
case ProtocolConstants.MINECRAFT_1_18_2:
return EntityMap_1_16_2.INSTANCE_1_18;
}
throw new RuntimeException( "Version " + version + " has no entity map" );
Expand Down

0 comments on commit 7e47490

Please sign in to comment.