chore: Port to 1.21.5 + some additional fixes. #18

Merged
MerchantCalico merged 10 commits from chore/1.21.5 into 1.21.5 2025-08-18 19:04:41 +00:00
MerchantCalico commented 2025-07-27 08:56:53 +00:00 (Migrated from github.com)

(Copypaste of CHANGELOG.md)

Breaking Changes

  • silicate:entity_vehicle must now use the silicate:vehicle_entity param type to reference the vehicle entity, with other fields remaining the exact same.
  • silicate:entity_passenger must now use the silicate:passenger_entity param type to reference the passenger entity, with other fields remaining the exact same.
  • silicate:entity_tame_owner must now use the silicate:owner_entity param type to reference the owner entity, with other fields remaining the exact same.
  • silicate:entity_projectile_owner must now use the silicate:owner_entity param type to reference the owner entity, with other fields remaining the exact same.
  • The ContextParamType codec will now return a data error if not present within the registry, or if the class of the registered param type is unable to be casted to the specified class. On a success, this will return the original context param type if it is an exact match in class, otherwise, this will create a new param type if the resulting class can be cast to the specified class. The latter is always equal to the former.

Added

  • Ported to 1.21.5.

Fixed

  • Fixed entity_vehicle, entity_passenger, entity_tame_owner, entity_projectile_owner conditions overriding the original field with the target entity within their inner conditions' context.
  • Fixed issues with registering custom game conditions on NeoForge.
  • Fixed ContextParamType codec creating entirely new param types without checking if a param type of the sort exists already.
  • Fixed ContextParamType codec's entirely new param types not being equal to any param type in the case of casted classes.
(Copypaste of CHANGELOG.md) ## Breaking Changes - `silicate:entity_vehicle` must now use the `silicate:vehicle_entity` param type to reference the vehicle entity, with other fields remaining the exact same. - `silicate:entity_passenger` must now use the `silicate:passenger_entity` param type to reference the passenger entity, with other fields remaining the exact same. - `silicate:entity_tame_owner` must now use the `silicate:owner_entity` param type to reference the owner entity, with other fields remaining the exact same. - `silicate:entity_projectile_owner` must now use the `silicate:owner_entity` param type to reference the owner entity, with other fields remaining the exact same. - The ContextParamType codec will now return a data error if not present within the registry, or if the class of the registered param type is unable to be casted to the specified class. On a success, this will return the original context param type if it is an exact match in class, otherwise, this will create a new param type if the resulting class can be cast to the specified class. The latter is always equal to the former. ## Added - Ported to 1.21.5. ## Fixed - Fixed `entity_vehicle`, `entity_passenger`, `entity_tame_owner`, `entity_projectile_owner` conditions overriding the original field with the target entity within their inner conditions' context. - Fixed issues with registering custom game conditions on NeoForge. - Fixed ContextParamType codec creating entirely new param types without checking if a param type of the sort exists already. - Fixed ContextParamType codec's entirely new param types not being equal to any param type in the case of casted classes.
MerchantCalico commented 2025-07-27 09:01:49 +00:00 (Migrated from github.com)

Another little note is that I've updated parts of the Gradle build script to my own preferences.

Another little note is that I've updated parts of the Gradle build script to my own preferences.
sylv256 (Migrated from github.com) reviewed 2025-08-01 05:28:24 +00:00
sylv256 (Migrated from github.com) commented 2025-08-01 05:28:24 +00:00

In a future PR, we should make this configurable.

In a future PR, we should make this configurable.
MerchantCalico (Migrated from github.com) reviewed 2025-08-01 20:44:28 +00:00
sylv256 (Migrated from github.com) approved these changes 2025-08-18 19:03:43 +00:00
sylv256 (Migrated from github.com) left a comment

We need to get this out for ModFest: Toybox, so we can fix the nitpicks later.

We need to get this out for ModFest: Toybox, so we can fix the nitpicks later.
@ -39,1 +39,3 @@
.xmap(name -> new ContextParamType<>(name, clazz), ContextParamType::name);
.flatXmap(name -> {
ContextParamType<?> paramType = SilicateBuiltInRegistries.CONTEXT_PARAM_TYPE.getValue(name);
if (paramType != null) {
sylv256 (Migrated from github.com) commented 2025-08-01 05:53:47 +00:00

We can move all of this logic to TypedGameCondition#validate and use a byName Codec.

We can move all of this logic to `TypedGameCondition#validate` and use a `byName` Codec.
@ -40,0 +43,4 @@
return DataResult.success((ContextParamType<T>)paramType);
if (clazz.isAssignableFrom(paramType.clazz())) // If the paramType extends the specified class...
return DataResult.success(new ContextParamType<>(name, clazz)); // Create a new ContextParamType that may be used in place of the old one.
return DataResult.error(() -> paramType + " is not of the proper parameter"); // Remapping is the reason why we don't tell which class.
sylv256 (Migrated from github.com) commented 2025-08-01 05:36:20 +00:00

We should remove unbraced if-statements, this could be ambiguous.

We should remove unbraced if-statements, this could be ambiguous.
@ -40,0 +52,4 @@
@Override // Makes sure that values return the correct value within the context when clazz is cast.
public boolean equals(Object obj) {
if (obj == this)
return true;
sylv256 (Migrated from github.com) commented 2025-08-01 05:47:58 +00:00

We should remove this if it's not used anywhere, and I don't think this comment has anything to do with anything here.

We should remove this if it's not used anywhere, and I don't think this comment has anything to do with anything here.
@ -0,0 +125,4 @@
.build();
}
private static ContextParamMap createParamMap(BlockState state, BlockPos origin, Entity entity, Entity entity2, BlockState entityBlock, ServerPlayer fakePlayer, Projectile projectile, GameTestHelper helper) throws InvalidContextParameterException {
sylv256 (Migrated from github.com) commented 2025-08-01 06:02:24 +00:00

We should probably name entity and entity2 something more specific, like "chicken" or whatever mob name they are.

We should probably name `entity` and `entity2` something more specific, like "chicken" or whatever mob name they are.
Sign in to join this conversation.
No description provided.