Make AbstractProperty abstract

This commit is contained in:
MattBDev 2019-06-28 19:00:31 -04:00
parent 8dd5f0c298
commit 0feebac44b
3 changed files with 10 additions and 20 deletions

View File

@ -27,7 +27,7 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class AbstractProperty<T> implements Property<T> { public abstract class AbstractProperty<T> implements Property<T> {
private final PropertyKey key; private final PropertyKey key;
private String name; private String name;
@ -73,9 +73,7 @@ public class AbstractProperty<T> implements Property<T> {
} }
//todo remove the following to allow for upstream compatibility. //todo remove the following to allow for upstream compatibility.
public <C extends AbstractProperty<T>> C withOffset(int bitOffset) { public abstract <C extends AbstractProperty<T>> C withOffset(int bitOffset);
return (C) new AbstractProperty<>(name, values, bitOffset);
}
@Deprecated @Deprecated
public int modify(int state, T value) { public int modify(int state, T value) {

View File

@ -46,8 +46,7 @@ import java.util.Objects;
*/ */
public class BaseBlock implements BlockStateHolder<BaseBlock> { public class BaseBlock implements BlockStateHolder<BaseBlock> {
private final BlockState blockState; private BlockState blockState;
@Nullable protected CompoundTag nbtData; @Nullable protected CompoundTag nbtData;
@Deprecated @Deprecated
@ -55,16 +54,6 @@ public class BaseBlock implements BlockStateHolder<BaseBlock> {
this(BlockTypes.AIR.getDefaultState()); 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. * Construct a block with the given type and default data.
* @deprecated Just use the BlockType.getDefaultState() * @deprecated Just use the BlockType.getDefaultState()

View File

@ -19,15 +19,16 @@
package com.sk89q.worldedit.world.block; package com.sk89q.worldedit.world.block;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.blocks.TileEntityBlock; import com.sk89q.worldedit.blocks.TileEntityBlock;
import com.sk89q.worldedit.function.pattern.FawePattern; import com.sk89q.worldedit.function.pattern.FawePattern;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.registry.state.PropertyKey; import com.sk89q.worldedit.registry.state.PropertyKey;
import com.sk89q.worldedit.world.registry.BlockMaterial; import com.sk89q.worldedit.world.registry.BlockMaterial;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -198,9 +199,11 @@ public interface BlockStateHolder<B extends BlockStateHolder<B>> extends FawePat
if (getStates().isEmpty()) { if (getStates().isEmpty()) {
return this.getBlockType().getId(); return this.getBlockType().getId();
} else { } else {
String properties = String properties = getStates().entrySet().stream()
getStates().entrySet().stream().map(entry -> entry.getKey().getName() + "=" + entry.getValue().toString().toLowerCase()).collect(Collectors.joining( .map(entry -> entry.getKey().getName()
",")); + "="
+ entry.getValue().toString().toLowerCase(Locale.ROOT))
.collect(Collectors.joining(","));
return this.getBlockType().getId() + "[" + properties + "]"; return this.getBlockType().getId() + "[" + properties + "]";
} }
} }