Added more components + added item palette reference

This commit is contained in:
Anon 2024-09-11 20:35:23 +02:00
parent 76e873ed54
commit 49319fe781
44 changed files with 667 additions and 29 deletions

View file

@ -13,7 +13,8 @@ public class StructuredComponentsHandler
public StructuredComponentsHandler(
int protocolVersion,
DataTypes dataTypes)
DataTypes dataTypes,
ItemPalette itemPalette)
{
// Get the appropriate subcomponent registry type based on the protocol version and then instantiate it
var subcomponentRegistryType = protocolVersion switch
@ -32,7 +33,7 @@ public class StructuredComponentsHandler
_ => throw new NotSupportedException($"Protocol version {protocolVersion} is not supported for structured component registries!")
};
ComponentRegistry = Activator.CreateInstance(registryType, subcomponentRegistry, dataTypes) as StructuredComponentRegistry
ComponentRegistry = Activator.CreateInstance(registryType, dataTypes, itemPalette, subcomponentRegistry) as StructuredComponentRegistry
?? throw new InvalidOperationException($"Failed to instantiate a component registry for type {nameof(registryType)}");
}