In Minecraft 1.21, entity selector options were refactored. The existing documentation is no longer valid, particularly with the now-missing EntitySelectorReader#setPredicate
method:
|
* <pre>{@code |
|
* EntitySelectorOptionRegistry.register( |
|
* Identifier.of("example", "min_health"), |
|
* Text.literal("Minimum entity health"), |
|
* (reader) -> { |
|
* final float minHealth = reader.getReader().readFloat(); |
|
* |
|
* if (minHealth > 0) { |
|
* reader.setPredicate((entity) -> entity instanceof LivingEntity livingEntity && livingEntity.getHealth() >= minHealth); |
|
* } |
|
* }, |
|
* (reader) -> true |
|
* ); |
|
* }</pre> |