From 8b0991139d96722a924e558f478f357eec5f6b98 Mon Sep 17 00:00:00 2001 From: TheMode Date: Sun, 30 May 2021 23:37:22 +0200 Subject: [PATCH] WIP property retrieval --- .../minestom/server/instance/block/Block.java | 6 ++++++ .../server/instance/block/BlockImpl.java | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/main/java/net/minestom/server/instance/block/Block.java b/src/main/java/net/minestom/server/instance/block/Block.java index 51a1856b2..8d3014be5 100644 --- a/src/main/java/net/minestom/server/instance/block/Block.java +++ b/src/main/java/net/minestom/server/instance/block/Block.java @@ -17,12 +17,18 @@ public interface Block extends Keyed, TagReadable, BlockConstants { @NotNull Block withProperty(@NotNull BlockProperty property, @NotNull T value); + @NotNull Block withProperty(@NotNull String property, @NotNull String value); + @NotNull Block withTag(@NotNull Tag tag, @Nullable T value); @NotNull Block withNbt(@Nullable NBTCompound compound); @NotNull Block withHandler(@Nullable BlockHandler handler); + @NotNull T getProperty(@NotNull BlockProperty property); + + @NotNull String getProperty(@NotNull String property); + @Nullable BlockHandler getHandler(); @NotNull Block getDefaultBlock(); diff --git a/src/main/java/net/minestom/server/instance/block/BlockImpl.java b/src/main/java/net/minestom/server/instance/block/BlockImpl.java index f1cb31682..443a69ba8 100644 --- a/src/main/java/net/minestom/server/instance/block/BlockImpl.java +++ b/src/main/java/net/minestom/server/instance/block/BlockImpl.java @@ -96,6 +96,12 @@ class BlockImpl implements Block { return block; } + @Override + public @NotNull Block withProperty(@NotNull String property, @NotNull String value) { + // TODO + return null; + } + @Override public @Nullable T getTag(@NotNull Tag tag) { return tag.read(compound); @@ -136,6 +142,17 @@ class BlockImpl implements Block { return block; } + @Override + public @NotNull T getProperty(@NotNull BlockProperty property) { + return (T) propertiesMap.get(property); + } + + @Override + public @NotNull String getProperty(@NotNull String property) { + // TODO + return null; + } + @Override public @NotNull Block getDefaultBlock() { return original;