mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 12:06:41 +00:00
Further work on BlockState transition
This commit is contained in:
@ -21,6 +21,8 @@ package com.sk89q.worldedit.world.registry;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
import com.sk89q.worldedit.blocks.type.BlockState;
|
||||
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.registry.state.State;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -38,7 +40,7 @@ public interface BlockRegistry {
|
||||
* @return the block, which may be null if no block exists
|
||||
*/
|
||||
@Nullable
|
||||
BaseBlock createFromId(String id);
|
||||
BlockState createFromId(String id);
|
||||
|
||||
/**
|
||||
* Create a new block using its legacy numeric ID.
|
||||
@ -48,7 +50,7 @@ public interface BlockRegistry {
|
||||
*/
|
||||
@Nullable
|
||||
@Deprecated
|
||||
BaseBlock createFromId(int id);
|
||||
BlockState createFromId(int id);
|
||||
|
||||
/**
|
||||
* Get the material for the given block.
|
||||
@ -66,6 +68,6 @@ public interface BlockRegistry {
|
||||
* @return a map of states where the key is the state's ID
|
||||
*/
|
||||
@Nullable
|
||||
Map<String, ? extends State> getStates(BaseBlock block);
|
||||
Map<String, ? extends State> getStates(BlockStateHolder block);
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ package com.sk89q.worldedit.world.registry;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
import com.sk89q.worldedit.blocks.type.BlockState;
|
||||
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.state.State;
|
||||
|
||||
@ -35,13 +37,13 @@ public class BundledBlockRegistry implements BlockRegistry {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BaseBlock createFromId(String id) {
|
||||
return new BaseBlock(BlockTypes.getBlockType(id));
|
||||
public BlockState createFromId(String id) {
|
||||
return BlockTypes.getBlockType(id).getDefaultState();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BaseBlock createFromId(int legacyId) {
|
||||
public BlockState createFromId(int legacyId) {
|
||||
String id = BundledBlockData.getInstance().fromLegacyId(legacyId);
|
||||
if (id != null) {
|
||||
return createFromId(id);
|
||||
@ -58,7 +60,7 @@ public class BundledBlockRegistry implements BlockRegistry {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Map<String, ? extends State> getStates(BaseBlock block) {
|
||||
public Map<String, ? extends State> getStates(BlockStateHolder block) {
|
||||
return BundledBlockData.getInstance().getStatesById(block.getBlockType().getId());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user