Add experimental Block#possibleStates

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-10-25 16:17:12 +02:00
parent c9f52397cb
commit 1b4e0519ee
2 changed files with 10 additions and 4 deletions

View File

@ -5,10 +5,7 @@ import net.minestom.server.registry.Registry;
import net.minestom.server.tag.Tag;
import net.minestom.server.tag.TagReadable;
import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import org.jetbrains.annotations.*;
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
import java.util.Collection;
@ -122,6 +119,10 @@ public sealed interface Block extends ProtocolObject, TagReadable, Blocks permit
return properties().get(property);
}
@Contract(pure = true)
@ApiStatus.Experimental
@NotNull Collection<@NotNull Block> possibleStates();
/**
* Returns the block registry.
* <p>

View File

@ -132,6 +132,11 @@ final class BlockImpl implements Block {
return Collections.unmodifiableMap(properties);
}
@Override
public @NotNull Collection<@NotNull Block> possibleStates() {
return propertyEntry.values();
}
@Override
public @NotNull Registry.BlockEntry registry() {
return registry;