WIP property retrieval

This commit is contained in:
TheMode 2021-05-30 23:37:22 +02:00
parent 5a485a3aab
commit 8b0991139d
2 changed files with 23 additions and 0 deletions

View File

@ -17,12 +17,18 @@ public interface Block extends Keyed, TagReadable, BlockConstants {
<T> @NotNull Block withProperty(@NotNull BlockProperty<T> property, @NotNull T value); <T> @NotNull Block withProperty(@NotNull BlockProperty<T> property, @NotNull T value);
@NotNull Block withProperty(@NotNull String property, @NotNull String value);
<T> @NotNull Block withTag(@NotNull Tag<T> tag, @Nullable T value); <T> @NotNull Block withTag(@NotNull Tag<T> tag, @Nullable T value);
@NotNull Block withNbt(@Nullable NBTCompound compound); @NotNull Block withNbt(@Nullable NBTCompound compound);
@NotNull Block withHandler(@Nullable BlockHandler handler); @NotNull Block withHandler(@Nullable BlockHandler handler);
<T> @NotNull T getProperty(@NotNull BlockProperty<T> property);
@NotNull String getProperty(@NotNull String property);
@Nullable BlockHandler getHandler(); @Nullable BlockHandler getHandler();
@NotNull Block getDefaultBlock(); @NotNull Block getDefaultBlock();

View File

@ -96,6 +96,12 @@ class BlockImpl implements Block {
return block; return block;
} }
@Override
public @NotNull Block withProperty(@NotNull String property, @NotNull String value) {
// TODO
return null;
}
@Override @Override
public <T> @Nullable T getTag(@NotNull Tag<T> tag) { public <T> @Nullable T getTag(@NotNull Tag<T> tag) {
return tag.read(compound); return tag.read(compound);
@ -136,6 +142,17 @@ class BlockImpl implements Block {
return block; return block;
} }
@Override
public <T> @NotNull T getProperty(@NotNull BlockProperty<T> property) {
return (T) propertiesMap.get(property);
}
@Override
public @NotNull String getProperty(@NotNull String property) {
// TODO
return null;
}
@Override @Override
public @NotNull Block getDefaultBlock() { public @NotNull Block getDefaultBlock() {
return original; return original;