mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 16:37:38 +01:00
Create ProtocolObject
This commit is contained in:
parent
35baf1e772
commit
82eec1072c
@ -1,7 +1,6 @@
|
|||||||
package net.minestom.server.instance.block;
|
package net.minestom.server.instance.block;
|
||||||
|
|
||||||
import net.kyori.adventure.key.Key;
|
import net.minestom.server.registry.ProtocolObject;
|
||||||
import net.kyori.adventure.key.Keyed;
|
|
||||||
import net.minestom.server.tag.Tag;
|
import net.minestom.server.tag.Tag;
|
||||||
import net.minestom.server.tag.TagReadable;
|
import net.minestom.server.tag.TagReadable;
|
||||||
import net.minestom.server.utils.NamespaceID;
|
import net.minestom.server.utils.NamespaceID;
|
||||||
@ -13,7 +12,7 @@ import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.BiPredicate;
|
import java.util.function.BiPredicate;
|
||||||
|
|
||||||
public interface Block extends Keyed, TagReadable, BlockConstants {
|
public interface Block extends ProtocolObject, TagReadable, BlockConstants {
|
||||||
|
|
||||||
<T> @NotNull Block withProperty(@NotNull BlockProperty<T> property, @NotNull T value);
|
<T> @NotNull Block withProperty(@NotNull BlockProperty<T> property, @NotNull T value);
|
||||||
|
|
||||||
@ -33,21 +32,8 @@ public interface Block extends Keyed, TagReadable, BlockConstants {
|
|||||||
|
|
||||||
@NotNull Block getDefaultBlock();
|
@NotNull Block getDefaultBlock();
|
||||||
|
|
||||||
@NotNull NamespaceID getNamespaceId();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default @NotNull Key key() {
|
|
||||||
return getNamespaceId();
|
|
||||||
}
|
|
||||||
|
|
||||||
default @NotNull String getName() {
|
|
||||||
return getNamespaceId().asString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull Map<String, String> createPropertiesMap();
|
@NotNull Map<String, String> createPropertiesMap();
|
||||||
|
|
||||||
int getId();
|
|
||||||
|
|
||||||
short getStateId();
|
short getStateId();
|
||||||
|
|
||||||
@NotNull BlockData getData();
|
@NotNull BlockData getData();
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package net.minestom.server.registry;
|
||||||
|
|
||||||
|
import net.kyori.adventure.key.Key;
|
||||||
|
import net.kyori.adventure.key.Keyed;
|
||||||
|
import net.minestom.server.utils.NamespaceID;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public interface ProtocolObject extends Keyed {
|
||||||
|
|
||||||
|
@NotNull NamespaceID getNamespaceId();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default @NotNull Key key() {
|
||||||
|
return getNamespaceId();
|
||||||
|
}
|
||||||
|
|
||||||
|
default @NotNull String getName() {
|
||||||
|
return getNamespaceId().asString();
|
||||||
|
}
|
||||||
|
|
||||||
|
int getId();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user