From 0feebac44b8e67e8753b76247860f02c27a31254 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 28 Jun 2019 19:00:31 -0400 Subject: [PATCH] Make AbstractProperty abstract --- .../worldedit/registry/state/AbstractProperty.java | 6 ++---- .../com/sk89q/worldedit/world/block/BaseBlock.java | 13 +------------ .../worldedit/world/block/BlockStateHolder.java | 11 +++++++---- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java index 7177d5410..4c1028b5a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java @@ -27,7 +27,7 @@ import com.sk89q.worldedit.world.block.BlockTypes; import javax.annotation.Nullable; import java.util.List; -public class AbstractProperty implements Property { +public abstract class AbstractProperty implements Property { private final PropertyKey key; private String name; @@ -73,9 +73,7 @@ public class AbstractProperty implements Property { } //todo remove the following to allow for upstream compatibility. - public > C withOffset(int bitOffset) { - return (C) new AbstractProperty<>(name, values, bitOffset); - } + public abstract > C withOffset(int bitOffset); @Deprecated public int modify(int state, T value) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java index 0c994e0de..0b0997992 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java @@ -46,8 +46,7 @@ import java.util.Objects; */ public class BaseBlock implements BlockStateHolder { - private final BlockState blockState; - + private BlockState blockState; @Nullable protected CompoundTag nbtData; @Deprecated @@ -55,16 +54,6 @@ public class BaseBlock implements BlockStateHolder { this(BlockTypes.AIR.getDefaultState()); } -// /** -// * Construct a block with a state. -// * @deprecated Just use the BlockStateHolder instead -// * @param blockState The blockstate -// */ -// @Deprecated -// public BaseBlock(BlockStateHolder blockState) { -// this(blockState, blockState.getNbtData()); -// } - /** * Construct a block with the given type and default data. * @deprecated Just use the BlockType.getDefaultState() diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java index 6ab42e12c..eed1c68eb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java @@ -19,15 +19,16 @@ package com.sk89q.worldedit.world.block; +import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.blocks.TileEntityBlock; import com.sk89q.worldedit.function.pattern.FawePattern; -import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.registry.state.PropertyKey; import com.sk89q.worldedit.world.registry.BlockMaterial; import javax.annotation.Nullable; +import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; @@ -198,9 +199,11 @@ public interface BlockStateHolder> extends FawePat if (getStates().isEmpty()) { return this.getBlockType().getId(); } else { - String properties = - getStates().entrySet().stream().map(entry -> entry.getKey().getName() + "=" + entry.getValue().toString().toLowerCase()).collect(Collectors.joining( - ",")); + String properties = getStates().entrySet().stream() + .map(entry -> entry.getKey().getName() + + "=" + + entry.getValue().toString().toLowerCase(Locale.ROOT)) + .collect(Collectors.joining(",")); return this.getBlockType().getId() + "[" + properties + "]"; } }