Register your own block-keys
private static final Set<Location> powerfulSponges = new HashSet<>();
private static final Key SPONGE_KEY = Key.of("SPONGE");
private static final Key POWERFUL_SPONGE_KEY = Key.of("POWERFUL_SPONGE");
private static final class PowerfulSpongeParser implements CustomKeyParser{
@Override
public Key getCustomKey(Location location) {
/* All of my custom sponges are cached in powerfulSponges.
I know that the block in that location will always be SPONGE, so I can return the sponge key
if it's not a custom sponge. If it is, then I return my custom key. */
return powerfulSponges.contains(location) ? POWERFUL_SPONGE_KEY : SPONGE_KEY;
}
@Override
public boolean isCustomKey(Key key) {
// If the key is "POWERFUL_SPONGE", then that key was created by this parser.
return key.equals(POWERFUL_SPONGE_KEY);
}
}Last updated