2023-03-24 19:46:25 +08:00
|
|
|
using MinecraftClient.Mapping.EntityMetadataPalettes;
|
|
|
|
|
using MinecraftClient.Protocol.Handlers;
|
|
|
|
|
using System;
|
2023-03-23 23:41:41 +01:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace MinecraftClient.Mapping;
|
|
|
|
|
|
|
|
|
|
public abstract class EntityMetadataPalette
|
|
|
|
|
{
|
|
|
|
|
public abstract Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList();
|
2023-03-24 19:46:25 +08:00
|
|
|
|
|
|
|
|
public EntityMetaDataType GetDataType(int typeId)
|
|
|
|
|
{
|
|
|
|
|
return GetEntityMetadataMappingsList()[typeId];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static EntityMetadataPalette GetPalette(int protocolVersion)
|
|
|
|
|
{
|
2023-03-27 18:22:50 +08:00
|
|
|
if (protocolVersion <= Protocol18Handler.MC_1_8_Version)
|
|
|
|
|
return new EntityMetadataPalette18(); // 1.8
|
2023-03-24 20:51:10 +08:00
|
|
|
else if (protocolVersion <= Protocol18Handler.MC_1_12_2_Version)
|
|
|
|
|
return new EntityMetadataPalette1122(); // 1.9 - 1.12.2
|
2023-03-24 19:46:25 +08:00
|
|
|
else if (protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
2023-03-24 20:51:10 +08:00
|
|
|
return new EntityMetadataPalette1191(); // 1.13 - 1.19.2
|
2023-03-24 19:46:25 +08:00
|
|
|
else if (protocolVersion <= Protocol18Handler.MC_1_19_3_Version)
|
2023-03-24 20:51:10 +08:00
|
|
|
return new EntityMetadataPalette1193(); // 1.19.3
|
2023-03-24 19:46:25 +08:00
|
|
|
else if (protocolVersion <= Protocol18Handler.MC_1_19_4_Version)
|
2023-03-24 20:51:10 +08:00
|
|
|
return new EntityMetadataPalette1194(); // 1.19.4
|
2023-03-24 19:46:25 +08:00
|
|
|
else
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2023-03-23 23:41:41 +01:00
|
|
|
}
|