Fixing #1169 - use strum macros for BlockKind conversion

This commit is contained in:
Daan Vanoverloop
2021-06-26 16:54:17 +02:00
parent f983295318
commit 0076b8379c
3 changed files with 9 additions and 25 deletions

View File

@ -43,6 +43,7 @@ use hashbrown::{HashMap, HashSet};
use humantime::Duration as HumanDuration;
use rand::Rng;
use specs::{storage::StorageEntry, Builder, Entity as EcsEntity, Join, WorldExt};
use std::str::FromStr;
use vek::*;
use wiring::{Circuit, Wire, WiringAction, WiringActionEffect, WiringElement};
use world::util::Sampler;
@ -515,7 +516,7 @@ fn handle_make_block(
action: &ChatCommand,
) -> CmdResult<()> {
if let Some(block_name) = scan_fmt_some!(&args, &action.arg_fmt(), String) {
if let Ok(bk) = BlockKind::try_from(block_name.as_str()) {
if let Ok(bk) = BlockKind::from_str(block_name.as_str()) {
let pos = position(server, target, "target")?;
server.state.set_block(
pos.0.map(|e| e.floor() as i32),