1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2026-01-06 15:41:50 +00:00

Fix startup

This commit is contained in:
onebeastchris
2025-11-26 20:36:33 +01:00
parent b2739e1948
commit 52b76f5b6f
2 changed files with 17 additions and 15 deletions

View File

@@ -145,25 +145,27 @@ public class VanillaEntityType<T extends Entity> extends EntityTypeDefinition<T>
* set to false if we're not expecting this entity to spawn from the network.
*/
public VanillaEntityType<T> build(boolean register) {
if (register && type == null) {
throw new IllegalStateException("Missing entity type!");
}
if (bedrockDefinition == null) {
Identifier identifier = bedrockIdentifier == null ? type.identifier() : IdentifierImpl.parse(bedrockIdentifier);
if (Registries.BEDROCK_ENTITY_DEFINITIONS.get().containsKey(identifier)) {
throw new IllegalStateException("Duplicate bedrock identifier: " + bedrockIdentifier);
if (register) {
if (type == null) {
throw new IllegalStateException("Missing entity type!");
}
bedrockDefinition = BedrockEntityDefinition.builder()
.properties(propertiesBuilder)
.identifier(identifier)
.build();
Registries.BEDROCK_ENTITY_DEFINITIONS.get().put(identifier, bedrockDefinition);
if (bedrockDefinition == null) {
Identifier identifier = bedrockIdentifier == null ? type.identifier() : IdentifierImpl.parse(bedrockIdentifier);
if (Registries.BEDROCK_ENTITY_DEFINITIONS.get().containsKey(identifier)) {
throw new IllegalStateException("Duplicate bedrock identifier: " + bedrockIdentifier);
}
bedrockDefinition = BedrockEntityDefinition.builder()
.properties(propertiesBuilder)
.identifier(identifier)
.build();
Registries.BEDROCK_ENTITY_DEFINITIONS.get().put(identifier, bedrockDefinition);
}
}
VanillaEntityType<T> definition = new VanillaEntityType<>(factory, type, width, height, offset, bedrockDefinition, translators);
if (register && definition.entityType() != null) {
if (register && type != null) {
Registries.JAVA_ENTITY_TYPES.get().putIfAbsent(definition.entityType(), definition);
Registries.JAVA_ENTITY_IDENTIFIERS.get().putIfAbsent(type.identifier().toString(), definition);
}

View File

@@ -563,7 +563,7 @@ public final class EntityUtils {
});
for (var definition : Registries.BEDROCK_ENTITY_DEFINITIONS.get().values()) {
if (definition.registeredProperties() != null) {
if (!definition.registeredProperties().isEmpty()) {
Registries.BEDROCK_ENTITY_PROPERTIES.get().add(definition.registeredProperties().toNbtMap(definition.identifier().toString()));
}
}