Further work on BlockState transition

This commit is contained in:
Matthew Miller
2018-06-18 22:51:21 +10:00
parent e99190225e
commit 484687a49d
76 changed files with 2911 additions and 10010 deletions

View File

@ -24,6 +24,7 @@ package com.sk89q.worldedit.util;
import com.sk89q.util.StringUtil;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.world.registry.BundledItemData;
import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
import java.io.File;
@ -90,6 +91,10 @@ public class PropertiesConfiguration extends LocalConfiguration {
logFormat = getString("log-format", logFormat);
registerHelp = getBool("register-help", registerHelp);
wandItem = getString("wand-item", wandItem);
try {
wandItem = BundledItemData.getInstance().fromLegacyId(Integer.parseInt(wandItem));
} catch (Throwable e) {
}
superPickaxeDrop = getBool("super-pickaxe-drop-items", superPickaxeDrop);
superPickaxeManyDrop = getBool("super-pickaxe-many-drop-items", superPickaxeManyDrop);
noDoubleSlash = getBool("no-double-slash", noDoubleSlash);
@ -97,6 +102,10 @@ public class PropertiesConfiguration extends LocalConfiguration {
useInventoryOverride = getBool("use-inventory-override", useInventoryOverride);
useInventoryCreativeOverride = getBool("use-inventory-creative-override", useInventoryCreativeOverride);
navigationWand = getString("nav-wand-item", navigationWand);
try {
navigationWand = BundledItemData.getInstance().fromLegacyId(Integer.parseInt(navigationWand));
} catch (Throwable e) {
}
navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance);
navigationUseGlass = getBool("nav-use-glass", navigationUseGlass);
scriptTimeout = getInt("scripting-timeout", scriptTimeout);

View File

@ -283,6 +283,6 @@ public class TreeGenerator {
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
private static boolean setBlockIfAir(EditSession session, Vector position, BaseBlock block) throws MaxChangedBlocksException {
return session.getBlock(position).isAir() && session.setBlock(position, block);
return session.getBlock(position).getBlockType() == BlockTypes.AIR && session.setBlock(position, block);
}
}

View File

@ -24,6 +24,7 @@ import com.sk89q.util.yaml.YAMLProcessor;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.session.SessionManager;
import com.sk89q.worldedit.world.registry.BundledItemData;
import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
import java.io.IOException;
@ -55,6 +56,10 @@ public class YAMLConfiguration extends LocalConfiguration {
profile = config.getBoolean("debug", profile);
wandItem = config.getString("wand-item", wandItem);
try {
wandItem = BundledItemData.getInstance().fromLegacyId(Integer.parseInt(wandItem));
} catch (Throwable e) {
}
defaultChangeLimit = Math.max(-1, config.getInt(
"limits.max-blocks-changed.default", defaultChangeLimit));
@ -99,6 +104,10 @@ public class YAMLConfiguration extends LocalConfiguration {
useInventoryCreativeOverride);
navigationWand = config.getString("navigation-wand.item", navigationWand);
try {
navigationWand = BundledItemData.getInstance().fromLegacyId(Integer.parseInt(navigationWand));
} catch (Throwable e) {
}
navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance);
navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass);