1
0
mirror of https://github.com/GeyserMC/Rainbow.git synced 2025-12-19 14:59:16 +00:00

Don't write empty bedrock options

This commit is contained in:
Eclipse
2025-06-29 12:32:44 +00:00
parent 3c028ee652
commit 25c9ef6616

View File

@@ -34,13 +34,13 @@ public record GeyserMapping(ResourceLocation model, ResourceLocation bedrockIden
public static final Codec<GeyserMapping> CODEC = RecordCodecBuilder.create(instance -> public static final Codec<GeyserMapping> CODEC = RecordCodecBuilder.create(instance ->
instance.group( instance.group(
Codec.STRING.fieldOf("type").forGetter(mapping -> "definition"), Codec.STRING.fieldOf("type").forGetter(mapping -> "definition"), // TODO
ResourceLocation.CODEC.fieldOf("model").forGetter(GeyserMapping::model), ResourceLocation.CODEC.fieldOf("model").forGetter(GeyserMapping::model),
ResourceLocation.CODEC.fieldOf("bedrock_identifier").forGetter(GeyserMapping::bedrockIdentifier), ResourceLocation.CODEC.fieldOf("bedrock_identifier").forGetter(GeyserMapping::bedrockIdentifier),
Codec.STRING.optionalFieldOf("display_name").forGetter(GeyserMapping::displayName), Codec.STRING.optionalFieldOf("display_name").forGetter(GeyserMapping::displayName),
GeyserPredicate.LIST_CODEC.optionalFieldOf("predicate", List.of()).forGetter(GeyserMapping::predicates), GeyserPredicate.LIST_CODEC.optionalFieldOf("predicate", List.of()).forGetter(GeyserMapping::predicates),
BedrockOptions.CODEC.fieldOf("bedrock_options").forGetter(GeyserMapping::bedrockOptions), BedrockOptions.CODEC.optionalFieldOf("bedrock_options", BedrockOptions.DEFAULT).forGetter(GeyserMapping::bedrockOptions),
FILTERED_COMPONENT_MAP_CODEC.fieldOf("components").forGetter(GeyserMapping::components) FILTERED_COMPONENT_MAP_CODEC.optionalFieldOf("components", DataComponentPatch.EMPTY).forGetter(GeyserMapping::components)
).apply(instance, (type, model, bedrockIdentifier, displayName, predicates, bedrockOptions, components) ).apply(instance, (type, model, bedrockIdentifier, displayName, predicates, bedrockOptions, components)
-> new GeyserMapping(model, bedrockIdentifier, displayName, predicates, bedrockOptions, components)) -> new GeyserMapping(model, bedrockIdentifier, displayName, predicates, bedrockOptions, components))
); );
@@ -54,6 +54,7 @@ public record GeyserMapping(ResourceLocation model, ResourceLocation bedrockIden
Codec.INT.optionalFieldOf("protection_value", 0).forGetter(BedrockOptions::protectionValue) Codec.INT.optionalFieldOf("protection_value", 0).forGetter(BedrockOptions::protectionValue)
).apply(instance, BedrockOptions::new) ).apply(instance, BedrockOptions::new)
); );
public static final BedrockOptions DEFAULT = new BedrockOptions(Optional.empty(), true, false, 0);
} }
public boolean conflictsWith(GeyserMapping other) { public boolean conflictsWith(GeyserMapping other) {