use of com.sk89q.worldedit.registry.state.Property in project FastAsyncWorldEdit by IntellectualSites.
the class PaperweightAdapter method getInternalBlockStateId.
@Override
public OptionalInt getInternalBlockStateId(BlockState state) {
Block mcBlock = getBlockFromType(state.getBlockType());
net.minecraft.world.level.block.state.BlockState newState = mcBlock.defaultBlockState();
Map<Property<?>, Object> states = state.getStates();
newState = applyProperties(mcBlock.getStateDefinition(), newState, states);
final int combinedId = Block.getId(newState);
return combinedId == 0 && state.getBlockType() != BlockTypes.AIR ? OptionalInt.empty() : OptionalInt.of(combinedId);
}
use of com.sk89q.worldedit.registry.state.Property in project FastAsyncWorldEdit by IntellectualSites.
the class FabricAdapter method adapt.
public static net.minecraft.block.BlockState adapt(BlockState blockState) {
Block mcBlock = adapt(blockState.getBlockType());
net.minecraft.block.BlockState newState = mcBlock.getDefaultState();
Map<Property<?>, Object> states = blockState.getStates();
return applyProperties(mcBlock.getStateFactory(), newState, states);
}
use of com.sk89q.worldedit.registry.state.Property in project FastAsyncWorldEdit by IntellectualSites.
the class ForgeAdapter method adapt.
public static net.minecraft.block.BlockState adapt(BlockState blockState) {
Block mcBlock = adapt(blockState.getBlockType());
net.minecraft.block.BlockState newState = mcBlock.getDefaultState();
Map<Property<?>, Object> states = blockState.getStates();
return applyProperties(mcBlock.getStateContainer(), newState, states);
}
use of com.sk89q.worldedit.registry.state.Property in project FastAsyncWorldEdit by IntellectualSites.
the class ForgeBlockRegistry method getProperties.
@Override
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) {
Block block = ForgeAdapter.adapt(blockType);
Map<String, Property<?>> map = new TreeMap<>();
Collection<IProperty<?>> propertyKeys = block.getDefaultState().getProperties();
for (IProperty<?> key : propertyKeys) {
map.put(key.getName(), ForgeAdapter.adaptProperty(key));
}
return map;
}
use of com.sk89q.worldedit.registry.state.Property in project FastAsyncWorldEdit by IntellectualSites.
the class FabricBlockRegistry method getProperties.
@Override
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) {
Block block = FabricAdapter.adapt(blockType);
Map<String, Property<?>> map = new TreeMap<>();
Collection<net.minecraft.state.property.Property<?>> propertyKeys = block.getDefaultState().getProperties();
for (net.minecraft.state.property.Property<?> key : propertyKeys) {
map.put(key.getName(), FabricAdapter.adaptProperty(key));
}
return map;
}
Aggregations