Skip to content

Commit f91e6e6

Browse files
author
MerchantPug
committed
fix: GameConditions being unable to be sent from the server to clients.
1 parent f245b7d commit f91e6e6

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
## Added
2-
- `EntityProjectileOwnerCondition` - Checks the owner of a projectile entity/`TraceableEntity` (mojmap).
3-
- `EntityTameOwnerCondition` - Checks the owner of a tamed entity/`OwnableEntity` (mojmap).
1+
## Fixed
2+
- Fixed GameConditions being unable to be sent from the server to clients.

common/src/main/java/net/modgarden/silicate/api/condition/GameCondition.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,7 @@ public interface GameCondition<T extends GameCondition<T>> extends Predicate<Gam
3232
Codec<GameCondition<?>> TYPED_CODEC = SilicateBuiltInRegistries.GAME_CONDITION_TYPE.byNameCodec()
3333
.dispatch("type", GameCondition::getType, GameConditionType::codec);
3434
@SuppressWarnings("unchecked") // We use ConditionTemplate which uses raw types. Everything is checked at runtime.
35-
Codec<GameCondition<?>> CODEC = Codec.either(ResourceLocation.CODEC, TYPED_CODEC)
36-
.flatComapMap(
37-
either -> either.map(
38-
ConditionTemplate::new,
39-
Function.identity()
40-
),
41-
condition -> DataResult.error(() -> "Cannot convert pre-existing GameCondition to ResourceLocation")
42-
);
35+
Codec<GameCondition<?>> CODEC = Codec.withAlternative(TYPED_CODEC, ResourceLocation.CODEC, ConditionTemplate::new);
4336

4437
@Override
4538
boolean test(GameContext context);

0 commit comments

Comments
 (0)