diff --git a/README.md b/README.md index 2dc4846ba..3eb26b510 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,15 @@ ![WorldEdit](http://static.sk89q.com/readme/worldedit.png) ========= -WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both -single player and multiplayer, that lets you: +WorldEdit is Minecraft mod that turns Minecraft into an in-game map editor (sorta, kinda). -* Change thousands of blocks in an area at once by selecting regions. -* Use over 100 functions to modify the world or remove problems. -* Remove large chunks of land as you wish. -* Sculpt the world and build mountains with brushes. -* Fix annoyances such as broken water, missing snow, raging fires, and more. +* Make awesome stuff with half the time OR make ***quadriply** awesome* creations with the same time :sparkles: +* Get lost in hundreds of options and functions that even we've forgotten existed +* Utilize Photoshop-like tools like "selection areas" and "brushes" +* Making fjords and other natural wonders with weird names +* Also: fix grief, broken water, missing snow, raging fires, and other :poop: -WorldEdit is open source and is available under the GNU Lesser General Public -License v3. +WorldEdit is open source!, so if you've just learned how to make a button blink, I probably recommend picking up a book on CS algorithms. The project is licensed using the GNU Lesser General Public License license, v3. Compiling --------- diff --git a/build.gradle b/build.gradle index a97b88a56..9d91915c1 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,8 @@ buildscript { configurations.all { resolutionStrategy { - force 'com.google.guava:guava:17.0' + force 'com.google.guava:guava:21.0' + force 'org.ow2.asm:asm:6.0_BETA' } } @@ -34,7 +35,7 @@ buildscript { allprojects { group = 'com.sk89q.worldedit' - version = '6.1.7-SNAPSHOT' + version = '7.0.0-SNAPSHOT' } if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl = "http://localhost" @@ -86,10 +87,11 @@ subprojects { ext.internalVersion = version + ";" + gitCommitHash - sourceCompatibility = 1.7 - targetCompatibility = 1.7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml") + checkstyle.toolVersion = '7.6.1' repositories { mavenCentral() diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 1e33564c4..cd403cf91 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -27,7 +27,6 @@ - @@ -61,4 +60,4 @@ - \ No newline at end of file + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d6e2637af..0d4a95168 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 589dd6099..a95009c3b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Wed Nov 23 21:39:25 PST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-bin.zip diff --git a/gradlew b/gradlew index 4ef3a871f..cccdd3d51 100755 --- a/gradlew +++ b/gradlew @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS="" # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -155,13 +155,14 @@ if $cygwin ; then fi # Escape application args -for s in "${@}" ; do - s=\"$s\" - APP_ARGS=$APP_ARGS" "$s -done +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") # Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- "$DEFAULT_JVM_OPTS" "$JAVA_OPTS" "$GRADLE_OPTS" "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 2413532e3..5c1a39cd9 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -1,5 +1,6 @@ apply plugin: 'eclipse' apply plugin: 'idea' +apply plugin: 'maven' repositories { maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } @@ -8,7 +9,7 @@ repositories { dependencies { compile project(':worldedit-core') compile 'com.sk89q:dummypermscompat:1.8' - compile 'org.bukkit:bukkit:1.9.4-R0.1-SNAPSHOT' // zzz + compile 'org.bukkit:bukkit:1.13-R0.1-SNAPSHOT' // zzz testCompile 'org.mockito:mockito-core:1.9.0-rc1' } @@ -33,10 +34,7 @@ jar { shadowJar { dependencies { include(dependency(':worldedit-core')) - include(dependency('com.google.code.gson:gson:2.2.4')) } - - relocate('com.google.gson', 'com.sk89q.worldedit.internal.gson') } build.dependsOn(shadowJar) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/CommandRegistration.java b/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/CommandRegistration.java index 2417b2ced..e7df6832c 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/CommandRegistration.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/CommandRegistration.java @@ -82,7 +82,7 @@ public class CommandRegistration { public boolean unregisterCommands() { CommandMap commandMap = getCommandMap(); - List toRemove = new ArrayList(); + List toRemove = new ArrayList<>(); Map knownCommands = ReflectionUtil.getField(commandMap, "knownCommands"); Set aliases = ReflectionUtil.getField(commandMap, "aliases"); if (knownCommands == null || aliases == null) { diff --git a/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/CommandsManagerRegistration.java b/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/CommandsManagerRegistration.java index 175c51c6d..5f8bfbc8c 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/CommandsManagerRegistration.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/bukkit/util/CommandsManagerRegistration.java @@ -50,7 +50,7 @@ public class CommandsManagerRegistration extends CommandRegistration { } public boolean registerAll(List registered) { - List toRegister = new ArrayList(); + List toRegister = new ArrayList<>(); for (Command command : registered) { List permissions = null; Method cmdMethod = commands.getMethods().get(null).get(command.aliases()[0]); @@ -59,7 +59,7 @@ public class CommandsManagerRegistration extends CommandRegistration { if (cmdMethod != null && cmdMethod.isAnnotationPresent(CommandPermissions.class)) { permissions = Arrays.asList(cmdMethod.getAnnotation(CommandPermissions.class).value()); } else if (cmdMethod != null && childMethods != null && !childMethods.isEmpty()) { - permissions = new ArrayList(); + permissions = new ArrayList<>(); for (Method m : childMethods.values()) { if (m.isAnnotationPresent(CommandPermissions.class)) { permissions.addAll(Arrays.asList(m.getAnnotation(CommandPermissions.class).value())); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/ConfigurationPermissionsResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/ConfigurationPermissionsResolver.java index 75beabdf2..d61674c1e 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/ConfigurationPermissionsResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/ConfigurationPermissionsResolver.java @@ -19,16 +19,16 @@ package com.sk89q.wepif; +import com.sk89q.util.yaml.YAMLNode; +import com.sk89q.util.yaml.YAMLProcessor; +import org.bukkit.OfflinePlayer; + import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import com.sk89q.util.yaml.YAMLNode; -import com.sk89q.util.yaml.YAMLProcessor; -import org.bukkit.OfflinePlayer; - public class ConfigurationPermissionsResolver implements PermissionsResolver { private YAMLProcessor config; private Map> userPermissionsCache; @@ -52,11 +52,11 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver { @Override public void load() { - userGroups = new HashMap>(); - userPermissionsCache = new HashMap>(); - defaultPermissionsCache = new HashSet(); + userGroups = new HashMap<>(); + userPermissionsCache = new HashMap<>(); + defaultPermissionsCache = new HashSet<>(); - Map> userGroupPermissions = new HashMap>(); + Map> userGroupPermissions = new HashMap<>(); List groupKeys = config.getStringList("permissions.groups", null); @@ -66,7 +66,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver { config.getStringList("permissions.groups." + key + ".permissions", null); if (!permissions.isEmpty()) { - Set groupPerms = new HashSet(permissions); + Set groupPerms = new HashSet<>(permissions); userGroupPermissions.put(key, groupPerms); if (key.equals("default")) { @@ -80,7 +80,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver { if (userKeys != null) { for (String key : userKeys) { - Set permsCache = new HashSet(); + Set permsCache = new HashSet<>(); List permissions = config.getStringList("permissions.users." + key + ".permissions", null); @@ -103,7 +103,7 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver { } userPermissionsCache.put(key.toLowerCase(), permsCache); - userGroups.put(key.toLowerCase(), new HashSet(groups)); + userGroups.put(key.toLowerCase(), new HashSet<>(groups)); } } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/DinnerPermsResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/DinnerPermsResolver.java index 4e8199f9b..d5f9c7fc6 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/DinnerPermsResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/DinnerPermsResolver.java @@ -114,13 +114,13 @@ public class DinnerPermsResolver implements PermissionsResolver { if (perms == null) { return new String[0]; } - List groupNames = new ArrayList(); + List groupNames = new ArrayList<>(); for (PermissionAttachmentInfo permAttach : perms.getEffectivePermissions()) { String perm = permAttach.getPermission(); if (!(perm.startsWith(GROUP_PREFIX) && permAttach.getValue())) { continue; } - groupNames.add(perm.substring(GROUP_PREFIX.length(), perm.length())); + groupNames.add(perm.substring(GROUP_PREFIX.length())); } return groupNames.toArray(new String[groupNames.size()]); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java index 6caa45207..3f2324596 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java @@ -66,13 +66,8 @@ public class FlatFilePermissionsResolver implements PermissionsResolver { this.userFile = userFile; } - @Deprecated - public static boolean filesExists() { - return (new File("perms_groups.txt")).exists() && (new File("perms_users.txt")).exists(); - } - public Map> loadGroupPermissions() { - Map> userGroupPermissions = new HashMap>(); + Map> userGroupPermissions = new HashMap<>(); BufferedReader buff = null; @@ -98,7 +93,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver { if (parts.length > 1) { String[] perms = parts[1].split(","); - Set groupPerms = new HashSet(Arrays.asList(perms)); + Set groupPerms = new HashSet<>(Arrays.asList(perms)); userGroupPermissions.put(key, groupPerms); } } @@ -118,9 +113,9 @@ public class FlatFilePermissionsResolver implements PermissionsResolver { @Override public void load() { - userGroups = new HashMap>(); - userPermissionsCache = new HashMap>(); - defaultPermissionsCache = new HashSet(); + userGroups = new HashMap<>(); + userPermissionsCache = new HashMap<>(); + defaultPermissionsCache = new HashSet<>(); Map> userGroupPermissions = loadGroupPermissions(); @@ -136,7 +131,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver { String line; while ((line = buff.readLine()) != null) { - Set permsCache = new HashSet(); + Set permsCache = new HashSet<>(); line = line.trim(); @@ -165,7 +160,7 @@ public class FlatFilePermissionsResolver implements PermissionsResolver { } userPermissionsCache.put(key.toLowerCase(), permsCache); - userGroups.put(key.toLowerCase(), new HashSet(Arrays.asList(groups))); + userGroups.put(key.toLowerCase(), new HashSet<>(Arrays.asList(groups))); } } } catch (IOException e) { diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/NijiPermissionsResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/NijiPermissionsResolver.java index f3502d460..fe23bfa46 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/NijiPermissionsResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/NijiPermissionsResolver.java @@ -19,6 +19,7 @@ package com.sk89q.wepif; +import com.nijikokun.bukkit.Permissions.Permissions; import com.sk89q.util.yaml.YAMLProcessor; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; @@ -27,7 +28,6 @@ import org.bukkit.command.PluginCommand; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; -import com.nijikokun.bukkit.Permissions.Permissions; import java.util.logging.Level; import java.util.logging.Logger; @@ -50,7 +50,7 @@ public class NijiPermissionsResolver implements PermissionsResolver { Plugin plugin = pluginManager.getPlugin("Permissions"); // Check if plugin is loaded and has Permissions interface - if (plugin == null || !(plugin instanceof Permissions)) { + if (!(plugin instanceof Permissions)) { return null; } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsProvider.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsProvider.java index 2d9be46a3..8332a519b 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsProvider.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsProvider.java @@ -22,19 +22,19 @@ package com.sk89q.wepif; import org.bukkit.OfflinePlayer; public interface PermissionsProvider { - public boolean hasPermission(String name, String permission); + boolean hasPermission(String name, String permission); - public boolean hasPermission(String worldName, String name, String permission); + boolean hasPermission(String worldName, String name, String permission); - public boolean inGroup(String player, String group); + boolean inGroup(String player, String group); - public String[] getGroups(String player); + String[] getGroups(String player); - public boolean hasPermission(OfflinePlayer player, String permission); + boolean hasPermission(OfflinePlayer player, String permission); - public boolean hasPermission(String worldName, OfflinePlayer player, String permission); + boolean hasPermission(String worldName, OfflinePlayer player, String permission); - public boolean inGroup(OfflinePlayer player, String group); + boolean inGroup(OfflinePlayer player, String group); - public String[] getGroups(OfflinePlayer player); + String[] getGroups(OfflinePlayer player); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolver.java index 1423ede23..918c1bc23 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolver.java @@ -20,7 +20,7 @@ package com.sk89q.wepif; public interface PermissionsResolver extends PermissionsProvider { - public void load(); + void load(); - public String getDetectionMessage(); + String getDetectionMessage(); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java index babc4a4cf..01f04546b 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java @@ -86,7 +86,7 @@ public class PermissionsResolverManager implements PermissionsResolver { private PermissionsResolver permissionResolver; private YAMLProcessor config; private Logger logger = Logger.getLogger(getClass().getCanonicalName()); - private List> enabledResolvers = new ArrayList>(); + private List> enabledResolvers = new ArrayList<>(); @SuppressWarnings("unchecked") protected Class[] availableResolvers = new Class[] { @@ -213,7 +213,7 @@ public class PermissionsResolverManager implements PermissionsResolver { if (!keys.contains("resolvers")) { //List resolverKeys = config.getKeys("resolvers"); - List resolvers = new ArrayList(); + List resolvers = new ArrayList<>(); for (Class clazz : availableResolvers) { resolvers.add(clazz.getSimpleName()); } @@ -221,7 +221,7 @@ public class PermissionsResolverManager implements PermissionsResolver { config.setProperty("resolvers.enabled", resolvers); isUpdated = true; } else { - List disabledResolvers = config.getStringList("resolvers.disabled", new ArrayList()); + List disabledResolvers = config.getStringList("resolvers.disabled", new ArrayList<>()); List stagedEnabled = config.getStringList("resolvers.enabled", null); for (Iterator i = stagedEnabled.iterator(); i.hasNext();) { String nextName = i.next(); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java index 306f19b7b..f1181cf50 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java @@ -19,22 +19,62 @@ package com.sk89q.worldedit.bukkit; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.base.Function; import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.Entity; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.gamemode.GameMode; +import com.sk89q.worldedit.world.gamemode.GameModes; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.block.data.BlockData; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -import static com.google.common.base.Preconditions.checkNotNull; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +import javax.annotation.Nullable; /** * Adapts between Bukkit and WorldEdit equivalent objects. */ -final class BukkitAdapter { +public class BukkitAdapter { private BukkitAdapter() { } + private static final ParserContext TO_BLOCK_CONTEXT = new ParserContext(); + + static { + TO_BLOCK_CONTEXT.setRestricted(false); + } + + /** + * Checks equality between a WorldEdit BlockType and a Bukkit Material + * + * @param blockType The WorldEdit BlockType + * @param type The Bukkit Material + * @return If they are equal + */ + public static boolean equals(BlockType blockType, Material type) { + return Objects.equals(blockType.getId(), type.getKey().toString()); + } + /** * Convert any WorldEdit world into an equivalent wrapped Bukkit world. * @@ -67,6 +107,26 @@ final class BukkitAdapter { return new BukkitWorld(world); } + /** + * Create a WorldEdit Player from a Bukkit Player. + * + * @param player The Bukkit player + * @return The WorldEdit player + */ + public static BukkitPlayer adapt(Player player) { + return WorldEditPlugin.getInstance().wrapPlayer(player); + } + + /** + * Create a Bukkit Player from a WorldEdit Player. + * + * @param player The WorldEdit player + * @return The Bukkit player + */ + public static Player adapt(com.sk89q.worldedit.entity.Player player) { + return ((BukkitPlayer) player).getPlayer(); + } + /** * Create a Bukkit world from a WorldEdit world. * @@ -95,7 +155,7 @@ final class BukkitAdapter { */ public static Location adapt(org.bukkit.Location location) { checkNotNull(location); - Vector position = BukkitUtil.toVector(location); + Vector position = asVector(location); return new com.sk89q.worldedit.util.Location( adapt(location.getWorld()), position, @@ -151,6 +211,17 @@ final class BukkitAdapter { location.getPitch()); } + /** + * Create a WorldEdit Vector from a Bukkit location. + * + * @param location The Bukkit location + * @return a WorldEdit vector + */ + public static Vector asVector(org.bukkit.Location location) { + checkNotNull(location); + return new Vector(location.getX(), location.getY(), location.getZ()); + } + /** * Create a WorldEdit entity from a Bukkit entity. * @@ -162,4 +233,142 @@ final class BukkitAdapter { return new BukkitEntity(entity); } + /** + * Create a Bukkit Material form a WorldEdit ItemType + * + * @param itemType The WorldEdit ItemType + * @return The Bukkit Material + */ + public static Material adapt(ItemType itemType) { + checkNotNull(itemType); + if (!itemType.getId().startsWith("minecraft:")) { + throw new IllegalArgumentException("Bukkit only supports Minecraft items"); + } + return Material.getMaterial(itemType.getId().replace("minecraft:", "").toUpperCase()); + } + + /** + * Create a Bukkit Material form a WorldEdit BlockType + * + * @param blockType The WorldEdit BlockType + * @return The Bukkit Material + */ + public static Material adapt(BlockType blockType) { + checkNotNull(blockType); + if (!blockType.getId().startsWith("minecraft:")) { + throw new IllegalArgumentException("Bukkit only supports Minecraft blocks"); + } + return Material.getMaterial(blockType.getId().replace("minecraft:", "").toUpperCase()); + } + + /** + * Create a WorldEdit GameMode from a Bukkit one. + * + * @param gameMode Bukkit GameMode + * @return WorldEdit GameMode + */ + public static GameMode adapt(org.bukkit.GameMode gameMode) { + checkNotNull(gameMode); + return GameModes.get(gameMode.name().toLowerCase()); + } + + /** + * Converts a Material to a BlockType + * + * @param material The material + * @return The blocktype + */ + public static BlockType asBlockType(Material material) { + checkNotNull(material); + if (!material.isBlock()) { + throw new IllegalArgumentException(material.getKey().toString() + " is not a block!"); + } + return BlockTypes.get(material.getKey().toString()); + } + + /** + * Converts a Material to a ItemType + * + * @param material The material + * @return The itemtype + */ + public static ItemType asItemType(Material material) { + checkNotNull(material); + if (!material.isItem()) { + throw new IllegalArgumentException(material.getKey().toString() + " is not an item!"); + } + return ItemTypes.get(material.getKey().toString()); + } + + private static Map blockStateCache = new HashMap<>(); + + /** + * Create a WorldEdit BlockState from a Bukkit BlockData + * + * @param blockData The Bukkit BlockData + * @return The WorldEdit BlockState + */ + public static BlockState adapt(BlockData blockData) { + checkNotNull(blockData); + return blockStateCache.computeIfAbsent(blockData.getAsString(), new Function() { + @Nullable + @Override + public BlockState apply(@Nullable String input) { + try { + return WorldEdit.getInstance().getBlockFactory().parseFromInput(input, TO_BLOCK_CONTEXT).toImmutableState(); + } catch (InputParseException e) { + e.printStackTrace(); + return null; + } + } + }); + } + + /** + * Create a Bukkit BlockData from a WorldEdit BlockStateHolder + * + * @param block The WorldEdit BlockStateHolder + * @return The Bukkit BlockData + */ + public static BlockData adapt(BlockStateHolder block) { + checkNotNull(block); + return Bukkit.createBlockData(block.getAsString()); + } + + /** + * Create a WorldEdit BlockState from a Bukkit ItemStack + * + * @param itemStack The Bukkit ItemStack + * @return The WorldEdit BlockState + */ + public static BlockState asBlockState(ItemStack itemStack) { + checkNotNull(itemStack); + if (itemStack.getType().isBlock()) { + return adapt(itemStack.getType().createBlockData()); + } else { + return BlockTypes.AIR.getDefaultState(); + } + } + + /** + * Create a WorldEdit BaseItemStack from a Bukkit ItemStack + * + * @param itemStack The Bukkit ItemStack + * @return The WorldEdit BaseItemStack + */ + public static BaseItemStack adapt(ItemStack itemStack) { + checkNotNull(itemStack); + return new BaseItemStack(ItemTypes.get(itemStack.getType().getKey().toString()), itemStack.getAmount()); + } + + /** + * Create a Bukkit ItemStack from a WorldEdit BaseItemStack + * + * @param item The WorldEdit BaseItemStack + * @return The Bukkit ItemStack + */ + public static ItemStack adapt(BaseItemStack item) { + checkNotNull(item); + return new ItemStack(adapt(item.getType()), item.getAmount()); + } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java index 72e3379fc..cb0fea4de 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java @@ -25,11 +25,12 @@ import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.registry.BiomeRegistry; import org.bukkit.block.Biome; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.Nullable; + /** * A biome registry for Bukkit. */ @@ -48,7 +49,7 @@ class BukkitBiomeRegistry implements BiomeRegistry { public List getBiomes() { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { - List biomes = new ArrayList(); + List biomes = new ArrayList<>(); for (Biome biome : Biome.values()) { int biomeId = adapter.getBiomeId(biome); biomes.add(new BaseBiome(biomeId)); @@ -65,12 +66,7 @@ class BukkitBiomeRegistry implements BiomeRegistry { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { final Biome bukkitBiome = adapter.getBiome(biome.getId()); - return new BiomeData() { - @Override - public String getName() { - return bukkitBiome.name(); - } - }; + return bukkitBiome::name; } else { return null; } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java new file mode 100644 index 000000000..6f272af72 --- /dev/null +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java @@ -0,0 +1,78 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.bukkit; + +import com.sk89q.worldedit.world.registry.BlockMaterial; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.registry.BundledBlockRegistry; +import com.sk89q.worldedit.world.registry.PassthroughBlockMaterial; +import org.bukkit.Material; + +import java.util.EnumMap; +import java.util.Map; + +import javax.annotation.Nullable; + +public class BukkitBlockRegistry extends BundledBlockRegistry { + + private Map materialMap = new EnumMap<>(Material.class); + + @Nullable + @Override + public BlockMaterial getMaterial(BlockType blockType) { + return materialMap.computeIfAbsent(BukkitAdapter.adapt(blockType), + material -> new BukkitBlockMaterial(BukkitBlockRegistry.super.getMaterial(blockType), material)); + } + + @Nullable + @Override + public Map getProperties(BlockType blockType) { + if (WorldEditPlugin.getInstance().getBukkitImplAdapter() != null) { + return WorldEditPlugin.getInstance().getBukkitImplAdapter().getProperties(blockType); + } + return super.getProperties(blockType); + } + + public static class BukkitBlockMaterial extends PassthroughBlockMaterial { + + private final Material material; + + public BukkitBlockMaterial(@Nullable BlockMaterial material, Material bukkitMaterial) { + super(material); + this.material = bukkitMaterial; + } + + @Override + public boolean isSolid() { + return material.isSolid(); + } + + @Override + public boolean isBurnable() { + return material.isBurnable(); + } + + @Override + public boolean isTranslucent() { + return material.isTransparent(); + } + } +} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandInspector.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandInspector.java index 8f4b8e5ae..b392c50ac 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandInspector.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandInspector.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.bukkit; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.bukkit.util.CommandInspector; import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.worldedit.extension.platform.Actor; @@ -30,8 +32,6 @@ import org.bukkit.command.CommandSender; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkNotNull; - class BukkitCommandInspector implements CommandInspector { private static final Logger logger = Logger.getLogger(BukkitCommandInspector.class.getCanonicalName()); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandSender.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandSender.java index df7fdd520..55929af02 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandSender.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitCommandSender.java @@ -19,19 +19,20 @@ package com.sk89q.worldedit.bukkit; -import com.sk89q.worldedit.session.SessionKey; -import com.sk89q.worldedit.util.auth.AuthorizationException; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.cui.CUIEvent; +import com.sk89q.worldedit.session.SessionKey; +import com.sk89q.worldedit.util.auth.AuthorizationException; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import javax.annotation.Nullable; import java.io.File; import java.util.UUID; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; public class BukkitCommandSender implements Actor { diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java index cfc49b01b..418980ad7 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntity.java @@ -19,19 +19,20 @@ package com.sk89q.worldedit.bukkit; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.entity.metadata.EntityType; +import com.sk89q.worldedit.entity.metadata.EntityProperties; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.NullWorld; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * An adapter to adapt a Bukkit entity into a WorldEdit one. @@ -47,7 +48,7 @@ class BukkitEntity implements Entity { */ BukkitEntity(org.bukkit.entity.Entity entity) { checkNotNull(entity); - this.entityRef = new WeakReference(entity); + this.entityRef = new WeakReference<>(entity); } @Override @@ -105,8 +106,8 @@ class BukkitEntity implements Entity { @Override public T getFacet(Class cls) { org.bukkit.entity.Entity entity = entityRef.get(); - if (entity != null && EntityType.class.isAssignableFrom(cls)) { - return (T) new BukkitEntityType(entity); + if (entity != null && EntityProperties.class.isAssignableFrom(cls)) { + return (T) new BukkitEntityProperties(entity); } else { return null; } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntityType.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntityProperties.java similarity index 88% rename from worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntityType.java rename to worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntityProperties.java index 57e57c29b..86618f62f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntityType.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitEntityProperties.java @@ -19,11 +19,14 @@ package com.sk89q.worldedit.bukkit; -import com.sk89q.worldedit.entity.metadata.EntityType; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.entity.metadata.EntityProperties; import com.sk89q.worldedit.util.Enums; import org.bukkit.entity.Ambient; import org.bukkit.entity.Animals; import org.bukkit.entity.Boat; +import org.bukkit.entity.ComplexEntityPart; import org.bukkit.entity.Entity; import org.bukkit.entity.ExperienceOrb; import org.bukkit.entity.FallingBlock; @@ -34,22 +37,21 @@ import org.bukkit.entity.ItemFrame; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Minecart; import org.bukkit.entity.Painting; +import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.Tameable; import org.bukkit.entity.Villager; import org.bukkit.entity.minecart.ExplosiveMinecart; -import static com.google.common.base.Preconditions.checkNotNull; - -class BukkitEntityType implements EntityType { +class BukkitEntityProperties implements EntityProperties { private static final org.bukkit.entity.EntityType armorStandType = Enums.findByValue(org.bukkit.entity.EntityType.class, "ARMOR_STAND"); private final Entity entity; - BukkitEntityType(Entity entity) { + BukkitEntityProperties(Entity entity) { checkNotNull(entity); this.entity = entity; } @@ -136,11 +138,16 @@ class BukkitEntityType implements EntityType { @Override public boolean isTagged() { - return entity instanceof LivingEntity && ((LivingEntity) entity).getCustomName() != null; + return entity instanceof LivingEntity && entity.getCustomName() != null; } @Override public boolean isArmorStand() { return entity.getType() == armorStandType; } + + @Override + public boolean isPasteable() { + return !(entity instanceof Player || entity instanceof ComplexEntityPart); + } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index 25f02915b..7066da770 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -20,32 +20,34 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.util.StringUtil; -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalWorld; -import com.sk89q.worldedit.ServerInterface; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.WorldVector; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.session.SessionKey; +import com.sk89q.worldedit.util.HandSide; +import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.gamemode.GameMode; +import com.sk89q.worldedit.world.gamemode.GameModes; import org.bukkit.Bukkit; -import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import javax.annotation.Nullable; import java.util.UUID; -public class BukkitPlayer extends LocalPlayer { +import javax.annotation.Nullable; + +public class BukkitPlayer extends AbstractPlayerActor { private Player player; private WorldEditPlugin plugin; - public BukkitPlayer(WorldEditPlugin plugin, ServerInterface server, Player player) { + public BukkitPlayer(WorldEditPlugin plugin, Player player) { this.plugin = plugin; this.player = player; } @@ -56,15 +58,19 @@ public class BukkitPlayer extends LocalPlayer { } @Override - public int getItemInHand() { - ItemStack itemStack = player.getItemInHand(); - return itemStack != null ? itemStack.getTypeId() : 0; + public BaseItemStack getItemInHand(HandSide handSide) { + ItemStack itemStack = handSide == HandSide.MAIN_HAND + ? player.getInventory().getItemInMainHand() + : player.getInventory().getItemInOffHand(); + return BukkitAdapter.adapt(itemStack); } @Override - public BaseBlock getBlockInHand() throws WorldEditException { - ItemStack itemStack = player.getItemInHand(); - return BukkitUtil.toBlock(getWorld(), itemStack); + public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException { + ItemStack itemStack = handSide == HandSide.MAIN_HAND + ? player.getInventory().getItemInMainHand() + : player.getInventory().getItemInOffHand(); + return BukkitAdapter.asBlockState(itemStack).toBaseBlock(); } @Override @@ -73,25 +79,8 @@ public class BukkitPlayer extends LocalPlayer { } @Override - public WorldVector getPosition() { - Location loc = player.getLocation(); - return new WorldVector(BukkitUtil.getLocalWorld(loc.getWorld()), - loc.getX(), loc.getY(), loc.getZ()); - } - - @Override - public double getPitch() { - return player.getLocation().getPitch(); - } - - @Override - public double getYaw() { - return player.getLocation().getYaw(); - } - - @Override - public void giveItem(int type, int amt) { - player.getInventory().addItem(new ItemStack(type, amt)); + public void giveItem(BaseItemStack itemStack) { + player.getInventory().addItem(BukkitAdapter.adapt(itemStack)); } @Override @@ -138,6 +127,16 @@ public class BukkitPlayer extends LocalPlayer { return new BukkitPlayerBlockBag(player); } + @Override + public GameMode getGameMode() { + return GameModes.get(player.getGameMode().name().toLowerCase()); + } + + @Override + public void setGameMode(GameMode gameMode) { + player.setGameMode(org.bukkit.GameMode.valueOf(gameMode.getId().toUpperCase())); + } + @Override public boolean hasPermission(String perm) { return (!plugin.getLocalConfiguration().noOpPermissions && player.isOp()) @@ -146,8 +145,8 @@ public class BukkitPlayer extends LocalPlayer { } @Override - public LocalWorld getWorld() { - return BukkitUtil.getLocalWorld(player.getWorld()); + public World getWorld() { + return BukkitAdapter.adapt(player.getWorld()); } @Override @@ -164,11 +163,6 @@ public class BukkitPlayer extends LocalPlayer { return player; } - @Override - public boolean hasCreativeMode() { - return player.getGameMode() == GameMode.CREATIVE; - } - @Override public void floatAt(int x, int y, int z, boolean alwaysGlass) { if (alwaysGlass || !player.getAllowFlight()) { @@ -188,7 +182,7 @@ public class BukkitPlayer extends LocalPlayer { @Override public com.sk89q.worldedit.util.Location getLocation() { Location nativeLocation = player.getLocation(); - Vector position = BukkitUtil.toVector(nativeLocation); + Vector position = BukkitAdapter.asVector(nativeLocation); return new com.sk89q.worldedit.util.Location( getWorld(), position, @@ -235,7 +229,7 @@ public class BukkitPlayer extends LocalPlayer { // CopyOnWrite list for the list of players, but the Bukkit // specification doesn't require thread safety (though the // spec is extremely incomplete) - return Bukkit.getServer().getPlayerExact(name) != null; + return Bukkit.getServer().getPlayer(uuid) != null; } @Override diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java index acacad5e8..7334a48c8 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java @@ -19,14 +19,16 @@ package com.sk89q.worldedit.bukkit; -import com.sk89q.worldedit.WorldVector; +import com.sk89q.worldedit.blocks.BaseItemStack; +import com.sk89q.worldedit.extent.inventory.BlockBag; +import com.sk89q.worldedit.extent.inventory.BlockBagException; +import com.sk89q.worldedit.extent.inventory.OutOfBlocksException; +import com.sk89q.worldedit.extent.inventory.OutOfSpaceException; +import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypes; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import com.sk89q.worldedit.extent.inventory.*; -import com.sk89q.worldedit.blocks.BaseItem; -import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.blocks.BlockID; -import com.sk89q.worldedit.blocks.ItemType; public class BukkitPlayerBlockBag extends BlockBag { @@ -61,14 +63,8 @@ public class BukkitPlayerBlockBag extends BlockBag { } @Override - public void fetchItem(BaseItem item) throws BlockBagException { - final int id = item.getType(); - final int damage = item.getData(); - int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1; - assert(amount == 1); - boolean usesDamageValue = ItemType.usesDamageValue(id); - - if (id == BlockID.AIR) { + public void fetchBlock(BlockState blockState) throws BlockBagException { + if (blockState.getBlockType() == BlockTypes.AIR) { throw new IllegalArgumentException("Can't fetch air block"); } @@ -83,16 +79,11 @@ public class BukkitPlayerBlockBag extends BlockBag { continue; } - if (bukkitItem.getTypeId() != id) { + if (!BukkitAdapter.equals(blockState.getBlockType(), bukkitItem.getType())) { // Type id doesn't fit continue; } - if (usesDamageValue && bukkitItem.getDurability() != damage) { - // Damage value doesn't fit. - continue; - } - int currentAmount = bukkitItem.getAmount(); if (currentAmount < 0) { // Unlimited @@ -116,16 +107,13 @@ public class BukkitPlayerBlockBag extends BlockBag { } @Override - public void storeItem(BaseItem item) throws BlockBagException { - final int id = item.getType(); - final int damage = item.getData(); - int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1; - assert(amount <= 64); - boolean usesDamageValue = ItemType.usesDamageValue(id); - - if (id == BlockID.AIR) { + public void storeBlock(BlockState blockState, int amount) throws BlockBagException { + if (blockState.getBlockType() == BlockTypes.AIR) { throw new IllegalArgumentException("Can't store air block"); } + if (!blockState.getBlockType().hasItemType()) { + throw new IllegalArgumentException("This block cannot be stored"); + } loadInventory(); @@ -144,16 +132,11 @@ public class BukkitPlayerBlockBag extends BlockBag { continue; } - if (bukkitItem.getTypeId() != id) { + if (!BukkitAdapter.equals(blockState.getBlockType(), bukkitItem.getType())) { // Type id doesn't fit continue; } - if (usesDamageValue && bukkitItem.getDurability() != damage) { - // Damage value doesn't fit. - continue; - } - int currentAmount = bukkitItem.getAmount(); if (currentAmount < 0) { // Unlimited @@ -175,11 +158,11 @@ public class BukkitPlayerBlockBag extends BlockBag { } if (freeSlot > -1) { - items[freeSlot] = new ItemStack(id, amount); + items[freeSlot] = BukkitAdapter.adapt(new BaseItemStack(blockState.getBlockType().getItemType(), amount)); return; } - throw new OutOfSpaceException(id); + throw new OutOfSpaceException(blockState.getBlockType()); } @Override @@ -191,11 +174,11 @@ public class BukkitPlayerBlockBag extends BlockBag { } @Override - public void addSourcePosition(WorldVector pos) { + public void addSourcePosition(Location pos) { } @Override - public void addSingleSourcePosition(WorldVector pos) { + public void addSingleSourcePosition(Location pos) { } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorldData.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitRegistries.java similarity index 72% rename from worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorldData.java rename to worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitRegistries.java index 6d747f4aa..6ed0999c7 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorldData.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitRegistries.java @@ -20,20 +20,27 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.worldedit.world.registry.BiomeRegistry; -import com.sk89q.worldedit.world.registry.LegacyWorldData; +import com.sk89q.worldedit.world.registry.BlockRegistry; +import com.sk89q.worldedit.world.registry.BundledRegistries; /** * World data for the Bukkit platform. */ -class BukkitWorldData extends LegacyWorldData { +class BukkitRegistries extends BundledRegistries { - private static final BukkitWorldData INSTANCE = new BukkitWorldData(); + private static final BukkitRegistries INSTANCE = new BukkitRegistries(); + private final BlockRegistry blockRegistry = new BukkitBlockRegistry(); private final BiomeRegistry biomeRegistry = new BukkitBiomeRegistry(); /** * Create a new instance. */ - BukkitWorldData() { + BukkitRegistries() { + } + + @Override + public BlockRegistry getBlockRegistry() { + return blockRegistry; } @Override @@ -46,7 +53,7 @@ class BukkitWorldData extends LegacyWorldData { * * @return an instance */ - public static BukkitWorldData getInstance() { + public static BukkitRegistries getInstance() { return INSTANCE; } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java index 3681aff06..3e8f4bcf9 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java @@ -22,8 +22,6 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.bukkit.util.CommandInfo; import com.sk89q.bukkit.util.CommandRegistration; import com.sk89q.worldedit.LocalConfiguration; -import com.sk89q.worldedit.LocalWorld; -import com.sk89q.worldedit.ServerInterface; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; @@ -32,30 +30,29 @@ import com.sk89q.worldedit.extension.platform.Preference; import com.sk89q.worldedit.util.command.CommandMapping; import com.sk89q.worldedit.util.command.Description; import com.sk89q.worldedit.util.command.Dispatcher; +import com.sk89q.worldedit.world.registry.Registries; import org.bukkit.Bukkit; -import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.World; import org.bukkit.entity.EntityType; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.EnumMap; import java.util.List; import java.util.Map; -public class BukkitServerInterface extends ServerInterface implements MultiUserPlatform { +import javax.annotation.Nullable; + +public class BukkitServerInterface implements MultiUserPlatform { public Server server; public WorldEditPlugin plugin; private CommandRegistration dynamicCommands; - private BukkitBiomeRegistry biomes; private boolean hookingEvents; public BukkitServerInterface(WorldEditPlugin plugin, Server server) { this.plugin = plugin; this.server = server; - this.biomes = new BukkitBiomeRegistry(); dynamicCommands = new CommandRegistration(plugin); } @@ -64,9 +61,8 @@ public class BukkitServerInterface extends ServerInterface implements MultiUserP } @Override - public int resolveItem(String name) { - Material mat = Material.matchMaterial(name); - return mat == null ? 0 : mat.getId(); + public Registries getRegistries() { + return BukkitRegistries.getInstance(); } @Override @@ -86,12 +82,12 @@ public class BukkitServerInterface extends ServerInterface implements MultiUserP } @Override - public List getWorlds() { + public List getWorlds() { List worlds = server.getWorlds(); - List ret = new ArrayList(worlds.size()); + List ret = new ArrayList<>(worlds.size()); for (World world : worlds) { - ret.add(BukkitUtil.getLocalWorld(world)); + ret.add(BukkitAdapter.adapt(world)); } return ret; @@ -104,7 +100,7 @@ public class BukkitServerInterface extends ServerInterface implements MultiUserP return player; } else { org.bukkit.entity.Player bukkitPlayer = server.getPlayerExact(player.getName()); - return bukkitPlayer != null ? new BukkitPlayer(plugin, this, bukkitPlayer) : null; + return bukkitPlayer != null ? new BukkitPlayer(plugin, bukkitPlayer) : null; } } @@ -121,7 +117,7 @@ public class BukkitServerInterface extends ServerInterface implements MultiUserP @Override public void registerCommands(Dispatcher dispatcher) { - List toRegister = new ArrayList(); + List toRegister = new ArrayList<>(); BukkitCommandInspector inspector = new BukkitCommandInspector(plugin, dispatcher); for (CommandMapping command : dispatcher.getCommands()) { @@ -163,7 +159,7 @@ public class BukkitServerInterface extends ServerInterface implements MultiUserP @Override public Map getCapabilities() { - Map capabilities = new EnumMap(Capability.class); + Map capabilities = new EnumMap<>(Capability.class); capabilities.put(Capability.CONFIGURATION, Preference.NORMAL); capabilities.put(Capability.WORLDEDIT_CUI, Preference.NORMAL); capabilities.put(Capability.GAME_HOOKS, Preference.PREFERRED); @@ -179,9 +175,9 @@ public class BukkitServerInterface extends ServerInterface implements MultiUserP @Override public Collection getConnectedUsers() { - List users = new ArrayList(); + List users = new ArrayList<>(); for (org.bukkit.entity.Player player : Bukkit.getServer().getOnlinePlayers()) { - users.add(new BukkitPlayer(plugin, this, player)); + users.add(new BukkitPlayer(plugin, player)); } return users; } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java deleted file mode 100644 index d4cb72a6d..000000000 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit; - -import java.util.List; - -import com.sk89q.worldedit.NotABlockException; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; -import com.sk89q.worldedit.blocks.BlockType; -import com.sk89q.worldedit.blocks.ItemID; -import com.sk89q.worldedit.blocks.SkullBlock; -import org.bukkit.DyeColor; -import org.bukkit.Server; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Entity; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.entity.Item; -import org.bukkit.entity.Painting; -import org.bukkit.entity.Player; - -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.BlockWorldVector; -import com.sk89q.worldedit.LocalWorld; -import com.sk89q.worldedit.Location; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.WorldVector; -import com.sk89q.worldedit.bukkit.entity.BukkitEntity; -import com.sk89q.worldedit.bukkit.entity.BukkitExpOrb; -import com.sk89q.worldedit.bukkit.entity.BukkitItem; -import com.sk89q.worldedit.bukkit.entity.BukkitPainting; -import org.bukkit.inventory.ItemStack; -import org.bukkit.material.Dye; - -public final class BukkitUtil { - - private BukkitUtil() { - } - - public static LocalWorld getLocalWorld(World w) { - return new BukkitWorld(w); - } - - public static BlockVector toVector(Block block) { - return new BlockVector(block.getX(), block.getY(), block.getZ()); - } - - public static BlockVector toVector(BlockFace face) { - return new BlockVector(face.getModX(), face.getModY(), face.getModZ()); - } - - public static BlockWorldVector toWorldVector(Block block) { - return new BlockWorldVector(getLocalWorld(block.getWorld()), block.getX(), block.getY(), block.getZ()); - } - - public static Vector toVector(org.bukkit.Location loc) { - return new Vector(loc.getX(), loc.getY(), loc.getZ()); - } - - public static Location toLocation(org.bukkit.Location loc) { - return new Location( - getLocalWorld(loc.getWorld()), - new Vector(loc.getX(), loc.getY(), loc.getZ()), - loc.getYaw(), loc.getPitch() - ); - } - - public static Vector toVector(org.bukkit.util.Vector vector) { - return new Vector(vector.getX(), vector.getY(), vector.getZ()); - } - - public static org.bukkit.Location toLocation(WorldVector pt) { - return new org.bukkit.Location(toWorld(pt), pt.getX(), pt.getY(), pt.getZ()); - } - - public static org.bukkit.Location toLocation(World world, Vector pt) { - return new org.bukkit.Location(world, pt.getX(), pt.getY(), pt.getZ()); - } - - public static org.bukkit.Location center(org.bukkit.Location loc) { - return new org.bukkit.Location( - loc.getWorld(), - loc.getBlockX() + 0.5, - loc.getBlockY() + 0.5, - loc.getBlockZ() + 0.5, - loc.getPitch(), - loc.getYaw() - ); - } - - public static Player matchSinglePlayer(Server server, String name) { - List players = server.matchPlayer(name); - if (players.isEmpty()) { - return null; - } - return players.get(0); - } - - public static Block toBlock(BlockWorldVector pt) { - return toWorld(pt).getBlockAt(toLocation(pt)); - } - - public static World toWorld(WorldVector pt) { - return ((BukkitWorld) pt.getWorld()).getWorld(); - } - - /** - * Bukkit's Location class has serious problems with floating point - * precision. - */ - @SuppressWarnings("RedundantIfStatement") - public static boolean equals(org.bukkit.Location a, org.bukkit.Location b) { - if (Math.abs(a.getX() - b.getX()) > EQUALS_PRECISION) return false; - if (Math.abs(a.getY() - b.getY()) > EQUALS_PRECISION) return false; - if (Math.abs(a.getZ() - b.getZ()) > EQUALS_PRECISION) return false; - return true; - } - - public static final double EQUALS_PRECISION = 0.0001; - - public static org.bukkit.Location toLocation(Location location) { - Vector pt = location.getPosition(); - return new org.bukkit.Location( - toWorld(location.getWorld()), - pt.getX(), pt.getY(), pt.getZ(), - location.getYaw(), location.getPitch() - ); - } - - public static World toWorld(final LocalWorld world) { - return ((BukkitWorld) world).getWorld(); - } - - public static BukkitEntity toLocalEntity(Entity e) { - switch (e.getType()) { - case EXPERIENCE_ORB: - return new BukkitExpOrb(toLocation(e.getLocation()), e.getUniqueId(), ((ExperienceOrb)e).getExperience()); - case PAINTING: - Painting paint = (Painting) e; - return new BukkitPainting(toLocation(e.getLocation()), paint.getArt(), paint.getFacing(), e.getUniqueId()); - case DROPPED_ITEM: - return new BukkitItem(toLocation(e.getLocation()), ((Item)e).getItemStack(), e.getUniqueId()); - default: - return new BukkitEntity(toLocation(e.getLocation()), e.getType(), e.getUniqueId()); - } - } - - public static BaseBlock toBlock(LocalWorld world, ItemStack itemStack) throws WorldEditException { - final int typeId = itemStack.getTypeId(); - - switch (typeId) { - case ItemID.INK_SACK: - final Dye materialData = (Dye) itemStack.getData(); - if (materialData.getColor() == DyeColor.BROWN) { - return new BaseBlock(BlockID.COCOA_PLANT, -1); - } - break; - - case ItemID.HEAD: - return new SkullBlock(0, (byte) itemStack.getDurability()); - - default: - final BaseBlock baseBlock = BlockType.getBlockForItem(typeId, itemStack.getDurability()); - if (baseBlock != null) { - return baseBlock; - } - break; - } - - if (world.isValidBlockType(typeId)) { - return new BaseBlock(typeId, -1); - } - - throw new NotABlockException(typeId); - } -} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index df7714295..c0d16dddb 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -19,24 +19,27 @@ package com.sk89q.worldedit.bukkit; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.blocks.LazyBlock; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.TreeGenerator; +import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.biome.BaseBiome; -import com.sk89q.worldedit.world.registry.WorldData; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.weather.WeatherType; +import com.sk89q.worldedit.world.weather.WeatherTypes; import org.bukkit.Effect; -import org.bukkit.Material; import org.bukkit.TreeType; import org.bukkit.World; import org.bukkit.block.Biome; @@ -46,9 +49,7 @@ import org.bukkit.block.Chest; import org.bukkit.entity.Entity; import org.bukkit.inventory.DoubleChestInventory; import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.EnumMap; @@ -58,13 +59,13 @@ import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; -public class BukkitWorld extends LocalWorld { +public class BukkitWorld extends AbstractWorld { private static final Logger logger = WorldEdit.logger; - private static final Map effects = new HashMap(); + private static final Map effects = new HashMap<>(); static { for (Effect effect : Effect.values()) { effects.put(effect.getId(), effect); @@ -78,9 +79,8 @@ public class BukkitWorld extends LocalWorld { * * @param world the world */ - @SuppressWarnings("unchecked") public BukkitWorld(World world) { - this.worldRef = new WeakReference(world); + this.worldRef = new WeakReference<>(world); } @Override @@ -88,9 +88,9 @@ public class BukkitWorld extends LocalWorld { World world = getWorld(); List ents = world.getEntities(); - List entities = new ArrayList(); + List entities = new ArrayList<>(); for (Entity ent : ents) { - if (region.contains(BukkitUtil.toVector(ent.getLocation()))) { + if (region.contains(BukkitAdapter.asVector(ent.getLocation()))) { entities.add(BukkitAdapter.adapt(ent)); } } @@ -99,7 +99,7 @@ public class BukkitWorld extends LocalWorld { @Override public List getEntities() { - List list = new ArrayList(); + List list = new ArrayList<>(); for (Entity entity : getWorld().getEntities()) { list.add(BukkitAdapter.adapt(entity)); } @@ -111,10 +111,19 @@ public class BukkitWorld extends LocalWorld { public com.sk89q.worldedit.entity.Entity createEntity(com.sk89q.worldedit.util.Location location, BaseEntity entity) { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { - Entity createdEntity = adapter.createEntity(BukkitAdapter.adapt(getWorld(), location), entity); - if (createdEntity != null) { - return new BukkitEntity(createdEntity); - } else { + try { + Entity createdEntity = adapter.createEntity(BukkitAdapter.adapt(getWorld(), location), entity); + if (createdEntity != null) { + return new BukkitEntity(createdEntity); + } else { + return null; + } + } catch (Exception e) { + logger.warning("Corrupt entity found when creating: " + entity.getType().getId()); + if (entity.getNbtData() != null) { + logger.warning(entity.getNbtData().toString()); + } + e.printStackTrace(); return null; } } else { @@ -156,7 +165,7 @@ public class BukkitWorld extends LocalWorld { @Override public boolean regenerate(Region region, EditSession editSession) { - BaseBlock[] history = new BaseBlock[16 * 16 * (getMaxY() + 1)]; + BlockStateHolder[] history = new BlockStateHolder[16 * 16 * (getMaxY() + 1)]; for (Vector2D chunk : region.getChunks()) { Vector min = new Vector(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16); @@ -167,7 +176,7 @@ public class BukkitWorld extends LocalWorld { for (int z = 0; z < 16; ++z) { Vector pt = min.add(x, y, z); int index = y * 16 * 16 + z * 16 + x; - history[index] = editSession.getBlock(pt); + history[index] = editSession.getFullBlock(pt); } } } @@ -189,8 +198,7 @@ public class BukkitWorld extends LocalWorld { if (!region.contains(pt)) { editSession.smartSetBlock(pt, history[index]); } else { // Otherwise fool with history - editSession.rememberChange(pt, history[index], - editSession.rawGetBlock(pt)); + editSession.getChangeSet().add(new BlockChange(pt.toBlockVector(), history[index], editSession.getFullBlock(pt))); } } } @@ -248,41 +256,11 @@ public class BukkitWorld extends LocalWorld { return true; } - @Override - @Deprecated - public boolean generateTree(EditSession editSession, Vector pt) { - return generateTree(TreeGenerator.TreeType.TREE, editSession, pt); - } - - @Override - @Deprecated - public boolean generateBigTree(EditSession editSession, Vector pt) { - return generateTree(TreeGenerator.TreeType.BIG_TREE, editSession, pt); - } - - @Override - @Deprecated - public boolean generateBirchTree(EditSession editSession, Vector pt) { - return generateTree(TreeGenerator.TreeType.BIRCH, editSession, pt); - } - - @Override - @Deprecated - public boolean generateRedwoodTree(EditSession editSession, Vector pt) { - return generateTree(TreeGenerator.TreeType.REDWOOD, editSession, pt); - } - - @Override - @Deprecated - public boolean generateTallRedwoodTree(EditSession editSession, Vector pt) { - return generateTree(TreeGenerator.TreeType.TALL_REDWOOD, editSession, pt); - } - /** * An EnumMap that stores which WorldEdit TreeTypes apply to which Bukkit TreeTypes */ private static final EnumMap treeTypeMapping = - new EnumMap(TreeGenerator.TreeType.class); + new EnumMap<>(TreeGenerator.TreeType.class); static { for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) { @@ -316,22 +294,14 @@ public class BukkitWorld extends LocalWorld { public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector pt) { World world = getWorld(); TreeType bukkitType = toBukkitTreeType(type); - return type != null && world.generateTree(BukkitUtil.toLocation(world, pt), bukkitType, + return type != null && world.generateTree(BukkitAdapter.adapt(world, pt), bukkitType, new EditSessionBlockChangeDelegate(editSession)); } @Override public void dropItem(Vector pt, BaseItemStack item) { World world = getWorld(); - ItemStack bukkitItem = new ItemStack(item.getType(), item.getAmount(), - item.getData()); - world.dropItemNaturally(BukkitUtil.toLocation(world, pt), bukkitItem); - } - - @SuppressWarnings("deprecation") - @Override - public boolean isValidBlockType(int type) { - return Material.getMaterial(type) != null && Material.getMaterial(type).isBlock(); + world.dropItemNaturally(BukkitAdapter.adapt(world, pt), BukkitAdapter.adapt(item)); } @Override @@ -383,14 +353,54 @@ public class BukkitWorld extends LocalWorld { return false; } - world.playEffect(BukkitUtil.toLocation(world, position), effect, data); + world.playEffect(BukkitAdapter.adapt(world, position), effect, data); return true; } @Override - public WorldData getWorldData() { - return BukkitWorldData.getInstance(); + public WeatherType getWeather() { + if (getWorld().isThundering()) { + return WeatherTypes.THUNDER_STORM; + } else if (getWorld().hasStorm()) { + return WeatherTypes.RAIN; + } + + return WeatherTypes.CLEAR; + } + + @Override + public long getRemainingWeatherDuration() { + return getWorld().getWeatherDuration(); + } + + @Override + public void setWeather(WeatherType weatherType) { + if (weatherType == WeatherTypes.THUNDER_STORM) { + getWorld().setThundering(true); + } else if (weatherType == WeatherTypes.RAIN) { + getWorld().setStorm(true); + } else { + getWorld().setStorm(false); + getWorld().setThundering(false); + } + } + + @Override + public void setWeather(WeatherType weatherType, long duration) { + // Who named these methods... + if (weatherType == WeatherTypes.THUNDER_STORM) { + getWorld().setThundering(true); + getWorld().setThunderDuration((int) duration); + getWorld().setWeatherDuration((int) duration); + } else if (weatherType == WeatherTypes.RAIN) { + getWorld().setStorm(true); + getWorld().setWeatherDuration((int) duration); + } else { + getWorld().setStorm(false); + getWorld().setThundering(false); + getWorld().setWeatherDuration((int) duration); + } } @Override @@ -399,35 +409,44 @@ public class BukkitWorld extends LocalWorld { } @Override - public BaseBlock getBlock(Vector position) { + public com.sk89q.worldedit.world.block.BlockState getBlock(Vector position) { + Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + return BukkitAdapter.adapt(bukkitBlock.getBlockData()); + } + + @Override + public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { + BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); + if (adapter != null) { + try { + return adapter.setBlock(BukkitAdapter.adapt(getWorld(), position), block, notifyAndLight); + } catch (Exception e) { + if (block instanceof BaseBlock && ((BaseBlock) block).getNbtData() != null) { + logger.warning("Tried to set a corrupt tile entity at " + position.toString()); + logger.warning(((BaseBlock) block).getNbtData().toString()); + } + e.printStackTrace(); + Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + bukkitBlock.setBlockData(BukkitAdapter.adapt(block), notifyAndLight); + return true; + } + } else { + Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + bukkitBlock.setBlockData(BukkitAdapter.adapt(block), notifyAndLight); + return true; + } + } + + @Override + public BaseBlock getFullBlock(Vector position) { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { return adapter.getBlock(BukkitAdapter.adapt(getWorld(), position)); } else { - Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - return new BaseBlock(bukkitBlock.getTypeId(), bukkitBlock.getData()); + return getBlock(position).toBaseBlock(); } } - @Override - public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - if (adapter != null) { - return adapter.setBlock(BukkitAdapter.adapt(getWorld(), position), block, notifyAndLight); - } else { - Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - return bukkitBlock.setTypeIdAndData(block.getType(), (byte) block.getData(), notifyAndLight); - } - } - - @SuppressWarnings("deprecation") - @Override - public BaseBlock getLazyBlock(Vector position) { - World world = getWorld(); - Block bukkitBlock = world.getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - return new LazyBlock(bukkitBlock.getTypeId(), bukkitBlock.getData(), this, position); - } - @Override public BaseBiome getBiome(Vector2D position) { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); @@ -450,12 +469,4 @@ public class BukkitWorld extends LocalWorld { return false; } } - - /** - * @deprecated Use {@link #setBlock(Vector, BaseBlock, boolean)} - */ - @Deprecated - public boolean setBlock(Vector pt, com.sk89q.worldedit.foundation.Block block, boolean notifyAdjacent) throws WorldEditException { - return setBlock(pt, (BaseBlock) block, notifyAdjacent); - } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java index c3d1b2059..24e14d964 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.bukkit; -import com.sk89q.worldedit.blocks.BlockID; -import org.bukkit.BlockChangeDelegate; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.world.block.BlockTypes; +import org.bukkit.BlockChangeDelegate; +import org.bukkit.block.data.BlockData; /** * Proxy class to catch calls to set blocks. @@ -38,36 +38,18 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate { } @Override - public boolean setRawTypeId(int x, int y, int z, int typeId) { + public boolean setBlockData(int x, int y, int z, BlockData blockData) { try { - return editSession.setBlock(new Vector(x, y, z), new BaseBlock(typeId)); - } catch (MaxChangedBlocksException ex) { + editSession.setBlock(new Vector(x, y, z), BukkitAdapter.adapt(blockData)); + } catch (MaxChangedBlocksException e) { return false; } + return true; } @Override - public boolean setRawTypeIdAndData(int x, int y, int z, int typeId, int data) { - try { - return editSession.setBlock(new Vector(x, y, z), new BaseBlock(typeId, data)); - } catch (MaxChangedBlocksException ex) { - return false; - } - } - - @Override - public boolean setTypeId(int x, int y, int z, int typeId) { - return setRawTypeId(x, y, z, typeId); - } - - @Override - public boolean setTypeIdAndData(int x, int y, int z, int typeId, int data) { - return setRawTypeIdAndData(x, y, z, typeId, data); - } - - @Override - public int getTypeId(int x, int y, int z) { - return editSession.getBlockType(new Vector(x, y, z)); + public BlockData getBlockData(int x, int y, int z) { + return BukkitAdapter.adapt(editSession.getBlock(new Vector(x, y, z))); } @Override @@ -77,7 +59,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate { @Override public boolean isEmpty(int x, int y, int z) { - return editSession.getBlockType(new Vector(x, y, z)) == BlockID.AIR; + return editSession.getBlock(new Vector(x, y, z)).getBlockType() == BlockTypes.AIR; } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java index bd9a92b09..44dd56b44 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java @@ -22,10 +22,9 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.util.StringUtil; -import com.sk89q.worldedit.LocalPlayer; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.WorldVector; -import com.sk89q.worldedit.internal.LocalWorldAdapter; +import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; import org.bukkit.block.Block; import org.bukkit.event.Event.Result; @@ -67,7 +66,7 @@ public class WorldEditListener implements Listener { } // this will automatically refresh their session, we don't have to do anything - WorldEdit.getInstance().getSession(plugin.wrapPlayer(event.getPlayer())); + WorldEdit.getInstance().getSessionManager().get(plugin.wrapPlayer(event.getPlayer())); } /** @@ -120,18 +119,17 @@ public class WorldEditListener implements Listener { return; // TODO api needs to be able to get either hand depending on event // for now just ignore all off hand interacts } - } catch (NoSuchMethodError ignored) { - } catch (NoSuchFieldError ignored) { + } catch (NoSuchMethodError | NoSuchFieldError ignored) { } - final LocalPlayer player = plugin.wrapPlayer(event.getPlayer()); + final Player player = plugin.wrapPlayer(event.getPlayer()); final World world = player.getWorld(); final WorldEdit we = plugin.getWorldEdit(); Action action = event.getAction(); if (action == Action.LEFT_CLICK_BLOCK) { final Block clickedBlock = event.getClickedBlock(); - final WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ()); + final Location pos = new Location(world, clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ()); if (we.handleBlockLeftClick(player, pos)) { event.setCancelled(true); @@ -150,8 +148,7 @@ public class WorldEditListener implements Listener { } else if (action == Action.RIGHT_CLICK_BLOCK) { final Block clickedBlock = event.getClickedBlock(); - final WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), clickedBlock.getX(), - clickedBlock.getY(), clickedBlock.getZ()); + final Location pos = new Location(world, clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ()); if (we.handleBlockRightClick(player, pos)) { event.setCancelled(true); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 4ffde3d85..057742b92 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -19,23 +19,17 @@ package com.sk89q.worldedit.bukkit; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.base.Joiner; import com.sk89q.util.yaml.YAMLProcessor; import com.sk89q.wepif.PermissionsResolverManager; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.IncompleteRegionException; -import com.sk89q.worldedit.LocalPlayer; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.ServerInterface; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.WorldEditOperation; import com.sk89q.worldedit.bukkit.adapter.AdapterLoadException; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader; -import com.sk89q.worldedit.bukkit.selections.CuboidSelection; -import com.sk89q.worldedit.bukkit.selections.CylinderSelection; -import com.sk89q.worldedit.bukkit.selections.Polygonal2DSelection; -import com.sk89q.worldedit.bukkit.selections.Selection; import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.event.platform.CommandSuggestionEvent; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; @@ -43,21 +37,12 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extent.inventory.BlockBag; -import com.sk89q.worldedit.regions.CuboidRegion; -import com.sk89q.worldedit.regions.CylinderRegion; -import com.sk89q.worldedit.regions.Polygonal2DRegion; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.regions.RegionSelector; -import com.sk89q.worldedit.util.Java8Detector; - -import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; -import javax.annotation.Nullable; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; @@ -69,21 +54,19 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.zip.ZipEntry; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Plugin for Bukkit. */ -@SuppressWarnings("deprecation") public class WorldEditPlugin extends JavaPlugin implements TabCompleter { private static final Logger log = Logger.getLogger(WorldEditPlugin.class.getCanonicalName()); - public static final String CUI_PLUGIN_CHANNEL = "WECUI"; + public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui"; private static WorldEditPlugin INSTANCE; private BukkitImplAdapter bukkitAdapter; private BukkitServerInterface server; - private final WorldEditAPI api = new WorldEditAPI(this); private BukkitConfiguration config; /** @@ -99,12 +82,15 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { WorldEdit worldEdit = WorldEdit.getInstance(); - loadConfig(); // Load configuration - PermissionsResolverManager.initialize(this); // Setup permission resolver + loadAdapter(); // Need an adapter to work with special blocks with NBT data // Setup platform server = new BukkitServerInterface(this, getServer()); worldEdit.getPlatformManager().register(server); + worldEdit.loadMappings(); + + loadConfig(); // Load configuration + PermissionsResolverManager.initialize(this); // Setup permission resolver // Register CUI getServer().getMessenger().registerIncomingPluginChannel(this, CUI_PLUGIN_CHANNEL, new CUIChannelListener(this)); @@ -117,11 +103,6 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { // Forge WorldEdit and there's (probably) not going to be any other // platforms to be worried about... at the current time of writing WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent()); - - loadAdapter(); // Need an adapter to work with special blocks with NBT data - - // Check Java version - Java8Detector.notifyIfNot8(); } private void loadConfig() { @@ -169,7 +150,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { @Override public void onDisable() { WorldEdit worldEdit = WorldEdit.getInstance(); - worldEdit.clearSessions(); + worldEdit.getSessionManager().clear(); worldEdit.getPlatformManager().unregister(server); if (config != null) { config.unload(); @@ -269,7 +250,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { * @return a session */ public LocalSession getSession(Player player) { - return WorldEdit.getInstance().getSession(wrapPlayer(player)); + return WorldEdit.getInstance().getSessionManager().get(wrapPlayer(player)); } /** @@ -279,8 +260,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { * @return a session */ public EditSession createEditSession(Player player) { - LocalPlayer wePlayer = wrapPlayer(player); - LocalSession session = WorldEdit.getInstance().getSession(wePlayer); + com.sk89q.worldedit.entity.Player wePlayer = wrapPlayer(player); + LocalSession session = WorldEdit.getInstance().getSessionManager().get(wePlayer); BlockBag blockBag = session.getBlockBag(wePlayer); EditSession editSession = WorldEdit.getInstance().getEditSessionFactory() @@ -297,8 +278,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { * @param editSession an edit session */ public void remember(Player player, EditSession editSession) { - LocalPlayer wePlayer = wrapPlayer(player); - LocalSession session = WorldEdit.getInstance().getSession(wePlayer); + com.sk89q.worldedit.entity.Player wePlayer = wrapPlayer(player); + LocalSession session = WorldEdit.getInstance().getSessionManager().get(wePlayer); session.remember(editSession); editSession.flushQueue(); @@ -306,38 +287,6 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { WorldEdit.getInstance().flushBlockBag(wePlayer, editSession); } - /** - * Wrap an operation into an EditSession. - * - * @param player a player - * @param op the operation - * @throws Throwable on any error - * @deprecated use the regular API - */ - @Deprecated - public void perform(Player player, WorldEditOperation op) throws Throwable { - LocalPlayer wePlayer = wrapPlayer(player); - LocalSession session = WorldEdit.getInstance().getSession(wePlayer); - - EditSession editSession = createEditSession(player); - try { - op.run(session, wePlayer, editSession); - } finally { - remember(player, editSession); - } - } - - /** - * Get the API. - * - * @return the API - * @deprecated use the regular API - */ - @Deprecated - public WorldEditAPI getAPI() { - return api; - } - /** * Returns the configuration used by WorldEdit. * @@ -357,13 +306,13 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { } /** - * Used to wrap a Bukkit Player as a LocalPlayer. + * Used to wrap a Bukkit Player as a WorldEdit Player. * * @param player a player * @return a wrapped player */ public BukkitPlayer wrapPlayer(Player player) { - return new BukkitPlayer(this, this.server, player); + return new BukkitPlayer(this, player); } public Actor wrapCommandSender(CommandSender sender) { @@ -374,15 +323,6 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { return new BukkitCommandSender(this, sender); } - /** - * Get the server interface. - * - * @return the server interface - */ - public ServerInterface getServerInterface() { - return server; - } - BukkitServerInterface getInternalPlatform() { return server; } @@ -396,64 +336,6 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { return WorldEdit.getInstance(); } - /** - * Gets the region selection for the player. - * - * @param player aplayer - * @return the selection or null if there was none - */ - public Selection getSelection(Player player) { - if (player == null) { - throw new IllegalArgumentException("Null player not allowed"); - } - if (!player.isOnline()) { - throw new IllegalArgumentException("Offline player not allowed"); - } - - LocalSession session = WorldEdit.getInstance().getSession(wrapPlayer(player)); - RegionSelector selector = session.getRegionSelector(BukkitUtil.getLocalWorld(player.getWorld())); - - try { - Region region = selector.getRegion(); - World world = BukkitAdapter.asBukkitWorld(session.getSelectionWorld()).getWorld(); - - if (region instanceof CuboidRegion) { - return new CuboidSelection(world, selector, (CuboidRegion) region); - } else if (region instanceof Polygonal2DRegion) { - return new Polygonal2DSelection(world, selector, (Polygonal2DRegion) region); - } else if (region instanceof CylinderRegion) { - return new CylinderSelection(world, selector, (CylinderRegion) region); - } else { - return null; - } - } catch (IncompleteRegionException e) { - return null; - } - } - - /** - * Sets the region selection for a player. - * - * @param player the player - * @param selection a selection - */ - public void setSelection(Player player, Selection selection) { - if (player == null) { - throw new IllegalArgumentException("Null player not allowed"); - } - if (!player.isOnline()) { - throw new IllegalArgumentException("Offline player not allowed"); - } - if (selection == null) { - throw new IllegalArgumentException("Null selection not allowed"); - } - - LocalSession session = WorldEdit.getInstance().getSession(wrapPlayer(player)); - RegionSelector sel = selection.getRegionSelector(); - session.setRegionSelector(BukkitUtil.getLocalWorld(player.getWorld()), sel); - session.dispatchCUISelection(wrapPlayer(player)); - } - /** * Gets the instance of this plugin. * diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index 04113a6d5..4a30a11c0 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -19,13 +19,17 @@ package com.sk89q.worldedit.bukkit.adapter; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; import org.bukkit.Location; -import org.bukkit.Material; import org.bukkit.block.Biome; import org.bukkit.entity.Entity; +import java.util.Map; + import javax.annotation.Nullable; /** @@ -33,26 +37,6 @@ import javax.annotation.Nullable; */ public interface BukkitImplAdapter { - /** - * Get the block ID for the given material. - * - *

Returns 0 if it is not known or it doesn't exist.

- * - * @param material the material - * @return the block ID - */ - int getBlockId(Material material); - - /** - * Get the material for the given block ID. - * - *

Returns {@link Material#AIR} if it is not known or it doesn't exist.

- * - * @param id the block ID - * @return the material - */ - Material getMaterial(int id); - /** * Get the biome ID for the given biome. * @@ -89,7 +73,7 @@ public interface BukkitImplAdapter { * @param notifyAndLight notify and light if set * @return true if a block was likely changed */ - boolean setBlock(Location location, BaseBlock state, boolean notifyAndLight); + boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight); /** * Get the state for the given entity. @@ -110,5 +94,11 @@ public interface BukkitImplAdapter { @Nullable Entity createEntity(Location location, BaseEntity state); - + /** + * Get a map of string -> properties + * + * @param blockType The block type + * @return The properties map + */ + Map getProperties(BlockType blockType); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java index 1bb953421..40a94baf1 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java @@ -38,7 +38,7 @@ import java.util.logging.Logger; public class BukkitImplLoader { private static final Logger log = Logger.getLogger(BukkitImplLoader.class.getCanonicalName()); - private final List adapterCandidates = new ArrayList(); + private final List adapterCandidates = new ArrayList<>(); private String customCandidate; private static final String SEARCH_PACKAGE = "com.sk89q.worldedit.bukkit.adapter.impl"; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitExpOrb.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitExpOrb.java deleted file mode 100644 index 1b57f8143..000000000 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitExpOrb.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.entity; - -import com.sk89q.worldedit.Location; -import com.sk89q.worldedit.bukkit.BukkitUtil; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.ExperienceOrb; - -import java.util.UUID; - -public class BukkitExpOrb extends BukkitEntity { - - private final int amount; - - public BukkitExpOrb(Location loc, UUID entityId, int amount) { - super(loc, EntityType.EXPERIENCE_ORB, entityId); - this.amount = amount; - } - - @Override - public boolean spawn(Location weLoc) { - org.bukkit.Location loc = BukkitUtil.toLocation(weLoc); - ExperienceOrb orb = loc.getWorld().spawn(loc, ExperienceOrb.class); - if (orb != null) { - orb.setExperience(amount); - return true; - } - return false; - } - -} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitPainting.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitPainting.java deleted file mode 100644 index 57f7eb4f5..000000000 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitPainting.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.entity; - -import com.sk89q.worldedit.Location; -import com.sk89q.worldedit.bukkit.BukkitUtil; -import org.bukkit.Art; -import org.bukkit.Bukkit; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Painting; - -import java.util.ArrayDeque; -import java.util.Deque; -import java.util.UUID; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class BukkitPainting extends BukkitEntity { - - private static final Logger log = Logger.getLogger(BukkitPainting.class.getCanonicalName()); - - private static int spawnTask = -1; - private static final Deque spawnQueue = new ArrayDeque(); - - private class QueuedPaintingSpawn { - private final Location weLoc; - - private QueuedPaintingSpawn(Location weLoc) { - this.weLoc = weLoc; - } - - public void spawn() { - spawnRaw(weLoc); - } - } - - private static class PaintingSpawnRunnable implements Runnable { - @Override - public void run() { - synchronized (spawnQueue) { - QueuedPaintingSpawn spawn; - while ((spawn = spawnQueue.poll()) != null) { - try { - spawn.spawn(); - } catch (Throwable t) { - log.log(Level.WARNING, "Failed to spawn painting", t); - continue; - } - } - spawnTask = -1; - } - } - } - - private final Art art; - private final BlockFace facingDirection; - public BukkitPainting(Location loc, Art art, BlockFace facingDirection, UUID entityId) { - super(loc, EntityType.PAINTING, entityId); - this.art = art; - this.facingDirection = facingDirection; - } - - /** - * Queue the painting to be spawned at the specified location. - * This operation is delayed so that the block changes that may be applied can be applied before the painting spawn is attempted. - * - * @param weLoc The WorldEdit location - * @return Whether the spawn as successful - */ - @Override - public boolean spawn(Location weLoc) { - synchronized (spawnQueue) { - spawnQueue.add(new QueuedPaintingSpawn(weLoc)); - if (spawnTask == -1) { - spawnTask = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"), new PaintingSpawnRunnable(), 1L); - } - } - return true; - } - - public boolean spawnRaw(Location weLoc) { - org.bukkit.Location loc = BukkitUtil.toLocation(weLoc); - Painting paint = loc.getWorld().spawn(loc, Painting.class); - if (paint != null) { - paint.setFacingDirection(facingDirection, true); - paint.setArt(art, true); - return true; - } - return false; - } - -} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/CuboidSelection.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/CuboidSelection.java deleted file mode 100644 index 5ecd74956..000000000 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/CuboidSelection.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.selections; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.bukkit.BukkitUtil; -import com.sk89q.worldedit.regions.CuboidRegion; -import com.sk89q.worldedit.regions.RegionSelector; -import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; -import com.sk89q.worldedit.regions.selector.limit.PermissiveSelectorLimits; -import org.bukkit.Location; -import org.bukkit.World; - -public class CuboidSelection extends RegionSelection { - - protected CuboidRegion cuboid; - - public CuboidSelection(World world, Location pt1, Location pt2) { - this(world, BukkitUtil.toVector(pt1), BukkitUtil.toVector(pt2)); - } - - public CuboidSelection(World world, Vector pt1, Vector pt2) { - super(world); - - // Validate input - if (pt1 == null) { - throw new IllegalArgumentException("Null point 1 not permitted"); - } - - if (pt2 == null) { - throw new IllegalArgumentException("Null point 2 not permitted"); - } - - // Create new selector - CuboidRegionSelector sel = new CuboidRegionSelector(BukkitUtil.getLocalWorld(world)); - - // set up selector - sel.selectPrimary(pt1, PermissiveSelectorLimits.getInstance()); - sel.selectSecondary(pt2, PermissiveSelectorLimits.getInstance()); - - // set up CuboidSelection - cuboid = sel.getIncompleteRegion(); - - // set up RegionSelection - setRegionSelector(sel); - setRegion(cuboid); - } - - public CuboidSelection(World world, RegionSelector sel, CuboidRegion region) { - super(world, sel, region); - this.cuboid = region; - } -} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/CylinderSelection.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/CylinderSelection.java deleted file mode 100644 index c7dee7c79..000000000 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/CylinderSelection.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.selections; - -import com.sk89q.worldedit.regions.selector.CylinderRegionSelector; -import org.bukkit.World; - -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.LocalWorld; -import com.sk89q.worldedit.bukkit.BukkitUtil; -import com.sk89q.worldedit.regions.CylinderRegion; -import com.sk89q.worldedit.regions.RegionSelector; - -/** - * A selection representing a {@link CylinderRegion} - */ -public class CylinderSelection extends RegionSelection { - - private CylinderRegion cylRegion; - - public CylinderSelection(World world, RegionSelector selector, CylinderRegion region) { - super(world, selector, region); - this.cylRegion = region; - } - - public CylinderSelection(World world, BlockVector2D center, BlockVector2D radius, int minY, int maxY) { - super(world); - LocalWorld lWorld = BukkitUtil.getLocalWorld(world); - - // Validate input - minY = Math.min(Math.max(0, minY), world.getMaxHeight()); - maxY = Math.min(Math.max(0, maxY), world.getMaxHeight()); - - // Create and set up new selector - CylinderRegionSelector sel = new CylinderRegionSelector(lWorld, center, radius, minY, maxY); - - // set up selection - cylRegion = sel.getIncompleteRegion(); - - // set up RegionSelection - setRegionSelector(sel); - setRegion(cylRegion); - } - - /** - * Returns the center vector of the cylinder - * - * @return the center - */ - public BlockVector2D getCenter() { - return cylRegion.getCenter().toVector2D().toBlockVector2D(); - } - - /** - * Returns the radius vector of the cylinder - * - * @return the radius - */ - public BlockVector2D getRadius() { - return cylRegion.getRadius().toBlockVector2D(); - } - -} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/Polygonal2DSelection.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/Polygonal2DSelection.java deleted file mode 100644 index 387bcf6de..000000000 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/Polygonal2DSelection.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.selections; - -import java.util.Collections; -import java.util.List; - -import com.sk89q.worldedit.LocalWorld; -import com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector; -import org.bukkit.World; -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.bukkit.BukkitUtil; -import com.sk89q.worldedit.regions.*; - -public class Polygonal2DSelection extends RegionSelection { - - protected Polygonal2DRegion poly2d; - - public Polygonal2DSelection(World world, RegionSelector sel, Polygonal2DRegion region) { - super(world, sel, region); - this.poly2d = region; - } - - public Polygonal2DSelection(World world, List points, int minY, int maxY) { - super(world); - LocalWorld lWorld = BukkitUtil.getLocalWorld(world); - - // Validate input - minY = Math.min(Math.max(0, minY), world.getMaxHeight()); - maxY = Math.min(Math.max(0, maxY), world.getMaxHeight()); - - // Create and set up new selector - Polygonal2DRegionSelector sel = new Polygonal2DRegionSelector(lWorld, points, minY, maxY); - - // set up CuboidSelection - poly2d = sel.getIncompleteRegion(); - - // set up RegionSelection - setRegionSelector(sel); - setRegion(poly2d); - } - - public List getNativePoints() { - return Collections.unmodifiableList(poly2d.getPoints()); - } -} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/RegionSelection.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/RegionSelection.java deleted file mode 100644 index db705a8be..000000000 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/RegionSelection.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.selections; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.regions.RegionSelector; -import org.bukkit.Location; -import org.bukkit.World; - -import static com.sk89q.worldedit.bukkit.BukkitUtil.toLocation; -import static com.sk89q.worldedit.bukkit.BukkitUtil.toVector; - -public abstract class RegionSelection implements Selection { - - private World world; - private RegionSelector selector; - private Region region; - - public RegionSelection(World world) { - this.world = world; - } - - public RegionSelection(World world, RegionSelector selector, Region region) { - this.world = world; - this.region = region; - this.selector = selector; - } - - protected Region getRegion() { - return region; - } - - protected void setRegion(Region region) { - this.region = region; - } - - @Override - public RegionSelector getRegionSelector() { - return selector; - } - - protected void setRegionSelector(RegionSelector selector) { - this.selector = selector; - } - - @Override - public Location getMinimumPoint() { - return toLocation(world, region.getMinimumPoint()); - } - - @Override - public Vector getNativeMinimumPoint() { - return region.getMinimumPoint(); - } - - @Override - public Location getMaximumPoint() { - return toLocation(world, region.getMaximumPoint()); - } - - @Override - public Vector getNativeMaximumPoint() { - return region.getMaximumPoint(); - } - - @Override - public World getWorld() { - return world; - } - - @Override - public int getArea() { - return region.getArea(); - } - - @Override - public int getWidth() { - return region.getWidth(); - } - - @Override - public int getHeight() { - return region.getHeight(); - } - - @Override - public int getLength() { - return region.getLength(); - } - - @Override - public boolean contains(Location position) { - if (!position.getWorld().equals(world)) { - return false; - } - - return region.contains(toVector(position)); - } - -} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/Selection.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/Selection.java deleted file mode 100644 index c3788affc..000000000 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/selections/Selection.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.selections; - -import org.bukkit.Location; -import org.bukkit.World; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.regions.RegionSelector; - -import javax.annotation.Nullable; - -/** - * An abstraction of WorldEdit regions, which do not use Bukkit objects. - */ -public interface Selection { - - /** - * Get the lower point of a region. - * - * @return min. point - */ - public Location getMinimumPoint(); - - /** - * Get the lower point of a region. - * - * @return min. point - */ - public Vector getNativeMinimumPoint(); - - /** - * Get the upper point of a region. - * - * @return max. point - */ - public Location getMaximumPoint(); - - /** - * Get the upper point of a region. - * - * @return max. point - */ - public Vector getNativeMaximumPoint(); - - /** - * Get the region selector. This is for internal use. - * - * @return the region selector - */ - public RegionSelector getRegionSelector(); - - /** - * Get the world. - * - * @return the world, which may be null - */ - @Nullable - public World getWorld(); - - /** - * Get the number of blocks in the region. - * - * @return number of blocks - */ - public int getArea(); - - /** - * Get X-size. - * - * @return width - */ - public int getWidth(); - - /** - * Get Y-size. - * - * @return height - */ - public int getHeight(); - - /** - * Get Z-size. - * - * @return length - */ - public int getLength(); - - /** - * Returns true based on whether the region contains the point, - * - * @param position a vector - * @return true if it is contained - */ - public boolean contains(Location position); - -} diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_6_R3.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_6_R3.class deleted file mode 100644 index 4f3c4dab7..000000000 Binary files a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_6_R3.class and /dev/null differ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_7_R2.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_7_R2.class deleted file mode 100644 index c61abe627..000000000 Binary files a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_7_R2.class and /dev/null differ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_7_R3.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_7_R3.class deleted file mode 100644 index c08893d3b..000000000 Binary files a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_7_R3.class and /dev/null differ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_7_R4.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_7_R4.class deleted file mode 100644 index cecbd02ca..000000000 Binary files a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/CraftBukkit_v1_7_R4.class and /dev/null differ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_10_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_10_R1.class deleted file mode 100644 index fad3f0bd1..000000000 Binary files a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_10_R1.class and /dev/null differ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_11_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_11_R1.class deleted file mode 100644 index c8b7a3fc6..000000000 Binary files a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_11_R1.class and /dev/null differ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class new file mode 100644 index 000000000..9655a35a6 Binary files /dev/null and b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class differ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_8_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_8_R1.class deleted file mode 100644 index 22d0efe35..000000000 Binary files a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_8_R1.class and /dev/null differ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_8_R2.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_8_R2.class deleted file mode 100644 index 4364089e0..000000000 Binary files a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_8_R2.class and /dev/null differ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_8_R3.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_8_R3.class deleted file mode 100644 index ad8fa4d66..000000000 Binary files a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_8_R3.class and /dev/null differ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_9_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_9_R1.class deleted file mode 100644 index 77edca329..000000000 Binary files a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_9_R1.class and /dev/null differ diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_9_R2.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_9_R2.class deleted file mode 100644 index 198451706..000000000 Binary files a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_9_R2.class and /dev/null differ diff --git a/worldedit-bukkit/src/main/resources/defaults/config.yml b/worldedit-bukkit/src/main/resources/defaults/config.yml index 2ad742afb..fd931081f 100644 --- a/worldedit-bukkit/src/main/resources/defaults/config.yml +++ b/worldedit-bukkit/src/main/resources/defaults/config.yml @@ -1,18 +1,19 @@ # -# WorldEdit's configuration file +# WorldEdit's Configuration File # # About editing this file: -# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If -# you use an editor like Notepad++ (recommended for Windows users), you -# must configure it to "replace tabs with spaces." In Notepad++, this can -# be changed in Settings > Preferences > Language Menu. -# - Don't get rid of the indents. They are indented so some entries are -# in categories (like "max-blocks-changed" is in the "limits" +# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain and post +# errors. If you use an editor, like Notepad++ (recommended for Windows +# users), you must configure it to "replace tabs with spaces." +# This can be changed in Settings > Preferences > Language Menu. +# - Don't get rid of indentations. They are indented so some entries that are +# in categories, like "max-blocks-changed", are placed in the "limits" # category. # - If you want to check the format of this file before putting it # into WorldEdit, paste it into http://yaml-online-parser.appspot.com/ -# and see if it gives "ERROR:". -# - Lines starting with # are commentsand so they are ignored. +# and see if it gives you "ERROR:". +# - Lines starting with # are comments, so they are ignored. +# - If you want to allow blocks, make sure to change "disallowed-blocks" to [] # limits: @@ -29,7 +30,67 @@ limits: butcher-radius: default: -1 maximum: -1 - disallowed-blocks: [6, 7, 14, 15, 16, 26, 27, 28, 29, 39, 31, 32, 33, 34, 36, 37, 38, 39, 40, 46, 50, 51, 56, 59, 69, 73, 74, 75, 76, 77, 81, 83] + disallowed-blocks: + - "minecraft:oak_sapling" + - "minecraft:jungle_sapling" + - "minecraft:dark_oak_sapling:" + - "minecraft:spruce_sapling" + - "minecraft:birch_sapling" + - "minecraft:acacia_sapling" + - "minecraft:black_bed" + - "minecraft:blue_bed" + - "minecraft:brown_bed" + - "minecraft:cyan_bed" + - "minecraft:gray_bed" + - "minecraft:green_bed" + - "minecraft:light_blue_bed" + - "minecraft:light_gray_bed" + - "minecraft:lime_bed" + - "minecraft:magenta_bed" + - "minecraft:orange_bed" + - "minecraft:pink_bed" + - "minecraft:purple_bed" + - "minecraft:red_bed" + - "minecraft:white_bed" + - "minecraft:yellow_bed" + - "minecraft:powered_rail" + - "minecraft:detector_rail" + - "minecraft:grass" + - "minecraft:dead_bush" + - "minecraft:moving_piston" + - "minecraft:piston_head" + - "minecraft:sunflower" + - "minecraft:rose_bush" + - "minecraft:dandelion" + - "minecraft:poppy" + - "minecraft:brown_mushroom" + - "minecraft:red_mushroom" + - "minecraft:tnt" + - "minecraft:torch" + - "minecraft:fire" + - "minecraft:redstone_wire" + - "minecraft:wheat" + - "minecraft:potatoes" + - "minecraft:carrots" + - "minecraft:melon_stem" + - "minecraft:pumpkin_stem" + - "minecraft:beetroots" + - "minecraft:rail" + - "minecraft:lever" + - "minecraft:redstone_torch" + - "minecraft:redstone_wall_torch" + - "minecraft:repeater" + - "minecraft:comparator" + - "minecraft:stone_button" + - "minecraft:birch_button" + - "minecraft:acacia_button" + - "minecraft:dark_oak_button" + - "minecraft:jungle_button" + - "minecraft:oak_button" + - "minecraft:spruce_button" + - "minecraft:cactus" + - "minecraft:sugar_cane" + - "minecraft:bedrock" use-inventory: enable: false @@ -39,6 +100,17 @@ use-inventory: logging: log-commands: false file: worldedit.log + # The format of custom log message. This is java general format string (java.util.Formatter). Arguments are: + # 1$ : date - a Date object representing event time of the log record. + # 2$ : source - a string representing the caller, if available; otherwise, the logger's name. + # 3$ : logger - the logger's name. + # 4$ : level - the log level. + # 5$ : message - the formatted log message returned from the Formatter.formatMessage(LogRecord) method. It uses java.text formatting and does not use the java.util.Formatter format argument. + # 6$ : thrown - a string representing the throwable associated with the log record and its backtrace beginning with a newline character, if any; otherwise, an empty string. + # For details see: + # https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html + # https://docs.oracle.com/javase/8/docs/api/java/util/logging/SimpleFormatter.html#format-java.util.logging.LogRecord- + format: "[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s]: %5$s%6$s%n" super-pickaxe: drop-items: true @@ -48,7 +120,7 @@ snapshots: directory: navigation-wand: - item: 345 + item: minecraft:compass max-distance: 100 scripting: @@ -65,7 +137,7 @@ history: size: 15 expiration: 10 -wand-item: 271 +wand-item: minecraft:wooden_axe shell-save-type: no-double-slash: false no-op-permissions: false diff --git a/worldedit-bukkit/src/main/resources/plugin.yml b/worldedit-bukkit/src/main/resources/plugin.yml index d071c6f04..9afc2c5a5 100644 --- a/worldedit-bukkit/src/main/resources/plugin.yml +++ b/worldedit-bukkit/src/main/resources/plugin.yml @@ -2,6 +2,7 @@ name: WorldEdit main: com.sk89q.worldedit.bukkit.WorldEditPlugin version: "${internalVersion}" softdepend: [Spout] #hack to fix trove errors +api-version: 1.13 # Permissions aren't here. Read http://wiki.sk89q.com/wiki/WEPIF/DinnerPerms # for how WorldEdit permissions actually work. diff --git a/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java b/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java index 8e80a57bc..e207e7b8d 100644 --- a/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java +++ b/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java @@ -19,13 +19,15 @@ package com.sk89q.wepif; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.bukkit.Server; import org.bukkit.plugin.PluginManager; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.*; - -import static org.mockito.Mockito.*; public class DinnerPermsResolverTest { private DinnerPermsResolver resolver; diff --git a/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java b/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java index 81e41e9d7..21c83228f 100644 --- a/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java +++ b/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java @@ -28,13 +28,17 @@ import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.plugin.Plugin; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; public class TestOfflinePermissible implements OfflinePlayer, Permissible { private boolean op; private UUID randomUuid = UUID.randomUUID(); - private final Map assignedPermissions = new HashMap(); + private final Map assignedPermissions = new HashMap<>(); @Override public boolean isOp() { @@ -101,7 +105,7 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible { @Override public Set getEffectivePermissions() { - Set ret = new HashSet(); + Set ret = new HashSet<>(); for (Map.Entry entry : assignedPermissions.entrySet()) { ret.add(new PermissionAttachmentInfo(this, entry.getKey(), null, entry.getValue())); } @@ -141,11 +145,6 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible { throw new UnsupportedOperationException("Not supported yet."); } - @Override - public void setBanned(boolean b) { - throw new UnsupportedOperationException("Not supported yet."); - } - @Override public boolean isWhitelisted() { throw new UnsupportedOperationException("Not supported yet."); diff --git a/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java b/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java index cf627e393..e6776cf8c 100644 --- a/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java +++ b/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java @@ -28,7 +28,7 @@ public class BukkitWorldTest { @Test public void testTreeTypeMapping() { for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) { - Assert.assertFalse("No mapping for: " + type, BukkitWorld.toBukkitTreeType(type) == null); + Assert.assertNotNull("No mapping for: " + type, BukkitWorld.toBukkitTreeType(type)); } } diff --git a/worldedit-core/build.gradle b/worldedit-core/build.gradle index 079e3c124..57a5eb2ca 100644 --- a/worldedit-core/build.gradle +++ b/worldedit-core/build.gradle @@ -5,11 +5,11 @@ dependencies { compile 'de.schlichtherle:truezip:6.8.3' compile 'rhino:js:1.7R2' compile 'org.yaml:snakeyaml:1.9' - compile 'com.google.guava:guava:17.0' + compile 'com.google.guava:guava:21.0' compile 'com.sk89q:jchronic:0.2.4a' compile 'com.google.code.findbugs:jsr305:1.3.9' compile 'com.thoughtworks.paranamer:paranamer:2.6' - compile 'com.google.code.gson:gson:2.2.4' + compile 'com.google.code.gson:gson:2.8.0' compile 'com.sk89q.lib:jlibnoise:1.0.0' //compile 'net.sf.trove4j:trove4j:3.0.3' testCompile 'org.mockito:mockito-core:1.9.0-rc1' diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBag.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBag.java deleted file mode 100644 index c8842ccb2..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBag.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bags; - -import com.sk89q.worldedit.WorldVector; -import com.sk89q.worldedit.blocks.*; - -/** - * @deprecated Block bags are currently not a supported feature of WorldEdit - */ -@SuppressWarnings("deprecation") -@Deprecated - -public abstract class BlockBag { - - /** - * Stores a block as if it was mined. - * - * @param id the ID of the block - * @throws BlockBagException thrown on a error - * @deprecated Use {@link BlockBag#storeDroppedBlock(int, int)} instead - */ - @Deprecated - public void storeDroppedBlock(int id) throws BlockBagException { - storeDroppedBlock(id, 0); - } - - /** - * Stores a block as if it was mined. - * - * @param id the ID of the block - * @param data the data value of the block - * @throws BlockBagException thrown on a error - */ - public void storeDroppedBlock(int id, int data) throws BlockBagException { - BaseItem dropped = BlockType.getBlockBagItem(id, data); - if (dropped == null) return; - if (dropped.getType() == BlockID.AIR) return; - - storeItem(dropped); - } - - /** - * Sets a block as if it was placed by hand. - * - * @param id the ID of the block - * @throws BlockBagException - * @deprecated Use {@link #fetchPlacedBlock(int,int)} instead - */ - @Deprecated - public void fetchPlacedBlock(int id) throws BlockBagException { - fetchPlacedBlock(id, 0); - } - - /** - * Sets a block as if it was placed by hand. - * - * @param id the ID of the block - * @param data the data value of the block - * @throws BlockBagException - */ - public void fetchPlacedBlock(int id, int data) throws BlockBagException { - try { - // Blocks that can't be fetched... - switch (id) { - case BlockID.BEDROCK: - case BlockID.GOLD_ORE: - case BlockID.IRON_ORE: - case BlockID.COAL_ORE: - case BlockID.DIAMOND_ORE: - case BlockID.TNT: - case BlockID.MOB_SPAWNER: - case BlockID.CROPS: - case BlockID.REDSTONE_ORE: - case BlockID.GLOWING_REDSTONE_ORE: - case BlockID.SNOW: - case BlockID.LIGHTSTONE: - case BlockID.PORTAL: - throw new UnplaceableBlockException(); - - case BlockID.WATER: - case BlockID.STATIONARY_WATER: - case BlockID.LAVA: - case BlockID.STATIONARY_LAVA: - // Override liquids - return; - - default: - fetchBlock(id); - break; - } - - } catch (OutOfBlocksException e) { - BaseItem placed = BlockType.getBlockBagItem(id, data); - if (placed == null) throw e; // TODO: check - if (placed.getType() == BlockID.AIR) throw e; // TODO: check - - fetchItem(placed); - } - } - - /** - * Get a block. - * - * Either this method or fetchItem needs to be overridden - * - * @param id the ID of the block - * @throws BlockBagException - */ - public void fetchBlock(int id) throws BlockBagException { - fetchItem(new BaseItem(id)); - } - - /** - * Get a block. - * - * Either this method or fetchBlock needs to be overridden - * - * @param item the item - * @throws BlockBagException - */ - public void fetchItem(BaseItem item) throws BlockBagException { - fetchBlock(item.getType()); - } - - /** - * Store a block. - * - * Either this method or storeItem needs to be overridden - * - * @param id the ID of the block - * @throws BlockBagException - */ - public void storeBlock(int id) throws BlockBagException { - storeItem(new BaseItem(id)); - } - - /** - * Store a block. - * - * Either this method or storeBlock needs to be overridden - * - * @param item the item - * @throws BlockBagException - */ - public void storeItem(BaseItem item) throws BlockBagException { - storeBlock(item.getType()); - } - - /** - * Checks to see if a block exists without removing it. - * - * @param id the ID of the block - * @return whether the block exists - */ - public boolean peekBlock(int id) { - try { - fetchBlock(id); - storeBlock(id); - return true; - } catch (BlockBagException e) { - return false; - } - } - - /** - * Flush any changes. This is called at the end. - */ - public abstract void flushChanges(); - - /** - * Adds a position to be used a source. - * - * @param position the position of the source - */ - public abstract void addSourcePosition(WorldVector position); - - /** - * Adds a position to be used a source. - * - * @param position the position of the source - */ - public abstract void addSingleSourcePosition(WorldVector position); - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ChestBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ChestBlock.java deleted file mode 100644 index 9c62e7f6d..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ChestBlock.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.NBTUtils; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.world.DataException; -import com.sk89q.worldedit.world.storage.InvalidFormatException; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Represents a chest block. - */ -public class ChestBlock extends ContainerBlock { - - /** - * Construct an empty chest block with the default orientation (data value). - */ - public ChestBlock() { - super(BlockID.CHEST, 27); - } - - /** - * Construct an empty chest block with a custom data value. - * - * @param data data indicating the position of the chest - */ - public ChestBlock(int data) { - super(BlockID.CHEST, data, 27); - } - - /** - * Construct the chest block with a custom data value and a list of items. - * - * @param data data indicating the position of the chest - * @param items array of items - */ - public ChestBlock(int data, BaseItemStack[] items) { - super(BlockID.CHEST, data, 27); - setItems(items); - } - - @Override - public String getNbtId() { - return "Chest"; - } - - @Override - public CompoundTag getNbtData() { - Map values = new HashMap(); - values.put("Items", new ListTag(CompoundTag.class, serializeInventory(getItems()))); - return new CompoundTag(values); - } - - @Override - public void setNbtData(CompoundTag rootTag) { - if (rootTag == null) { - return; - } - - Map values = rootTag.getValue(); - - Tag t = values.get("id"); - if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Chest")) { - throw new RuntimeException("'Chest' tile entity expected"); - } - - List items = new ArrayList(); - - try { - for (Tag tag : NBTUtils.getChildTag(values, "Items", ListTag.class).getValue()) { - if (!(tag instanceof CompoundTag)) { - throw new RuntimeException("CompoundTag expected as child tag of Chest's Items"); - } - - items.add((CompoundTag) tag); - } - - setItems(deserializeInventory(items)); - } catch (InvalidFormatException e) { - throw new RuntimeException(e); - } catch (DataException e) { - throw new RuntimeException(e); - } - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ContainerBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ContainerBlock.java deleted file mode 100644 index 05709cd0b..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/ContainerBlock.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.ByteTag; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.NBTUtils; -import com.sk89q.jnbt.ShortTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.world.DataException; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Represents a block that stores items. - */ -public abstract class ContainerBlock extends BaseBlock implements TileEntityBlock { - - private BaseItemStack[] items; - - public ContainerBlock(int type, int inventorySize) { - super(type); - this.items = new BaseItemStack[inventorySize]; - } - - public ContainerBlock(int type, int data, int inventorySize) { - super(type, data); - this.items = new BaseItemStack[inventorySize]; - } - - /** - * Get the list of items. - * - * @return an array of stored items - */ - public BaseItemStack[] getItems() { - return this.items; - } - - /** - * Set the list of items. - * - * @param items an array of stored items - */ - public void setItems(BaseItemStack[] items) { - this.items = items; - } - - @Override - public boolean hasNbtData() { - return true; - } - - public Map serializeItem(BaseItemStack item) { - Map data = new HashMap(); - data.put("id", new ShortTag((short) item.getType())); - data.put("Damage", new ShortTag(item.getData())); - data.put("Count", new ByteTag((byte) item.getAmount())); - if (!item.getEnchantments().isEmpty()) { - List enchantmentList = new ArrayList(); - for(Map.Entry entry : item.getEnchantments().entrySet()) { - Map enchantment = new HashMap(); - enchantment.put("id", new ShortTag(entry.getKey().shortValue())); - enchantment.put("lvl", new ShortTag(entry.getValue().shortValue())); - enchantmentList.add(new CompoundTag(enchantment)); - } - - Map auxData = new HashMap(); - auxData.put("ench", new ListTag(CompoundTag.class, enchantmentList)); - data.put("tag", new CompoundTag(auxData)); - } - return data; - } - - public BaseItemStack deserializeItem(Map data) throws DataException { - short id = NBTUtils.getChildTag(data, "id", ShortTag.class).getValue(); - short damage = NBTUtils.getChildTag(data, "Damage", ShortTag.class).getValue(); - byte count = NBTUtils.getChildTag(data, "Count", ByteTag.class).getValue(); - - BaseItemStack stack = new BaseItemStack(id, count, damage); - - if (data.containsKey("tag")) { - Map auxData = NBTUtils.getChildTag(data, "tag", CompoundTag.class).getValue(); - ListTag ench = (ListTag)auxData.get("ench"); - for(Tag e : ench.getValue()) { - Map vars = ((CompoundTag) e).getValue(); - short enchId = NBTUtils.getChildTag(vars, "id", ShortTag.class).getValue(); - short enchLevel = NBTUtils.getChildTag(vars, "lvl", ShortTag.class).getValue(); - stack.getEnchantments().put((int) enchId, (int) enchLevel); - } - } - return stack; - } - - public BaseItemStack[] deserializeInventory(List items) throws DataException { - BaseItemStack[] stacks = new BaseItemStack[items.size()]; - for (CompoundTag tag : items) { - Map item = tag.getValue(); - BaseItemStack stack = deserializeItem(item); - byte slot = NBTUtils.getChildTag(item, "Slot", ByteTag.class).getValue(); - if (slot >= 0 && slot < stacks.length) { - stacks[slot] = stack; - } - } - return stacks; - } - - public List serializeInventory(BaseItemStack[] items) { - List tags = new ArrayList(); - for (int i = 0; i < items.length; ++i) { - if (items[i] != null) { - Map tagData = serializeItem(items[i]); - tagData.put("Slot", new ByteTag((byte) i)); - tags.add(new CompoundTag(tagData)); - } - } - return tags; - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/DispenserBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/DispenserBlock.java deleted file mode 100644 index 4140ee88a..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/DispenserBlock.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.NBTUtils; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.world.DataException; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Represents dispensers. - */ -public class DispenserBlock extends ContainerBlock { - - /** - * Construct an empty dispenser block. - */ - public DispenserBlock() { - super(BlockID.DISPENSER, 9); - } - - /** - * Construct an empty dispenser block. - * - * @param data data value (orientation) - */ - public DispenserBlock(int data) { - super(BlockID.DISPENSER, data, 9); - } - - /** - * Construct a dispenser block with the given orientation and inventory. - * - * @param data data value (orientation) - * @param items array of items in the inventory - */ - public DispenserBlock(int data, BaseItemStack[] items) { - super(BlockID.DISPENSER, data, 9); - this.setItems(items); - } - - @Override - public String getNbtId() { - return "Trap"; - } - - @Override - public CompoundTag getNbtData() { - Map values = new HashMap(); - values.put("Items", new ListTag(CompoundTag.class, serializeInventory(getItems()))); - return new CompoundTag(values); - } - - @Override - public void setNbtData(CompoundTag rootTag) { - try { - if (rootTag == null) { - return; - } - - Map values = rootTag.getValue(); - - Tag t = values.get("id"); - if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Trap")) { - throw new DataException("'Trap' tile entity expected"); - } - - List items = new ArrayList(); - for (Tag tag : NBTUtils.getChildTag(values, "Items", ListTag.class).getValue()) { - if (!(tag instanceof CompoundTag)) { - throw new DataException("CompoundTag expected as child tag of Trap Items"); - } - - items.add((CompoundTag) tag); - } - - setItems(deserializeInventory(items)); - } catch (DataException e) { - throw new RuntimeException(e); - } - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/FurnaceBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/FurnaceBlock.java deleted file mode 100644 index f2001d754..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/FurnaceBlock.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.NBTUtils; -import com.sk89q.jnbt.ShortTag; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.world.DataException; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Represents a furnace block. - */ -public class FurnaceBlock extends ContainerBlock { - - private short burnTime; - private short cookTime; - - /** - * Construct an empty furnace block with the default orientation. - * - * @param type type ID - */ - public FurnaceBlock(int type) { - super(type, 2); - } - - /** - * Construct an empty furnace block with a given orientation. - * - * @param type type ID - * @param data orientation - */ - public FurnaceBlock(int type, int data) { - super(type, data, 2); - } - - /** - * Construct an furnace block with a given orientation and inventory. - * - * @param type type ID - * @param data orientation - * @param items inventory items - */ - public FurnaceBlock(int type, int data, BaseItemStack[] items) { - super(type, data, 2); - setItems(items); - } - - /** - * Get the burn time. - * - * @return the burn time - */ - public short getBurnTime() { - return burnTime; - } - - /** - * Set the burn time. - * - * @param burnTime the burn time - */ - public void setBurnTime(short burnTime) { - this.burnTime = burnTime; - } - - /** - * Get the cook time. - * - * @return the cook time - */ - public short getCookTime() { - return cookTime; - } - - /** - * Set the cook time. - * - * @param cookTime the cook time to set - */ - public void setCookTime(short cookTime) { - this.cookTime = cookTime; - } - - @Override - public String getNbtId() { - return "Furnace"; - } - - @Override - public CompoundTag getNbtData() { - Map values = new HashMap(); - values.put("Items", new ListTag(CompoundTag.class, serializeInventory(getItems()))); - values.put("BurnTime", new ShortTag(burnTime)); - values.put("CookTime", new ShortTag(cookTime)); - return new CompoundTag(values); - } - - @Override - public void setNbtData(CompoundTag rootTag) { - if (rootTag == null) { - return; - } - - try { - Map values = rootTag.getValue(); - - Tag t = values.get("id"); - if (!(t instanceof StringTag) - || !((StringTag) t).getValue().equals("Furnace")) { - throw new RuntimeException("'Furnace' tile entity expected"); - } - - ListTag items = NBTUtils.getChildTag(values, "Items", ListTag.class); - - List compound = new ArrayList(); - - for (Tag tag : items.getValue()) { - if (!(tag instanceof CompoundTag)) { - throw new RuntimeException("CompoundTag expected as child tag of Furnace Items"); - } - compound.add((CompoundTag) tag); - } - setItems(deserializeInventory(compound)); - - t = values.get("BurnTime"); - if (t instanceof ShortTag) { - burnTime = ((ShortTag) t).getValue(); - } - - t = values.get("CookTime"); - if (t instanceof ShortTag) { - cookTime = ((ShortTag) t).getValue(); - } - } catch (DataException e) { - throw new RuntimeException(e); - } - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/LazyBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/LazyBlock.java deleted file mode 100644 index cb34a71d3..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/LazyBlock.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.extent.Extent; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * A implementation of a lazy block for {@link Extent#getLazyBlock(Vector)} - * that takes the block's ID and metadata, but will defer loading of NBT - * data until time of access. - * - *

NBT data is later loaded using a call to {@link Extent#getBlock(Vector)} - * with a stored {@link Extent} and location.

- * - *

All mutators on this object will throw an - * {@link UnsupportedOperationException}.

- */ -public class LazyBlock extends BaseBlock { - - private final Extent extent; - private final Vector position; - private boolean loaded = false; - - /** - * Create a new lazy block. - * - * @param type the block type - * @param extent the extent to later load the full block data from - * @param position the position to later load the full block data from - */ - public LazyBlock(int type, Extent extent, Vector position) { - super(type); - checkNotNull(extent); - checkNotNull(position); - this.extent = extent; - this.position = position; - } - - /** - * Create a new lazy block. - * - * @param type the block type - * @param data the data value - * @param extent the extent to later load the full block data from - * @param position the position to later load the full block data from - */ - public LazyBlock(int type, int data, Extent extent, Vector position) { - super(type, data); - checkNotNull(extent); - checkNotNull(position); - this.extent = extent; - this.position = position; - } - - @Override - public void setId(int id) { - throw new UnsupportedOperationException("This object is immutable"); - } - - @Override - public void setData(int data) { - throw new UnsupportedOperationException("This object is immutable"); - } - - @Override - public CompoundTag getNbtData() { - if (!loaded) { - BaseBlock loadedBlock = extent.getBlock(position); - super.setNbtData(loadedBlock.getNbtData()); - } - return super.getNbtData(); - } - - @Override - public void setNbtData(CompoundTag nbtData) { - throw new UnsupportedOperationException("This object is immutable"); - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java index a876a1c1f..0d175e974 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java +++ b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java @@ -25,7 +25,8 @@ import com.sk89q.jnbt.NBTUtils; import com.sk89q.jnbt.ShortTag; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.blocks.metadata.MobType; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.storage.InvalidFormatException; import java.util.HashMap; @@ -49,41 +50,23 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock { private short maxNearbyEntities; private short requiredPlayerRange; - /** - * Construct the mob spawner block with a pig as the mob type. - */ - public MobSpawnerBlock() { - super(BlockID.MOB_SPAWNER); - this.mobType = MobType.PIG.getName(); - } - - /** - * Construct the mob spawner block with a given mob type. - * - * @param mobType mob type - */ - public MobSpawnerBlock(String mobType) { - super(BlockID.MOB_SPAWNER); - this.mobType = mobType; - } - /** * Construct the mob spawner block with a specified data value. * - * @param data data value + * @param blockState The block state */ - public MobSpawnerBlock(int data) { - super(BlockID.MOB_SPAWNER, data); + public MobSpawnerBlock(BlockState blockState) { + super(blockState); } /** * Construct the mob spawner block. * - * @param data data value + * @param blockState The block state * @param mobType mob type */ - public MobSpawnerBlock(int data, String mobType) { - super(BlockID.MOB_SPAWNER, data); + public MobSpawnerBlock(BlockState blockState, String mobType) { + super(blockState); this.mobType = mobType; } @@ -135,7 +118,7 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock { @Override public CompoundTag getNbtData() { - Map values = new HashMap(); + Map values = new HashMap<>(); values.put("EntityId", new StringTag(mobType)); values.put("Delay", new ShortTag(delay)); values.put("SpawnCount", new ShortTag(spawnCount)); diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/NoteBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/NoteBlock.java deleted file mode 100644 index f061723c1..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/NoteBlock.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.ByteTag; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; - -import java.util.HashMap; -import java.util.Map; - -/** - * A note block. - */ -public class NoteBlock extends BaseBlock implements TileEntityBlock { - - private byte note; - - /** - * Construct the note block with a data value of 0. - */ - public NoteBlock() { - super(BlockID.NOTE_BLOCK); - this.note = 0; - } - - /** - * Construct the note block with a given data value. - * - * @param data data value - */ - public NoteBlock(int data) { - super(BlockID.NOTE_BLOCK, data); - this.note = 0; - } - - /** - * Construct the note block with a given data value and note. - * - * @param data data value - * @param note note - */ - public NoteBlock(int data, byte note) { - super(BlockID.NOTE_BLOCK, data); - this.note = note; - } - - /** - * Get the note. - * - * @return the note - */ - public byte getNote() { - return note; - } - - /** - * Set the note. - * - * @param note the note to set - */ - public void setNote(byte note) { - this.note = note; - } - - @Override - public boolean hasNbtData() { - return true; - } - - @Override - public String getNbtId() { - return "Music"; - } - - @Override - public CompoundTag getNbtData() { - Map values = new HashMap(); - values.put("note", new ByteTag(note)); - return new CompoundTag(values); - } - - @Override - public void setNbtData(CompoundTag rootTag) { - if (rootTag == null) { - return; - } - - Map values = rootTag.getValue(); - - Tag t; - - t = values.get("id"); - if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Music")) { - throw new RuntimeException("'Music' tile entity expected"); - } - - t = values.get("note"); - if (t instanceof ByteTag) { - note = ((ByteTag) t).getValue(); - } - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java index 78f78419e..e11330faa 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java +++ b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java @@ -23,6 +23,8 @@ import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.util.gson.GsonUtil; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; import java.util.HashMap; import java.util.Map; @@ -36,26 +38,14 @@ public class SignBlock extends BaseBlock implements TileEntityBlock { private static String EMPTY = "{\"text\":\"\"}"; - /** - * Construct the sign without text. - * - * @param type type ID - * @param data data value (orientation) - */ - public SignBlock(int type, int data) { - super(type, data); - this.text = new String[] { EMPTY, EMPTY, EMPTY, EMPTY }; - } - /** * Construct the sign with text. * - * @param type type ID - * @param data data value (orientation) + * @param blockState The block state * @param text lines of text */ - public SignBlock(int type, int data, String[] text) { - super(type, data); + public SignBlock(BlockState blockState, String[] text) { + super(blockState); if (text == null) { this.text = new String[] { EMPTY, EMPTY, EMPTY, EMPTY }; return; @@ -103,7 +93,7 @@ public class SignBlock extends BaseBlock implements TileEntityBlock { @Override public CompoundTag getNbtData() { - Map values = new HashMap(); + Map values = new HashMap<>(); values.put("Text1", new StringTag(text[0])); values.put("Text2", new StringTag(text[1])); values.put("Text3", new StringTag(text[2])); diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java index d440ee0f7..4ecddddc2 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java +++ b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java @@ -19,10 +19,11 @@ package com.sk89q.worldedit.blocks; -import com.sk89q.jnbt.ByteTag; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; import java.util.HashMap; import java.util.Map; @@ -33,60 +34,25 @@ import java.util.Map; public class SkullBlock extends BaseBlock implements TileEntityBlock { private String owner = ""; // notchian - private byte skullType; // stored here for block, in damage value for item - private byte rot; // only matters if block data == 0x1 (on floor) /** * Construct the skull block with a default type of skelton. - * @param data data value to set, controls placement + * @param state BlockState to set */ - public SkullBlock(int data) { - this(data, (byte) 0); - } - - /** - * Construct the skull block with a given type. - * 0 - skeleton - * 1 - wither skelly - * 2 - zombie - * 3 - human - * 4 - creeper - * @param data data value to set, controls placement - * @param type type of skull - */ - public SkullBlock(int data, byte type) { - this(data, type, (byte) 0); - } - - /** - * Construct the skull block with a given type and rotation. - * @param data data value to set, controls placement - * @param type type of skull - * @param rot rotation (if on floor) - */ - public SkullBlock(int data, byte type, byte rot) { - super(BlockID.HEAD, data); - if (type < (byte) 0 || type > (byte) 4) { - this.skullType = (byte) 0; - } else { - this.skullType = type; - } - this.rot = rot; + public SkullBlock(BlockState state) { + super(state); this.owner = ""; } /** * Construct the skull block with a given rotation and owner. * The type is assumed to be player unless owner is null or empty. - * @param data data value to set, controls placement - * @param rot rotation of skull + * @param blockState BlockState to set * @param owner name of player */ - public SkullBlock(int data, byte rot, String owner) { - super(BlockID.HEAD, data); - this.rot = rot; + public SkullBlock(BlockState blockState, String owner) { + super(blockState); this.setOwner(owner); - if (owner == null || owner.isEmpty()) this.skullType = (byte) 0; } /** @@ -100,7 +66,6 @@ public class SkullBlock extends BaseBlock implements TileEntityBlock { if (owner.length() > 16 || owner.isEmpty()) this.owner = ""; else this.owner = owner; } - if (this.owner != null && !this.owner.isEmpty()) this.skullType = (byte) 3; } /** @@ -111,38 +76,6 @@ public class SkullBlock extends BaseBlock implements TileEntityBlock { return owner; } - /** - * Get the type of skull. - * @return the skullType - */ - public byte getSkullType() { - return skullType; - } - - /** - * Set the type of skull; - * @param skullType the skullType to set - */ - public void setSkullType(byte skullType) { - this.skullType = skullType; - } - - /** - * Get rotation of skull. This only means anything if the block data is 1. - * @return the rotation - */ - public byte getRot() { - return rot; - } - - /** - * Set the rotation of skull. - * @param rot the rotation to set - */ - public void setRot(byte rot) { - this.rot = rot; - } - @Override public boolean hasNbtData() { return true; @@ -155,11 +88,9 @@ public class SkullBlock extends BaseBlock implements TileEntityBlock { @Override public CompoundTag getNbtData() { - Map values = new HashMap(); - values.put("SkullType", new ByteTag(skullType)); + Map values = new HashMap<>(); if (owner == null) owner = ""; - values.put("ExtraType", new StringTag( owner)); - values.put("Rot", new ByteTag(rot)); + values.put("ExtraType", new StringTag(owner)); return new CompoundTag(values); } @@ -178,17 +109,9 @@ public class SkullBlock extends BaseBlock implements TileEntityBlock { throw new RuntimeException("'Skull' tile entity expected"); } - t = values.get("SkullType"); - if (t instanceof ByteTag) { - skullType = ((ByteTag) t).getValue(); - } t = values.get("ExtraType"); - if (t != null && t instanceof StringTag) { + if (t instanceof StringTag) { owner = ((StringTag) t).getValue(); } - t = values.get("Rot"); - if (t instanceof ByteTag) { - rot = ((ByteTag) t).getValue(); - } } } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/foundation/Block.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/foundation/Block.java deleted file mode 100644 index c39c51e57..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/foundation/Block.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.foundation; - -import com.sk89q.worldedit.blocks.BaseBlock; - -/** - * @deprecated Use {@link BaseBlock} - */ -@Deprecated -public abstract class Block { - - public abstract int getId(); - - public abstract void setId(int id); - - public abstract int getData(); - - public abstract void setData(int data); - - public abstract void setIdAndData(int id, int data); - - public abstract boolean hasWildcardData(); - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/AbstractMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/AbstractMask.java deleted file mode 100644 index 704ce4035..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/AbstractMask.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; - -/** - * @deprecated Switch to {@link com.sk89q.worldedit.function.mask.AbstractMask} - */ -@Deprecated -public abstract class AbstractMask implements Mask { - @Override - public void prepare(LocalSession session, LocalPlayer player, Vector target) { - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockMask.java deleted file mode 100644 index a6dd9ab97..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockMask.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -/** - * @deprecated Use {@link com.sk89q.worldedit.function.mask.BlockMask} - */ -@Deprecated -public class BlockMask extends AbstractMask { - - private final Set blocks; - - public BlockMask() { - blocks = new HashSet(); - } - - public BlockMask(Set types) { - this.blocks = types; - } - - public BlockMask(BaseBlock... block) { - blocks = new HashSet(); - for (BaseBlock b : block) { - add(b); - } - } - - public BlockMask(BaseBlock block) { - this(); - add(block); - } - - public void add(BaseBlock block) { - blocks.add(block); - } - - public void addAll(Collection blocks) { - blocks.addAll(blocks); - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - BaseBlock block = editSession.getBlock(position); - return blocks.contains(block) - || blocks.contains(new BaseBlock(block.getType(), -1)); - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/CombinedMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/CombinedMask.java deleted file mode 100644 index 3f7a6690e..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/CombinedMask.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.function.mask.MaskIntersection; - -import java.util.ArrayList; -import java.util.List; - -/** - * @deprecated See {@link MaskIntersection} - */ -@Deprecated -public class CombinedMask extends AbstractMask { - private final List masks = new ArrayList(); - - public CombinedMask() { - } - - public CombinedMask(Mask mask) { - add(mask); - } - - public CombinedMask(Mask ...mask) { - for (Mask m : mask) { - add(m); - } - } - - public CombinedMask(List masks) { - this.masks.addAll(masks); - } - - public void add(Mask mask) { - masks.add(mask); - } - - public boolean remove(Mask mask) { - return masks.remove(mask); - } - - public boolean has(Mask mask) { - return masks.contains(mask); - } - - @Override - public void prepare(LocalSession session, LocalPlayer player, Vector target) { - for (Mask mask : masks) { - mask.prepare(session, player, target); - } - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - for (Mask mask : masks) { - if (!mask.matches(editSession, position)) { - return false; - } - } - - return true; - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/ExistingBlockMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/ExistingBlockMask.java deleted file mode 100644 index 487786d06..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/ExistingBlockMask.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BlockID; - -/** - * @deprecated See {@link com.sk89q.worldedit.function.mask.ExistingBlockMask} - */ -@Deprecated -public class ExistingBlockMask extends AbstractMask { - @Override - public boolean matches(EditSession editSession, Vector position) { - return editSession.getBlockType(position) != BlockID.AIR; - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/FuzzyBlockMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/FuzzyBlockMask.java deleted file mode 100644 index 63093624c..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/FuzzyBlockMask.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.Blocks; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -/** - * @deprecated See {@link com.sk89q.worldedit.function.mask.FuzzyBlockMask} - */ -@Deprecated -public class FuzzyBlockMask extends AbstractMask { - - private final Set filter; - - /** - * Create a new fuzzy block mask. - * - * @param filter a list of block types to match - */ - public FuzzyBlockMask(Set filter) { - this.filter = filter; - } - - /** - * Create a new fuzzy block mask. - * - * @param block a list of block types to match - */ - public FuzzyBlockMask(BaseBlock... block) { - Set filter = new HashSet(); - Collections.addAll(filter, block); - this.filter = filter; - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - BaseBlock compare = new BaseBlock(editSession.getBlockType(position), editSession.getBlockData(position)); - return Blocks.containsFuzzy(filter, compare); - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/Mask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/Mask.java deleted file mode 100644 index cf0a04c89..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/Mask.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; - -/** - * @deprecated Use {@link com.sk89q.worldedit.function.mask.Mask} - */ -@Deprecated -public interface Mask { - - /** - * Called one time before each edit session. - * - * @param session a session - * @param player a player - * @param target target of the brush, null if not a brush mask - */ - void prepare(LocalSession session, LocalPlayer player, Vector target); - - /** - * Given a block position, this method returns true if the block at - * that position matches the filter. Block information is not provided - * as getting a BaseBlock has unneeded overhead in most block querying - * situations (enumerating a chest's contents is a waste, for example). - * - * @param editSession an instance - * @param position the position to check - * @return true if it matches - */ - boolean matches(EditSession editSession, Vector position); - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/SolidBlockMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/SolidBlockMask.java deleted file mode 100644 index dd5403441..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/SolidBlockMask.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BlockType; - -/** - * @deprecated See {@link com.sk89q.worldedit.function.mask.SolidBlockMask} - */ -@Deprecated -public class SolidBlockMask extends AbstractMask { - @Override - public boolean matches(EditSession editSession, Vector position) { - return !BlockType.canPassThrough(editSession.getBlockType(position), editSession.getBlockData(position)); - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/UnderOverlayMask.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/UnderOverlayMask.java deleted file mode 100644 index 39fe3dc8e..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/UnderOverlayMask.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.masks; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.function.mask.MaskIntersection; -import com.sk89q.worldedit.function.mask.Masks; -import com.sk89q.worldedit.function.mask.OffsetMask; - -import java.util.Set; - -/** - * @deprecated Use {@link OffsetMask} with {@link MaskIntersection} and {@link Masks#negate(com.sk89q.worldedit.function.mask.Mask)} - */ -@Deprecated -public class UnderOverlayMask extends AbstractMask { - private final int yMod; - private Mask mask; - - @Deprecated - public UnderOverlayMask(Set ids, boolean overlay) { - this(new BlockTypeMask(ids), overlay); - } - - public UnderOverlayMask(Mask mask, boolean overlay) { - this.yMod = overlay ? -1 : 1; - this.mask = mask; - } - - @Deprecated - public void addAll(Set ids) { - if (mask instanceof BlockMask) { - final BlockMask blockTypeMask = (BlockMask) mask; - for (Integer id : ids) { - blockTypeMask.add(new BaseBlock(id)); - } - } else if (mask instanceof ExistingBlockMask) { - final BlockMask blockMask = new BlockMask(); - for (int type : ids) { - blockMask.add(new BaseBlock(type)); - } - mask = blockMask; - } - } - - @Override - public void prepare(LocalSession session, LocalPlayer player, Vector target) { - mask.prepare(session, player, target); - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - return !mask.matches(editSession, position) && mask.matches(editSession, position.add(0, yMod, 0)); - } -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/Pattern.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/Pattern.java deleted file mode 100644 index b27e8e0fc..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/Pattern.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.patterns; - -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; - -/** - * @deprecated See {@link com.sk89q.worldedit.function.pattern.Pattern} - */ -@Deprecated -public interface Pattern { - - /** - * Get a block for a position. This return value of this method does - * not have to be consistent for the same position. - * - * @param position the position where a block is needed - * @return a block - */ - public BaseBlock next(Vector position); - - /** - * Get a block for a position. This return value of this method does - * not have to be consistent for the same position. - * - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - * @return a block - */ - public BaseBlock next(int x, int y, int z); - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/RandomFillPattern.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/RandomFillPattern.java deleted file mode 100644 index 6014eec36..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/RandomFillPattern.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.patterns; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.function.pattern.RandomPattern; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -/** - * @deprecated See {@link RandomPattern} - */ -@Deprecated -public class RandomFillPattern implements Pattern { - - private static final Random random = new Random(); - private List blocks; - - /** - * Construct the object. - * - * @param blocks a list of blocks - */ - public RandomFillPattern(List blocks) { - double max = 0; - - for (BlockChance block : blocks) { - max += block.getChance(); - } - - List finalBlocks = new ArrayList(); - - double i = 0; - - for (BlockChance block : blocks) { - double v = block.getChance() / max; - i += v; - finalBlocks.add(new BlockChance(block.getBlock(), i)); - } - - this.blocks = finalBlocks; - } - - @Override - public BaseBlock next(Vector position) { - double r = random.nextDouble(); - - for (BlockChance block : blocks) { - if (r <= block.getChance()) { - return block.getBlock(); - } - } - - throw new RuntimeException("ProportionalFillPattern"); - } - - @Override - public BaseBlock next(int x, int y, int z) { - return next(null); - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/AbstractLegacyRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/AbstractLegacyRegionSelector.java deleted file mode 100644 index 1930e3b9f..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/AbstractLegacyRegionSelector.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.extension.platform.Actor; - -abstract class AbstractLegacyRegionSelector implements RegionSelector { - - @Deprecated - public final void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector position) { - explainPrimarySelection((Actor) player, session, position); - } - - @Deprecated - public final void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector position) { - explainSecondarySelection((Actor) player, session, position); - } - - @Deprecated - public final void explainRegionAdjust(LocalPlayer player, LocalSession session) { - explainRegionAdjust((Actor) player, session); - } - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegionSelector.java deleted file mode 100644 index f264546dd..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class ConvexPolyhedralRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CuboidRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CuboidRegionSelector.java deleted file mode 100644 index 458d75cb3..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CuboidRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class CuboidRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CylinderRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CylinderRegionSelector.java deleted file mode 100644 index b54709e7d..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/CylinderRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class CylinderRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/EllipsoidRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/EllipsoidRegionSelector.java deleted file mode 100644 index 69bf5ba2b..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/EllipsoidRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class EllipsoidRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ExtendingCuboidRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ExtendingCuboidRegionSelector.java deleted file mode 100644 index d9888a447..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/ExtendingCuboidRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class ExtendingCuboidRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/Polygonal2DRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/Polygonal2DRegionSelector.java deleted file mode 100644 index f3b8a9cbd..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/Polygonal2DRegionSelector.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class Polygonal2DRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { - - /** - * Get the number of points. - * - * @return the number of points - */ - public abstract int getPointCount(); - -} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/SphereRegionSelector.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/SphereRegionSelector.java deleted file mode 100644 index 8a3057dc0..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/regions/SphereRegionSelector.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.regions; - -import com.sk89q.worldedit.internal.cui.CUIRegion; - -/** - * @deprecated This class only exists as to not break binary compatibility - */ -@Deprecated -public abstract class SphereRegionSelector extends AbstractLegacyRegionSelector implements CUIRegion { -} diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java index 6477d2502..2c439e11b 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java @@ -72,7 +72,7 @@ public final class CompoundTag extends Tag { * @return the builder */ public CompoundTagBuilder createBuilder() { - return new CompoundTagBuilder(new HashMap(value)); + return new CompoundTagBuilder(new HashMap<>(value)); } /** @@ -317,6 +317,24 @@ public final class CompoundTag extends Tag { } } + /** + * Get a {@code long[]} named with the given key. + * + *

If the key does not exist or its value is not an long array tag, + * then an empty array will be returned.

+ * + * @param key the key + * @return an int array + */ + public long[] getLongArray(String key) { + Tag tag = value.get(key); + if (tag instanceof LongArrayTag) { + return ((LongArrayTag) tag).getValue(); + } else { + return new long[0]; + } + } + /** * Get a long named with the given key. * diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTagBuilder.java b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTagBuilder.java index 3d476fa40..b0e873c0d 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTagBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTagBuilder.java @@ -19,11 +19,11 @@ package com.sk89q.jnbt; +import static com.google.common.base.Preconditions.checkNotNull; + import java.util.HashMap; import java.util.Map; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Helps create compound tags. */ @@ -35,7 +35,7 @@ public class CompoundTagBuilder { * Create a new instance. */ CompoundTagBuilder() { - this.entries = new HashMap(); + this.entries = new HashMap<>(); } /** @@ -133,6 +133,18 @@ public class CompoundTagBuilder { return put(key, new IntTag(value)); } + /** + * Put the given key and value into the compound tag as a + * {@code LongArrayTag}. + * + * @param key they key + * @param value the value + * @return this object + */ + public CompoundTagBuilder putLongArray(String key, long[] value) { + return put(key, new LongArrayTag(value)); + } + /** * Put the given key and value into the compound tag as a * {@code LongTag}. @@ -189,7 +201,7 @@ public class CompoundTagBuilder { * @return the new compound tag */ public CompoundTag build() { - return new CompoundTag(new HashMap(entries)); + return new CompoundTag(new HashMap<>(entries)); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java index 3cbe42977..7a2482344 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java @@ -19,12 +19,12 @@ package com.sk89q.jnbt; -import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkNotNull; + import java.util.Collections; import java.util.List; -import java.util.NoSuchElementException; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * The {@code TAG_List} tag. @@ -79,11 +79,10 @@ public final class ListTag extends Tag { */ @Nullable public Tag getIfExists(int index) { - try { - return value.get(index); - } catch (NoSuchElementException e) { + if (index >= value.size()) { return null; } + return value.get(index); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java index 9bcbbfd05..c410ec3ae 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTagBuilder.java @@ -19,13 +19,13 @@ package com.sk89q.jnbt; +import static com.google.common.base.Preconditions.checkNotNull; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Helps create list tags. */ @@ -42,7 +42,7 @@ public class ListTagBuilder { ListTagBuilder(Class type) { checkNotNull(type); this.type = type; - this.entries = new ArrayList(); + this.entries = new ArrayList<>(); } /** @@ -80,7 +80,7 @@ public class ListTagBuilder { * @return the new list tag */ public ListTag build() { - return new ListTag(type, new ArrayList(entries)); + return new ListTag(type, new ArrayList<>(entries)); } /** diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/ClipboardPattern.java b/worldedit-core/src/main/java/com/sk89q/jnbt/LongArrayTag.java similarity index 51% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/ClipboardPattern.java rename to worldedit-core/src/main/java/com/sk89q/jnbt/LongArrayTag.java index 8808a0684..30dad0cc3 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/ClipboardPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/LongArrayTag.java @@ -17,41 +17,44 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.patterns; +package com.sk89q.jnbt; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; +import static com.google.common.base.Preconditions.checkNotNull; /** - * Pattern that repeats the clipboard. + * The {@code TAG_Long_Array} tag. */ -public class ClipboardPattern implements Pattern { +public class LongArrayTag extends Tag { - private CuboidClipboard clipboard; - private Vector size; + private final long[] value; /** - * Construct the object. + * Creates the tag with an empty name. * - * @param clipboard the clipboard + * @param value the value of the tag */ - public ClipboardPattern(CuboidClipboard clipboard) { - this.clipboard = clipboard; - this.size = clipboard.getSize(); + public LongArrayTag(long[] value) { + super(); + checkNotNull(value); + this.value = value; } @Override - public BaseBlock next(Vector position) { - return next(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + public long[] getValue() { + return value; } @Override - public BaseBlock next(int x, int y, int z) { - int xp = Math.abs(x) % size.getBlockX(); - int yp = Math.abs(y) % size.getBlockY(); - int zp = Math.abs(z) % size.getBlockZ(); - - return clipboard.getPoint(new Vector(xp, yp, zp)); + public String toString() { + StringBuilder hex = new StringBuilder(); + for (long b : value) { + String hexDigits = Long.toHexString(b).toUpperCase(); + if (hexDigits.length() == 1) { + hex.append("0"); + } + hex.append(hexDigits).append(" "); + } + return "TAG_Long_Array(" + hex + ")"; } } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTConstants.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTConstants.java index 2ff2768ac..1cbff362d 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTConstants.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTConstants.java @@ -31,7 +31,7 @@ public final class NBTConstants { public static final int TYPE_END = 0, TYPE_BYTE = 1, TYPE_SHORT = 2, TYPE_INT = 3, TYPE_LONG = 4, TYPE_FLOAT = 5, TYPE_DOUBLE = 6, TYPE_BYTE_ARRAY = 7, TYPE_STRING = 8, TYPE_LIST = 9, - TYPE_COMPOUND = 10, TYPE_INT_ARRAY = 11; + TYPE_COMPOUND = 10, TYPE_INT_ARRAY = 11, TYPE_LONG_ARRAY = 12; /** * Default private constructor. @@ -73,6 +73,8 @@ public final class NBTConstants { return CompoundTag.class; case TYPE_INT_ARRAY: return IntArrayTag.class; + case TYPE_LONG_ARRAY: + return LongArrayTag.class; default: throw new IllegalArgumentException("Unknown tag type ID of " + id); } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTInputStream.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTInputStream.java index 223ca2248..b6096a163 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTInputStream.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTInputStream.java @@ -128,7 +128,7 @@ public final class NBTInputStream implements Closeable { int childType = is.readByte(); length = is.readInt(); - List tagList = new ArrayList(); + List tagList = new ArrayList<>(); for (int i = 0; i < length; ++i) { Tag tag = readTagPayload(childType, depth + 1); if (tag instanceof EndTag) { @@ -139,7 +139,7 @@ public final class NBTInputStream implements Closeable { return new ListTag(NBTUtils.getTypeClass(childType), tagList); case NBTConstants.TYPE_COMPOUND: - Map tagMap = new HashMap(); + Map tagMap = new HashMap<>(); while (true) { NamedTag namedTag = readNamedTag(depth + 1); Tag tag = namedTag.getTag(); @@ -158,6 +158,13 @@ public final class NBTInputStream implements Closeable { data[i] = is.readInt(); } return new IntArrayTag(data); + case NBTConstants.TYPE_LONG_ARRAY: + length = is.readInt(); + long[] longData = new long[length]; + for (int i = 0; i < length; i++) { + longData[i] = is.readLong(); + } + return new LongArrayTag(longData); default: throw new IOException("Invalid tag type: " + type + "."); } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java index a54ea6e26..5bed0297f 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java @@ -19,6 +19,8 @@ package com.sk89q.jnbt; +import static com.google.common.base.Preconditions.checkNotNull; + import java.io.Closeable; import java.io.DataOutputStream; import java.io.IOException; @@ -26,8 +28,6 @@ import java.io.OutputStream; import java.util.List; import java.util.Map; -import static com.google.common.base.Preconditions.checkNotNull; - /** * This class writes NBT, or Named Binary Tag * {@code Tag} objects to an underlying {@code OutputStream}. @@ -129,6 +129,9 @@ public final class NBTOutputStream implements Closeable { case NBTConstants.TYPE_INT_ARRAY: writeIntArrayTagPayload((IntArrayTag) tag); break; + case NBTConstants.TYPE_LONG_ARRAY: + writeLongArrayTagPayload((LongArrayTag) tag); + break; default: throw new IOException("Invalid tag type: " + type + "."); } @@ -286,6 +289,14 @@ public final class NBTOutputStream implements Closeable { } } + private void writeLongArrayTagPayload(LongArrayTag tag) throws IOException { + long[] data = tag.getValue(); + os.writeInt(data.length); + for (long aData : data) { + os.writeLong(aData); + } + } + @Override public void close() throws IOException { os.close(); diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java index 428ff4d86..e44262911 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java @@ -19,13 +19,13 @@ package com.sk89q.jnbt; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.world.storage.InvalidFormatException; import java.util.Map; -import static com.google.common.base.Preconditions.checkNotNull; - /** * A class which contains NBT-related utility methods. * @@ -69,6 +69,8 @@ public final class NBTUtils { return "TAG_String"; } else if (clazz.equals(IntArrayTag.class)) { return "TAG_Int_Array"; + } else if (clazz.equals(LongArrayTag.class)) { + return "TAG_Long_Array"; } else { throw new IllegalArgumentException("Invalid tag classs (" + clazz.getName() + ")."); @@ -107,6 +109,8 @@ public final class NBTUtils { return NBTConstants.TYPE_STRING; } else if (clazz.equals(IntArrayTag.class)) { return NBTConstants.TYPE_INT_ARRAY; + } else if (clazz.equals(LongArrayTag.class)) { + return NBTConstants.TYPE_LONG_ARRAY; } else { throw new IllegalArgumentException("Invalid tag classs (" + clazz.getName() + ")."); @@ -146,6 +150,8 @@ public final class NBTUtils { return CompoundTag.class; case NBTConstants.TYPE_INT_ARRAY: return IntArrayTag.class; + case NBTConstants.TYPE_LONG_ARRAY: + return LongArrayTag.class; default: throw new IllegalArgumentException("Invalid tag type : " + type + "."); diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandContext.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandContext.java index d1db70207..9dfc58d6f 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandContext.java +++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandContext.java @@ -34,8 +34,8 @@ public class CommandContext { protected final List originalArgIndices; protected final String[] originalArgs; - protected final Set booleanFlags = new HashSet(); - protected final Map valueFlags = new HashMap(); + protected final Set booleanFlags = new HashSet<>(); + protected final Map valueFlags = new HashMap<>(); protected final SuggestionContext suggestionContext; protected final CommandLocals locals; @@ -103,8 +103,8 @@ public class CommandContext { SuggestionContext suggestionContext = SuggestionContext.hangingValue(); // Eliminate empty args and combine multiword args first - List argIndexList = new ArrayList(args.length); - List argList = new ArrayList(args.length); + List argIndexList = new ArrayList<>(args.length); + List argList = new ArrayList<>(args.length); for (int i = 1; i < args.length; ++i) { isHanging = false; @@ -152,8 +152,8 @@ public class CommandContext { // Then flags - this.originalArgIndices = new ArrayList(argIndexList.size()); - this.parsedArgs = new ArrayList(argList.size()); + this.originalArgIndices = new ArrayList<>(argIndexList.size()); + this.parsedArgs = new ArrayList<>(argList.size()); if (parseFlags) { for (int nextArg = 0; nextArg < argList.size(); ) { diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandException.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandException.java index e81344e56..4345793d1 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandException.java +++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandException.java @@ -19,16 +19,17 @@ package com.sk89q.minecraft.util.commands; -import javax.annotation.Nullable; +import static com.google.common.base.Preconditions.checkNotNull; + import java.util.ArrayList; import java.util.List; import java.util.ListIterator; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; public class CommandException extends Exception { - private List commandStack = new ArrayList(); + private List commandStack = new ArrayList<>(); public CommandException() { super(); diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandLocals.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandLocals.java index e0053f0b3..0bc2992a5 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandLocals.java +++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandLocals.java @@ -24,7 +24,7 @@ import java.util.Map; public class CommandLocals { - private final Map locals = new HashMap(); + private final Map locals = new HashMap<>(); public boolean containsKey(Object key) { return locals.containsKey(key); diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java index eec7ced7c..a8f49678b 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java +++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java @@ -72,18 +72,18 @@ public abstract class CommandsManager { * the key of the command name (one for each alias) with the * method. */ - protected Map> commands = new HashMap>(); + protected Map> commands = new HashMap<>(); /** * Used to store the instances associated with a method. */ - protected Map instances = new HashMap(); + protected Map instances = new HashMap<>(); /** * Mapping of commands (not including aliases) with a description. This * is only for top level commands. */ - protected Map descs = new HashMap(); + protected Map descs = new HashMap<>(); /** * Stores the injector used to getInstance. @@ -94,7 +94,7 @@ public abstract class CommandsManager { * Mapping of commands (not including aliases) with a description. This * is only for top level commands. */ - protected Map helpMessages = new HashMap(); + protected Map helpMessages = new HashMap<>(); /** * Register an class that contains commands (denoted by {@link Command}. @@ -141,11 +141,7 @@ public abstract class CommandsManager { Object obj = getInjector().getInstance(cls); return registerMethods(cls, parent, obj); } - } catch (InvocationTargetException e) { - logger.log(Level.SEVERE, "Failed to register commands", e); - } catch (IllegalAccessException e) { - logger.log(Level.SEVERE, "Failed to register commands", e); - } catch (InstantiationException e) { + } catch (InvocationTargetException | InstantiationException | IllegalAccessException e) { logger.log(Level.SEVERE, "Failed to register commands", e); } return null; @@ -161,14 +157,14 @@ public abstract class CommandsManager { */ private List registerMethods(Class cls, Method parent, Object obj) { Map map; - List registered = new ArrayList(); + List registered = new ArrayList<>(); // Make a new hash map to cache the commands for this class // as looking up methods via reflection is fairly slow if (commands.containsKey(parent)) { map = commands.get(parent); } else { - map = new HashMap(); + map = new HashMap<>(); commands.put(parent, map); } @@ -359,7 +355,7 @@ public abstract class CommandsManager { command.append("<"); - Set allowedCommands = new HashSet(); + Set allowedCommands = new HashSet<>(); for (Map.Entry entry : map.entrySet()) { Method childMethod = entry.getValue(); @@ -479,10 +475,10 @@ public abstract class CommandsManager { String[] newArgs = new String[args.length - level]; System.arraycopy(args, level, newArgs, 0, args.length - level); - final Set valueFlags = new HashSet(); + final Set valueFlags = new HashSet<>(); char[] flags = cmd.flags().toCharArray(); - Set newFlags = new HashSet(); + Set newFlags = new HashSet<>(); for (int i = 0; i < flags.length; ++i) { if (flags.length > i + 1 && flags[i + 1] == ':') { valueFlags.add(flags[i]); @@ -526,9 +522,7 @@ public abstract class CommandsManager { public void invokeMethod(Method parent, String[] args, T player, Method method, Object instance, Object[] methodArgs, int level) throws CommandException { try { method.invoke(instance, methodArgs); - } catch (IllegalArgumentException e) { - logger.log(Level.SEVERE, "Failed to execute command", e); - } catch (IllegalAccessException e) { + } catch (IllegalArgumentException | IllegalAccessException e) { logger.log(Level.SEVERE, "Failed to execute command", e); } catch (InvocationTargetException e) { if (e.getCause() instanceof CommandException) { diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/SimpleInjector.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/SimpleInjector.java index ca3e82f92..eb6097512 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/SimpleInjector.java +++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/SimpleInjector.java @@ -44,16 +44,7 @@ public class SimpleInjector implements Injector { Constructor ctr = clazz.getConstructor(argClasses); ctr.setAccessible(true); return ctr.newInstance(args); - } catch (NoSuchMethodException e) { - log.log(Level.SEVERE, "Error initializing commands class " + clazz, e); - return null; - } catch (InvocationTargetException e) { - log.log(Level.SEVERE, "Error initializing commands class " + clazz, e); - return null; - } catch (InstantiationException e) { - log.log(Level.SEVERE, "Error initializing commands class " + clazz, e); - return null; - } catch (IllegalAccessException e) { + } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { log.log(Level.SEVERE, "Error initializing commands class " + clazz, e); return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/util/ArrayUtil.java b/worldedit-core/src/main/java/com/sk89q/util/ArrayUtil.java deleted file mode 100644 index 5593c2e75..000000000 --- a/worldedit-core/src/main/java/com/sk89q/util/ArrayUtil.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.util; - -public final class ArrayUtil { - - private ArrayUtil() { - } - - public static String[] removePortionOfArray(String[] array, int from, int to, String replace) { - String[] newArray = new String[from + array.length - to - (replace == null ? 1 : 0)]; - System.arraycopy(array, 0, newArray, 0, from); - if (replace != null) newArray[from] = replace; - System.arraycopy(array, to + 1, newArray, from + (replace == null ? 0 : 1), - array.length - to - 1); - return newArray; - } - - public static char[] removePortionOfArray(char[] array, int from, int to, Character replace) { - char[] newArray = new char[from + array.length - to - (replace == null ? 1 : 0)]; - System.arraycopy(array, 0, newArray, 0, from); - if (replace != null) newArray[from] = replace; - System.arraycopy(array, to + 1, newArray, from + (replace == null ? 0 : 1), - array.length - to - 1); - return newArray; - } -} diff --git a/worldedit-core/src/main/java/com/sk89q/util/ReflectionUtil.java b/worldedit-core/src/main/java/com/sk89q/util/ReflectionUtil.java index 0b80816f7..81388e619 100644 --- a/worldedit-core/src/main/java/com/sk89q/util/ReflectionUtil.java +++ b/worldedit-core/src/main/java/com/sk89q/util/ReflectionUtil.java @@ -34,8 +34,7 @@ public final class ReflectionUtil { Field field = checkClass.getDeclaredField(name); field.setAccessible(true); return (T) field.get(from); - } catch (NoSuchFieldException ignored) { - } catch (IllegalAccessException ignored) { + } catch (NoSuchFieldException | IllegalAccessException ignored) { } } while (checkClass.getSuperclass() != Object.class && ((checkClass = checkClass.getSuperclass()) != null)); return null; diff --git a/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java b/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java index 90bb2f5b6..2571f71f9 100644 --- a/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java +++ b/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java @@ -19,7 +19,9 @@ package com.sk89q.util; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.Map; /** @@ -301,4 +303,24 @@ public final class StringUtil { return type; } + + public static List parseListInQuotes(String[] input, char delimiter, char quoteOpen, char quoteClose) { + List parsableBlocks = new ArrayList<>(); + StringBuilder buffer = new StringBuilder(); + for (String split : input) { + if (split.indexOf(quoteOpen) != -1 && split.indexOf(quoteClose) == -1) { + buffer.append(split).append(delimiter); + } else if (split.indexOf(quoteClose) != -1 && split.indexOf(quoteOpen) == -1) { + buffer.append(split); + parsableBlocks.add(buffer.toString()); + buffer = new StringBuilder(); + } else if (buffer.length() == 0) { + parsableBlocks.add(split); + } else { + buffer.append(split).append(delimiter); + } + } + + return parsableBlocks; + } } diff --git a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java index ff0bda3a4..677ca5ecb 100644 --- a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java +++ b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java @@ -23,12 +23,13 @@ import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import javax.annotation.Nullable; + /** * Represents a configuration node. */ @@ -111,7 +112,7 @@ public class YAMLNode { */ private Object prepareSerialization(Object value) { if (value instanceof Vector) { - Map out = new LinkedHashMap(); + Map out = new LinkedHashMap<>(); Vector vec = (Vector) value; out.put("x", vec.getX()); out.put("y", vec.getY()); @@ -169,7 +170,7 @@ public class YAMLNode { * @return a node for the path */ public YAMLNode addNode(String path) { - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); YAMLNode node = new YAMLNode(map, writeDefaults); setProperty(path, map); return node; @@ -398,12 +399,12 @@ public class YAMLNode { */ @SuppressWarnings("unchecked") public List getKeys(String path) { - if (path == null) return new ArrayList(root.keySet()); + if (path == null) return new ArrayList<>(root.keySet()); Object o = getProperty(path); if (o == null) { return null; } else if (o instanceof Map) { - return new ArrayList(((Map) o).keySet()); + return new ArrayList<>(((Map) o).keySet()); } else { return null; } @@ -444,10 +445,10 @@ public class YAMLNode { List raw = getList(path); if (raw == null) { if (writeDefaults && def != null) setProperty(path, def); - return def != null ? def : new ArrayList(); + return def != null ? def : new ArrayList<>(); } - List list = new ArrayList(); + List list = new ArrayList<>(); for (Object o : raw) { if (o == null) { continue; @@ -474,10 +475,10 @@ public class YAMLNode { List raw = getList(path); if (raw == null) { if (writeDefaults && def != null) setProperty(path, def); - return def != null ? def : new ArrayList(); + return def != null ? def : new ArrayList<>(); } - List list = new ArrayList(); + List list = new ArrayList<>(); for (Object o : raw) { Integer i = castInt(o); if (i != null) { @@ -503,10 +504,10 @@ public class YAMLNode { List raw = getList(path); if (raw == null) { if (writeDefaults && def != null) setProperty(path, def); - return def != null ? def : new ArrayList(); + return def != null ? def : new ArrayList<>(); } - List list = new ArrayList(); + List list = new ArrayList<>(); for (Object o : raw) { Double i = castDouble(o); if (i != null) { @@ -532,10 +533,10 @@ public class YAMLNode { List raw = getList(path); if (raw == null) { if (writeDefaults && def != null) setProperty(path, def); - return def != null ? def : new ArrayList(); + return def != null ? def : new ArrayList<>(); } - List list = new ArrayList(); + List list = new ArrayList<>(); for (Object o : raw) { Boolean tetsu = castBoolean(o); if (tetsu != null) { @@ -559,7 +560,7 @@ public class YAMLNode { */ public List getVectorList(String path, List def) { List raw = getNodeList(path, null); - List list = new ArrayList(); + List list = new ArrayList<>(); for (YAMLNode o : raw) { Double x = o.getDouble("x"); @@ -590,7 +591,7 @@ public class YAMLNode { public List getVector2dList(String path, List def) { List raw = getNodeList(path, null); - List list = new ArrayList(); + List list = new ArrayList<>(); for (YAMLNode o : raw) { Double x = o.getDouble("x"); @@ -620,7 +621,7 @@ public class YAMLNode { public List getBlockVector2dList(String path, List def) { List raw = getNodeList(path, null); - List list = new ArrayList(); + List list = new ArrayList<>(); for (YAMLNode o : raw) { Double x = o.getDouble("x"); @@ -652,10 +653,10 @@ public class YAMLNode { List raw = getList(path); if (raw == null) { if (writeDefaults && def != null) setProperty(path, def); - return def != null ? def : new ArrayList(); + return def != null ? def : new ArrayList<>(); } - List list = new ArrayList(); + List list = new ArrayList<>(); for (Object o : raw) { if (o instanceof Map) { list.add(new YAMLNode((Map) o, writeDefaults)); @@ -698,7 +699,7 @@ public class YAMLNode { return null; } else if (o instanceof Map) { Map nodes = - new LinkedHashMap(); + new LinkedHashMap<>(); for (Map.Entry entry : ((Map) o).entrySet()) { if (entry.getValue() instanceof Map) { diff --git a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java index e0ecdf33f..45ffd8776 100644 --- a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java +++ b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java @@ -24,14 +24,22 @@ import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.SafeConstructor; import org.yaml.snakeyaml.emitter.ScalarAnalysis; -import org.yaml.snakeyaml.nodes.Node; import org.yaml.snakeyaml.nodes.Tag; import org.yaml.snakeyaml.reader.UnicodeReader; -import org.yaml.snakeyaml.representer.Represent; import org.yaml.snakeyaml.representer.Representer; -import java.io.*; -import java.util.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.nio.charset.StandardCharsets; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; import java.util.Map.Entry; /** @@ -76,10 +84,10 @@ public class YAMLProcessor extends YAMLNode { * Comments support based on ZerothAngel's AnnotatedYAMLConfiguration * Comments are only supported with YAMLFormat.EXTENDED */ - private final Map comments = new HashMap(); + private final Map comments = new HashMap<>(); public YAMLProcessor(File file, boolean writeDefaults, YAMLFormat format) { - super(new LinkedHashMap(), writeDefaults); + super(new LinkedHashMap<>(), writeDefaults); this.format = format; DumperOptions options = new FancyDumperOptions(); @@ -103,21 +111,13 @@ public class YAMLProcessor extends YAMLNode { * @throws java.io.IOException on load error */ public void load() throws IOException { - InputStream stream = null; - try { - stream = getInputStream(); - if (stream == null) throw new IOException("Stream is null!"); + try (InputStream stream = getInputStream()) { + if (stream == null) + throw new IOException("Stream is null!"); read(yaml.load(new UnicodeReader(stream))); } catch (YAMLProcessorException e) { - root = new LinkedHashMap(); - } finally { - try { - if (stream != null) { - stream.close(); - } - } catch (IOException ignored) { - } + root = new LinkedHashMap<>(); } } @@ -167,18 +167,15 @@ public class YAMLProcessor extends YAMLNode { * @return true if it was successful */ public boolean save() { - OutputStream stream = null; File parent = file.getParentFile(); - if (parent != null) { parent.mkdirs(); } - - try { - stream = getOutputStream(); - if (stream == null) return false; - OutputStreamWriter writer = new OutputStreamWriter(stream, "UTF-8"); + try (OutputStream stream = getOutputStream()) { + if (stream == null) + return false; + OutputStreamWriter writer = new OutputStreamWriter(stream, StandardCharsets.UTF_8); if (header != null) { writer.append(header); writer.append(LINE_BREAK); @@ -187,7 +184,7 @@ public class YAMLProcessor extends YAMLNode { yaml.dump(root, writer); } else { // Iterate over each root-level property and dump - for (Entry entry : root.entrySet()) { + for (Entry entry: root.entrySet()) { // Output comment, if present String comment = comments.get(entry.getKey()); if (comment != null) { @@ -202,12 +199,6 @@ public class YAMLProcessor extends YAMLNode { } return true; } catch (IOException ignored) { - } finally { - try { - if (stream != null) { - stream.close(); - } - } catch (IOException ignored) {} } return false; @@ -217,9 +208,9 @@ public class YAMLProcessor extends YAMLNode { private void read(Object input) throws YAMLProcessorException { try { if (null == input) { - root = new LinkedHashMap(); + root = new LinkedHashMap<>(); } else { - root = new LinkedHashMap((Map) input); + root = new LinkedHashMap<>((Map) input); } } catch (ClassCastException e) { throw new YAMLProcessorException("Root document must be an key-value structure"); @@ -302,7 +293,7 @@ public class YAMLProcessor extends YAMLNode { * @return a node */ public static YAMLNode getEmptyNode(boolean writeDefaults) { - return new YAMLNode(new LinkedHashMap(), writeDefaults); + return new YAMLNode(new LinkedHashMap<>(), writeDefaults); } // This will be included in snakeyaml 1.10, but until then we have to do it manually. @@ -321,12 +312,7 @@ public class YAMLProcessor extends YAMLNode { private static class FancyRepresenter extends Representer { private FancyRepresenter() { - this.nullRepresenter = new Represent() { - @Override - public Node representData(Object o) { - return representScalar(Tag.NULL, ""); - } - }; + this.nullRepresenter = o -> representScalar(Tag.NULL, ""); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector.java index 474d24f33..c444d80d1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector.java @@ -73,6 +73,11 @@ public class BlockVector extends Vector { super(x, y, z); } + @Override + public int hashCode() { + return ((int) x ^ ((int) z << 12)) ^ ((int) y << 24); + } + @Override public boolean equals(Object obj) { if (!(obj instanceof Vector)) { @@ -84,13 +89,6 @@ public class BlockVector extends Vector { } - @Override - public int hashCode() { - return ((int) x << 19) ^ - ((int) y << 12) ^ - (int) z; - } - @Override public BlockVector toBlockVector() { return this; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector2D.java index 9a0ae4b91..07d54430b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector2D.java @@ -69,6 +69,11 @@ public class BlockVector2D extends Vector2D { super(x, z); } + @Override + public int hashCode() { + return ((int) x << 16) ^ (int) z; + } + @Override public boolean equals(Object obj) { if (!(obj instanceof Vector2D)) { @@ -80,12 +85,6 @@ public class BlockVector2D extends Vector2D { } - @Override - public int hashCode() { - return (Integer.valueOf((int) x).hashCode() >> 13) ^ - Integer.valueOf((int) z).hashCode(); - } - @Override public BlockVector2D toBlockVector2D() { return this; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockWorldVector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/BlockWorldVector.java deleted file mode 100644 index 4fcc70624..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockWorldVector.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -/** - * @deprecated Replace all uses of {@link WorldVector}s with {@link Location}s - */ -@SuppressWarnings("deprecation") -@Deprecated -public class BlockWorldVector extends WorldVector { - - /** - * Construct an instance from another instance. - * - * @param position the position to copy - */ - public BlockWorldVector(WorldVector position) { - super(position.getWorld(), position); - } - - /** - * Construct an instance from another instance. - * - * @param world the world - * @param position the position to copy - */ - public BlockWorldVector(LocalWorld world, Vector position) { - super(world, position); - } - - /** - * Construct a new instance. - * - * @param world another instance - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public BlockWorldVector(WorldVector world, int x, int y, int z) { - super(world.getWorld(), x, y, z); - } - - /** - * Construct a new instance. - * - * @param world another instance - * @param v the other vector - */ - public BlockWorldVector(WorldVector world, Vector v) { - super(world.getWorld(), v.getX(), v.getY(), v.getZ()); - } - - /** - * Construct a new instance. - * - * @param world a world - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public BlockWorldVector(LocalWorld world, int x, int y, int z) { - super(world, x, y, z); - } - - /** - * Construct a new instance. - * - * @param world a world - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public BlockWorldVector(LocalWorld world, float x, float y, float z) { - super(world, x, y, z); - } - - /** - * Construct a new instance. - * - * @param world a world - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public BlockWorldVector(LocalWorld world, double x, double y, double z) { - super(world, x, y, z); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Vector)) { - return false; - } - Vector other = (Vector) obj; - return (int) other.getX() == (int) this.x && (int) other.getY() == (int) this.y - && (int) other.getZ() == (int) this.z; - - } - - @Override - public int hashCode() { - return (Integer.valueOf((int) x).hashCode() << 19) ^ - (Integer.valueOf((int) y).hashCode() << 12) ^ - Integer.valueOf((int) z).hashCode(); - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockWorldVector2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/BlockWorldVector2D.java deleted file mode 100644 index 70289f8f2..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/BlockWorldVector2D.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -/** - * @deprecated Replace all uses of {@link WorldVector}s with {@link Location}s - */ -@SuppressWarnings("deprecation") -@Deprecated -public class BlockWorldVector2D extends WorldVector2D { - - /** - * Construct a new instance. - * - * @param world the world - * @param x the X coordinate - * @param z the Z coordinate - */ - public BlockWorldVector2D(LocalWorld world, double x, double z) { - super(world, x, z); - } - - /** - * Construct a new instance. - * - * @param world the world - * @param x the X coordinate - * @param z the Z coordinate - */ - public BlockWorldVector2D(LocalWorld world, float x, float z) { - super(world, x, z); - } - - /** - * Construct a new instance. - * - * @param world the world - * @param x the X coordinate - * @param z the Z coordinate - */ - public BlockWorldVector2D(LocalWorld world, int x, int z) { - super(world, x, z); - } - - /** - * Construct a new instance. - * - * @param world the world - * @param position a position - */ - public BlockWorldVector2D(LocalWorld world, Vector2D position) { - super(world, position); - } - - /** - * Construct a new instance with X and Z set to (0, 0). - * - * @param world the world - */ - public BlockWorldVector2D(LocalWorld world) { - super(world); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof WorldVector2D)) { - return false; - } - WorldVector2D other = (WorldVector2D) obj; - return other.getWorld().equals(world) - && (int) other.getX() == (int) this.x - && (int) other.getZ() == (int) this.z; - - } - - @Override - public int hashCode() { - int result = super.hashCode(); - long temp; - result = 31 * result + world.hashCode(); - temp = Double.doubleToLongBits(x); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(z); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - return result; - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/CuboidClipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/CuboidClipboard.java deleted file mode 100644 index 17c5149d3..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/CuboidClipboard.java +++ /dev/null @@ -1,695 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; -import com.sk89q.worldedit.command.ClipboardCommands; -import com.sk89q.worldedit.command.SchematicCommands; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.function.operation.ForwardExtentCopy; -import com.sk89q.worldedit.regions.CuboidRegion; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.schematic.SchematicFormat; -import com.sk89q.worldedit.util.Countable; -import com.sk89q.worldedit.world.DataException; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * The clipboard remembers the state of a cuboid region. - * - * @deprecated This is slowly being replaced with {@link Clipboard}, which is - * far more versatile. Transforms are supported using affine - * transformations and full entity support is provided because - * the clipboard properly implements {@link Extent}. However, - * the new clipboard class is only available in WorldEdit 6.x and - * beyond. We intend on keeping this deprecated class in WorldEdit - * for an extended amount of time so there is no rush to - * switch (but new features will not be supported). To copy between - * a clipboard and a world (or between any two {@code Extent}s), - * one can use {@link ForwardExtentCopy}. See - * {@link ClipboardCommands} and {@link SchematicCommands} for - * more information. - */ -@Deprecated -public class CuboidClipboard { - - /** - * An enum of possible flip directions. - */ - public enum FlipDirection { - NORTH_SOUTH, - WEST_EAST, - UP_DOWN - } - - private BaseBlock[][][] data; - private Vector offset; - private Vector origin; - private Vector size; - private List entities = new ArrayList(); - - /** - * Constructs the clipboard. - * - * @param size the dimensions of the clipboard (should be at least 1 on every dimension) - */ - public CuboidClipboard(Vector size) { - checkNotNull(size); - - this.size = size; - data = new BaseBlock[size.getBlockX()][size.getBlockY()][size.getBlockZ()]; - origin = new Vector(); - offset = new Vector(); - } - - /** - * Constructs the clipboard. - * - * @param size the dimensions of the clipboard (should be at least 1 on every dimension) - * @param origin the origin point where the copy was made, which must be the - * {@link CuboidRegion#getMinimumPoint()} relative to the copy - */ - public CuboidClipboard(Vector size, Vector origin) { - checkNotNull(size); - checkNotNull(origin); - - this.size = size; - data = new BaseBlock[size.getBlockX()][size.getBlockY()][size.getBlockZ()]; - this.origin = origin; - offset = new Vector(); - } - - /** - * Constructs the clipboard. - * - * @param size the dimensions of the clipboard (should be at least 1 on every dimension) - * @param origin the origin point where the copy was made, which must be the - * {@link CuboidRegion#getMinimumPoint()} relative to the copy - * @param offset the offset from the minimum point of the copy where the user was - */ - public CuboidClipboard(Vector size, Vector origin, Vector offset) { - checkNotNull(size); - checkNotNull(origin); - checkNotNull(offset); - - this.size = size; - data = new BaseBlock[size.getBlockX()][size.getBlockY()][size.getBlockZ()]; - this.origin = origin; - this.offset = offset; - } - - /** - * Get the width (X-direction) of the clipboard. - * - * @return width - */ - public int getWidth() { - return size.getBlockX(); - } - - /** - * Get the length (Z-direction) of the clipboard. - * - * @return length - */ - public int getLength() { - return size.getBlockZ(); - } - - /** - * Get the height (Y-direction) of the clipboard. - * - * @return height - */ - public int getHeight() { - return size.getBlockY(); - } - - /** - * Rotate the clipboard in 2D. It can only rotate by angles divisible by 90. - * - * @param angle in degrees - */ - @SuppressWarnings("deprecation") - public void rotate2D(int angle) { - angle = angle % 360; - if (angle % 90 != 0) { // Can only rotate 90 degrees at the moment - return; - } - final boolean reverse = angle < 0; - final int numRotations = Math.abs((int) Math.floor(angle / 90.0)); - - final int width = getWidth(); - final int length = getLength(); - final int height = getHeight(); - final Vector sizeRotated = size.transform2D(angle, 0, 0, 0, 0); - final int shiftX = sizeRotated.getX() < 0 ? -sizeRotated.getBlockX() - 1 : 0; - final int shiftZ = sizeRotated.getZ() < 0 ? -sizeRotated.getBlockZ() - 1 : 0; - - final BaseBlock[][][] newData = new BaseBlock - [Math.abs(sizeRotated.getBlockX())] - [Math.abs(sizeRotated.getBlockY())] - [Math.abs(sizeRotated.getBlockZ())]; - - for (int x = 0; x < width; ++x) { - for (int z = 0; z < length; ++z) { - final Vector2D v = new Vector2D(x, z).transform2D(angle, 0, 0, shiftX, shiftZ); - final int newX = v.getBlockX(); - final int newZ = v.getBlockZ(); - for (int y = 0; y < height; ++y) { - final BaseBlock block = data[x][y][z]; - newData[newX][y][newZ] = block; - - if (block == null) { - continue; - } - - if (reverse) { - for (int i = 0; i < numRotations; ++i) { - block.rotate90Reverse(); - } - } else { - for (int i = 0; i < numRotations; ++i) { - block.rotate90(); - } - } - } - } - } - - data = newData; - size = new Vector(Math.abs(sizeRotated.getBlockX()), - Math.abs(sizeRotated.getBlockY()), - Math.abs(sizeRotated.getBlockZ())); - offset = offset.transform2D(angle, 0, 0, 0, 0) - .subtract(shiftX, 0, shiftZ); - } - - /** - * Flip the clipboard. - * - * @param dir direction to flip - */ - public void flip(FlipDirection dir) { - flip(dir, false); - } - - /** - * Flip the clipboard. - * - * @param dir direction to flip - * @param aroundPlayer flip the offset around the player - */ - @SuppressWarnings("deprecation") - public void flip(FlipDirection dir, boolean aroundPlayer) { - checkNotNull(dir); - - final int width = getWidth(); - final int length = getLength(); - final int height = getHeight(); - - switch (dir) { - case WEST_EAST: - final int wid = (int) Math.ceil(width / 2.0f); - for (int xs = 0; xs < wid; ++xs) { - for (int z = 0; z < length; ++z) { - for (int y = 0; y < height; ++y) { - final BaseBlock block1 = data[xs][y][z]; - if (block1 != null) { - block1.flip(dir); - } - - // Skip the center plane - if (xs == width - xs - 1) { - continue; - } - - final BaseBlock block2 = data[width - xs - 1][y][z]; - if (block2 != null) { - block2.flip(dir); - } - - data[xs][y][z] = block2; - data[width - xs - 1][y][z] = block1; - } - } - } - - if (aroundPlayer) { - offset = offset.setX(1 - offset.getX() - width); - } - - break; - - case NORTH_SOUTH: - final int len = (int) Math.ceil(length / 2.0f); - for (int zs = 0; zs < len; ++zs) { - for (int x = 0; x < width; ++x) { - for (int y = 0; y < height; ++y) { - final BaseBlock block1 = data[x][y][zs]; - if (block1 != null) { - block1.flip(dir); - } - - // Skip the center plane - if (zs == length - zs - 1) { - continue; - } - - final BaseBlock block2 = data[x][y][length - zs - 1]; - if (block2 != null) { - block2.flip(dir); - } - - data[x][y][zs] = block2; - data[x][y][length - zs - 1] = block1; - } - } - } - - if (aroundPlayer) { - offset = offset.setZ(1 - offset.getZ() - length); - } - - break; - - case UP_DOWN: - final int hei = (int) Math.ceil(height / 2.0f); - for (int ys = 0; ys < hei; ++ys) { - for (int x = 0; x < width; ++x) { - for (int z = 0; z < length; ++z) { - final BaseBlock block1 = data[x][ys][z]; - if (block1 != null) { - block1.flip(dir); - } - - // Skip the center plane - if (ys == height - ys - 1) { - continue; - } - - final BaseBlock block2 = data[x][height - ys - 1][z]; - if (block2 != null) { - block2.flip(dir); - } - - data[x][ys][z] = block2; - data[x][height - ys - 1][z] = block1; - } - } - } - - if (aroundPlayer) { - offset = offset.setY(1 - offset.getY() - height); - } - - break; - } - } - - /** - * Copies blocks to the clipboard. - * - * @param editSession the EditSession from which to take the blocks - */ - public void copy(EditSession editSession) { - for (int x = 0; x < size.getBlockX(); ++x) { - for (int y = 0; y < size.getBlockY(); ++y) { - for (int z = 0; z < size.getBlockZ(); ++z) { - data[x][y][z] = - editSession.getBlock(new Vector(x, y, z).add(getOrigin())); - } - } - } - } - - /** - * Copies blocks to the clipboard. - * - * @param editSession The EditSession from which to take the blocks - * @param region A region that further constrains which blocks to take. - */ - public void copy(EditSession editSession, Region region) { - for (int x = 0; x < size.getBlockX(); ++x) { - for (int y = 0; y < size.getBlockY(); ++y) { - for (int z = 0; z < size.getBlockZ(); ++z) { - final Vector pt = new Vector(x, y, z).add(getOrigin()); - if (region.contains(pt)) { - data[x][y][z] = editSession.getBlock(pt); - } else { - data[x][y][z] = null; - } - } - } - } - } - - /** - * Paste the clipboard at the given location using the given {@code EditSession}. - * - *

This method blocks the server/game until the entire clipboard is - * pasted. In the future, {@link ForwardExtentCopy} will be recommended, - * which, if combined with the proposed operation scheduler framework, - * will not freeze the game/server.

- * - * @param editSession the EditSession to which blocks are to be copied to - * @param newOrigin the new origin point (must correspond to the minimum point of the cuboid) - * @param noAir true to not copy air blocks in the source - * @throws MaxChangedBlocksException thrown if too many blocks were changed - */ - public void paste(EditSession editSession, Vector newOrigin, boolean noAir) throws MaxChangedBlocksException { - paste(editSession, newOrigin, noAir, false); - } - - /** - * Paste the clipboard at the given location using the given {@code EditSession}. - * - *

This method blocks the server/game until the entire clipboard is - * pasted. In the future, {@link ForwardExtentCopy} will be recommended, - * which, if combined with the proposed operation scheduler framework, - * will not freeze the game/server.

- * - * @param editSession the EditSession to which blocks are to be copied to - * @param newOrigin the new origin point (must correspond to the minimum point of the cuboid) - * @param noAir true to not copy air blocks in the source - * @param entities true to copy entities - * @throws MaxChangedBlocksException thrown if too many blocks were changed - */ - public void paste(EditSession editSession, Vector newOrigin, boolean noAir, boolean entities) throws MaxChangedBlocksException { - place(editSession, newOrigin.add(offset), noAir); - if (entities) { - pasteEntities(newOrigin.add(offset)); - } - } - - /** - * Paste the clipboard at the given location using the given {@code EditSession}. - * - *

This method blocks the server/game until the entire clipboard is - * pasted. In the future, {@link ForwardExtentCopy} will be recommended, - * which, if combined with the proposed operation scheduler framework, - * will not freeze the game/server.

- * - * @param editSession the EditSession to which blocks are to be copied to - * @param newOrigin the new origin point (must correspond to the minimum point of the cuboid) - * @param noAir true to not copy air blocks in the source - * @throws MaxChangedBlocksException thrown if too many blocks were changed - */ - public void place(EditSession editSession, Vector newOrigin, boolean noAir) throws MaxChangedBlocksException { - for (int x = 0; x < size.getBlockX(); ++x) { - for (int y = 0; y < size.getBlockY(); ++y) { - for (int z = 0; z < size.getBlockZ(); ++z) { - final BaseBlock block = data[x][y][z]; - if (block == null) { - continue; - } - - if (noAir && block.isAir()) { - continue; - } - - editSession.setBlock(new Vector(x, y, z).add(newOrigin), block); - } - } - } - } - - /** - * Paste the stored entities to the given position. - * - * @param newOrigin the new origin - * @return a list of entities that were pasted - */ - public LocalEntity[] pasteEntities(Vector newOrigin) { - LocalEntity[] entities = new LocalEntity[this.entities.size()]; - for (int i = 0; i < this.entities.size(); ++i) { - CopiedEntity copied = this.entities.get(i); - if (copied.entity.spawn(copied.entity.getPosition().setPosition(copied.relativePosition.add(newOrigin)))) { - entities[i] = copied.entity; - } - } - return entities; - } - - /** - * Store an entity. - * - * @param entity the entity - */ - public void storeEntity(LocalEntity entity) { - this.entities.add(new CopiedEntity(entity)); - } - - /** - * Get the block at the given position. - * - *

If the position is out of bounds, air will be returned.

- * - * @param position the point, relative to the origin of the copy (0, 0, 0) and not to the actual copy origin - * @return air, if this block was outside the (non-cuboid) selection while copying - * @throws ArrayIndexOutOfBoundsException if the position is outside the bounds of the CuboidClipboard - * @deprecated use {@link #getBlock(Vector)} instead - */ - @Deprecated - public BaseBlock getPoint(Vector position) throws ArrayIndexOutOfBoundsException { - final BaseBlock block = getBlock(position); - if (block == null) { - return new BaseBlock(BlockID.AIR); - } - - return block; - } - - /** - * Get the block at the given position. - * - *

If the position is out of bounds, air will be returned.

- * - * @param position the point, relative to the origin of the copy (0, 0, 0) and not to the actual copy origin - * @return null, if this block was outside the (non-cuboid) selection while copying - * @throws ArrayIndexOutOfBoundsException if the position is outside the bounds of the CuboidClipboard - */ - public BaseBlock getBlock(Vector position) throws ArrayIndexOutOfBoundsException { - return data[position.getBlockX()][position.getBlockY()][position.getBlockZ()]; - } - - /** - * Set the block at a position in the clipboard. - * - * @param position the point, relative to the origin of the copy (0, 0, 0) and not to the actual copy origin. - * @param block the block to set - * @throws ArrayIndexOutOfBoundsException if the position is outside the bounds of the CuboidClipboard - */ - public void setBlock(Vector position, BaseBlock block) { - data[position.getBlockX()][position.getBlockY()][position.getBlockZ()] = block; - } - - /** - * Get the dimensions of the clipboard. - * - * @return the dimensions, where (1, 1, 1) is 1 wide, 1 across, 1 deep - */ - public Vector getSize() { - return size; - } - - /** - * Saves the clipboard data to a .schematic-format file. - * - * @param path the path to the file to save - * @throws IOException thrown on I/O error - * @throws DataException thrown on error writing the data for other reasons - * @deprecated use {@link SchematicFormat#MCEDIT} - */ - @Deprecated - public void saveSchematic(File path) throws IOException, DataException { - checkNotNull(path); - SchematicFormat.MCEDIT.save(this, path); - } - - /** - * Load a .schematic file into a clipboard. - * - * @param path the path to the file to load - * @return a clipboard - * @throws IOException thrown on I/O error - * @throws DataException thrown on error writing the data for other reasons - * @deprecated use {@link SchematicFormat#MCEDIT} - */ - @Deprecated - public static CuboidClipboard loadSchematic(File path) throws DataException, IOException { - checkNotNull(path); - return SchematicFormat.MCEDIT.load(path); - } - - /** - * Get the origin point, which corresponds to where the copy was - * originally copied from. The origin is the lowest possible X, Y, and - * Z components of the cuboid region that was copied. - * - * @return the origin - */ - public Vector getOrigin() { - return origin; - } - - /** - * Set the origin point, which corresponds to where the copy was - * originally copied from. The origin is the lowest possible X, Y, and - * Z components of the cuboid region that was copied. - * - * @param origin the origin to set - */ - public void setOrigin(Vector origin) { - checkNotNull(origin); - this.origin = origin; - } - - /** - * Get the offset of the player to the clipboard's minimum point - * (minimum X, Y, Z coordinates). - * - *

The offset is inverse (multiplied by -1).

- * - * @return the offset the offset - */ - public Vector getOffset() { - return offset; - } - - /** - * Set the offset of the player to the clipboard's minimum point - * (minimum X, Y, Z coordinates). - * - *

The offset is inverse (multiplied by -1).

- * - * @param offset the new offset - */ - public void setOffset(Vector offset) { - this.offset = offset; - } - - /** - * Get the block distribution inside a clipboard. - * - * @return a block distribution - */ - public List> getBlockDistribution() { - List> distribution = new ArrayList>(); - Map> map = new HashMap>(); - - int maxX = getWidth(); - int maxY = getHeight(); - int maxZ = getLength(); - - for (int x = 0; x < maxX; ++x) { - for (int y = 0; y < maxY; ++y) { - for (int z = 0; z < maxZ; ++z) { - final BaseBlock block = data[x][y][z]; - if (block == null) { - continue; - } - - int id = block.getId(); - - if (map.containsKey(id)) { - map.get(id).increment(); - } else { - Countable c = new Countable(id, 1); - map.put(id, c); - distribution.add(c); - } - } - } - } - - Collections.sort(distribution); - // Collections.reverse(distribution); - - return distribution; - } - - /** - * Get the block distribution inside a clipboard with data values. - * - * @return a block distribution - */ - // TODO reduce code duplication - public List> getBlockDistributionWithData() { - List> distribution = new ArrayList>(); - Map> map = new HashMap>(); - - int maxX = getWidth(); - int maxY = getHeight(); - int maxZ = getLength(); - - for (int x = 0; x < maxX; ++x) { - for (int y = 0; y < maxY; ++y) { - for (int z = 0; z < maxZ; ++z) { - final BaseBlock block = data[x][y][z]; - if (block == null) { - continue; - } - - // Strip the block from metadata that is not part of our key - final BaseBlock bareBlock = new BaseBlock(block.getId(), block.getData()); - - if (map.containsKey(bareBlock)) { - map.get(bareBlock).increment(); - } else { - Countable c = new Countable(bareBlock, 1); - map.put(bareBlock, c); - distribution.add(c); - } - } - } - } - - Collections.sort(distribution); - // Collections.reverse(distribution); - - return distribution; - } - - /** - * Stores a copied entity. - */ - private class CopiedEntity { - private final LocalEntity entity; - private final Vector relativePosition; - - private CopiedEntity(LocalEntity entity) { - this.entity = entity; - this.relativePosition = entity.getPosition().getPosition().subtract(getOrigin()); - } - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index abb4f4909..1984abf94 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -19,9 +19,13 @@ package com.sk89q.worldedit; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; -import com.sk89q.worldedit.blocks.BlockType; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.regions.Regions.asFlatRegion; +import static com.sk89q.worldedit.regions.Regions.maximumBlockY; +import static com.sk89q.worldedit.regions.Regions.minimumBlockY; + +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.event.extent.EditSessionEvent; @@ -46,46 +50,77 @@ import com.sk89q.worldedit.function.block.BlockReplace; import com.sk89q.worldedit.function.block.Counter; import com.sk89q.worldedit.function.block.Naturalizer; import com.sk89q.worldedit.function.generator.GardenPatchGenerator; -import com.sk89q.worldedit.function.mask.*; -import com.sk89q.worldedit.function.operation.*; +import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.mask.BoundedHeightMask; +import com.sk89q.worldedit.function.mask.ExistingBlockMask; +import com.sk89q.worldedit.function.mask.FuzzyBlockMask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.MaskIntersection; +import com.sk89q.worldedit.function.mask.MaskUnion; +import com.sk89q.worldedit.function.mask.Masks; +import com.sk89q.worldedit.function.mask.NoiseFilter2D; +import com.sk89q.worldedit.function.mask.RegionMask; +import com.sk89q.worldedit.function.operation.ChangeSetExecutor; +import com.sk89q.worldedit.function.operation.ForwardExtentCopy; +import com.sk89q.worldedit.function.operation.Operation; +import com.sk89q.worldedit.function.operation.OperationQueue; +import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.BlockPattern; -import com.sk89q.worldedit.function.pattern.Patterns; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.util.RegionOffset; -import com.sk89q.worldedit.function.visitor.*; +import com.sk89q.worldedit.function.visitor.DownwardVisitor; +import com.sk89q.worldedit.function.visitor.LayerVisitor; +import com.sk89q.worldedit.function.visitor.NonRisingVisitor; +import com.sk89q.worldedit.function.visitor.RecursiveVisitor; +import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.history.UndoContext; -import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.history.changeset.BlockOptimizedHistory; import com.sk89q.worldedit.history.changeset.ChangeSet; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.runtime.RValue; +import com.sk89q.worldedit.math.MathUtils; import com.sk89q.worldedit.math.interpolation.Interpolation; import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation; import com.sk89q.worldedit.math.interpolation.Node; import com.sk89q.worldedit.math.noise.RandomNoise; import com.sk89q.worldedit.math.transform.AffineTransform; -import com.sk89q.worldedit.patterns.Pattern; -import com.sk89q.worldedit.patterns.SingleBlockPattern; -import com.sk89q.worldedit.regions.*; +import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.regions.EllipsoidRegion; +import com.sk89q.worldedit.regions.FlatRegion; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.regions.Regions; import com.sk89q.worldedit.regions.shape.ArbitraryBiomeShape; import com.sk89q.worldedit.regions.shape.ArbitraryShape; import com.sk89q.worldedit.regions.shape.RegionShape; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; -import com.sk89q.worldedit.util.*; +import com.sk89q.worldedit.util.Countable; +import com.sk89q.worldedit.util.Direction; +import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.collection.DoubleArrayList; import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.world.NullWorld; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BlockCategories; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; -import javax.annotation.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.regions.Regions.*; +import javax.annotation.Nullable; /** * An {@link Extent} that handles history, {@link BlockBag}s, change limits, @@ -95,13 +130,13 @@ import static com.sk89q.worldedit.regions.Regions.*; * {@link Extent}s that are chained together. For example, history is logged * using the {@link ChangeSetExtent}.

*/ -@SuppressWarnings({"FieldCanBeLocal", "deprecation"}) +@SuppressWarnings({"FieldCanBeLocal"}) public class EditSession implements Extent { private static final Logger log = Logger.getLogger(EditSession.class.getCanonicalName()); /** - * Used by {@link #setBlock(Vector, BaseBlock, Stage)} to + * Used by {@link #setBlock(Vector, BlockStateHolder, Stage)} to * determine which {@link Extent}s should be bypassed. */ public enum Stage { @@ -130,35 +165,8 @@ public class EditSession implements Extent { private final Extent bypassHistory; private final Extent bypassNone; - @SuppressWarnings("deprecation") private Mask oldMask; - /** - * Create a new instance. - * - * @param world a world - * @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit - * @deprecated use {@link WorldEdit#getEditSessionFactory()} to create {@link EditSession}s - */ - @SuppressWarnings("deprecation") - @Deprecated - public EditSession(LocalWorld world, int maxBlocks) { - this(world, maxBlocks, null); - } - - /** - * Create a new instance. - * - * @param world a world - * @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit - * @param blockBag the block bag to set, or null to use none - * @deprecated use {@link WorldEdit#getEditSessionFactory()} to create {@link EditSession}s - */ - @Deprecated - public EditSession(LocalWorld world, int maxBlocks, @Nullable BlockBag blockBag) { - this(WorldEdit.getInstance().getEventBus(), world, maxBlocks, blockBag, new EditSessionEvent(world, null, maxBlocks, null)); - } - /** * Construct the object with a maximum number of blocks and a block bag. * @@ -307,21 +315,6 @@ public class EditSession implements Extent { } } - /** - * Set the mask. - * - * @param mask the mask - * @deprecated Use {@link #setMask(Mask)} - */ - @Deprecated - public void setMask(com.sk89q.worldedit.masks.Mask mask) { - if (mask == null) { - setMask((Mask) null); - } else { - setMask(Masks.wrap(mask)); - } - } - /** * Get the {@link SurvivalModeExtent}. * @@ -381,7 +374,7 @@ public class EditSession implements Extent { * * @return a map of missing blocks */ - public Map popMissingBlocks() { + public Map popMissingBlocks() { return blockBagExtent.popMissing(); } @@ -407,80 +400,29 @@ public class EditSession implements Extent { } @Override - public BaseBlock getLazyBlock(Vector position) { - return world.getLazyBlock(position); - } - - @Override - public BaseBlock getBlock(Vector position) { + public BlockState getBlock(Vector position) { return world.getBlock(position); } - /** - * Get a block type at the given position. - * - * @param position the position - * @return the block type - * @deprecated Use {@link #getLazyBlock(Vector)} or {@link #getBlock(Vector)} - */ - @Deprecated - public int getBlockType(Vector position) { - return world.getBlockType(position); + @Override + public BaseBlock getFullBlock(Vector position) { + return world.getFullBlock(position); } /** - * Get a block data at the given position. - * - * @param position the position - * @return the block data - * @deprecated Use {@link #getLazyBlock(Vector)} or {@link #getBlock(Vector)} - */ - @Deprecated - public int getBlockData(Vector position) { - return world.getBlockData(position); - } - - /** - * Gets the block type at a position. - * - * @param position the position - * @return a block - * @deprecated Use {@link #getBlock(Vector)} - */ - @Deprecated - public BaseBlock rawGetBlock(Vector position) { - return getBlock(position); - } - - /** - * Returns the highest solid 'terrain' block which can occur naturally. - * - * @param x the X coordinate - * @param z the Z cooridnate - * @param minY minimal height - * @param maxY maximal height - * @return height of highest block found or 'minY' - */ - public int getHighestTerrainBlock(int x, int z, int minY, int maxY) { - return getHighestTerrainBlock(x, z, minY, maxY, false); - } - - /** - * Returns the highest solid 'terrain' block which can occur naturally. + * Returns the highest solid 'terrain' block. * * @param x the X coordinate * @param z the Z coordinate * @param minY minimal height * @param maxY maximal height - * @param naturalOnly look at natural blocks or all blocks * @return height of highest block found or 'minY' */ - public int getHighestTerrainBlock(int x, int z, int minY, int maxY, boolean naturalOnly) { + public int getHighestTerrainBlock(int x, int z, int minY, int maxY) { for (int y = maxY; y >= minY; --y) { Vector pt = new Vector(x, y, z); - int id = getBlockType(pt); - int data = getBlockData(pt); - if (naturalOnly ? BlockType.isNaturalTerrainBlock(id, data) : !BlockType.canPassThrough(id, data)) { + BlockState block = getBlock(pt); + if (block.getBlockType().getMaterial().isMovementBlocker()) { return y; } } @@ -497,7 +439,7 @@ public class EditSession implements Extent { * @return whether the block changed * @throws WorldEditException thrown on a set error */ - public boolean setBlock(Vector position, BaseBlock block, Stage stage) throws WorldEditException { + public boolean setBlock(Vector position, BlockStateHolder block, Stage stage) throws WorldEditException { switch (stage) { case BEFORE_HISTORY: return bypassNone.setBlock(position, block); @@ -517,7 +459,7 @@ public class EditSession implements Extent { * @param block the block * @return whether the block changed */ - public boolean rawSetBlock(Vector position, BaseBlock block) { + public boolean rawSetBlock(Vector position, BlockStateHolder block) { try { return setBlock(position, block, Stage.BEFORE_CHANGE); } catch (WorldEditException e) { @@ -532,7 +474,7 @@ public class EditSession implements Extent { * @param block the block * @return whether the block changed */ - public boolean smartSetBlock(Vector position, BaseBlock block) { + public boolean smartSetBlock(Vector position, BlockStateHolder block) { try { return setBlock(position, block, Stage.BEFORE_REORDER); } catch (WorldEditException e) { @@ -541,7 +483,7 @@ public class EditSession implements Extent { } @Override - public boolean setBlock(Vector position, BaseBlock block) throws MaxChangedBlocksException { + public boolean setBlock(Vector position, BlockStateHolder block) throws MaxChangedBlocksException { try { return setBlock(position, block, Stage.BEFORE_HISTORY); } catch (MaxChangedBlocksException e) { @@ -559,9 +501,8 @@ public class EditSession implements Extent { * @return Whether the block changed -- not entirely dependable * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public boolean setBlock(Vector position, Pattern pattern) throws MaxChangedBlocksException { - return setBlock(position, pattern.next(position)); + return setBlock(position, pattern.apply(position)); } /** @@ -573,7 +514,6 @@ public class EditSession implements Extent { * @return the number of changed blocks * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") private int setBlocks(Set vset, Pattern pattern) throws MaxChangedBlocksException { int affected = 0; for (Vector v : vset) { @@ -582,55 +522,12 @@ public class EditSession implements Extent { return affected; } - /** - * Set a block (only if a previous block was not there) if {@link Math#random()} - * returns a number less than the given probability. - * - * @param position the position - * @param block the block - * @param probability a probability between 0 and 1, inclusive - * @return whether a block was changed - * @throws MaxChangedBlocksException thrown if too many blocks are changed - */ - @SuppressWarnings("deprecation") - public boolean setChanceBlockIfAir(Vector position, BaseBlock block, double probability) - throws MaxChangedBlocksException { - return Math.random() <= probability && setBlockIfAir(position, block); - } - - /** - * Set a block only if there's no block already there. - * - * @param position the position - * @param block the block to set - * @return if block was changed - * @throws MaxChangedBlocksException thrown if too many blocks are changed - * @deprecated Use your own method - */ - @Deprecated - public boolean setBlockIfAir(Vector position, BaseBlock block) throws MaxChangedBlocksException { - return getBlock(position).isAir() && setBlock(position, block); - } - @Override @Nullable public Entity createEntity(com.sk89q.worldedit.util.Location location, BaseEntity entity) { return bypassNone.createEntity(location, entity); } - /** - * Insert a contrived block change into the history. - * - * @param position the position - * @param existing the previous block at that position - * @param block the new block - * @deprecated Get the change set with {@link #getChangeSet()} and add the change with that - */ - @Deprecated - public void rememberChange(Vector position, BaseBlock existing, BaseBlock block) { - changeSet.add(new BlockChange(position.toBlockVector(), existing, block)); - } - /** * Restores all blocks to their initial state. * @@ -696,21 +593,6 @@ public class EditSession implements Extent { return bypassNone.commit(); } - /** - * Count the number of blocks of a given list of types in a region. - * - * @param region the region - * @param searchIDs a list of IDs to search - * @return the number of found blocks - */ - public int countBlock(Region region, Set searchIDs) { - Set passOn = new HashSet(); - for (Integer i : searchIDs) { - passOn.add(new BaseBlock(i, -1)); - } - return countBlocks(region, passOn); - } - /** * Count the number of blocks of a list of types in a region. * @@ -718,7 +600,7 @@ public class EditSession implements Extent { * @param searchBlocks the list of blocks to search * @return the number of blocks that matched the pattern */ - public int countBlocks(Region region, Set searchBlocks) { + public int countBlocks(Region region, Set searchBlocks) { FuzzyBlockMask mask = new FuzzyBlockMask(this, searchBlocks); Counter count = new Counter(); RegionMaskingFilter filter = new RegionMaskingFilter(mask, count); @@ -738,10 +620,8 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") - public int fillXZ(Vector origin, BaseBlock block, double radius, int depth, boolean recursive) - throws MaxChangedBlocksException { - return fillXZ(origin, new SingleBlockPattern(block), radius, depth, recursive); + public int fillXZ(Vector origin, BlockStateHolder block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException { + return fillXZ(origin, new BlockPattern(block), radius, depth, recursive); } /** @@ -755,7 +635,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int fillXZ(Vector origin, Pattern pattern, double radius, int depth, boolean recursive) throws MaxChangedBlocksException { checkNotNull(origin); checkNotNull(pattern); @@ -770,7 +649,7 @@ public class EditSession implements Extent { Masks.negate(new ExistingBlockMask(this))); // Want to replace blocks - BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); + BlockReplace replace = new BlockReplace(this, pattern); // Pick how we're going to visit blocks RecursiveVisitor visitor; @@ -798,7 +677,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int removeAbove(Vector position, int apothem, int height) throws MaxChangedBlocksException { checkNotNull(position); checkArgument(apothem >= 1, "apothem >= 1"); @@ -808,7 +686,7 @@ public class EditSession implements Extent { getWorld(), // Causes clamping of Y range position.add(-apothem + 1, 0, -apothem + 1), position.add(apothem - 1, height - 1, apothem - 1)); - Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR)); + Pattern pattern = new BlockPattern(BlockTypes.AIR.getDefaultState()); return setBlocks(region, pattern); } @@ -821,7 +699,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int removeBelow(Vector position, int apothem, int height) throws MaxChangedBlocksException { checkNotNull(position); checkArgument(apothem >= 1, "apothem >= 1"); @@ -831,7 +708,7 @@ public class EditSession implements Extent { getWorld(), // Causes clamping of Y range position.add(-apothem + 1, 0, -apothem + 1), position.add(apothem - 1, -height + 1, apothem - 1)); - Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR)); + Pattern pattern = new BlockPattern(BlockTypes.AIR.getDefaultState()); return setBlocks(region, pattern); } @@ -844,18 +721,17 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") - public int removeNear(Vector position, int blockType, int apothem) throws MaxChangedBlocksException { + public int removeNear(Vector position, BlockType blockType, int apothem) throws MaxChangedBlocksException { checkNotNull(position); checkArgument(apothem >= 1, "apothem >= 1"); - Mask mask = new FuzzyBlockMask(this, new BaseBlock(blockType, -1)); + Mask mask = new FuzzyBlockMask(this, blockType.getDefaultState().toFuzzy()); Vector adjustment = new Vector(1, 1, 1).multiply(apothem - 1); Region region = new CuboidRegion( getWorld(), // Causes clamping of Y range position.add(adjustment.multiply(-1)), position.add(adjustment)); - Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR)); + Pattern pattern = new BlockPattern(BlockTypes.AIR.getDefaultState()); return replaceBlocks(region, mask, pattern); } @@ -867,9 +743,8 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") - public int setBlocks(Region region, BaseBlock block) throws MaxChangedBlocksException { - return setBlocks(region, new SingleBlockPattern(block)); + public int setBlocks(Region region, BlockStateHolder block) throws MaxChangedBlocksException { + return setBlocks(region, new BlockPattern(block)); } /** @@ -880,12 +755,11 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); - BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); + BlockReplace replace = new BlockReplace(this, pattern); RegionVisitor visitor = new RegionVisitor(region, replace); Operations.completeLegacy(visitor); return visitor.getAffected(); @@ -896,14 +770,13 @@ public class EditSession implements Extent { * returned by a given pattern. * * @param region the region to replace the blocks within - * @param filter a list of block types to match, or null to use {@link com.sk89q.worldedit.masks.ExistingBlockMask} + * @param filter a list of block types to match, or null to use {@link com.sk89q.worldedit.function.mask.ExistingBlockMask} * @param replacement the replacement block * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") - public int replaceBlocks(Region region, Set filter, BaseBlock replacement) throws MaxChangedBlocksException { - return replaceBlocks(region, filter, new SingleBlockPattern(replacement)); + public int replaceBlocks(Region region, Set filter, BlockStateHolder replacement) throws MaxChangedBlocksException { + return replaceBlocks(region, filter, new BlockPattern(replacement)); } /** @@ -911,13 +784,12 @@ public class EditSession implements Extent { * returned by a given pattern. * * @param region the region to replace the blocks within - * @param filter a list of block types to match, or null to use {@link com.sk89q.worldedit.masks.ExistingBlockMask} + * @param filter a list of block types to match, or null to use {@link com.sk89q.worldedit.function.mask.ExistingBlockMask} * @param pattern the pattern that provides the new blocks * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") - public int replaceBlocks(Region region, Set filter, Pattern pattern) throws MaxChangedBlocksException { + public int replaceBlocks(Region region, Set filter, Pattern pattern) throws MaxChangedBlocksException { Mask mask = filter == null ? new ExistingBlockMask(this) : new FuzzyBlockMask(this, filter); return replaceBlocks(region, mask, pattern); } @@ -932,13 +804,12 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int replaceBlocks(Region region, Mask mask, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(mask); checkNotNull(pattern); - BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); + BlockReplace replace = new BlockReplace(this, pattern); RegionMaskingFilter filter = new RegionMaskingFilter(mask, replace); RegionVisitor visitor = new RegionVisitor(region, filter); Operations.completeLegacy(visitor); @@ -955,7 +826,6 @@ public class EditSession implements Extent { * @return the number of blocks placed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int center(Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); @@ -963,8 +833,9 @@ public class EditSession implements Extent { Vector center = region.getCenter(); Region centerRegion = new CuboidRegion( getWorld(), // Causes clamping of Y range - new Vector((int) center.getX(), (int) center.getY(), (int) center.getZ()), - center.toBlockVector()); + new Vector(((int) center.getX()), ((int) center.getY()), ((int) center.getZ())), + new Vector(MathUtils.roundHalfUp(center.getX()), + center.getY(), MathUtils.roundHalfUp(center.getZ()))); return setBlocks(centerRegion, pattern); } @@ -976,9 +847,8 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeCuboidFaces(Region region, BaseBlock block) throws MaxChangedBlocksException { - return makeCuboidFaces(region, new SingleBlockPattern(block)); + return makeCuboidFaces(region, new BlockPattern(block)); } /** @@ -989,7 +859,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeCuboidFaces(Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); @@ -1009,7 +878,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeFaces(final Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); @@ -1031,9 +899,8 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeCuboidWalls(Region region, BaseBlock block) throws MaxChangedBlocksException { - return makeCuboidWalls(region, new SingleBlockPattern(block)); + return makeCuboidWalls(region, new BlockPattern(block)); } /** @@ -1045,7 +912,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeCuboidWalls(Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); @@ -1065,7 +931,6 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int makeWalls(final Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); @@ -1077,7 +942,7 @@ public class EditSession implements Extent { final int maxY = region.getMaximumPoint().getBlockY(); final ArbitraryShape shape = new RegionShape(region) { @Override - protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial) { + protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) { if (y > maxY || y < minY) { // Put holes into the floor and ceiling by telling ArbitraryShape that the shape goes on outside the region return defaultMaterial; @@ -1099,11 +964,10 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int overlayCuboidBlocks(Region region, BaseBlock block) throws MaxChangedBlocksException { checkNotNull(block); - return overlayCuboidBlocks(region, new SingleBlockPattern(block)); + return overlayCuboidBlocks(region, new BlockPattern(block)); } /** @@ -1115,12 +979,11 @@ public class EditSession implements Extent { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - @SuppressWarnings("deprecation") public int overlayCuboidBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(pattern); - BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); + BlockReplace replace = new BlockReplace(this, pattern); RegionOffset offset = new RegionOffset(new Vector(0, 1, 0), replace); GroundFunction ground = new GroundFunction(new ExistingBlockMask(this), offset); LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground); @@ -1184,7 +1047,7 @@ public class EditSession implements Extent { * @return number of blocks moved * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int moveRegion(Region region, Vector dir, int distance, boolean copyAir, BaseBlock replacement) throws MaxChangedBlocksException { + public int moveRegion(Region region, Vector dir, int distance, boolean copyAir, BlockStateHolder replacement) throws MaxChangedBlocksException { checkNotNull(region); checkNotNull(dir); checkArgument(distance >= 1, "distance >= 1 required"); @@ -1194,7 +1057,7 @@ public class EditSession implements Extent { // Remove the original blocks com.sk89q.worldedit.function.pattern.Pattern pattern = replacement != null ? new BlockPattern(replacement) : - new BlockPattern(new BaseBlock(BlockID.AIR)); + new BlockPattern(BlockTypes.AIR.getDefaultState()); BlockReplace remove = new BlockReplace(this, pattern); // Copy to a buffer so we don't destroy our original before we can copy all the blocks from it @@ -1249,7 +1112,7 @@ public class EditSession implements Extent { new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), getWorld().createLiquidMask()); - BlockReplace replace = new BlockReplace(this, new BlockPattern(new BaseBlock(BlockID.AIR))); + BlockReplace replace = new BlockReplace(this, new BlockPattern(BlockTypes.AIR.getDefaultState())); RecursiveVisitor visitor = new RecursiveVisitor(mask, replace); // Around the origin in a 3x3 block @@ -1269,35 +1132,28 @@ public class EditSession implements Extent { * * @param origin the original position * @param radius the radius to fix - * @param moving the block ID of the moving liquid - * @param stationary the block ID of the stationary liquid + * @param fluid the type of the fluid * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int fixLiquid(Vector origin, double radius, int moving, int stationary) throws MaxChangedBlocksException { + public int fixLiquid(Vector origin, double radius, BlockType fluid) throws MaxChangedBlocksException { checkNotNull(origin); checkArgument(radius >= 0, "radius >= 0 required"); // Our origins can only be liquids - BlockMask liquidMask = new BlockMask( - this, - new BaseBlock(moving, -1), - new BaseBlock(stationary, -1)); + BlockMask liquidMask = new BlockMask(this, fluid.getDefaultState().toFuzzy()); // But we will also visit air blocks - MaskIntersection blockMask = - new MaskUnion(liquidMask, - new BlockMask( - this, - new BaseBlock(BlockID.AIR))); + MaskIntersection blockMask = new MaskUnion(liquidMask, new BlockMask(this, BlockTypes.AIR.getDefaultState())); // There are boundaries that the routine needs to stay in MaskIntersection mask = new MaskIntersection( new BoundedHeightMask(0, Math.min(origin.getBlockY(), getWorld().getMaxY())), new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), - blockMask); + blockMask + ); - BlockReplace replace = new BlockReplace(this, new BlockPattern(new BaseBlock(stationary))); + BlockReplace replace = new BlockReplace(this, new BlockPattern(fluid.getDefaultState())); NonRisingVisitor visitor = new NonRisingVisitor(mask, replace); // Around the origin in a 3x3 block @@ -1568,8 +1424,8 @@ public class EditSession implements Extent { int oy = position.getBlockY(); int oz = position.getBlockZ(); - BaseBlock air = new BaseBlock(0); - BaseBlock water = new BaseBlock(BlockID.STATIONARY_WATER); + BlockState air = BlockTypes.AIR.getDefaultState(); + BlockState water = BlockTypes.WATER.getDefaultState(); int ceilRadius = (int) Math.ceil(radius); for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) { @@ -1580,26 +1436,18 @@ public class EditSession implements Extent { for (int y = world.getMaxY(); y >= 1; --y) { Vector pt = new Vector(x, y, z); - int id = getBlockType(pt); + BlockType id = getBlock(pt).getBlockType(); - switch (id) { - case BlockID.ICE: + if (id == BlockTypes.ICE) { if (setBlock(pt, water)) { ++affected; } - break; - - case BlockID.SNOW: + } else if (id == BlockTypes.SNOW) { if (setBlock(pt, air)) { ++affected; } - break; - - case BlockID.AIR: + } else if (id == BlockTypes.AIR) { continue; - - default: - break; } break; @@ -1626,8 +1474,8 @@ public class EditSession implements Extent { int oy = position.getBlockY(); int oz = position.getBlockZ(); - BaseBlock ice = new BaseBlock(BlockID.ICE); - BaseBlock snow = new BaseBlock(BlockID.SNOW); + BlockState ice = BlockTypes.ICE.getDefaultState(); + BlockState snow = BlockTypes.SNOW.getDefaultState(); int ceilRadius = (int) Math.ceil(radius); for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) { @@ -1638,14 +1486,14 @@ public class EditSession implements Extent { for (int y = world.getMaxY(); y >= 1; --y) { Vector pt = new Vector(x, y, z); - int id = getBlockType(pt); + BlockType id = getBlock(pt).getBlockType(); - if (id == BlockID.AIR) { + if (id == BlockTypes.AIR) { continue; } // Ice! - if (id == BlockID.WATER || id == BlockID.STATIONARY_WATER) { + if (id == BlockTypes.WATER) { if (setBlock(pt, ice)) { ++affected; } @@ -1653,8 +1501,11 @@ public class EditSession implements Extent { } // Snow should not cover these blocks - if (BlockType.isTranslucent(id)) { - break; + if (id.getMaterial().isTranslucent()) { + // Add snow on leaves + if (!BlockCategories.LEAVES.contains(id)) { + break; + } } // Too high? @@ -1674,20 +1525,6 @@ public class EditSession implements Extent { return affected; } - /** - * Make dirt green. - * - * @param position a position - * @param radius a radius - * @return number of blocks affected - * @throws MaxChangedBlocksException thrown if too many blocks are changed - * @deprecated Use {@link #green(Vector, double, boolean)}. - */ - @Deprecated - public int green(Vector position, double radius) throws MaxChangedBlocksException { - return green(position, radius, true); - } - /** * Make dirt green. * @@ -1706,7 +1543,7 @@ public class EditSession implements Extent { final int oy = position.getBlockY(); final int oz = position.getBlockZ(); - final BaseBlock grass = new BaseBlock(BlockID.GRASS); + final BlockState grass = BlockTypes.GRASS_BLOCK.getDefaultState(); final int ceilRadius = (int) Math.ceil(radius); for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) { @@ -1715,34 +1552,20 @@ public class EditSession implements Extent { continue; } - loop: for (int y = world.getMaxY(); y >= 1; --y) { + for (int y = world.getMaxY(); y >= 1; --y) { final Vector pt = new Vector(x, y, z); - final int id = getBlockType(pt); - final int data = getBlockData(pt); - - switch (id) { - case BlockID.DIRT: - if (onlyNormalDirt && data != 0) { - break loop; - } + final BlockState block = getBlock(pt); + if (block.getBlockType() == BlockTypes.DIRT || + (!onlyNormalDirt && block.getBlockType() == BlockTypes.COARSE_DIRT)) { if (setBlock(pt, grass)) { ++affected; } - break loop; - - case BlockID.WATER: - case BlockID.STATIONARY_WATER: - case BlockID.LAVA: - case BlockID.STATIONARY_LAVA: - // break on liquids... - break loop; - - default: - // ...and all non-passable blocks - if (!BlockType.canPassThrough(id, data)) { - break loop; - } + break; + } else if (block.getBlockType() == BlockTypes.WATER || block.getBlockType() == BlockTypes.LAVA) { + break; + } else if (block.getBlockType().getMaterial().isMovementBlocker()) { + break; } } } @@ -1784,11 +1607,11 @@ public class EditSession implements Extent { * @param basePosition a position * @param size a size * @param density between 0 and 1, inclusive - * @param treeGenerator the tree genreator + * @param treeType the tree type * @return number of trees created * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int makeForest(Vector basePosition, int size, double density, TreeGenerator treeGenerator) throws MaxChangedBlocksException { + public int makeForest(Vector basePosition, int size, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException { int affected = 0; for (int x = basePosition.getBlockX() - size; x <= basePosition.getBlockX() @@ -1796,7 +1619,7 @@ public class EditSession implements Extent { for (int z = basePosition.getBlockZ() - size; z <= basePosition.getBlockZ() + size; ++z) { // Don't want to be in the ground - if (!getBlock(new Vector(x, basePosition.getBlockY(), z)).isAir()) { + if (getBlock(new Vector(x, basePosition.getBlockY(), z)).getBlockType() != BlockTypes.AIR) { continue; } // The gods don't want a tree here @@ -1806,14 +1629,14 @@ public class EditSession implements Extent { for (int y = basePosition.getBlockY(); y >= basePosition.getBlockY() - 10; --y) { // Check if we hit the ground - int t = getBlock(new Vector(x, y, z)).getType(); - if (t == BlockID.GRASS || t == BlockID.DIRT) { - treeGenerator.generate(this, new Vector(x, y + 1, z)); + BlockType t = getBlock(new Vector(x, y, z)).getBlockType(); + if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) { + treeType.generate(this, new Vector(x, y + 1, z)); ++affected; break; - } else if (t == BlockID.SNOW) { - setBlock(new Vector(x, y, z), new BaseBlock(BlockID.AIR)); - } else if (t != BlockID.AIR) { // Trees won't grow on this! + } else if (t == BlockTypes.SNOW) { + setBlock(new Vector(x, y, z), BlockTypes.AIR.getDefaultState()); + } else if (t != BlockTypes.AIR) { // Trees won't grow on this! break; } } @@ -1829,9 +1652,9 @@ public class EditSession implements Extent { * @param region a region * @return the results */ - public List> getBlockDistribution(Region region) { - List> distribution = new ArrayList>(); - Map> map = new HashMap>(); + public List> getBlockDistribution(Region region) { + List> distribution = new ArrayList<>(); + Map> map = new HashMap<>(); if (region instanceof CuboidRegion) { // Doing this for speed @@ -1850,13 +1673,13 @@ public class EditSession implements Extent { for (int z = minZ; z <= maxZ; ++z) { Vector pt = new Vector(x, y, z); - int id = getBlockType(pt); + BlockType type = getBlock(pt).getBlockType(); - if (map.containsKey(id)) { - map.get(id).increment(); + if (map.containsKey(type)) { + map.get(type).increment(); } else { - Countable c = new Countable(id, 1); - map.put(id, c); + Countable c = new Countable<>(type, 1); + map.put(type, c); distribution.add(c); } } @@ -1864,13 +1687,13 @@ public class EditSession implements Extent { } } else { for (Vector pt : region) { - int id = getBlockType(pt); + BlockType type = getBlock(pt).getBlockType(); - if (map.containsKey(id)) { - map.get(id).increment(); + if (map.containsKey(type)) { + map.get(type).increment(); } else { - Countable c = new Countable(id, 1); - map.put(id, c); + Countable c = new Countable<>(type, 1); + map.put(type, c); } } } @@ -1888,9 +1711,9 @@ public class EditSession implements Extent { * @return the results */ // TODO reduce code duplication - probably during ops-redux - public List> getBlockDistributionWithData(Region region) { - List> distribution = new ArrayList>(); - Map> map = new HashMap>(); + public List> getBlockDistributionWithData(Region region) { + List> distribution = new ArrayList<>(); + Map> map = new HashMap<>(); if (region instanceof CuboidRegion) { // Doing this for speed @@ -1909,12 +1732,12 @@ public class EditSession implements Extent { for (int z = minZ; z <= maxZ; ++z) { Vector pt = new Vector(x, y, z); - BaseBlock blk = new BaseBlock(getBlockType(pt), getBlockData(pt)); + BlockStateHolder blk = getBlock(pt); if (map.containsKey(blk)) { map.get(blk).increment(); } else { - Countable c = new Countable(blk, 1); + Countable c = new Countable<>(blk, 1); map.put(blk, c); distribution.add(c); } @@ -1923,12 +1746,12 @@ public class EditSession implements Extent { } } else { for (Vector pt : region) { - BaseBlock blk = new BaseBlock(getBlockType(pt), getBlockData(pt)); + BlockStateHolder blk = getBlock(pt); if (map.containsKey(blk)) { map.get(blk).increment(); } else { - Countable c = new Countable(blk, 1); + Countable c = new Countable<>(blk, 1); map.put(blk, c); } } @@ -1952,17 +1775,18 @@ public class EditSession implements Extent { final ArbitraryShape shape = new ArbitraryShape(region) { @Override - protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial) { + protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) { final Vector current = new Vector(x, y, z); environment.setCurrentBlock(current); final Vector scaled = current.subtract(zero).divide(unit); try { - if (expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ(), defaultMaterial.getType(), defaultMaterial.getData()) <= 0) { + if (expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ(), defaultMaterial.getBlockType().getLegacyId(), 0) <= 0) { + // TODO data return null; } - return new BaseBlock((int) typeVariable.getValue(), (int) dataVariable.getValue()); + return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue()); } catch (Exception e) { log.log(Level.WARNING, "Failed to create shape", e); return null; @@ -1984,7 +1808,7 @@ public class EditSession implements Extent { final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(this, unit, zero); expression.setEnvironment(environment); - final DoubleArrayList queue = new DoubleArrayList(false); + final DoubleArrayList queue = new DoubleArrayList<>(false); for (BlockVector position : region) { // offset, scale @@ -1996,8 +1820,7 @@ public class EditSession implements Extent { final BlockVector sourcePosition = environment.toWorld(x.getValue(), y.getValue(), z.getValue()); // read block from world - // TODO: use getBlock here once the reflection is out of the way - final BaseBlock material = new BaseBlock(world.getBlockType(sourcePosition), world.getBlockData(sourcePosition)); + final BaseBlock material = world.getFullBlock(sourcePosition); // queue operation queue.put(position, material); @@ -2030,7 +1853,7 @@ public class EditSession implements Extent { public int hollowOutRegion(Region region, int thickness, Pattern pattern) throws MaxChangedBlocksException { int affected = 0; - final Set outside = new HashSet(); + final Set outside = new HashSet<>(); final Vector min = region.getMinimumPoint(); final Vector max = region.getMaximumPoint(); @@ -2064,7 +1887,7 @@ public class EditSession implements Extent { } for (int i = 1; i < thickness; ++i) { - final Set newOutside = new HashSet(); + final Set newOutside = new HashSet<>(); outer: for (BlockVector position : region) { for (Vector recurseDirection: recurseDirections) { BlockVector neighbor = position.add(recurseDirection).toBlockVector(); @@ -2088,7 +1911,7 @@ public class EditSession implements Extent { } } - if (setBlock(position, pattern.next(position))) { + if (setBlock(position, pattern.apply(position))) { ++affected; } } @@ -2111,7 +1934,7 @@ public class EditSession implements Extent { public int drawLine(Pattern pattern, Vector pos1, Vector pos2, double radius, boolean filled) throws MaxChangedBlocksException { - Set vset = new HashSet(); + Set vset = new HashSet<>(); boolean notdrawn = true; int x1 = pos1.getBlockX(), y1 = pos1.getBlockY(), z1 = pos1.getBlockZ(); @@ -2182,8 +2005,8 @@ public class EditSession implements Extent { public int drawSpline(Pattern pattern, List nodevectors, double tension, double bias, double continuity, double quality, double radius, boolean filled) throws MaxChangedBlocksException { - Set vset = new HashSet(); - List nodes = new ArrayList(nodevectors.size()); + Set vset = new HashSet<>(); + List nodes = new ArrayList<>(nodevectors.size()); Interpolation interpol = new KochanekBartelsInterpolation(); @@ -2222,7 +2045,7 @@ public class EditSession implements Extent { } private static Set getBallooned(Set vset, double radius) { - Set returnset = new HashSet(); + Set returnset = new HashSet<>(); int ceilrad = (int) Math.ceil(radius); for (Vector v : vset) { @@ -2242,7 +2065,7 @@ public class EditSession implements Extent { } private static Set getHollowed(Set vset) { - Set returnset = new HashSet(); + Set returnset = new HashSet<>(); for (Vector v : vset) { double x = v.getX(), y = v.getY(), z = v.getZ(); if (!(vset.contains(new Vector(x + 1, y, z)) && @@ -2258,12 +2081,13 @@ public class EditSession implements Extent { } private void recurseHollow(Region region, BlockVector origin, Set outside) { - final LinkedList queue = new LinkedList(); + final LinkedList queue = new LinkedList<>(); queue.addLast(origin); while (!queue.isEmpty()) { final BlockVector current = queue.removeFirst(); - if (!BlockType.canPassThrough(getBlockType(current), getBlockData(current))) { + final BlockState block = getBlock(current); + if (block.getBlockType().getMaterial().isMovementBlocker()) { continue; } @@ -2317,12 +2141,12 @@ public class EditSession implements Extent { } private static final Vector[] recurseDirections = { - PlayerDirection.NORTH.vector(), - PlayerDirection.EAST.vector(), - PlayerDirection.SOUTH.vector(), - PlayerDirection.WEST.vector(), - PlayerDirection.UP.vector(), - PlayerDirection.DOWN.vector(), + Direction.NORTH.toVector(), + Direction.EAST.toVector(), + Direction.SOUTH.toVector(), + Direction.WEST.toVector(), + Direction.UP.toVector(), + Direction.DOWN.toVector(), }; private static double lengthSq(double x, double y, double z) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java index b5ce151b9..094da742e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionFactory.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.event.extent.EditSessionEvent; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.world.World; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Creates new {@link EditSession}s. To get an instance of this factory, * use {@link WorldEdit#getEditSessionFactory()}. @@ -133,66 +133,6 @@ public class EditSessionFactory { throw new RuntimeException("Method needs to be implemented"); } - // ------------------------------------------------------------------------ - // Methods being deprecated - // ------------------------------------------------------------------------ - - /** - * Construct an edit session. - * - * @param world the world - * @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit - * @return an instance - * @deprecated We are replacing {@link LocalWorld} with {@link World}, so use {@link #getEditSession(World, int)} instead - */ - @Deprecated - public EditSession getEditSession(LocalWorld world, int maxBlocks) { - return getEditSession((World) world, maxBlocks); - } - - /** - * Construct an edit session. - * - * @param world the world - * @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit - * @param player the player that the {@link EditSession} is for - * @return an instance - * @deprecated We are replacing {@link LocalWorld} with {@link World}, so use {@link #getEditSession(World, int, Player)} instead - */ - @Deprecated - public EditSession getEditSession(LocalWorld world, int maxBlocks, LocalPlayer player) { - return getEditSession((World) world, maxBlocks, player); - } - - /** - * Construct an edit session. - * - * @param world the world - * @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit - * @param blockBag an optional {@link BlockBag} to use, otherwise null - * @return an instance - * @deprecated We are replacing {@link LocalWorld} with {@link World}, so use {@link #getEditSession(World, int, BlockBag)} instead - */ - @Deprecated - public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag) { - return getEditSession((World) world, maxBlocks, blockBag); - } - - /** - * Construct an edit session. - * - * @param world the world - * @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit - * @param blockBag an optional {@link BlockBag} to use, otherwise null - * @param player the player that the {@link EditSession} is for - * @return an instance - * @deprecated We are replacing {@link LocalWorld} with {@link World}, so use {@link #getEditSession(World, int, BlockBag, Player)} instead - */ - @Deprecated - public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag, LocalPlayer player) { - return getEditSession((World) world, maxBlocks, blockBag, player); - } - /** * Internal factory for {@link EditSession}s. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java index f27bb5808..2d931f91f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -19,8 +19,10 @@ package com.sk89q.worldedit; -import com.sk89q.worldedit.blocks.BlockID; -import com.sk89q.worldedit.blocks.ItemID; +import com.sk89q.worldedit.util.logging.LogFormat; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.item.ItemTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.snapshot.SnapshotRepository; import java.io.File; @@ -32,53 +34,73 @@ import java.util.Set; */ public abstract class LocalConfiguration { - protected static final int[] defaultDisallowedBlocks = new int[] { - // dangerous stuff (physics/drops items) - BlockID.SAPLING, - BlockID.BED, - BlockID.POWERED_RAIL, - BlockID.DETECTOR_RAIL, - BlockID.LONG_GRASS, - BlockID.DEAD_BUSH, - BlockID.PISTON_EXTENSION, - BlockID.PISTON_MOVING_PIECE, - BlockID.YELLOW_FLOWER, - BlockID.RED_FLOWER, - BlockID.BROWN_MUSHROOM, - BlockID.RED_MUSHROOM, - BlockID.TNT, - BlockID.TORCH, - BlockID.FIRE, - BlockID.REDSTONE_WIRE, - BlockID.CROPS, - BlockID.MINECART_TRACKS, - BlockID.LEVER, - BlockID.REDSTONE_TORCH_OFF, - BlockID.REDSTONE_TORCH_ON, - BlockID.REDSTONE_REPEATER_OFF, - BlockID.REDSTONE_REPEATER_ON, - BlockID.STONE_BUTTON, - BlockID.CACTUS, - BlockID.REED, - // ores and stuff - BlockID.BEDROCK, - BlockID.GOLD_ORE, - BlockID.IRON_ORE, - BlockID.COAL_ORE, - BlockID.DIAMOND_ORE, - - // @TODO rethink what should be disallowed by default - // Gold and iron can be legitimately obtained, but were set to disallowed by - // default. Diamond and coal can't be legitimately obtained. Sponges, - // portals, snow, and locked chests also can't, but are allowed. None of - // these blocks poses any immediate threat. Most of the blocks (in the first - // section) are disallowed because people will accidentally set a huge area - // of them, triggering physics and a million item drops, lagging the server. - // Doors also have this effect, but are not disallowed. - }; + protected static final String[] defaultDisallowedBlocks = new String[] { + // dangerous stuff (physics/drops items) + BlockTypes.OAK_SAPLING.getId(), + BlockTypes.JUNGLE_SAPLING.getId(), + BlockTypes.DARK_OAK_SAPLING.getId(), + BlockTypes.SPRUCE_SAPLING.getId(), + BlockTypes.BIRCH_SAPLING.getId(), + BlockTypes.ACACIA_SAPLING.getId(), + BlockTypes.BLACK_BED.getId(), + BlockTypes.BLUE_BED.getId(), + BlockTypes.BROWN_BED.getId(), + BlockTypes.CYAN_BED.getId(), + BlockTypes.GRAY_BED.getId(), + BlockTypes.GREEN_BED.getId(), + BlockTypes.LIGHT_BLUE_BED.getId(), + BlockTypes.LIGHT_GRAY_BED.getId(), + BlockTypes.LIME_BED.getId(), + BlockTypes.MAGENTA_BED.getId(), + BlockTypes.ORANGE_BED.getId(), + BlockTypes.PINK_BED.getId(), + BlockTypes.PURPLE_BED.getId(), + BlockTypes.RED_BED.getId(), + BlockTypes.WHITE_BED.getId(), + BlockTypes.YELLOW_BED.getId(), + BlockTypes.POWERED_RAIL.getId(), + BlockTypes.DETECTOR_RAIL.getId(), + BlockTypes.GRASS.getId(), + BlockTypes.DEAD_BUSH.getId(), + BlockTypes.MOVING_PISTON.getId(), + BlockTypes.PISTON_HEAD.getId(), + BlockTypes.SUNFLOWER.getId(), + BlockTypes.ROSE_BUSH.getId(), + BlockTypes.DANDELION.getId(), + BlockTypes.POPPY.getId(), + BlockTypes.BROWN_MUSHROOM.getId(), + BlockTypes.RED_MUSHROOM.getId(), + BlockTypes.TNT.getId(), + BlockTypes.TORCH.getId(), + BlockTypes.FIRE.getId(), + BlockTypes.REDSTONE_WIRE.getId(), + BlockTypes.WHEAT.getId(), + BlockTypes.POTATOES.getId(), + BlockTypes.CARROTS.getId(), + BlockTypes.MELON_STEM.getId(), + BlockTypes.PUMPKIN_STEM.getId(), + BlockTypes.BEETROOTS.getId(), + BlockTypes.RAIL.getId(), + BlockTypes.LEVER.getId(), + BlockTypes.REDSTONE_TORCH.getId(), + BlockTypes.REDSTONE_WALL_TORCH.getId(), + BlockTypes.REPEATER.getId(), + BlockTypes.COMPARATOR.getId(), + BlockTypes.STONE_BUTTON.getId(), + BlockTypes.BIRCH_BUTTON.getId(), + BlockTypes.ACACIA_BUTTON.getId(), + BlockTypes.DARK_OAK_BUTTON.getId(), + BlockTypes.JUNGLE_BUTTON.getId(), + BlockTypes.OAK_BUTTON.getId(), + BlockTypes.SPRUCE_BUTTON.getId(), + BlockTypes.CACTUS.getId(), + BlockTypes.SUGAR_CANE.getId(), + // ores and stuff + BlockTypes.BEDROCK.getId(), + }; public boolean profile = false; - public Set disallowedBlocks = new HashSet(); + public Set disallowedBlocks = new HashSet<>(); public int defaultChangeLimit = -1; public int maxChangeLimit = -1; public int defaultMaxPolygonalPoints = -1; @@ -92,8 +114,9 @@ public abstract class LocalConfiguration { public int maxBrushRadius = 6; public boolean logCommands = false; public String logFile = ""; + public String logFormat = LogFormat.DEFAULT_FORMAT; public boolean registerHelp = true; // what is the point of this, it's not even used - public int wandItem = ItemID.WOOD_AXE; + public String wandItem = ItemTypes.WOODEN_AXE.getId(); public boolean superPickaxeDrop = true; public boolean superPickaxeManyDrop = true; public boolean noDoubleSlash = false; @@ -101,10 +124,10 @@ public abstract class LocalConfiguration { public boolean useInventoryOverride = false; public boolean useInventoryCreativeOverride = false; public boolean navigationUseGlass = true; - public int navigationWand = ItemID.COMPASS; + public String navigationWand = ItemTypes.COMPASS.getId(); public int navigationWandMaxDistance = 50; public int scriptTimeout = 3000; - public Set allowedDataCycleBlocks = new HashSet(); + public Set allowedDataCycleBlocks = new HashSet<>(); public String saveDir = "schematics"; public String scriptsDir = "craftscripts"; public boolean showHelpInfo = true; @@ -126,4 +149,23 @@ public abstract class LocalConfiguration { return new File("."); } + public String convertLegacyItem(String legacy) { + String item = legacy; + try { + String[] splitter = item.split(":", 2); + int id = 0; + byte data = 0; + if (splitter.length == 1) { + id = Integer.parseInt(item); + } else { + id = Integer.parseInt(splitter[0]); + data = Byte.parseByte(splitter[1]); + } + item = LegacyMapper.getInstance().getItemFromLegacy(id, data).getId(); + } catch (Throwable e) { + } + + return item; + } + } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalPlayer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalPlayer.java deleted file mode 100644 index b7df2ed9b..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalPlayer.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; -import com.sk89q.worldedit.extension.platform.Actor; - -/** - * Represents a player that uses WorldEdit. - * - * @deprecated use {@link Actor} (or {@link Player}, etc.) instead (and {@link AbstractPlayerActor} to extend) - */ -@Deprecated -public abstract class LocalPlayer extends AbstractPlayerActor { - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index e7ffcd165..c42be0914 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.jchronic.Chronic; import com.sk89q.jchronic.Options; import com.sk89q.jchronic.utils.Span; @@ -32,7 +34,6 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionShapeEvent; @@ -43,9 +44,10 @@ import com.sk89q.worldedit.regions.selector.RegionSelectorType; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.snapshot.Snapshot; -import javax.annotation.Nullable; import java.util.Calendar; import java.util.HashMap; import java.util.LinkedList; @@ -53,7 +55,7 @@ import java.util.Map; import java.util.TimeZone; import java.util.concurrent.atomic.AtomicBoolean; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Stores session information. @@ -65,17 +67,18 @@ public class LocalSession { // Non-session related fields private transient LocalConfiguration config; private transient final AtomicBoolean dirty = new AtomicBoolean(); + private transient int failedCuiAttempts = 0; // Session related private transient RegionSelector selector = new CuboidRegionSelector(); private transient boolean placeAtPos1 = false; - private transient LinkedList history = new LinkedList(); + private transient LinkedList history = new LinkedList<>(); private transient int historyPointer = 0; private transient ClipboardHolder clipboard; private transient boolean toolControl = true; private transient boolean superPickaxe = false; private transient BlockTool pickaxeMode = new SinglePickaxe(); - private transient Map tools = new HashMap(); + private transient Map tools = new HashMap<>(); private transient int maxBlocksChanged = -1; private transient boolean useInventory; private transient Snapshot snapshot; @@ -203,17 +206,6 @@ public class LocalSession { historyPointer = history.size(); } - /** - * Performs an undo. - * - * @param newBlockBag a new block bag - * @param player the player - * @return whether anything was undone - */ - public EditSession undo(@Nullable BlockBag newBlockBag, LocalPlayer player) { - return undo(newBlockBag, (Player) player); - } - /** * Performs an undo. * @@ -238,17 +230,6 @@ public class LocalSession { } } - /** - * Performs a redo - * - * @param newBlockBag a new block bag - * @param player the player - * @return whether anything was redone - */ - public EditSession redo(@Nullable BlockBag newBlockBag, LocalPlayer player) { - return redo(newBlockBag, (Player) player); - } - /** * Performs a redo * @@ -292,14 +273,6 @@ public class LocalSession { setDirty(); } - /** - * @deprecated Use {@link #getRegionSelector(World)} - */ - @Deprecated - public RegionSelector getRegionSelector(LocalWorld world) { - return getRegionSelector((World) world); - } - /** * Get the region selector for defining the selection. If the selection * was defined for a different world, the old selection will be discarded. @@ -316,22 +289,6 @@ public class LocalSession { return selector; } - /** - * @deprecated use {@link #getRegionSelector(World)} - */ - @Deprecated - public RegionSelector getRegionSelector() { - return selector; - } - - /** - * @deprecated use {@link #setRegionSelector(World, RegionSelector)} - */ - @Deprecated - public void setRegionSelector(LocalWorld world, RegionSelector selector) { - setRegionSelector((World) world, selector); - } - /** * Set the region selector. * @@ -345,24 +302,6 @@ public class LocalSession { this.selector = selector; } - /** - * Returns true if the region is fully defined. - * - * @return true if a region selection is defined - */ - @Deprecated - public boolean isRegionDefined() { - return selector.isDefined(); - } - - /** - * @deprecated use {@link #isSelectionDefined(World)} - */ - @Deprecated - public boolean isSelectionDefined(LocalWorld world) { - return isSelectionDefined((World) world); - } - /** * Returns true if the region is fully defined for the specified world. * @@ -377,22 +316,6 @@ public class LocalSession { return selector.isDefined(); } - /** - * @deprecated use {@link #getSelection(World)} - */ - @Deprecated - public Region getRegion() throws IncompleteRegionException { - return selector.getRegion(); - } - - /** - * @deprecated use {@link #getSelection(World)} - */ - @Deprecated - public Region getSelection(LocalWorld world) throws IncompleteRegionException { - return getSelection((World) world); - } - /** * Get the selection region. If you change the region, you should * call learnRegionChanges(). If the selection is defined in @@ -524,7 +447,7 @@ public class LocalSession { public Vector getPlacementPosition(Player player) throws IncompleteRegionException { checkNotNull(player); if (!placeAtPos1) { - return player.getBlockIn(); + return player.getBlockIn().toVector(); } return selector.getPrimaryPosition(); @@ -596,11 +519,11 @@ public class LocalSession { /** * Get the tool assigned to the item. * - * @param item the item type ID + * @param item the item type * @return the tool, which may be {@link null} */ @Nullable - public Tool getTool(int item) { + public Tool getTool(ItemType item) { return tools.get(item); } @@ -609,14 +532,14 @@ public class LocalSession { * or the tool is not assigned, the slot will be replaced with the * brush tool. * - * @param item the item type ID + * @param item the item type * @return the tool, or {@code null} * @throws InvalidToolBindException if the item can't be bound to that item */ - public BrushTool getBrushTool(int item) throws InvalidToolBindException { + public BrushTool getBrushTool(ItemType item) throws InvalidToolBindException { Tool tool = getTool(item); - if (tool == null || !(tool instanceof BrushTool)) { + if (!(tool instanceof BrushTool)) { tool = new BrushTool("worldedit.brush.sphere"); setTool(item, tool); } @@ -627,16 +550,16 @@ public class LocalSession { /** * Set the tool. * - * @param item the item type ID + * @param item the item type * @param tool the tool to set, which can be {@code null} * @throws InvalidToolBindException if the item can't be bound to that item */ - public void setTool(int item, @Nullable Tool tool) throws InvalidToolBindException { - if (item > 0 && item < 255) { + public void setTool(ItemType item, @Nullable Tool tool) throws InvalidToolBindException { + if (item.hasBlockType()) { throw new InvalidToolBindException(item, "Blocks can't be used"); - } else if (item == config.wandItem) { + } else if (item == ItemTypes.get(config.wandItem)) { throw new InvalidToolBindException(item, "Already used for the wand"); - } else if (item == config.navigationWand) { + } else if (item == ItemTypes.get(config.navigationWand)) { throw new InvalidToolBindException(item, "Already used for the navigation wand"); } @@ -772,14 +695,22 @@ public class LocalSession { */ public void handleCUIInitializationMessage(String text) { checkNotNull(text); + if (this.failedCuiAttempts > 3) { + return; + } - String[] split = text.split("\\|"); + String[] split = text.split("\\|", 2); if (split.length > 1 && split[0].equalsIgnoreCase("v")) { // enough fields and right message + if (split[1].length() > 4) { + this.failedCuiAttempts ++; + return; + } setCUISupport(true); try { setCUIVersion(Integer.parseInt(split[1])); } catch (NumberFormatException e) { WorldEdit.logger.warning("Error while reading CUI init message: " + e.getMessage()); + this.failedCuiAttempts ++; } } } @@ -841,21 +772,12 @@ public class LocalSession { } } - /** - * @deprecated use {@link #createEditSession(Player)} - */ - @Deprecated - public EditSession createEditSession(LocalPlayer player) { - return createEditSession((Player) player); - } - /** * Construct a new edit session. * * @param player the player * @return an edit session */ - @SuppressWarnings("deprecation") public EditSession createEditSession(Player player) { checkNotNull(player); @@ -908,14 +830,4 @@ public class LocalSession { this.mask = mask; } - /** - * Set a mask. - * - * @param mask mask or null - */ - @SuppressWarnings("deprecation") - public void setMask(com.sk89q.worldedit.masks.Mask mask) { - setMask(mask != null ? Masks.wrap(mask) : null); - } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalWorld.java deleted file mode 100644 index ae1112b95..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalWorld.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.util.TreeGenerator; -import com.sk89q.worldedit.world.AbstractWorld; -import com.sk89q.worldedit.world.World; - -/** - * A legacy abstract implementation of {@link World}. New implementations - * should use {@link AbstractWorld} when possible. - * - * @deprecated Replace with {@link World} wherever appropriate - */ -@Deprecated -public abstract class LocalWorld extends AbstractWorld { - - @Override - public BaseBlock getLazyBlock(Vector position) { - return getBlock(position); - } - - @Override - public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector pt) throws MaxChangedBlocksException { - switch (type) { - case BIG_TREE: - return generateBigTree(editSession, pt); - case BIRCH: - return generateBirchTree(editSession, pt); - case REDWOOD: - return generateRedwoodTree(editSession, pt); - case TALL_REDWOOD: - return generateTallRedwoodTree(editSession, pt); - default: - case TREE: - return generateTree(editSession, pt); - } - } - - @Override - public boolean generateTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { - return false; - } - - @Override - public boolean generateBigTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { - return false; - } - - @Override - public boolean generateBirchTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { - return false; - } - - @Override - public boolean generateRedwoodTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { - return false; - } - - @Override - public boolean generateTallRedwoodTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { - return false; - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/Location.java b/worldedit-core/src/main/java/com/sk89q/worldedit/Location.java deleted file mode 100644 index 6674af51d..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/Location.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -/** - * @deprecated Use {@link com.sk89q.worldedit.util.Location} wherever possible - */ -@Deprecated -public class Location { - private final LocalWorld world; - private final Vector position; - private final float yaw; - private final float pitch; - - public Location(LocalWorld world, Vector position) { - this(world, position, 0, 0); - } - - public Location(LocalWorld world, Vector position, float yaw, float pitch) { - this.world = world; - this.position = position; - this.yaw = yaw; - this.pitch = pitch; - } - - public LocalWorld getWorld() { - return world; - } - - public Vector getPosition() { - return position; - } - - public float getYaw() { - return yaw; - } - - public float getPitch() { - return pitch; - } - - public Location setAngles(float yaw, float pitch) { - return new Location(world, position, yaw, pitch); - } - - public Location setPosition(Vector position) { - return new Location(world, position, yaw, pitch); - } - - public Location add(Vector other) { - return setPosition(position.add(other)); - } - - public Location add(double x, double y, double z) { - return setPosition(position.add(x, y, z)); - } - - public Vector getDirection() { - final double yawRadians = Math.toRadians(yaw); - final double pitchRadians = Math.toRadians(pitch); - final double y = -Math.sin(pitchRadians); - - final double h = Math.cos(pitchRadians); - - final double x = -h * Math.sin(yawRadians); - final double z = h * Math.cos(yawRadians); - - return new Vector(x, y, z); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Location)) - return false; - - Location location = (Location) obj; - if (!world.equals(location.world)) - return false; - - if (!position.equals(location.position)) - return false; - - return true; - } - - @Override - public int hashCode() { - return position.hashCode() + 19 * world.hashCode(); - } - - @Override - public String toString() { - return "World: " + world.getName() + ", Coordinates: " + position - + ", Yaw: " + yaw + ", Pitch: " + pitch; - } - - public static Location fromLookAt(LocalWorld world, Vector start, Vector lookAt) { - final Vector diff = lookAt.subtract(start); - - return fromEye(world, start, diff); - } - - public static Location fromEye(LocalWorld world, Vector start, Vector eye) { - final double eyeX = eye.getX(); - final double eyeZ = eye.getZ(); - final float yaw = (float) Math.toDegrees(Math.atan2(-eyeX, eyeZ)); - final double length = Math.sqrt(eyeX * eyeX + eyeZ * eyeZ); - final float pitch = (float) Math.toDegrees(Math.atan2(-eye.getY(), length)); - - return new Location(world, start, yaw, pitch); - } -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java index 92bed02f2..2a82fea88 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java @@ -28,24 +28,22 @@ import com.sk89q.worldedit.util.Direction; */ public enum PlayerDirection { - NORTH(new Vector(0, 0, -1), new Vector(-1, 0, 0), true), - NORTH_EAST((new Vector(1, 0, -1)).normalize(), (new Vector(-1, 0, -1)).normalize(), false), - EAST(new Vector(1, 0, 0), new Vector(0, 0, -1), true), - SOUTH_EAST((new Vector(1, 0, 1)).normalize(), (new Vector(1, 0, -1)).normalize(), false), - SOUTH(new Vector(0, 0, 1), new Vector(1, 0, 0), true), - SOUTH_WEST((new Vector(-1, 0, 1)).normalize(), (new Vector(1, 0, 1)).normalize(), false), - WEST(new Vector(-1, 0, 0), new Vector(0, 0, 1), true), - NORTH_WEST((new Vector(-1, 0, -1)).normalize(), (new Vector(-1, 0, 1)).normalize(), false), - UP(new Vector(0, 1, 0), new Vector(0, 0, 1), true), - DOWN(new Vector(0, -1, 0), new Vector(0, 0, 1), true); + NORTH(new Vector(0, 0, -1), true), + NORTH_EAST((new Vector(1, 0, -1)).normalize(), false), + EAST(new Vector(1, 0, 0), true), + SOUTH_EAST((new Vector(1, 0, 1)).normalize(), false), + SOUTH(new Vector(0, 0, 1), true), + SOUTH_WEST((new Vector(-1, 0, 1)).normalize(), false), + WEST(new Vector(-1, 0, 0), true), + NORTH_WEST((new Vector(-1, 0, -1)).normalize(), false), + UP(new Vector(0, 1, 0), true), + DOWN(new Vector(0, -1, 0), true); private final Vector dir; - private final Vector leftDir; private final boolean isOrthogonal; - PlayerDirection(Vector vec, Vector leftDir, boolean isOrthogonal) { + PlayerDirection(Vector vec, boolean isOrthogonal) { this.dir = vec; - this.leftDir = leftDir; this.isOrthogonal = isOrthogonal; } @@ -53,11 +51,6 @@ public enum PlayerDirection { return dir; } - @Deprecated - public Vector leftVector() { - return leftDir; - } - public boolean isOrthogonal() { return isOrthogonal; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/ServerInterface.java b/worldedit-core/src/main/java/com/sk89q/worldedit/ServerInterface.java deleted file mode 100644 index 8012fce15..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/ServerInterface.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import com.sk89q.worldedit.extension.platform.AbstractPlatform; -import com.sk89q.worldedit.extension.platform.Platform; - -/** - * A legacy abstract class that is to be replaced with {@link Platform}. - * Extend {@link AbstractPlatform} instead. - * - * @deprecated Use {@link Platform} wherever possible - */ -@Deprecated -public abstract class ServerInterface extends AbstractPlatform { -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/Vector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/Vector.java index e148e75d5..a47210ce6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/Vector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/Vector.java @@ -754,7 +754,8 @@ public class Vector implements Comparable { * @return a new {@code BlockVector} */ public BlockVector toBlockVector() { - return new BlockVector(this); + return toBlockPoint(); +// return new BlockVector(this); TODO Look into this further. } /** @@ -789,12 +790,7 @@ public class Vector implements Comparable { @Override public int hashCode() { - int hash = 7; - - hash = 79 * hash + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32)); - hash = 79 * hash + (int) (Double.doubleToLongBits(this.y) ^ (Double.doubleToLongBits(this.y) >>> 32)); - hash = 79 * hash + (int) (Double.doubleToLongBits(this.z) ^ (Double.doubleToLongBits(this.z) >>> 32)); - return hash; + return ((int) x ^ ((int) z << 12)) ^ ((int) y << 24); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java index 2c295ca2c..ae58566b7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java @@ -627,8 +627,7 @@ public class Vector2D { @Override public int hashCode() { - return ((new Double(x)).hashCode() >> 13) ^ - (new Double(z)).hashCode(); + return ((int) x << 16) ^ (int) z; } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/VectorFace.java b/worldedit-core/src/main/java/com/sk89q/worldedit/VectorFace.java deleted file mode 100644 index 4b900ec6a..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/VectorFace.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import com.sk89q.worldedit.util.Direction; - -/** - * Represents the adjacency of one vector to another. Works similarly to - * Bukkit's BlockFace class. - * - * @deprecated to be replaced with {@link Direction} - */ -@Deprecated -public enum VectorFace { - NORTH(-1, 0, 0), - EAST(0, 0, -1), - SOUTH(1, 0, 0), - WEST(0, 0, 1), - UP(0, 1, 0), - DOWN(0, -1, 0), - NORTH_EAST(NORTH, EAST), - NORTH_WEST(NORTH, WEST), - SOUTH_EAST(SOUTH, EAST), - SOUTH_WEST(SOUTH, WEST), - ABOVE_NORTH(UP, NORTH), - BELOW_NORTH(DOWN, NORTH), - ABOVE_SOUTH(UP, SOUTH), - BELOW_SOUTH(DOWN, SOUTH), - ABOVE_WEST(UP, WEST), - BELOW_WEST(DOWN, WEST), - ABOVE_EAST(UP, EAST), - BELOW_EAST(DOWN, EAST), - SELF(0, 0, 0); - - private final int modX; - private final int modY; - private final int modZ; - - private VectorFace(final int modX, final int modY, final int modZ) { - this.modX = modX; - this.modY = modY; - this.modZ = modZ; - } - - private VectorFace(VectorFace face1, VectorFace face2) { - this.modX = face1.getModX() + face2.getModX(); - this.modY = face1.getModY() + face2.getModY(); - this.modZ = face1.getModZ() + face2.getModZ(); - } - - public int getModX() { - return modX; - } - - public int getModZ() { - return modZ; - } - - public int getModY() { - return modY; - } - - public static VectorFace fromMods(int modX2, int modY2, int modZ2) { - for (VectorFace face : values()) { - if (face.getModX() == modX2 - && face.getModY() == modY2 - && face.getModZ() == modZ2) { - return face; - } - } - return VectorFace.SELF; - } -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java index 3826b19e3..0ac44dbff 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -19,12 +19,14 @@ package com.sk89q.worldedit; -import com.sk89q.worldedit.CuboidClipboard.FlipDirection; -import com.sk89q.worldedit.blocks.BaseBlock; +import static com.sk89q.worldedit.event.platform.Interaction.HIT; +import static com.sk89q.worldedit.event.platform.Interaction.OPEN; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItem; -import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.event.extent.EditSessionEvent; import com.sk89q.worldedit.event.platform.BlockInteractEvent; import com.sk89q.worldedit.event.platform.InputType; import com.sk89q.worldedit.event.platform.PlayerInputEvent; @@ -32,44 +34,41 @@ import com.sk89q.worldedit.extension.factory.BlockFactory; import com.sk89q.worldedit.extension.factory.ItemFactory; import com.sk89q.worldedit.extension.factory.MaskFactory; import com.sk89q.worldedit.extension.factory.PatternFactory; -import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.PlatformManager; import com.sk89q.worldedit.extent.inventory.BlockBag; -import com.sk89q.worldedit.function.mask.Masks; -import com.sk89q.worldedit.function.pattern.Patterns; -import com.sk89q.worldedit.masks.Mask; -import com.sk89q.worldedit.patterns.Pattern; import com.sk89q.worldedit.scripting.CraftScriptContext; import com.sk89q.worldedit.scripting.CraftScriptEngine; import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine; import com.sk89q.worldedit.session.SessionManager; import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException; import com.sk89q.worldedit.util.io.file.FilenameException; import com.sk89q.worldedit.util.io.file.FilenameResolutionException; import com.sk89q.worldedit.util.io.file.InvalidFilenameException; import com.sk89q.worldedit.util.logging.WorldEditPrefixHandler; +import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.registry.BundledBlockData; +import com.sk89q.worldedit.world.registry.BundledItemData; +import com.sk89q.worldedit.world.registry.LegacyMapper; -import javax.script.ScriptException; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; -import java.util.HashSet; +import java.util.Iterator; +import java.util.List; import java.util.Map; -import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.event.platform.Interaction.HIT; -import static com.sk89q.worldedit.event.platform.Interaction.OPEN; +import javax.script.ScriptException; /** * The entry point and container for a working implementation of WorldEdit. @@ -104,7 +103,6 @@ public class WorldEdit { static { WorldEditPrefixHandler.register("com.sk89q.worldedit"); getVersion(); - BundledBlockData.getInstance(); // Load block registry } private WorldEdit() { @@ -194,151 +192,6 @@ public class WorldEdit { return sessions; } - /** - * @deprecated Use {@link #getSessionManager()} - */ - @Deprecated - public LocalSession getSession(String player) { - return sessions.findByName(player); - } - - /** - * @deprecated use {@link #getSessionManager()} - */ - @Deprecated - public LocalSession getSession(Player player) { - return sessions.get(player); - } - - /** - * @deprecated use {@link #getSessionManager()} - */ - @Deprecated - public void removeSession(Player player) { - sessions.remove(player); - } - - /** - * @deprecated use {@link #getSessionManager()} - */ - @Deprecated - public void clearSessions() { - sessions.clear(); - } - - /** - * @deprecated use {@link #getSessionManager()} - */ - @Deprecated - public boolean hasSession(Player player) { - return sessions.contains(player); - } - - /** - * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)} - */ - @SuppressWarnings("deprecation") - @Deprecated - public BaseBlock getBlock(Player player, String arg, boolean allAllowed) throws WorldEditException { - return getBlock(player, arg, allAllowed, false); - } - - /** - * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)} - */ - @SuppressWarnings("deprecation") - @Deprecated - public BaseBlock getBlock(Player player, String arg, boolean allAllowed, boolean allowNoData) throws WorldEditException { - ParserContext context = new ParserContext(); - context.setActor(player); - context.setWorld(player.getWorld()); - context.setSession(getSession(player)); - context.setRestricted(!allAllowed); - context.setPreferringWildcard(allowNoData); - return getBlockFactory().parseFromInput(arg, context); - } - - /** - * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)} - */ - @SuppressWarnings("deprecation") - @Deprecated - public BaseBlock getBlock(Player player, String id) throws WorldEditException { - return getBlock(player, id, false); - } - - /** - * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromListInput(String, ParserContext)} - */ - @Deprecated - @SuppressWarnings("deprecation") - public Set getBlocks(Player player, String list, boolean allAllowed, boolean allowNoData) throws WorldEditException { - String[] items = list.split(","); - Set blocks = new HashSet(); - for (String id : items) { - blocks.add(getBlock(player, id, allAllowed, allowNoData)); - } - return blocks; - } - - /** - * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)} - */ - @Deprecated - @SuppressWarnings("deprecation") - public Set getBlocks(Player player, String list, boolean allAllowed) throws WorldEditException { - return getBlocks(player, list, allAllowed, false); - } - - /** - * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromListInput(String, ParserContext)} - */ - @Deprecated - @SuppressWarnings("deprecation") - public Set getBlocks(Player player, String list) throws WorldEditException { - return getBlocks(player, list, false); - } - - /** - * @deprecated Use {@link #getBlockFactory()} and {@link BlockFactory#parseFromListInput(String, ParserContext)} - */ - @Deprecated - @SuppressWarnings("deprecation") - public Set getBlockIDs(Player player, String list, boolean allBlocksAllowed) throws WorldEditException { - String[] items = list.split(","); - Set blocks = new HashSet(); - for (String s : items) { - blocks.add(getBlock(player, s, allBlocksAllowed).getType()); - } - return blocks; - } - - /** - * @deprecated Use {@link #getPatternFactory()} and {@link BlockFactory#parseFromInput(String, ParserContext)} - */ - @Deprecated - @SuppressWarnings("deprecation") - public Pattern getBlockPattern(Player player, String input) throws WorldEditException { - ParserContext context = new ParserContext(); - context.setActor(player); - context.setWorld(player.getWorld()); - context.setSession(getSession(player)); - return Patterns.wrap(getPatternFactory().parseFromInput(input, context)); - } - - /** - * @deprecated Use {@link #getMaskFactory()} ()} and {@link MaskFactory#parseFromInput(String, ParserContext)} - */ - @Deprecated - @SuppressWarnings("deprecation") - public Mask getBlockMask(Player player, LocalSession session, String input) throws WorldEditException { - ParserContext context = new ParserContext(); - context.setActor(player); - context.setWorld(player.getWorld()); - context.setSession(session); - return Masks.wrap(getMaskFactory().parseFromInput(input, context)); - } - /** * Gets the path to a file. This method will check to see if the filename * has valid characters and has an extension. It also prevents directory @@ -403,15 +256,8 @@ public class WorldEdit { throw new FileSelectionAbortedException("No file selected"); } } else { - if (defaultExt != null && filename.lastIndexOf('.') == -1) { - filename += "." + defaultExt; - } - - if (!filename.matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+\\.[A-Za-z0-9]+$")) { - throw new InvalidFilenameException(filename, "Invalid characters or extension missing"); - } - - f = new File(dir, filename); + List exts = extensions == null ? ImmutableList.of(defaultExt) : Lists.asList(defaultExt, extensions); + return getSafeFileWithExtensions(dir, filename, exts, isSave); } try { @@ -430,6 +276,48 @@ public class WorldEdit { } } + private File getSafeFileWithExtensions(File dir, String filename, List exts, boolean isSave) throws InvalidFilenameException { + if (isSave) { + // First is default, only use that. + if (exts.size() != 1) { + exts = exts.subList(0, 1); + } + } + File result = null; + for (Iterator iter = exts.iterator(); iter.hasNext() && (result == null || !result.exists());) { + result = getSafeFileWithExtension(dir, filename, iter.next()); + } + if (result == null) { + throw new InvalidFilenameException(filename, "Invalid characters or extension missing"); + } + return result; + } + + private File getSafeFileWithExtension(File dir, String filename, String extension) { + if (extension != null && filename.lastIndexOf('.') == -1) { + filename += "." + extension; + } + + if (!checkFilename(filename)) { + return null; + } + + return new File(dir, filename); + } + + private boolean checkFilename(String filename) { + return filename.matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+\\.[A-Za-z0-9]+$"); + } + + /** + * Load the bundled mappings. + */ + public void loadMappings() { + BundledBlockData.getInstance(); // Load block registry + BundledItemData.getInstance(); // Load item registry + LegacyMapper.getInstance(); // Load item registry + } + /** * Checks to see if the specified radius is within bounds. * @@ -572,47 +460,6 @@ public class WorldEdit { return dir; } - /** - * Get diagonal direction vector for a player's direction. May return - * null if a direction could not be found. - * - * @param player the player - * @param dirStr the direction string - * @return a direction vector - * @throws UnknownDirectionException thrown if the direction is not known - */ - public Vector getDiagonalDirection(Player player, String dirStr) throws UnknownDirectionException { - return getPlayerDirection(player, dirStr.toLowerCase()).vector(); - } - - /** - * Get the flip direction for a player's direction. - * - * @param player the player - * @param dirStr the direction string - * @return a direction vector - * @throws UnknownDirectionException thrown if the direction is not known - */ - public FlipDirection getFlipDirection(Player player, String dirStr) throws UnknownDirectionException { - final PlayerDirection dir = getPlayerDirection(player, dirStr); - switch (dir) { - case WEST: - case EAST: - return FlipDirection.WEST_EAST; - - case NORTH: - case SOUTH: - return FlipDirection.NORTH_SOUTH; - - case UP: - case DOWN: - return FlipDirection.UP_DOWN; - - default: - throw new UnknownDirectionException(dir.name()); - } - } - /** * Flush a block bag's changes to a player. * @@ -626,7 +473,7 @@ public class WorldEdit { blockBag.flushChanges(); } - Map missingBlocks = editSession.popMissingBlocks(); + Map missingBlocks = editSession.popMissingBlocks(); if (!missingBlocks.isEmpty()) { StringBuilder str = new StringBuilder(); @@ -634,12 +481,8 @@ public class WorldEdit { int size = missingBlocks.size(); int i = 0; - for (Integer id : missingBlocks.keySet()) { - BlockType type = BlockType.fromID(id); - - str.append(type != null - ? type.getName() + " (" + id + ")" - : id.toString()); + for (BlockType id : missingBlocks.keySet()) { + str.append(id.getName()); str.append(" [Amt: ").append(missingBlocks.get(id)).append("]"); @@ -685,8 +528,8 @@ public class WorldEdit { * @param clicked the clicked block * @return false if you want the action to go through */ - public boolean handleBlockRightClick(Player player, WorldVector clicked) { - BlockInteractEvent event = new BlockInteractEvent(player, clicked.toLocation(), OPEN); + public boolean handleBlockRightClick(Player player, Location clicked) { + BlockInteractEvent event = new BlockInteractEvent(player, clicked, OPEN); getEventBus().post(event); return event.isCancelled(); } @@ -698,8 +541,8 @@ public class WorldEdit { * @param clicked the clicked block * @return false if you want the action to go through */ - public boolean handleBlockLeftClick(Player player, WorldVector clicked) { - BlockInteractEvent event = new BlockInteractEvent(player, clicked.toLocation(), HIT); + public boolean handleBlockLeftClick(Player player, Location clicked) { + BlockInteractEvent event = new BlockInteractEvent(player, clicked, HIT); getEventBus().post(event); return event.isCancelled(); } @@ -717,7 +560,7 @@ public class WorldEdit { String filename = f.getPath(); int index = filename.lastIndexOf("."); - String ext = filename.substring(index + 1, filename.length()); + String ext = filename.substring(index + 1); if (!ext.equalsIgnoreCase("js")) { player.printError("Only .js scripts are currently supported"); @@ -751,9 +594,10 @@ public class WorldEdit { } LocalSession session = getSessionManager().get(player); - CraftScriptContext scriptContext = new CraftScriptContext(this, getServer(), getConfiguration(), session, player, args); + CraftScriptContext scriptContext = new CraftScriptContext(this, getPlatformManager().queryCapability(Capability.USER_COMMANDS), + getConfiguration(), session, player, args); - CraftScriptEngine engine = null; + CraftScriptEngine engine; try { engine = new RhinoCraftScriptEngine(); @@ -765,7 +609,7 @@ public class WorldEdit { engine.setTimeLimit(getConfiguration().scriptTimeout); - Map vars = new HashMap(); + Map vars = new HashMap<>(); vars.put("argv", args); vars.put("context", scriptContext); vars.put("player", player); @@ -776,9 +620,7 @@ public class WorldEdit { player.printError("Failed to execute:"); player.printRaw(e.getMessage()); logger.log(Level.WARNING, "Failed to execute script", e); - } catch (NumberFormatException e) { - throw e; - } catch (WorldEditException e) { + } catch (NumberFormatException | WorldEditException e) { throw e; } catch (Throwable e) { player.printError("Failed to execute (see console):"); @@ -801,15 +643,6 @@ public class WorldEdit { return getPlatformManager().getConfiguration(); } - /** - * Get the server interface. - * - * @return the server interface - */ - public ServerInterface getServer() { - return getPlatformManager().getServerInterface(); - } - /** * Get a factory for {@link EditSession}s. */ @@ -817,20 +650,6 @@ public class WorldEdit { return editSessionFactory; } - /** - * @deprecated EditSessionFactories are no longer used. Please register an {@link EditSessionEvent} event - * with the event bus in order to override or catch changes to the world - */ - @Deprecated - public void setEditSessionFactory(EditSessionFactory factory) { - checkNotNull(factory); - logger.severe("Got request to set EditSessionFactory of type " + - factory.getClass().getName() + " from " + factory.getClass().getPackage().getName() + - " but EditSessionFactories have been removed in favor of extending EditSession's extents.\n\n" + - "This may mean that any block logger / intercepters addons/plugins/mods that you have installed will not " + - "intercept WorldEdit's changes! Please notify the maintainer of the other addon about this."); - } - /** * Get the version. * @@ -860,11 +679,4 @@ public class WorldEdit { return version; } - /** - * @deprecated Declare your platform version with {@link Platform#getPlatformVersion()} - */ - @Deprecated - public static void setVersion(String version) { - } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditOperation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditOperation.java deleted file mode 100644 index 26628f017..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditOperation.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -/** - * Represents a WorldEdit operation. - * - * @deprecated This will be removed with no direct replacement. Please use the - * WorldEdit API. - */ -@Deprecated -public abstract class WorldEditOperation { - - public abstract void run(LocalSession session, LocalPlayer player, EditSession editSession) throws Throwable; - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVector.java deleted file mode 100644 index c45b53ef8..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVector.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import com.sk89q.worldedit.internal.LocalWorldAdapter; -import com.sk89q.worldedit.world.World; - -/** - * @deprecated Use {@link com.sk89q.worldedit.util.Location} wherever possible - */ -@SuppressWarnings("deprecation") -@Deprecated -public class WorldVector extends Vector { - - private LocalWorld world; - - /** - * Construct the Vector object. - * - * @param world a world - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public WorldVector(LocalWorld world, double x, double y, double z) { - super(x, y, z); - this.world = world; - } - - /** - * Construct the Vector object. - * - * @param world a world - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public WorldVector(LocalWorld world, int x, int y, int z) { - super(x, y, z); - this.world = world; - } - - /** - * Construct the Vector object. - * - * @param world a world - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - */ - public WorldVector(LocalWorld world, float x, float y, float z) { - super(x, y, z); - this.world = world; - } - - /** - * Construct the Vector object. - * - * @param world a world - * @param other the position to copy - */ - public WorldVector(LocalWorld world, Vector other) { - super(other); - this.world = world; - } - - /** - * Construct the Vector object. - * - * @param world a world - */ - public WorldVector(LocalWorld world) { - super(); - this.world = world; - } - - /** - * Construct the Vector object. - * - * @param location the location - */ - public WorldVector(com.sk89q.worldedit.util.Location location) { - this(LocalWorldAdapter.adapt((World) location.getExtent()), location.getX(), location.getY(), location.getZ()); - } - - /** - * Get the world. - * - * @return the world - */ - public LocalWorld getWorld() { - return world; - } - - /** - * Get a block point from a point. - * - * @param world a world - * @param x the X coordinate - * @param y the Y coordinate - * @param z the Z coordinate - * @return point - */ - public static WorldVector toBlockPoint(LocalWorld world, double x, double y, - double z) { - return new WorldVector(world, (int) Math.floor(x), - (int) Math.floor(y), - (int) Math.floor(z)); - } - - /** - * Gets a BlockVector version. - * - * @return BlockWorldVector - */ - public BlockWorldVector toWorldBlockVector() { - return new BlockWorldVector(this); - } - - /** - * Return this object as a new preferred {@code Location} - * object. - * - * @return a new location object - */ - public com.sk89q.worldedit.util.Location toLocation() { - return new com.sk89q.worldedit.util.Location(getWorld(), this); - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVector2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVector2D.java deleted file mode 100644 index 35a261b2a..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVector2D.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -/** - * @deprecated Use {@link com.sk89q.worldedit.util.Location} wherever possible - */ -@Deprecated -public class WorldVector2D extends Vector2D { - - protected LocalWorld world; - - public WorldVector2D(LocalWorld world) { - super(); - this.world = world; - } - - public WorldVector2D(LocalWorld world, double x, double z) { - super(x, z); - this.world = world; - } - - public WorldVector2D(LocalWorld world, float x, float z) { - super(x, z); - this.world = world; - } - - public WorldVector2D(LocalWorld world, int x, int z) { - super(x, z); - this.world = world; - } - - public WorldVector2D(LocalWorld world, Vector2D pt) { - super(pt); - this.world = world; - } - - public LocalWorld getWorld() { - return world; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof WorldVector2D)) { - return false; - } - WorldVector2D other = (WorldVector2D) obj; - return other.world.equals(world) && other.x == this.x - && other.z == this.z; - - } - - /** - * Gets the hash code. - * - * @return hash code - */ - @Override - public int hashCode() { - return (world.hashCode() >> 7) ^ - ((int) (Double.doubleToLongBits(x) ^ (Double.doubleToLongBits(x) >>> 32)) >> 13) ^ - (int) (Double.doubleToLongBits(z) ^ (Double.doubleToLongBits(z) >>> 32)); - } -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVectorFace.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVectorFace.java deleted file mode 100644 index 306b2ea34..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldVectorFace.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -/** - * @deprecated Use {@link com.sk89q.worldedit.util.Location} wherever possible - */ -@SuppressWarnings("deprecation") -@Deprecated -public class WorldVectorFace extends WorldVector { - - private VectorFace face; - - public WorldVectorFace(LocalWorld world, double x, double y, double z, VectorFace face) { - super(world, x, y, z); - this.face = face; - } - - public WorldVectorFace(LocalWorld world, int x, int y, int z, VectorFace face) { - super(world, x, y, z); - this.face = face; - } - - public WorldVectorFace(LocalWorld world, float x, float y, float z, VectorFace face) { - super(world, x, y, z); - this.face = face; - } - - public WorldVectorFace(LocalWorld world, Vector pt, VectorFace face) { - super(world, pt); - this.face = face; - } - - public WorldVectorFace(LocalWorld world, VectorFace face) { - super(world); - this.face = face; - } - - /** - * Get the face. - * - * @return the face - */ - public VectorFace getFace() { - return face; - } - - /** - * Get the WorldVector adjacent to this WorldVectorFace. - * - * @return the face vector - */ - public WorldVector getFaceVector() { - return new WorldVector(getWorld(), - getBlockX() - face.getModX(), - getBlockY() - face.getModY(), - getBlockZ() - face.getModZ()); - } - - /** - * Get a WorldVectorFace by comparing two vectors. Note that they need not be - * adjacent, as only the directions, not distance, will be taken into account. - * - * @param world the world in which the resulting vector should lie - * @param vector the original vector - * @param face the direction in which the face should lie - * @return a face - */ - public static WorldVectorFace getWorldVectorFace(LocalWorld world, Vector vector, Vector face) { - if (vector == null || face == null) return null; - // check which direction the face is from the vector - final int x1 = vector.getBlockX(); - final int y1 = vector.getBlockY(); - final int z1 = vector.getBlockZ(); - int modX = x1 - face.getBlockX(); - int modY = y1 - face.getBlockY(); - int modZ = z1 - face.getBlockZ(); - if (modX > 0) modX = 1; - else if (modX < 0) modX = -1; - else modX = 0; - if (modY > 0) modY = 1; - else if (modY < 0) modY = -1; - else modY = 0; - if (modZ > 0) modZ = 1; - else if (modZ < 0) modZ = -1; - else modZ = 0; - // construct new vector - return new WorldVectorFace(world, x1, y1, z1, VectorFace.fromMods(modX, modY, modZ)); - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java deleted file mode 100644 index cc8bcf05c..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java +++ /dev/null @@ -1,410 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.CuboidClipboard.FlipDirection; -import com.sk89q.worldedit.foundation.Block; -import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.world.registry.WorldData; - -import javax.annotation.Nullable; -import java.util.Collection; - -/** - * Represents a mutable "snapshot" of a block. - * - *

An instance of this block contains all the information needed to - * accurately reproduce the block, provided that the instance was - * made correctly. In some implementations, it may not be possible to get a - * snapshot of blocks correctly, so, for example, the NBT data for a block - * may be missing.

- * - *

This class identifies blocks using an integer ID. However, IDs for - * a given block may differ between worlds so it is important that users of - * this class convert the ID from one "world space" to another "world space," - * a task that that is assisted with by working with the source and - * destination {@link WorldData} instances. Numeric IDs are utilized because - * they are more space efficient to store, and it also implies that internal - * uses of this class (i.e. history, etc.) do not need to worry about - * interning block string IDs.

- * - *

A peculiar detail of this class is that it accepts {@code -1} as a - * valid data value. This is due to legacy reasons: WorldEdit uses -1 - * as a "wildcard" block value, even though a {@link Mask} would be - * more appropriate.

- */ -@SuppressWarnings("deprecation") -public class BaseBlock extends Block implements TileEntityBlock { - - /** - * Indicates the highest possible block ID (inclusive) that can be used. - * This value is subject to change depending on the implementation, but - * internally this class only supports a range of 4096 IDs (for space - * reasons), which coincides with the number of possible IDs that official - * Minecraft supports as of version 1.7. - */ - public static final int MAX_ID = 4095; - - /** - * Indicates the maximum data value (inclusive) that can be used. A future - * version of Minecraft may abolish block data values. - */ - public static final int MAX_DATA = 15; - - // Instances of this class should be _as small as possible_ because there will - // be millions of instances of this object. - - private short id; - private short data; - @Nullable - private CompoundTag nbtData; - - /** - * Construct a block with the given ID and a data value of 0. - * - * @param id ID value - * @see #setId(int) - */ - public BaseBlock(int id) { - internalSetId(id); - internalSetData(0); - } - - /** - * Construct a block with the given ID and data value. - * - * @param id ID value - * @param data data value - * @see #setId(int) - * @see #setData(int) - */ - public BaseBlock(int id, int data) { - internalSetId(id); - internalSetData(data); - } - - /** - * Construct a block with the given ID, data value and NBT data structure. - * - * @param id ID value - * @param data data value - * @param nbtData NBT data, which may be null - */ - public BaseBlock(int id, int data, @Nullable CompoundTag nbtData) { - setId(id); - setData(data); - setNbtData(nbtData); - } - - /** - * Create a clone of another block. - * - * @param other the other block - */ - public BaseBlock(BaseBlock other) { - this(other.getId(), other.getData(), other.getNbtData()); - } - - /** - * Get the ID of the block. - * - * @return ID (between 0 and {@link #MAX_ID}) - */ - @Override - public int getId() { - return id; - } - - /** - * Set the block ID. - * - * @param id block id (between 0 and {@link #MAX_ID}). - */ - protected final void internalSetId(int id) { - if (id > MAX_ID) { - throw new IllegalArgumentException("Can't have a block ID above " - + MAX_ID + " (" + id + " given)"); - } - - if (id < 0) { - throw new IllegalArgumentException("Can't have a block ID below 0"); - } - - this.id = (short) id; - } - - /** - * Set the block ID. - * - * @param id block id (between 0 and {@link #MAX_ID}). - */ - @Override - public void setId(int id) { - internalSetId(id); - } - - /** - * Get the block's data value. - * - * @return data value (0-15) - */ - @Override - public int getData() { - return data; - } - - /** - * Set the block's data value. - * - * @param data block data value (between 0 and {@link #MAX_DATA}). - */ - protected final void internalSetData(int data) { - if (data > MAX_DATA) { - throw new IllegalArgumentException( - "Can't have a block data value above " + MAX_DATA + " (" - + data + " given)"); - } - - if (data < -1) { - throw new IllegalArgumentException("Can't have a block data value below -1"); - } - - this.data = (short) data; - } - - /** - * Set the block's data value. - * - * @param data block data value (between 0 and {@link #MAX_DATA}). - */ - @Override - public void setData(int data) { - internalSetData(data); - } - - /** - * Set both the block's ID and data value. - * - * @param id ID value - * @param data data value - * @see #setId(int) - * @see #setData(int) - */ - @Override - public void setIdAndData(int id, int data) { - setId(id); - setData(data); - } - - /** - * Returns whether the data value is -1, indicating that this block is to be - * used as a wildcard matching block. - * - * @return true if the data value is -1 - */ - @Override - public boolean hasWildcardData() { - return getData() == -1; - } - - @Override - public boolean hasNbtData() { - return getNbtData() != null; - } - - @Override - public String getNbtId() { - CompoundTag nbtData = getNbtData(); - if (nbtData == null) { - return ""; - } - Tag idTag = nbtData.getValue().get("id"); - if (idTag != null && idTag instanceof StringTag) { - return ((StringTag) idTag).getValue(); - } else { - return ""; - } - } - - @Nullable - @Override - public CompoundTag getNbtData() { - return nbtData; - } - - @Override - public void setNbtData(@Nullable CompoundTag nbtData) { - this.nbtData = nbtData; - } - - /** - * Get the type of block. - * - * @return the type - */ - public int getType() { - return getId(); - } - - /** - * Set the type of block. - * - * @param type the type to set - */ - public void setType(int type) { - setId(type); - } - - /** - * Returns true if it's air. - * - * @return if air - */ - public boolean isAir() { - return getType() == BlockID.AIR; - } - - /** - * Rotate this block 90 degrees. - * - * @return new data value - * @deprecated Use {@link BlockData#rotate90(int, int)} - */ - @Deprecated - public int rotate90() { - int newData = BlockData.rotate90(getType(), getData()); - setData(newData); - return newData; - } - - /** - * Rotate this block -90 degrees. - * - * @return new data value - * @deprecated Use {@link BlockData#rotate90Reverse(int, int)} - */ - @Deprecated - public int rotate90Reverse() { - int newData = BlockData.rotate90Reverse(getType(), getData()); - setData((short) newData); - return newData; - } - - /** - * Cycle the damage value of the block forward or backward - * - * @param increment 1 for forward, -1 for backward - * @return new data value - * @deprecated Use {@link BlockData#cycle(int, int, int)} - */ - @Deprecated - public int cycleData(int increment) { - int newData = BlockData.cycle(getType(), getData(), increment); - setData((short) newData); - return newData; - } - - /** - * Flip this block. - * - * @return this block - * @deprecated Use {@link BlockData#flip(int, int)} - */ - @Deprecated - public BaseBlock flip() { - setData((short) BlockData.flip(getType(), getData())); - return this; - } - - /** - * Flip this block. - * - * @param direction direction to flip in - * @return this block - * @deprecated Use {@link BlockData#flip(int, int, FlipDirection)} - */ - @Deprecated - public BaseBlock flip(FlipDirection direction) { - setData((short) BlockData.flip(getType(), getData(), direction)); - return this; - } - - /** - * Checks whether the type ID and data value are equal. - */ - @Override - public boolean equals(Object o) { - if (!(o instanceof BaseBlock)) { - return false; - } - - final BaseBlock otherBlock = (BaseBlock) o; - - return getType() == otherBlock.getType() && getData() == otherBlock.getData(); - - } - - /** - * Checks if the type is the same, and if data is the same if only data != -1. - * - * @param o other block - * @return true if equal - */ - public boolean equalsFuzzy(BaseBlock o) { - return (getType() == o.getType()) && (getData() == o.getData() || getData() == -1 || o.getData() == -1); - } - - /** - * @deprecated This method is silly, use {@link #containsFuzzy(java.util.Collection, BaseBlock)} instead. - */ - @Deprecated - public boolean inIterable(Iterable iter) { - for (BaseBlock block : iter) { - if (block.equalsFuzzy(this)) { - return true; - } - } - return false; - } - - /** - * @deprecated Use {@link Blocks#containsFuzzy(Collection, BaseBlock)} - */ - @Deprecated - public static boolean containsFuzzy(Collection collection, BaseBlock o) { - return Blocks.containsFuzzy(collection, o); - } - - @Override - public int hashCode() { - int ret = getId() << 3; - if (getData() != (byte) -1) ret |= getData(); - return ret; - } - - @Override - public String toString() { - return "Block{ID:" + getId() + ", Data: " + getData() + "}"; - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java index 24a2f5be1..114609e63 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java @@ -19,8 +19,11 @@ package com.sk89q.worldedit.blocks; -import java.util.HashMap; -import java.util.Map; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.world.NbtValued; +import com.sk89q.worldedit.world.item.ItemType; + +import javax.annotation.Nullable; /** * Represents an item, without an amount value. See {@link BaseItemStack} @@ -28,95 +31,63 @@ import java.util.Map; * *

This class may be removed in the future.

*/ -public class BaseItem { +public class BaseItem implements NbtValued { - private int id; - private short data; - private final Map enchantments = new HashMap(); + private ItemType itemType; + @Nullable + private CompoundTag nbtData; /** * Construct the object. * - * @param id ID of the item + * @param itemType Type of the item */ - public BaseItem(int id) { - this.id = id; - this.data = 0; + public BaseItem(ItemType itemType) { + this.itemType = itemType; } /** * Construct the object. * - * @param id ID of the item - * @param data data value of the item + * @param itemType Type of the item + * @param tag NBT Compound tag */ - public BaseItem(int id, short data) { - this.id = id; - this.data = data; + public BaseItem(ItemType itemType, CompoundTag tag) { + this.itemType = itemType; + this.nbtData = tag; } /** * Get the type of item. - * - * @return the id + * + * @return the type */ - public int getType() { - return id; + public ItemType getType() { + return this.itemType; } /** - * Get the type of item. - * - * @param id the id to set + * Set the type of the item. + * + * @param itemType The type to set */ - public void setType(int id) { - this.id = id; + public void setType(ItemType itemType) { + this.itemType = itemType; } - /** - * Get the damage value. - * - * @return the damage - */ - @Deprecated - public short getDamage() { - return data; + @Override + public boolean hasNbtData() { + return this.nbtData != null; } - /** - * Get the data value. - * - * @return the data - */ - public short getData() { - return data; + @Nullable + @Override + public CompoundTag getNbtData() { + return this.nbtData; } - /** - * Set the data value. - * - * @param data the damage to set - */ - @Deprecated - public void setDamage(short data) { - this.data = data; - } - - /** - * Set the data value. - * - * @param data the damage to set - */ - public void setData(short data) { - this.data = data; - } - - /** - * Get the map of enchantments. - * - * @return map of enchantments - */ - public Map getEnchantments() { - return enchantments; + @Override + public void setNbtData(@Nullable CompoundTag nbtData) { + this.nbtData = nbtData; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItemStack.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItemStack.java index 320fc1b40..6a1a0cbd5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItemStack.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItemStack.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.blocks; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.world.item.ItemType; + /** * Represents a stack of BaseItems. * @@ -29,34 +32,34 @@ public class BaseItemStack extends BaseItem { private int amount = 1; /** - * Construct the object with default stack size of one, with data value of 0. + * Construct the object with default stack size of one, with damage value of 0. * - * @param id with data value of 0. + * @param itemType The item type */ - public BaseItemStack(int id) { - super(id); + public BaseItemStack(ItemType itemType) { + super(itemType); } /** * Construct the object. * - * @param id type ID + * @param itemType The item type * @param amount amount in the stack */ - public BaseItemStack(int id, int amount) { - super(id); + public BaseItemStack(ItemType itemType, int amount) { + super(itemType); this.amount = amount; } /** * Construct the object. * - * @param id type ID + * @param id The item type + * @param tag Tag value * @param amount amount in the stack - * @param data data value */ - public BaseItemStack(int id, int amount, short data) { - super(id, data); + public BaseItemStack(ItemType id, CompoundTag tag, int amount) { + super(id, tag); this.amount = amount; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockData.java deleted file mode 100644 index 006de9041..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockData.java +++ /dev/null @@ -1,1108 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.worldedit.CuboidClipboard.FlipDirection; - -/** - * Block data related classes. - */ -public final class BlockData { - - private BlockData() { - } - - /** - * Rotate a block's data value 90 degrees (north->east->south->west->north); - * - * @param type the type ID of the bock - * @param data the data ID of the block - * @return the new data value - */ - public static int rotate90(int type, int data) { - switch (type) { - case BlockID.TORCH: - case BlockID.REDSTONE_TORCH_OFF: - case BlockID.REDSTONE_TORCH_ON: - switch (data) { - case 1: return 3; - case 2: return 4; - case 3: return 2; - case 4: return 1; - } - break; - - case BlockID.MINECART_TRACKS: - switch (data) { - case 6: return 7; - case 7: return 8; - case 8: return 9; - case 9: return 6; - } - /* FALL-THROUGH */ - - case BlockID.POWERED_RAIL: - case BlockID.DETECTOR_RAIL: - case BlockID.ACTIVATOR_RAIL: - switch (data & 0x7) { - case 0: return 1 | (data & ~0x7); - case 1: return 0 | (data & ~0x7); - case 2: return 5 | (data & ~0x7); - case 3: return 4 | (data & ~0x7); - case 4: return 2 | (data & ~0x7); - case 5: return 3 | (data & ~0x7); - } - break; - - case BlockID.OAK_WOOD_STAIRS: - case BlockID.COBBLESTONE_STAIRS: - case BlockID.BRICK_STAIRS: - case BlockID.STONE_BRICK_STAIRS: - case BlockID.NETHER_BRICK_STAIRS: - case BlockID.SANDSTONE_STAIRS: - case BlockID.SPRUCE_WOOD_STAIRS: - case BlockID.BIRCH_WOOD_STAIRS: - case BlockID.JUNGLE_WOOD_STAIRS: - case BlockID.QUARTZ_STAIRS: - case BlockID.ACACIA_STAIRS: - case BlockID.DARK_OAK_STAIRS: - switch (data) { - case 0: return 2; - case 1: return 3; - case 2: return 1; - case 3: return 0; - case 4: return 6; - case 5: return 7; - case 6: return 5; - case 7: return 4; - } - break; - - case BlockID.STONE_BUTTON: - case BlockID.WOODEN_BUTTON: { - int thrown = data & 0x8; - switch (data & ~0x8) { - case 1: return 3 | thrown; - case 2: return 4 | thrown; - case 3: return 2 | thrown; - case 4: return 1 | thrown; - // 0 and 5 are vertical - } - break; - } - - case BlockID.LEVER: { - int thrown = data & 0x8; - switch (data & ~0x8) { - case 1: return 3 | thrown; - case 2: return 4 | thrown; - case 3: return 2 | thrown; - case 4: return 1 | thrown; - case 5: return 6 | thrown; - case 6: return 5 | thrown; - case 7: return 0 | thrown; - case 0: return 7 | thrown; - } - break; - } - - case BlockID.WOODEN_DOOR: - case BlockID.IRON_DOOR: - if ((data & 0x8) != 0) { - // door top halves contain no orientation information - break; - } - - /* FALL-THROUGH */ - - case BlockID.COCOA_PLANT: - case BlockID.TRIPWIRE_HOOK: { - int extra = data & ~0x3; - int withoutFlags = data & 0x3; - switch (withoutFlags) { - case 0: return 1 | extra; - case 1: return 2 | extra; - case 2: return 3 | extra; - case 3: return 0 | extra; - } - break; - } - case BlockID.SIGN_POST: - return (data + 4) % 16; - - case BlockID.LADDER: - case BlockID.WALL_SIGN: - case BlockID.CHEST: - case BlockID.FURNACE: - case BlockID.BURNING_FURNACE: - case BlockID.ENDER_CHEST: - case BlockID.TRAPPED_CHEST: - case BlockID.HOPPER: { - int extra = data & 0x8; - int withoutFlags = data & ~0x8; - switch (withoutFlags) { - case 2: return 5 | extra; - case 3: return 4 | extra; - case 4: return 2 | extra; - case 5: return 3 | extra; - } - break; - } - case BlockID.DISPENSER: - case BlockID.DROPPER: - int dispPower = data & 0x8; - switch (data & ~0x8) { - case 2: return 5 | dispPower; - case 3: return 4 | dispPower; - case 4: return 2 | dispPower; - case 5: return 3 | dispPower; - } - break; - - case BlockID.PUMPKIN: - case BlockID.JACKOLANTERN: - switch (data) { - case 0: return 1; - case 1: return 2; - case 2: return 3; - case 3: return 0; - } - break; - - case BlockID.HAY_BLOCK: - case BlockID.LOG: - case BlockID.LOG2: - if (data >= 4 && data <= 11) data ^= 0xc; - break; - - case BlockID.COMPARATOR_OFF: - case BlockID.COMPARATOR_ON: - case BlockID.REDSTONE_REPEATER_OFF: - case BlockID.REDSTONE_REPEATER_ON: - int dir = data & 0x03; - int delay = data - dir; - switch (dir) { - case 0: return 1 | delay; - case 1: return 2 | delay; - case 2: return 3 | delay; - case 3: return 0 | delay; - } - break; - - case BlockID.TRAP_DOOR: - case BlockID.IRON_TRAP_DOOR: - int withoutOrientation = data & ~0x3; - int orientation = data & 0x3; - switch (orientation) { - case 0: return 3 | withoutOrientation; - case 1: return 2 | withoutOrientation; - case 2: return 0 | withoutOrientation; - case 3: return 1 | withoutOrientation; - } - break; - - case BlockID.PISTON_BASE: - case BlockID.PISTON_STICKY_BASE: - case BlockID.PISTON_EXTENSION: - final int rest = data & ~0x7; - switch (data & 0x7) { - case 2: return 5 | rest; - case 3: return 4 | rest; - case 4: return 2 | rest; - case 5: return 3 | rest; - } - break; - - case BlockID.BROWN_MUSHROOM_CAP: - case BlockID.RED_MUSHROOM_CAP: - if (data >= 10) return data; - return (data * 3) % 10; - - case BlockID.VINE: - return ((data << 1) | (data >> 3)) & 0xf; - - case BlockID.FENCE_GATE: - return ((data + 1) & 0x3) | (data & ~0x3); - - case BlockID.ANVIL: - int damage = data & ~0x3; - switch (data & 0x3) { - case 0: return 3 | damage; - case 2: return 1 | damage; - case 1: return 0 | damage; - case 3: return 2 | damage; - } - break; - - case BlockID.BED: - return data & ~0x3 | (data + 1) & 0x3; - - case BlockID.HEAD: - switch (data) { - case 2: return 5; - case 3: return 4; - case 4: return 2; - case 5: return 3; - } - } - - return data; - } - - /** - * Rotate a block's data value -90 degrees (north<-east<-south<-west<-north); - * - * @param type the type ID of the bock - * @param data the data ID of the block - * @return the new data value - */ - public static int rotate90Reverse(int type, int data) { - // case ([0-9]+): return ([0-9]+) -> case \2: return \1 - - switch (type) { - case BlockID.TORCH: - case BlockID.REDSTONE_TORCH_OFF: - case BlockID.REDSTONE_TORCH_ON: - switch (data) { - case 3: return 1; - case 4: return 2; - case 2: return 3; - case 1: return 4; - } - break; - - case BlockID.MINECART_TRACKS: - switch (data) { - case 7: return 6; - case 8: return 7; - case 9: return 8; - case 6: return 9; - } - /* FALL-THROUGH */ - - case BlockID.POWERED_RAIL: - case BlockID.DETECTOR_RAIL: - case BlockID.ACTIVATOR_RAIL: - int power = data & ~0x7; - switch (data & 0x7) { - case 1: return 0 | power; - case 0: return 1 | power; - case 5: return 2 | power; - case 4: return 3 | power; - case 2: return 4 | power; - case 3: return 5 | power; - } - break; - - case BlockID.OAK_WOOD_STAIRS: - case BlockID.COBBLESTONE_STAIRS: - case BlockID.BRICK_STAIRS: - case BlockID.STONE_BRICK_STAIRS: - case BlockID.NETHER_BRICK_STAIRS: - case BlockID.SANDSTONE_STAIRS: - case BlockID.SPRUCE_WOOD_STAIRS: - case BlockID.BIRCH_WOOD_STAIRS: - case BlockID.JUNGLE_WOOD_STAIRS: - case BlockID.QUARTZ_STAIRS: - case BlockID.ACACIA_STAIRS: - case BlockID.DARK_OAK_STAIRS: - switch (data) { - case 2: return 0; - case 3: return 1; - case 1: return 2; - case 0: return 3; - case 6: return 4; - case 7: return 5; - case 5: return 6; - case 4: return 7; - } - break; - - case BlockID.STONE_BUTTON: - case BlockID.WOODEN_BUTTON: { - int thrown = data & 0x8; - switch (data & ~0x8) { - case 3: return 1 | thrown; - case 4: return 2 | thrown; - case 2: return 3 | thrown; - case 1: return 4 | thrown; - // 0 and 5 are vertical - } - break; - } - - case BlockID.LEVER: { - int thrown = data & 0x8; - switch (data & ~0x8) { - case 3: return 1 | thrown; - case 4: return 2 | thrown; - case 2: return 3 | thrown; - case 1: return 4 | thrown; - case 6: return 5 | thrown; - case 5: return 6 | thrown; - case 0: return 7 | thrown; - case 7: return 0 | thrown; - } - break; - } - - case BlockID.WOODEN_DOOR: - case BlockID.IRON_DOOR: - if ((data & 0x8) != 0) { - // door top halves contain no orientation information - break; - } - - /* FALL-THROUGH */ - - case BlockID.COCOA_PLANT: - case BlockID.TRIPWIRE_HOOK: { - int extra = data & ~0x3; - int withoutFlags = data & 0x3; - switch (withoutFlags) { - case 1: return 0 | extra; - case 2: return 1 | extra; - case 3: return 2 | extra; - case 0: return 3 | extra; - } - break; - } - case BlockID.SIGN_POST: - return (data + 12) % 16; - - case BlockID.LADDER: - case BlockID.WALL_SIGN: - case BlockID.CHEST: - case BlockID.FURNACE: - case BlockID.BURNING_FURNACE: - case BlockID.ENDER_CHEST: - case BlockID.TRAPPED_CHEST: - case BlockID.HOPPER: { - int extra = data & 0x8; - int withoutFlags = data & ~0x8; - switch (withoutFlags) { - case 5: return 2 | extra; - case 4: return 3 | extra; - case 2: return 4 | extra; - case 3: return 5 | extra; - } - break; - } - case BlockID.DISPENSER: - case BlockID.DROPPER: - int dispPower = data & 0x8; - switch (data & ~0x8) { - case 5: return 2 | dispPower; - case 4: return 3 | dispPower; - case 2: return 4 | dispPower; - case 3: return 5 | dispPower; - } - break; - case BlockID.PUMPKIN: - case BlockID.JACKOLANTERN: - switch (data) { - case 1: return 0; - case 2: return 1; - case 3: return 2; - case 0: return 3; - } - break; - - case BlockID.HAY_BLOCK: - case BlockID.LOG: - case BlockID.LOG2: - if (data >= 4 && data <= 11) data ^= 0xc; - break; - - case BlockID.COMPARATOR_OFF: - case BlockID.COMPARATOR_ON: - case BlockID.REDSTONE_REPEATER_OFF: - case BlockID.REDSTONE_REPEATER_ON: - int dir = data & 0x03; - int delay = data - dir; - switch (dir) { - case 1: return 0 | delay; - case 2: return 1 | delay; - case 3: return 2 | delay; - case 0: return 3 | delay; - } - break; - - case BlockID.TRAP_DOOR: - case BlockID.IRON_TRAP_DOOR: - int withoutOrientation = data & ~0x3; - int orientation = data & 0x3; - switch (orientation) { - case 3: return 0 | withoutOrientation; - case 2: return 1 | withoutOrientation; - case 0: return 2 | withoutOrientation; - case 1: return 3 | withoutOrientation; - } - - case BlockID.PISTON_BASE: - case BlockID.PISTON_STICKY_BASE: - case BlockID.PISTON_EXTENSION: - final int rest = data & ~0x7; - switch (data & 0x7) { - case 5: return 2 | rest; - case 4: return 3 | rest; - case 2: return 4 | rest; - case 3: return 5 | rest; - } - break; - - case BlockID.BROWN_MUSHROOM_CAP: - case BlockID.RED_MUSHROOM_CAP: - if (data >= 10) return data; - return (data * 7) % 10; - - case BlockID.VINE: - return ((data >> 1) | (data << 3)) & 0xf; - - case BlockID.FENCE_GATE: - return ((data + 3) & 0x3) | (data & ~0x3); - - case BlockID.ANVIL: - int damage = data & ~0x3; - switch (data & 0x3) { - case 0: return 1 | damage; - case 2: return 3 | damage; - case 1: return 2 | damage; - case 3: return 0 | damage; - } - break; - - case BlockID.BED: - return data & ~0x3 | (data - 1) & 0x3; - - case BlockID.HEAD: - switch (data) { - case 2: return 4; - case 3: return 5; - case 4: return 3; - case 5: return 2; - } - } - - return data; - } - - /** - * Flip a block's data value. - * - * @param type the type ID of the bock - * @param data the data ID of the block - * @return the new data value - */ - public static int flip(int type, int data) { - return rotate90(type, rotate90(type, data)); - } - - /** - * Flip a block's data value. - * - * @param type the type ID of the bock - * @param data the data ID of the block - * @param direction the direction to flip - * @return the new data value - */ - public static int flip(int type, int data, FlipDirection direction) { - int flipX = 0; - int flipY = 0; - int flipZ = 0; - - switch (direction) { - case NORTH_SOUTH: - flipZ = 1; - break; - - case WEST_EAST: - flipX = 1; - break; - - case UP_DOWN: - flipY = 1; - break; - } - - switch (type) { - case BlockID.TORCH: - case BlockID.REDSTONE_TORCH_OFF: - case BlockID.REDSTONE_TORCH_ON: - if (data < 1 || data > 4) break; - switch (data) { - case 1: return data + flipX; - case 2: return data - flipX; - case 3: return data + flipZ; - case 4: return data - flipZ; - } - break; - - case BlockID.STONE_BUTTON: - case BlockID.WOODEN_BUTTON: { - switch (data & ~0x8) { - case 1: return data + flipX; - case 2: return data - flipX; - case 3: return data + flipZ; - case 4: return data - flipZ; - case 0: - case 5: - return data ^ (flipY * 5); - } - break; - } - - case BlockID.LEVER: - switch (data & ~0x8) { - case 1: return data + flipX; - case 2: return data - flipX; - case 3: return data + flipZ; - case 4: return data - flipZ; - case 5: - case 7: - return data ^ flipY << 1; - case 6: - case 0: - return data ^ flipY * 6; - } - break; - - case BlockID.MINECART_TRACKS: - switch (data) { - case 6: return data + flipX + flipZ * 3; - case 7: return data - flipX + flipZ; - case 8: return data + flipX - flipZ; - case 9: return data - flipX - flipZ * 3; - } - /* FALL-THROUGH */ - - case BlockID.POWERED_RAIL: - case BlockID.DETECTOR_RAIL: - case BlockID.ACTIVATOR_RAIL: - switch (data & 0x7) { - case 0: - case 1: - return data; - case 2: - case 3: - return data ^ flipX; - case 4: - case 5: - return data ^ flipZ; - } - break; - - case BlockID.STEP: - case BlockID.WOODEN_STEP: - return data ^ (flipY << 3); - - case BlockID.OAK_WOOD_STAIRS: - case BlockID.COBBLESTONE_STAIRS: - case BlockID.BRICK_STAIRS: - case BlockID.STONE_BRICK_STAIRS: - case BlockID.NETHER_BRICK_STAIRS: - case BlockID.SANDSTONE_STAIRS: - case BlockID.SPRUCE_WOOD_STAIRS: - case BlockID.BIRCH_WOOD_STAIRS: - case BlockID.JUNGLE_WOOD_STAIRS: - case BlockID.QUARTZ_STAIRS: - case BlockID.ACACIA_STAIRS: - case BlockID.DARK_OAK_STAIRS: - data ^= flipY << 2; - switch (data) { - case 0: - case 1: - case 4: - case 5: - return data ^ flipX; - case 2: - case 3: - case 6: - case 7: - return data ^ flipZ; - } - break; - - case BlockID.WOODEN_DOOR: - case BlockID.IRON_DOOR: - if ((data & 0x8) != 0) { - // door top halves contain no orientation information - break; - } - - switch (data & 0x3) { - case 0: return data + flipX + flipZ * 3; - case 1: return data - flipX + flipZ; - case 2: return data + flipX - flipZ; - case 3: return data - flipX - flipZ * 3; - } - break; - - case BlockID.SIGN_POST: - switch (direction) { - case NORTH_SOUTH: - return (16 - data) & 0xf; - case WEST_EAST: - return (8 - data) & 0xf; - default: - } - break; - - case BlockID.LADDER: - case BlockID.WALL_SIGN: - case BlockID.CHEST: - case BlockID.FURNACE: - case BlockID.BURNING_FURNACE: - case BlockID.ENDER_CHEST: - case BlockID.TRAPPED_CHEST: - case BlockID.HOPPER: - int extra = data & 0x8; - int withoutFlags = data & ~0x8; - switch (withoutFlags) { - case 2: - case 3: - return (data ^ flipZ) | extra; - case 4: - case 5: - return (data ^ flipX) | extra; - } - break; - - case BlockID.DROPPER: - case BlockID.DISPENSER: - int dispPower = data & 0x8; - switch (data & ~0x8) { - case 2: - case 3: - return (data ^ flipZ) | dispPower; - case 4: - case 5: - return (data ^ flipX) | dispPower; - case 0: - case 1: - return (data ^ flipY) | dispPower; - } - break; - - case BlockID.PUMPKIN: - case BlockID.JACKOLANTERN: - if (data > 3) break; - /* FALL-THROUGH */ - - case BlockID.REDSTONE_REPEATER_OFF: - case BlockID.REDSTONE_REPEATER_ON: - case BlockID.COMPARATOR_OFF: - case BlockID.COMPARATOR_ON: - case BlockID.COCOA_PLANT: - case BlockID.TRIPWIRE_HOOK: - switch (data & 0x3) { - case 0: - case 2: - return data ^ (flipZ << 1); - case 1: - case 3: - return data ^ (flipX << 1); - } - break; - - case BlockID.TRAP_DOOR: - case BlockID.IRON_TRAP_DOOR: - switch (data & 0x3) { - case 0: - case 1: - return data ^ flipZ; - case 2: - case 3: - return data ^ flipX; - } - break; - - case BlockID.PISTON_BASE: - case BlockID.PISTON_STICKY_BASE: - case BlockID.PISTON_EXTENSION: - switch (data & ~0x8) { - case 0: - case 1: - return data ^ flipY; - case 2: - case 3: - return data ^ flipZ; - case 4: - case 5: - return data ^ flipX; - } - break; - - case BlockID.RED_MUSHROOM_CAP: - case BlockID.BROWN_MUSHROOM_CAP: - switch (data) { - case 1: - case 4: - case 7: - data += flipX * 2; - break; - case 3: - case 6: - case 9: - data -= flipX * 2; - break; - } - switch (data) { - case 1: - case 2: - case 3: - return data + flipZ * 6; - case 7: - case 8: - case 9: - return data - flipZ * 6; - } - break; - - case BlockID.VINE: - final int bit1, bit2; - switch (direction) { - case NORTH_SOUTH: - bit1 = 0x2; - bit2 = 0x8; - break; - case WEST_EAST: - bit1 = 0x1; - bit2 = 0x4; - break; - default: - return data; - } - int newData = data & ~(bit1 | bit2); - if ((data & bit1) != 0) newData |= bit2; - if ((data & bit2) != 0) newData |= bit1; - return newData; - - case BlockID.FENCE_GATE: - switch (data & 0x3) { - case 0: - case 2: - return data ^ flipZ << 1; - case 1: - case 3: - return data ^ flipX << 1; - } - break; - - case BlockID.BED: - switch (data & 0x3) { - case 0: - case 2: - return data ^ flipZ << 1; - case 1: - case 3: - return data ^ flipX << 1; - } - break; - - case BlockID.HEAD: - switch (data) { - case 2: - case 3: - return data ^ flipZ; - case 4: - case 5: - return data ^ flipX; - } - break; - - case BlockID.ANVIL: - switch (data & 0x3) { - case 0: - case 2: - return data ^ flipZ << 1; - case 1: - case 3: - return data ^ flipX << 1; - } - break; - - } - - return data; - } - - /** - * Cycle a block's data value. This usually goes through some rotational pattern - * depending on the block. If it returns -1, it means the id and data specified - * do not have anything to cycle to. - * - * @param type block id to be cycled - * @param data block data value that it starts at - * @param increment whether to go forward (1) or backward (-1) in the cycle - * @return the new data value for the block - */ - public static int cycle(int type, int data, int increment) { - if (increment != -1 && increment != 1) { - throw new IllegalArgumentException("Increment must be 1 or -1."); - } - - int store; - switch (type) { - - // special case here, going to use "forward" for type and "backward" for orientation - case BlockID.LOG: - case BlockID.LOG2: - if (increment == -1) { - store = data & 0x3; // copy bottom (type) bits - return mod((data & ~0x3) + 4, 16) | store; // switch orientation with top bits and reapply bottom bits; - } else { - store = data & ~0x3; // copy top (orientation) bits - return mod((data & 0x3) + 1, 4) | store; // switch type with bottom bits and reapply top bits - } - - // same here - screw you unit tests - /*case BlockID.QUARTZ_BLOCK: - if (increment == -1 && data > 2) { - switch (data) { - case 2: return 3; - case 3: return 4; - case 4: return 2; - } - } else if (increment == 1) { - switch (data) { - case 0: - return 1; - case 1: - return 2; - case 2: - case 3: - case 4: - return 0; - } - } else { - return -1; - }*/ - - case BlockID.LONG_GRASS: - case BlockID.SANDSTONE: - case BlockID.DIRT: - if (data > 2) return -1; - return mod((data + increment), 3); - - case BlockID.TORCH: - case BlockID.REDSTONE_TORCH_ON: - case BlockID.REDSTONE_TORCH_OFF: - if (data < 1 || data > 4) return -1; - return mod((data - 1 + increment), 4) + 1; - - case BlockID.OAK_WOOD_STAIRS: - case BlockID.COBBLESTONE_STAIRS: - case BlockID.BRICK_STAIRS: - case BlockID.STONE_BRICK_STAIRS: - case BlockID.NETHER_BRICK_STAIRS: - case BlockID.SANDSTONE_STAIRS: - case BlockID.SPRUCE_WOOD_STAIRS: - case BlockID.BIRCH_WOOD_STAIRS: - case BlockID.JUNGLE_WOOD_STAIRS: - case BlockID.QUARTZ_STAIRS: - case BlockID.ACACIA_STAIRS: - case BlockID.DARK_OAK_STAIRS: - if (data > 7) return -1; - return mod((data + increment), 8); - - case BlockID.STONE_BRICK: - case BlockID.QUARTZ_BLOCK: - case BlockID.PUMPKIN: - case BlockID.JACKOLANTERN: - case BlockID.NETHER_WART: - case BlockID.CAULDRON: - case BlockID.WOODEN_STEP: - case BlockID.DOUBLE_WOODEN_STEP: - case BlockID.HAY_BLOCK: - if (data > 3) return -1; - return mod((data + increment), 4); - - case BlockID.STEP: - case BlockID.DOUBLE_STEP: - case BlockID.CAKE_BLOCK: - case BlockID.PISTON_BASE: - case BlockID.PISTON_STICKY_BASE: - case BlockID.SILVERFISH_BLOCK: - if (data > 5) return -1; - return mod((data + increment), 6); - - case BlockID.DOUBLE_PLANT: - store = data & 0x8; // top half flag - data &= ~0x8; - if (data > 5) return -1; - return mod((data + increment), 6) | store; - - case BlockID.CROPS: - case BlockID.PUMPKIN_STEM: - case BlockID.MELON_STEM: - if (data > 6) return -1; - return mod((data + increment), 7); - - case BlockID.SOIL: - case BlockID.RED_FLOWER: - if (data > 8) return -1; - return mod((data + increment), 9); - - case BlockID.RED_MUSHROOM_CAP: - case BlockID.BROWN_MUSHROOM_CAP: - if (data > 10) return -1; - return mod((data + increment), 11); - - case BlockID.CACTUS: - case BlockID.REED: - case BlockID.SIGN_POST: - case BlockID.VINE: - case BlockID.SNOW: - case BlockID.COCOA_PLANT: - if (data > 15) return -1; - return mod((data + increment), 16); - - case BlockID.FURNACE: - case BlockID.BURNING_FURNACE: - case BlockID.WALL_SIGN: - case BlockID.LADDER: - case BlockID.CHEST: - case BlockID.ENDER_CHEST: - case BlockID.TRAPPED_CHEST: - case BlockID.HOPPER: - int extra = data & 0x8; - int withoutFlags = data & ~0x8; - if (withoutFlags < 2 || withoutFlags > 5) return -1; - return (mod((withoutFlags - 2 + increment), 4) + 2) | extra; - - case BlockID.DISPENSER: - case BlockID.DROPPER: - store = data & 0x8; - data &= ~0x8; - if (data > 5) return -1; - return mod((data + increment), 6) | store; - - case BlockID.REDSTONE_REPEATER_OFF: - case BlockID.REDSTONE_REPEATER_ON: - case BlockID.COMPARATOR_OFF: - case BlockID.COMPARATOR_ON: - case BlockID.TRAP_DOOR: - case BlockID.FENCE_GATE: - case BlockID.LEAVES: - case BlockID.LEAVES2: - if (data > 7) return -1; - store = data & ~0x3; - return mod(((data & 0x3) + increment), 4) | store; - - case BlockID.MINECART_TRACKS: - if (data < 6 || data > 9) return -1; - return mod((data - 6 + increment), 4) + 6; - - case BlockID.SAPLING: - if ((data & 0x3) == 3 || data > 15) return -1; - store = data & ~0x3; - return mod(((data & 0x3) + increment), 3) | store; - - case BlockID.FLOWER_POT: - if (data > 13) return -1; - return mod((data + increment), 14); - - case BlockID.CLOTH: - case BlockID.STAINED_CLAY: - case BlockID.CARPET: - case BlockID.STAINED_GLASS: - case BlockID.STAINED_GLASS_PANE: - if (increment == 1) { - data = nextClothColor(data); - } else if (increment == -1) { - data = prevClothColor(data); - } - return data; - - default: - return -1; - } - } - - /** - * Returns the data value for the next color of cloth in the rainbow. This - * should not be used if you want to just increment the data value. - * - * @param data the data value - * @return the next data value - */ - public static int nextClothColor(int data) { - switch (data) { - case ClothColor.ID.WHITE: return ClothColor.ID.LIGHT_GRAY; - case ClothColor.ID.LIGHT_GRAY: return ClothColor.ID.GRAY; - case ClothColor.ID.GRAY: return ClothColor.ID.BLACK; - case ClothColor.ID.BLACK: return ClothColor.ID.BROWN; - case ClothColor.ID.BROWN: return ClothColor.ID.RED; - case ClothColor.ID.RED: return ClothColor.ID.ORANGE; - case ClothColor.ID.ORANGE: return ClothColor.ID.YELLOW; - case ClothColor.ID.YELLOW: return ClothColor.ID.LIGHT_GREEN; - case ClothColor.ID.LIGHT_GREEN: return ClothColor.ID.DARK_GREEN; - case ClothColor.ID.DARK_GREEN: return ClothColor.ID.CYAN; - case ClothColor.ID.CYAN: return ClothColor.ID.LIGHT_BLUE; - case ClothColor.ID.LIGHT_BLUE: return ClothColor.ID.BLUE; - case ClothColor.ID.BLUE: return ClothColor.ID.PURPLE; - case ClothColor.ID.PURPLE: return ClothColor.ID.MAGENTA; - case ClothColor.ID.MAGENTA: return ClothColor.ID.PINK; - case ClothColor.ID.PINK: return ClothColor.ID.WHITE; - } - - return ClothColor.ID.WHITE; - } - - /** - * Returns the data value for the previous ext color of cloth in the rainbow. - * This should not be used if you want to just increment the data value. - * - * @param data the data value - * @return the new data value - */ - public static int prevClothColor(int data) { - switch (data) { - case ClothColor.ID.LIGHT_GRAY: return ClothColor.ID.WHITE; - case ClothColor.ID.GRAY: return ClothColor.ID.LIGHT_GRAY; - case ClothColor.ID.BLACK: return ClothColor.ID.GRAY; - case ClothColor.ID.BROWN: return ClothColor.ID.BLACK; - case ClothColor.ID.RED: return ClothColor.ID.BROWN; - case ClothColor.ID.ORANGE: return ClothColor.ID.RED; - case ClothColor.ID.YELLOW: return ClothColor.ID.ORANGE; - case ClothColor.ID.LIGHT_GREEN: return ClothColor.ID.YELLOW; - case ClothColor.ID.DARK_GREEN: return ClothColor.ID.LIGHT_GREEN; - case ClothColor.ID.CYAN: return ClothColor.ID.DARK_GREEN; - case ClothColor.ID.LIGHT_BLUE: return ClothColor.ID.CYAN; - case ClothColor.ID.BLUE: return ClothColor.ID.LIGHT_BLUE; - case ClothColor.ID.PURPLE: return ClothColor.ID.BLUE; - case ClothColor.ID.MAGENTA: return ClothColor.ID.PURPLE; - case ClothColor.ID.PINK: return ClothColor.ID.MAGENTA; - case ClothColor.ID.WHITE: return ClothColor.ID.PINK; - } - - return ClothColor.ID.WHITE; - } - - /** - * Better modulo, not just remainder. - */ - private static int mod(int x, int y) { - int res = x % y; - return res < 0 ? res + y : res; - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java index 89d53fdef..0e0fd917d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java @@ -19,252 +19,73 @@ package com.sk89q.worldedit.blocks; +import com.sk89q.worldedit.world.block.BlockTypes; + /** * List of block IDs. + * + * {@deprecated Please use {@link BlockTypes }} */ +@Deprecated public final class BlockID { - public static final int AIR = 0; - public static final int STONE = 1; - public static final int GRASS = 2; - public static final int DIRT = 3; - public static final int COBBLESTONE = 4; - public static final int WOOD = 5; // PLANKS - public static final int SAPLING = 6; - public static final int BEDROCK = 7; - public static final int WATER = 8; // FLOWING_WATER - public static final int STATIONARY_WATER = 9; // WATER - public static final int LAVA = 10; // FLOWING_LAVA - public static final int STATIONARY_LAVA = 11; // LAVA - public static final int SAND = 12; - public static final int GRAVEL = 13; - public static final int GOLD_ORE = 14; - public static final int IRON_ORE = 15; - public static final int COAL_ORE = 16; - public static final int LOG = 17; - public static final int LEAVES = 18; - public static final int SPONGE = 19; - public static final int GLASS = 20; - public static final int LAPIS_LAZULI_ORE = 21; // LAPIS_ORE - public static final int LAPIS_LAZULI_BLOCK = 22; // LAPIS_BLOCK - public static final int DISPENSER = 23; - public static final int SANDSTONE = 24; - public static final int NOTE_BLOCK = 25; // NOTEBLOCK - public static final int BED = 26; - public static final int POWERED_RAIL = 27; // GOLDEN_RAIL - public static final int DETECTOR_RAIL = 28; - public static final int PISTON_STICKY_BASE = 29; // STICKY_PISTON - public static final int WEB = 30; - public static final int LONG_GRASS = 31; // TALLGRASS - public static final int DEAD_BUSH = 32; // DEADBUSH - public static final int PISTON_BASE = 33; // PISTON - public static final int PISTON_EXTENSION = 34; // PISTON_HEAD - public static final int CLOTH = 35; // WOOL - public static final int PISTON_MOVING_PIECE = 36; // PISTON_EXTENSION - public static final int YELLOW_FLOWER = 37; - public static final int RED_FLOWER = 38; - public static final int BROWN_MUSHROOM = 39; - public static final int RED_MUSHROOM = 40; - public static final int GOLD_BLOCK = 41; - public static final int IRON_BLOCK = 42; - public static final int DOUBLE_STEP = 43; // DOUBLE_STONE_SLAB - public static final int STEP = 44; // STONE_SLAB - public static final int BRICK = 45; // BRICK_BLOCK - public static final int TNT = 46; - public static final int BOOKCASE = 47; // BOOKSHELF - public static final int MOSSY_COBBLESTONE = 48; - public static final int OBSIDIAN = 49; - public static final int TORCH = 50; - public static final int FIRE = 51; - public static final int MOB_SPAWNER = 52; - @Deprecated - public static final int WOODEN_STAIRS = 53; - public static final int OAK_WOOD_STAIRS = 53; // OAK_STAIRS - public static final int CHEST = 54; - public static final int REDSTONE_WIRE = 55; - public static final int DIAMOND_ORE = 56; - public static final int DIAMOND_BLOCK = 57; - public static final int WORKBENCH = 58; // CRAFTING_TABLE - public static final int CROPS = 59; // WHEAT - public static final int SOIL = 60; // FARMLAND - public static final int FURNACE = 61; - public static final int BURNING_FURNACE = 62; // LIT_FURNACE - public static final int SIGN_POST = 63; // STANDING_SIGN - public static final int WOODEN_DOOR = 64; // WOODEN_DOOR - public static final int LADDER = 65; - public static final int MINECART_TRACKS = 66; // RAIL - public static final int COBBLESTONE_STAIRS = 67; // STONE_STAIRS - public static final int WALL_SIGN = 68; - public static final int LEVER = 69; - public static final int STONE_PRESSURE_PLATE = 70; - public static final int IRON_DOOR = 71; - public static final int WOODEN_PRESSURE_PLATE = 72; - public static final int REDSTONE_ORE = 73; // LIT_REDSTONE_ORE - public static final int GLOWING_REDSTONE_ORE = 74; // UNLIT_REDSTONE_ORE - public static final int REDSTONE_TORCH_OFF = 75; // UNLIT_REDSTONE_TORCH - public static final int REDSTONE_TORCH_ON = 76; // LIT_REDSTONE_TORCH - public static final int STONE_BUTTON = 77; - public static final int SNOW = 78; // SNOW_LAYER - public static final int ICE = 79; - public static final int SNOW_BLOCK = 80; // SNOW - public static final int CACTUS = 81; - public static final int CLAY = 82; - public static final int REED = 83; // REEDS - public static final int JUKEBOX = 84; - public static final int FENCE = 85; - public static final int PUMPKIN = 86; - @Deprecated - public static final int NETHERSTONE = 87; - public static final int NETHERRACK = 87; - public static final int SLOW_SAND = 88; // SOUL_SAND - public static final int LIGHTSTONE = 89; // GLOWSTONE - public static final int PORTAL = 90; - public static final int JACKOLANTERN = 91; // LIT_PUMPKIN - public static final int CAKE_BLOCK = 92; // CAKE - public static final int REDSTONE_REPEATER_OFF = 93; // UNPOWERED_REPEATER - public static final int REDSTONE_REPEATER_ON = 94; // POWERED_REPEATER - @Deprecated - public static final int LOCKED_CHEST = 95; - public static final int STAINED_GLASS = 95; - public static final int TRAP_DOOR = 96; // TRAPDOOR - public static final int SILVERFISH_BLOCK = 97; // MONSTER_EGG - public static final int STONE_BRICK = 98; // STONEBRICK - public static final int BROWN_MUSHROOM_CAP = 99; // BROWN_MUSHROOM_BLOCK - public static final int RED_MUSHROOM_CAP = 100; // RED_MUSHROOM_BLOCK - public static final int IRON_BARS = 101; - public static final int GLASS_PANE = 102; - public static final int MELON_BLOCK = 103; - public static final int PUMPKIN_STEM = 104; - public static final int MELON_STEM = 105; - public static final int VINE = 106; - public static final int FENCE_GATE = 107; - public static final int BRICK_STAIRS = 108; - public static final int STONE_BRICK_STAIRS = 109; - public static final int MYCELIUM = 110; - public static final int LILY_PAD = 111; // WATERLILY - public static final int NETHER_BRICK = 112; - public static final int NETHER_BRICK_FENCE = 113; - public static final int NETHER_BRICK_STAIRS = 114; - public static final int NETHER_WART = 115; - public static final int ENCHANTMENT_TABLE = 116; // ENCHANTING_TABLE - public static final int BREWING_STAND = 117; - public static final int CAULDRON = 118; - public static final int END_PORTAL = 119; - public static final int END_PORTAL_FRAME = 120; - public static final int END_STONE = 121; - public static final int DRAGON_EGG = 122; - public static final int REDSTONE_LAMP_OFF = 123; // REDSTONE_LAMP - public static final int REDSTONE_LAMP_ON = 124; // LIT_REDSTONE_LAMP - public static final int DOUBLE_WOODEN_STEP = 125; // DOUBLE_WOODEN_SLAB - public static final int WOODEN_STEP = 126; // WOODEN_SLAB - public static final int COCOA_PLANT = 127; // COCOA - public static final int SANDSTONE_STAIRS = 128; - public static final int EMERALD_ORE = 129; - public static final int ENDER_CHEST = 130; - public static final int TRIPWIRE_HOOK = 131; - public static final int TRIPWIRE = 132; - public static final int EMERALD_BLOCK = 133; - public static final int SPRUCE_WOOD_STAIRS = 134; // SPRUCE_STAIRS - public static final int BIRCH_WOOD_STAIRS = 135; // BRUCE_STAIRS - public static final int JUNGLE_WOOD_STAIRS = 136; // JUNGLE_STAIRS - public static final int COMMAND_BLOCK = 137; - public static final int BEACON = 138; - public static final int COBBLESTONE_WALL = 139; - public static final int FLOWER_POT = 140; - public static final int CARROTS = 141; - public static final int POTATOES = 142; - public static final int WOODEN_BUTTON = 143; - public static final int HEAD = 144; // SKULL - public static final int ANVIL = 145; - public static final int TRAPPED_CHEST = 146; - public static final int PRESSURE_PLATE_LIGHT = 147; // LIGHT_WEIGHTED_PRESSURE_PLATE - public static final int PRESSURE_PLATE_HEAVY = 148; // HEAVY_WEIGHTED_PRESSURE_PLATE - public static final int COMPARATOR_OFF = 149; // UNPOWERED_COMPARATOR - public static final int COMPARATOR_ON = 150; // COMPARATOR - public static final int DAYLIGHT_SENSOR = 151; // DAYLIGHT_DETECTOR - public static final int REDSTONE_BLOCK = 152; - public static final int QUARTZ_ORE = 153; - public static final int HOPPER = 154; - public static final int QUARTZ_BLOCK = 155; - public static final int QUARTZ_STAIRS = 156; - public static final int ACTIVATOR_RAIL = 157; - public static final int DROPPER = 158; - public static final int STAINED_CLAY = 159; // STAINED_HARDENED_CLAY - public static final int STAINED_GLASS_PANE = 160; - public static final int LEAVES2 = 161; - public static final int LOG2 = 162; - public static final int ACACIA_STAIRS = 163; - public static final int DARK_OAK_STAIRS = 164; - public static final int SLIME = 165; - public static final int BARRIER = 166; - public static final int IRON_TRAP_DOOR = 167; - public static final int PRISMARINE = 168; - public static final int SEA_LANTERN = 169; - public static final int HAY_BLOCK = 170; - public static final int CARPET = 171; - public static final int HARDENED_CLAY = 172; - public static final int COAL_BLOCK = 173; - public static final int PACKED_ICE = 174; - public static final int DOUBLE_PLANT = 175; - public static final int STANDING_BANNER = 176; - public static final int WALL_BANNER = 177; - public static final int DAYLIGHT_SENSOR_INVERTED = 178; - public static final int RED_SANDSTONE = 179; - public static final int RED_SANDSTONE_STAIRS = 180; - public static final int DOUBLE_STEP2 = 181; - public static final int STEP2 = 182; - public static final int SPRUCE_FENCE_GATE = 183; - public static final int BIRCH_FENCE_GATE = 184; - public static final int JUNGLE_FENCE_GATE = 185; - public static final int DARK_OAK_FENCE_GATE = 186; - public static final int ACACIA_FENCE_GATE = 187; - public static final int SPRUCE_FENCE = 188; - public static final int BIRCH_FENCE = 189; - public static final int JUNGLE_FENCE = 190; - public static final int DARK_OAK_FENCE = 191; - public static final int ACACIA_FENCE = 192; - public static final int SPRUCE_DOOR = 193; - public static final int BIRCH_DOOR = 194; - public static final int JUNGLE_DOOR = 195; - public static final int ACACIA_DOOR = 196; - public static final int DARK_OAK_DOOR = 197; - public static final int END_ROD = 198; - public static final int CHORUS_PLANT = 199; - public static final int CHORUS_FLOWER = 200; - public static final int PURPUR_BLOCK = 201; - public static final int PURPUR_PILLAR = 202; - public static final int PURPUR_STAIRS = 203; - public static final int PURPUR_DOUBLE_SLAB = 204; - public static final int PURPUR_SLAB = 205; - public static final int END_BRICKS = 206; - public static final int BEETROOTS = 207; - public static final int GRASS_PATH = 208; - public static final int END_GATEWAY = 209; - public static final int REPEATING_COMMAND_BLOCK = 210; - public static final int CHAIN_COMMAND_BLOCK = 211; - public static final int FROSTED_ICE = 212; - public static final int MAGMA_BLOCK = 213; - public static final int NETHER_WART_BLOCK = 214; - public static final int RED_NETHER_BRICK = 215; - public static final int BONE_BLOCK = 216; - public static final int STRUCTURE_VOID = 217; - public static final int OBSERVER = 218; - public static final int SHULKER_BOX_WHITE = 219; - public static final int SHULKER_BOX_ORANGE = 220; - public static final int SHULKER_BOX_MAGENTA = 221; - public static final int SHULKER_BOX_LIGHT_BLUE = 222; - public static final int SHULKER_BOX_YELLOW = 223; - public static final int SHULKER_BOX_LIME = 224; - public static final int SHULKER_BOX_PINK = 225; - public static final int SHULKER_BOX_GRAY = 226; - public static final int SHULKER_BOX_LIGHT_GRAY = 227; - public static final int SHULKER_BOX_CYAN = 228; - public static final int SHULKER_BOX_PURPLE = 229; - public static final int SHULKER_BOX_BLUE = 230; - public static final int SHULKER_BOX_BROWN = 231; - public static final int SHULKER_BOX_GREEN = 232; - public static final int SHULKER_BOX_RED = 233; - public static final int SHULKER_BOX_BLACK = 234; - public static final int STRUCTURE_BLOCK = 255; + static final int SAPLING = 6; + static final int POWERED_RAIL = 27; // GOLDEN_RAIL + static final int DETECTOR_RAIL = 28; + static final int LONG_GRASS = 31; // TALLGRASS + static final int DEAD_BUSH = 32; // DEADBUSH + static final int PISTON_EXTENSION = 34; // PISTON_HEAD + static final int YELLOW_FLOWER = 37; + static final int RED_FLOWER = 38; + static final int BROWN_MUSHROOM = 39; + static final int RED_MUSHROOM = 40; + static final int TORCH = 50; + static final int REDSTONE_WIRE = 55; + static final int CROPS = 59; // WHEAT + static final int SIGN_POST = 63; // STANDING_SIGN + static final int WOODEN_DOOR = 64; // WOODEN_DOOR + static final int LADDER = 65; + static final int MINECART_TRACKS = 66; // RAIL + static final int WALL_SIGN = 68; + static final int LEVER = 69; + static final int STONE_PRESSURE_PLATE = 70; + static final int IRON_DOOR = 71; + static final int WOODEN_PRESSURE_PLATE = 72; + static final int REDSTONE_TORCH_OFF = 75; // UNLIT_REDSTONE_TORCH + static final int REDSTONE_TORCH_ON = 76; // LIT_REDSTONE_TORCH + static final int STONE_BUTTON = 77; + static final int CACTUS = 81; + static final int REED = 83; // REEDS + static final int CAKE_BLOCK = 92; // CAKE + static final int REDSTONE_REPEATER_OFF = 93; // UNPOWERED_REPEATER + static final int REDSTONE_REPEATER_ON = 94; // POWERED_REPEATER + static final int TRAP_DOOR = 96; // TRAPDOOR + static final int PUMPKIN_STEM = 104; + static final int MELON_STEM = 105; + static final int VINE = 106; + static final int NETHER_WART = 115; + static final int COCOA_PLANT = 127; // COCOA + static final int TRIPWIRE_HOOK = 131; + static final int TRIPWIRE = 132; + static final int FLOWER_POT = 140; + static final int CARROTS = 141; + static final int POTATOES = 142; + static final int WOODEN_BUTTON = 143; + static final int ANVIL = 145; + static final int PRESSURE_PLATE_LIGHT = 147; // LIGHT_WEIGHTED_PRESSURE_PLATE + static final int PRESSURE_PLATE_HEAVY = 148; // HEAVY_WEIGHTED_PRESSURE_PLATE + static final int COMPARATOR_OFF = 149; // UNPOWERED_COMPARATOR + static final int COMPARATOR_ON = 150; // COMPARATOR + static final int ACTIVATOR_RAIL = 157; + static final int IRON_TRAP_DOOR = 167; + static final int CARPET = 171; + static final int DOUBLE_PLANT = 175; + static final int STANDING_BANNER = 176; + static final int WALL_BANNER = 177; + static final int SPRUCE_DOOR = 193; + static final int BIRCH_DOOR = 194; + static final int JUNGLE_DOOR = 195; + static final int ACACIA_DOOR = 196; + static final int DARK_OAK_DOOR = 197; private BlockID() { } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java index bfe64a9cf..d21635cf5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java @@ -19,1844 +19,23 @@ package com.sk89q.worldedit.blocks; -import com.sk89q.util.StringUtil; import com.sk89q.worldedit.PlayerDirection; -import javax.annotation.Nullable; - -import java.util.EnumSet; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; -import java.util.Random; -import java.util.Set; - -import static com.google.common.base.Preconditions.checkNotNull; /** * Block types. + * + * {@deprecated Please use {@link com.sk89q.worldedit.world.block.BlockType }} */ +@Deprecated public enum BlockType { - AIR(BlockID.AIR, "Air", "air"), - STONE(BlockID.STONE, "Stone", "stone", "rock"), - GRASS(BlockID.GRASS, "Grass", "grass"), - DIRT(BlockID.DIRT, "Dirt", "dirt"), - COBBLESTONE(BlockID.COBBLESTONE, "Cobblestone", "cobblestone", "cobble"), - WOOD(BlockID.WOOD, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"), - SAPLING(BlockID.SAPLING, "Sapling", "sapling", "seedling"), - BEDROCK(BlockID.BEDROCK, "Bedrock", "adminium", "bedrock"), - WATER(BlockID.WATER, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"), - STATIONARY_WATER(BlockID.STATIONARY_WATER, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"), - LAVA(BlockID.LAVA, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"), - STATIONARY_LAVA(BlockID.STATIONARY_LAVA, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"), - SAND(BlockID.SAND, "Sand", "sand"), - GRAVEL(BlockID.GRAVEL, "Gravel", "gravel"), - GOLD_ORE(BlockID.GOLD_ORE, "Gold ore", "goldore"), - IRON_ORE(BlockID.IRON_ORE, "Iron ore", "ironore"), - COAL_ORE(BlockID.COAL_ORE, "Coal ore", "coalore"), - LOG(BlockID.LOG, "Log", "log", "tree", "pine", "oak", "birch", "redwood"), - LEAVES(BlockID.LEAVES, "Leaves", "leaves", "leaf"), - SPONGE(BlockID.SPONGE, "Sponge", "sponge"), - GLASS(BlockID.GLASS, "Glass", "glass"), - LAPIS_LAZULI_ORE(BlockID.LAPIS_LAZULI_ORE, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"), - LAPIS_LAZULI(BlockID.LAPIS_LAZULI_BLOCK, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"), - DISPENSER(BlockID.DISPENSER, "Dispenser", "dispenser"), - SANDSTONE(BlockID.SANDSTONE, "Sandstone", "sandstone"), - NOTE_BLOCK(BlockID.NOTE_BLOCK, "Note block", "musicblock", "noteblock", "note", "music", "instrument"), - BED(BlockID.BED, "Bed", "bed"), - POWERED_RAIL(BlockID.POWERED_RAIL, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"), - DETECTOR_RAIL(BlockID.DETECTOR_RAIL, "Detector Rail", "detectorrail", "detector"), - PISTON_STICKY_BASE(BlockID.PISTON_STICKY_BASE, "Sticky Piston", "stickypiston"), - WEB(BlockID.WEB, "Web", "web", "spiderweb"), - LONG_GRASS(BlockID.LONG_GRASS, "Long grass", "longgrass", "tallgrass"), - DEAD_BUSH(BlockID.DEAD_BUSH, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"), - PISTON_BASE(BlockID.PISTON_BASE, "Piston", "piston"), - PISTON_EXTENSION(BlockID.PISTON_EXTENSION, "Piston extension", "pistonextendsion", "pistonhead"), - CLOTH(BlockID.CLOTH, "Wool", "cloth", "wool"), - PISTON_MOVING_PIECE(BlockID.PISTON_MOVING_PIECE, "Piston moving piece", "movingpiston"), - YELLOW_FLOWER(BlockID.YELLOW_FLOWER, "Yellow flower", "yellowflower", "flower"), - RED_FLOWER(BlockID.RED_FLOWER, "Red rose", "redflower", "redrose", "rose"), - BROWN_MUSHROOM(BlockID.BROWN_MUSHROOM, "Brown mushroom", "brownmushroom", "mushroom"), - RED_MUSHROOM(BlockID.RED_MUSHROOM, "Red mushroom", "redmushroom"), - GOLD_BLOCK(BlockID.GOLD_BLOCK, "Gold block", "gold", "goldblock"), - IRON_BLOCK(BlockID.IRON_BLOCK, "Iron block", "iron", "ironblock"), - DOUBLE_STEP(BlockID.DOUBLE_STEP, "Double step", "doubleslab", "doublestoneslab", "doublestep"), - STEP(BlockID.STEP, "Step", "slab", "stoneslab", "step", "halfstep"), - BRICK(BlockID.BRICK, "Brick", "brick", "brickblock"), - TNT(BlockID.TNT, "TNT", "tnt", "c4", "explosive"), - BOOKCASE(BlockID.BOOKCASE, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"), - MOSSY_COBBLESTONE(BlockID.MOSSY_COBBLESTONE, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"), - OBSIDIAN(BlockID.OBSIDIAN, "Obsidian", "obsidian"), - TORCH(BlockID.TORCH, "Torch", "torch", "light", "candle"), - FIRE(BlockID.FIRE, "Fire", "fire", "flame", "flames"), - MOB_SPAWNER(BlockID.MOB_SPAWNER, "Mob spawner", "mobspawner", "spawner"), - WOODEN_STAIRS(BlockID.OAK_WOOD_STAIRS, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"), - CHEST(BlockID.CHEST, "Chest", "chest", "storage", "storagechest"), - REDSTONE_WIRE(BlockID.REDSTONE_WIRE, "Redstone wire", "redstone", "redstoneblock"), - DIAMOND_ORE(BlockID.DIAMOND_ORE, "Diamond ore", "diamondore"), - DIAMOND_BLOCK(BlockID.DIAMOND_BLOCK, "Diamond block", "diamond", "diamondblock"), - WORKBENCH(BlockID.WORKBENCH, "Workbench", "workbench", "table", "craftingtable", "crafting"), - CROPS(BlockID.CROPS, "Crops", "crops", "crop", "plant", "plants"), - SOIL(BlockID.SOIL, "Soil", "soil", "farmland"), - FURNACE(BlockID.FURNACE, "Furnace", "furnace"), - BURNING_FURNACE(BlockID.BURNING_FURNACE, "Furnace (burning)", "burningfurnace", "litfurnace"), - SIGN_POST(BlockID.SIGN_POST, "Sign post", "sign", "signpost"), - WOODEN_DOOR(BlockID.WOODEN_DOOR, "Wooden door", "wooddoor", "woodendoor", "door"), - LADDER(BlockID.LADDER, "Ladder", "ladder"), - MINECART_TRACKS(BlockID.MINECART_TRACKS, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"), - COBBLESTONE_STAIRS(BlockID.COBBLESTONE_STAIRS, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"), - WALL_SIGN(BlockID.WALL_SIGN, "Wall sign", "wallsign"), - LEVER(BlockID.LEVER, "Lever", "lever", "switch", "stonelever", "stoneswitch"), - STONE_PRESSURE_PLATE(BlockID.STONE_PRESSURE_PLATE, "Stone pressure plate", "stonepressureplate", "stoneplate"), - IRON_DOOR(BlockID.IRON_DOOR, "Iron Door", "irondoor"), - WOODEN_PRESSURE_PLATE(BlockID.WOODEN_PRESSURE_PLATE, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"), - REDSTONE_ORE(BlockID.REDSTONE_ORE, "Redstone ore", "redstoneore"), - GLOWING_REDSTONE_ORE(BlockID.GLOWING_REDSTONE_ORE, "Glowing redstone ore", "glowingredstoneore"), - REDSTONE_TORCH_OFF(BlockID.REDSTONE_TORCH_OFF, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"), - REDSTONE_TORCH_ON(BlockID.REDSTONE_TORCH_ON, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"), - STONE_BUTTON(BlockID.STONE_BUTTON, "Stone Button", "stonebutton", "button"), - SNOW(BlockID.SNOW, "Snow", "snow"), - ICE(BlockID.ICE, "Ice", "ice"), - SNOW_BLOCK(BlockID.SNOW_BLOCK, "Snow block", "snowblock"), - CACTUS(BlockID.CACTUS, "Cactus", "cactus", "cacti"), - CLAY(BlockID.CLAY, "Clay", "clay"), - SUGAR_CANE(BlockID.REED, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"), - JUKEBOX(BlockID.JUKEBOX, "Jukebox", "jukebox", "stereo", "recordplayer"), - FENCE(BlockID.FENCE, "Fence", "fence"), - PUMPKIN(BlockID.PUMPKIN, "Pumpkin", "pumpkin"), - NETHERRACK(BlockID.NETHERRACK, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"), - SOUL_SAND(BlockID.SLOW_SAND, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"), - GLOWSTONE(BlockID.LIGHTSTONE, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"), - PORTAL(BlockID.PORTAL, "Portal", "portal"), - JACK_O_LANTERN(BlockID.JACKOLANTERN, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"), - CAKE(BlockID.CAKE_BLOCK, "Cake", "cake", "cakeblock"), - REDSTONE_REPEATER_OFF(BlockID.REDSTONE_REPEATER_OFF, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeateroff", "delayeroff"), - REDSTONE_REPEATER_ON(BlockID.REDSTONE_REPEATER_ON, "Redstone repeater (on)", "diodeon", "redstonerepeateron", "repeateron", "delayeron"), - @Deprecated LOCKED_CHEST(BlockID.LOCKED_CHEST, "thisblockisinvalidusedstainedglassinstead"), - STAINED_GLASS(BlockID.STAINED_GLASS, "Stained Glass", "stainedglass"), - TRAP_DOOR(BlockID.TRAP_DOOR, "Trap door", "trapdoor", "hatch", "floordoor"), - SILVERFISH_BLOCK(BlockID.SILVERFISH_BLOCK, "Silverfish block", "silverfish", "silver"), - STONE_BRICK(BlockID.STONE_BRICK, "Stone brick", "stonebrick", "sbrick", "smoothstonebrick"), - RED_MUSHROOM_CAP(BlockID.RED_MUSHROOM_CAP, "Red mushroom cap", "giantmushroomred", "redgiantmushroom", "redmushroomcap"), - BROWN_MUSHROOM_CAP(BlockID.BROWN_MUSHROOM_CAP, "Brown mushroom cap", "giantmushroombrown", "browngiantmushoom", "brownmushroomcap"), - IRON_BARS(BlockID.IRON_BARS, "Iron bars", "ironbars", "ironfence"), - GLASS_PANE(BlockID.GLASS_PANE, "Glass pane", "window", "glasspane", "glasswindow"), - MELON_BLOCK(BlockID.MELON_BLOCK, "Melon (block)", "melonblock"), - PUMPKIN_STEM(BlockID.PUMPKIN_STEM, "Pumpkin stem", "pumpkinstem"), - MELON_STEM(BlockID.MELON_STEM, "Melon stem", "melonstem"), - VINE(BlockID.VINE, "Vine", "vine", "vines", "creepers"), - FENCE_GATE(BlockID.FENCE_GATE, "Fence gate", "fencegate", "gate"), - BRICK_STAIRS(BlockID.BRICK_STAIRS, "Brick stairs", "brickstairs", "bricksteps"), - STONE_BRICK_STAIRS(BlockID.STONE_BRICK_STAIRS, "Stone brick stairs", "stonebrickstairs", "smoothstonebrickstairs"), - MYCELIUM(BlockID.MYCELIUM, "Mycelium", "mycelium", "fungus", "mycel"), - LILY_PAD(BlockID.LILY_PAD, "Lily pad", "lilypad", "waterlily"), - NETHER_BRICK(BlockID.NETHER_BRICK, "Nether brick", "netherbrick"), - NETHER_BRICK_FENCE(BlockID.NETHER_BRICK_FENCE, "Nether brick fence", "netherbrickfence", "netherfence"), - NETHER_BRICK_STAIRS(BlockID.NETHER_BRICK_STAIRS, "Nether brick stairs", "netherbrickstairs", "netherbricksteps", "netherstairs", "nethersteps"), - NETHER_WART(BlockID.NETHER_WART, "Nether wart", "netherwart", "netherstalk"), - ENCHANTMENT_TABLE(BlockID.ENCHANTMENT_TABLE, "Enchantment table", "enchantmenttable", "enchanttable"), - BREWING_STAND(BlockID.BREWING_STAND, "Brewing Stand", "brewingstand"), - CAULDRON(BlockID.CAULDRON, "Cauldron"), - END_PORTAL(BlockID.END_PORTAL, "End Portal", "endportal", "blackstuff", "airportal", "weirdblackstuff"), - END_PORTAL_FRAME(BlockID.END_PORTAL_FRAME, "End Portal Frame", "endportalframe", "airportalframe", "crystalblock"), - END_STONE(BlockID.END_STONE, "End Stone", "endstone", "enderstone", "endersand"), - DRAGON_EGG(BlockID.DRAGON_EGG, "Dragon Egg", "dragonegg", "dragons"), - REDSTONE_LAMP_OFF(BlockID.REDSTONE_LAMP_OFF, "Redstone lamp (off)", "redstonelamp", "redstonelampoff", "rslamp", "rslampoff", "rsglow", "rsglowoff"), - REDSTONE_LAMP_ON(BlockID.REDSTONE_LAMP_ON, "Redstone lamp (on)", "redstonelampon", "rslampon", "rsglowon"), - DOUBLE_WOODEN_STEP(BlockID.DOUBLE_WOODEN_STEP, "Double wood step", "doublewoodslab", "doublewoodstep"), - WOODEN_STEP(BlockID.WOODEN_STEP, "Wood step", "woodenslab", "woodslab", "woodstep", "woodhalfstep"), - COCOA_PLANT(BlockID.COCOA_PLANT, "Cocoa plant", "cocoplant", "cocoaplant"), - SANDSTONE_STAIRS(BlockID.SANDSTONE_STAIRS, "Sandstone stairs", "sandstairs", "sandstonestairs"), - EMERALD_ORE(BlockID.EMERALD_ORE, "Emerald ore", "emeraldore"), - ENDER_CHEST(BlockID.ENDER_CHEST, "Ender chest", "enderchest"), - TRIPWIRE_HOOK(BlockID.TRIPWIRE_HOOK, "Tripwire hook", "tripwirehook"), - TRIPWIRE(BlockID.TRIPWIRE, "Tripwire", "tripwire", "string"), - EMERALD_BLOCK(BlockID.EMERALD_BLOCK, "Emerald block", "emeraldblock", "emerald"), - SPRUCE_WOOD_STAIRS(BlockID.SPRUCE_WOOD_STAIRS, "Spruce wood stairs", "sprucestairs", "sprucewoodstairs"), - BIRCH_WOOD_STAIRS(BlockID.BIRCH_WOOD_STAIRS, "Birch wood stairs", "birchstairs", "birchwoodstairs"), - JUNGLE_WOOD_STAIRS(BlockID.JUNGLE_WOOD_STAIRS, "Jungle wood stairs", "junglestairs", "junglewoodstairs"), - COMMAND_BLOCK(BlockID.COMMAND_BLOCK, "Command block", "commandblock", "cmdblock", "command", "cmd"), - BEACON(BlockID.BEACON, "Beacon", "beacon", "beaconblock"), - COBBLESTONE_WALL(BlockID.COBBLESTONE_WALL, "Cobblestone wall", "cobblestonewall", "cobblewall"), - FLOWER_POT(BlockID.FLOWER_POT, "Flower pot", "flowerpot", "plantpot", "pot"), - CARROTS(BlockID.CARROTS, "Carrots", "carrots", "carrotsplant", "carrotsblock"), - POTATOES(BlockID.POTATOES, "Potatoes", "potatoes", "potatoesblock"), - WOODEN_BUTTON(BlockID.WOODEN_BUTTON, "Wooden button", "woodbutton", "woodenbutton"), - HEAD(BlockID.HEAD, "Head", "head", "skull"), - ANVIL(BlockID.ANVIL, "Anvil", "anvil", "blacksmith"), - TRAPPED_CHEST(BlockID.TRAPPED_CHEST, "Trapped Chest", "trappedchest", "redstonechest"), - PRESSURE_PLATE_LIGHT(BlockID.PRESSURE_PLATE_LIGHT, "Weighted Pressure Plate (Light)", "lightpressureplate"), - PRESSURE_PLATE_HEAVY(BlockID.PRESSURE_PLATE_HEAVY, "Weighted Pressure Plate (Heavy)", "heavypressureplate"), - COMPARATOR_OFF(BlockID.COMPARATOR_OFF, "Redstone Comparator (inactive)", "redstonecomparator", "comparator"), - COMPARATOR_ON(BlockID.COMPARATOR_ON, "Redstone Comparator (active)", "redstonecomparatoron", "comparatoron"), - DAYLIGHT_SENSOR(BlockID.DAYLIGHT_SENSOR, "Daylight Sensor", "daylightsensor", "lightsensor", "daylightdetector"), - REDSTONE_BLOCK(BlockID.REDSTONE_BLOCK, "Block of Redstone", "redstoneblock", "blockofredstone"), - QUARTZ_ORE(BlockID.QUARTZ_ORE, "Nether Quartz Ore", "quartzore", "netherquartzore"), - HOPPER(BlockID.HOPPER, "Hopper", "hopper"), - QUARTZ_BLOCK(BlockID.QUARTZ_BLOCK, "Block of Quartz", "quartzblock", "quartz"), - QUARTZ_STAIRS(BlockID.QUARTZ_STAIRS, "Quartz Stairs", "quartzstairs"), - ACTIVATOR_RAIL(BlockID.ACTIVATOR_RAIL, "Activator Rail", "activatorrail", "tntrail", "activatortrack"), - DROPPER(BlockID.DROPPER, "Dropper", "dropper"), - STAINED_CLAY(BlockID.STAINED_CLAY, "Stained Clay", "stainedclay", "stainedhardenedclay"), - STAINED_GLASS_PANE(BlockID.STAINED_GLASS_PANE, "Stained Glass Pane", "stainedglasspane"), - LEAVES2(BlockID.LEAVES2, "Leaves", "leaves2", "acacialeaves", "darkoakleaves"), - LOG2(BlockID.LOG2, "Log", "log2", "acacia", "darkoak"), - ACACIA_STAIRS(BlockID.ACACIA_STAIRS, "Acacia Wood Stairs", "acaciawoodstairs", "acaciastairs"), - DARK_OAK_STAIRS(BlockID.DARK_OAK_STAIRS, "Dark Oak Wood Stairs", "darkoakwoodstairs", "darkoakstairs"), - SLIME(BlockID.SLIME, "SLime", "slimeblock"), - BARRIER(BlockID.BARRIER, "Barrier", "barrier", "wall", "worldborder", "edge"), - IRON_TRAP_DOOR(BlockID.IRON_TRAP_DOOR, "Iron Trap Door", "irontrapdoor"), - PRISMARINE(BlockID.PRISMARINE, "Prismarine", "prismarine"), - SEA_LANTERN(BlockID.SEA_LANTERN, "Sea Lantern", "sealantern"), - HAY_BLOCK(BlockID.HAY_BLOCK, "Hay Block", "hayblock", "haybale", "wheatbale"), - CARPET(BlockID.CARPET, "Carpet", "carpet"), - HARDENED_CLAY(BlockID.HARDENED_CLAY, "Hardened Clay", "hardenedclay", "hardclay"), - COAL_BLOCK(BlockID.COAL_BLOCK, "Block of Coal", "coalblock", "blockofcoal"), - PACKED_ICE(BlockID.PACKED_ICE, "Packed Ice", "packedice", "hardice"), - DOUBLE_PLANT(BlockID.DOUBLE_PLANT, "Large Flowers", "largeflowers", "doubleflowers"), - STANDING_BANNER(BlockID.STANDING_BANNER, "Standing Banner", "standingbannear", "banner"), - WALL_BANNER(BlockID.WALL_BANNER, "Wall Banner", "wallbanner"), - DAYLIGHT_SENSOR_INVERTED(BlockID.DAYLIGHT_SENSOR_INVERTED, "Inverted Daylight Sensor", "inverteddaylight", "inverteddaylightsensor"), - RED_SANDSTONE(BlockID.RED_SANDSTONE, "Red Sandstone", "redsandstone"), - RED_SANDSTONE_STAIRS(BlockID.RED_SANDSTONE_STAIRS, "Red Sandstone Stairs", "redsandstonestairs"), - DOUBLE_STEP2(BlockID.DOUBLE_STEP2, "Double Step 2", "doublestep2", "doubleslab2", "doublestoneslab2", "doublestonestep2"), - STEP2(BlockID.STEP2, "Step 2", "step2", "slab2", "stonestep2", "stoneslab2"), - SPRUCE_FENCE_GATE(BlockID.SPRUCE_FENCE_GATE, "Spruce Fence Gate", "spurcefencegate"), - BIRCH_FENCE_GATE(BlockID.BIRCH_FENCE_GATE, "Birch Fence Gate", "birchfencegate"), - JUNGLE_FENCE_GATE(BlockID.JUNGLE_FENCE_GATE, "Jungle Fence Gate", "junglefencegate"), - DARK_OAK_FENCE_GATE(BlockID.DARK_OAK_FENCE_GATE, "Dark Oak Fence Gate", "darkoakfencegate"), - ACACIA_FENCE_GATE(BlockID.ACACIA_FENCE_GATE, "Acacia Fence Gate", "acaciafencegate"), - SPRUCE_FENCE(BlockID.SPRUCE_FENCE, "Spruce Fence", "sprucefence"), - BIRCH_FENCE(BlockID.BIRCH_FENCE, "Birch Fence", "birchfence"), - JUNGLE_FENCE(BlockID.JUNGLE_FENCE, "Jungle Fence", "junglefence"), - DARK_OAK_FENCE(BlockID.DARK_OAK_FENCE, "Dark Oak Fence", "darkoakfence"), - ACACIA_FENCE(BlockID.ACACIA_FENCE, "Acacia Fence", "acaciafence"), - SPRUCE_DOOR(BlockID.SPRUCE_DOOR, "Spruce Door", "sprucedoor"), - BIRCH_DOOR(BlockID.BIRCH_DOOR, "Birch Door", "birchdoor"), - JUNGLE_DOOR(BlockID.JUNGLE_DOOR, "Jungle Door", "jungledoor"), - ACACIA_DOOR(BlockID.ACACIA_DOOR, "Acacia Door", "acaciadoor"), - DARK_OAK_DOOR(BlockID.DARK_OAK_DOOR, "Dark Oak Door", "darkoakdoor"), - END_ROD(BlockID.END_ROD, "End Rod", "endrod", "endtorch"), - CHORUS_PLANT(BlockID.CHORUS_PLANT, "Chorus Plant", "chorusplant", "chorusstem"), - CHORUS_FLOWER(BlockID.CHORUS_FLOWER, "Chorus Flower", "chorusflower"), - PURPUR_BLOCK(BlockID.PURPUR_BLOCK, "Purpur Block", "purpurblock", "blockpurpur"), - PURPUR_PILLAR(BlockID.PURPUR_PILLAR, "Purpur Pillar", "purpurpillar"), - PURPUR_STAIRS(BlockID.PURPUR_STAIRS, "Purpur Stairs", "purpurstairs"), - PURPUR_DOUBLE_SLAB(BlockID.PURPUR_DOUBLE_SLAB, "Purpur Double Slab", "purpurdoubleslab", "doubleslabpurpur", "doublepurpurslab"), - PURPUR_SLAB(BlockID.PURPUR_SLAB, "Purpur Slab", "purpurslab", "slabpurpur"), - END_BRICKS(BlockID.END_BRICKS, "End Bricks", "endbricks"), - BEETROOTS(BlockID.BEETROOTS, "Beetroots", "beetroots", "beetroot_plant"), - GRASS_PATH(BlockID.GRASS_PATH, "Grass Path", "grasspath", "dirtpath"), - END_GATEWAY(BlockID.END_GATEWAY, "End Gateway", "endgateway"), - REPEATING_COMMAND_BLOCK(BlockID.REPEATING_COMMAND_BLOCK, "Repeating Command Block", "repeatingcommandblock", "commandblockrepeating"), - CHAIN_COMMAND_BLOCK(BlockID.CHAIN_COMMAND_BLOCK, "Chain Command Block", "chaincommandblock", "commandblockchain"), - FROSTED_ICE(BlockID.FROSTED_ICE, "Frosted Ice", "frostedice", "frostwalkerice"), - MAGMA_BLOCK(BlockID.MAGMA_BLOCK, "Magma Block", "magmablock", "magma"), - NETHER_WART_BLOCK(BlockID.NETHER_WART_BLOCK, "Nether Wart Block", "netherwartblock"), - RED_NETHER_BRICK(BlockID.RED_NETHER_BRICK, "Red Nether Brick", "rednetherbrick", "netherbrickred"), - BONE_BLOCK(BlockID.BONE_BLOCK, "Bone Block", "boneblock", "blockbone", "fossil", "fossilblock", "blockfossil"), - STRUCTURE_VOID(BlockID.STRUCTURE_VOID, "Structure Void", "structurevoid", "structureair"), - OBSERVER(BlockID.OBSERVER, "Observer", "observer", "blockupdatedetector"), - SHULKER_BOX_MAGENTA(BlockID.SHULKER_BOX_MAGENTA, "Magenta Shulker Box", "shulkerboxmagenta"), - SHULKER_BOX_LIGHT_BLUE(BlockID.SHULKER_BOX_LIGHT_BLUE, "Light Blue Shulker Box", "shulkerboxlightblue"), - SHULKER_BOX_YELLOW(BlockID.SHULKER_BOX_YELLOW, "Yellow Shulker Box", "shulkerboxyellow"), - SHULKER_BOX_LIME(BlockID.SHULKER_BOX_LIME, "Lime Shulker Box", "shulkerboxlime"), - SHULKER_BOX_PINK(BlockID.SHULKER_BOX_PINK, "Pink Shulker Box", "shulkerboxpink"), - SHULKER_BOX_GRAY(BlockID.SHULKER_BOX_GRAY, "Gray Shulker Box", "shulkerboxgray"), - SHULKER_BOX_LIGHT_GRAY(BlockID.SHULKER_BOX_LIGHT_GRAY, "Light Gray Shulker Box", "shulkerboxlightgray"), - SHULKER_BOX_CYAN(BlockID.SHULKER_BOX_CYAN, "Cyan Shulker Box", "shulkerboxcyan"), - SHULKER_BOX_PURPLE(BlockID.SHULKER_BOX_PURPLE, "Purple Shulker Box", "shulkerboxpurple"), - SHULKER_BOX_BLUE(BlockID.SHULKER_BOX_BLUE, "Blue Shulker Box", "shulkerboxblue"), - SHULKER_BOX_BROWN(BlockID.SHULKER_BOX_BROWN, "Brown Shulker Box", "shulkerboxbrown"), - SHULKER_BOX_GREEN(BlockID.SHULKER_BOX_GREEN, "Green Shulker Box", "shulkerboxgreen"), - SHULKER_BOX_RED(BlockID.SHULKER_BOX_RED, "Red Shulker Box", "shulkerboxred"), - SHULKER_BOX_BLACK(BlockID.SHULKER_BOX_BLACK, "Black Shulker Box", "shulkerboxblack"), - STRUCTURE_BLOCK(BlockID.STRUCTURE_BLOCK, "Structure Block", "structureblock"); + ; - /** - * Stores a map of the IDs for fast access. - */ - private static final Map ids = new HashMap(); - /** - * Stores a map of the names for fast access. - */ - private static final Map lookup = new HashMap(); - - private final int id; - private final String name; - private final String[] lookupKeys; - - static { - for (BlockType type : EnumSet.allOf(BlockType.class)) { - ids.put(type.id, type); - for (String key : type.lookupKeys) { - lookup.put(key, type); - } - } - } - - - /** - * Construct the type. - * - * @param id the ID of the block - * @param name the name of the block - * @param lookupKey a name to reference the block by - */ - BlockType(int id, String name, String lookupKey) { - this.id = id; - this.name = name; - this.lookupKeys = new String[] { lookupKey }; - } - - /** - * Construct the type. - * - * @param id the ID of the block - * @param name the name of the block - * @param lookupKeys an array of keys to reference the block by - */ - BlockType(int id, String name, String... lookupKeys) { - this.id = id; - this.name = name; - this.lookupKeys = lookupKeys; - } - - /** - * Return type from ID. May return null. - * - * @param id the type ID - * @return a block type, otherwise null - */ - @Nullable - public static BlockType fromID(int id) { - return ids.get(id); - } - - /** - * Return type from name. May return null. - * - * @param name the name to search - * @return a block type or null - */ - @Nullable - public static BlockType lookup(String name) { - return lookup(name, true); - } - - /** - * Return type from name. May return null. - * - * @param name the name (or ID) of a block - * @param fuzzy true to for a fuzzy search on the block name - * @return a block type or null - */ - @Nullable - public static BlockType lookup(String name, boolean fuzzy) { - try { - return fromID(Integer.parseInt(name)); - } catch (NumberFormatException e) { - return StringUtil.lookup(lookup, name, fuzzy); - } - } - - private static final Map itemBlockMapping = new HashMap(); - private static final Map dataItemBlockMapping = new HashMap(); - static { - for (int data = 0; data < 16; ++data) { - dataItemBlockMapping.put(typeDataKey(BlockID.DIRT, data), new BaseBlock(BlockID.DIRT, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.WOOD, data), new BaseBlock(BlockID.WOOD, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.SAND, data), new BaseBlock(BlockID.SAND, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.SANDSTONE, data), new BaseBlock(BlockID.SANDSTONE, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.LONG_GRASS, data), new BaseBlock(BlockID.LONG_GRASS, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.CLOTH, data), new BaseBlock(BlockID.CLOTH, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.SILVERFISH_BLOCK, data), new BaseBlock(BlockID.SILVERFISH_BLOCK, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.STONE_BRICK, data), new BaseBlock(BlockID.STONE_BRICK, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.COBBLESTONE_WALL, data), new BaseBlock(BlockID.COBBLESTONE_WALL, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.STAINED_CLAY, data), new BaseBlock(BlockID.STAINED_CLAY, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.CARPET, data), new BaseBlock(BlockID.CARPET, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.RED_FLOWER, data), new BaseBlock(BlockID.RED_FLOWER, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.DOUBLE_PLANT, data), new BaseBlock(BlockID.DOUBLE_PLANT, data)); - dataItemBlockMapping.put(typeDataKey(BlockID.STAINED_GLASS, data), new BaseBlock(BlockID.STAINED_GLASS, data)); - } - - itemBlockMapping.put(ItemID.FLINT_AND_TINDER, new BaseBlock(BlockID.FIRE, -1)); - itemBlockMapping.put(ItemID.STRING, new BaseBlock(BlockID.TRIPWIRE, -1)); - itemBlockMapping.put(ItemID.SEEDS, new BaseBlock(BlockID.CROPS, -1)); - itemBlockMapping.put(ItemID.SIGN, new BaseBlock(BlockID.SIGN_POST, -1)); - itemBlockMapping.put(ItemID.WOODEN_DOOR_ITEM, new BaseBlock(BlockID.WOODEN_DOOR, -1)); - itemBlockMapping.put(ItemID.WATER_BUCKET, new BaseBlock(BlockID.STATIONARY_WATER, -1)); - itemBlockMapping.put(ItemID.LAVA_BUCKET, new BaseBlock(BlockID.STATIONARY_LAVA, -1)); - itemBlockMapping.put(ItemID.IRON_DOOR_ITEM, new BaseBlock(BlockID.IRON_DOOR, -1)); - itemBlockMapping.put(ItemID.REDSTONE_DUST, new BaseBlock(BlockID.REDSTONE_WIRE, -1)); - itemBlockMapping.put(ItemID.SUGAR_CANE_ITEM, new BaseBlock(BlockID.REED, -1)); - itemBlockMapping.put(ItemID.BED_ITEM, new BaseBlock(BlockID.BED, -1)); - itemBlockMapping.put(ItemID.REDSTONE_REPEATER, new BaseBlock(BlockID.REDSTONE_REPEATER_OFF, -1)); - itemBlockMapping.put(ItemID.PUMPKIN_SEEDS, new BaseBlock(BlockID.PUMPKIN_STEM, -1)); - itemBlockMapping.put(ItemID.MELON_SEEDS, new BaseBlock(BlockID.MELON_STEM, -1)); - itemBlockMapping.put(ItemID.NETHER_WART_SEED, new BaseBlock(BlockID.NETHER_WART, -1)); - itemBlockMapping.put(ItemID.BREWING_STAND, new BaseBlock(BlockID.BREWING_STAND, -1)); - itemBlockMapping.put(ItemID.CAULDRON, new BaseBlock(BlockID.CAULDRON, -1)); - itemBlockMapping.put(ItemID.FLOWER_POT, new BaseBlock(BlockID.FLOWER_POT, -1)); - itemBlockMapping.put(ItemID.CARROT, new BaseBlock(BlockID.CARROTS, -1)); - itemBlockMapping.put(ItemID.POTATO, new BaseBlock(BlockID.POTATOES, -1)); - itemBlockMapping.put(ItemID.COMPARATOR, new BaseBlock(BlockID.COMPARATOR_OFF, -1)); - itemBlockMapping.put(ItemID.BANNER, new BaseBlock(BlockID.STANDING_BANNER, -1)); - itemBlockMapping.put(ItemID.SPRUCE_DOOR, new BaseBlock(BlockID.SPRUCE_DOOR, -1)); - itemBlockMapping.put(ItemID.BIRCH_DOOR, new BaseBlock(BlockID.BIRCH_DOOR, -1)); - itemBlockMapping.put(ItemID.JUNGLE_DOOR, new BaseBlock(BlockID.JUNGLE_DOOR, -1)); - itemBlockMapping.put(ItemID.ACACIA_DOOR, new BaseBlock(BlockID.ACACIA_DOOR, -1)); - itemBlockMapping.put(ItemID.DARK_OAK_DOOR, new BaseBlock(BlockID.DARK_OAK_DOOR, -1)); - } - - /** - * Get the equivalent block for an item. - * - * @param typeId the type ID of the block - * @param data the data valuie of the block - * @return a block or null - */ - @Nullable - public static BaseBlock getBlockForItem(int typeId, int data) { - final BaseBlock block = itemBlockMapping.get(typeId); - - if (block != null) { - return block; - } - - return dataItemBlockMapping.get(typeDataKey(typeId, data)); - } - - /** - * Get block numeric ID. - * - * @return the block ID - */ - public int getID() { - return id; - } - - /** - * Get user-friendly block name. - * - * @return the block name - */ - public String getName() { - return name; - } - - - /** - * HashSet for shouldPlaceLast. - */ - private static final Set shouldPlaceLast = new HashSet(); - static { - shouldPlaceLast.add(BlockID.SAPLING); - shouldPlaceLast.add(BlockID.BED); - shouldPlaceLast.add(BlockID.POWERED_RAIL); - shouldPlaceLast.add(BlockID.DETECTOR_RAIL); - shouldPlaceLast.add(BlockID.LONG_GRASS); - shouldPlaceLast.add(BlockID.DEAD_BUSH); - shouldPlaceLast.add(BlockID.PISTON_EXTENSION); - shouldPlaceLast.add(BlockID.YELLOW_FLOWER); - shouldPlaceLast.add(BlockID.RED_FLOWER); - shouldPlaceLast.add(BlockID.BROWN_MUSHROOM); - shouldPlaceLast.add(BlockID.RED_MUSHROOM); - shouldPlaceLast.add(BlockID.TORCH); - shouldPlaceLast.add(BlockID.FIRE); - shouldPlaceLast.add(BlockID.REDSTONE_WIRE); - shouldPlaceLast.add(BlockID.CROPS); - shouldPlaceLast.add(BlockID.LADDER); - shouldPlaceLast.add(BlockID.MINECART_TRACKS); - shouldPlaceLast.add(BlockID.LEVER); - shouldPlaceLast.add(BlockID.STONE_PRESSURE_PLATE); - shouldPlaceLast.add(BlockID.WOODEN_PRESSURE_PLATE); - shouldPlaceLast.add(BlockID.REDSTONE_TORCH_OFF); - shouldPlaceLast.add(BlockID.REDSTONE_TORCH_ON); - shouldPlaceLast.add(BlockID.STONE_BUTTON); - shouldPlaceLast.add(BlockID.SNOW); - shouldPlaceLast.add(BlockID.PORTAL); - shouldPlaceLast.add(BlockID.REDSTONE_REPEATER_OFF); - shouldPlaceLast.add(BlockID.REDSTONE_REPEATER_ON); - shouldPlaceLast.add(BlockID.TRAP_DOOR); - shouldPlaceLast.add(BlockID.VINE); - shouldPlaceLast.add(BlockID.LILY_PAD); - shouldPlaceLast.add(BlockID.NETHER_WART); - shouldPlaceLast.add(BlockID.PISTON_BASE); - shouldPlaceLast.add(BlockID.PISTON_STICKY_BASE); - shouldPlaceLast.add(BlockID.PISTON_EXTENSION); - shouldPlaceLast.add(BlockID.PISTON_MOVING_PIECE); - shouldPlaceLast.add(BlockID.COCOA_PLANT); - shouldPlaceLast.add(BlockID.TRIPWIRE_HOOK); - shouldPlaceLast.add(BlockID.TRIPWIRE); - shouldPlaceLast.add(BlockID.FLOWER_POT); - shouldPlaceLast.add(BlockID.CARROTS); - shouldPlaceLast.add(BlockID.POTATOES); - shouldPlaceLast.add(BlockID.WOODEN_BUTTON); - shouldPlaceLast.add(BlockID.ANVIL); // becomes relevant with asynchronous placement - shouldPlaceLast.add(BlockID.PRESSURE_PLATE_LIGHT); - shouldPlaceLast.add(BlockID.PRESSURE_PLATE_HEAVY); - shouldPlaceLast.add(BlockID.COMPARATOR_OFF); - shouldPlaceLast.add(BlockID.COMPARATOR_ON); - shouldPlaceLast.add(BlockID.ACTIVATOR_RAIL); - shouldPlaceLast.add(BlockID.IRON_TRAP_DOOR); - shouldPlaceLast.add(BlockID.CARPET); - shouldPlaceLast.add(BlockID.DOUBLE_PLANT); - shouldPlaceLast.add(BlockID.DAYLIGHT_SENSOR_INVERTED); - } - - /** - * Checks to see whether a block should be placed last (when reordering - * blocks that are placed). - * - * @param id the block ID - * @return true if the block should be placed last - */ - public static boolean shouldPlaceLast(int id) { - return shouldPlaceLast.contains(id); - } - - /** - * Checks to see whether this block should be placed last (when reordering - * blocks that are placed) - * - * @return true if the block should be placed last - */ - public boolean shouldPlaceLast() { - return shouldPlaceLast.contains(id); - } - - /** - * HashSet for shouldPlaceLast. - */ - private static final Set shouldPlaceFinal = new HashSet(); - static { - shouldPlaceFinal.add(BlockID.SIGN_POST); - shouldPlaceFinal.add(BlockID.WOODEN_DOOR); - shouldPlaceFinal.add(BlockID.ACACIA_DOOR); - shouldPlaceFinal.add(BlockID.BIRCH_DOOR); - shouldPlaceFinal.add(BlockID.JUNGLE_DOOR); - shouldPlaceFinal.add(BlockID.DARK_OAK_DOOR); - shouldPlaceFinal.add(BlockID.SPRUCE_DOOR); - shouldPlaceFinal.add(BlockID.WALL_SIGN); - shouldPlaceFinal.add(BlockID.IRON_DOOR); - shouldPlaceFinal.add(BlockID.CACTUS); - shouldPlaceFinal.add(BlockID.REED); - shouldPlaceFinal.add(BlockID.CAKE_BLOCK); - shouldPlaceFinal.add(BlockID.PISTON_EXTENSION); - shouldPlaceFinal.add(BlockID.PISTON_MOVING_PIECE); - shouldPlaceFinal.add(BlockID.STANDING_BANNER); - shouldPlaceFinal.add(BlockID.WALL_BANNER); - } - - /** - * Checks to see whether a block should be placed in the final queue. - * - * This applies to blocks that can be attached to other blocks that have an attachment. - * - * @param id the type ID of the block - * @return whether the block is in the final queue - */ - public static boolean shouldPlaceFinal(int id) { - return shouldPlaceFinal.contains(id); - } - - /** - * HashSet for canPassThrough. - */ - private static final Set canPassThrough = new HashSet(); - static { - canPassThrough.add(BlockID.AIR); - canPassThrough.add(BlockID.WATER); - canPassThrough.add(BlockID.STATIONARY_WATER); - canPassThrough.add(BlockID.SAPLING); - canPassThrough.add(BlockID.POWERED_RAIL); - canPassThrough.add(BlockID.DETECTOR_RAIL); - canPassThrough.add(BlockID.WEB); - canPassThrough.add(BlockID.LONG_GRASS); - canPassThrough.add(BlockID.DEAD_BUSH); - canPassThrough.add(BlockID.YELLOW_FLOWER); - canPassThrough.add(BlockID.RED_FLOWER); - canPassThrough.add(BlockID.BROWN_MUSHROOM); - canPassThrough.add(BlockID.RED_MUSHROOM); - canPassThrough.add(BlockID.TORCH); - canPassThrough.add(BlockID.FIRE); - canPassThrough.add(BlockID.REDSTONE_WIRE); - canPassThrough.add(BlockID.CROPS); - canPassThrough.add(BlockID.SIGN_POST); - canPassThrough.add(BlockID.LADDER); - canPassThrough.add(BlockID.MINECART_TRACKS); - canPassThrough.add(BlockID.WALL_SIGN); - canPassThrough.add(BlockID.LEVER); - canPassThrough.add(BlockID.STONE_PRESSURE_PLATE); - canPassThrough.add(BlockID.WOODEN_PRESSURE_PLATE); - canPassThrough.add(BlockID.REDSTONE_TORCH_OFF); - canPassThrough.add(BlockID.REDSTONE_TORCH_ON); - canPassThrough.add(BlockID.STONE_BUTTON); - canPassThrough.add(-16*BlockID.SNOW-0); - canPassThrough.add(-16*BlockID.SNOW-8); - canPassThrough.add(BlockID.REED); - canPassThrough.add(BlockID.PORTAL); - canPassThrough.add(BlockID.REDSTONE_REPEATER_OFF); - canPassThrough.add(BlockID.REDSTONE_REPEATER_ON); - canPassThrough.add(BlockID.PUMPKIN_STEM); - canPassThrough.add(BlockID.MELON_STEM); - canPassThrough.add(BlockID.VINE); - canPassThrough.add(BlockID.NETHER_WART); - canPassThrough.add(BlockID.END_PORTAL); - canPassThrough.add(BlockID.TRIPWIRE_HOOK); - canPassThrough.add(BlockID.TRIPWIRE); - canPassThrough.add(BlockID.CARROTS); - canPassThrough.add(BlockID.POTATOES); - canPassThrough.add(BlockID.WOODEN_BUTTON); - canPassThrough.add(BlockID.PRESSURE_PLATE_LIGHT); - canPassThrough.add(BlockID.PRESSURE_PLATE_HEAVY); - canPassThrough.add(BlockID.COMPARATOR_OFF); - canPassThrough.add(BlockID.COMPARATOR_ON); - canPassThrough.add(BlockID.ACTIVATOR_RAIL); - canPassThrough.add(BlockID.IRON_TRAP_DOOR); - canPassThrough.add(BlockID.CARPET); - canPassThrough.add(BlockID.DOUBLE_PLANT); - canPassThrough.add(BlockID.STANDING_BANNER); - canPassThrough.add(BlockID.WALL_BANNER); - } - - - /** - * Checks whether a block can be passed through. - * - * @param id the ID of the block - * @return true if the block can be passed through - */ - public static boolean canPassThrough(int id) { - return canPassThrough.contains(id); - } - - /** - * Checks whether a block can be passed through. - * - * @param id the ID of the block - * @param data the data value of the block - * @return true if the block can be passed through - */ - public static boolean canPassThrough(int id, int data) { - return canPassThrough.contains(-16*id-data) || canPassThrough.contains(id); - } - - /** - * Checks whether a block can be passed through. - * - * @param block the block - * @return true if the block can be passed through - */ - public static boolean canPassThrough(BaseBlock block) { - checkNotNull(block); - return canPassThrough(block.getId(), block.getData()); - } - - /** - * Checks whether the block type can be passed through. - * - * @return whether the block can be passed through - */ - public boolean canPassThrough() { - return canPassThrough.contains(id); - } - - /** - * HashSet for centralTopLimit. - */ - private static final Map centralTopLimit = new HashMap(); - static { - centralTopLimit.put(BlockID.BED, 0.5625); - centralTopLimit.put(BlockID.BREWING_STAND, 0.875); - centralTopLimit.put(BlockID.CAKE_BLOCK, 0.4375); - for (int data = 6; data < 16; ++data) { - centralTopLimit.put(-16*BlockID.CAKE_BLOCK-data, 0.0); - } - centralTopLimit.put(BlockID.CAULDRON, 0.3125); - centralTopLimit.put(BlockID.COCOA_PLANT, 0.750); - centralTopLimit.put(BlockID.ENCHANTMENT_TABLE, 0.75); - for (int data = 0; data < 16; ++data) { - if ((data & 4) != 0) { - centralTopLimit.put(-16*BlockID.END_PORTAL_FRAME-data, 1.0); - } else { - centralTopLimit.put(-16*BlockID.END_PORTAL_FRAME-data, 0.8125); - } - centralTopLimit.put(-16*BlockID.HEAD-data, 0.75); - } - // Heads on the floor are lower - centralTopLimit.put(-16*BlockID.HEAD-1, 0.5); - centralTopLimit.put(-16*BlockID.HEAD-9, 0.5); - centralTopLimit.put(BlockID.FENCE, 1.5); - for (int data = 0; data < 8; ++data) { - centralTopLimit.put(-16*BlockID.STEP-data, 0.5); - centralTopLimit.put(-16*BlockID.WOODEN_STEP-data, 0.5); - centralTopLimit.put(-16*BlockID.STEP2-data, 0.5); - centralTopLimit.put(-16*BlockID.SNOW-data, 0.125*data); - centralTopLimit.put(-16*BlockID.SNOW-(data+8), 0.125*data); - } - centralTopLimit.put(BlockID.LILY_PAD, 0.015625); - centralTopLimit.put(BlockID.REDSTONE_REPEATER_ON, .125); - centralTopLimit.put(BlockID.REDSTONE_REPEATER_OFF, .125); - for (int data = 0; data < 4; ++data) { - centralTopLimit.put(-16*BlockID.TRAP_DOOR-(data+ 0), 0.1875); // closed lower trap doors - centralTopLimit.put(-16*BlockID.TRAP_DOOR-(data+ 4), 0.0); // opened lower trap doors - centralTopLimit.put(-16*BlockID.TRAP_DOOR-(data+ 8), 1.0); // closed upper trap doors - centralTopLimit.put(-16*BlockID.TRAP_DOOR-(data+12), 0.0); // opened upper trap doors - - centralTopLimit.put(-16*BlockID.FENCE_GATE-(data+ 0), 1.5); - centralTopLimit.put(-16*BlockID.FENCE_GATE-(data+ 4), 0.0); - centralTopLimit.put(-16*BlockID.FENCE_GATE-(data+ 8), 1.5); - centralTopLimit.put(-16*BlockID.FENCE_GATE-(data+12), 0.0); - } - centralTopLimit.put(BlockID.SLOW_SAND, 0.875); - centralTopLimit.put(BlockID.COBBLESTONE_WALL, 1.5); - centralTopLimit.put(BlockID.FLOWER_POT, 0.375); - centralTopLimit.put(BlockID.COMPARATOR_OFF, .125); - centralTopLimit.put(BlockID.COMPARATOR_ON, .125); - centralTopLimit.put(BlockID.DAYLIGHT_SENSOR, 0.375); - centralTopLimit.put(BlockID.HOPPER, 0.625); - - // Some default values to be used if no data value is given - centralTopLimit.put(BlockID.HEAD, 0.75); - centralTopLimit.put(BlockID.TRAP_DOOR, 1.0); - centralTopLimit.put(BlockID.FENCE_GATE, 1.5); - } - - /** - * Returns the y offset a player falls to when falling onto the top of a block at xp+0.5/zp+0.5. - * - * @param id the block ID - * @param data the block data value - * @return the y offset - */ - public static double centralTopLimit(int id, int data) { - if (centralTopLimit.containsKey(-16*id-data)) - return centralTopLimit.get(-16*id-data); - - if (centralTopLimit.containsKey(id)) - return centralTopLimit.get(id); - - return canPassThrough(id) ? 0 : 1; - } - - /** - * Returns the y offset a player falls to when falling onto the top of a block at xp+0.5/zp+0.5. - * - * @param block the block - * @return the y offset - */ - public static double centralTopLimit(BaseBlock block) { - checkNotNull(block); - return centralTopLimit(block.getId(), block.getData()); - } - - /** - * Returns the y offset a player falls to when falling onto the top of a block at xp+0.5/zp+0.5. - * - * @return the y offset - */ - public double centralTopLimit() { - if (centralTopLimit.containsKey(id)) - return centralTopLimit.get(id); - - return canPassThrough(id) ? 0 : 1; - } - - /** - * HashSet for usesData. - */ - private static final Set usesData = new HashSet(); - static { - usesData.add(BlockID.STONE); - usesData.add(BlockID.DIRT); - usesData.add(BlockID.WOOD); - usesData.add(BlockID.SAPLING); - usesData.add(BlockID.WATER); - usesData.add(BlockID.STATIONARY_WATER); - usesData.add(BlockID.LAVA); - usesData.add(BlockID.STATIONARY_LAVA); - usesData.add(BlockID.SAND); - usesData.add(BlockID.LOG); - usesData.add(BlockID.LOG2); - usesData.add(BlockID.LEAVES); - usesData.add(BlockID.LEAVES2); - usesData.add(BlockID.SPONGE); - usesData.add(BlockID.DISPENSER); - usesData.add(BlockID.SANDSTONE); - usesData.add(BlockID.BED); - usesData.add(BlockID.POWERED_RAIL); - usesData.add(BlockID.DETECTOR_RAIL); - usesData.add(BlockID.PISTON_STICKY_BASE); - usesData.add(BlockID.LONG_GRASS); - usesData.add(BlockID.PISTON_BASE); - usesData.add(BlockID.PISTON_EXTENSION); - usesData.add(BlockID.CLOTH); - usesData.add(BlockID.RED_FLOWER); - usesData.add(BlockID.DOUBLE_STEP); - usesData.add(BlockID.STEP); - usesData.add(BlockID.TORCH); - usesData.add(BlockID.FIRE); - usesData.add(BlockID.OAK_WOOD_STAIRS); - usesData.add(BlockID.CHEST); - usesData.add(BlockID.REDSTONE_WIRE); - usesData.add(BlockID.CROPS); - usesData.add(BlockID.SOIL); - usesData.add(BlockID.FURNACE); - usesData.add(BlockID.BURNING_FURNACE); - usesData.add(BlockID.SIGN_POST); - usesData.add(BlockID.WOODEN_DOOR); - usesData.add(BlockID.LADDER); - usesData.add(BlockID.MINECART_TRACKS); - usesData.add(BlockID.COBBLESTONE_STAIRS); - usesData.add(BlockID.WALL_SIGN); - usesData.add(BlockID.LEVER); - usesData.add(BlockID.STONE_PRESSURE_PLATE); - usesData.add(BlockID.IRON_DOOR); - usesData.add(BlockID.WOODEN_PRESSURE_PLATE); - usesData.add(BlockID.REDSTONE_TORCH_OFF); - usesData.add(BlockID.REDSTONE_TORCH_ON); - usesData.add(BlockID.STONE_BUTTON); - usesData.add(BlockID.SNOW); - usesData.add(BlockID.CACTUS); - usesData.add(BlockID.REED); - usesData.add(BlockID.JUKEBOX); - usesData.add(BlockID.PUMPKIN); - usesData.add(BlockID.JACKOLANTERN); - usesData.add(BlockID.CAKE_BLOCK); - usesData.add(BlockID.REDSTONE_REPEATER_OFF); - usesData.add(BlockID.REDSTONE_REPEATER_ON); - usesData.add(BlockID.TRAP_DOOR); - usesData.add(BlockID.SILVERFISH_BLOCK); - usesData.add(BlockID.STONE_BRICK); - usesData.add(BlockID.RED_MUSHROOM_CAP); - usesData.add(BlockID.BROWN_MUSHROOM_CAP); - usesData.add(BlockID.PUMPKIN_STEM); - usesData.add(BlockID.MELON_STEM); - usesData.add(BlockID.VINE); - usesData.add(BlockID.FENCE_GATE); - usesData.add(BlockID.BRICK_STAIRS); - usesData.add(BlockID.STONE_BRICK_STAIRS); - usesData.add(BlockID.NETHER_BRICK_STAIRS); - usesData.add(BlockID.NETHER_WART); - usesData.add(BlockID.BREWING_STAND); - usesData.add(BlockID.CAULDRON); - usesData.add(BlockID.END_PORTAL_FRAME); - usesData.add(BlockID.DOUBLE_WOODEN_STEP); - usesData.add(BlockID.WOODEN_STEP); - usesData.add(BlockID.COCOA_PLANT); - usesData.add(BlockID.SANDSTONE_STAIRS); - usesData.add(BlockID.ENDER_CHEST); - usesData.add(BlockID.TRIPWIRE_HOOK); - usesData.add(BlockID.TRIPWIRE); - usesData.add(BlockID.SPRUCE_WOOD_STAIRS); - usesData.add(BlockID.BIRCH_WOOD_STAIRS); - usesData.add(BlockID.JUNGLE_WOOD_STAIRS); - usesData.add(BlockID.COBBLESTONE_WALL); - usesData.add(BlockID.FLOWER_POT); - usesData.add(BlockID.CARROTS); - usesData.add(BlockID.POTATOES); - usesData.add(BlockID.WOODEN_BUTTON); - usesData.add(BlockID.HEAD); - usesData.add(BlockID.ANVIL); - usesData.add(BlockID.PRESSURE_PLATE_LIGHT); - usesData.add(BlockID.PRESSURE_PLATE_HEAVY); - usesData.add(BlockID.COMPARATOR_OFF); - usesData.add(BlockID.COMPARATOR_ON); - usesData.add(BlockID.QUARTZ_BLOCK); - usesData.add(BlockID.QUARTZ_STAIRS); - usesData.add(BlockID.ACTIVATOR_RAIL); - usesData.add(BlockID.DROPPER); - usesData.add(BlockID.HOPPER); - usesData.add(BlockID.STAINED_CLAY); - usesData.add(BlockID.STAINED_GLASS); - usesData.add(BlockID.STAINED_GLASS_PANE); - usesData.add(BlockID.IRON_TRAP_DOOR); - usesData.add(BlockID.PRISMARINE); - usesData.add(BlockID.HAY_BLOCK); - usesData.add(BlockID.CARPET); - usesData.add(BlockID.DOUBLE_PLANT); - usesData.add(BlockID.STANDING_BANNER); - usesData.add(BlockID.WALL_BANNER); - usesData.add(BlockID.RED_SANDSTONE); - usesData.add(BlockID.RED_SANDSTONE_STAIRS); - usesData.add(BlockID.DOUBLE_STEP2); - usesData.add(BlockID.STEP2); - usesData.add(BlockID.SPRUCE_DOOR); - usesData.add(BlockID.BIRCH_DOOR); - usesData.add(BlockID.JUNGLE_DOOR); - usesData.add(BlockID.ACACIA_DOOR); - usesData.add(BlockID.DARK_OAK_DOOR); - } - - /** - * Returns true if the block uses its data value. - * - * @param id the type ID - * @return true if the block type uses its data value - */ - public static boolean usesData(int id) { - return usesData.contains(id); - } - - /** - * Returns true if the block uses its data value. - * - * @return true if this block type uses its data value - */ - public boolean usesData() { - return usesData.contains(id); - } - - /** - * HashSet for isContainerBlock. - */ - private static final Set isContainerBlock = new HashSet(); - static { - isContainerBlock.add(BlockID.DISPENSER); - isContainerBlock.add(BlockID.FURNACE); - isContainerBlock.add(BlockID.BURNING_FURNACE); - isContainerBlock.add(BlockID.CHEST); - isContainerBlock.add(BlockID.BREWING_STAND); - isContainerBlock.add(BlockID.TRAPPED_CHEST); - isContainerBlock.add(BlockID.HOPPER); - isContainerBlock.add(BlockID.DROPPER); - //isContainerBlock.add(BlockID.ENDER_CHEST); // ender chest has no own inventory, don't add this here - } - - /** - * Returns true if the block is a container block. - * - * @param id the block ID - * @return true if the block is a container - */ - public static boolean isContainerBlock(int id) { - return isContainerBlock.contains(id); - } - - /** - * Returns true if the block is a container block. - * - * @return true if the block is a container block - */ - public boolean isContainerBlock() { - return isContainerBlock.contains(id); - } - - /** - * HashSet for isRedstoneBlock. - */ - private static final Set isRedstoneBlock = new HashSet(); - static { - isRedstoneBlock.add(BlockID.POWERED_RAIL); - isRedstoneBlock.add(BlockID.DETECTOR_RAIL); - isRedstoneBlock.add(BlockID.PISTON_STICKY_BASE); - isRedstoneBlock.add(BlockID.PISTON_BASE); - isRedstoneBlock.add(BlockID.LEVER); - isRedstoneBlock.add(BlockID.STONE_PRESSURE_PLATE); - isRedstoneBlock.add(BlockID.WOODEN_PRESSURE_PLATE); - isRedstoneBlock.add(BlockID.REDSTONE_TORCH_OFF); - isRedstoneBlock.add(BlockID.REDSTONE_TORCH_ON); - isRedstoneBlock.add(BlockID.STONE_BUTTON); - isRedstoneBlock.add(BlockID.REDSTONE_WIRE); - isRedstoneBlock.add(BlockID.WOODEN_DOOR); - isRedstoneBlock.add(BlockID.ACACIA_DOOR); - isRedstoneBlock.add(BlockID.BIRCH_DOOR); - isRedstoneBlock.add(BlockID.JUNGLE_DOOR); - isRedstoneBlock.add(BlockID.DARK_OAK_DOOR); - isRedstoneBlock.add(BlockID.SPRUCE_DOOR); - isRedstoneBlock.add(BlockID.IRON_DOOR); - isRedstoneBlock.add(BlockID.TNT); - isRedstoneBlock.add(BlockID.DISPENSER); - isRedstoneBlock.add(BlockID.NOTE_BLOCK); - isRedstoneBlock.add(BlockID.REDSTONE_REPEATER_OFF); - isRedstoneBlock.add(BlockID.REDSTONE_REPEATER_ON); - isRedstoneBlock.add(BlockID.TRIPWIRE_HOOK); - isRedstoneBlock.add(BlockID.COMMAND_BLOCK); - isRedstoneBlock.add(BlockID.WOODEN_BUTTON); - isRedstoneBlock.add(BlockID.TRAPPED_CHEST); - isRedstoneBlock.add(BlockID.PRESSURE_PLATE_LIGHT); - isRedstoneBlock.add(BlockID.PRESSURE_PLATE_HEAVY); - isRedstoneBlock.add(BlockID.COMPARATOR_OFF); - isRedstoneBlock.add(BlockID.COMPARATOR_ON); - isRedstoneBlock.add(BlockID.DAYLIGHT_SENSOR); - isRedstoneBlock.add(BlockID.REDSTONE_BLOCK); - isRedstoneBlock.add(BlockID.HOPPER); - isRedstoneBlock.add(BlockID.ACTIVATOR_RAIL); - isRedstoneBlock.add(BlockID.DROPPER); - isRedstoneBlock.add(BlockID.DAYLIGHT_SENSOR_INVERTED); - } - - /** - * Returns true if a block uses Redstone in some way. - * - * @param id the type ID of the block - * @return true if the block uses Redstone - */ - public static boolean isRedstoneBlock(int id) { - return isRedstoneBlock.contains(id); - } - - /** - * Returns true if a block uses Redstone in some way. - * - * @return true if the block uses Redstone - */ - public boolean isRedstoneBlock() { - return isRedstoneBlock.contains(id); - } - - /** - * HashSet for canTransferRedstone. - */ - private static final Set canTransferRedstone = new HashSet(); - static { - canTransferRedstone.add(BlockID.REDSTONE_TORCH_OFF); - canTransferRedstone.add(BlockID.REDSTONE_TORCH_ON); - canTransferRedstone.add(BlockID.REDSTONE_WIRE); - canTransferRedstone.add(BlockID.REDSTONE_REPEATER_OFF); - canTransferRedstone.add(BlockID.REDSTONE_REPEATER_ON); - canTransferRedstone.add(BlockID.COMPARATOR_OFF); - canTransferRedstone.add(BlockID.COMPARATOR_ON); - } - - /** - * Returns true if a block can transfer Redstone. - * - *

This was made since {@link #isRedstoneBlock} was getting big.

- * - * @param id the type ID of the block - * @return true if the block can transfer redstone - */ - public static boolean canTransferRedstone(int id) { - return canTransferRedstone.contains(id); - } - - /** - * Returns true if a block can transfer Redstone. - * - *

This was made since {@link #isRedstoneBlock} was getting big.

- * - * @return true if the block can transfer redstone - */ - public boolean canTransferRedstone() { - return canTransferRedstone.contains(id); - } - - /** - * HashSet for isRedstoneSource. - */ - private static final Set isRedstoneSource = new HashSet(); - static { - isRedstoneSource.add(BlockID.DETECTOR_RAIL); - isRedstoneSource.add(BlockID.REDSTONE_TORCH_OFF); - isRedstoneSource.add(BlockID.REDSTONE_TORCH_ON); - isRedstoneSource.add(BlockID.LEVER); - isRedstoneSource.add(BlockID.STONE_PRESSURE_PLATE); - isRedstoneSource.add(BlockID.WOODEN_PRESSURE_PLATE); - isRedstoneSource.add(BlockID.STONE_BUTTON); - isRedstoneSource.add(BlockID.TRIPWIRE_HOOK); - isRedstoneSource.add(BlockID.WOODEN_BUTTON); - isRedstoneSource.add(BlockID.PRESSURE_PLATE_LIGHT); - isRedstoneSource.add(BlockID.PRESSURE_PLATE_HEAVY); - isRedstoneSource.add(BlockID.DAYLIGHT_SENSOR); - isRedstoneSource.add(BlockID.REDSTONE_BLOCK); - isRedstoneSource.add(BlockID.DAYLIGHT_SENSOR_INVERTED); - } - - /** - * Returns whether the block is a Redstone source. - * - * @param id the type ID of the block - * @return true if the block is a Redstone source - */ - public static boolean isRedstoneSource(int id) { - return isRedstoneSource.contains(id); - } - - /** - * Returns whether the block is a Redstone source. - * - * @return true if the block is a Redstone source - */ - public boolean isRedstoneSource() { - return isRedstoneSource.contains(id); - } - - /** - * HashSet for isRailBlock. - */ - private static final Set isRailBlock = new HashSet(); - static { - isRailBlock.add(BlockID.POWERED_RAIL); - isRailBlock.add(BlockID.DETECTOR_RAIL); - isRailBlock.add(BlockID.MINECART_TRACKS); - isRailBlock.add(BlockID.ACTIVATOR_RAIL); - } - - /** - * Checks if the block is that of one of the rail types. - * - * @param id the type ID of the block - * @return true if the block is a rail block - */ - public static boolean isRailBlock(int id) { - return isRailBlock.contains(id); - } - - /** - * Checks if the block is that of one of the rail types - * - * @return true if the block is a rail block - */ - public boolean isRailBlock() { - return isRailBlock.contains(id); - } - - /** - * HashSet for isNaturalBlock. - */ - private static final Set isNaturalTerrainBlock = new HashSet(); - static { - isNaturalTerrainBlock.add(BlockID.STONE); - isNaturalTerrainBlock.add(BlockID.GRASS); - isNaturalTerrainBlock.add(BlockID.DIRT); - // isNaturalBlock.add(BlockID.COBBLESTONE); // technically can occur next to water and lava - isNaturalTerrainBlock.add(BlockID.BEDROCK); - isNaturalTerrainBlock.add(BlockID.SAND); - isNaturalTerrainBlock.add(BlockID.GRAVEL); - isNaturalTerrainBlock.add(BlockID.CLAY); - isNaturalTerrainBlock.add(BlockID.MYCELIUM); - isNaturalTerrainBlock.add(BlockID.PACKED_ICE); - isNaturalTerrainBlock.add(BlockID.STAINED_CLAY); - - // hell - isNaturalTerrainBlock.add(BlockID.NETHERRACK); - isNaturalTerrainBlock.add(BlockID.SLOW_SAND); - isNaturalTerrainBlock.add(BlockID.LIGHTSTONE); - isNaturalTerrainBlock.add(BlockID.QUARTZ_ORE); - - // ores - isNaturalTerrainBlock.add(BlockID.COAL_ORE); - isNaturalTerrainBlock.add(BlockID.IRON_ORE); - isNaturalTerrainBlock.add(BlockID.GOLD_ORE); - isNaturalTerrainBlock.add(BlockID.LAPIS_LAZULI_ORE); - isNaturalTerrainBlock.add(BlockID.DIAMOND_ORE); - isNaturalTerrainBlock.add(BlockID.REDSTONE_ORE); - isNaturalTerrainBlock.add(BlockID.GLOWING_REDSTONE_ORE); - isNaturalTerrainBlock.add(BlockID.EMERALD_ORE); - } - - /** - * Checks if the block type is naturally occurring. - * - * @param id the type ID of the block - * @return true if the block type is naturally occurring - * @deprecated Use {@link #isNaturalTerrainBlock(int, int)} - */ - @Deprecated - public static boolean isNaturalTerrainBlock(int id) { - return isNaturalTerrainBlock.contains(id); - } - - /** - * Checks if the block type is naturally occurring - * - * @param id the type ID of the block - * @param data data value of the block - * @return true if the block type is naturally occurring - */ - public static boolean isNaturalTerrainBlock(int id, int data) { - return isNaturalTerrainBlock.contains(-16*id-data) || isNaturalTerrainBlock.contains(id); - } - - /** - * Checks if the block type is naturally occurring - * - * @param block the block - * @return true if the block type is naturally occurring - */ - public static boolean isNaturalTerrainBlock(BaseBlock block) { - return isNaturalTerrainBlock(block.getId(), block.getData()); - } - - /** - * Checks if the block type is naturally occurring - * - * @return true if the block type is naturally occurring - */ - public boolean isNaturalTerrainBlock() { - return isNaturalTerrainBlock.contains(id); - } - - /** - * HashSet for emitsLight. - */ - private static final Set emitsLight = new HashSet(); - static { - emitsLight.add(BlockID.LAVA); - emitsLight.add(BlockID.STATIONARY_LAVA); - emitsLight.add(BlockID.BROWN_MUSHROOM); - emitsLight.add(BlockID.RED_MUSHROOM); - emitsLight.add(BlockID.TORCH); - emitsLight.add(BlockID.FIRE); - emitsLight.add(BlockID.BURNING_FURNACE); - emitsLight.add(BlockID.GLOWING_REDSTONE_ORE); - emitsLight.add(BlockID.REDSTONE_TORCH_ON); - emitsLight.add(BlockID.LIGHTSTONE); - emitsLight.add(BlockID.PORTAL); - emitsLight.add(BlockID.JACKOLANTERN); - emitsLight.add(BlockID.REDSTONE_REPEATER_ON); - emitsLight.add(BlockID.BROWN_MUSHROOM_CAP); - emitsLight.add(BlockID.RED_MUSHROOM_CAP); - emitsLight.add(BlockID.END_PORTAL); - emitsLight.add(BlockID.REDSTONE_LAMP_ON); - emitsLight.add(BlockID.ENDER_CHEST); - emitsLight.add(BlockID.BEACON); - emitsLight.add(BlockID.REDSTONE_BLOCK); - emitsLight.add(BlockID.SEA_LANTERN); - } - - /** - * Checks if the block type emits light. - * - * @param id the type ID of the block - * @return true if the block emits light - */ - public static boolean emitsLight(int id) { - return emitsLight.contains(id); - } - - /** - * HashSet for isTranslucent. - */ - private static final Set isTranslucent = new HashSet(); - static { - isTranslucent.add(BlockID.AIR); - isTranslucent.add(BlockID.SAPLING); - isTranslucent.add(BlockID.WATER); - isTranslucent.add(BlockID.STATIONARY_WATER); - isTranslucent.add(BlockID.LEAVES); - isTranslucent.add(BlockID.GLASS); - isTranslucent.add(BlockID.BED); - isTranslucent.add(BlockID.POWERED_RAIL); - isTranslucent.add(BlockID.DETECTOR_RAIL); - //isTranslucent.add(BlockID.PISTON_STICKY_BASE); - isTranslucent.add(BlockID.WEB); - isTranslucent.add(BlockID.LONG_GRASS); - isTranslucent.add(BlockID.DEAD_BUSH); - //isTranslucent.add(BlockID.PISTON_BASE); - isTranslucent.add(BlockID.PISTON_EXTENSION); - //isTranslucent.add(BlockID.PISTON_MOVING_PIECE); - isTranslucent.add(BlockID.YELLOW_FLOWER); - isTranslucent.add(BlockID.RED_FLOWER); - isTranslucent.add(BlockID.BROWN_MUSHROOM); - isTranslucent.add(BlockID.RED_MUSHROOM); - isTranslucent.add(BlockID.TORCH); - isTranslucent.add(BlockID.FIRE); - isTranslucent.add(BlockID.MOB_SPAWNER); - isTranslucent.add(BlockID.OAK_WOOD_STAIRS); - isTranslucent.add(BlockID.CHEST); - isTranslucent.add(BlockID.REDSTONE_WIRE); - isTranslucent.add(BlockID.CROPS); - isTranslucent.add(BlockID.SIGN_POST); - isTranslucent.add(BlockID.WOODEN_DOOR); - isTranslucent.add(BlockID.LADDER); - isTranslucent.add(BlockID.MINECART_TRACKS); - isTranslucent.add(BlockID.COBBLESTONE_STAIRS); - isTranslucent.add(BlockID.WALL_SIGN); - isTranslucent.add(BlockID.LEVER); - isTranslucent.add(BlockID.STONE_PRESSURE_PLATE); - isTranslucent.add(BlockID.IRON_DOOR); - isTranslucent.add(BlockID.WOODEN_PRESSURE_PLATE); - isTranslucent.add(BlockID.REDSTONE_TORCH_OFF); - isTranslucent.add(BlockID.REDSTONE_TORCH_ON); - isTranslucent.add(BlockID.STONE_BUTTON); - isTranslucent.add(BlockID.SNOW); - isTranslucent.add(BlockID.ICE); - isTranslucent.add(BlockID.CACTUS); - isTranslucent.add(BlockID.REED); - isTranslucent.add(BlockID.FENCE); - isTranslucent.add(BlockID.PORTAL); - isTranslucent.add(BlockID.CAKE_BLOCK); - isTranslucent.add(BlockID.REDSTONE_REPEATER_OFF); - isTranslucent.add(BlockID.REDSTONE_REPEATER_ON); - isTranslucent.add(BlockID.TRAP_DOOR); - isTranslucent.add(BlockID.IRON_BARS); - isTranslucent.add(BlockID.GLASS_PANE); - isTranslucent.add(BlockID.PUMPKIN_STEM); - isTranslucent.add(BlockID.MELON_STEM); - isTranslucent.add(BlockID.VINE); - isTranslucent.add(BlockID.FENCE_GATE); - isTranslucent.add(BlockID.BRICK_STAIRS); - isTranslucent.add(BlockID.STONE_BRICK_STAIRS); - isTranslucent.add(BlockID.LILY_PAD); - isTranslucent.add(BlockID.NETHER_BRICK_FENCE); - isTranslucent.add(BlockID.NETHER_BRICK_STAIRS); - isTranslucent.add(BlockID.NETHER_WART); - isTranslucent.add(BlockID.ENCHANTMENT_TABLE); - isTranslucent.add(BlockID.BREWING_STAND); - isTranslucent.add(BlockID.CAULDRON); - isTranslucent.add(BlockID.WOODEN_STEP); - isTranslucent.add(BlockID.COCOA_PLANT); - isTranslucent.add(BlockID.SANDSTONE_STAIRS); - isTranslucent.add(BlockID.ENDER_CHEST); - isTranslucent.add(BlockID.TRIPWIRE_HOOK); - isTranslucent.add(BlockID.TRIPWIRE); - isTranslucent.add(BlockID.SPRUCE_WOOD_STAIRS); - isTranslucent.add(BlockID.BIRCH_WOOD_STAIRS); - isTranslucent.add(BlockID.JUNGLE_WOOD_STAIRS); - isTranslucent.add(BlockID.COBBLESTONE_WALL); - isTranslucent.add(BlockID.FLOWER_POT); - isTranslucent.add(BlockID.CARROTS); - isTranslucent.add(BlockID.POTATOES); - isTranslucent.add(BlockID.WOODEN_BUTTON); - isTranslucent.add(BlockID.HEAD); - isTranslucent.add(BlockID.ANVIL); - isTranslucent.add(BlockID.TRAPPED_CHEST); - isTranslucent.add(BlockID.PRESSURE_PLATE_LIGHT); - isTranslucent.add(BlockID.PRESSURE_PLATE_HEAVY); - isTranslucent.add(BlockID.COMPARATOR_OFF); - isTranslucent.add(BlockID.COMPARATOR_ON); - isTranslucent.add(BlockID.DAYLIGHT_SENSOR); - isTranslucent.add(BlockID.HOPPER); - isTranslucent.add(BlockID.QUARTZ_STAIRS); - isTranslucent.add(BlockID.ACTIVATOR_RAIL); - isTranslucent.add(BlockID.BARRIER); - isTranslucent.add(BlockID.IRON_TRAP_DOOR); - isTranslucent.add(BlockID.CARPET); - isTranslucent.add(BlockID.STAINED_GLASS_PANE); - isTranslucent.add(BlockID.DOUBLE_PLANT); - isTranslucent.add(BlockID.STANDING_BANNER); - isTranslucent.add(BlockID.WALL_BANNER); - isTranslucent.add(BlockID.DAYLIGHT_SENSOR_INVERTED); - isTranslucent.add(BlockID.RED_SANDSTONE_STAIRS); - isTranslucent.add(BlockID.STEP2); - isTranslucent.add(BlockID.SPRUCE_FENCE_GATE); - isTranslucent.add(BlockID.BIRCH_FENCE_GATE); - isTranslucent.add(BlockID.JUNGLE_FENCE_GATE); - isTranslucent.add(BlockID.DARK_OAK_FENCE_GATE); - isTranslucent.add(BlockID.ACACIA_FENCE_GATE); - isTranslucent.add(BlockID.SPRUCE_FENCE); - isTranslucent.add(BlockID.BIRCH_FENCE); - isTranslucent.add(BlockID.JUNGLE_FENCE); - isTranslucent.add(BlockID.DARK_OAK_FENCE); - isTranslucent.add(BlockID.ACACIA_FENCE); - isTranslucent.add(BlockID.SPRUCE_DOOR); - isTranslucent.add(BlockID.BIRCH_DOOR); - isTranslucent.add(BlockID.JUNGLE_DOOR); - isTranslucent.add(BlockID.ACACIA_DOOR); - isTranslucent.add(BlockID.DARK_OAK_DOOR); - } - - /** - * Checks if the block type lets light through. - * - * @param id the type ID of the block - * @return true if the block type lets light through - */ - public static boolean isTranslucent(int id) { - return isTranslucent.contains(id); - } - - /** - * HashMap for getBlockBagItem. - */ - private static final Map dataBlockBagItems = new HashMap(); - private static final Map nonDataBlockBagItems = new HashMap(); - private static final BaseItem doNotDestroy = new BaseItemStack(BlockID.AIR, 0); - static { - /* - * rules: - * - * 1. block yields itself => addIdentity - * 2. block is part of a 2-block object => drop an appropriate item for one of the 2 blocks - * 3. block can be placed by right-clicking an obtainable item on the ground => use that item - * 4. block yields more than one item => addIdentities - * 5. block yields exactly one item => use that item - * 6. block is a liquid => drop nothing - * 7. block is created from thin air by the game other than by the map generator => drop nothing - */ - - nonDataBlockBagItems.put(BlockID.STONE, new BaseItem(BlockID.COBBLESTONE)); // rule 5 - nonDataBlockBagItems.put(BlockID.GRASS, new BaseItem(BlockID.DIRT)); // rule 5 - addIdentities(BlockID.DIRT, 3); // rule 1 - addIdentity(BlockID.COBBLESTONE); // rule 1 - addIdentities(BlockID.WOOD, 6); // rule 1 - addIdentities(BlockID.SAPLING, 6); // rule 1 - nonDataBlockBagItems.put(BlockID.BEDROCK, doNotDestroy); // exception - // WATER, rule 6 - // STATIONARY_WATER, rule 6 - // LAVA, rule 6 - // STATIONARY_LAVA, rule 6 - addIdentity(BlockID.SAND); // rule 1 - addIdentity(BlockID.GRAVEL); // rule 1 - addIdentity(BlockID.GOLD_ORE); // rule 1 - addIdentity(BlockID.IRON_ORE); // rule 1 - nonDataBlockBagItems.put(BlockID.COAL_ORE, new BaseItem(ItemID.COAL)); // rule 5 - addIdentities(BlockID.LOG, 4); // rule 1 - addIdentities(BlockID.LEAVES, 4); // rule 1 with shears, otherwise rule 3 - addIdentity(BlockID.SPONGE); // rule 1 - addIdentity(BlockID.GLASS); // rule 3 - addIdentity(BlockID.LAPIS_LAZULI_ORE); // rule 4 - addIdentity(BlockID.LAPIS_LAZULI_BLOCK); // rule 1 - addIdentity(BlockID.DISPENSER); // rule 1 - addIdentity(BlockID.SANDSTONE); // rule 1 - addIdentity(BlockID.NOTE_BLOCK); // rule 1 - addIdentities(BlockID.BED, 8); // rule 2 - addIdentity(BlockID.POWERED_RAIL); // rule 1 - addIdentity(BlockID.DETECTOR_RAIL); // rule 1 - addIdentity(BlockID.PISTON_STICKY_BASE); - nonDataBlockBagItems.put(BlockID.WEB, new BaseItem(ItemID.STRING)); // rule 5 - // LONG_GRASS - // DEAD_BUSH - addIdentity(BlockID.PISTON_BASE); - // PISTON_EXTENSION, rule 7 - addIdentities(BlockID.CLOTH, 16); // rule 1 - // PISTON_MOVING_PIECE, rule 7 - addIdentity(BlockID.YELLOW_FLOWER); // rule 1 - addIdentity(BlockID.RED_FLOWER); // rule 1 - addIdentity(BlockID.BROWN_MUSHROOM); // rule 1 - addIdentity(BlockID.RED_MUSHROOM); // rule 1 - addIdentity(BlockID.GOLD_BLOCK); // rule 1 - addIdentity(BlockID.IRON_BLOCK); // rule 1 - addIdentities(BlockID.DOUBLE_STEP, 7); // rule 3 - addIdentities(BlockID.STEP, 7); // rule 1 - addIdentity(BlockID.BRICK); // rule 1 - addIdentity(BlockID.TNT); - addIdentity(BlockID.BOOKCASE); // rule 3 - addIdentity(BlockID.MOSSY_COBBLESTONE); // rule 1 - addIdentity(BlockID.OBSIDIAN); // rule 1 - addIdentity(BlockID.TORCH); // rule 1 - // FIRE - // MOB_SPAWNER - addIdentity(BlockID.OAK_WOOD_STAIRS); // rule 1 - addIdentity(BlockID.CHEST); // rule 1 - nonDataBlockBagItems.put(BlockID.REDSTONE_WIRE, new BaseItem(ItemID.REDSTONE_DUST)); // rule 3 - nonDataBlockBagItems.put(BlockID.DIAMOND_ORE, new BaseItem(ItemID.DIAMOND)); // rule 5 - addIdentity(BlockID.DIAMOND_BLOCK); // rule 1 - addIdentity(BlockID.WORKBENCH); // rule 1 - nonDataBlockBagItems.put(BlockID.CROPS, new BaseItem(ItemID.SEEDS)); // rule 3 - nonDataBlockBagItems.put(BlockID.SOIL, new BaseItem(BlockID.DIRT)); // rule 5 - addIdentity(BlockID.FURNACE); // rule 1 - nonDataBlockBagItems.put(BlockID.BURNING_FURNACE, new BaseItem(BlockID.FURNACE)); - nonDataBlockBagItems.put(BlockID.SIGN_POST, new BaseItem(ItemID.SIGN)); // rule 3 - addIdentities(BlockID.WOODEN_DOOR, 8); // rule 2 - addIdentity(BlockID.LADDER); // rule 1 - addIdentity(BlockID.MINECART_TRACKS); // rule 1 - addIdentity(BlockID.COBBLESTONE_STAIRS); // rule 3 - nonDataBlockBagItems.put(BlockID.WALL_SIGN, new BaseItem(ItemID.SIGN)); // rule 3 - addIdentity(BlockID.LEVER); // rule 1 - addIdentity(BlockID.STONE_PRESSURE_PLATE); // rule 1 - addIdentities(BlockID.IRON_DOOR, 8); // rule 2 - addIdentity(BlockID.WOODEN_PRESSURE_PLATE); // rule 1 - addIdentity(BlockID.REDSTONE_ORE); // rule 4 - nonDataBlockBagItems.put(BlockID.GLOWING_REDSTONE_ORE, new BaseItem(BlockID.REDSTONE_ORE)); // rule 4 - nonDataBlockBagItems.put(BlockID.REDSTONE_TORCH_OFF, new BaseItem(BlockID.REDSTONE_TORCH_ON)); // rule 3 - addIdentity(BlockID.REDSTONE_TORCH_ON); // rule 1 - addIdentity(BlockID.STONE_BUTTON); // rule 1 - addIdentity(BlockID.SNOW); // rule 1 - addIdentity(BlockID.ICE); // exception - addIdentity(BlockID.SNOW_BLOCK); // rule 3 - addIdentity(BlockID.CACTUS); - addIdentity(BlockID.CLAY); // rule 3 - nonDataBlockBagItems.put(BlockID.REED, new BaseItem(ItemID.SUGAR_CANE_ITEM)); // rule 3 - addIdentity(BlockID.JUKEBOX); // rule 1 - addIdentity(BlockID.FENCE); // rule 1 - addIdentity(BlockID.PUMPKIN); // rule 1 - addIdentity(BlockID.NETHERRACK); // rule 1 - addIdentity(BlockID.SLOW_SAND); // rule 1 - addIdentity(BlockID.LIGHTSTONE); // rule 4 - // PORTAL - addIdentity(BlockID.JACKOLANTERN); // rule 1 - nonDataBlockBagItems.put(BlockID.CAKE_BLOCK, new BaseItem(ItemID.CAKE_ITEM)); // rule 3 - nonDataBlockBagItems.put(BlockID.REDSTONE_REPEATER_OFF, new BaseItem(ItemID.REDSTONE_REPEATER)); // rule 3 - nonDataBlockBagItems.put(BlockID.REDSTONE_REPEATER_ON, new BaseItem(ItemID.REDSTONE_REPEATER)); // rule 3 - addIdentities(BlockID.STAINED_GLASS_PANE, 16); // ??? - addIdentity(BlockID.TRAP_DOOR); // rule 1 - nonDataBlockBagItems.put(BlockID.SILVERFISH_BLOCK, doNotDestroy); // exception - addIdentity(BlockID.STONE_BRICK); // rule 1 - addIdentity(BlockID.BROWN_MUSHROOM_CAP); - addIdentity(BlockID.RED_MUSHROOM_CAP); - addIdentity(BlockID.IRON_BARS); // rule 1 - addIdentity(BlockID.GLASS_PANE); // rule 1 - addIdentity(BlockID.MELON_BLOCK); // rule 3 - nonDataBlockBagItems.put(BlockID.PUMPKIN_STEM, new BaseItem(ItemID.PUMPKIN_SEEDS)); // rule 3 - nonDataBlockBagItems.put(BlockID.MELON_STEM, new BaseItem(ItemID.MELON_SEEDS)); // rule 3 - nonDataBlockBagItems.put(BlockID.VINE, doNotDestroy); // exception - addIdentity(BlockID.FENCE_GATE); // rule 1 - addIdentity(BlockID.BRICK_STAIRS); // rule 3 - addIdentity(BlockID.STONE_BRICK_STAIRS); // rule 3 - - // 1.9 blocks - nonDataBlockBagItems.put(BlockID.MYCELIUM, new BaseItem(BlockID.DIRT)); - addIdentity(BlockID.LILY_PAD); - addIdentity(BlockID.NETHER_BRICK); - addIdentity(BlockID.NETHER_BRICK_FENCE); - addIdentity(BlockID.NETHER_BRICK_STAIRS); - nonDataBlockBagItems.put(BlockID.NETHER_WART, new BaseItem(ItemID.NETHER_WART_SEED)); - addIdentity(BlockID.ENCHANTMENT_TABLE); - nonDataBlockBagItems.put(BlockID.BREWING_STAND, new BaseItem(ItemID.BREWING_STAND)); - nonDataBlockBagItems.put(BlockID.CAULDRON, new BaseItem(ItemID.CAULDRON)); - nonDataBlockBagItems.put(BlockID.END_PORTAL, doNotDestroy); - nonDataBlockBagItems.put(BlockID.END_PORTAL_FRAME, doNotDestroy); - addIdentity(BlockID.END_STONE); - - addIdentity(BlockID.REDSTONE_LAMP_OFF); - nonDataBlockBagItems.put(BlockID.REDSTONE_LAMP_ON, new BaseItem(BlockID.REDSTONE_LAMP_OFF)); - - addIdentities(BlockID.DOUBLE_WOODEN_STEP, 7); // rule 3 - addIdentities(BlockID.WOODEN_STEP, 7); // rule 1 - nonDataBlockBagItems.put(BlockID.COCOA_PLANT, new BaseItem(ItemID.INK_SACK, (short) (15 - ClothColor.ID.BROWN))); // rule 3 - addIdentity(BlockID.SANDSTONE_STAIRS); // rule 1 - nonDataBlockBagItems.put(BlockID.EMERALD_ORE, new BaseItem(ItemID.EMERALD)); // rule 5 - addIdentity(BlockID.ENDER_CHEST); // rule 3 - addIdentity(BlockID.TRIPWIRE_HOOK); // rule 1 - nonDataBlockBagItems.put(BlockID.TRIPWIRE, new BaseItem(ItemID.STRING)); // rule 3 - addIdentity(BlockID.EMERALD_BLOCK); // rule 1 - addIdentity(BlockID.SPRUCE_WOOD_STAIRS); // rule 1 - addIdentity(BlockID.BIRCH_WOOD_STAIRS); // rule 1 - addIdentity(BlockID.JUNGLE_WOOD_STAIRS); // rule 1 - addIdentity(BlockID.COMMAND_BLOCK); // rule 1 - addIdentities(BlockID.COBBLESTONE_WALL, 1); // rule 4 - nonDataBlockBagItems.put(BlockID.FLOWER_POT, new BaseItemStack(ItemID.FLOWER_POT)); // rule 3 - nonDataBlockBagItems.put(BlockID.CARROTS, new BaseItemStack(ItemID.CARROT)); // rule 3 - nonDataBlockBagItems.put(BlockID.POTATOES, new BaseItemStack(ItemID.POTATO)); // rule 3 - addIdentity(BlockID.WOODEN_BUTTON); // rule 1 - nonDataBlockBagItems.put(BlockID.HEAD, doNotDestroy); // exception, can't handle TE data - addIdentities(BlockID.ANVIL, 2); // rule 4 - addIdentity(BlockID.TRAPPED_CHEST); // rule 1 - addIdentity(BlockID.PRESSURE_PLATE_LIGHT); // rule 1 - addIdentity(BlockID.PRESSURE_PLATE_HEAVY); // rule 1 - nonDataBlockBagItems.put(BlockID.COMPARATOR_OFF, new BaseItemStack(ItemID.COMPARATOR)); // rule 3 - nonDataBlockBagItems.put(BlockID.COMPARATOR_ON, new BaseItemStack(ItemID.COMPARATOR)); // rule 3 - addIdentity(BlockID.DAYLIGHT_SENSOR); // rule 1 - addIdentity(BlockID.REDSTONE_BLOCK); // rule 1 - nonDataBlockBagItems.put(BlockID.QUARTZ_ORE, new BaseItemStack(ItemID.NETHER_QUARTZ)); // rule 3 - addIdentity(BlockID.HOPPER); // rule 1 - addIdentities(BlockID.QUARTZ_BLOCK, 1); // rule 4 - for (int i = 2; i <= 4; i++) { - dataBlockBagItems.put(typeDataKey(BlockID.QUARTZ_BLOCK, i), new BaseItem(BlockID.QUARTZ_BLOCK, (short) 2)); // rule 4, quartz pillars - } - addIdentity(BlockID.QUARTZ_STAIRS); // rule 1 - addIdentity(BlockID.ACTIVATOR_RAIL); // rule 1 - addIdentity(BlockID.DROPPER); // rule 1 - - addIdentities(BlockID.STAINED_CLAY, 16); // rule 1 - addIdentity(BlockID.HAY_BLOCK); // rule 1 - addIdentities(BlockID.CARPET, 16); // rule 1 - addIdentity(BlockID.HARDENED_CLAY); // rule 1 - addIdentity(BlockID.COAL_BLOCK); // rule 1 - - addIdentities(BlockID.LOG2, 1); - addIdentities(BlockID.LEAVES2, 1); - addIdentity(BlockID.ACACIA_STAIRS); - addIdentity(BlockID.DARK_OAK_STAIRS); - addIdentity(BlockID.PACKED_ICE); - addIdentities(BlockID.STAINED_GLASS_PANE, 16); - addIdentities(BlockID.DOUBLE_PLANT, 6); - - addIdentities(BlockID.ACACIA_DOOR, 8); // rule 2 - addIdentities(BlockID.BIRCH_DOOR, 8); // rule 2 - addIdentities(BlockID.JUNGLE_DOOR, 8); // rule 2 - addIdentities(BlockID.DARK_OAK_DOOR, 8); // rule 2 - addIdentities(BlockID.SPRUCE_DOOR, 8); // rule 2 - } - - /** - * Get the block or item that this block can be constructed from. If nothing is - * dropped, a block with a BaseItemStack of type AIR and size 0 will be returned. - * If the block should not be destroyed (i.e. bedrock), null will be returned. - * - * @param type the type of of the block - * @param data the data value of the block - * @return the item or null - */ - @Nullable - public static BaseItem getBlockBagItem(int type, int data) { - BaseItem dropped = nonDataBlockBagItems.get(type); - if (dropped != null) return dropped; - - dropped = dataBlockBagItems.get(typeDataKey(type, data)); - - if (dropped == null) { - return new BaseItemStack(BlockID.AIR, 0); - } - - if (dropped == doNotDestroy) { - return null; - } - - return dropped; - } - - private static void addIdentity(int type) { - nonDataBlockBagItems.put(type, new BaseItem(type)); - } - - private static void addIdentities(int type, int maxData) { - for (int data = 0; data < maxData; ++data) { - dataBlockBagItems.put(typeDataKey(type, data), new BaseItem(type, (short) data)); - } - } - - /** - * Get the block or item that would have been dropped. If nothing is - * dropped, 0 will be returned. If the block should not be destroyed - * (i.e. bedrock), -1 will be returned. - * - * @param id the type ID of the block - * @return the dropped item - * @deprecated This function ignores the data value. - */ - @Deprecated - public static int getDroppedBlock(int id) { - BaseItem dropped = nonDataBlockBagItems.get(id); - if (dropped == null) { - return BlockID.AIR; - } - return dropped.getType(); - } - - /** - * Get the block drop for this type given a data value. - * - * @param data the data value - * @return the item stack - */ - public BaseItemStack getBlockDrop(short data) { - return getBlockDrop(id, data); - } - - private static final Random random = new Random(); - - /** - * Get the block drop for a block. - * - * @param id the type ID of the block - * @param data the data value - * @return an item or null - */ - @Nullable - public static BaseItemStack getBlockDrop(int id, short data) { - int store; - switch (id) { - case BlockID.STONE: - return new BaseItemStack(BlockID.COBBLESTONE); - - case BlockID.GRASS: - return new BaseItemStack(BlockID.DIRT); - - case BlockID.GRAVEL: - if (random.nextInt(10) == 0) { - return new BaseItemStack(ItemID.FLINT); - } else { - return new BaseItemStack(BlockID.GRAVEL); - } - - case BlockID.COAL_ORE: - return new BaseItemStack(ItemID.COAL); - - case BlockID.LEAVES: - if (random.nextDouble() > 0.95) { - return new BaseItemStack(BlockID.SAPLING, 1, data); - } else { - return null; - } - - case BlockID.LAPIS_LAZULI_ORE: - return new BaseItemStack(ItemID.INK_SACK, random.nextInt(5) + 4, (short) 4); - - case BlockID.BED: - return new BaseItemStack(ItemID.BED_ITEM); - - case BlockID.LONG_GRASS: - if (random.nextInt(8) == 0) { - return new BaseItemStack(ItemID.SEEDS); - } else { - return null; - } - - case BlockID.DOUBLE_STEP: - return new BaseItemStack(BlockID.STEP, 2, data); - - case BlockID.REDSTONE_WIRE: - return new BaseItemStack(ItemID.REDSTONE_DUST); - - case BlockID.DIAMOND_ORE: - return new BaseItemStack(ItemID.DIAMOND); - - case BlockID.CROPS: - if (data == 7) return new BaseItemStack(ItemID.WHEAT); - return new BaseItemStack(ItemID.SEEDS); - - case BlockID.SOIL: - return new BaseItemStack(BlockID.DIRT); - - case BlockID.BURNING_FURNACE: - return new BaseItemStack(BlockID.FURNACE); - - case BlockID.SIGN_POST: - return new BaseItemStack(ItemID.SIGN); - - case BlockID.WOODEN_DOOR: - return new BaseItemStack(ItemID.WOODEN_DOOR_ITEM); - - case BlockID.WALL_SIGN: - return new BaseItemStack(ItemID.SIGN); - - case BlockID.IRON_DOOR: - return new BaseItemStack(ItemID.IRON_DOOR_ITEM); - - case BlockID.REDSTONE_ORE: - case BlockID.GLOWING_REDSTONE_ORE: - return new BaseItemStack(ItemID.REDSTONE_DUST, (random.nextInt(2) + 4)); - - case BlockID.REDSTONE_TORCH_OFF: - return new BaseItemStack(BlockID.REDSTONE_TORCH_ON); - - case BlockID.CLAY: - return new BaseItemStack(ItemID.CLAY_BALL, 4); - - case BlockID.REED: - return new BaseItemStack(ItemID.SUGAR_CANE_ITEM); - - case BlockID.LIGHTSTONE: - return new BaseItemStack(ItemID.LIGHTSTONE_DUST, (random.nextInt(3) + 2)); - - case BlockID.REDSTONE_REPEATER_OFF: - case BlockID.REDSTONE_REPEATER_ON: - return new BaseItemStack(ItemID.REDSTONE_REPEATER); - - case BlockID.BROWN_MUSHROOM_CAP: - store = random.nextInt(10); - if (store == 0) { - return new BaseItemStack(BlockID.BROWN_MUSHROOM, 2); - } else if (store == 1) { - return new BaseItemStack(BlockID.BROWN_MUSHROOM); - } else { - return null; - } - - case BlockID.RED_MUSHROOM_CAP: - store = random.nextInt(10); - if (store == 0) { - return new BaseItemStack(BlockID.RED_MUSHROOM, 2); - } else if (store == 1) { - return new BaseItemStack(BlockID.RED_MUSHROOM); - } else { - return null; - } - - case BlockID.MELON_BLOCK: - return new BaseItemStack(ItemID.MELON, (random.nextInt(5) + 3)); - - case BlockID.PUMPKIN_STEM: - return new BaseItemStack(ItemID.PUMPKIN_SEEDS); - - case BlockID.MELON_STEM: - return new BaseItemStack(ItemID.MELON_SEEDS); - - case BlockID.MYCELIUM: - return new BaseItemStack(BlockID.DIRT); - - case BlockID.LILY_PAD: - return new BaseItemStack(BlockID.LILY_PAD); - - case BlockID.NETHER_WART: - return new BaseItemStack(ItemID.NETHER_WART_SEED, random.nextInt(3) + 1); - - case BlockID.BREWING_STAND: - return new BaseItemStack(ItemID.BREWING_STAND); - - case BlockID.CAULDRON: - return new BaseItemStack(ItemID.CAULDRON); - - case BlockID.REDSTONE_LAMP_ON: - return new BaseItemStack(BlockID.REDSTONE_LAMP_OFF); - - case BlockID.DOUBLE_WOODEN_STEP: - return new BaseItemStack(BlockID.WOODEN_STEP, 2, data); - - case BlockID.COCOA_PLANT: - return new BaseItemStack(ItemID.INK_SACK, (data >= 2 ? 3 : 1), (short) 3); - - case BlockID.EMERALD_ORE: - return new BaseItemStack(ItemID.EMERALD); - - case BlockID.TRIPWIRE: - return new BaseItemStack(ItemID.STRING); - - case BlockID.FLOWER_POT: - return new BaseItemStack(ItemID.FLOWER_POT); - - case BlockID.CARROTS: - return new BaseItemStack(ItemID.CARROT, random.nextInt(3) + 1); - - case BlockID.POTATOES: - return new BaseItemStack(ItemID.POTATO, random.nextInt(3) + 1); - - case BlockID.COMPARATOR_OFF: - case BlockID.COMPARATOR_ON: - return new BaseItemStack(ItemID.COMPARATOR); - - case BlockID.QUARTZ_ORE: - return new BaseItemStack(ItemID.NETHER_QUARTZ); - - case BlockID.QUARTZ_BLOCK: - return new BaseItemStack(BlockID.QUARTZ_BLOCK, 1, (data >= 2 ? 2 : data)); - - case BlockID.LOG: - return new BaseItemStack(BlockID.LOG, 1, (short) (data & 0x3)); // strip orientation data - - case BlockID.HAY_BLOCK: - return new BaseItemStack(BlockID.HAY_BLOCK); // strip orientation data - - case BlockID.OAK_WOOD_STAIRS: - case BlockID.COBBLESTONE_STAIRS: - case BlockID.BRICK_STAIRS: - case BlockID.STONE_BRICK_STAIRS: - case BlockID.NETHER_BRICK_STAIRS: - case BlockID.SPRUCE_WOOD_STAIRS: - case BlockID.BIRCH_WOOD_STAIRS: - case BlockID.JUNGLE_WOOD_STAIRS: - case BlockID.QUARTZ_STAIRS: - return new BaseItemStack(id); // strip data from stairs - - case BlockID.BEDROCK: - case BlockID.WATER: - case BlockID.STATIONARY_WATER: - case BlockID.LAVA: - case BlockID.STATIONARY_LAVA: - case BlockID.GLASS: - case BlockID.STAINED_GLASS_PANE: - case BlockID.PISTON_EXTENSION: - case BlockID.BOOKCASE: - case BlockID.FIRE: - case BlockID.MOB_SPAWNER: - case BlockID.SNOW: - case BlockID.ICE: - case BlockID.PORTAL: - case BlockID.AIR: - case BlockID.SILVERFISH_BLOCK: - case BlockID.VINE: - case BlockID.END_PORTAL: - case BlockID.END_PORTAL_FRAME: - case BlockID.HEAD: - return null; - } - - if (usesData(id)) { - return new BaseItemStack(id, 1, data); - } else { - return new BaseItemStack(id); - } - } - - private static final Map dataAttachments = new HashMap(); - private static final Map nonDataAttachments = new HashMap(); + private static final Map dataAttachments = new HashMap<>(); + private static final Map nonDataAttachments = new HashMap<>(); static { nonDataAttachments.put(BlockID.SAPLING, PlayerDirection.DOWN); nonDataAttachments.put(BlockID.LONG_GRASS, PlayerDirection.DOWN); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java index c4c3c7f48..09bd50ff2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java @@ -19,7 +19,14 @@ package com.sk89q.worldedit.blocks; +import com.sk89q.worldedit.world.block.BlockCategories; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; + import java.util.Collection; +import java.util.HashSet; +import java.util.Set; /** * Block-related utility methods. @@ -29,6 +36,121 @@ public final class Blocks { private Blocks() { } + /** + * HashSet for shouldPlaceLast. + */ + private static final Set shouldPlaceLast = new HashSet<>(); + static { + shouldPlaceLast.addAll(BlockCategories.SAPLINGS.getAll()); + shouldPlaceLast.addAll(BlockCategories.FLOWER_POTS.getAll()); + shouldPlaceLast.addAll(BlockCategories.BUTTONS.getAll()); + shouldPlaceLast.addAll(BlockCategories.ANVIL.getAll()); // becomes relevant with asynchronous placement + shouldPlaceLast.addAll(BlockCategories.WOODEN_PRESSURE_PLATES.getAll()); + shouldPlaceLast.addAll(BlockCategories.CARPETS.getAll()); + shouldPlaceLast.addAll(BlockCategories.RAILS.getAll()); + shouldPlaceLast.add(BlockTypes.BLACK_BED); + shouldPlaceLast.add(BlockTypes.BLUE_BED); + shouldPlaceLast.add(BlockTypes.BROWN_BED); + shouldPlaceLast.add(BlockTypes.CYAN_BED); + shouldPlaceLast.add(BlockTypes.GRAY_BED); + shouldPlaceLast.add(BlockTypes.GREEN_BED); + shouldPlaceLast.add(BlockTypes.LIGHT_BLUE_BED); + shouldPlaceLast.add(BlockTypes.LIGHT_GRAY_BED); + shouldPlaceLast.add(BlockTypes.LIME_BED); + shouldPlaceLast.add(BlockTypes.MAGENTA_BED); + shouldPlaceLast.add(BlockTypes.ORANGE_BED); + shouldPlaceLast.add(BlockTypes.PINK_BED); + shouldPlaceLast.add(BlockTypes.PURPLE_BED); + shouldPlaceLast.add(BlockTypes.RED_BED); + shouldPlaceLast.add(BlockTypes.WHITE_BED); + shouldPlaceLast.add(BlockTypes.YELLOW_BED); + shouldPlaceLast.add(BlockTypes.GRASS); + shouldPlaceLast.add(BlockTypes.TALL_GRASS); + shouldPlaceLast.add(BlockTypes.ROSE_BUSH); + shouldPlaceLast.add(BlockTypes.DANDELION); + shouldPlaceLast.add(BlockTypes.BROWN_MUSHROOM); + shouldPlaceLast.add(BlockTypes.RED_MUSHROOM); + shouldPlaceLast.add(BlockTypes.FERN); + shouldPlaceLast.add(BlockTypes.LARGE_FERN); + shouldPlaceLast.add(BlockTypes.OXEYE_DAISY); + shouldPlaceLast.add(BlockTypes.AZURE_BLUET); + shouldPlaceLast.add(BlockTypes.TORCH); + shouldPlaceLast.add(BlockTypes.WALL_TORCH); + shouldPlaceLast.add(BlockTypes.FIRE); + shouldPlaceLast.add(BlockTypes.REDSTONE_WIRE); + shouldPlaceLast.add(BlockTypes.CARROTS); + shouldPlaceLast.add(BlockTypes.POTATOES); + shouldPlaceLast.add(BlockTypes.WHEAT); + shouldPlaceLast.add(BlockTypes.BEETROOTS); + shouldPlaceLast.add(BlockTypes.COCOA); + shouldPlaceLast.add(BlockTypes.LADDER); + shouldPlaceLast.add(BlockTypes.LEVER); + shouldPlaceLast.add(BlockTypes.REDSTONE_TORCH); + shouldPlaceLast.add(BlockTypes.REDSTONE_WALL_TORCH); + shouldPlaceLast.add(BlockTypes.SNOW); + shouldPlaceLast.add(BlockTypes.NETHER_PORTAL); + shouldPlaceLast.add(BlockTypes.END_PORTAL); + shouldPlaceLast.add(BlockTypes.REPEATER); + shouldPlaceLast.add(BlockTypes.VINE); + shouldPlaceLast.add(BlockTypes.LILY_PAD); + shouldPlaceLast.add(BlockTypes.NETHER_WART); + shouldPlaceLast.add(BlockTypes.PISTON); + shouldPlaceLast.add(BlockTypes.STICKY_PISTON); + shouldPlaceLast.add(BlockTypes.TRIPWIRE_HOOK); + shouldPlaceLast.add(BlockTypes.TRIPWIRE); + shouldPlaceLast.add(BlockTypes.STONE_PRESSURE_PLATE); + shouldPlaceLast.add(BlockTypes.HEAVY_WEIGHTED_PRESSURE_PLATE); + shouldPlaceLast.add(BlockTypes.LIGHT_WEIGHTED_PRESSURE_PLATE); + shouldPlaceLast.add(BlockTypes.COMPARATOR); + shouldPlaceLast.add(BlockTypes.IRON_TRAPDOOR); + shouldPlaceLast.add(BlockTypes.ACACIA_TRAPDOOR); + shouldPlaceLast.add(BlockTypes.BIRCH_TRAPDOOR); + shouldPlaceLast.add(BlockTypes.DARK_OAK_TRAPDOOR); + shouldPlaceLast.add(BlockTypes.JUNGLE_TRAPDOOR); + shouldPlaceLast.add(BlockTypes.OAK_TRAPDOOR); + shouldPlaceLast.add(BlockTypes.SPRUCE_TRAPDOOR); + shouldPlaceLast.add(BlockTypes.DAYLIGHT_DETECTOR); + } + + /** + * Checks to see whether a block should be placed last (when reordering + * blocks that are placed). + * + * @param type the block type + * @return true if the block should be placed last + */ + public static boolean shouldPlaceLast(BlockType type) { + return shouldPlaceLast.contains(type); + } + + /** + * HashSet for shouldPlaceLast. + */ + private static final Set shouldPlaceFinal = new HashSet<>(); + static { + shouldPlaceFinal.addAll(BlockCategories.DOORS.getAll()); + shouldPlaceFinal.addAll(BlockCategories.BANNERS.getAll()); + shouldPlaceFinal.add(BlockTypes.SIGN); + shouldPlaceFinal.add(BlockTypes.WALL_SIGN); + shouldPlaceFinal.add(BlockTypes.CACTUS); + shouldPlaceFinal.add(BlockTypes.SUGAR_CANE); + shouldPlaceFinal.add(BlockTypes.CAKE); + shouldPlaceFinal.add(BlockTypes.PISTON_HEAD); + shouldPlaceFinal.add(BlockTypes.MOVING_PISTON); + } + + /** + * Checks to see whether a block should be placed in the final queue. + * + * This applies to blocks that can be attached to other blocks that have an attachment. + * + * @param type the type of the block + * @return whether the block is in the final queue + */ + public static boolean shouldPlaceFinal(BlockType type) { + return shouldPlaceFinal.contains(type); + } + /** * Checks whether a given block is in a list of base blocks. * @@ -36,9 +158,9 @@ public final class Blocks { * @param o the block * @return true if the collection contains the given block */ - public static boolean containsFuzzy(Collection collection, BaseBlock o) { + public static boolean containsFuzzy(Collection collection, BlockStateHolder o) { // Allow masked data in the searchBlocks to match various types - for (BaseBlock b : collection) { + for (BlockStateHolder b : collection) { if (b.equalsFuzzy(o)) { return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ClothColor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ClothColor.java index 76e362e7f..dd3ba1fc2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ClothColor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ClothColor.java @@ -19,10 +19,11 @@ package com.sk89q.worldedit.blocks; -import javax.annotation.Nullable; -import java.util.Map; -import java.util.HashMap; import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; /** * The colors for wool. @@ -31,61 +32,32 @@ import java.util.EnumSet; */ public enum ClothColor { - WHITE(ID.WHITE, "White", "white"), - ORANGE(ID.ORANGE, "Orange", "orange"), - MAGENTA(ID.MAGENTA, "Magenta", "magenta"), - LIGHT_BLUE(ID.LIGHT_BLUE, "Light blue", "lightblue"), - YELLOW(ID.YELLOW, "Yellow", "yellow"), - LIGHT_GREEN(ID.LIGHT_GREEN, "Light green", "lightgreen"), - PINK(ID.PINK, "Pink", new String[] { "pink", "lightred" }), - GRAY(ID.GRAY, "Gray", new String[] { "grey", "gray" }), - LIGHT_GRAY(ID.LIGHT_GRAY, "Light gray", new String[] { "lightgrey", "lightgray" }), - CYAN(ID.CYAN, "Cyan", new String[] { "cyan", "turquoise" }), - PURPLE(ID.PURPLE, "Purple", new String[] { "purple", "violet" }), - BLUE(ID.BLUE, "Blue", "blue"), - BROWN(ID.BROWN, "Brown", new String[] { "brown", "cocoa", "coffee" }), - DARK_GREEN(ID.DARK_GREEN, "Dark green", new String[] { "green", "darkgreen", "cactusgreen", "cactigreen" }), - RED(ID.RED, "Red", "red"), - BLACK(ID.BLACK, "Black", "black"); - - public static final class ID { - public static final int WHITE = 0; - public static final int ORANGE = 1; - public static final int MAGENTA = 2; - public static final int LIGHT_BLUE = 3; - public static final int YELLOW = 4; - public static final int LIGHT_GREEN = 5; - public static final int PINK = 6; - public static final int GRAY = 7; - public static final int LIGHT_GRAY = 8; - public static final int CYAN = 9; - public static final int PURPLE = 10; - public static final int BLUE = 11; - public static final int BROWN = 12; - public static final int DARK_GREEN = 13; - public static final int RED = 14; - public static final int BLACK = 15; - - private ID() { - } - } - - /** - * Stores a map of the IDs for fast access. - */ - private static final Map ids = new HashMap(); + WHITE("White", "white"), + ORANGE("Orange", "orange"), + MAGENTA("Magenta", "magenta"), + LIGHT_BLUE("Light blue", "lightblue"), + YELLOW("Yellow", "yellow"), + LIGHT_GREEN("Light green", "lightgreen"), + PINK("Pink", "pink", "lightred"), + GRAY("Gray", "grey", "gray"), + LIGHT_GRAY("Light gray", "lightgrey", "lightgray"), + CYAN("Cyan", "cyan", "turquoise"), + PURPLE("Purple", "purple", "violet"), + BLUE("Blue", "blue"), + BROWN("Brown", "brown", "cocoa", "coffee"), + DARK_GREEN("Dark green", "green", "darkgreen", "cactusgreen", "cactigreen"), + RED("Red", "red"), + BLACK("Black", "black"); /** * Stores a map of the names for fast access. */ - private static final Map lookup = new HashMap(); + private static final Map lookup = new HashMap<>(); - private final int id; private final String name; private final String[] lookupKeys; static { for (ClothColor type : EnumSet.allOf(ClothColor.class)) { - ids.put(type.id, type); for (String key : type.lookupKeys) { lookup.put(key, type); } @@ -96,40 +68,14 @@ public enum ClothColor { /** * Construct the type. * - * @param id the ID of the color * @param name the name of the color - * @param lookupKey a name to refer to the color by + * @param lookupKeys a name to refer to the color by */ - ClothColor(int id, String name, String lookupKey) { - this.id = id; - this.name = name; - this.lookupKeys = new String[] { lookupKey }; - } - - /** - * Construct the type. - * - * @param id the ID of the color - * @param name the name of the color - * @param lookupKeys an array of lookup keys - */ - ClothColor(int id, String name, String[] lookupKeys) { - this.id = id; + ClothColor(String name, String ... lookupKeys) { this.name = name; this.lookupKeys = lookupKeys; } - /** - * Return type from ID. May return null. - * - * @param id the ID - * @return a color or null - */ - @Nullable - public static ClothColor fromID(int id) { - return ids.get(id); - } - /** * Return type from name. May return null. * @@ -141,15 +87,6 @@ public enum ClothColor { return lookup.get(name.toLowerCase()); } - /** - * Get item numeric ID. - * - * @return the ID - */ - public int getID() { - return id; - } - /** * Get user-friendly item name. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemID.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemID.java deleted file mode 100644 index 8d4c332ab..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemID.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -/** - * List of item IDs. - */ -public final class ItemID { - - public static final int IRON_SHOVEL = 256; - public static final int IRON_PICK = 257; - public static final int IRON_AXE = 258; - public static final int FLINT_AND_TINDER = 259; - public static final int RED_APPLE = 260; - public static final int BOW = 261; - public static final int ARROW = 262; - public static final int COAL = 263; - public static final int DIAMOND = 264; - public static final int IRON_BAR = 265; - public static final int GOLD_BAR = 266; - public static final int IRON_SWORD = 267; - public static final int WOOD_SWORD = 268; - public static final int WOOD_SHOVEL = 269; - public static final int WOOD_PICKAXE = 270; - public static final int WOOD_AXE = 271; - public static final int STONE_SWORD = 272; - public static final int STONE_SHOVEL = 273; - public static final int STONE_PICKAXE = 274; - public static final int STONE_AXE = 275; - public static final int DIAMOND_SWORD = 276; - public static final int DIAMOND_SHOVEL = 277; - public static final int DIAMOND_PICKAXE = 278; - public static final int DIAMOND_AXE = 279; - public static final int STICK = 280; - public static final int BOWL = 281; - public static final int MUSHROOM_SOUP = 282; - public static final int GOLD_SWORD = 283; - public static final int GOLD_SHOVEL = 284; - public static final int GOLD_PICKAXE = 285; - public static final int GOLD_AXE = 286; - public static final int STRING = 287; - public static final int FEATHER = 288; - public static final int SULPHUR = 289; - public static final int WOOD_HOE = 290; - public static final int STONE_HOE = 291; - public static final int IRON_HOE = 292; - public static final int DIAMOND_HOE = 293; - public static final int GOLD_HOE = 294; - public static final int SEEDS = 295; - public static final int WHEAT = 296; - public static final int BREAD = 297; - public static final int LEATHER_HELMET = 298; - public static final int LEATHER_CHEST = 299; - public static final int LEATHER_PANTS = 300; - public static final int LEATHER_BOOTS = 301; - public static final int CHAINMAIL_HELMET = 302; - public static final int CHAINMAIL_CHEST = 303; - public static final int CHAINMAIL_PANTS = 304; - public static final int CHAINMAIL_BOOTS = 305; - public static final int IRON_HELMET = 306; - public static final int IRON_CHEST = 307; - public static final int IRON_PANTS = 308; - public static final int IRON_BOOTS = 309; - public static final int DIAMOND_HELMET = 310; - public static final int DIAMOND_CHEST = 311; - public static final int DIAMOND_PANTS = 312; - public static final int DIAMOND_BOOTS = 313; - public static final int GOLD_HELMET = 314; - public static final int GOLD_CHEST = 315; - public static final int GOLD_PANTS = 316; - public static final int GOLD_BOOTS = 317; - public static final int FLINT = 318; - public static final int RAW_PORKCHOP = 319; - public static final int COOKED_PORKCHOP = 320; - public static final int PAINTING = 321; - public static final int GOLD_APPLE = 322; - public static final int SIGN = 323; - public static final int WOODEN_DOOR_ITEM = 324; - public static final int BUCKET = 325; - public static final int WATER_BUCKET = 326; - public static final int LAVA_BUCKET = 327; - public static final int MINECART = 328; - public static final int SADDLE = 329; - public static final int IRON_DOOR_ITEM = 330; - public static final int REDSTONE_DUST = 331; - public static final int SNOWBALL = 332; - public static final int WOOD_BOAT = 333; - public static final int LEATHER = 334; - public static final int MILK_BUCKET = 335; - public static final int BRICK_BAR = 336; - public static final int CLAY_BALL = 337; - public static final int SUGAR_CANE_ITEM = 338; - public static final int PAPER = 339; - public static final int BOOK = 340; - public static final int SLIME_BALL = 341; - public static final int STORAGE_MINECART = 342; - public static final int POWERED_MINECART = 343; - public static final int EGG = 344; - public static final int COMPASS = 345; - public static final int FISHING_ROD = 346; - public static final int WATCH = 347; - public static final int LIGHTSTONE_DUST = 348; - public static final int RAW_FISH = 349; - public static final int COOKED_FISH = 350; - public static final int INK_SACK = 351; - public static final int BONE = 352; - public static final int SUGAR = 353; - public static final int CAKE_ITEM = 354; - public static final int BED_ITEM = 355; - public static final int REDSTONE_REPEATER = 356; - public static final int COOKIE = 357; - public static final int MAP = 358; - public static final int SHEARS = 359; - public static final int MELON = 360; - public static final int PUMPKIN_SEEDS = 361; - public static final int MELON_SEEDS = 362; - public static final int RAW_BEEF = 363; - public static final int COOKED_BEEF = 364; - public static final int RAW_CHICKEN = 365; - public static final int COOKED_CHICKEN = 366; - public static final int ROTTEN_FLESH = 367; - public static final int ENDER_PEARL = 368; - public static final int BLAZE_ROD = 369; - public static final int GHAST_TEAR = 370; - public static final int GOLD_NUGGET = 371; - public static final int NETHER_WART_SEED = 372; - public static final int POTION = 373; - public static final int GLASS_BOTTLE = 374; - public static final int SPIDER_EYE = 375; - public static final int FERMENTED_SPIDER_EYE = 376; - public static final int BLAZE_POWDER = 377; - public static final int MAGMA_CREAM = 378; - public static final int BREWING_STAND = 379; - public static final int CAULDRON = 380; - public static final int EYE_OF_ENDER = 381; - public static final int GLISTERING_MELON = 382; - public static final int SPAWN_EGG = 383; - public static final int BOTTLE_O_ENCHANTING = 384; - public static final int FIRE_CHARGE = 385; - public static final int BOOK_AND_QUILL = 386; - public static final int WRITTEN_BOOK = 387; - public static final int EMERALD = 388; - public static final int ITEM_FRAME = 389; - public static final int FLOWER_POT = 390; - public static final int CARROT = 391; - public static final int POTATO = 392; - public static final int BAKED_POTATO = 393; - public static final int POISONOUS_POTATO = 394; - public static final int BLANK_MAP = 395; - public static final int GOLDEN_CARROT = 396; - public static final int HEAD = 397; - public static final int CARROT_ON_A_STICK = 398; - public static final int NETHER_STAR = 399; - public static final int PUMPKIN_PIE = 400; - public static final int FIREWORK_ROCKET = 401; - public static final int FIREWORK_STAR = 402; - public static final int ENCHANTED_BOOK = 403; - public static final int COMPARATOR = 404; - public static final int NETHER_BRICK = 405; - public static final int NETHER_QUARTZ = 406; - public static final int TNT_MINECART = 407; - public static final int HOPPER_MINECART = 408; - public static final int PRISMARINE_SHARD = 409; - public static final int PRISMARINE_CRYSTALS = 410; - public static final int RABBIT = 411; - public static final int COOKED_RABBIT = 412; - public static final int RABBIT_STEW = 413; - public static final int RABBIT_FOOT = 414; - public static final int RABBIT_HIDE = 415; - public static final int ARMOR_STAND = 416; - public static final int HORSE_ARMOR_IRON = 417; - public static final int HORSE_ARMOR_GOLD = 418; - public static final int HORSE_ARMOR_DIAMOND = 419; - public static final int LEAD = 420; - public static final int NAME_TAG = 421; - public static final int COMMAND_BLOCK_MINECART = 422; - public static final int MUTTON = 423; - public static final int COOKED_MUTTON = 424; - public static final int BANNER = 425; - public static final int END_CRYSTAL = 426; - public static final int SPRUCE_DOOR = 427; - public static final int BIRCH_DOOR = 428; - public static final int JUNGLE_DOOR = 429; - public static final int ACACIA_DOOR = 430; - public static final int DARK_OAK_DOOR = 431; - public static final int CHORUS_FRUIT = 432; - public static final int CHORUS_FRUIT_POPPED = 433; - public static final int BEETROOT = 434; - public static final int BEETROOT_SEEDS = 435; - public static final int BEETROOT_SOUP = 436; - public static final int DRAGON_BREATH = 437; - public static final int SPLASH_POTION = 438; - public static final int SPECTRAL_ARROW = 439; - public static final int TIPPED_ARROW = 440; - public static final int LINGERING_POTION = 441; - public static final int SHIELD = 442; - public static final int ELYTRA = 443; - public static final int SPRUCE_BOAT = 444; - public static final int BIRCH_BOAT = 445; - public static final int JUNGLE_BOAT = 446; - public static final int ACACIA_BOAT = 447; - public static final int DARK_OAK_BOAT = 448; - public static final int TOTEM_OF_UNDYING = 449; - public static final int SHULKER_SHELL = 450; - - @Deprecated public static final int GOLD_RECORD = 2256; // deprecated, but leave it there - @Deprecated public static final int GREEN_RECORD = 2257; // deprecated, but leave it there - public static final int DISC_13 = 2256; - public static final int DISC_CAT = 2257; - public static final int DISC_BLOCKS = 2258; - public static final int DISC_CHIRP = 2259; - public static final int DISC_FAR = 2260; - public static final int DISC_MALL = 2261; - public static final int DISC_MELLOHI = 2262; - public static final int DISC_STAL = 2263; - public static final int DISC_STRAD = 2264; - public static final int DISC_WARD = 2265; - public static final int DISC_11 = 2266; - public static final int DISC_WAIT = 2267; - - private ItemID() { - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemType.java deleted file mode 100644 index a2f563724..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemType.java +++ /dev/null @@ -1,762 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.util.StringUtil; - -import javax.annotation.Nullable; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - -/** - * An enum of types of items. - */ -public enum ItemType { - - // Blocks - AIR(BlockID.AIR, "Air", "air"), - STONE(BlockID.STONE, "Stone", "stone", "rock"), - GRASS(BlockID.GRASS, "Grass", "grass"), - DIRT(BlockID.DIRT, "Dirt", "dirt"), - COBBLESTONE(BlockID.COBBLESTONE, "Cobblestone", "cobblestone", "cobble"), - WOOD(BlockID.WOOD, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"), - SAPLING(BlockID.SAPLING, "Sapling", "sapling", "seedling"), - BEDROCK(BlockID.BEDROCK, "Bedrock", "adminium", "bedrock"), - WATER(BlockID.WATER, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"), - STATIONARY_WATER(BlockID.STATIONARY_WATER, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"), - LAVA(BlockID.LAVA, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"), - STATIONARY_LAVA(BlockID.STATIONARY_LAVA, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"), - SAND(BlockID.SAND, "Sand", "sand"), - GRAVEL(BlockID.GRAVEL, "Gravel", "gravel"), - GOLD_ORE(BlockID.GOLD_ORE, "Gold ore", "goldore"), - IRON_ORE(BlockID.IRON_ORE, "Iron ore", "ironore"), - COAL_ORE(BlockID.COAL_ORE, "Coal ore", "coalore"), - LOG(BlockID.LOG, "Log", "log", "tree", "pine", "oak", "birch", "redwood"), - LEAVES(BlockID.LEAVES, "Leaves", "leaves", "leaf"), - SPONGE(BlockID.SPONGE, "Sponge", "sponge"), - GLASS(BlockID.GLASS, "Glass", "glass"), - LAPIS_LAZULI_ORE(BlockID.LAPIS_LAZULI_ORE, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"), - LAPIS_LAZULI(BlockID.LAPIS_LAZULI_BLOCK, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"), - DISPENSER(BlockID.DISPENSER, "Dispenser", "dispenser"), - SANDSTONE(BlockID.SANDSTONE, "Sandstone", "sandstone"), - NOTE_BLOCK(BlockID.NOTE_BLOCK, "Note block", "musicblock", "noteblock", "note", "music", "instrument"), - BED(BlockID.BED, "Bed", "bed"), - POWERED_RAIL(BlockID.POWERED_RAIL, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"), - DETECTOR_RAIL(BlockID.DETECTOR_RAIL, "Detector Rail", "detectorrail", "detector"), - PISTON_STICKY_BASE(BlockID.PISTON_STICKY_BASE, "Sticky Piston", "stickypiston"), - WEB(BlockID.WEB, "Web", "web", "spiderweb"), - LONG_GRASS(BlockID.LONG_GRASS, "Long grass", "longgrass", "tallgrass"), - DEAD_BUSH(BlockID.DEAD_BUSH, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"), - PISTON_BASE(BlockID.PISTON_BASE, "Piston", "piston"), - PISTON_EXTENSION(BlockID.PISTON_EXTENSION, "Piston extension", "pistonextendsion", "pistonhead"), - CLOTH(BlockID.CLOTH, "Wool", "cloth", "wool"), - PISTON_MOVING_PIECE(BlockID.PISTON_MOVING_PIECE, "Piston moving piece", "movingpiston"), - YELLOW_FLOWER(BlockID.YELLOW_FLOWER, "Yellow flower", "yellowflower", "flower"), - RED_FLOWER(BlockID.RED_FLOWER, "Red rose", "redflower", "redrose", "rose"), - BROWN_MUSHROOM(BlockID.BROWN_MUSHROOM, "Brown mushroom", "brownmushroom", "mushroom"), - RED_MUSHROOM(BlockID.RED_MUSHROOM, "Red mushroom", "redmushroom"), - GOLD_BLOCK(BlockID.GOLD_BLOCK, "Gold block", "gold", "goldblock"), - IRON_BLOCK(BlockID.IRON_BLOCK, "Iron block", "iron", "ironblock"), - DOUBLE_STEP(BlockID.DOUBLE_STEP, "Double step", "doubleslab", "doublestoneslab", "doublestep"), - STEP(BlockID.STEP, "Step", "slab", "stoneslab", "step", "halfstep"), - BRICK(BlockID.BRICK, "Brick", "brick", "brickblock"), - TNT(BlockID.TNT, "TNT", "tnt", "c4", "explosive"), - BOOKCASE(BlockID.BOOKCASE, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"), - MOSSY_COBBLESTONE(BlockID.MOSSY_COBBLESTONE, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"), - OBSIDIAN(BlockID.OBSIDIAN, "Obsidian", "obsidian"), - TORCH(BlockID.TORCH, "Torch", "torch", "light", "candle"), - FIRE(BlockID.FIRE, "Fire", "fire", "flame", "flames"), - MOB_SPAWNER(BlockID.MOB_SPAWNER, "Mob spawner", "mobspawner", "spawner"), - WOODEN_STAIRS(BlockID.OAK_WOOD_STAIRS, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"), - CHEST(BlockID.CHEST, "Chest", "chest", "storage", "storagechest"), - REDSTONE_WIRE(BlockID.REDSTONE_WIRE, "Redstone wire", "redstone", "redstoneblock"), - DIAMOND_ORE(BlockID.DIAMOND_ORE, "Diamond ore", "diamondore"), - DIAMOND_BLOCK(BlockID.DIAMOND_BLOCK, "Diamond block", "diamond", "diamondblock"), - WORKBENCH(BlockID.WORKBENCH, "Workbench", "workbench", "table", "craftingtable", "crafting"), - CROPS(BlockID.CROPS, "Crops", "crops", "crop", "plant", "plants"), - SOIL(BlockID.SOIL, "Soil", "soil", "farmland"), - FURNACE(BlockID.FURNACE, "Furnace", "furnace"), - BURNING_FURNACE(BlockID.BURNING_FURNACE, "Furnace (burning)", "burningfurnace", "litfurnace"), - SIGN_POST(BlockID.SIGN_POST, "Sign post", "sign", "signpost"), - WOODEN_DOOR(BlockID.WOODEN_DOOR, "Wooden door", "wooddoor", "woodendoor", "door"), - LADDER(BlockID.LADDER, "Ladder", "ladder"), - MINECART_TRACKS(BlockID.MINECART_TRACKS, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"), - COBBLESTONE_STAIRS(BlockID.COBBLESTONE_STAIRS, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"), - WALL_SIGN(BlockID.WALL_SIGN, "Wall sign", "wallsign"), - LEVER(BlockID.LEVER, "Lever", "lever", "switch", "stonelever", "stoneswitch"), - STONE_PRESSURE_PLATE(BlockID.STONE_PRESSURE_PLATE, "Stone pressure plate", "stonepressureplate", "stoneplate"), - IRON_DOOR(BlockID.IRON_DOOR, "Iron Door", "irondoor"), - WOODEN_PRESSURE_PLATE(BlockID.WOODEN_PRESSURE_PLATE, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"), - REDSTONE_ORE(BlockID.REDSTONE_ORE, "Redstone ore", "redstoneore"), - GLOWING_REDSTONE_ORE(BlockID.GLOWING_REDSTONE_ORE, "Glowing redstone ore", "glowingredstoneore"), - REDSTONE_TORCH_OFF(BlockID.REDSTONE_TORCH_OFF, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"), - REDSTONE_TORCH_ON(BlockID.REDSTONE_TORCH_ON, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"), - STONE_BUTTON(BlockID.STONE_BUTTON, "Stone Button", "stonebutton", "button"), - SNOW(BlockID.SNOW, "Snow", "snow"), - ICE(BlockID.ICE, "Ice", "ice"), - SNOW_BLOCK(BlockID.SNOW_BLOCK, "Snow block", "snowblock"), - CACTUS(BlockID.CACTUS, "Cactus", "cactus", "cacti"), - CLAY(BlockID.CLAY, "Clay", "clay"), - SUGAR_CANE(BlockID.REED, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"), - JUKEBOX(BlockID.JUKEBOX, "Jukebox", "jukebox", "stereo", "recordplayer"), - FENCE(BlockID.FENCE, "Fence", "fence"), - PUMPKIN(BlockID.PUMPKIN, "Pumpkin", "pumpkin"), - NETHERRACK(BlockID.NETHERRACK, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"), - SOUL_SAND(BlockID.SLOW_SAND, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"), - GLOWSTONE(BlockID.LIGHTSTONE, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"), - PORTAL(BlockID.PORTAL, "Portal", "portal"), - JACK_O_LANTERN(BlockID.JACKOLANTERN, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"), - CAKE(BlockID.CAKE_BLOCK, "Cake", "cake", "cakeblock"), - REDSTONE_REPEATER_OFF(BlockID.REDSTONE_REPEATER_OFF, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeateroff", "delayeroff"), - REDSTONE_REPEATER_ON(BlockID.REDSTONE_REPEATER_ON, "Redstone repeater (on)", "diodeon", "redstonerepeateron", "repeateron", "delayeron"), - @Deprecated LOCKED_CHEST(BlockID.LOCKED_CHEST, "thisblockisinvalidusedstainedglassinstead"), - STAINED_GLASS(BlockID.STAINED_GLASS, "Stained Glass", "stainedglass"), - TRAP_DOOR(BlockID.TRAP_DOOR, "Trap door", "trapdoor", "hatch", "floordoor"), - SILVERFISH_BLOCK(BlockID.SILVERFISH_BLOCK, "Silverfish block", "silverfish", "silver"), - STONE_BRICK(BlockID.STONE_BRICK, "Stone brick", "stonebrick", "sbrick", "smoothstonebrick"), - RED_MUSHROOM_CAP(BlockID.RED_MUSHROOM_CAP, "Red mushroom cap", "giantmushroomred", "redgiantmushroom", "redmushroomcap"), - BROWN_MUSHROOM_CAP(BlockID.BROWN_MUSHROOM_CAP, "Brown mushroom cap", "giantmushroombrown", "browngiantmushoom", "brownmushroomcap"), - IRON_BARS(BlockID.IRON_BARS, "Iron bars", "ironbars", "ironfence"), - GLASS_PANE(BlockID.GLASS_PANE, "Glass pane", "window", "glasspane", "glasswindow"), - MELON_BLOCK(BlockID.MELON_BLOCK, "Melon (block)", "melonblock"), - PUMPKIN_STEM(BlockID.PUMPKIN_STEM, "Pumpkin stem", "pumpkinstem"), - MELON_STEM(BlockID.MELON_STEM, "Melon stem", "melonstem"), - VINE(BlockID.VINE, "Vine", "vine", "vines", "creepers"), - FENCE_GATE(BlockID.FENCE_GATE, "Fence gate", "fencegate", "gate"), - BRICK_STAIRS(BlockID.BRICK_STAIRS, "Brick stairs", "brickstairs", "bricksteps"), - STONE_BRICK_STAIRS(BlockID.STONE_BRICK_STAIRS, "Stone brick stairs", "stonebrickstairs", "smoothstonebrickstairs"), - MYCELIUM(BlockID.MYCELIUM, "Mycelium", "mycelium", "fungus", "mycel"), - LILY_PAD(BlockID.LILY_PAD, "Lily pad", "lilypad", "waterlily"), - NETHER_BRICK(BlockID.NETHER_BRICK, "Nether brick", "netherbrick"), - NETHER_BRICK_FENCE(BlockID.NETHER_BRICK_FENCE, "Nether brick fence", "netherbrickfence", "netherfence"), - NETHER_BRICK_STAIRS(BlockID.NETHER_BRICK_STAIRS, "Nether brick stairs", "netherbrickstairs", "netherbricksteps", "netherstairs", "nethersteps"), - NETHER_WART(BlockID.NETHER_WART, "Nether wart", "netherwart", "netherstalk"), - ENCHANTMENT_TABLE(BlockID.ENCHANTMENT_TABLE, "Enchantment table", "enchantmenttable", "enchanttable"), - BREWING_STAND(BlockID.BREWING_STAND, "Brewing Stand", "brewingstand"), - CAULDRON(BlockID.CAULDRON, "Cauldron"), - END_PORTAL(BlockID.END_PORTAL, "End Portal", "endportal", "blackstuff", "airportal", "weirdblackstuff"), - END_PORTAL_FRAME(BlockID.END_PORTAL_FRAME, "End Portal Frame", "endportalframe", "airportalframe", "crystalblock"), - END_STONE(BlockID.END_STONE, "End Stone", "endstone", "enderstone", "endersand"), - DRAGON_EGG(BlockID.DRAGON_EGG, "Dragon Egg", "dragonegg", "dragons"), - REDSTONE_LAMP_OFF(BlockID.REDSTONE_LAMP_OFF, "Redstone lamp (off)", "redstonelamp", "redstonelampoff", "rslamp", "rslampoff", "rsglow", "rsglowoff"), - REDSTONE_LAMP_ON(BlockID.REDSTONE_LAMP_ON, "Redstone lamp (on)", "redstonelampon", "rslampon", "rsglowon"), - DOUBLE_WOODEN_STEP(BlockID.DOUBLE_WOODEN_STEP, "Double wood step", "doublewoodslab", "doublewoodstep"), - WOODEN_STEP(BlockID.WOODEN_STEP, "Wood step", "woodenslab", "woodslab", "woodstep", "woodhalfstep"), - COCOA_PLANT(BlockID.COCOA_PLANT, "Cocoa plant", "cocoplant", "cocoaplant"), - SANDSTONE_STAIRS(BlockID.SANDSTONE_STAIRS, "Sandstone stairs", "sandstairs", "sandstonestairs"), - EMERALD_ORE(BlockID.EMERALD_ORE, "Emerald ore", "emeraldore"), - ENDER_CHEST(BlockID.ENDER_CHEST, "Ender chest", "enderchest"), - TRIPWIRE_HOOK(BlockID.TRIPWIRE_HOOK, "Tripwire hook", "tripwirehook"), - TRIPWIRE(BlockID.TRIPWIRE, "Tripwire", "tripwire", "string"), - EMERALD_BLOCK(BlockID.EMERALD_BLOCK, "Emerald block", "emeraldblock", "emerald"), - SPRUCE_WOOD_STAIRS(BlockID.SPRUCE_WOOD_STAIRS, "Spruce wood stairs", "sprucestairs", "sprucewoodstairs"), - BIRCH_WOOD_STAIRS(BlockID.BIRCH_WOOD_STAIRS, "Birch wood stairs", "birchstairs", "birchwoodstairs"), - JUNGLE_WOOD_STAIRS(BlockID.JUNGLE_WOOD_STAIRS, "Jungle wood stairs", "junglestairs", "junglewoodstairs"), - COMMAND_BLOCK(BlockID.COMMAND_BLOCK, "Command block", "commandblock", "cmdblock", "command", "cmd"), - BEACON(BlockID.BEACON, "Beacon", "beacon", "beaconblock"), - COBBLESTONE_WALL(BlockID.COBBLESTONE_WALL, "Cobblestone wall", "cobblestonewall", "cobblewall"), - FLOWER_POT_BLOCK(BlockID.FLOWER_POT, "Flower pot", "flowerpot", "plantpot", "pot"), - CARROTS(BlockID.CARROTS, "Carrots", "carrots", "carrotsplant", "carrotsblock"), - POTATOES(BlockID.POTATOES, "Potatoes", "potatoes", "potatoesblock"), - WOODEN_BUTTON(BlockID.WOODEN_BUTTON, "Wooden button", "woodbutton", "woodenbutton"), - HEAD_BLOCK(BlockID.HEAD, "Head", "head", "skull"), - ANVIL(BlockID.ANVIL, "Anvil", "anvil", "blacksmith"), - TRAPPED_CHEST(BlockID.TRAPPED_CHEST, "Trapped Chest", "trappedchest", "redstonechest"), - PRESSURE_PLATE_LIGHT(BlockID.PRESSURE_PLATE_LIGHT, "Weighted Pressure Plate (Light)", "lightpressureplate"), - PRESSURE_PLATE_HEAVY(BlockID.PRESSURE_PLATE_HEAVY, "Weighted Pressure Plate (Heavy)", "heavypressureplate"), - COMPARATOR_OFF(BlockID.COMPARATOR_OFF, "Redstone Comparator (inactive)", "redstonecomparator", "comparator"), - COMPARATOR_ON(BlockID.COMPARATOR_ON, "Redstone Comparator (active)", "redstonecomparatoron", "comparatoron"), - DAYLIGHT_SENSOR(BlockID.DAYLIGHT_SENSOR, "Daylight Sensor", "daylightsensor", "lightsensor", "daylightdetector"), - REDSTONE_BLOCK(BlockID.REDSTONE_BLOCK, "Block of Redstone", "redstoneblock", "blockofredstone"), - QUARTZ_ORE(BlockID.QUARTZ_ORE, "Nether Quartz Ore", "quartzore", "netherquartzore"), - HOPPER(BlockID.HOPPER, "Hopper", "hopper"), - QUARTZ_BLOCK(BlockID.QUARTZ_BLOCK, "Block of Quartz", "quartzblock", "quartz"), - QUARTZ_STAIRS(BlockID.QUARTZ_STAIRS, "Quartz Stairs", "quartzstairs"), - ACTIVATOR_RAIL(BlockID.ACTIVATOR_RAIL, "Activator Rail", "activatorrail", "tntrail", "activatortrack"), - DROPPER(BlockID.DROPPER, "Dropper", "dropper"), - STAINED_CLAY(BlockID.STAINED_CLAY, "Stained Clay", "stainedclay", "stainedhardenedclay"), - STAINED_GLASS_PANE(BlockID.STAINED_GLASS_PANE, "Stained Glass Pane", "stainedglasspane"), - LEAVES2(BlockID.LEAVES2, "Leaves", "leaves2", "acacialeaves", "darkoakleaves"), - LOG2(BlockID.LOG2, "Log", "log2", "acacia", "darkoak"), - ACACIA_STAIRS(BlockID.ACACIA_STAIRS, "Acacia Wood Stairs", "acaciawoodstairs", "acaciastairs"), - DARK_OAK_STAIRS(BlockID.DARK_OAK_STAIRS, "Dark Oak Wood Stairs", "darkoakwoodstairs", "darkoakstairs"), - HAY_BLOCK(BlockID.HAY_BLOCK, "Hay Block", "hayblock", "haybale", "wheatbale"), - CARPET(BlockID.CARPET, "Carpet", "carpet"), - HARDENED_CLAY(BlockID.HARDENED_CLAY, "Hardened Clay", "hardenedclay", "hardclay"), - COAL_BLOCK(BlockID.COAL_BLOCK, "Block of Coal", "coalblock", "blockofcoal"), - PACKED_ICE(BlockID.PACKED_ICE, "Packed Ice", "packedice", "hardice"), - DOUBLE_PLANT(BlockID.DOUBLE_PLANT, "Large Flowers", "largeflowers", "doubleflowers"), - - DARK_OAK_DOOR(BlockID.DARK_OAK_DOOR, "Dark Oak Door", "darkoakdoor"), - END_ROD(BlockID.END_ROD, "End Rod", "endrod", "endtorch"), - CHORUS_PLANT(BlockID.CHORUS_PLANT, "Chorus Plant", "chorusplant", "chorusstem"), - CHORUS_FLOWER(BlockID.CHORUS_FLOWER, "Chorus Flower", "chorusflower"), - PURPUR_BLOCK(BlockID.PURPUR_BLOCK, "Purpur Block", "purpurblock", "blockpurpur"), - PURPUR_PILLAR(BlockID.PURPUR_PILLAR, "Purpur Pillar", "purpurpillar"), - PURPUR_STAIRS(BlockID.PURPUR_STAIRS, "Purpur Stairs", "purpurstairs"), - PURPUR_DOUBLE_SLAB(BlockID.PURPUR_DOUBLE_SLAB, "Purpur Double Slab", "purpurdoubleslab", "doubleslabpurpur", "doublepurpurslab"), - PURPUR_SLAB(BlockID.PURPUR_SLAB, "Purpur Slab", "purpurslab", "slabpurpur"), - END_BRICKS(BlockID.END_BRICKS, "End Bricks", "endbricks"), - BEETROOTS(BlockID.BEETROOTS, "Beetroots", "beetroots", "beetroot_plant"), - GRASS_PATH(BlockID.GRASS_PATH, "Grass Path", "grasspath", "dirtpath"), - END_GATEWAY(BlockID.END_GATEWAY, "End Gateway", "endgateway"), - REPEATING_COMMAND_BLOCK(BlockID.REPEATING_COMMAND_BLOCK, "Repeating Command Block", "repeatingcommandblock", "commandblockrepeating"), - CHAIN_COMMAND_BLOCK(BlockID.CHAIN_COMMAND_BLOCK, "Chain Command Block", "chaincommandblock", "commandblockchain"), - FROSTED_ICE(BlockID.FROSTED_ICE, "Frosted Ice", "frostedice", "frostwalkerice"), - MAGMA_BLOCK(BlockID.MAGMA_BLOCK, "Magma Block", "magmablock", "magma"), - NETHER_WART_BLOCK(BlockID.NETHER_WART_BLOCK, "Nether Wart Block", "netherwartblock"), - RED_NETHER_BRICK(BlockID.RED_NETHER_BRICK, "Red Nether Brick", "rednetherbrick", "netherbrickred"), - BONE_BLOCK(BlockID.BONE_BLOCK, "Bone Block", "boneblock", "blockbone", "fossil", "fossilblock", "blockfossil"), - STRUCTURE_VOID(BlockID.STRUCTURE_VOID, "Structure Void", "structurevoid", "structureair"), - OBSERVER(BlockID.OBSERVER, "Observer", "observer", "blockupdatedetector"), - SHULKER_BOX_MAGENTA(BlockID.SHULKER_BOX_MAGENTA, "Magenta Shulker Box", "shulkerboxmagenta"), - SHULKER_BOX_LIGHT_BLUE(BlockID.SHULKER_BOX_LIGHT_BLUE, "Light Blue Shulker Box", "shulkerboxlightblue"), - SHULKER_BOX_YELLOW(BlockID.SHULKER_BOX_YELLOW, "Yellow Shulker Box", "shulkerboxyellow"), - SHULKER_BOX_LIME(BlockID.SHULKER_BOX_LIME, "Lime Shulker Box", "shulkerboxlime"), - SHULKER_BOX_PINK(BlockID.SHULKER_BOX_PINK, "Pink Shulker Box", "shulkerboxpink"), - SHULKER_BOX_GRAY(BlockID.SHULKER_BOX_GRAY, "Gray Shulker Box", "shulkerboxgray"), - SHULKER_BOX_LIGHT_GRAY(BlockID.SHULKER_BOX_LIGHT_GRAY, "Light Gray Shulker Box", "shulkerboxlightgray"), - SHULKER_BOX_CYAN(BlockID.SHULKER_BOX_CYAN, "Cyan Shulker Box", "shulkerboxcyan"), - SHULKER_BOX_PURPLE(BlockID.SHULKER_BOX_PURPLE, "Purple Shulker Box", "shulkerboxpurple"), - SHULKER_BOX_BLUE(BlockID.SHULKER_BOX_BLUE, "Blue Shulker Box", "shulkerboxblue"), - SHULKER_BOX_BROWN(BlockID.SHULKER_BOX_BROWN, "Brown Shulker Box", "shulkerboxbrown"), - SHULKER_BOX_GREEN(BlockID.SHULKER_BOX_GREEN, "Green Shulker Box", "shulkerboxgreen"), - SHULKER_BOX_RED(BlockID.SHULKER_BOX_RED, "Red Shulker Box", "shulkerboxred"), - SHULKER_BOX_BLACK(BlockID.SHULKER_BOX_BLACK, "Black Shulker Box", "shulkerboxblack"), - STRUCTURE_BLOCK(BlockID.STRUCTURE_BLOCK, "Structure Block", "structureblock"), - - // Items - IRON_SHOVEL(ItemID.IRON_SHOVEL, "Iron shovel", "ironshovel"), - IRON_PICK(ItemID.IRON_PICK, "Iron pick", "ironpick", "ironpickaxe"), - IRON_AXE(ItemID.IRON_AXE, "Iron axe", "ironaxe"), - FLINT_AND_TINDER(ItemID.FLINT_AND_TINDER, "Flint and tinder", "flintandtinder", "lighter", "flintandsteel", "flintsteel", "flintandiron", "flintnsteel", "flintniron", "flintntinder"), - RED_APPLE(ItemID.RED_APPLE, "Red apple", "redapple", "apple"), - BOW(ItemID.BOW, "Bow", "bow"), - ARROW(ItemID.ARROW, "Arrow", "arrow"), - COAL(ItemID.COAL, "Coal", "coal"), - DIAMOND(ItemID.DIAMOND, "Diamond", "diamond"), - IRON_BAR(ItemID.IRON_BAR, "Iron bar", "ironbar", "iron"), - GOLD_BAR(ItemID.GOLD_BAR, "Gold bar", "goldbar", "gold"), - IRON_SWORD(ItemID.IRON_SWORD, "Iron sword", "ironsword"), - WOOD_SWORD(ItemID.WOOD_SWORD, "Wooden sword", "woodsword"), - WOOD_SHOVEL(ItemID.WOOD_SHOVEL, "Wooden shovel", "woodshovel"), - WOOD_PICKAXE(ItemID.WOOD_PICKAXE, "Wooden pickaxe", "woodpick", "woodpickaxe"), - WOOD_AXE(ItemID.WOOD_AXE, "Wooden axe", "woodaxe"), - STONE_SWORD(ItemID.STONE_SWORD, "Stone sword", "stonesword"), - STONE_SHOVEL(ItemID.STONE_SHOVEL, "Stone shovel", "stoneshovel"), - STONE_PICKAXE(ItemID.STONE_PICKAXE, "Stone pickaxe", "stonepick", "stonepickaxe"), - STONE_AXE(ItemID.STONE_AXE, "Stone pickaxe", "stoneaxe"), - DIAMOND_SWORD(ItemID.DIAMOND_SWORD, "Diamond sword", "diamondsword"), - DIAMOND_SHOVEL(ItemID.DIAMOND_SHOVEL, "Diamond shovel", "diamondshovel"), - DIAMOND_PICKAXE(ItemID.DIAMOND_PICKAXE, "Diamond pickaxe", "diamondpick", "diamondpickaxe"), - DIAMOND_AXE(ItemID.DIAMOND_AXE, "Diamond axe", "diamondaxe"), - STICK(ItemID.STICK, "Stick", "stick"), - BOWL(ItemID.BOWL, "Bowl", "bowl"), - MUSHROOM_SOUP(ItemID.MUSHROOM_SOUP, "Mushroom soup", "mushroomsoup", "soup", "brbsoup"), - GOLD_SWORD(ItemID.GOLD_SWORD, "Golden sword", "goldsword"), - GOLD_SHOVEL(ItemID.GOLD_SHOVEL, "Golden shovel", "goldshovel"), - GOLD_PICKAXE(ItemID.GOLD_PICKAXE, "Golden pickaxe", "goldpick", "goldpickaxe"), - GOLD_AXE(ItemID.GOLD_AXE, "Golden axe", "goldaxe"), - STRING(ItemID.STRING, "String", "string"), - FEATHER(ItemID.FEATHER, "Feather", "feather"), - SULPHUR(ItemID.SULPHUR, "Sulphur", "sulphur", "sulfur", "gunpowder"), - WOOD_HOE(ItemID.WOOD_HOE, "Wooden hoe", "woodhoe"), - STONE_HOE(ItemID.STONE_HOE, "Stone hoe", "stonehoe"), - IRON_HOE(ItemID.IRON_HOE, "Iron hoe", "ironhoe"), - DIAMOND_HOE(ItemID.DIAMOND_HOE, "Diamond hoe", "diamondhoe"), - GOLD_HOE(ItemID.GOLD_HOE, "Golden hoe", "goldhoe"), - SEEDS(ItemID.SEEDS, "Seeds", "seeds", "seed"), - WHEAT(ItemID.WHEAT, "Wheat", "wheat"), - BREAD(ItemID.BREAD, "Bread", "bread"), - LEATHER_HELMET(ItemID.LEATHER_HELMET, "Leather helmet", "leatherhelmet", "leatherhat"), - LEATHER_CHEST(ItemID.LEATHER_CHEST, "Leather chestplate", "leatherchest", "leatherchestplate", "leathervest", "leatherbreastplate", "leatherplate", "leathercplate", "leatherbody"), - LEATHER_PANTS(ItemID.LEATHER_PANTS, "Leather pants", "leatherpants", "leathergreaves", "leatherlegs", "leatherleggings", "leatherstockings", "leatherbreeches"), - LEATHER_BOOTS(ItemID.LEATHER_BOOTS, "Leather boots", "leatherboots", "leathershoes", "leatherfoot", "leatherfeet"), - CHAINMAIL_HELMET(ItemID.CHAINMAIL_HELMET, "Chainmail helmet", "chainmailhelmet", "chainmailhat"), - CHAINMAIL_CHEST(ItemID.CHAINMAIL_CHEST, "Chainmail chestplate", "chainmailchest", "chainmailchestplate", "chainmailvest", "chainmailbreastplate", "chainmailplate", "chainmailcplate", "chainmailbody"), - CHAINMAIL_PANTS(ItemID.CHAINMAIL_PANTS, "Chainmail pants", "chainmailpants", "chainmailgreaves", "chainmaillegs", "chainmailleggings", "chainmailstockings", "chainmailbreeches"), - CHAINMAIL_BOOTS(ItemID.CHAINMAIL_BOOTS, "Chainmail boots", "chainmailboots", "chainmailshoes", "chainmailfoot", "chainmailfeet"), - IRON_HELMET(ItemID.IRON_HELMET, "Iron helmet", "ironhelmet", "ironhat"), - IRON_CHEST(ItemID.IRON_CHEST, "Iron chestplate", "ironchest", "ironchestplate", "ironvest", "ironbreastplate", "ironplate", "ironcplate", "ironbody"), - IRON_PANTS(ItemID.IRON_PANTS, "Iron pants", "ironpants", "irongreaves", "ironlegs", "ironleggings", "ironstockings", "ironbreeches"), - IRON_BOOTS(ItemID.IRON_BOOTS, "Iron boots", "ironboots", "ironshoes", "ironfoot", "ironfeet"), - DIAMOND_HELMET(ItemID.DIAMOND_HELMET, "Diamond helmet", "diamondhelmet", "diamondhat"), - DIAMOND_CHEST(ItemID.DIAMOND_CHEST, "Diamond chestplate", "diamondchest", "diamondchestplate", "diamondvest", "diamondbreastplate", "diamondplate", "diamondcplate", "diamondbody"), - DIAMOND_PANTS(ItemID.DIAMOND_PANTS, "Diamond pants", "diamondpants", "diamondgreaves", "diamondlegs", "diamondleggings", "diamondstockings", "diamondbreeches"), - DIAMOND_BOOTS(ItemID.DIAMOND_BOOTS, "Diamond boots", "diamondboots", "diamondshoes", "diamondfoot", "diamondfeet"), - GOLD_HELMET(ItemID.GOLD_HELMET, "Gold helmet", "goldhelmet", "goldhat"), - GOLD_CHEST(ItemID.GOLD_CHEST, "Gold chestplate", "goldchest", "goldchestplate", "goldvest", "goldbreastplate", "goldplate", "goldcplate", "goldbody"), - GOLD_PANTS(ItemID.GOLD_PANTS, "Gold pants", "goldpants", "goldgreaves", "goldlegs", "goldleggings", "goldstockings", "goldbreeches"), - GOLD_BOOTS(ItemID.GOLD_BOOTS, "Gold boots", "goldboots", "goldshoes", "goldfoot", "goldfeet"), - FLINT(ItemID.FLINT, "Flint", "flint"), - RAW_PORKCHOP(ItemID.RAW_PORKCHOP, "Raw porkchop", "rawpork", "rawporkchop", "rawbacon", "baconstrips", "rawmeat"), - COOKED_PORKCHOP(ItemID.COOKED_PORKCHOP, "Cooked porkchop", "pork", "cookedpork", "cookedporkchop", "cookedbacon", "bacon", "meat"), - PAINTING(ItemID.PAINTING, "Painting", "painting"), - GOLD_APPLE(ItemID.GOLD_APPLE, "Golden apple", "goldapple", "goldenapple"), - SIGN(ItemID.SIGN, "Wooden sign", "sign"), - WOODEN_DOOR_ITEM(ItemID.WOODEN_DOOR_ITEM, "Wooden door", "wooddoor", "door"), - BUCKET(ItemID.BUCKET, "Bucket", "bucket", "bukkit"), - WATER_BUCKET(ItemID.WATER_BUCKET, "Water bucket", "waterbucket", "waterbukkit"), - LAVA_BUCKET(ItemID.LAVA_BUCKET, "Lava bucket", "lavabucket", "lavabukkit"), - MINECART(ItemID.MINECART, "Minecart", "minecart", "cart"), - SADDLE(ItemID.SADDLE, "Saddle", "saddle"), - IRON_DOOR_ITEM(ItemID.IRON_DOOR_ITEM, "Iron door", "irondoor"), - REDSTONE_DUST(ItemID.REDSTONE_DUST, "Redstone dust", "redstonedust", "reddust", "redstone", "dust", "wire"), - SNOWBALL(ItemID.SNOWBALL, "Snowball", "snowball"), - WOOD_BOAT(ItemID.WOOD_BOAT, "Wooden boat", "woodboat", "woodenboat", "boat"), - LEATHER(ItemID.LEATHER, "Leather", "leather", "cowhide"), - MILK_BUCKET(ItemID.MILK_BUCKET, "Milk bucket", "milkbucket", "milk", "milkbukkit"), - BRICK_BAR(ItemID.BRICK_BAR, "Brick", "brickbar"), - CLAY_BALL(ItemID.CLAY_BALL, "Clay", "clay"), - SUGAR_CANE_ITEM(ItemID.SUGAR_CANE_ITEM, "Sugar cane", "sugarcane", "reed", "reeds"), - PAPER(ItemID.PAPER, "Paper", "paper"), - BOOK(ItemID.BOOK, "Book", "book"), - SLIME_BALL(ItemID.SLIME_BALL, "Slime ball", "slimeball", "slime"), - STORAGE_MINECART(ItemID.STORAGE_MINECART, "Minecart with Chest", "storageminecart", "storagecart", "minecartwithchest", "minecartchest", "chestminecart"), - POWERED_MINECART(ItemID.POWERED_MINECART, "Minecart with Furnace", "poweredminecart", "poweredcart", "minecartwithfurnace", "minecartfurnace", "furnaceminecart"), - EGG(ItemID.EGG, "Egg", "egg"), - COMPASS(ItemID.COMPASS, "Compass", "compass"), - FISHING_ROD(ItemID.FISHING_ROD, "Fishing rod", "fishingrod", "fishingpole"), - WATCH(ItemID.WATCH, "Watch", "watch", "clock", "timer"), - LIGHTSTONE_DUST(ItemID.LIGHTSTONE_DUST, "Glowstone dust", "lightstonedust", "glowstonedone", "brightstonedust", "brittlegolddust", "brimstonedust"), - RAW_FISH(ItemID.RAW_FISH, "Raw fish", "rawfish", "fish"), - COOKED_FISH(ItemID.COOKED_FISH, "Cooked fish", "cookedfish"), - INK_SACK(ItemID.INK_SACK, "Ink sac", "inksac", "ink", "dye", "inksack"), - BONE(ItemID.BONE, "Bone", "bone"), - SUGAR(ItemID.SUGAR, "Sugar", "sugar"), - CAKE_ITEM(ItemID.CAKE_ITEM, "Cake", "cake"), - BED_ITEM(ItemID.BED_ITEM, "Bed", "bed"), - REDSTONE_REPEATER(ItemID.REDSTONE_REPEATER, "Redstone repeater", "redstonerepeater", "diode", "delayer", "repeater"), - COOKIE(ItemID.COOKIE, "Cookie", "cookie"), - MAP(ItemID.MAP, "Map", "map"), - SHEARS(ItemID.SHEARS, "Shears", "shears", "scissors"), - MELON(ItemID.MELON, "Melon Slice", "melon", "melonslice"), - PUMPKIN_SEEDS(ItemID.PUMPKIN_SEEDS, "Pumpkin seeds", "pumpkinseed", "pumpkinseeds"), - MELON_SEEDS(ItemID.MELON_SEEDS, "Melon seeds", "melonseed", "melonseeds"), - RAW_BEEF(ItemID.RAW_BEEF, "Raw beef", "rawbeef", "rawcow", "beef"), - COOKED_BEEF(ItemID.COOKED_BEEF, "Steak", "steak", "cookedbeef", "cookedcow"), - RAW_CHICKEN(ItemID.RAW_CHICKEN, "Raw chicken", "rawchicken"), - COOKED_CHICKEN(ItemID.COOKED_CHICKEN, "Cooked chicken", "cookedchicken", "chicken", "grilledchicken"), - ROTTEN_FLESH(ItemID.ROTTEN_FLESH, "Rotten flesh", "rottenflesh", "zombiemeat", "flesh"), - ENDER_PEARL(ItemID.ENDER_PEARL, "Ender pearl", "pearl", "enderpearl"), - BLAZE_ROD(ItemID.BLAZE_ROD, "Blaze rod", "blazerod"), - GHAST_TEAR(ItemID.GHAST_TEAR, "Ghast tear", "ghasttear"), - GOLD_NUGGET(ItemID.GOLD_NUGGET, "Gold nuggest", "goldnugget"), - NETHER_WART_ITEM(ItemID.NETHER_WART_SEED, "Nether wart", "netherwart", "netherwartseed"), - POTION(ItemID.POTION, "Potion", "potion"), - GLASS_BOTTLE(ItemID.GLASS_BOTTLE, "Glass bottle", "glassbottle"), - SPIDER_EYE(ItemID.SPIDER_EYE, "Spider eye", "spidereye"), - FERMENTED_SPIDER_EYE(ItemID.FERMENTED_SPIDER_EYE, "Fermented spider eye", "fermentedspidereye", "fermentedeye"), - BLAZE_POWDER(ItemID.BLAZE_POWDER, "Blaze powder", "blazepowder"), - MAGMA_CREAM(ItemID.MAGMA_CREAM, "Magma cream", "magmacream"), - BREWING_STAND_ITEM(ItemID.BREWING_STAND, "Brewing stand", "brewingstand"), - CAULDRON_ITEM(ItemID.CAULDRON, "Cauldron", "cauldron"), - EYE_OF_ENDER(ItemID.EYE_OF_ENDER, "Eye of Ender", "eyeofender", "endereye"), - GLISTERING_MELON(ItemID.GLISTERING_MELON, "Glistering Melon", "glisteringmelon", "goldmelon"), - SPAWN_EGG(ItemID.SPAWN_EGG, "Spawn Egg", "spawnegg", "spawn", "mobspawnegg"), - BOTTLE_O_ENCHANTING(ItemID.BOTTLE_O_ENCHANTING, "Bottle o' Enchanting", "expbottle", "bottleoenchanting", "experiencebottle", "exppotion", "experiencepotion"), - FIRE_CHARGE(ItemID.FIRE_CHARGE, "Fire Charge", "firecharge", "firestarter", "firerock"), - BOOK_AND_QUILL(ItemID.BOOK_AND_QUILL, "Book and Quill", "bookandquill", "quill", "writingbook"), - WRITTEN_BOOK(ItemID.WRITTEN_BOOK, "Written Book", "writtenbook"), - EMERALD(ItemID.EMERALD, "Emerald", "emeraldingot", "emerald"), - ITEM_FRAME(ItemID.ITEM_FRAME, "Item frame", "itemframe", "frame", "itempainting"), - FLOWER_POT(ItemID.FLOWER_POT, "Flower pot", "flowerpot", "plantpot", "pot"), - CARROT(ItemID.CARROT, "Carrot", "carrot"), - POTATO(ItemID.POTATO, "Potato", "potato"), - BAKED_POTATO(ItemID.BAKED_POTATO, "Baked potato", "bakedpotato", "potatobaked"), - POISONOUS_POTATO(ItemID.POISONOUS_POTATO, "Poisonous potato", "poisonpotato", "poisonouspotato"), - BLANK_MAP(ItemID.BLANK_MAP, "Blank map", "blankmap", "emptymap"), - GOLDEN_CARROT(ItemID.GOLDEN_CARROT, "Golden carrot", "goldencarrot", "goldcarrot"), - HEAD(ItemID.HEAD, "Head", "skull", "head", "headmount", "mount"), - CARROT_ON_A_STICK(ItemID.CARROT_ON_A_STICK, "Carrot on a stick", "carrotonastick", "carrotonstick", "stickcarrot", "carrotstick"), - NETHER_STAR(ItemID.NETHER_STAR, "Nether star", "netherstar", "starnether"), - PUMPKIN_PIE(ItemID.PUMPKIN_PIE, "Pumpkin pie", "pumpkinpie"), - FIREWORK_ROCKET(ItemID.FIREWORK_ROCKET, "Firework rocket", "firework", "rocket"), - FIREWORK_STAR(ItemID.FIREWORK_STAR, "Firework star", "fireworkstar", "fireworkcharge"), - ENCHANTED_BOOK(ItemID.ENCHANTED_BOOK, "Enchanted book", "enchantedbook", "spellbook", "enchantedtome", "tome"), - COMPARATOR(ItemID.COMPARATOR, "Comparator", "comparator", "capacitor"), - NETHER_BRICK_ITEM(ItemID.NETHER_BRICK, "Nether Brick (item)", "netherbrickitem"), - NETHER_QUARTZ(ItemID.NETHER_QUARTZ, "Nether Quartz", "netherquartz", "quartz"), - TNT_MINECART(ItemID.TNT_MINECART, "Minecart with TNT", "minecraftwithtnt", "tntminecart", "minecarttnt"), - HOPPER_MINECART(ItemID.HOPPER_MINECART, "Minecart with Hopper", "minecraftwithhopper", "hopperminecart", "minecarthopper"), - PRISMARINE_SHARD(ItemID.PRISMARINE_SHARD, "Prismarine Shard", "prismarineshard"), - PRISMARINE_CRYSTALS(ItemID.PRISMARINE_CRYSTALS, "Prismarine Crystals", "prismarinecrystals", "prismarinecrystal"), - RABBIT(ItemID.RABBIT, "Raw Rabbit", "rawrabbit", "rabbit"), // raw and wriggling - COOKED_RABBIT(ItemID.COOKED_RABBIT, "Cooked Rabbit", "cookedrabbit"), // stupid fat hobbit, you ruins it - RABBIT_STEW(ItemID.RABBIT_STEW, "Rabbit Stew", "rabbitstew"), // po-ta-toes - RABBIT_FOOT(ItemID.RABBIT_FOOT, "Rabbit's Foot", "rabbitsfoot", "rabbitfoot"), - RABBIT_HIDE(ItemID.RABBIT_HIDE, "Rabbit Hide", "rabbithide", "rabbitskin"), - ARMOR_STAND(ItemID.ARMOR_STAND, "Armor Stand", "armorstand"), - HORSE_ARMOR_IRON(ItemID.HORSE_ARMOR_IRON, "Iron Horse Armor", "ironhorsearmor", "ironbarding"), - HORSE_ARMOR_GOLD(ItemID.HORSE_ARMOR_GOLD, "Gold Horse Armor", "goldhorsearmor", "goldbarding"), - HORSE_ARMOR_DIAMOND(ItemID.HORSE_ARMOR_DIAMOND, "Diamond Horse Armor", "diamondhorsearmor", "diamondbarding"), - LEAD(ItemID.LEAD, "Lead", "lead", "leash"), - NAME_TAG(ItemID.NAME_TAG, "Name Tag", "nametag"), - COMMAND_BLOCK_MINECART(ItemID.COMMAND_BLOCK_MINECART, "Minecart with Command Block"), - MUTTON(ItemID.MUTTON, "Mutton", "mutton", "rawmutton"), - COOKED_MUTTON(ItemID.COOKED_MUTTON, "Cooked Mutton", "cookedmutton"), - BANNER(ItemID.BANNER, "Banner", "banner"), - END_CRYSTAL(ItemID.END_CRYSTAL, "End Crystal", "endcrystal"), - SPRUCE_DOOR_ITEM(ItemID.SPRUCE_DOOR, "Spruce Door", "sprucedoor"), - BIRCH_DOOR_ITEM(ItemID.BIRCH_DOOR, "Birch Door", "birchdoor"), - JUNGLE_DOOR_ITEM(ItemID.JUNGLE_DOOR, "Jungle Door", "jungledoor"), - ACACIA_DOOR_ITEM(ItemID.ACACIA_DOOR, "Acacia Door", "acaciadoor"), - DARK_OAK_DOOR_ITEM(ItemID.DARK_OAK_DOOR, "Dark Oak Door", "darkoakdoor"), - CHORUS_FRUIT(ItemID.CHORUS_FRUIT, "Chorus Fruit", "chorusfruit"), - CHORUS_FRUIT_POPPED(ItemID.CHORUS_FRUIT_POPPED, "Popped Chorus Fruit", "poppedchorusfruit", "chorusfruitpopped", "cookedchorusfruit"), - BEETROOT(ItemID.BEETROOT, "Beetroot", "beetroot"), - BEETROOT_SEEDS(ItemID.BEETROOT_SEEDS, "Beetroot Seeds", "beetrootseeds"), - BEETROOT_SOUP(ItemID.BEETROOT_SOUP, "Beetroot Soup", "beetrootsoup"), - DRAGON_BREATH(ItemID.DRAGON_BREATH, "Dragon Breath", "dragonbreath"), - SPLASH_POTION(ItemID.SPLASH_POTION, "Splash Potion", "splashpotion", "potionsplash"), - SPECTRAL_ARROW(ItemID.SPECTRAL_ARROW, "Spectral Arrow", "spectralarrow", "glowingarrow"), - TIPPED_ARROW(ItemID.TIPPED_ARROW, "Tipped Arrow", "tippedarrow", "potionarrow"), - LINGERING_POTION(ItemID.LINGERING_POTION, "Lingering Potion", "lingeringpotion", "potionlingering"), - SHIELD(ItemID.SHIELD, "Shield", "shield"), - ELYTRA(ItemID.ELYTRA, "Elytra", "elytra", "wings"), - SPRUCE_BOAT(ItemID.SPRUCE_BOAT, "Spruce Boat", "spruceboat", "boatspruce"), - BIRCH_BOAT(ItemID.BIRCH_BOAT, "Birch Boat", "birchboat", "boatbirch"), - JUNGLE_BOAT(ItemID.JUNGLE_BOAT, "Jungle Boat", "jungleboat", "boatjungle"), - ACACIA_BOAT(ItemID.ACACIA_BOAT, "Acacia Boat", "acaciaboat", "boatacacia"), - DARK_OAK_BOAT(ItemID.DARK_OAK_BOAT, "Dark Oak Boat", "darkoakboat", "boatdarkoak"), - TOTEM_OF_UNDYING(ItemID.TOTEM_OF_UNDYING, "Totem of Undying", "totemofundying", "undyingtotem"), - SHULKER_SHELL(ItemID.SHULKER_SHELL, "Shulker Shell", "shulkershell"), - - DISC_13(ItemID.DISC_13, "Music Disc - 13", "disc_13"), - DISC_CAT(ItemID.DISC_CAT, "Music Disc - Cat", "disc_cat"), - DISC_BLOCKS(ItemID.DISC_BLOCKS, "Music Disc - blocks", "disc_blocks"), - DISC_CHIRP(ItemID.DISC_CHIRP, "Music Disc - chirp", "disc_chirp"), - DISC_FAR(ItemID.DISC_FAR, "Music Disc - far", "disc_far"), - DISC_MALL(ItemID.DISC_MALL, "Music Disc - mall", "disc_mall"), - DISC_MELLOHI(ItemID.DISC_MELLOHI, "Music Disc - mellohi", "disc_mellohi"), - DISC_STAL(ItemID.DISC_STAL, "Music Disc - stal", "disc_stal"), - DISC_STRAD(ItemID.DISC_STRAD, "Music Disc - strad", "disc_strad"), - DISC_WARD(ItemID.DISC_WARD, "Music Disc - ward", "disc_ward"), - DISC_11(ItemID.DISC_11, "Music Disc - 11", "disc_11"), - DISC_WAIT(ItemID.DISC_WAIT, "Music Disc - wait", "disc_wait"), - - // deprecated - @Deprecated GOLD_RECORD(ItemID.GOLD_RECORD, "Gold Record", "goldrecord", "golddisc"), - @Deprecated GREEN_RECORD(ItemID.GREEN_RECORD, "Green Record", "greenrecord", "greenddisc"); - - /** - * Stores a map of the IDs for fast access. - */ - private static final Map ids = new HashMap(); - /** - * Stores a map of the names for fast access. - */ - private static final Map lookup = new LinkedHashMap(); - - private final int id; - private final String name; - private final String[] lookupKeys; - - static { - for (ItemType type : EnumSet.allOf(ItemType.class)) { - ids.put(type.id, type); - for (String key : type.lookupKeys) { - lookup.put(key, type); - } - } - } - - - /** - * Construct the type. - * - * @param id the type ID of the item - * @param name the name of the item - * @param lookupKey a name to refer to the item type by - */ - ItemType(int id, String name, String lookupKey) { - this.id = id; - this.name = name; - this.lookupKeys = new String[] { lookupKey }; - } - - /** - * Construct the type. - * - * @param id the type ID of the item - * @param name the name of the item - * @param lookupKeys a list of names to refer to the item type by - */ - ItemType(int id, String name, String... lookupKeys) { - this.id = id; - this.name = name; - this.lookupKeys = lookupKeys; - } - - /** - * Return type from ID. May return null. - * - * @param id the type ID of the item - * @return an item type or null - */ - @Nullable - public static ItemType fromID(int id) { - return ids.get(id); - } - - /** - * Get a name for the item. - * - *

If the item type is not null, the numeric ID will be returned.

- * - * @param id the type ID of the item - * @return a name for the item - */ - public static String toName(int id) { - ItemType type = ids.get(id); - if (type != null) { - return type.getName(); - } else { - return "#" + id; - } - } - - /** - * Get a name for a held item. - * - *

If the item type is not null, the numeric ID will be returned.

- * - * @param id the type ID of the item - * @return the name of the item - */ - public static String toHeldName(int id) { - if (id == 0) { - return "Hand"; - } - ItemType type = ids.get(id); - if (type != null) { - return type.getName(); - } else { - return "#" + id; - } - } - - /** - * Return type from name. May return null. - * - * @param name the name - * @return the type or null - */ - @Nullable - public static ItemType lookup(String name) { - return lookup(name, true); - } - - /** - * Return type from name. May return null. - * - * @param name the name - * @param fuzzy true to do a fuzzy string search - * @return the type or null - */ - @Nullable - public static ItemType lookup(String name, boolean fuzzy) { - try { - return fromID(Integer.parseInt(name)); - } catch (NumberFormatException e) { - return StringUtil.lookup(lookup, name, fuzzy); - } - } - - /** - * Get item numeric ID. - * - * @return the type ID of this item - */ - public int getID() { - return id; - } - - /** - * Get user-friendly item name. - * - * @return a name of this item - */ - public String getName() { - return name; - } - - /** - * Get a list of aliases. - * - * @return a list of aliases - */ - public String[] getAliases() { - return lookupKeys; - } - - private static final Set shouldNotStack = new HashSet(); - static { - shouldNotStack.add(ItemID.IRON_SHOVEL); - shouldNotStack.add(ItemID.IRON_PICK); - shouldNotStack.add(ItemID.IRON_AXE); - shouldNotStack.add(ItemID.FLINT_AND_TINDER); - shouldNotStack.add(ItemID.BOW); - shouldNotStack.add(ItemID.IRON_SWORD); - shouldNotStack.add(ItemID.WOOD_SWORD); - shouldNotStack.add(ItemID.WOOD_SHOVEL); - shouldNotStack.add(ItemID.WOOD_PICKAXE); - shouldNotStack.add(ItemID.WOOD_AXE); - shouldNotStack.add(ItemID.STONE_SWORD); - shouldNotStack.add(ItemID.STONE_SHOVEL); - shouldNotStack.add(ItemID.STONE_PICKAXE); - shouldNotStack.add(ItemID.STONE_AXE); - shouldNotStack.add(ItemID.DIAMOND_SWORD); - shouldNotStack.add(ItemID.DIAMOND_SHOVEL); - shouldNotStack.add(ItemID.DIAMOND_PICKAXE); - shouldNotStack.add(ItemID.DIAMOND_AXE); - shouldNotStack.add(ItemID.BOWL); - shouldNotStack.add(ItemID.GOLD_SWORD); - shouldNotStack.add(ItemID.GOLD_SHOVEL); - shouldNotStack.add(ItemID.GOLD_PICKAXE); - shouldNotStack.add(ItemID.GOLD_AXE); - shouldNotStack.add(ItemID.WOOD_HOE); - shouldNotStack.add(ItemID.STONE_HOE); - shouldNotStack.add(ItemID.IRON_HOE); - shouldNotStack.add(ItemID.DIAMOND_HOE); - shouldNotStack.add(ItemID.GOLD_HOE); - shouldNotStack.add(ItemID.LEATHER_HELMET); - shouldNotStack.add(ItemID.LEATHER_CHEST); - shouldNotStack.add(ItemID.LEATHER_PANTS); - shouldNotStack.add(ItemID.LEATHER_BOOTS); - shouldNotStack.add(ItemID.CHAINMAIL_CHEST); - shouldNotStack.add(ItemID.CHAINMAIL_HELMET); - shouldNotStack.add(ItemID.CHAINMAIL_BOOTS); - shouldNotStack.add(ItemID.CHAINMAIL_PANTS); - shouldNotStack.add(ItemID.IRON_HELMET); - shouldNotStack.add(ItemID.IRON_CHEST); - shouldNotStack.add(ItemID.IRON_PANTS); - shouldNotStack.add(ItemID.IRON_BOOTS); - shouldNotStack.add(ItemID.DIAMOND_HELMET); - shouldNotStack.add(ItemID.DIAMOND_PANTS); - shouldNotStack.add(ItemID.DIAMOND_CHEST); - shouldNotStack.add(ItemID.DIAMOND_BOOTS); - shouldNotStack.add(ItemID.GOLD_HELMET); - shouldNotStack.add(ItemID.GOLD_CHEST); - shouldNotStack.add(ItemID.GOLD_PANTS); - shouldNotStack.add(ItemID.GOLD_BOOTS); - shouldNotStack.add(ItemID.WOODEN_DOOR_ITEM); - shouldNotStack.add(ItemID.WATER_BUCKET); - shouldNotStack.add(ItemID.LAVA_BUCKET); - shouldNotStack.add(ItemID.MINECART); - shouldNotStack.add(ItemID.SADDLE); - shouldNotStack.add(ItemID.IRON_DOOR_ITEM); - shouldNotStack.add(ItemID.WOOD_BOAT); - shouldNotStack.add(ItemID.MILK_BUCKET); - shouldNotStack.add(ItemID.STORAGE_MINECART); - shouldNotStack.add(ItemID.POWERED_MINECART); - shouldNotStack.add(ItemID.WATCH); - shouldNotStack.add(ItemID.CAKE_ITEM); - shouldNotStack.add(ItemID.BED_ITEM); - shouldNotStack.add(ItemID.MAP); - shouldNotStack.add(ItemID.SHEARS); - shouldNotStack.add(ItemID.HEAD); - shouldNotStack.add(ItemID.FIREWORK_ROCKET); - shouldNotStack.add(ItemID.FIREWORK_STAR); - shouldNotStack.add(ItemID.ENCHANTED_BOOK); - shouldNotStack.add(ItemID.TNT_MINECART); - shouldNotStack.add(ItemID.HOPPER_MINECART); - shouldNotStack.add(ItemID.HORSE_ARMOR_IRON); - shouldNotStack.add(ItemID.HORSE_ARMOR_GOLD); - shouldNotStack.add(ItemID.HORSE_ARMOR_DIAMOND); - shouldNotStack.add(ItemID.COMMAND_BLOCK_MINECART); - shouldNotStack.add(ItemID.DISC_13); - shouldNotStack.add(ItemID.DISC_CAT); - shouldNotStack.add(ItemID.DISC_BLOCKS); - shouldNotStack.add(ItemID.DISC_CHIRP); - shouldNotStack.add(ItemID.DISC_FAR); - shouldNotStack.add(ItemID.DISC_MALL); - shouldNotStack.add(ItemID.DISC_MELLOHI); - shouldNotStack.add(ItemID.DISC_STAL); - shouldNotStack.add(ItemID.DISC_STRAD); - shouldNotStack.add(ItemID.DISC_WARD); - shouldNotStack.add(ItemID.DISC_11); - shouldNotStack.add(ItemID.DISC_WAIT); - } - - /** - * Returns true if an item should not be stacked. - * - * @param id the type ID of the item - * @return true if the item should not stack - */ - public static boolean shouldNotStack(int id) { - return shouldNotStack.contains(id); - } - - private static final Set usesDamageValue = new HashSet(); - static { - usesDamageValue.add(BlockID.DIRT); - usesDamageValue.add(BlockID.WOOD); - usesDamageValue.add(BlockID.SAPLING); - usesDamageValue.add(BlockID.SAND); - usesDamageValue.add(BlockID.LOG); - usesDamageValue.add(BlockID.LEAVES); - usesDamageValue.add(BlockID.SANDSTONE); - usesDamageValue.add(BlockID.LONG_GRASS); - usesDamageValue.add(BlockID.CLOTH); - usesDamageValue.add(BlockID.RED_FLOWER); - usesDamageValue.add(BlockID.DOUBLE_STEP); - usesDamageValue.add(BlockID.STEP); - usesDamageValue.add(BlockID.SILVERFISH_BLOCK); - usesDamageValue.add(BlockID.STONE_BRICK); - usesDamageValue.add(BlockID.BROWN_MUSHROOM_CAP); - usesDamageValue.add(BlockID.RED_MUSHROOM_CAP); - usesDamageValue.add(BlockID.DOUBLE_WOODEN_STEP); - usesDamageValue.add(BlockID.WOODEN_STEP); - usesDamageValue.add(BlockID.COBBLESTONE_WALL); - usesDamageValue.add(BlockID.ANVIL); - usesDamageValue.add(BlockID.QUARTZ_BLOCK); - usesDamageValue.add(BlockID.STAINED_CLAY); - usesDamageValue.add(BlockID.CARPET); - - usesDamageValue.add(ItemID.COAL); - usesDamageValue.add(ItemID.INK_SACK); - usesDamageValue.add(ItemID.POTION); - usesDamageValue.add(ItemID.SPAWN_EGG); - usesDamageValue.add(ItemID.MAP); - usesDamageValue.add(ItemID.HEAD); - usesDamageValue.add(ItemID.GOLD_APPLE); - usesDamageValue.add(ItemID.RAW_FISH); - usesDamageValue.add(ItemID.COOKED_FISH); - usesDamageValue.add(ItemID.BANNER); - } - - /** - * Returns true if an item uses its damage value for something - * other than damage. - * - * @param id the type ID of the item - * @return true if the item uses its damage value - */ - public static boolean usesDamageValue(int id) { - return usesDamageValue.contains(id); - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java index 953168c3b..70deb8133 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; @@ -30,6 +33,7 @@ import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.function.FlatRegionFunction; import com.sk89q.worldedit.function.FlatRegionMaskingFilter; import com.sk89q.worldedit.function.biome.BiomeReplace; @@ -41,6 +45,7 @@ import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.FlatRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Regions; +import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BaseBiome; @@ -51,9 +56,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; - /** * Implements biome-related commands such as "/biomelist". */ @@ -90,7 +92,8 @@ public class BiomeCommands { offset = (page - 1) * 19; } - BiomeRegistry biomeRegistry = player.getWorld().getWorldData().getBiomeRegistry(); + BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager() + .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); List biomes = biomeRegistry.getBiomes(); int totalPages = biomes.size() / 19 + 1; player.print("Available Biomes (page " + page + "/" + totalPages + ") :"); @@ -124,23 +127,24 @@ public class BiomeCommands { ) @CommandPermissions("worldedit.biome.info") public void biomeInfo(Player player, LocalSession session, CommandContext args) throws WorldEditException { - BiomeRegistry biomeRegistry = player.getWorld().getWorldData().getBiomeRegistry(); - Set biomes = new HashSet(); + BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager() + .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); + Set biomes = new HashSet<>(); String qualifier; if (args.hasFlag('t')) { - Vector blockPosition = player.getBlockTrace(300); + Location blockPosition = player.getBlockTrace(300); if (blockPosition == null) { player.printError("No block in sight!"); return; } - BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector2D()); + BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toVector2D()); biomes.add(biome); qualifier = "at line of sight point"; } else if (args.hasFlag('p')) { - BaseBiome biome = player.getWorld().getBiome(player.getPosition().toVector2D()); + BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toVector2D()); biomes.add(biome); qualifier = "at your position"; @@ -191,7 +195,7 @@ public class BiomeCommands { Mask2D mask2d = mask != null ? mask.toMask2D() : null; if (atPosition) { - region = new CuboidRegion(player.getPosition(), player.getPosition()); + region = new CuboidRegion(player.getLocation().toVector(), player.getLocation().toVector()); } else { region = session.getSelection(world); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index 67efbd716..045dc6fbe 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; @@ -28,8 +30,6 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.command.tool.BrushTool; import com.sk89q.worldedit.command.tool.brush.ButcherBrush; import com.sk89q.worldedit.command.tool.brush.ClipboardBrush; @@ -46,10 +46,10 @@ import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.session.ClipboardHolder; +import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.parametric.Optional; - -import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.world.block.BlockTypes; /** * Commands to set brush shape. @@ -84,7 +84,7 @@ public class BrushCommands { @Optional("2") double radius, @Switch('h') boolean hollow) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - BrushTool tool = session.getBrushTool(player.getItemInHand()); + BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setFill(fill); tool.setSize(radius); @@ -114,7 +114,7 @@ public class BrushCommands { worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(height); - BrushTool tool = session.getBrushTool(player.getItemInHand()); + BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setFill(fill); tool.setSize(radius); @@ -149,7 +149,7 @@ public class BrushCommands { worldEdit.checkMaxBrushRadius(size.getBlockY()); worldEdit.checkMaxBrushRadius(size.getBlockZ()); - BrushTool tool = session.getBrushTool(player.getItemInHand()); + BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setBrush(new ClipboardBrush(holder, ignoreAir, usingOrigin), "worldedit.brush.clipboard"); player.print("Clipboard brush shape equipped."); @@ -158,27 +158,23 @@ public class BrushCommands { @Command( aliases = { "smooth" }, usage = "[size] [iterations]", - flags = "n", desc = "Choose the terrain softener brush", help = - "Chooses the terrain softener brush.\n" + - "The -n flag makes it only consider naturally occurring blocks.", + "Chooses the terrain softener brush.", min = 0, max = 2 ) @CommandPermissions("worldedit.brush.smooth") public void smoothBrush(Player player, LocalSession session, EditSession editSession, - @Optional("2") double radius, @Optional("4") int iterations, @Switch('n') - boolean naturalBlocksOnly) throws WorldEditException { + @Optional("2") double radius, @Optional("4") int iterations) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - BrushTool tool = session.getBrushTool(player.getItemInHand()); + BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); - tool.setBrush(new SmoothBrush(iterations, naturalBlocksOnly), "worldedit.brush.smooth"); + tool.setBrush(new SmoothBrush(iterations), "worldedit.brush.smooth"); - player.print(String.format("Smooth brush equipped (%.0f x %dx, using " + (naturalBlocksOnly ? "natural blocks only" : "any block") + ").", - radius, iterations)); + player.print(String.format("Smooth brush equipped (%.0f x %dx, using any block).", radius, iterations)); } @Command( @@ -192,11 +188,11 @@ public class BrushCommands { public void extinguishBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - BrushTool tool = session.getBrushTool(player.getItemInHand()); - Pattern fill = new BlockPattern(new BaseBlock(0)); + BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); + Pattern fill = new BlockPattern(BlockTypes.AIR.getDefaultState()); tool.setFill(fill); tool.setSize(radius); - tool.setMask(new BlockMask(editSession, new BaseBlock(BlockID.FIRE))); + tool.setMask(new BlockMask(editSession, BlockTypes.FIRE.getDefaultState().toFuzzy())); tool.setBrush(new SphereBrush(), "worldedit.brush.ex"); player.print(String.format("Extinguisher equipped (%.0f).", radius)); @@ -218,7 +214,7 @@ public class BrushCommands { public void gravityBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius, @Switch('h') boolean fromMaxY) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - BrushTool tool = session.getBrushTool(player.getItemInHand()); + BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); tool.setBrush(new GravityBrush(fromMaxY), "worldedit.brush.gravity"); @@ -265,7 +261,7 @@ public class BrushCommands { CreatureButcher flags = new CreatureButcher(player); flags.fromCommand(args); - BrushTool tool = session.getBrushTool(player.getItemInHand()); + BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); tool.setBrush(new ButcherBrush(flags), "worldedit.brush.butcher"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java index 0330c58bc..ae96027b0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java @@ -19,13 +19,22 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.math.MathUtils; +import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.storage.LegacyChunkStore; import com.sk89q.worldedit.world.storage.McRegionChunkStore; @@ -34,9 +43,6 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Set; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; - /** * Commands for working with chunks. */ @@ -58,7 +64,7 @@ public class ChunkCommands { ) @CommandPermissions("worldedit.chunkinfo") public void chunkInfo(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - Vector pos = player.getBlockIn(); + Location pos = player.getBlockIn(); int chunkX = (int) Math.floor(pos.getBlockX() / 16.0); int chunkZ = (int) Math.floor(pos.getBlockZ() / 16.0); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java index ab6a294cd..edc6282a7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java @@ -19,10 +19,18 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; @@ -43,10 +51,6 @@ import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.parametric.Optional; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; - /** * Clipboard commands. */ @@ -70,7 +74,7 @@ public class ClipboardCommands { desc = "Copy the selection to the clipboard", help = "Copy the selection to the clipboard\n" + "Flags:\n" + - " -e controls whether entities are copied\n" + + " -e will also copy entities\n" + " -m sets a source mask so that excluded blocks become air\n" + "WARNING: Pasting entities cannot yet be undone!", min = 0, @@ -84,11 +88,12 @@ public class ClipboardCommands { BlockArrayClipboard clipboard = new BlockArrayClipboard(region); clipboard.setOrigin(session.getPlacementPosition(player)); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); + copy.setCopyingEntities(copyEntities); if (mask != null) { copy.setSourceMask(mask); } Operations.completeLegacy(copy); - session.setClipboard(new ClipboardHolder(clipboard, editSession.getWorld().getWorldData())); + session.setClipboard(new ClipboardHolder(clipboard)); player.print(region.getArea() + " block(s) were copied."); } @@ -100,10 +105,9 @@ public class ClipboardCommands { desc = "Cut the selection to the clipboard", help = "Copy the selection to the clipboard\n" + "Flags:\n" + - " -e controls whether entities are copied\n" + + " -e will also cut entities\n" + " -m sets a source mask so that excluded blocks become air\n" + "WARNING: Cutting and pasting entities cannot yet be undone!", - min = 0, max = 1 ) @CommandPermissions("worldedit.clipboard.cut") @@ -116,11 +120,13 @@ public class ClipboardCommands { clipboard.setOrigin(session.getPlacementPosition(player)); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); copy.setSourceFunction(new BlockReplace(editSession, leavePattern)); + copy.setCopyingEntities(copyEntities); + copy.setRemovingEntities(true); if (mask != null) { copy.setSourceMask(mask); } Operations.completeLegacy(copy); - session.setClipboard(new ClipboardHolder(clipboard, editSession.getWorld().getWorldData())); + session.setClipboard(new ClipboardHolder(clipboard)); player.print(region.getArea() + " block(s) were copied."); } @@ -151,7 +157,7 @@ public class ClipboardCommands { Vector to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player); Operation operation = holder - .createPaste(editSession, editSession.getWorld().getWorldData()) + .createPaste(editSession) .to(to) .ignoreAirBlocks(ignoreAirBlocks) .build(); @@ -215,32 +221,6 @@ public class ClipboardCommands { player.print("The clipboard copy has been flipped."); } - @Command( - aliases = { "/load" }, - usage = "", - desc = "Load a schematic into your clipboard", - min = 0, - max = 1 - ) - @Deprecated - @CommandPermissions("worldedit.clipboard.load") - public void load(Actor actor) { - actor.printError("This command is no longer used. See //schematic load."); - } - - @Command( - aliases = { "/save" }, - usage = "", - desc = "Save a schematic into your clipboard", - min = 0, - max = 1 - ) - @Deprecated - @CommandPermissions("worldedit.clipboard.save") - public void save(Actor actor) { - actor.printError("This command is no longer used. See //schematic save."); - } - @Command( aliases = { "clearclipboard" }, usage = "", diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java index 70adc7803..b15d444d9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.Clipboard; @@ -30,9 +32,6 @@ import com.sk89q.worldedit.math.transform.CombinedTransform; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.world.registry.WorldData; - -import static com.google.common.base.Preconditions.checkNotNull; /** * Helper class to 'bake' a transform into a clipboard. @@ -46,22 +45,18 @@ class FlattenedClipboardTransform { private final Clipboard original; private final Transform transform; - private final WorldData worldData; /** * Create a new instance. * * @param original the original clipboard * @param transform the transform - * @param worldData the world data instance */ - private FlattenedClipboardTransform(Clipboard original, Transform transform, WorldData worldData) { + private FlattenedClipboardTransform(Clipboard original, Transform transform) { checkNotNull(original); checkNotNull(transform); - checkNotNull(worldData); this.original = original; this.transform = transform; - this.worldData = worldData; } /** @@ -122,7 +117,7 @@ class FlattenedClipboardTransform { * @return the operation */ public Operation copyTo(Extent target) { - BlockTransformExtent extent = new BlockTransformExtent(original, transform, worldData.getBlockRegistry()); + BlockTransformExtent extent = new BlockTransformExtent(original, transform); ForwardExtentCopy copy = new ForwardExtentCopy(extent, original.getRegion(), original.getOrigin(), target, original.getOrigin()); copy.setTransform(transform); return copy; @@ -133,11 +128,10 @@ class FlattenedClipboardTransform { * * @param original the original clipboard * @param transform the transform - * @param worldData the world data instance * @return a builder */ - public static FlattenedClipboardTransform transform(Clipboard original, Transform transform, WorldData worldData) { - return new FlattenedClipboardTransform(original, transform, worldData); + public static FlattenedClipboardTransform transform(Clipboard original, Transform transform) { + return new FlattenedClipboardTransform(original, transform); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index 4d8aa6f8f..3e1ecec7b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -19,17 +19,23 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.collect.Sets; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.ItemType; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.util.command.parametric.Optional; - -import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; /** * General WorldEdit commands. @@ -161,64 +167,55 @@ public class GeneralCommands { boolean blocksOnly = args.hasFlag('b'); boolean itemsOnly = args.hasFlag('i'); - try { - int id = Integer.parseInt(query); + ItemType type = ItemTypes.get(query); - ItemType type = ItemType.fromID(id); - - if (type != null) { - actor.print("#" + type.getID() + " (" + type.getName() + ")"); - } else { - actor.printError("No item found by ID " + id); - } - - return; - } catch (NumberFormatException ignored) { - } - - if (query.length() <= 2) { - actor.printError("Enter a longer search string (len > 2)."); - return; - } - - if (!blocksOnly && !itemsOnly) { - actor.print("Searching for: " + query); - } else if (blocksOnly && itemsOnly) { - actor.printError("You cannot use both the 'b' and 'i' flags simultaneously."); - return; - } else if (blocksOnly) { - actor.print("Searching for blocks: " + query); + if (type != null) { + actor.print(type.getId() + " (" + type.getName() + ")"); } else { - actor.print("Searching for items: " + query); - } - - int found = 0; - - for (ItemType type : ItemType.values()) { - if (found >= 15) { - actor.print("Too many results!"); - break; + if (query.length() <= 2) { + actor.printError("Enter a longer search string (len > 2)."); + return; } - if (blocksOnly && type.getID() > 255) { - continue; + if (!blocksOnly && !itemsOnly) { + actor.print("Searching for: " + query); + } else if (blocksOnly && itemsOnly) { + actor.printError("You cannot use both the 'b' and 'i' flags simultaneously."); + return; + } else if (blocksOnly) { + actor.print("Searching for blocks: " + query); + } else { + actor.print("Searching for items: " + query); } - if (itemsOnly && type.getID() <= 255) { - continue; - } + int found = 0; - for (String alias : type.getAliases()) { - if (alias.contains(query)) { - actor.print("#" + type.getID() + " (" + type.getName() + ")"); - ++found; + for (ItemType searchType : ItemType.REGISTRY) { + if (found >= 15) { + actor.print("Too many results!"); break; } - } - } - if (found == 0) { - actor.printError("No items found."); + if (blocksOnly && !searchType.hasBlockType()) { + continue; + } + + if (itemsOnly && searchType.hasBlockType()) { + continue; + } + + for (String alias : Sets.newHashSet(searchType.getId(), searchType.getName())) { + if (alias.contains(query)) { + actor.print(searchType.getId() + " (" + searchType.getName() + ")"); + ++found; + break; + } + } + } + + if (found == 0) { + actor.printError("No items found."); + } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index edda882a8..381de7a8a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -19,6 +19,11 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.ALL; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; @@ -29,11 +34,9 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; import com.sk89q.worldedit.internal.annotation.Selection; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.util.command.binding.Range; import com.sk89q.worldedit.util.command.binding.Switch; @@ -41,9 +44,6 @@ import com.sk89q.worldedit.util.command.binding.Text; import com.sk89q.worldedit.util.command.parametric.Optional; import com.sk89q.worldedit.world.biome.BaseBiome; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.*; - /** * Commands for the generation of shapes and other objects. */ @@ -117,7 +117,7 @@ public class GenerationCommands { worldEdit.checkMaxRadius(height); Vector pos = session.getPlacementPosition(player); - int affected = editSession.makeCylinder(pos, Patterns.wrap(pattern), radiusX, radiusZ, height, !hollow); + int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow); player.print(affected + " block(s) have been created."); } @@ -182,7 +182,7 @@ public class GenerationCommands { pos = pos.add(0, radiusY, 0); } - int affected = editSession.makeSphere(pos, Patterns.wrap(pattern), radiusX, radiusY, radiusZ, !hollow); + int affected = editSession.makeSphere(pos, pattern, radiusX, radiusY, radiusZ, !hollow); player.findFreePosition(); player.print(affected + " block(s) have been created."); } @@ -196,10 +196,9 @@ public class GenerationCommands { ) @CommandPermissions("worldedit.generation.forest") @Logging(POSITION) - @SuppressWarnings("deprecation") public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size, @Optional("tree") TreeType type, @Optional("5") double density) throws WorldEditException { density = density / 100; - int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, new TreeGenerator(type)); + int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type); player.print(affected + " trees created."); } @@ -243,7 +242,7 @@ public class GenerationCommands { public void pyramid(Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow) throws WorldEditException { Vector pos = session.getPlacementPosition(player); worldEdit.checkMaxRadius(size); - int affected = editSession.makePyramid(pos, Patterns.wrap(pattern), size, !hollow); + int affected = editSession.makePyramid(pos, pattern, size, !hollow); player.findFreePosition(); player.print(affected + " block(s) have been created."); } @@ -306,7 +305,7 @@ public class GenerationCommands { } try { - final int affected = editSession.makeShape(region, zero, unit, Patterns.wrap(pattern), expression, hollow); + final int affected = editSession.makeShape(region, zero, unit, pattern, expression, hollow); player.findFreePosition(); player.print(affected + " block(s) have been created."); } catch (ExpressionException e) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java index eda112bbd..8b76b68d4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java @@ -19,14 +19,17 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Commands to undo, redo, and clear history. */ @@ -60,7 +63,7 @@ public class HistoryCommands { undone = session.undo(session.getBlockBag(player), player); } else { player.checkPermission("worldedit.history.undo.other"); - LocalSession sess = worldEdit.getSession(args.getString(1)); + LocalSession sess = worldEdit.getSessionManager().findByName(args.getString(1)); if (sess == null) { player.printError("Unable to find session for " + args.getString(1)); break; @@ -95,7 +98,7 @@ public class HistoryCommands { redone = session.redo(session.getBlockBag(player), player); } else { player.checkPermission("worldedit.history.redo.other"); - LocalSession sess = worldEdit.getSession(args.getString(1)); + LocalSession sess = worldEdit.getSessionManager().findByName(args.getString(1)); if (sess == null) { player.printError("Unable to find session for " + args.getString(1)); break; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java index 4cb581e3d..082b29c6e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; @@ -28,13 +31,10 @@ import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.WorldVector; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.command.parametric.Optional; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION; - /** * Commands for moving the player around. */ @@ -75,9 +75,12 @@ public class NavigationCommands { ) @CommandPermissions("worldedit.navigation.ascend") public void ascend(Player player, @Optional("1") int levelsToAscend) throws WorldEditException { - int ascentLevels = 1; - while (player.ascendLevel() && levelsToAscend != ascentLevels) { + int ascentLevels = 0; + while (player.ascendLevel()) { ++ascentLevels; + if (levelsToAscend == ascentLevels) { + break; + } } if (ascentLevels == 0) { player.printError("No free spot above you found."); @@ -95,12 +98,15 @@ public class NavigationCommands { ) @CommandPermissions("worldedit.navigation.descend") public void descend(Player player, @Optional("1") int levelsToDescend) throws WorldEditException { - int descentLevels = 1; - while (player.descendLevel() && levelsToDescend != descentLevels) { + int descentLevels = 0; + while (player.descendLevel()) { ++descentLevels; + if (levelsToDescend == descentLevels) { + break; + } } if (descentLevels == 0) { - player.printError("No free spot above you found."); + player.printError("No free spot below you found."); } else { player.print((descentLevels != 1) ? "Descended " + Integer.toString(descentLevels) + " levels." : "Descended a level."); } @@ -155,7 +161,7 @@ public class NavigationCommands { @CommandPermissions("worldedit.navigation.jumpto.command") public void jumpTo(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - WorldVector pos = player.getSolidBlockTrace(300); + Location pos = player.getSolidBlockTrace(300); if (pos != null) { player.findFreePosition(pos); player.print("Poof!"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java index 174fe08de..5b5c17133 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java @@ -19,11 +19,22 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.ALL; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.ORIENTATION_REGION; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; +import static com.sk89q.worldedit.regions.Regions.asFlatRegion; +import static com.sk89q.worldedit.regions.Regions.maximumBlockY; +import static com.sk89q.worldedit.regions.Regions.minimumBlockY; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.function.GroundFunction; import com.sk89q.worldedit.function.generator.FloraGenerator; @@ -33,7 +44,6 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.NoiseFilter2D; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; import com.sk89q.worldedit.function.visitor.LayerVisitor; import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.annotation.Selection; @@ -46,20 +56,16 @@ import com.sk89q.worldedit.regions.ConvexPolyhedralRegion; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionOperationException; -import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.util.command.binding.Range; import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.binding.Text; import com.sk89q.worldedit.util.command.parametric.Optional; +import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.ArrayList; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.*; -import static com.sk89q.worldedit.regions.Regions.*; - /** * Commands that operate on regions. */ @@ -106,7 +112,7 @@ public class RegionCommands { CuboidRegion cuboidregion = (CuboidRegion) region; Vector pos1 = cuboidregion.getPos1(); Vector pos2 = cuboidregion.getPos2(); - int blocksChanged = editSession.drawLine(Patterns.wrap(pattern), pos1, pos2, thickness, !shell); + int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell); player.print(blocksChanged + " block(s) have been changed."); } @@ -137,9 +143,9 @@ public class RegionCommands { } ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region; - List vectors = new ArrayList(cpregion.getVertices()); + List vectors = new ArrayList<>(cpregion.getVertices()); - int blocksChanged = editSession.drawSpline(Patterns.wrap(pattern), vectors, 0, 0, 0, 10, thickness, !shell); + int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell); player.print(blocksChanged + " block(s) have been changed."); } @@ -158,7 +164,7 @@ public class RegionCommands { if (from == null) { from = new ExistingBlockMask(editSession); } - int affected = editSession.replaceBlocks(region, from, Patterns.wrap(to)); + int affected = editSession.replaceBlocks(region, from, to); player.print(affected + " block(s) have been replaced."); } @@ -172,7 +178,7 @@ public class RegionCommands { @CommandPermissions("worldedit.region.overlay") @Logging(REGION) public void overlay(Player player, EditSession editSession, @Selection Region region, Pattern pattern) throws WorldEditException { - int affected = editSession.overlayCuboidBlocks(region, Patterns.wrap(pattern)); + int affected = editSession.overlayCuboidBlocks(region, pattern); player.print(affected + " block(s) have been overlaid."); } @@ -186,7 +192,7 @@ public class RegionCommands { @Logging(REGION) @CommandPermissions("worldedit.region.center") public void center(Player player, EditSession editSession, @Selection Region region, Pattern pattern) throws WorldEditException { - int affected = editSession.center(region, Patterns.wrap(pattern)); + int affected = editSession.center(region, pattern); player.print("Center set ("+ affected + " blocks changed)"); } @@ -214,7 +220,7 @@ public class RegionCommands { @CommandPermissions("worldedit.region.walls") @Logging(REGION) public void walls(Player player, EditSession editSession, @Selection Region region, Pattern pattern) throws WorldEditException { - int affected = editSession.makeCuboidWalls(region, Patterns.wrap(pattern)); + int affected = editSession.makeCuboidWalls(region, pattern); player.print(affected + " block(s) have been changed."); } @@ -228,25 +234,23 @@ public class RegionCommands { @CommandPermissions("worldedit.region.faces") @Logging(REGION) public void faces(Player player, EditSession editSession, @Selection Region region, Pattern pattern) throws WorldEditException { - int affected = editSession.makeCuboidFaces(region, Patterns.wrap(pattern)); + int affected = editSession.makeCuboidFaces(region, pattern); player.print(affected + " block(s) have been changed."); } @Command( aliases = { "/smooth" }, usage = "[iterations]", - flags = "n", desc = "Smooth the elevation in the selection", help = - "Smooths the elevation in the selection.\n" + - "The -n flag makes it only consider naturally occuring blocks.", + "Smooths the elevation in the selection.", min = 0, max = 1 ) @CommandPermissions("worldedit.region.smooth") @Logging(REGION) - public void smooth(Player player, EditSession editSession, @Selection Region region, @Optional("1") int iterations, @Switch('n') boolean affectNatural) throws WorldEditException { - HeightMap heightMap = new HeightMap(editSession, region, affectNatural); + public void smooth(Player player, EditSession editSession, @Selection Region region, @Optional("1") int iterations) throws WorldEditException { + HeightMap heightMap = new HeightMap(editSession, region); HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0)); int affected = heightMap.applyFilter(filter, iterations); player.print("Terrain's height map smoothed. " + affected + " block(s) changed."); @@ -271,7 +275,7 @@ public class RegionCommands { @Selection Region region, @Optional("1") @Range(min = 1) int count, @Optional(Direction.AIM) @Direction Vector direction, - @Optional("air") BaseBlock replace, + @Optional("air") BlockStateHolder replace, @Switch('s') boolean moveSelection) throws WorldEditException { int affected = editSession.moveRegion(region, direction, count, true, replace); @@ -422,7 +426,7 @@ public class RegionCommands { @Optional("0") @Range(min = 0) int thickness, @Optional("air") Pattern pattern) throws WorldEditException { - int affected = editSession.hollowOutRegion(region, thickness, Patterns.wrap(pattern)); + int affected = editSession.hollowOutRegion(region, thickness, pattern); player.print(affected + " block(s) have been changed."); } @@ -438,7 +442,7 @@ public class RegionCommands { public void forest(Player player, EditSession editSession, @Selection Region region, @Optional("tree") TreeType type, @Optional("5") @Range(min = 0, max = 100) double density) throws WorldEditException { density = density / 100; - ForestGenerator generator = new ForestGenerator(editSession, new TreeGenerator(type)); + ForestGenerator generator = new ForestGenerator(editSession, type); GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator); LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground); visitor.setMask(new NoiseFilter2D(new RandomNoise(), density)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index a72e7b872..affa4b491 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandException; @@ -33,6 +35,7 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; +import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; import com.sk89q.worldedit.function.operation.Operations; @@ -42,7 +45,6 @@ import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.parametric.Optional; import com.sk89q.worldedit.util.io.Closer; import com.sk89q.worldedit.util.io.file.FilenameException; -import com.sk89q.worldedit.world.registry.WorldData; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -52,14 +54,11 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Comparator; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Commands that work with schematic files. */ @@ -88,45 +87,40 @@ public class SchematicCommands { desc = "Load a schematic into your clipboard", min = 1, max = 2 ) - @Deprecated @CommandPermissions({ "worldedit.clipboard.load", "worldedit.schematic.load" }) - public void load(Player player, LocalSession session, @Optional("schematic") String formatName, String filename) throws FilenameException { + public void load(Player player, LocalSession session, @Optional("sponge") String formatName, String filename) throws FilenameException { LocalConfiguration config = worldEdit.getConfiguration(); File dir = worldEdit.getWorkingDirectoryFile(config.saveDir); - File f = worldEdit.getSafeOpenFile(player, dir, filename, "schematic", "schematic"); + File f = worldEdit.getSafeOpenFile(player, dir, filename, "schematic", ClipboardFormats.getFileExtensionArray()); if (!f.exists()) { player.printError("Schematic " + filename + " does not exist!"); return; } - ClipboardFormat format = ClipboardFormat.findByAlias(formatName); + ClipboardFormat format = ClipboardFormats.findByFile(f); + if (format == null) { + format = ClipboardFormats.findByAlias(formatName); + } if (format == null) { player.printError("Unknown schematic format: " + formatName); return; } - Closer closer = Closer.create(); - try { + try (Closer closer = Closer.create()) { FileInputStream fis = closer.register(new FileInputStream(f)); BufferedInputStream bis = closer.register(new BufferedInputStream(fis)); - ClipboardReader reader = format.getReader(bis); + ClipboardReader reader = closer.register(format.getReader(bis)); - WorldData worldData = player.getWorld().getWorldData(); - Clipboard clipboard = reader.read(player.getWorld().getWorldData()); - session.setClipboard(new ClipboardHolder(clipboard, worldData)); + Clipboard clipboard = reader.read(); + session.setClipboard(new ClipboardHolder(clipboard)); log.info(player.getName() + " loaded " + f.getCanonicalPath()); player.print(filename + " loaded. Paste it with //paste"); } catch (IOException e) { player.printError("Schematic could not read or it does not exist: " + e.getMessage()); log.log(Level.WARNING, "Failed to load a saved clipboard", e); - } finally { - try { - closer.close(); - } catch (IOException ignored) { - } } } @@ -136,20 +130,20 @@ public class SchematicCommands { desc = "Save a schematic into your clipboard", min = 1, max = 2 ) - @Deprecated @CommandPermissions({ "worldedit.clipboard.save", "worldedit.schematic.save" }) - public void save(Player player, LocalSession session, @Optional("schematic") String formatName, String filename) throws CommandException, WorldEditException { + public void save(Player player, LocalSession session, @Optional("sponge") String formatName, String filename) throws CommandException, WorldEditException { LocalConfiguration config = worldEdit.getConfiguration(); File dir = worldEdit.getWorkingDirectoryFile(config.saveDir); - File f = worldEdit.getSafeSaveFile(player, dir, filename, "schematic", "schematic"); - ClipboardFormat format = ClipboardFormat.findByAlias(formatName); + ClipboardFormat format = ClipboardFormats.findByAlias(formatName); if (format == null) { player.printError("Unknown schematic format: " + formatName); return; } + File f = worldEdit.getSafeSaveFile(player, dir, filename, format.getPrimaryFileExtension()); + ClipboardHolder holder = session.getClipboard(); Clipboard clipboard = holder.getClipboard(); Transform transform = holder.getTransform(); @@ -157,7 +151,7 @@ public class SchematicCommands { // If we have a transform, bake it into the copy if (!transform.isIdentity()) { - FlattenedClipboardTransform result = FlattenedClipboardTransform.transform(clipboard, transform, holder.getWorldData()); + FlattenedClipboardTransform result = FlattenedClipboardTransform.transform(clipboard, transform); target = new BlockArrayClipboard(result.getTransformedRegion()); target.setOrigin(clipboard.getOrigin()); Operations.completeLegacy(result.copyTo(target)); @@ -165,8 +159,7 @@ public class SchematicCommands { target = clipboard; } - Closer closer = Closer.create(); - try { + try (Closer closer = Closer.create()) { // Create parent directories File parent = f.getParentFile(); if (parent != null && !parent.exists()) { @@ -178,17 +171,12 @@ public class SchematicCommands { FileOutputStream fos = closer.register(new FileOutputStream(f)); BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos)); ClipboardWriter writer = closer.register(format.getWriter(bos)); - writer.write(target, holder.getWorldData()); + writer.write(target); log.info(player.getName() + " saved " + f.getCanonicalPath()); player.print(filename + " saved."); } catch (IOException e) { player.printError("Schematic could not written: " + e.getMessage()); log.log(Level.WARNING, "Failed to write a saved clipboard", e); - } finally { - try { - closer.close(); - } catch (IOException ignored) { - } } } @@ -232,9 +220,9 @@ public class SchematicCommands { actor.print("Available clipboard formats (Name: Lookup names)"); StringBuilder builder; boolean first = true; - for (ClipboardFormat format : ClipboardFormat.values()) { + for (ClipboardFormat format : ClipboardFormats.getAll()) { builder = new StringBuilder(); - builder.append(format.name()).append(": "); + builder.append(format.getName()).append(": "); for (String lookupName : format.getAliases()) { if (!first) { builder.append(", "); @@ -283,24 +271,21 @@ public class SchematicCommands { final int sortType = args.hasFlag('d') ? -1 : args.hasFlag('n') ? 1 : 0; // cleanup file list - Arrays.sort(files, new Comparator(){ - @Override - public int compare(File f1, File f2) { - // http://stackoverflow.com/questions/203030/best-way-to-list-files-in-java-sorted-by-date-modified - int res; - if (sortType == 0) { // use name by default - int p = f1.getParent().compareTo(f2.getParent()); - if (p == 0) { // same parent, compare names - res = f1.getName().compareTo(f2.getName()); - } else { // different parent, sort by that - res = p; - } - } else { - res = Long.valueOf(f1.lastModified()).compareTo(f2.lastModified()); // use date if there is a flag - if (sortType == 1) res = -res; // flip date for newest first instead of oldest first + Arrays.sort(files, (f1, f2) -> { + // http://stackoverflow.com/questions/203030/best-way-to-list-files-in-java-sorted-by-date-modified + int res; + if (sortType == 0) { // use name by default + int p = f1.getParent().compareTo(f2.getParent()); + if (p == 0) { // same parent, compare names + res = f1.getName().compareTo(f2.getName()); + } else { // different parent, sort by that + res = p; } - return res; + } else { + res = Long.compare(f1.lastModified(), f2.lastModified()); // use date if there is a flag + if (sortType == 1) res = -res; // flip date for newest first instead of oldest first } + return res; }); List schematics = listFiles(worldEdit.getConfiguration().saveDir, files); @@ -322,7 +307,7 @@ public class SchematicCommands { private List allFiles(File root) { File[] files = root.listFiles(); if (files == null) return null; - List fileList = new ArrayList(); + List fileList = new ArrayList<>(); for (File f : files) { if (f.isDirectory()) { List subFiles = allFiles(f); @@ -337,15 +322,15 @@ public class SchematicCommands { private List listFiles(String prefix, File[] files) { if (prefix == null) prefix = ""; - List result = new ArrayList(); + List result = new ArrayList<>(); for (File file : files) { StringBuilder build = new StringBuilder(); build.append("\u00a72"); - ClipboardFormat format = ClipboardFormat.findByFile(file); + ClipboardFormat format = ClipboardFormats.findByFile(file); boolean inRoot = file.getParentFile().getName().equals(prefix); build.append(inRoot ? file.getName() : file.getPath().split(Pattern.quote(prefix + File.separator))[1]) - .append(": ").append(format == null ? "Unknown" : format.name()); + .append(": ").append(format == null ? "Unknown" : format.getName()); result.add(build.toString()); } return result; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java index 3cb190e15..922dfcb69 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.ALL; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; @@ -31,9 +34,6 @@ import com.sk89q.worldedit.entity.Player; import java.io.File; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.ALL; - /** * Commands related to scripting. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java index 41799e8a0..fb4d9824e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java @@ -19,7 +19,9 @@ package com.sk89q.worldedit.command; -import com.google.common.base.Optional; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandException; @@ -31,9 +33,9 @@ import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.regions.Region; @@ -49,20 +51,22 @@ import com.sk89q.worldedit.regions.selector.RegionSelectorType; import com.sk89q.worldedit.regions.selector.SphereRegionSelector; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.util.Countable; +import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.formatting.ColorCodeBuilder; import com.sk89q.worldedit.util.formatting.Style; import com.sk89q.worldedit.util.formatting.StyledFragment; import com.sk89q.worldedit.util.formatting.component.CommandListBox; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.storage.ChunkStore; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.Set; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; - /** * Selection commands. */ @@ -85,12 +89,12 @@ public class SelectionCommands { @CommandPermissions("worldedit.selection.pos") public void pos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - Vector pos; + Location pos; if (args.argsLength() == 1) { if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) { String[] coords = args.getString(0).split(","); - pos = new Vector(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2])); + pos = new Location(player.getWorld(), Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2])); } else { player.printError("Invalid coordinates " + args.getString(0)); return; @@ -99,13 +103,13 @@ public class SelectionCommands { pos = player.getBlockIn(); } - if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) { + if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector(), ActorSelectorLimits.forActor(player))) { player.printError("Position already set."); return; } session.getRegionSelector(player.getWorld()) - .explainPrimarySelection(player, session, pos); + .explainPrimarySelection(player, session, pos.toVector()); } @Command( @@ -119,11 +123,11 @@ public class SelectionCommands { @CommandPermissions("worldedit.selection.pos") public void pos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - Vector pos; + Location pos; if (args.argsLength() == 1) { if (args.getString(0).matches("-?\\d+,-?\\d+,-?\\d+")) { String[] coords = args.getString(0).split(","); - pos = new Vector(Integer.parseInt(coords[0]), + pos = new Location(player.getWorld(), Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2])); } else { @@ -134,13 +138,13 @@ public class SelectionCommands { pos = player.getBlockIn(); } - if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) { + if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector(), ActorSelectorLimits.forActor(player))) { player.printError("Position already set."); return; } session.getRegionSelector(player.getWorld()) - .explainSecondarySelection(player, session, pos); + .explainSecondarySelection(player, session, pos.toVector()); } @Command( @@ -152,17 +156,17 @@ public class SelectionCommands { ) @CommandPermissions("worldedit.selection.hpos") public void hpos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - - Vector pos = player.getBlockTrace(300); + + Location pos = player.getBlockTrace(300); if (pos != null) { - if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) { + if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector(), ActorSelectorLimits.forActor(player))) { player.printError("Position already set."); return; } session.getRegionSelector(player.getWorld()) - .explainPrimarySelection(player, session, pos); + .explainPrimarySelection(player, session, pos.toVector()); } else { player.printError("No block in sight!"); } @@ -177,17 +181,17 @@ public class SelectionCommands { ) @CommandPermissions("worldedit.selection.hpos") public void hpos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - - Vector pos = player.getBlockTrace(300); + + Location pos = player.getBlockTrace(300); if (pos != null) { - if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) { + if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector(), ActorSelectorLimits.forActor(player))) { player.printError("Position already set."); return; } session.getRegionSelector(player.getWorld()) - .explainSecondarySelection(player, session, pos); + .explainSecondarySelection(player, session, pos.toVector()); } else { player.printError("No block in sight!"); } @@ -241,7 +245,7 @@ public class SelectionCommands { min2D = (args.hasFlag('c')) ? pos : ChunkStore.toChunk(pos.toVector()); } else { // use player loc - min2D = ChunkStore.toChunk(player.getBlockIn()); + min2D = ChunkStore.toChunk(player.getBlockIn().toVector()); } min = new Vector(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); @@ -275,7 +279,7 @@ public class SelectionCommands { @CommandPermissions("worldedit.wand") public void wand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - player.giveItem(we.getConfiguration().wandItem, 1); + player.giveItem(new BaseItemStack(ItemTypes.get(we.getConfiguration().wandItem), 1)); player.print("Left click: select pos #1; Right click: select pos #2"); } @@ -331,7 +335,7 @@ public class SelectionCommands { return; } - List dirs = new ArrayList(); + List dirs = new ArrayList<>(); int change = args.getInteger(0); int reverseChange = 0; @@ -404,7 +408,7 @@ public class SelectionCommands { @CommandPermissions("worldedit.selection.contract") public void contract(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - List dirs = new ArrayList(); + List dirs = new ArrayList<>(); int change = args.getInteger(0); int reverseChange = 0; @@ -479,7 +483,7 @@ public class SelectionCommands { @CommandPermissions("worldedit.selection.shift") public void shift(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - List dirs = new ArrayList(); + List dirs = new ArrayList<>(); int change = args.getInteger(0); if (args.argsLength() == 2) { if (args.getString(1).contains(",")) { @@ -557,7 +561,7 @@ public class SelectionCommands { } private Vector[] getChangesForEachDir(CommandContext args) { - List changes = new ArrayList(6); + List changes = new ArrayList<>(6); int change = args.getInteger(0); if (!args.hasFlag('h')) { @@ -623,26 +627,22 @@ public class SelectionCommands { aliases = { "/count" }, usage = "", desc = "Counts the number of a certain type of block", - flags = "d", min = 1, max = 1 ) @CommandPermissions("worldedit.analysis.count") public void count(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - boolean useData = args.hasFlag('d'); - if (args.getString(0).contains(":")) { - useData = true; //override d flag, if they specified data they want it - } - if (useData) { - Set searchBlocks = we.getBlocks(player, args.getString(0), true); - int count = editSession.countBlocks(session.getSelection(player.getWorld()), searchBlocks); - player.print("Counted: " + count); - } else { - Set searchIDs = we.getBlockIDs(player, args.getString(0), true); - int count = editSession.countBlock(session.getSelection(player.getWorld()), searchIDs); - player.print("Counted: " + count); - } + ParserContext context = new ParserContext(); + context.setActor(player); + context.setExtent(player.getExtent()); + context.setWorld(player.getWorld()); + context.setSession(session); + context.setRestricted(false); + + Set searchBlocks = we.getBlockFactory().parseFromListInput(args.getString(0), context); + int count = editSession.countBlocks(session.getSelection(player.getWorld()), searchBlocks); + player.print("Counted: " + count); } @Command( @@ -652,7 +652,7 @@ public class SelectionCommands { help = "Gets the distribution of blocks in the selection.\n" + "The -c flag gets the distribution of your clipboard.\n" + - "The -d flag separates blocks by data", + "The -d flag separates blocks by state", flags = "cd", min = 0, max = 0 @@ -662,8 +662,8 @@ public class SelectionCommands { int size; boolean useData = args.hasFlag('d'); - List> distribution = null; - List> distributionData = null; + List> distribution = null; + List> distributionData = null; if (args.hasFlag('c')) { // TODO: Update for new clipboard @@ -677,8 +677,7 @@ public class SelectionCommands { size = session.getSelection(player.getWorld()).getArea(); } - if ((useData && distributionData.size() <= 0) - || (!useData && distribution.size() <= 0)) { // *Should* always be false + if ((useData && distributionData.size() <= 0) || (!useData && distribution.size() <= 0)) { // *Should* always be false player.printError("No blocks counted."); return; } @@ -686,22 +685,24 @@ public class SelectionCommands { player.print("# total blocks: " + size); if (useData) { - for (Countable c : distributionData) { - String name = BlockType.fromID(c.getID().getId()).getName(); - String str = String.format("%-7s (%.3f%%) %s #%d:%d", + for (Countable c : distributionData) { + String name = c.getID().getBlockType().getName(); + String str = String.format("%-7s (%.3f%%) %s #%s%s", String.valueOf(c.getAmount()), c.getAmount() / (double) size * 100, - name == null ? "Unknown" : name, - c.getID().getType(), c.getID().getData()); + name, + c.getID().getBlockType().getId(), + c.getID().getStates()); player.print(str); } } else { - for (Countable c : distribution) { - BlockType block = BlockType.fromID(c.getID()); - String str = String.format("%-7s (%.3f%%) %s #%d", + for (Countable c : distribution) { + String name = c.getID().getName(); + String str = String.format("%-7s (%.3f%%) %s #%s", String.valueOf(c.getAmount()), c.getAmount() / (double) size * 100, - block == null ? "Unknown" : block.getName(), c.getID()); + name, + c.getID().getId()); player.print(str); } } @@ -738,9 +739,7 @@ public class SelectionCommands { selector = new Polygonal2DRegionSelector(oldSelector); player.print("2D polygon selector: Left/right click to add a point."); Optional limit = ActorSelectorLimits.forActor(player).getPolygonVertexLimit(); - if (limit.isPresent()) { - player.print(limit.get() + " points maximum."); - } + limit.ifPresent(integer -> player.print(integer + " points maximum.")); } else if (typeName.equalsIgnoreCase("ellipsoid")) { selector = new EllipsoidRegionSelector(oldSelector); player.print("Ellipsoid selector: left click=center, right click to extend"); @@ -754,9 +753,7 @@ public class SelectionCommands { selector = new ConvexPolyhedralRegionSelector(oldSelector); player.print("Convex polyhedral selector: Left click=First vertex, right click to add more."); Optional limit = ActorSelectorLimits.forActor(player).getPolyhedronVertexLimit(); - if (limit.isPresent()) { - player.print(limit.get() + " points maximum."); - } + limit.ifPresent(integer -> player.print(integer + " points maximum.")); } else { CommandListBox box = new CommandListBox("Selection modes"); StyledFragment contents = box.getContents(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java index 8c7676eee..4cd0e0079 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java @@ -24,7 +24,11 @@ package com.sk89q.worldedit.command; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.world.snapshot.InvalidSnapshotException; import com.sk89q.worldedit.world.snapshot.Snapshot; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java index 9eeacf199..fcd5445a6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java @@ -19,11 +19,17 @@ package com.sk89q.worldedit.command; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; + import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.Logging; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.DataException; @@ -37,8 +43,6 @@ import java.io.File; import java.io.IOException; import java.util.logging.Logger; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; - public class SnapshotUtilCommands { private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit"); @@ -115,10 +119,7 @@ public class SnapshotUtilCommands { try { chunkStore = snapshot.getChunkStore(); player.print("Snapshot '" + snapshot.getName() + "' loaded; now restoring..."); - } catch (DataException e) { - player.printError("Failed to load snapshot: " + e.getMessage()); - return; - } catch (IOException e) { + } catch (DataException | IOException e) { player.printError("Failed to load snapshot: " + e.getMessage()); return; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java index 116d71a81..5fa571265 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java @@ -22,7 +22,11 @@ package com.sk89q.worldedit.command; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.command.tool.AreaPickaxe; import com.sk89q.worldedit.command.tool.RecursivePickaxe; import com.sk89q.worldedit.command.tool.SinglePickaxe; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java index 59f099c58..7b80fbd73 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java @@ -22,13 +22,26 @@ package com.sk89q.worldedit.command; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.ItemType; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.blocks.BaseItemStack; +import com.sk89q.worldedit.command.tool.BlockDataCyler; +import com.sk89q.worldedit.command.tool.BlockReplacer; +import com.sk89q.worldedit.command.tool.DistanceWand; +import com.sk89q.worldedit.command.tool.FloatingTreeRemover; +import com.sk89q.worldedit.command.tool.FloodFillTool; +import com.sk89q.worldedit.command.tool.LongRangeBuildTool; +import com.sk89q.worldedit.command.tool.QueryTool; +import com.sk89q.worldedit.command.tool.TreePlanter; import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.patterns.Pattern; -import com.sk89q.worldedit.command.tool.*; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.TreeGenerator; +import com.sk89q.worldedit.world.block.BlockStateHolder; public class ToolCommands { private final WorldEdit we; @@ -46,7 +59,7 @@ public class ToolCommands { ) public void none(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - session.setTool(player.getItemInHand(), null); + session.setTool(player.getItemInHand(HandSide.MAIN_HAND).getType(), null); player.print("Tool unbound from your current item."); } @@ -60,9 +73,10 @@ public class ToolCommands { @CommandPermissions("worldedit.tool.info") public void info(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - session.setTool(player.getItemInHand(), new QueryTool()); + BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); + session.setTool(itemStack.getType(), new QueryTool()); player.print("Info tool bound to " - + ItemType.toHeldName(player.getItemInHand()) + "."); + + itemStack.getType().getName() + "."); } @Command( @@ -73,11 +87,10 @@ public class ToolCommands { max = 1 ) @CommandPermissions("worldedit.tool.tree") - @SuppressWarnings("deprecation") public void tree(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - TreeGenerator.TreeType type = args.argsLength() > 0 ? - type = TreeGenerator.lookup(args.getString(0)) + TreeGenerator.TreeType type = args.argsLength() > 0 + ? TreeGenerator.lookup(args.getString(0)) : TreeGenerator.TreeType.TREE; if (type == null) { @@ -85,9 +98,9 @@ public class ToolCommands { return; } - session.setTool(player.getItemInHand(), new TreePlanter(new TreeGenerator(type))); - player.print("Tree tool bound to " - + ItemType.toHeldName(player.getItemInHand()) + "."); + BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); + session.setTool(itemStack.getType(), new TreePlanter(type)); + player.print("Tree tool bound to " + itemStack.getType().getName() + "."); } @Command( @@ -100,10 +113,17 @@ public class ToolCommands { @CommandPermissions("worldedit.tool.replacer") public void repl(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - BaseBlock targetBlock = we.getBlock(player, args.getString(0)); - session.setTool(player.getItemInHand(), new BlockReplacer(targetBlock)); - player.print("Block replacer tool bound to " - + ItemType.toHeldName(player.getItemInHand()) + "."); + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + context.setRestricted(true); + context.setPreferringWildcard(false); + + BlockStateHolder targetBlock = we.getBlockFactory().parseFromInput(args.getString(0), context); + BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); + session.setTool(itemStack.getType(), new BlockReplacer(targetBlock)); + player.print("Block replacer tool bound to " + itemStack.getType().getName() + "."); } @Command( @@ -116,9 +136,9 @@ public class ToolCommands { @CommandPermissions("worldedit.tool.data-cycler") public void cycler(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - session.setTool(player.getItemInHand(), new BlockDataCyler()); - player.print("Block data cycler tool bound to " - + ItemType.toHeldName(player.getItemInHand()) + "."); + BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); + session.setTool(itemStack.getType(), new BlockDataCyler()); + player.print("Block data cycler tool bound to " + itemStack.getType().getName() + "."); } @Command( @@ -139,10 +159,15 @@ public class ToolCommands { return; } - Pattern pattern = we.getBlockPattern(player, args.getString(0)); - session.setTool(player.getItemInHand(), new FloodFillTool(range, pattern)); - player.print("Block flood fill tool bound to " - + ItemType.toHeldName(player.getItemInHand()) + "."); + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); + + BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); + session.setTool(itemStack.getType(), new FloodFillTool(range, pattern)); + player.print("Block flood fill tool bound to " + itemStack.getType().getName() + "."); } @Command( @@ -155,9 +180,10 @@ public class ToolCommands { @CommandPermissions("worldedit.tool.deltree") public void deltree(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - session.setTool(player.getItemInHand(), new FloatingTreeRemover()); - player.print("Floating tree remover tool bound to " - + ItemType.toHeldName(player.getItemInHand()) + "."); + BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); + session.setTool(itemStack.getType(), new FloatingTreeRemover()); + player.print("Floating tree remover tool bound to " + + itemStack.getType().getName() + "."); } @Command( @@ -170,8 +196,9 @@ public class ToolCommands { @CommandPermissions("worldedit.tool.farwand") public void farwand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - session.setTool(player.getItemInHand(), new DistanceWand()); - player.print("Far wand tool bound to " + ItemType.toHeldName(player.getItemInHand()) + "."); + BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); + session.setTool(itemStack.getType(), new DistanceWand()); + player.print("Far wand tool bound to " + itemStack.getType().getName() + "."); } @Command( @@ -184,11 +211,21 @@ public class ToolCommands { @CommandPermissions("worldedit.tool.lrbuild") public void longrangebuildtool(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - BaseBlock secondary = we.getBlock(player, args.getString(0)); - BaseBlock primary = we.getBlock(player, args.getString(1)); - session.setTool(player.getItemInHand(), new LongRangeBuildTool(primary, secondary)); - player.print("Long-range building tool bound to " + ItemType.toHeldName(player.getItemInHand()) + "."); - player.print("Left-click set to " + ItemType.toName(secondary.getType()) + "; right-click set to " - + ItemType.toName(primary.getType()) + "."); + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + context.setRestricted(true); + context.setPreferringWildcard(false); + + BlockStateHolder secondary = we.getBlockFactory().parseFromInput(args.getString(0), context); + BlockStateHolder primary = we.getBlockFactory().parseFromInput(args.getString(1), context); + + BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); + + session.setTool(itemStack.getType(), new LongRangeBuildTool(primary, secondary)); + player.print("Long-range building tool bound to " + itemStack.getType().getName() + "."); + player.print("Left-click set to " + secondary.getBlockType().getName() + "; right-click set to " + + primary.getBlockType().getName() + "."); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java index f4f92675c..e74dd129f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java @@ -22,10 +22,14 @@ package com.sk89q.worldedit.command; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.command.parametric.Optional; /** @@ -78,10 +82,10 @@ public class ToolUtilCommands { @CommandPermissions("worldedit.brush.options.mask") public void mask(Player player, LocalSession session, EditSession editSession, @Optional Mask mask) throws WorldEditException { if (mask == null) { - session.getBrushTool(player.getItemInHand()).setMask(null); + session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setMask(null); player.print("Brush mask disabled."); } else { - session.getBrushTool(player.getItemInHand()).setMask(mask); + session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setMask(mask); player.print("Brush mask set."); } } @@ -95,7 +99,7 @@ public class ToolUtilCommands { ) @CommandPermissions("worldedit.brush.options.material") public void material(Player player, LocalSession session, EditSession editSession, Pattern pattern) throws WorldEditException { - session.getBrushTool(player.getItemInHand()).setFill(pattern); + session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setFill(pattern); player.print("Brush material set."); } @@ -109,7 +113,7 @@ public class ToolUtilCommands { @CommandPermissions("worldedit.brush.options.range") public void range(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { int range = args.getInteger(0); - session.getBrushTool(player.getItemInHand()).setRange(range); + session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setRange(range); player.print("Brush range set."); } @@ -126,7 +130,7 @@ public class ToolUtilCommands { int radius = args.getInteger(0); we.checkMaxBrushRadius(radius); - session.getBrushTool(player.getItemInHand()).setSize(radius); + session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setSize(radius); player.print("Brush size set."); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java index e3e505007..f20b54d51 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.command; +import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT; + import com.google.common.base.Joiner; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; @@ -31,22 +33,22 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.command.util.CreatureButcher; import com.sk89q.worldedit.command.util.EntityRemover; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.CommandManager; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.function.operation.Operations; +import com.sk89q.worldedit.function.pattern.BlockPattern; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.visitor.EntityVisitor; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; -import com.sk89q.worldedit.patterns.Pattern; -import com.sk89q.worldedit.patterns.SingleBlockPattern; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CylinderRegion; import com.sk89q.worldedit.regions.Region; @@ -62,14 +64,13 @@ import com.sk89q.worldedit.util.formatting.component.Code; import com.sk89q.worldedit.util.formatting.component.CommandListBox; import com.sk89q.worldedit.util.formatting.component.CommandUsageBox; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Set; -import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT; - /** * Utility commands. */ @@ -92,20 +93,18 @@ public class UtilityCommands { @Logging(PLACEMENT) public void fill(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - Pattern pattern = we.getBlockPattern(player, args.getString(0)); + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); + double radius = Math.max(1, args.getDouble(1)); we.checkMaxRadius(radius); int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : 1; Vector pos = session.getPlacementPosition(player); - int affected = 0; - if (pattern instanceof SingleBlockPattern) { - affected = editSession.fillXZ(pos, - ((SingleBlockPattern) pattern).getBlock(), - radius, depth, false); - } else { - affected = editSession.fillXZ(pos, pattern, radius, depth, false); - } + int affected = editSession.fillXZ(pos, pattern, radius, depth, false); player.print(affected + " block(s) have been created."); } @@ -120,17 +119,20 @@ public class UtilityCommands { @Logging(PLACEMENT) public void fillr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - Pattern pattern = we.getBlockPattern(player, args.getString(0)); + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); + double radius = Math.max(1, args.getDouble(1)); we.checkMaxRadius(radius); int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE; Vector pos = session.getPlacementPosition(player); int affected = 0; - if (pattern instanceof SingleBlockPattern) { - affected = editSession.fillXZ(pos, - ((SingleBlockPattern) pattern).getBlock(), - radius, depth, true); + if (pattern instanceof BlockPattern) { + affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true); } else { affected = editSession.fillXZ(pos, pattern, radius, depth, true); } @@ -168,8 +170,7 @@ public class UtilityCommands { double radius = Math.max(0, args.getDouble(0)); we.checkMaxRadius(radius); - int affected = editSession.fixLiquid( - session.getPlacementPosition(player), radius, 10, 11); + int affected = editSession.fixLiquid(session.getPlacementPosition(player), radius, BlockTypes.LAVA); player.print(affected + " block(s) have been changed."); } @@ -186,8 +187,7 @@ public class UtilityCommands { double radius = Math.max(0, args.getDouble(0)); we.checkMaxRadius(radius); - int affected = editSession.fixLiquid( - session.getPlacementPosition(player), radius, 8, 9); + int affected = editSession.fixLiquid(session.getPlacementPosition(player), radius, BlockTypes.WATER); player.print(affected + " block(s) have been changed."); } @@ -243,11 +243,18 @@ public class UtilityCommands { @Logging(PLACEMENT) public void removeNear(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { - BaseBlock block = we.getBlock(player, args.getString(0), true); + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + context.setRestricted(false); + context.setPreferringWildcard(false); + + BlockStateHolder block = we.getBlockFactory().parseFromInput(args.getString(0), context); int size = Math.max(1, args.getInteger(1, 50)); we.checkMaxRadius(size); - int affected = editSession.removeNear(session.getPlacementPosition(player), block.getType(), size); + int affected = editSession.removeNear(session.getPlacementPosition(player), block.getBlockType(), size); player.print(affected + " block(s) have been removed."); } @@ -265,14 +272,22 @@ public class UtilityCommands { int size = Math.max(1, args.getInteger(0)); int affected; - Set from; + Set from; Pattern to; + + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + context.setRestricted(false); + context.setPreferringWildcard(!args.hasFlag('f')); + if (args.argsLength() == 2) { from = null; - to = we.getBlockPattern(player, args.getString(1)); + to = we.getPatternFactory().parseFromInput(args.getString(1), context); } else { - from = we.getBlocks(player, args.getString(1), true, !args.hasFlag('f')); - to = we.getBlockPattern(player, args.getString(2)); + from = we.getBlockFactory().parseFromListInput(args.getString(1), context); + to = we.getPatternFactory().parseFromInput(args.getString(2), context); } Vector base = session.getPlacementPosition(player); @@ -280,8 +295,8 @@ public class UtilityCommands { Vector max = base.add(size, size, size); Region region = new CuboidRegion(player.getWorld(), min, max); - if (to instanceof SingleBlockPattern) { - affected = editSession.replaceBlocks(region, from, ((SingleBlockPattern) to).getBlock()); + if (to instanceof BlockPattern) { + affected = editSession.replaceBlocks(region, from, ((BlockPattern) to).getBlock()); } else { affected = editSession.replaceBlocks(region, from, to); } @@ -359,7 +374,7 @@ public class UtilityCommands { : defaultRadius; we.checkMaxRadius(size); - int affected = editSession.removeNear(session.getPlacementPosition(player), 51, size); + int affected = editSession.removeNear(session.getPlacementPosition(player), BlockTypes.FIRE, size); player.print(affected + " block(s) have been removed."); } @@ -411,7 +426,7 @@ public class UtilityCommands { CreatureButcher flags = new CreatureButcher(actor); flags.fromCommand(args); - List visitors = new ArrayList(); + List visitors = new ArrayList<>(); LocalSession session = null; EditSession editSession = null; @@ -426,12 +441,12 @@ public class UtilityCommands { } else { entities = editSession.getEntities(); } - visitors.add(new EntityVisitor(entities.iterator(), flags.createFunction(editSession.getWorld().getWorldData().getEntityRegistry()))); + visitors.add(new EntityVisitor(entities.iterator(), flags.createFunction())); } else { Platform platform = we.getPlatformManager().queryCapability(Capability.WORLD_EDITING); for (World world : platform.getWorlds()) { List entities = world.getEntities(); - visitors.add(new EntityVisitor(entities.iterator(), flags.createFunction(world.getWorldData().getEntityRegistry()))); + visitors.add(new EntityVisitor(entities.iterator(), flags.createFunction())); } } @@ -471,7 +486,7 @@ public class UtilityCommands { EntityRemover remover = new EntityRemover(); remover.fromString(typeStr); - List visitors = new ArrayList(); + List visitors = new ArrayList<>(); LocalSession session = null; EditSession editSession = null; @@ -486,12 +501,12 @@ public class UtilityCommands { } else { entities = editSession.getEntities(); } - visitors.add(new EntityVisitor(entities.iterator(), remover.createFunction(editSession.getWorld().getWorldData().getEntityRegistry()))); + visitors.add(new EntityVisitor(entities.iterator(), remover.createFunction())); } else { Platform platform = we.getPlatformManager().queryCapability(Capability.WORLD_EDITING); for (World world : platform.getWorlds()) { List entities = world.getEntities(); - visitors.add(new EntityVisitor(entities.iterator(), remover.createFunction(world.getWorldData().getEntityRegistry()))); + visitors.add(new EntityVisitor(entities.iterator(), remover.createFunction())); } } @@ -591,7 +606,7 @@ public class UtilityCommands { } boolean isRootLevel = true; - List visited = new ArrayList(); + List visited = new ArrayList<>(); // Drill down to the command for (int i = 0; i < effectiveLength; i++) { @@ -631,8 +646,8 @@ public class UtilityCommands { Dispatcher dispatcher = (Dispatcher) callable; // Get a list of aliases - List aliases = new ArrayList(dispatcher.getCommands()); - Collections.sort(aliases, new PrimaryAliasComparator(CommandManager.COMMAND_CLEAN_PATTERN)); + List aliases = new ArrayList<>(dispatcher.getCommands()); + aliases.sort(new PrimaryAliasComparator(CommandManager.COMMAND_CLEAN_PATTERN)); // Calculate pagination int offset = perPage * page; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java index 1c40eb8f6..c849d1469 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java @@ -22,7 +22,10 @@ package com.sk89q.worldedit.command; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.event.platform.ConfigurationLoadEvent; import com.sk89q.worldedit.extension.platform.Actor; @@ -78,7 +81,7 @@ public class WorldEditCommands { ) @CommandPermissions("worldedit.reload") public void reload(Actor actor) throws WorldEditException { - we.getServer().reload(); + we.getPlatformManager().queryCapability(Capability.CONFIGURATION).reload(); we.getEventBus().post(new ConfigurationLoadEvent(we.getPlatformManager().queryCapability(Capability.CONFIGURATION).getConfiguration())); actor.print("Configuration reloaded!"); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemParser.java index 3f548fb06..880c17fb8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemParser.java @@ -24,14 +24,13 @@ import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.blocks.BaseItem; -import com.sk89q.worldedit.util.command.composition.SimpleCommand; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extension.input.InputParseException; -import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.util.command.argument.CommandArgs; +import com.sk89q.worldedit.util.command.composition.SimpleCommand; import com.sk89q.worldedit.world.World; public class ItemParser extends SimpleCommand { @@ -65,8 +64,6 @@ public class ItemParser extends SimpleCommand { try { return WorldEdit.getInstance().getItemFactory().parseFromInput(itemString, parserContext); - } catch (NoMatchException e) { - throw new CommandException(e.getMessage(), e); } catch (InputParseException e) { throw new CommandException(e.getMessage(), e); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java index 94e30e1b0..2ce222c5b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java @@ -68,7 +68,7 @@ public class ItemUseParser extends SimpleCommand> { @Override public String toString() { - return "application of the item " + item.getType() + ":" + item.getData(); + return "application of the item " + item.getType() + ":" + item.getNbtData(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/PatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/PatternParser.java index 7a5f9a928..e8d209e4c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/PatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/PatternParser.java @@ -23,15 +23,14 @@ import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.util.command.composition.SimpleCommand; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extension.input.InputParseException; -import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.util.command.argument.CommandArgs; +import com.sk89q.worldedit.util.command.composition.SimpleCommand; import com.sk89q.worldedit.world.World; public class PatternParser extends SimpleCommand { @@ -61,8 +60,6 @@ public class PatternParser extends SimpleCommand { try { return WorldEdit.getInstance().getPatternFactory().parseFromInput(patternString, parserContext); - } catch (NoMatchException e) { - throw new CommandException(e.getMessage(), e); } catch (InputParseException e) { throw new CommandException(e.getMessage(), e); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/RegionFactoryParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/RegionFactoryParser.java index 25493f363..9ec0ce101 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/RegionFactoryParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/RegionFactoryParser.java @@ -40,14 +40,17 @@ public class RegionFactoryParser implements CommandExecutor { try { String type = args.next(); - if (type.equals("cuboid")) { - return new CuboidRegionFactory(); - } else if (type.equals("sphere")) { - return new SphereRegionFactory(); - } else if (type.equals("cyl") || type.equals("cylinder")) { - return new CylinderRegionFactory(1); // TODO: Adjustable height - } else { - throw new CommandException("Unknown shape type: " + type + " (try one of " + getUsage() + ")"); + switch (type) { + case "cuboid": + return new CuboidRegionFactory(); + case "sphere": + return new SphereRegionFactory(); + case "cyl": + case "cylinder": + return new CylinderRegionFactory(1); // TODO: Adjustable height + + default: + throw new CommandException("Unknown shape type: " + type + " (try one of " + getUsage() + ")"); } } catch (MissingArgumentException e) { throw new CommandException("Missing shape type (try one of " + getUsage() + ")"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ReplaceParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ReplaceParser.java index 6db624149..4d98103c3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ReplaceParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ReplaceParser.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.command.argument; +import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; + import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.worldedit.extent.NullExtent; @@ -30,7 +32,6 @@ import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.util.command.argument.CommandArgs; import com.sk89q.worldedit.util.command.composition.SimpleCommand; -import static com.google.common.base.Objects.firstNonNull; public class ReplaceParser extends SimpleCommand> { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/TreeGeneratorParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/TreeGeneratorParser.java index 34b782af7..3d3f73d6b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/TreeGeneratorParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/TreeGeneratorParser.java @@ -94,7 +94,7 @@ public class TreeGeneratorParser implements CommandExecutor> { private final CommandExecutor> functionParser; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java index 4206d6947..087963aed 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/SelectionCommand.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.command.composition; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.base.Joiner; import com.google.common.collect.Lists; import com.sk89q.minecraft.util.commands.CommandException; @@ -41,8 +43,6 @@ import com.sk89q.worldedit.util.command.composition.SimpleCommand; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - public class SelectionCommand extends SimpleCommand { private final CommandExecutor> delegate; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java index faeb30928..e2bc2f14f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/ShapedBrushCommand.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.command.composition; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.minecraft.util.commands.CommandPermissionsException; @@ -35,12 +37,11 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.function.Contextual; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.regions.factory.RegionFactory; +import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.command.argument.CommandArgs; import com.sk89q.worldedit.util.command.composition.CommandExecutor; import com.sk89q.worldedit.util.command.composition.SimpleCommand; -import static com.google.common.base.Preconditions.checkNotNull; - public class ShapedBrushCommand extends SimpleCommand { private final CommandExecutor> delegate; @@ -71,12 +72,10 @@ public class ShapedBrushCommand extends SimpleCommand { try { WorldEdit.getInstance().checkMaxBrushRadius(radius); - BrushTool tool = session.getBrushTool(player.getItemInHand()); + BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); tool.setBrush(new OperationFactoryBrush(factory, regionFactory), permission); - } catch (MaxBrushRadiusException e) { - WorldEdit.getInstance().getPlatformManager().getCommandManager().getExceptionConverter().convert(e); - } catch (InvalidToolBindException e) { + } catch (MaxBrushRadiusException | InvalidToolBindException e) { WorldEdit.getInstance().getPlatformManager().getCommandManager().getExceptionConverter().convert(e); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java index 04a25443a..6401eb993 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java @@ -19,20 +19,23 @@ package com.sk89q.worldedit.command.tool; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.MaxChangedBlocksException; +import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; /** * A super pickaxe mode that will remove blocks in an area. */ public class AreaPickaxe implements BlockTool { - private static final BaseBlock air = new BaseBlock(0); private int range; public AreaPickaxe(int range) { @@ -49,13 +52,13 @@ public class AreaPickaxe implements BlockTool { int ox = clicked.getBlockX(); int oy = clicked.getBlockY(); int oz = clicked.getBlockZ(); - int initialType = ((World) clicked.getExtent()).getBlockType(clicked.toVector()); + BlockType initialType = clicked.getExtent().getBlock(clicked.toVector()).getBlockType(); - if (initialType == 0) { + if (initialType == BlockTypes.AIR) { return true; } - if (initialType == BlockID.BEDROCK && !player.canDestroyBedrock()) { + if (initialType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) { return true; } @@ -67,13 +70,13 @@ public class AreaPickaxe implements BlockTool { for (int y = oy - range; y <= oy + range; ++y) { for (int z = oz - range; z <= oz + range; ++z) { Vector pos = new Vector(x, y, z); - if (editSession.getBlockType(pos) != initialType) { + if (editSession.getBlock(pos).getBlockType() != initialType) { continue; } ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().distanceSq(pos)); - editSession.setBlock(pos, air); + editSession.setBlock(pos, BlockTypes.AIR.getDefaultState()); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java index ec2a05559..faee49faf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java @@ -19,17 +19,23 @@ package com.sk89q.worldedit.command.tool; +import com.google.common.collect.Lists; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockData; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockState; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; /** * A mode that cycles the data values of supported blocks. @@ -41,34 +47,55 @@ public class BlockDataCyler implements DoubleActionBlockTool { return player.hasPermission("worldedit.tool.data-cycler"); } + private Map> selectedProperties = new HashMap<>(); + private boolean handleCycle(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, boolean forward) { World world = (World) clicked.getExtent(); - int type = world.getBlockType(clicked.toVector()); - int data = world.getBlockData(clicked.toVector()); + BlockState block = world.getBlock(clicked.toVector()); if (!config.allowedDataCycleBlocks.isEmpty() && !player.hasPermission("worldedit.override.data-cycler") - && !config.allowedDataCycleBlocks.contains(type)) { + && !config.allowedDataCycleBlocks.contains(block.getBlockType().getId())) { player.printError("You are not permitted to cycle the data value of that block."); return true; } - int increment = forward ? 1 : -1; - BaseBlock block = new BaseBlock(type, BlockData.cycle(type, data, increment)); - EditSession editSession = session.createEditSession(player); - - if (block.getData() < 0) { + if (block.getStates().keySet().isEmpty()) { player.printError("That block's data cannot be cycled!"); } else { - try { - editSession.setBlock(clicked.toVector(), block); - } catch (MaxChangedBlocksException e) { - player.printError("Max blocks change limit reached."); - } finally { - session.remember(editSession); + Property currentProperty = selectedProperties.get(player.getUniqueId()); + + if (currentProperty == null || (forward && block.getState(currentProperty) == null)) { + currentProperty = block.getStates().keySet().stream().findFirst().get(); + selectedProperties.put(player.getUniqueId(), currentProperty); + } + + if (forward) { + block.getState(currentProperty); + int index = currentProperty.getValues().indexOf(block.getState(currentProperty)); + index = (index + 1) % currentProperty.getValues().size(); + BlockState newBlock = block.with(currentProperty, currentProperty.getValues().get(index)); + + EditSession editSession = session.createEditSession(player); + + try { + editSession.setBlock(clicked.toVector(), newBlock); + player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString()); + } catch (MaxChangedBlocksException e) { + player.printError("Max blocks change limit reached."); + } finally { + session.remember(editSession); + } + } else { + List> properties = Lists.newArrayList(block.getStates().keySet()); + int index = properties.indexOf(currentProperty); + index = (index + 1) % properties.size(); + currentProperty = properties.get(index); + selectedProperties.put(player.getUniqueId(), currentProperty); + player.print("Now cycling " + currentProperty.getName()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java index 8d4f718c4..9d0b9c9fc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java @@ -19,23 +19,25 @@ package com.sk89q.worldedit.command.tool; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extent.inventory.BlockBag; -import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; /** * A mode that replaces one block. */ public class BlockReplacer implements DoubleActionBlockTool { - private BaseBlock targetBlock; + private BlockStateHolder targetBlock; - public BlockReplacer(BaseBlock targetBlock) { + public BlockReplacer(BlockStateHolder targetBlock) { this.targetBlock = targetBlock; } @@ -66,10 +68,9 @@ public class BlockReplacer implements DoubleActionBlockTool { @Override public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { - World world = (World) clicked.getExtent(); EditSession editSession = session.createEditSession(player); targetBlock = (editSession).getBlock(clicked.toVector()); - BlockType type = BlockType.fromID(targetBlock.getType()); + BlockType type = targetBlock.getBlockType(); if (type != null) { player.print("Replacer tool switched to: " + type.getName()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java index 2e7fbc24a..9096a4d19 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java @@ -19,11 +19,12 @@ package com.sk89q.worldedit.command.tool; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.WorldVector; import com.sk89q.worldedit.command.tool.brush.Brush; import com.sk89q.worldedit.command.tool.brush.SphereBrush; import com.sk89q.worldedit.entity.Player; @@ -34,11 +35,10 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.MaskIntersection; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.util.Location; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Builds a shape at the place being looked at. */ @@ -162,7 +162,7 @@ public class BrushTool implements TraceTool { @Override public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) { - WorldVector target = null; + Location target = null; target = player.getBlockTrace(getRange(), true); if (target == null) { @@ -189,7 +189,7 @@ public class BrushTool implements TraceTool { } try { - brush.build(editSession, target, material, size); + brush.build(editSession, target.toVector(), material, size); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java index a4cb1151f..7488c14ad 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java @@ -19,12 +19,14 @@ package com.sk89q.worldedit.command.tool; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; import com.sk89q.worldedit.regions.RegionSelector; +import com.sk89q.worldedit.util.Location; /** * A wand that can be used at a distance. @@ -43,12 +45,12 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool { @Override public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) { if (session.isToolControlEnabled() && player.hasPermission("worldedit.selection.pos")) { - WorldVector target = getTarget(player); + Location target = getTarget(player); if (target == null) return true; RegionSelector selector = session.getRegionSelector(player.getWorld()); - if (selector.selectPrimary(target, ActorSelectorLimits.forActor(player))) { - selector.explainPrimarySelection(player, session, target); + if (selector.selectPrimary(target.toVector(), ActorSelectorLimits.forActor(player))) { + selector.explainPrimarySelection(player, session, target.toVector()); } return true; @@ -60,12 +62,12 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool { @Override public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) { if (session.isToolControlEnabled() && player.hasPermission("worldedit.selection.pos")) { - WorldVector target = getTarget(player); + Location target = getTarget(player); if (target == null) return true; RegionSelector selector = session.getRegionSelector(player.getWorld()); - if (selector.selectSecondary(target, ActorSelectorLimits.forActor(player))) { - selector.explainSecondarySelection(player, session, target); + if (selector.selectSecondary(target.toVector(), ActorSelectorLimits.forActor(player))) { + selector.explainSecondarySelection(player, session, target.toVector()); } return true; @@ -73,8 +75,8 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool { return false; } - public WorldVector getTarget(Player player) { - WorldVector target = null; + public Location getTarget(Player player) { + Location target; if (this.range > -1) { target = player.getBlockTrace(getRange(), true); } else { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java index 14785c392..5f2d822cc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java @@ -19,14 +19,21 @@ package com.sk89q.worldedit.command.tool; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.MaxChangedBlocksException; +import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockCategories; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.HashSet; import java.util.LinkedList; @@ -37,7 +44,6 @@ import java.util.Set; * to anything else) */ public class FloatingTreeRemover implements BlockTool { - private static final BaseBlock AIR = new BaseBlock(BlockID.AIR); private int rangeSq; public FloatingTreeRemover() { @@ -49,23 +55,23 @@ public class FloatingTreeRemover implements BlockTool { return player.hasPermission("worldedit.tool.deltree"); } + private boolean isTreeBlock(BlockType type) { + return BlockCategories.LEAVES.contains(type) + || BlockCategories.LOGS.contains(type) + || type == BlockTypes.RED_MUSHROOM_BLOCK + || type == BlockTypes.BROWN_MUSHROOM_BLOCK + || type == BlockTypes.MUSHROOM_STEM + || type == BlockTypes.VINE; + } + @Override public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { final World world = (World) clicked.getExtent(); + final BlockState state = world.getBlock(clicked.toVector()); - switch (world.getBlockType(clicked.toVector())) { - case BlockID.LOG: - case BlockID.LOG2: - case BlockID.LEAVES: - case BlockID.LEAVES2: - case BlockID.BROWN_MUSHROOM_CAP: - case BlockID.RED_MUSHROOM_CAP: - case BlockID.VINE: - break; - - default: + if (!isTreeBlock(state.getBlockType())) { player.printError("That's not a tree."); return true; } @@ -80,16 +86,9 @@ public class FloatingTreeRemover implements BlockTool { } for (Vector blockVector : blockSet) { - final int typeId = editSession.getBlock(blockVector).getType(); - switch (typeId) { - case BlockID.LOG: - case BlockID.LOG2: - case BlockID.LEAVES: - case BlockID.LEAVES2: - case BlockID.BROWN_MUSHROOM_CAP: - case BlockID.RED_MUSHROOM_CAP: - case BlockID.VINE: - editSession.setBlock(blockVector, AIR); + final BlockState otherState = editSession.getBlock(blockVector); + if (isTreeBlock(otherState.getBlockType())) { + editSession.setBlock(blockVector, BlockTypes.AIR.getDefaultState()); } } } catch (MaxChangedBlocksException e) { @@ -101,13 +100,13 @@ public class FloatingTreeRemover implements BlockTool { return true; } - Vector[] recurseDirections = { - PlayerDirection.NORTH.vector(), - PlayerDirection.EAST.vector(), - PlayerDirection.SOUTH.vector(), - PlayerDirection.WEST.vector(), - PlayerDirection.UP.vector(), - PlayerDirection.DOWN.vector(), + private Vector[] recurseDirections = { + Direction.NORTH.toVector(), + Direction.EAST.toVector(), + Direction.SOUTH.toVector(), + Direction.WEST.toVector(), + Direction.UP.toVector(), + Direction.DOWN.toVector(), }; /** @@ -118,8 +117,8 @@ public class FloatingTreeRemover implements BlockTool { * @return a set containing all blocks in the tree/shroom or null if this is not a floating tree/shroom. */ private Set bfs(World world, Vector origin) throws MaxChangedBlocksException { - final Set visited = new HashSet(); - final LinkedList queue = new LinkedList(); + final Set visited = new HashSet<>(); + final LinkedList queue = new LinkedList<>(); queue.addLast(origin); visited.add(origin); @@ -134,39 +133,24 @@ public class FloatingTreeRemover implements BlockTool { } if (visited.add(next)) { - switch (world.getBlockType(next)) { - case BlockID.AIR: - case BlockID.SNOW: - // we hit air or snow => stop walking this route + BlockState state = world.getBlock(next); + if (state.getBlockType() == BlockTypes.AIR || state.getBlockType() == BlockTypes.SNOW) { continue; - - case BlockID.LOG: - case BlockID.LOG2: - case BlockID.LEAVES: - case BlockID.LEAVES2: - case BlockID.BROWN_MUSHROOM_CAP: - case BlockID.RED_MUSHROOM_CAP: - case BlockID.VINE: - // queue next point + } + if (isTreeBlock(state.getBlockType())) { queue.addLast(next); - break; - - default: + } else { // we hit something solid - evaluate where we came from - final int curId = world.getBlockType(current); - if (curId == BlockID.LEAVES || curId == BlockID.LEAVES2 - || curId == BlockID.VINE) { - // leaves touching a wall/the ground => stop walking this route - continue; - } else { + final BlockType currentType = world.getBlock(current).getBlockType(); + if (!BlockCategories.LEAVES.contains(currentType) && currentType != BlockTypes.VINE) { // log/shroom touching a wall/the ground => this is not a floating tree, bail out return null; } - } // switch - } // if - } // for - } // while + } + } + } + } return visited; - } // bfs + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java index 3d484b18e..3d178cb9c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java @@ -19,14 +19,20 @@ package com.sk89q.worldedit.command.tool; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.MaxChangedBlocksException; +import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.patterns.Pattern; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.HashSet; import java.util.Set; @@ -53,21 +59,21 @@ public class FloodFillTool implements BlockTool { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { World world = (World) clicked.getExtent(); - int initialType = world.getBlockType(clicked.toVector()); + BlockType initialType = world.getBlock(clicked.toVector()).getBlockType(); - if (initialType == BlockID.AIR) { + if (initialType == BlockTypes.AIR) { return true; } - if (initialType == BlockID.BEDROCK && !player.canDestroyBedrock()) { + if (initialType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) { return true; } EditSession editSession = session.createEditSession(player); try { - recurse(server, editSession, world, clicked.toVector().toBlockVector(), - clicked.toVector(), range, initialType, new HashSet()); + recurse(editSession, clicked.toVector().toBlockVector(), + clicked.toVector(), range, initialType, new HashSet<>()); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { @@ -77,7 +83,7 @@ public class FloodFillTool implements BlockTool { return true; } - private void recurse(Platform server, EditSession editSession, World world, BlockVector pos, Vector origin, int size, int initialType, + private void recurse(EditSession editSession, BlockVector pos, Vector origin, int size, BlockType initialType, Set visited) throws MaxChangedBlocksException { if (origin.distance(pos) > size || visited.contains(pos)) { @@ -86,23 +92,23 @@ public class FloodFillTool implements BlockTool { visited.add(pos); - if (editSession.getBlock(pos).getType() == initialType) { - editSession.setBlock(pos, pattern.next(pos)); + if (editSession.getBlock(pos).getBlockType() == initialType) { + editSession.setBlock(pos, pattern.apply(pos)); } else { return; } - recurse(server, editSession, world, pos.add(1, 0, 0).toBlockVector(), + recurse(editSession, pos.add(1, 0, 0).toBlockVector(), origin, size, initialType, visited); - recurse(server, editSession, world, pos.add(-1, 0, 0).toBlockVector(), + recurse(editSession, pos.add(-1, 0, 0).toBlockVector(), origin, size, initialType, visited); - recurse(server, editSession, world, pos.add(0, 0, 1).toBlockVector(), + recurse(editSession, pos.add(0, 0, 1).toBlockVector(), origin, size, initialType, visited); - recurse(server, editSession, world, pos.add(0, 0, -1).toBlockVector(), + recurse(editSession, pos.add(0, 0, -1).toBlockVector(), origin, size, initialType, visited); - recurse(server, editSession, world, pos.add(0, 1, 0).toBlockVector(), + recurse(editSession, pos.add(0, 1, 0).toBlockVector(), origin, size, initialType, visited); - recurse(server, editSession, world, pos.add(0, -1, 0).toBlockVector(), + recurse(editSession, pos.add(0, -1, 0).toBlockVector(), origin, size, initialType, visited); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/InvalidToolBindException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/InvalidToolBindException.java index 5f192d320..7bda56799 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/InvalidToolBindException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/InvalidToolBindException.java @@ -20,18 +20,19 @@ package com.sk89q.worldedit.command.tool; import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.world.item.ItemType; public class InvalidToolBindException extends WorldEditException { - private int itemId; + private ItemType item; - public InvalidToolBindException(int itemId, String msg) { + public InvalidToolBindException(ItemType item, String msg) { super(msg); - this.itemId = itemId; + this.item = item; } - public int getItemId() { - return itemId; + public ItemType getItemType() { + return this.item; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java index 974c893e6..908ec5325 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java @@ -19,22 +19,26 @@ package com.sk89q.worldedit.command.tool; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; /** * A tool that can place (or remove) blocks at a distance. */ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTool { - BaseBlock primary; - BaseBlock secondary; + private BlockStateHolder primary; + private BlockStateHolder secondary; - public LongRangeBuildTool(BaseBlock primary, BaseBlock secondary) { + public LongRangeBuildTool(BlockStateHolder primary, BlockStateHolder secondary) { super("worldedit.tool.lrbuild"); this.primary = primary; this.secondary = secondary; @@ -47,14 +51,14 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo @Override public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) { - WorldVectorFace pos = getTargetFace(player); + Location pos = getTargetFace(player); if (pos == null) return false; EditSession eS = session.createEditSession(player); try { - if (secondary.getType() == BlockID.AIR) { - eS.setBlock(pos, secondary); + if (secondary.getBlockType() == BlockTypes.AIR) { + eS.setBlock(pos.toVector(), secondary); } else { - eS.setBlock(pos.getFaceVector(), secondary); + eS.setBlock(pos.getDirection(), secondary); } return true; } catch (MaxChangedBlocksException e) { @@ -66,14 +70,14 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo @Override public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) { - WorldVectorFace pos = getTargetFace(player); + Location pos = getTargetFace(player); if (pos == null) return false; EditSession eS = session.createEditSession(player); try { - if (primary.getType() == BlockID.AIR) { - eS.setBlock(pos, primary); + if (primary.getBlockType() == BlockTypes.AIR) { + eS.setBlock(pos.toVector(), primary); } else { - eS.setBlock(pos.getFaceVector(), primary); + eS.setBlock(pos.getDirection(), primary); } return true; } catch (MaxChangedBlocksException e) { @@ -82,9 +86,8 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo return false; } - public WorldVectorFace getTargetFace(Player player) { - WorldVectorFace target = null; - target = player.getBlockTraceFace(getRange(), true); + public Location getTargetFace(Player player) { + Location target = player.getBlockTraceFace(getRange(), true); if (target == null) { player.printError("No block in sight!"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java index 19a37aa40..1ad0441a4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java @@ -22,22 +22,12 @@ package com.sk89q.worldedit.command.tool; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; -import com.sk89q.worldedit.blocks.BlockType; -import com.sk89q.worldedit.blocks.ClothColor; import com.sk89q.worldedit.blocks.MobSpawnerBlock; -import com.sk89q.worldedit.blocks.NoteBlock; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.world.World; -import com.sk89q.worldedit.world.registry.BundledBlockData; -import com.sk89q.worldedit.world.registry.State; -import com.sk89q.worldedit.world.registry.StateValue; - -import java.util.Map; -import java.util.Map.Entry; +import com.sk89q.worldedit.world.block.BlockStateHolder; /** * Looks up information about a block. @@ -54,49 +44,19 @@ public class QueryTool implements BlockTool { World world = (World) clicked.getExtent(); EditSession editSession = session.createEditSession(player); - BaseBlock block = (editSession).rawGetBlock(clicked.toVector()); - BlockType type = BlockType.fromID(block.getType()); + BlockStateHolder block = editSession.getFullBlock(clicked.toVector()); player.print("\u00A79@" + clicked.toVector() + ": " + "\u00A7e" - + "#" + block.getType() + "\u00A77" + " (" - + (type == null ? "Unknown" : type.getName()) + ") " + + block.getBlockType().getName() + "\u00A77" + " (" + + block.toString() + ") " + "\u00A7f" - + "[" + block.getData() + "]" + " (" + world.getBlockLightLevel(clicked.toVector()) + "/" + world.getBlockLightLevel(clicked.toVector().add(0, 1, 0)) + ")"); + + " (" + world.getBlockLightLevel(clicked.toVector()) + "/" + world.getBlockLightLevel(clicked.toVector().add(0, 1, 0)) + ")"); if (block instanceof MobSpawnerBlock) { player.printRaw("\u00A7e" + "Mob Type: " + ((MobSpawnerBlock) block).getMobType()); - } else if (block instanceof NoteBlock) { - player.printRaw("\u00A7e" + "Note block: " - + ((NoteBlock) block).getNote()); - } else if (block.getType() == BlockID.CLOTH) { - // Should never be null - player.printRaw("\u00A7e" + "Color: " - + ClothColor.fromID(block.getData()).getName()); } - Map states = BundledBlockData.getInstance().getStatesById(block.getId()); - if (states == null || states.isEmpty()) return true; - StringBuilder builder = new StringBuilder(); - builder.append("States: "); - boolean first = true; - for (Entry e : states.entrySet()) { - String name = e.getKey(); - State state = e.getValue(); - if (!first) { - builder.append(", "); - } - first = false; - String valName = ""; - for (Entry entry : state.valueMap().entrySet()) { - if (entry.getValue().isSet(block)) { - valName = entry.getKey(); - } - } - builder.append("\u00A79").append(name).append(": \u00A7f").append(valName != null ? valName : "set"); - } - player.printRaw(builder.toString()); - return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java index 7a8589b4c..f513cb075 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java @@ -19,13 +19,18 @@ package com.sk89q.worldedit.command.tool; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.MaxChangedBlocksException; +import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.HashSet; import java.util.Set; @@ -36,7 +41,6 @@ import java.util.Set; */ public class RecursivePickaxe implements BlockTool { - private static final BaseBlock air = new BaseBlock(0); private double range; public RecursivePickaxe(double range) { @@ -52,13 +56,13 @@ public class RecursivePickaxe implements BlockTool { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { World world = (World) clicked.getExtent(); - int initialType = world.getBlockType(clicked.toVector()); + BlockType initialType = world.getBlock(clicked.toVector()).getBlockType(); - if (initialType == BlockID.AIR) { + if (initialType == BlockTypes.AIR) { return true; } - if (initialType == BlockID.BEDROCK && !player.canDestroyBedrock()) { + if (initialType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) { return true; } @@ -67,7 +71,7 @@ public class RecursivePickaxe implements BlockTool { try { recurse(server, editSession, world, clicked.toVector().toBlockVector(), - clicked.toVector(), range, initialType, new HashSet()); + clicked.toVector(), range, initialType, new HashSet<>()); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { @@ -79,7 +83,7 @@ public class RecursivePickaxe implements BlockTool { } private static void recurse(Platform server, EditSession editSession, World world, BlockVector pos, - Vector origin, double size, int initialType, Set visited) throws MaxChangedBlocksException { + Vector origin, double size, BlockType initialType, Set visited) throws MaxChangedBlocksException { final double distanceSq = origin.distanceSq(pos); if (distanceSq > size*size || visited.contains(pos)) { @@ -88,13 +92,13 @@ public class RecursivePickaxe implements BlockTool { visited.add(pos); - if (editSession.getBlock(pos).getType() != initialType) { + if (editSession.getBlock(pos).getBlockType() != initialType) { return; } world.queueBlockBreakEffect(server, pos, initialType, distanceSq); - editSession.setBlock(pos, air); + editSession.setBlock(pos, BlockTypes.AIR.getDefaultState()); recurse(server, editSession, world, pos.add(1, 0, 0).toBlockVector(), origin, size, initialType, visited); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java index 246a6f633..f3f4c9945 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java @@ -23,12 +23,12 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; /** * A super pickaxe mode that removes one block. @@ -43,8 +43,8 @@ public class SinglePickaxe implements BlockTool { @Override public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { World world = (World) clicked.getExtent(); - final int blockType = world.getBlockType(clicked.toVector()); - if (blockType == BlockID.BEDROCK + final BlockType blockType = world.getBlock(clicked.toVector()).getBlockType(); + if (blockType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) { return true; } @@ -53,14 +53,14 @@ public class SinglePickaxe implements BlockTool { editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop); try { - editSession.setBlock(clicked.toVector(), new BaseBlock(BlockID.AIR)); + editSession.setBlock(clicked.toVector(), BlockTypes.AIR.getDefaultState()); } catch (MaxChangedBlocksException e) { player.printError("Max blocks change limit reached."); } finally { editSession.flushQueue(); } - world.playEffect(clicked.toVector(), 2001, blockType); + world.playEffect(clicked.toVector(), 2001, blockType.getLegacyId()); return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java index 56f4bf5ed..436d42104 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java @@ -19,22 +19,25 @@ package com.sk89q.worldedit.command.tool; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.util.*; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.util.TreeGenerator; /** * Plants a tree. */ public class TreePlanter implements BlockTool { - private TreeGenerator gen; + private TreeGenerator.TreeType treeType; - public TreePlanter(TreeGenerator gen) { - this.gen = gen; + public TreePlanter(TreeGenerator.TreeType treeType) { + this.treeType = treeType; } @Override @@ -51,7 +54,7 @@ public class TreePlanter implements BlockTool { boolean successful = false; for (int i = 0; i < 10; i++) { - if (gen.generate(editSession, clicked.toVector().add(0, 1, 0))) { + if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0))) { successful = true; break; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java index b949d6b0e..175cc32ae 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java @@ -43,7 +43,7 @@ public class ButcherBrush implements Brush { public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { CylinderRegion region = CylinderRegion.createRadius(editSession, position, size); List entities = editSession.getEntities(region); - Operations.completeLegacy(new EntityVisitor(entities.iterator(), flags.createFunction(editSession.getWorld().getWorldData().getEntityRegistry()))); + Operations.completeLegacy(new EntityVisitor(entities.iterator(), flags.createFunction())); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java index 4417d1a35..184480787 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java @@ -48,7 +48,7 @@ public class ClipboardBrush implements Brush { Vector centerOffset = region.getCenter().subtract(clipboard.getOrigin()); Operation operation = holder - .createPaste(editSession, editSession.getWorld().getWorldData()) + .createPaste(editSession) .to(usingOrigin ? position : position.subtract(centerOffset)) .ignoreAirBlocks(ignoreAirBlocks) .build(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java index 2df64da79..10db344ca 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java @@ -22,11 +22,9 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; +import com.sk89q.worldedit.world.block.BlockTypes; public class CylinderBrush implements Brush { @@ -39,9 +37,9 @@ public class CylinderBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { - pattern = new BlockPattern(new BaseBlock(BlockID.COBBLESTONE)); + pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } - editSession.makeCylinder(position, Patterns.wrap(pattern), size, size, height, true); + editSession.makeCylinder(position, pattern, size, size, height, true); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java index 8331b7620..c452e7d7e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java @@ -22,11 +22,13 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; public class GravityBrush implements Brush { @@ -38,24 +40,23 @@ public class GravityBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { - final BaseBlock air = new BaseBlock(BlockID.AIR, 0); final double startY = fullHeight ? editSession.getWorld().getMaxY() : position.getBlockY() + size; for (double x = position.getBlockX() + size; x > position.getBlockX() - size; --x) { for (double z = position.getBlockZ() + size; z > position.getBlockZ() - size; --z) { double y = startY; - final List blockTypes = new ArrayList(); + final List blockTypes = new ArrayList<>(); for (; y > position.getBlockY() - size; --y) { final Vector pt = new Vector(x, y, z); - final BaseBlock block = editSession.getBlock(pt); - if (!block.isAir()) { + final BlockStateHolder block = editSession.getBlock(pt); + if (block.getBlockType() != BlockTypes.AIR) { blockTypes.add(block); - editSession.setBlock(pt, air); + editSession.setBlock(pt, BlockTypes.AIR.getDefaultState()); } } Vector pt = new Vector(x, y, z); Collections.reverse(blockTypes); for (int i = 0; i < blockTypes.size();) { - if (editSession.getBlock(pt).getType() == BlockID.AIR) { + if (editSession.getBlock(pt).getBlockType() == BlockTypes.AIR) { editSession.setBlock(pt, blockTypes.get(i++)); } pt = pt.add(0, 1, 0); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java index 0f468d666..3f9eb06c7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java @@ -22,11 +22,9 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; +import com.sk89q.worldedit.world.block.BlockTypes; public class HollowCylinderBrush implements Brush { @@ -39,9 +37,9 @@ public class HollowCylinderBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { - pattern = new BlockPattern(new BaseBlock(BlockID.COBBLESTONE)); + pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } - editSession.makeCylinder(position, Patterns.wrap(pattern), size, size, height, false); + editSession.makeCylinder(position, pattern, size, size, height, false); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java index 14813fd99..7980ec744 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java @@ -22,19 +22,17 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; +import com.sk89q.worldedit.world.block.BlockTypes; public class HollowSphereBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { - pattern = new BlockPattern(new BaseBlock(BlockID.COBBLESTONE)); + pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } - editSession.makeSphere(position, Patterns.wrap(pattern), size, size, size, false); + editSession.makeSphere(position, pattern, size, size, size, false); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java index 756f575d4..df76950d4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java @@ -20,37 +20,30 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.internal.LocalWorldAdapter; -import com.sk89q.worldedit.math.convolution.HeightMap; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.WorldVector; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.convolution.GaussianKernel; +import com.sk89q.worldedit.math.convolution.HeightMap; import com.sk89q.worldedit.math.convolution.HeightMapFilter; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.util.Location; public class SmoothBrush implements Brush { private int iterations; - private boolean naturalOnly; public SmoothBrush(int iterations) { - this(iterations, false); - } - - public SmoothBrush(int iterations, boolean naturalOnly) { this.iterations = iterations; - this.naturalOnly = naturalOnly; } @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { - WorldVector min = new WorldVector(LocalWorldAdapter.adapt(editSession.getWorld()), position.subtract(size, size, size)); + Location min = new Location(editSession.getWorld(), position.subtract(size, size, size)); Vector max = position.add(size, size + 10, size); - Region region = new CuboidRegion(editSession.getWorld(), min, max); - HeightMap heightMap = new HeightMap(editSession, region, naturalOnly); + Region region = new CuboidRegion(editSession.getWorld(), min.toVector(), max); + HeightMap heightMap = new HeightMap(editSession, region); HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0)); heightMap.applyFilter(filter, iterations); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java index 6c783a0da..ba4b3eaf2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java @@ -22,19 +22,17 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.Patterns; +import com.sk89q.worldedit.world.block.BlockTypes; public class SphereBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { - pattern = new BlockPattern(new BaseBlock(BlockID.COBBLESTONE)); + pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } - editSession.makeSphere(position, Patterns.wrap(pattern), size, size, size, true); + editSession.makeSphere(position, pattern, size, size, size, true); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/CreatureButcher.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/CreatureButcher.java index 7623d338e..94c7d5ad2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/CreatureButcher.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/CreatureButcher.java @@ -20,12 +20,9 @@ package com.sk89q.worldedit.command.util; import com.sk89q.minecraft.util.commands.CommandContext; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.entity.Entity; -import com.sk89q.worldedit.entity.metadata.EntityType; +import com.sk89q.worldedit.entity.metadata.EntityProperties; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.function.EntityFunction; -import com.sk89q.worldedit.world.registry.EntityRegistry; /** * The implementation of /butcher. @@ -80,63 +77,60 @@ public class CreatureButcher { or(Flags.WITH_LIGHTNING, args.hasFlag('l'), "worldedit.butcher.lightning"); } - public EntityFunction createFunction(final EntityRegistry entityRegistry) { - return new EntityFunction() { - @Override - public boolean apply(Entity entity) throws WorldEditException { - boolean killPets = (flags & Flags.PETS) != 0; - boolean killNPCs = (flags & Flags.NPCS) != 0; - boolean killAnimals = (flags & Flags.ANIMALS) != 0; - boolean killGolems = (flags & Flags.GOLEMS) != 0; - boolean killAmbient = (flags & Flags.AMBIENT) != 0; - boolean killTagged = (flags & Flags.TAGGED) != 0; - boolean killArmorStands = (flags & Flags.ARMOR_STAND) != 0; + public EntityFunction createFunction() { + return entity -> { + boolean killPets = (flags & Flags.PETS) != 0; + boolean killNPCs = (flags & Flags.NPCS) != 0; + boolean killAnimals = (flags & Flags.ANIMALS) != 0; + boolean killGolems = (flags & Flags.GOLEMS) != 0; + boolean killAmbient = (flags & Flags.AMBIENT) != 0; + boolean killTagged = (flags & Flags.TAGGED) != 0; + boolean killArmorStands = (flags & Flags.ARMOR_STAND) != 0; - EntityType type = entity.getFacet(EntityType.class); + EntityProperties type = entity.getFacet(EntityProperties.class); - if (type == null) { - return false; - } - - if (type.isPlayerDerived()) { - return false; - } - - if (!type.isLiving()) { - return false; - } - - if (!killAnimals && type.isAnimal()) { - return false; - } - - if (!killPets && type.isTamed()) { - return false; - } - - if (!killGolems && type.isGolem()) { - return false; - } - - if (!killNPCs && type.isNPC()) { - return false; - } - - if (!killAmbient && type.isAmbient()) { - return false; - } - - if (!killTagged && type.isTagged()) { - return false; - } - - if (!killArmorStands && type.isArmorStand()) { - return false; - } - - entity.remove(); - return true; + if (type == null) { + return false; } + + if (type.isPlayerDerived()) { + return false; + } + + if (!type.isLiving()) { + return false; + } + + if (!killAnimals && type.isAnimal()) { + return false; + } + + if (!killPets && type.isTamed()) { + return false; + } + + if (!killGolems && type.isGolem()) { + return false; + } + + if (!killNPCs && type.isNPC()) { + return false; + } + + if (!killAmbient && type.isAmbient()) { + return false; + } + + if (!killTagged && type.isTagged()) { + return false; + } + + if (!killArmorStands && type.isArmorStand()) { + return false; + } + + entity.remove(); + return true; }; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java index b6459b186..cac57b0dc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java @@ -19,17 +19,15 @@ package com.sk89q.worldedit.command.util; -import com.sk89q.minecraft.util.commands.CommandException; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.entity.Entity; -import com.sk89q.worldedit.entity.metadata.EntityType; -import com.sk89q.worldedit.function.EntityFunction; -import com.sk89q.worldedit.world.registry.EntityRegistry; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.minecraft.util.commands.CommandException; +import com.sk89q.worldedit.entity.metadata.EntityProperties; +import com.sk89q.worldedit.function.EntityFunction; -import javax.annotation.Nullable; import java.util.regex.Pattern; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * The implementation of /remove. @@ -39,7 +37,7 @@ public class EntityRemover { public enum Type { ALL("all") { @Override - boolean matches(EntityType type) { + boolean matches(EntityProperties type) { for (Type value : values()) { if (value != this && value.matches(type)) { return true; @@ -50,55 +48,55 @@ public class EntityRemover { }, PROJECTILES("projectiles?|arrows?") { @Override - boolean matches(EntityType type) { + boolean matches(EntityProperties type) { return type.isProjectile(); } }, ITEMS("items?|drops?") { @Override - boolean matches(EntityType type) { + boolean matches(EntityProperties type) { return type.isItem(); } }, FALLING_BLOCKS("falling(blocks?|sand|gravel)") { @Override - boolean matches(EntityType type) { + boolean matches(EntityProperties type) { return type.isFallingBlock(); } }, PAINTINGS("paintings?|art") { @Override - boolean matches(EntityType type) { + boolean matches(EntityProperties type) { return type.isPainting(); } }, ITEM_FRAMES("(item)frames?") { @Override - boolean matches(EntityType type) { + boolean matches(EntityProperties type) { return type.isItemFrame(); } }, BOATS("boats?") { @Override - boolean matches(EntityType type) { + boolean matches(EntityProperties type) { return type.isBoat(); } }, MINECARTS("(mine)?carts?") { @Override - boolean matches(EntityType type) { + boolean matches(EntityProperties type) { return type.isMinecart(); } }, TNT("tnt") { @Override - boolean matches(EntityType type) { + boolean matches(EntityProperties type) { return type.isTNT(); } }, XP_ORBS("xp") { @Override - boolean matches(EntityType type) { + boolean matches(EntityProperties type) { return type.isExperienceOrb(); } }; @@ -113,7 +111,7 @@ public class EntityRemover { return pattern.matcher(str).matches(); } - abstract boolean matches(EntityType type); + abstract boolean matches(EntityProperties type); @Nullable public static Type findByPattern(String str) { @@ -138,22 +136,19 @@ public class EntityRemover { } } - public EntityFunction createFunction(final EntityRegistry entityRegistry) { + public EntityFunction createFunction() { final Type type = this.type; - checkNotNull("type can't be null", type); - return new EntityFunction() { - @Override - public boolean apply(Entity entity) throws WorldEditException { - EntityType registryType = entity.getFacet(EntityType.class); - if (registryType != null) { - if (type.matches(registryType)) { - entity.remove(); - return true; - } + checkNotNull(type, "type can't be null"); + return entity -> { + EntityProperties registryType = entity.getFacet(EntityProperties.class); + if (registryType != null) { + if (type.matches(registryType)) { + entity.remove(); + return true; } - - return false; } + + return false; }; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java index 4b8237400..456acaa3d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java @@ -19,13 +19,14 @@ package com.sk89q.worldedit.entity; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.world.NbtValued; +import com.sk89q.worldedit.world.entity.EntityType; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Represents a mutable "snapshot" of an entity. * @@ -41,27 +42,27 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class BaseEntity implements NbtValued { - private String id; + private EntityType type; private CompoundTag nbtData; /** * Create a new base entity. * - * @param id the entity type ID + * @param type the entity type * @param nbtData NBT data */ - public BaseEntity(String id, CompoundTag nbtData) { - setTypeId(id); + public BaseEntity(EntityType type, CompoundTag nbtData) { + this(type); setNbtData(nbtData); } /** * Create a new base entity with no NBT data. * - * @param id the entity type ID + * @param type the entity type */ - public BaseEntity(String id) { - setTypeId(id); + public BaseEntity(EntityType type) { + this.type = type; } /** @@ -71,7 +72,7 @@ public class BaseEntity implements NbtValued { */ public BaseEntity(BaseEntity other) { checkNotNull(other); - setTypeId(other.getTypeId()); + this.type = other.getType(); setNbtData(other.getNbtData()); } @@ -92,22 +93,12 @@ public class BaseEntity implements NbtValued { } /** - * Get the entity that determines the type of entity. + * Get the type of entity. * - * @return the entity ID + * @return the entity type */ - public String getTypeId() { - return id; - } - - /** - * Set the entity ID that determines the type of entity. - * - * @param id the id - */ - public void setTypeId(String id) { - checkNotNull(id); - this.id = id; + public EntityType getType() { + return this.type; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java index ebb2e24f8..b803e93f5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java @@ -22,12 +22,14 @@ package com.sk89q.worldedit.entity; import com.sk89q.worldedit.PlayerDirection; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.WorldVector; -import com.sk89q.worldedit.WorldVectorFace; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.inventory.BlockBag; +import com.sk89q.worldedit.util.HandSide; +import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.gamemode.GameMode; /** * Represents a player @@ -57,26 +59,25 @@ public interface Player extends Entity, Actor { PlayerDirection getCardinalDirection(int yawOffset); /** - * Get the ID of the item that the player is holding. + * Get the item that the player is holding. * - * @return the item id of the item the player is holding + * @return the item the player is holding */ - int getItemInHand(); + BaseItemStack getItemInHand(HandSide handSide); /** * Get the Block that the player is holding. * * @return the item id of the item the player is holding */ - BaseBlock getBlockInHand() throws WorldEditException; + BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException; /** * Gives the player an item. * - * @param type The item id of the item to be given to the player - * @param amount How many items in the stack + * @param itemStack The item to give */ - void giveItem(int type, int amount); + void giveItem(BaseItemStack itemStack); /** * Get this actor's block bag. @@ -86,11 +87,18 @@ public interface Player extends Entity, Actor { BlockBag getInventoryBlockBag(); /** - * Return whether this actor has creative mode. + * Return this actor's game mode. * - * @return true if creative mode is enabled + * @return the game mode */ - boolean hasCreativeMode(); + GameMode getGameMode(); + + /** + * Sets the player to the given game mode. + * + * @param gameMode The game mode + */ + void setGameMode(GameMode gameMode); /** * Find a position for the actor to stand that is not inside a block. @@ -100,14 +108,14 @@ public interface Player extends Entity, Actor { * * @param searchPos search position */ - void findFreePosition(WorldVector searchPos); + void findFreePosition(Location searchPos); /** * Set the actor on the ground. * * @param searchPos The location to start searching from */ - void setOnGround(WorldVector searchPos); + void setOnGround(Location searchPos); /** * Find a position for the player to stand that is not inside a block. @@ -179,14 +187,14 @@ public interface Player extends Entity, Actor { * * @return point */ - WorldVector getBlockIn(); + Location getBlockIn(); /** * Get the point of the block that is being stood upon. * * @return point */ - WorldVector getBlockOn(); + Location getBlockOn(); /** * Get the point of the block being looked at. May return null. @@ -196,7 +204,7 @@ public interface Player extends Entity, Actor { * @param useLastBlock try to return the last valid air block found * @return point */ - WorldVector getBlockTrace(int range, boolean useLastBlock); + Location getBlockTrace(int range, boolean useLastBlock); /** * Get the face that the player is looking at. @@ -205,7 +213,7 @@ public interface Player extends Entity, Actor { * @param useLastBlock try to return the last valid air block found * @return a face */ - WorldVectorFace getBlockTraceFace(int range, boolean useLastBlock); + Location getBlockTraceFace(int range, boolean useLastBlock); /** * Get the point of the block being looked at. May return null. @@ -213,7 +221,7 @@ public interface Player extends Entity, Actor { * @param range How far to checks for blocks * @return point */ - WorldVector getBlockTrace(int range); + Location getBlockTrace(int range); /** * Get the point of the block being looked at. May return null. @@ -221,7 +229,7 @@ public interface Player extends Entity, Actor { * @param range How far to checks for blocks * @return point */ - WorldVector getSolidBlockTrace(int range); + Location getSolidBlockTrace(int range); /** * Get the player's cardinal direction (N, W, NW, etc.). May return null. @@ -230,35 +238,6 @@ public interface Player extends Entity, Actor { */ PlayerDirection getCardinalDirection(); - /** - * Get the actor's position. - * - *

If the actor has no permission, then a dummy location is returned.

- * - * @return the actor's position - * @deprecated use {@link #getLocation()} - */ - @Deprecated - WorldVector getPosition(); - - /** - * Get the player's view pitch in degrees. - * - * @return pitch - * @deprecated use {@link #getLocation()} - */ - @Deprecated - double getPitch(); - - /** - * Get the player's view yaw in degrees. - * - * @return yaw - * @deprecated use {@link #getLocation()} - */ - @Deprecated - double getYaw(); - /** * Pass through the wall that you are looking at. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/metadata/EntityType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/metadata/EntityProperties.java similarity index 95% rename from worldedit-core/src/main/java/com/sk89q/worldedit/entity/metadata/EntityType.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/entity/metadata/EntityProperties.java index f13cfd808..6e343ba84 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/metadata/EntityType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/metadata/EntityProperties.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.entity.metadata; /** * Describes various classes of entities. */ -public interface EntityType { +public interface EntityProperties { /** * Test whether the entity is a player-derived entity. @@ -154,4 +154,11 @@ public interface EntityType { * @return true if an armor stand */ boolean isArmorStand(); + + /** + * Test whether this entity can be pasted. + * + * @return true if pasteable + */ + boolean isPasteable(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java index f90642d07..d1bf6a238 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java @@ -19,19 +19,19 @@ package com.sk89q.worldedit.event.extent; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.EditSession.Stage; + import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.event.Event; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockStateHolder; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.EditSession.Stage; - /** * Raised (several times) when a new {@link EditSession} is being instantiated. * @@ -53,7 +53,7 @@ import static com.sk89q.worldedit.EditSession.Stage; * is set to {@link Stage#BEFORE_HISTORY}, then you can drop (or log) changes * before the change has reached the history, reordering, and actual change * extents, but that means that any changes made with - * {@link EditSession#rawSetBlock(Vector, BaseBlock)} will skip your + * {@link EditSession#rawSetBlock(Vector, BlockStateHolder)} will skip your * custom {@link Extent} because that method bypasses history (and reorder). * It is thus recommended that loggers intercept at {@link Stage#BEFORE_CHANGE} * and block interceptors intercept at BOTH {@link Stage#BEFORE_CHANGE} and diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/BlockInteractEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/BlockInteractEvent.java index 2fdb4e443..7549518ad 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/BlockInteractEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/BlockInteractEvent.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.event.platform; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.event.Cancellable; import com.sk89q.worldedit.event.Event; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.util.Location; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Called when a block is interacted with. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandEvent.java index 0790787f4..6d3791b86 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandEvent.java @@ -19,11 +19,11 @@ package com.sk89q.worldedit.event.platform; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.event.AbstractCancellable; import com.sk89q.worldedit.extension.platform.Actor; -import static com.google.common.base.Preconditions.checkNotNull; - /** * This class is currently only for internal use. Do not post or catch this event. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandSuggestionEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandSuggestionEvent.java index 8fa39c0ff..75483745e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandSuggestionEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandSuggestionEvent.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.event.platform; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.event.Event; import com.sk89q.worldedit.extension.platform.Actor; import java.util.Collections; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Posted when suggestions for auto-completion are requested for command input. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/ConfigurationLoadEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/ConfigurationLoadEvent.java index 73d23131c..1bfc11724 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/ConfigurationLoadEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/ConfigurationLoadEvent.java @@ -19,11 +19,11 @@ package com.sk89q.worldedit.event.platform; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.event.Event; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Raised when the configuration has been loaded or re-loaded. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/PlayerInputEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/PlayerInputEvent.java index 2bc39ee97..67ef25268 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/PlayerInputEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/PlayerInputEvent.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.event.platform; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.event.Cancellable; import com.sk89q.worldedit.event.Event; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Raised whenever a player sends input. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java index 43037ccf5..aab3504f4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java @@ -19,11 +19,13 @@ package com.sk89q.worldedit.extension.factory; +import com.sk89q.util.StringUtil; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.internal.registry.AbstractFactory; +import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.HashSet; import java.util.Set; @@ -35,7 +37,7 @@ import java.util.Set; *

Instances of this class can be taken from * {@link WorldEdit#getBlockFactory()}.

*/ -public class BlockFactory extends AbstractFactory { +public class BlockFactory extends AbstractFactory { /** * Create a new instance. @@ -56,9 +58,10 @@ public class BlockFactory extends AbstractFactory { * @return a set of blocks * @throws InputParseException thrown in error with the input */ - public Set parseFromListInput(String input, ParserContext context) throws InputParseException { - Set blocks = new HashSet(); - for (String token : input.split(",")) { + public Set parseFromListInput(String input, ParserContext context) throws InputParseException { + Set blocks = new HashSet<>(); + String[] splits = input.split(","); + for (String token : StringUtil.parseListInQuotes(splits, ',', '[', ']')) { blocks.add(parseFromInput(token, context)); } return blocks; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java index cda4c0093..510656828 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java @@ -19,8 +19,15 @@ package com.sk89q.worldedit.extension.factory; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.*; +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.IncompleteRegionException; +import com.sk89q.worldedit.NotABlockException; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.blocks.MobSpawnerBlock; +import com.sk89q.worldedit.blocks.SignBlock; +import com.sk89q.worldedit.blocks.SkullBlock; import com.sk89q.worldedit.blocks.metadata.MobType; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.input.DisallowedUsageException; @@ -28,22 +35,33 @@ import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; + +import java.util.HashMap; +import java.util.Map; /** * Parses block input strings. */ -class DefaultBlockParser extends InputParser { +class DefaultBlockParser extends InputParser { protected DefaultBlockParser(WorldEdit worldEdit) { super(worldEdit); } - private static BaseBlock getBlockInHand(Actor actor) throws InputParseException { + private static BaseBlock getBlockInHand(Actor actor, HandSide handSide) throws InputParseException { if (actor instanceof Player) { try { - return ((Player) actor).getBlockInHand(); + return ((Player) actor).getBlockInHand(handSide); } catch (NotABlockException e) { throw new InputParseException("You're not holding a block!"); } catch (WorldEditException e) { @@ -55,17 +73,13 @@ class DefaultBlockParser extends InputParser { } @Override - public BaseBlock parseFromInput(String input, ParserContext context) + public BlockStateHolder parseFromInput(String input, ParserContext context) throws InputParseException { - // TODO: Rewrite this entire method to use BaseBlocks and ignore - // BlockType, as well as to properly handle mod:name IDs - String originalInput = input; - input = input.replace("_", " "); input = input.replace(";", "|"); Exception suppressed = null; try { - BaseBlock modified = parseLogic(input, context); + BlockStateHolder modified = parseLogic(input, context); if (modified != null) { return modified; } @@ -82,278 +96,232 @@ class DefaultBlockParser extends InputParser { } } - private BaseBlock parseLogic(String input, ParserContext context) - throws InputParseException, NoMatchException, - DisallowedUsageException { - BlockType blockType; - String[] blockAndExtraData = input.split("\\|"); - String[] blockLocator = blockAndExtraData[0].split(":", 3); - String[] typeAndData; - switch (blockLocator.length) { - case 3: - typeAndData = new String[] { - blockLocator[0] + ":" + blockLocator[1], - blockLocator[2] }; - break; + private static String[] EMPTY_STRING_ARRAY = new String[]{}; + + /** + * Backwards compatibility for wool colours in block syntax. + * + * @param string Input string + * @return Mapped string + */ + private String woolMapper(String string) { + switch (string.toLowerCase()) { + case "white": + return BlockTypes.WHITE_WOOL.getId(); + case "black": + return BlockTypes.BLACK_WOOL.getId(); + case "blue": + return BlockTypes.BLUE_WOOL.getId(); + case "brown": + return BlockTypes.BROWN_WOOL.getId(); + case "cyan": + return BlockTypes.CYAN_WOOL.getId(); + case "gray": + case "grey": + return BlockTypes.GRAY_WOOL.getId(); + case "green": + return BlockTypes.GREEN_WOOL.getId(); + case "light_blue": + case "lightblue": + return BlockTypes.LIGHT_BLUE_WOOL.getId(); + case "light_gray": + case "light_grey": + case "lightgray": + case "lightgrey": + return BlockTypes.LIGHT_GRAY_WOOL.getId(); + case "lime": + return BlockTypes.LIME_WOOL.getId(); + case "magenta": + return BlockTypes.MAGENTA_WOOL.getId(); + case "orange": + return BlockTypes.ORANGE_WOOL.getId(); + case "pink": + return BlockTypes.PINK_WOOL.getId(); + case "purple": + return BlockTypes.PURPLE_WOOL.getId(); + case "yellow": + return BlockTypes.YELLOW_WOOL.getId(); + case "red": + return BlockTypes.RED_WOOL.getId(); default: - typeAndData = blockLocator; + return string; } - String testId = typeAndData[0]; + } - int blockId = -1; - - int data = -1; - - boolean parseDataValue = true; - - if ("hand".equalsIgnoreCase(testId)) { - // Get the block type from the item in the user's hand. - final BaseBlock blockInHand = getBlockInHand(context.requireActor()); - if (blockInHand.getClass() != BaseBlock.class) { - return blockInHand; - } - - blockId = blockInHand.getId(); - blockType = BlockType.fromID(blockId); - data = blockInHand.getData(); - } else if ("pos1".equalsIgnoreCase(testId)) { - // Get the block type from the "primary position" - final World world = context.requireWorld(); - final BlockVector primaryPosition; - try { - primaryPosition = context.requireSession().getRegionSelector(world).getPrimaryPosition(); - } catch (IncompleteRegionException e) { - throw new InputParseException("Your selection is not complete."); - } - final BaseBlock blockInHand = world.getBlock(primaryPosition); - if (blockInHand.getClass() != BaseBlock.class) { - return blockInHand; - } - - blockId = blockInHand.getId(); - blockType = BlockType.fromID(blockId); - data = blockInHand.getData(); - } else { - // Attempt to parse the item ID or otherwise resolve an item/block - // name to its numeric ID - try { - blockId = Integer.parseInt(testId); - blockType = BlockType.fromID(blockId); - } catch (NumberFormatException e) { - blockType = BlockType.lookup(testId); - if (blockType == null) { - int t = worldEdit.getServer().resolveItem(testId); - if (t >= 0) { - blockType = BlockType.fromID(t); // Could be null - blockId = t; - } else if (blockLocator.length == 2) { // Block IDs in MC 1.7 and above use mod:name - t = worldEdit.getServer().resolveItem(blockAndExtraData[0]); - if (t >= 0) { - blockType = BlockType.fromID(t); // Could be null - blockId = t; - typeAndData = new String[] { blockAndExtraData[0] }; - testId = blockAndExtraData[0]; - } - } - } - } - - if (blockId == -1 && blockType == null) { - // Maybe it's a cloth - ClothColor col = ClothColor.lookup(testId); - if (col == null) { - throw new NoMatchException("Can't figure out what block '" + input + "' refers to"); - } - - blockType = BlockType.CLOTH; - data = col.getID(); - - // Prevent overriding the data value - parseDataValue = false; - } - - // Read block ID - if (blockId == -1) { - blockId = blockType.getID(); - } - - if (!context.requireWorld().isValidBlockType(blockId)) { - throw new NoMatchException("Does not match a valid block type: '" + input + "'"); - } - } - - if (!context.isPreferringWildcard() && data == -1) { - // No wildcards allowed => eliminate them. - data = 0; - } - - if (parseDataValue) { // Block data not yet detected + private static BlockState applyProperties(BlockState state, String[] stateProperties) throws NoMatchException { + if (stateProperties.length > 0) { // Block data not yet detected // Parse the block data (optional) - try { - if (typeAndData.length > 1 && !typeAndData[1].isEmpty()) { - data = Integer.parseInt(typeAndData[1]); - } + for (String parseableData : stateProperties) { + try { + String[] parts = parseableData.split("="); + if (parts.length != 2) { + throw new NoMatchException("Bad state format in " + parseableData); + } - if (data > 15) { - throw new NoMatchException("Invalid data value '" + typeAndData[1] + "'"); - } + Property propertyKey = state.getBlockType().getPropertyMap().get(parts[0]); + if (propertyKey == null) { + throw new NoMatchException("Unknown state " + parts[0] + " for block " + state.getBlockType().getName()); + } + Object value; + try { + value = propertyKey.getValueFor(parts[1]); + } catch (IllegalArgumentException e) { + throw new NoMatchException("Unknown value " + parts[1] + " for state " + parts[0]); + } - if (data < 0 && (context.isRestricted() || data != -1)) { - data = 0; - } - } catch (NumberFormatException e) { - if (blockType == null) { - throw new NoMatchException("Unknown data value '" + typeAndData[1] + "'"); - } - - switch (blockType) { - case CLOTH: - case STAINED_CLAY: - case CARPET: - ClothColor col = ClothColor.lookup(typeAndData[1]); - if (col == null) { - throw new NoMatchException("Unknown wool color '" + typeAndData[1] + "'"); - } - - data = col.getID(); - break; - - case STEP: - case DOUBLE_STEP: - BlockType dataType = BlockType.lookup(typeAndData[1]); - - if (dataType == null) { - throw new NoMatchException("Unknown step type '" + typeAndData[1] + "'"); - } - - switch (dataType) { - case STONE: - data = 0; - break; - case SANDSTONE: - data = 1; - break; - case WOOD: - data = 2; - break; - case COBBLESTONE: - data = 3; - break; - case BRICK: - data = 4; - break; - case STONE_BRICK: - data = 5; - break; - case NETHER_BRICK: - data = 6; - break; - case QUARTZ_BLOCK: - data = 7; - break; - - default: - throw new NoMatchException("Invalid step type '" + typeAndData[1] + "'"); - } - break; - - default: - throw new NoMatchException("Unknown data value '" + typeAndData[1] + "'"); + state = state.with(propertyKey, value); + } catch (NoMatchException e) { + throw e; // Pass-through + } catch (Exception e) { + e.printStackTrace(); + throw new NoMatchException("Unknown state '" + parseableData + "'"); } } } + return state; + } + + private BlockStateHolder parseLogic(String input, ParserContext context) throws InputParseException { + BlockType blockType = null; + Map, Object> blockStates = new HashMap<>(); + String[] blockAndExtraData = input.trim().split("\\|"); + blockAndExtraData[0] = woolMapper(blockAndExtraData[0]); + + BlockState state = null; + + // Legacy matcher + if (context.isTryingLegacy()) { + try { + String[] split = blockAndExtraData[0].split(":"); + if (split.length == 1) { + state = LegacyMapper.getInstance().getBlockFromLegacy(Integer.parseInt(split[0])); + } else { + state = LegacyMapper.getInstance().getBlockFromLegacy(Integer.parseInt(split[0]), Integer.parseInt(split[1])); + } + if (state != null) { + blockType = state.getBlockType(); + } + } catch (NumberFormatException e) { + } + } + + if (state == null) { + String typeString; + String stateString = null; + int stateStart = blockAndExtraData[0].indexOf('['); + if (stateStart == -1) { + typeString = blockAndExtraData[0]; + } else { + typeString = blockAndExtraData[0].substring(0, stateStart); + stateString = blockAndExtraData[0].substring(stateStart + 1, blockAndExtraData[0].length() - 1); + } + if (typeString == null || typeString.isEmpty()) { + throw new InputParseException("Invalid format"); + } + String[] stateProperties = EMPTY_STRING_ARRAY; + if (stateString != null) { + stateProperties = stateString.split(","); + } + + if ("hand".equalsIgnoreCase(typeString)) { + // Get the block type from the item in the user's hand. + final BaseBlock blockInHand = getBlockInHand(context.requireActor(), HandSide.MAIN_HAND); + if (blockInHand.getClass() != BaseBlock.class) { + return blockInHand; + } + + blockType = blockInHand.getBlockType(); + blockStates = blockInHand.getStates(); + } else if ("offhand".equalsIgnoreCase(typeString)) { + // Get the block type from the item in the user's off hand. + final BaseBlock blockInHand = getBlockInHand(context.requireActor(), HandSide.OFF_HAND); + if (blockInHand.getClass() != BaseBlock.class) { + return blockInHand; + } + + blockType = blockInHand.getBlockType(); + blockStates = blockInHand.getStates(); + } else if ("pos1".equalsIgnoreCase(typeString)) { + // Get the block type from the "primary position" + final World world = context.requireWorld(); + final BlockVector primaryPosition; + try { + primaryPosition = context.requireSession().getRegionSelector(world).getPrimaryPosition(); + } catch (IncompleteRegionException e) { + throw new InputParseException("Your selection is not complete."); + } + final BlockState blockInHand = world.getBlock(primaryPosition); + + blockType = blockInHand.getBlockType(); + blockStates = blockInHand.getStates(); + } else { + // Attempt to lookup a block from ID or name. + blockType = BlockTypes.get(typeString.toLowerCase()); + + if (blockType == null) { + throw new NoMatchException("Does not match a valid block type: '" + input + "'"); + } + } + + if (!context.isPreferringWildcard()) { + // No wildcards allowed => eliminate them. (Start with default state) + state = blockType.getDefaultState(); + } else { + state = blockType.getDefaultState().toFuzzy(); + for (Map.Entry, Object> blockState : blockStates.entrySet()) { + state = state.with((Property) blockState.getKey(), blockState.getValue()); + } + } + + state = applyProperties(state, stateProperties); + } + // Check if the item is allowed - Actor actor = context.requireActor(); - if (context.isRestricted() && actor != null && !actor.hasPermission("worldedit.anyblock") - && worldEdit.getConfiguration().disallowedBlocks.contains(blockId)) { - throw new DisallowedUsageException("You are not allowed to use '" + input + "'"); + if (context.isRestricted()) { + Actor actor = context.requireActor(); + if (actor != null && !actor.hasPermission("worldedit.anyblock") + && worldEdit.getConfiguration().disallowedBlocks.contains(blockType.getId())) { + throw new DisallowedUsageException("You are not allowed to use '" + input + "'"); + } } - if (blockType == null) { - return new BaseBlock(blockId, data); - } - - switch (blockType) { - case SIGN_POST: - case WALL_SIGN: - // Allow special sign text syntax - String[] text = new String[4]; - text[0] = blockAndExtraData.length > 1 ? blockAndExtraData[1] : ""; - text[1] = blockAndExtraData.length > 2 ? blockAndExtraData[2] : ""; - text[2] = blockAndExtraData.length > 3 ? blockAndExtraData[3] : ""; - text[3] = blockAndExtraData.length > 4 ? blockAndExtraData[4] : ""; - return new SignBlock(blockType.getID(), data, text); - - case MOB_SPAWNER: - // Allow setting mob spawn type - if (blockAndExtraData.length > 1) { - String mobName = blockAndExtraData[1]; - for (MobType mobType : MobType.values()) { - if (mobType.getName().toLowerCase().equals(mobName.toLowerCase())) { - mobName = mobType.getName(); - break; - } - } - if (!worldEdit.getServer().isValidMobType(mobName)) { - throw new NoMatchException("Unknown mob type '" + mobName + "'"); - } - return new MobSpawnerBlock(data, mobName); - } else { - return new MobSpawnerBlock(data, MobType.PIG.getName()); - } - - case NOTE_BLOCK: - // Allow setting note - if (blockAndExtraData.length <= 1) { - return new NoteBlock(data, (byte) 0); - } - - byte note = Byte.parseByte(blockAndExtraData[1]); - if (note < 0 || note > 24) { - throw new InputParseException("Out of range note value: '" + blockAndExtraData[1] + "'"); - } - - return new NoteBlock(data, note); - - case HEAD: - // allow setting type/player/rotation - if (blockAndExtraData.length <= 1) { - return new SkullBlock(data); - } - - byte rot = 0; - String type = ""; - try { - rot = Byte.parseByte(blockAndExtraData[1]); - } catch (NumberFormatException e) { - type = blockAndExtraData[1]; - if (blockAndExtraData.length > 2) { - try { - rot = Byte.parseByte(blockAndExtraData[2]); - } catch (NumberFormatException e2) { - throw new InputParseException("Second part of skull metadata should be a number."); - } + if (blockType == BlockTypes.SIGN || blockType == BlockTypes.WALL_SIGN) { + // Allow special sign text syntax + String[] text = new String[4]; + text[0] = blockAndExtraData.length > 1 ? blockAndExtraData[1] : ""; + text[1] = blockAndExtraData.length > 2 ? blockAndExtraData[2] : ""; + text[2] = blockAndExtraData.length > 3 ? blockAndExtraData[3] : ""; + text[3] = blockAndExtraData.length > 4 ? blockAndExtraData[4] : ""; + return new SignBlock(state, text); + } else if (blockType == BlockTypes.SPAWNER) { + // Allow setting mob spawn type + if (blockAndExtraData.length > 1) { + String mobName = blockAndExtraData[1]; + for (MobType mobType : MobType.values()) { + if (mobType.getName().toLowerCase().equals(mobName.toLowerCase())) { + mobName = mobType.getName(); + break; } } - byte skullType = 0; - // type is either the mob type or the player name - // sorry for the four minecraft accounts named "skeleton", "wither", "zombie", or "creeper" - if (!type.isEmpty()) { - if (type.equalsIgnoreCase("skeleton")) skullType = 0; - else if (type.equalsIgnoreCase("wither")) skullType = 1; - else if (type.equalsIgnoreCase("zombie")) skullType = 2; - else if (type.equalsIgnoreCase("creeper")) skullType = 4; - else skullType = 3; - } - if (skullType == 3) { - return new SkullBlock(data, rot, type.replace(" ", "_")); // valid MC usernames - } else { - return new SkullBlock(data, skullType, rot); + if (!worldEdit.getPlatformManager().queryCapability(Capability.USER_COMMANDS).isValidMobType(mobName)) { + throw new NoMatchException("Unknown mob type '" + mobName + "'"); } + return new MobSpawnerBlock(state, mobName); + } else { + return new MobSpawnerBlock(state, MobType.PIG.getName()); + } + } else if (blockType == BlockTypes.PLAYER_HEAD || blockType == BlockTypes.PLAYER_WALL_HEAD) { + // allow setting type/player/rotation + if (blockAndExtraData.length <= 1) { + return new SkullBlock(state); + } - default: - return new BaseBlock(blockId, data); + String type = blockAndExtraData[1]; + + return new SkullBlock(state, type.replace(" ", "_")); // valid MC usernames + } else { + return state; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultItemParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultItemParser.java index ee7fc917a..d2319a609 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultItemParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultItemParser.java @@ -23,7 +23,10 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.registry.LegacyMapper; public class DefaultItemParser extends InputParser { @@ -33,46 +36,30 @@ public class DefaultItemParser extends InputParser { @Override public BaseItem parseFromInput(String input, ParserContext context) throws InputParseException { - String[] tokens = input.split(":", 3); - BaseItem item; - short meta = 0; - - try { - int id = Integer.parseInt(tokens[0]); - - // Parse metadata - if (tokens.length == 2) { - try { - meta = Short.parseShort(tokens[1]); - } catch (NumberFormatException ignored) { - throw new InputParseException("Expected '" + tokens[1] + "' to be a metadata value but it's not a number"); + BaseItem item = null; + // Legacy matcher + if (context.isTryingLegacy()) { + try { + String[] split = input.split(":"); + ItemType type; + if (split.length == 1) { + type = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0])); + } else { + type = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]), Integer.parseInt(split[1])); } + item = new BaseItem(type); + } catch (NumberFormatException e) { } + } - item = context.requireWorld().getWorldData().getItemRegistry().createFromId(id); - } catch (NumberFormatException e) { - if (input.length() < 2) { - throw new InputParseException("'" + input + "' isn't a known item name format"); - } - - String name = tokens[0] + ":" + tokens[1]; - - // Parse metadata - if (tokens.length == 3) { - try { - meta = Short.parseShort(tokens[2]); - } catch (NumberFormatException ignored) { - throw new InputParseException("Expected '" + tokens[2] + "' to be a metadata value but it's not a number"); - } - } - - item = context.requireWorld().getWorldData().getItemRegistry().createFromId(name); + if (item == null) { + item = WorldEdit.getInstance().getPlatformManager() + .queryCapability(Capability.GAME_HOOKS).getRegistries().getItemRegistry().createFromId(input.toLowerCase()); } if (item == null) { throw new InputParseException("'" + input + "' did not match any item"); } else { - item.setData(meta); return item; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java index 88d4b53ac..cf0565739 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java @@ -25,6 +25,7 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.BiomeMask2D; import com.sk89q.worldedit.function.mask.BlockMask; @@ -64,7 +65,7 @@ class DefaultMaskParser extends InputParser { @Override public Mask parseFromInput(String input, ParserContext context) throws InputParseException { - List masks = new ArrayList(); + List masks = new ArrayList<>(); for (String component : input.split(" ")) { if (component.isEmpty()) { @@ -126,9 +127,10 @@ class DefaultMaskParser extends InputParser { return new MaskIntersection(offsetMask, Masks.negate(submask)); case '$': - Set biomes = new HashSet(); + Set biomes = new HashSet<>(); String[] biomesList = component.substring(1).split(","); - BiomeRegistry biomeRegistry = context.requireWorld().getWorldData().getBiomeRegistry(); + BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager() + .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); List knownBiomes = biomeRegistry.getBiomes(); for (String biomeName : biomesList) { BaseBiome biome = Biomes.findBiomeByName(knownBiomes, biomeName, biomeRegistry); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/HashTagPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/HashTagPatternParser.java index 1c7a0d646..fe28aafe8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/HashTagPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/HashTagPatternParser.java @@ -22,12 +22,12 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.worldedit.EmptyClipboardException; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.pattern.ClipboardPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.registry.InputParser; -import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.session.ClipboardHolder; class HashTagPatternParser extends InputParser { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/RandomPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/RandomPatternParser.java index a850b98ff..010a6f01f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/RandomPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/RandomPatternParser.java @@ -19,14 +19,15 @@ package com.sk89q.worldedit.extension.factory; +import com.sk89q.util.StringUtil; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.RandomPattern; import com.sk89q.worldedit.internal.registry.InputParser; +import com.sk89q.worldedit.world.block.BlockStateHolder; class RandomPatternParser extends InputParser { @@ -39,8 +40,9 @@ class RandomPatternParser extends InputParser { BlockFactory blockRegistry = worldEdit.getBlockFactory(); RandomPattern randomPattern = new RandomPattern(); - for (String token : input.split(",")) { - BaseBlock block; + String[] splits = input.split(","); + for (String token : StringUtil.parseListInQuotes(splits, ',', '[', ']')) { + BlockStateHolder block; double chance; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/SingleBlockPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/SingleBlockPatternParser.java index 17833cf97..cd3adb5e7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/SingleBlockPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/SingleBlockPatternParser.java @@ -20,11 +20,11 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.registry.InputParser; -import com.sk89q.worldedit.extension.input.InputParseException; class SingleBlockPatternParser extends InputParser { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java index b2f61e880..d6fced5eb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java @@ -40,6 +40,7 @@ public class ParserContext { private @Nullable World world; private @Nullable Actor actor; private boolean restricted = true; + private boolean tryLegacy = true; private boolean preferringWildcard; /** @@ -60,6 +61,7 @@ public class ParserContext { setActor(other.getActor()); setRestricted(other.isRestricted()); setPreferringWildcard(other.isPreferringWildcard()); + setTryLegacy(other.isTryingLegacy()); } /** @@ -229,4 +231,21 @@ public class ParserContext { this.preferringWildcard = preferringWildcard; } + /** + * Set whether legacy IDs should be attempted. + * + * @param tryLegacy true if legacy IDs should be attempted + */ + public void setTryLegacy(boolean tryLegacy) { + this.tryLegacy = tryLegacy; + } + + /** + * Get whether legacy IDs should be tried. + * + * @return true if legacy should be tried + */ + public boolean isTryingLegacy() { + return tryLegacy; + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index 883930915..36e84ded7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -19,24 +19,24 @@ package com.sk89q.worldedit.extension.platform; -import com.sk89q.worldedit.util.auth.AuthorizationException; -import com.sk89q.worldedit.BlockWorldVector; -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.NotABlockException; import com.sk89q.worldedit.PlayerDirection; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.WorldVector; -import com.sk89q.worldedit.WorldVectorFace; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; -import com.sk89q.worldedit.blocks.BlockType; -import com.sk89q.worldedit.blocks.ItemID; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.internal.cui.CUIEvent; +import com.sk89q.worldedit.util.HandSide; +import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.TargetBlock; -import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.util.auth.AuthorizationException; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.gamemode.GameMode; +import com.sk89q.worldedit.world.gamemode.GameModes; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import java.io.File; @@ -84,17 +84,17 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public boolean isHoldingPickAxe() { - int item = getItemInHand(); - return item == ItemID.IRON_PICK - || item == ItemID.WOOD_PICKAXE - || item == ItemID.STONE_PICKAXE - || item == ItemID.DIAMOND_PICKAXE - || item == ItemID.GOLD_PICKAXE; + ItemType item = getItemInHand(HandSide.MAIN_HAND).getType(); + return item == ItemTypes.IRON_PICKAXE + || item == ItemTypes.WOODEN_PICKAXE + || item == ItemTypes.STONE_PICKAXE + || item == ItemTypes.DIAMOND_PICKAXE + || item == ItemTypes.GOLDEN_PICKAXE; } @Override - public void findFreePosition(WorldVector searchPos) { - World world = searchPos.getWorld(); + public void findFreePosition(Location searchPos) { + Extent world = searchPos.getExtent(); int x = searchPos.getBlockX(); int y = Math.max(0, searchPos.getBlockY()); int origY = y; @@ -102,8 +102,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { byte free = 0; - while (y <= world.getMaxY() + 2) { - if (BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) { + while (y <= world.getMaximumPoint().getBlockY() + 2) { + if (!world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -111,10 +111,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { if (free == 2) { if (y - 1 != origY) { - final Vector pos = new Vector(x, y - 2, z); - final int id = world.getBlockType(pos); - final int data = world.getBlockData(pos); - setPosition(new Vector(x + 0.5, y - 2 + BlockType.centralTopLimit(id, data), z + 0.5)); + setPosition(new Vector(x + 0.5, y - 2 + 1, z + 0.5)); } return; @@ -125,18 +122,17 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { } @Override - public void setOnGround(WorldVector searchPos) { - World world = searchPos.getWorld(); + public void setOnGround(Location searchPos) { + Extent world = searchPos.getExtent(); int x = searchPos.getBlockX(); int y = Math.max(0, searchPos.getBlockY()); int z = searchPos.getBlockZ(); while (y >= 0) { final Vector pos = new Vector(x, y, z); - final int id = world.getBlockType(pos); - final int data = world.getBlockData(pos); - if (!BlockType.canPassThrough(id, data)) { - setPosition(new Vector(x + 0.5, y + BlockType.centralTopLimit(id, data), z + 0.5)); + final BlockState id = world.getBlock(pos); + if (id.getBlockType().getMaterial().isMovementBlocker()) { + setPosition(new Vector(x + 0.5, y + 1, z + 0.5)); return; } @@ -151,17 +147,17 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public boolean ascendLevel() { - final WorldVector pos = getBlockIn(); + final Location pos = getBlockIn(); final int x = pos.getBlockX(); int y = Math.max(0, pos.getBlockY()); final int z = pos.getBlockZ(); - final World world = pos.getWorld(); + final Extent world = pos.getExtent(); byte free = 0; byte spots = 0; - while (y <= world.getMaxY() + 2) { - if (BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) { + while (y <= world.getMaximumPoint().getY() + 2) { + if (!world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -171,15 +167,15 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { ++spots; if (spots == 2) { final Vector platform = new Vector(x, y - 2, z); - final BaseBlock block = world.getBlock(platform); - final int type = block.getId(); + final BlockStateHolder block = world.getBlock(platform); + final com.sk89q.worldedit.world.block.BlockType type = block.getBlockType(); // Don't get put in lava! - if (type == BlockID.LAVA || type == BlockID.STATIONARY_LAVA) { + if (type == BlockTypes.LAVA) { return false; } - setPosition(platform.add(0.5, BlockType.centralTopLimit(block), 0.5)); + setPosition(platform.add(0.5, 1, 0.5)); return true; } } @@ -192,16 +188,16 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public boolean descendLevel() { - final WorldVector pos = getBlockIn(); + final Location pos = getBlockIn(); final int x = pos.getBlockX(); int y = Math.max(0, pos.getBlockY() - 1); final int z = pos.getBlockZ(); - final World world = pos.getWorld(); + final Extent world = pos.getExtent(); byte free = 0; while (y >= 1) { - if (BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) { + if (!world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; @@ -213,13 +209,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { // stand upon while (y >= 0) { final Vector platform = new Vector(x, y, z); - final BaseBlock block = world.getBlock(platform); - final int type = block.getId(); + final BlockStateHolder block = world.getBlock(platform); + final com.sk89q.worldedit.world.block.BlockType type = block.getBlockType(); // Don't want to end up in lava - if (type != BlockID.AIR && type != BlockID.LAVA && type != BlockID.STATIONARY_LAVA) { + if (type != BlockTypes.AIR && type != BlockTypes.LAVA) { // Found a block! - setPosition(platform.add(0.5, BlockType.centralTopLimit(block), 0.5)); + setPosition(platform.add(0.5, 1, 0.5)); return true; } @@ -242,21 +238,21 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public boolean ascendToCeiling(int clearance, boolean alwaysGlass) { - Vector pos = getBlockIn(); + Location pos = getBlockIn(); int x = pos.getBlockX(); int initialY = Math.max(0, pos.getBlockY()); int y = Math.max(0, pos.getBlockY() + 2); int z = pos.getBlockZ(); - World world = getPosition().getWorld(); + Extent world = getLocation().getExtent(); // No free space above - if (world.getBlockType(new Vector(x, y, z)) != 0) { + if (world.getBlock(new Vector(x, y, z)).getBlockType() != BlockTypes.AIR) { return false; } - while (y <= world.getMaxY()) { + while (y <= world.getMaximumPoint().getY()) { // Found a ceiling! - if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) { + if (world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { int platformY = Math.max(initialY, y - 3 - clearance); floatAt(x, platformY + 1, z, alwaysGlass); return true; @@ -275,16 +271,16 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public boolean ascendUpwards(int distance, boolean alwaysGlass) { - final Vector pos = getBlockIn(); + final Location pos = getBlockIn(); final int x = pos.getBlockX(); final int initialY = Math.max(0, pos.getBlockY()); int y = Math.max(0, pos.getBlockY() + 1); final int z = pos.getBlockZ(); final int maxY = Math.min(getWorld().getMaxY() + 1, initialY + distance); - final World world = getPosition().getWorld(); + final Extent world = getLocation().getExtent(); - while (y <= world.getMaxY() + 2) { - if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) { + while (y <= world.getMaximumPoint().getY() + 2) { + if (world.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { break; // Hit something } else if (y > maxY + 1) { break; @@ -301,43 +297,46 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public void floatAt(int x, int y, int z, boolean alwaysGlass) { - getPosition().getWorld().setBlockType(new Vector(x, y - 1, z), BlockID.GLASS); + try { + Vector spot = new Vector(x, y - 1, z); + if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) { + getLocation().getExtent().setBlock(spot, BlockTypes.GLASS.getDefaultState()); + } + } catch (WorldEditException e) { + e.printStackTrace(); + } setPosition(new Vector(x + 0.5, y, z + 0.5)); } @Override - public WorldVector getBlockIn() { - WorldVector pos = getPosition(); - return WorldVector.toBlockPoint(pos.getWorld(), pos.getX(), - pos.getY(), pos.getZ()); + public Location getBlockIn() { + return getLocation().setPosition(getLocation().toVector().toBlockVector()); } @Override - public WorldVector getBlockOn() { - WorldVector pos = getPosition(); - return WorldVector.toBlockPoint(pos.getWorld(), pos.getX(), - pos.getY() - 1, pos.getZ()); + public Location getBlockOn() { + return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).toVector().toBlockVector()); } @Override - public WorldVector getBlockTrace(int range, boolean useLastBlock) { + public Location getBlockTrace(int range, boolean useLastBlock) { TargetBlock tb = new TargetBlock(this, range, 0.2); return (useLastBlock ? tb.getAnyTargetBlock() : tb.getTargetBlock()); } @Override - public WorldVectorFace getBlockTraceFace(int range, boolean useLastBlock) { + public Location getBlockTraceFace(int range, boolean useLastBlock) { TargetBlock tb = new TargetBlock(this, range, 0.2); return (useLastBlock ? tb.getAnyTargetBlockFace() : tb.getTargetBlockFace()); } @Override - public WorldVector getBlockTrace(int range) { + public Location getBlockTrace(int range) { return getBlockTrace(range, false); } @Override - public WorldVector getSolidBlockTrace(int range) { + public Location getSolidBlockTrace(int range) { TargetBlock tb = new TargetBlock(this, range, 0.2); return tb.getSolidTargetBlock(); } @@ -349,15 +348,15 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public PlayerDirection getCardinalDirection(int yawOffset) { - if (getPitch() > 67.5) { + if (getLocation().getPitch() > 67.5) { return PlayerDirection.DOWN; } - if (getPitch() < -67.5) { + if (getLocation().getPitch() < -67.5) { return PlayerDirection.UP; } // From hey0's code - double rot = (getYaw() + yawOffset) % 360; //let's use real yaw now + double rot = (getLocation().getYaw() + yawOffset) % 360; //let's use real yaw now if (rot < 0) { rot += 360.0; } @@ -365,12 +364,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { } @Override - public BaseBlock getBlockInHand() throws WorldEditException { - final int typeId = getItemInHand(); - if (!getWorld().isValidBlockType(typeId)) { - throw new NotABlockException(typeId); + public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException { + final ItemType typeId = getItemInHand(handSide).getType(); + if (typeId.hasBlockType()) { + return typeId.getBlockType().getDefaultState().toBaseBlock(); + } else { + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } - return new BaseBlock(typeId); } /** @@ -383,14 +383,14 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { public boolean passThroughForwardWall(int range) { int searchDist = 0; TargetBlock hitBlox = new TargetBlock(this, range, 0.2); - World world = getPosition().getWorld(); - BlockWorldVector block; + Extent world = getLocation().getExtent(); + Location block; boolean firstBlock = true; int freeToFind = 2; boolean inFree = false; while ((block = hitBlox.getNextBlock()) != null) { - boolean free = BlockType.canPassThrough(world.getBlock(block)); + boolean free = !world.getBlock(block.toVector()).getBlockType().getMaterial().isMovementBlocker(); if (firstBlock) { firstBlock = false; @@ -425,7 +425,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public void setPosition(Vector pos) { - setPosition(pos, (float) getPitch(), (float) getYaw()); + setPosition(pos, getLocation().getPitch(), getLocation().getYaw()); } @Override @@ -451,10 +451,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public boolean equals(Object other) { - if (!(other instanceof LocalPlayer)) { + if (!(other instanceof Player)) { return false; } - LocalPlayer other2 = (LocalPlayer) other; + Player other2 = (Player) other; return other2.getName().equals(getName()); } @@ -476,8 +476,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { } @Override - public boolean hasCreativeMode() { - return false; + public GameMode getGameMode() { + return GameModes.SURVIVAL; + } + + @Override + public void setGameMode(GameMode gameMode) { + } @SuppressWarnings("CloneDoesntCallSuperClone") diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java index 3a39c47e9..12f56a81a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.extension.platform; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.util.command.composition.LegacyCommandAdapter.adapt; + import com.google.common.base.Joiner; import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandLocals; @@ -28,15 +31,41 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.command.*; +import com.sk89q.worldedit.command.BiomeCommands; +import com.sk89q.worldedit.command.BrushCommands; +import com.sk89q.worldedit.command.ChunkCommands; +import com.sk89q.worldedit.command.ClipboardCommands; +import com.sk89q.worldedit.command.GeneralCommands; +import com.sk89q.worldedit.command.GenerationCommands; +import com.sk89q.worldedit.command.HistoryCommands; +import com.sk89q.worldedit.command.NavigationCommands; +import com.sk89q.worldedit.command.RegionCommands; +import com.sk89q.worldedit.command.SchematicCommands; +import com.sk89q.worldedit.command.ScriptingCommands; +import com.sk89q.worldedit.command.SelectionCommands; +import com.sk89q.worldedit.command.SnapshotCommands; +import com.sk89q.worldedit.command.SnapshotUtilCommands; +import com.sk89q.worldedit.command.SuperPickaxeCommands; +import com.sk89q.worldedit.command.ToolCommands; +import com.sk89q.worldedit.command.ToolUtilCommands; +import com.sk89q.worldedit.command.UtilityCommands; +import com.sk89q.worldedit.command.WorldEditCommands; import com.sk89q.worldedit.command.argument.ReplaceParser; import com.sk89q.worldedit.command.argument.TreeGeneratorParser; -import com.sk89q.worldedit.command.composition.*; +import com.sk89q.worldedit.command.composition.ApplyCommand; +import com.sk89q.worldedit.command.composition.DeformCommand; +import com.sk89q.worldedit.command.composition.PaintCommand; +import com.sk89q.worldedit.command.composition.SelectionCommand; +import com.sk89q.worldedit.command.composition.ShapedBrushCommand; import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.event.platform.CommandSuggestionEvent; import com.sk89q.worldedit.function.factory.Deform; import com.sk89q.worldedit.function.factory.Deform.Mode; -import com.sk89q.worldedit.internal.command.*; +import com.sk89q.worldedit.internal.command.ActorAuthorizer; +import com.sk89q.worldedit.internal.command.CommandLoggingHandler; +import com.sk89q.worldedit.internal.command.UserCommandCompleter; +import com.sk89q.worldedit.internal.command.WorldEditBinding; +import com.sk89q.worldedit.internal.command.WorldEditExceptionConverter; import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.util.command.InvalidUsageException; @@ -58,9 +87,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.util.command.composition.LegacyCommandAdapter.adapt; - /** * Handles the registration and invocation of commands. * @@ -96,7 +122,6 @@ public final class CommandManager { // Setup the logger commandLog.addHandler(dynamicHandler); - dynamicHandler.setFormatter(new LogFormat()); // Set up the commands manager ParametricBuilder builder = new ParametricBuilder(); @@ -185,6 +210,8 @@ public final class CommandManager { } catch (IOException e) { log.log(Level.WARNING, "Could not use command log file " + path + ": " + e.getMessage()); } + + dynamicHandler.setFormatter(new LogFormat(config.logFormat)); } platform.registerCommands(dispatcher); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java index 03d4812a9..3b37a98b5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java @@ -23,11 +23,13 @@ import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.registry.Registries; -import javax.annotation.Nullable; import java.util.List; import java.util.Map; +import javax.annotation.Nullable; + /** * Represents a platform that WorldEdit has been implemented for. * @@ -37,12 +39,11 @@ import java.util.Map; public interface Platform { /** - * Resolves an item name to its ID. + * Gets the registry holder. * - * @param name The name to look up - * @return The id that corresponds to the name, or -1 if no such ID exists + * @return The registry holder */ - int resolveItem(String name); + Registries getRegistries(); /** * Checks if a mob type is valid. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java index 8f34ab6d1..95c202455 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.extension.platform; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.ServerInterface; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.WorldVector; import com.sk89q.worldedit.command.tool.BlockTool; import com.sk89q.worldedit.command.tool.DoubleActionBlockTool; import com.sk89q.worldedit.command.tool.DoubleActionTraceTool; @@ -38,13 +38,12 @@ import com.sk89q.worldedit.event.platform.PlatformInitializeEvent; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.event.platform.PlayerInputEvent; import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; -import com.sk89q.worldedit.internal.ServerInterfaceAdapter; import com.sk89q.worldedit.regions.RegionSelector; +import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.world.World; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.EnumMap; import java.util.Iterator; @@ -55,7 +54,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Manages registered {@link Platform}s for WorldEdit. Platforms are @@ -69,8 +68,8 @@ public class PlatformManager { private final WorldEdit worldEdit; private final CommandManager commandManager; - private final List platforms = new ArrayList(); - private final Map preferences = new EnumMap(Capability.class); + private final List platforms = new ArrayList<>(); + private final Map preferences = new EnumMap<>(Capability.class); private @Nullable String firstSeenVersion; private final AtomicBoolean initialized = new AtomicBoolean(); private final AtomicBoolean configured = new AtomicBoolean(); @@ -166,6 +165,9 @@ public class PlatformManager { if (platform != null) { return platform; } else { + if (preferences.isEmpty()) { + return platforms.get(0); // Use the first available if preferences have not been decided yet. + } throw new NoCapablePlatformException("No platform was found supporting " + capability.name()); } } @@ -218,7 +220,7 @@ public class PlatformManager { * @return a list of platforms */ public synchronized List getPlatforms() { - return new ArrayList(platforms); + return new ArrayList<>(platforms); } /** @@ -285,17 +287,6 @@ public class PlatformManager { return queryCapability(Capability.CONFIGURATION).getConfiguration(); } - /** - * Return a legacy {@link ServerInterface}. - * - * @return a {@link ServerInterface} - * @throws IllegalStateException if no platform has been registered - */ - @SuppressWarnings("deprecation") - public ServerInterface getServerInterface() throws IllegalStateException { - return ServerInterfaceAdapter.adapt(queryCapability(Capability.USER_COMMANDS)); - } - @Subscribe public void handlePlatformReady(PlatformReadyEvent event) { choosePreferred(); @@ -304,7 +295,6 @@ public class PlatformManager { } } - @SuppressWarnings("deprecation") @Subscribe public void handleBlockInteract(BlockInteractEvent event) { // Create a proxy actor with a potentially different world for @@ -320,7 +310,7 @@ public class PlatformManager { LocalSession session = worldEdit.getSessionManager().get(actor); if (event.getType() == Interaction.HIT) { - if (player.getItemInHand() == getConfiguration().wandItem) { + if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().wandItem)) { if (!session.isToolControlEnabled()) { return; } @@ -347,8 +337,8 @@ public class PlatformManager { } } - Tool tool = session.getTool(player.getItemInHand()); - if (tool != null && tool instanceof DoubleActionBlockTool) { + Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); + if (tool instanceof DoubleActionBlockTool) { if (tool.canUse(player)) { ((DoubleActionBlockTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location); event.setCancelled(true); @@ -356,7 +346,7 @@ public class PlatformManager { } } else if (event.getType() == Interaction.OPEN) { - if (player.getItemInHand() == getConfiguration().wandItem) { + if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().wandItem)) { if (!session.isToolControlEnabled()) { return; } @@ -374,8 +364,8 @@ public class PlatformManager { return; } - Tool tool = session.getTool(player.getItemInHand()); - if (tool != null && tool instanceof BlockTool) { + Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); + if (tool instanceof BlockTool) { if (tool.canUse(player)) { ((BlockTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location); event.setCancelled(true); @@ -385,7 +375,6 @@ public class PlatformManager { } } - @SuppressWarnings("deprecation") @Subscribe public void handlePlayerInput(PlayerInputEvent event) { // Create a proxy actor with a potentially different world for @@ -394,7 +383,7 @@ public class PlatformManager { switch (event.getInputType()) { case PRIMARY: { - if (player.getItemInHand() == getConfiguration().navigationWand) { + if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().navigationWand)) { if (getConfiguration().navigationWandMaxDistance <= 0) { return; } @@ -403,7 +392,7 @@ public class PlatformManager { return; } - WorldVector pos = player.getSolidBlockTrace(getConfiguration().navigationWandMaxDistance); + Location pos = player.getSolidBlockTrace(getConfiguration().navigationWandMaxDistance); if (pos != null) { player.findFreePosition(pos); } else { @@ -416,8 +405,8 @@ public class PlatformManager { LocalSession session = worldEdit.getSessionManager().get(player); - Tool tool = session.getTool(player.getItemInHand()); - if (tool != null && tool instanceof DoubleActionTraceTool) { + Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); + if (tool instanceof DoubleActionTraceTool) { if (tool.canUse(player)) { ((DoubleActionTraceTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session); event.setCancelled(true); @@ -429,7 +418,7 @@ public class PlatformManager { } case SECONDARY: { - if (player.getItemInHand() == getConfiguration().navigationWand) { + if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().navigationWand)) { if (getConfiguration().navigationWandMaxDistance <= 0) { return; } @@ -448,8 +437,8 @@ public class PlatformManager { LocalSession session = worldEdit.getSessionManager().get(player); - Tool tool = session.getTool(player.getItemInHand()); - if (tool != null && tool instanceof TraceTool) { + Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); + if (tool instanceof TraceTool) { if (tool.canUse(player)) { ((TraceTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session); event.setCancelled(true); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java index 7ed6d20d1..27da6be8a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java @@ -19,21 +19,23 @@ package com.sk89q.worldedit.extension.platform; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.WorldVector; +import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.session.SessionKey; +import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; - -import javax.annotation.Nullable; +import com.sk89q.worldedit.world.gamemode.GameMode; import java.util.UUID; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; class PlayerProxy extends AbstractPlayerActor { @@ -59,13 +61,13 @@ class PlayerProxy extends AbstractPlayerActor { } @Override - public int getItemInHand() { - return basePlayer.getItemInHand(); + public BaseItemStack getItemInHand(HandSide handSide) { + return basePlayer.getItemInHand(handSide); } @Override - public void giveItem(int type, int amount) { - basePlayer.giveItem(type, amount); + public void giveItem(BaseItemStack itemStack) { + basePlayer.giveItem(itemStack); } @Override @@ -88,21 +90,6 @@ class PlayerProxy extends AbstractPlayerActor { return basePlayer.getLocation(); } - @Override - public WorldVector getPosition() { - return basePlayer.getPosition(); - } - - @Override - public double getPitch() { - return basePlayer.getPitch(); - } - - @Override - public double getYaw() { - return basePlayer.getYaw(); - } - @Override public void setPosition(Vector pos, float pitch, float yaw) { basePlayer.setPosition(pos, pitch, yaw); @@ -158,4 +145,14 @@ class PlayerProxy extends AbstractPlayerActor { public SessionKey getSessionKey() { return basePlayer.getSessionKey(); } + + @Override + public GameMode getGameMode() { + return basePlayer.getGameMode(); + } + + @Override + public void setGameMode(GameMode gameMode) { + basePlayer.setGameMode(gameMode); + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/permission/ActorSelectorLimits.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/permission/ActorSelectorLimits.java index 255dbb406..5712fcb4e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/permission/ActorSelectorLimits.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/permission/ActorSelectorLimits.java @@ -19,13 +19,14 @@ package com.sk89q.worldedit.extension.platform.permission; -import com.google.common.base.Optional; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; -import static com.google.common.base.Preconditions.checkNotNull; +import java.util.Optional; public class ActorSelectorLimits implements SelectorLimits { @@ -55,7 +56,7 @@ public class ActorSelectorLimits implements SelectorLimits { if (limit > 0) { return Optional.of(limit); } else { - return Optional.absent(); + return Optional.empty(); } } @@ -74,7 +75,7 @@ public class ActorSelectorLimits implements SelectorLimits { if (limit > 0) { return Optional.of(limit); } else { - return Optional.absent(); + return Optional.empty(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java index 7a1bd25f9..a93c9b93d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java @@ -19,23 +19,25 @@ package com.sk89q.worldedit.extent; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.OperationQueue; -import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BaseBiome; - -import javax.annotation.Nullable; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * A base class for {@link Extent}s that merely passes extents onto another. @@ -64,17 +66,17 @@ public abstract class AbstractDelegateExtent implements Extent { } @Override - public BaseBlock getBlock(Vector position) { + public BlockState getBlock(Vector position) { return extent.getBlock(position); } @Override - public BaseBlock getLazyBlock(Vector position) { - return extent.getLazyBlock(position); + public BaseBlock getFullBlock(Vector position) { + return extent.getFullBlock(position); } @Override - public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { return extent.setBlock(location, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java index 794183355..e4f6ba48d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java @@ -19,9 +19,11 @@ package com.sk89q.worldedit.extent; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.history.change.BlockChange; @@ -30,13 +32,12 @@ import com.sk89q.worldedit.history.change.EntityRemove; import com.sk89q.worldedit.history.changeset.ChangeSet; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; - -import javax.annotation.Nullable; +import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.ArrayList; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Stores changes to a {@link ChangeSet}. @@ -58,8 +59,8 @@ public class ChangeSetExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { - BaseBlock previous = getBlock(location); + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + BaseBlock previous = getFullBlock(location); changeSet.add(new BlockChange(location.toBlockVector(), previous, block)); return super.setBlock(location, block); } @@ -85,7 +86,7 @@ public class ChangeSetExtent extends AbstractDelegateExtent { } private List wrapEntities(List entities) { - List newList = new ArrayList(entities.size()); + List newList = new ArrayList<>(entities.size()); for (Entity entity : entities) { newList.add(new TrackedEntity(entity)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java index 617dff41f..5ed584351 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java @@ -22,11 +22,12 @@ package com.sk89q.worldedit.extent; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; -import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.util.Location; + +import java.util.List; import javax.annotation.Nullable; -import java.util.List; /** * A world, portion of a world, clipboard, or other object that can have blocks diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java index f8e3a7a8f..61ea293c8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java @@ -21,9 +21,10 @@ package com.sk89q.worldedit.extent; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BlockState; /** * Provides the current state of blocks, entities, and so on. @@ -37,43 +38,22 @@ public interface InputExtent { * is undefined (an air block could be returned). However, {@code null} * should not be returned.

* - *

The returned block is mutable and is a snapshot of the block at the time + *

The returned block is immutable and is a snapshot of the block at the time * of call. It has no position attached to it, so it could be reused in * {@link Pattern}s and so on.

* - *

Calls to this method can actually be quite expensive, so cache results - * whenever it is possible, while being aware of the mutability aspect. - * The cost, however, depends on the implementation and particular extent. - * If only basic information about the block is required, then use of - * {@link #getLazyBlock(Vector)} is recommended.

- * * @param position position of the block * @return the block */ - BaseBlock getBlock(Vector position); + BlockState getBlock(Vector position); /** - * Get a lazy, immutable snapshot of the block at the given location that only - * immediately contains information about the block's type (and metadata). - * - *

Further information (such as NBT data) will be available by the - * time of access. Therefore, it is not recommended that - * this method is used if the world is being simulated at the time of - * call. If the block needs to be stored for future use, then this method should - * definitely not be used. Moreover, the block that is returned is immutable (or - * should be), and therefore modifications should not be attempted on it. If a - * modifiable copy is required, then the block should be cloned.

- * - *

This method exists because it is sometimes important to inspect the block - * at a given location, but {@link #getBlock(Vector)} may be too expensive in - * the underlying implementation. It is also not possible to implement - * caching if the returned object is mutable, so this methods allows caching - * implementations to be used.

+ * Get a immutable snapshot of the block at the given location. * * @param position position of the block * @return the block */ - BaseBlock getLazyBlock(Vector position); + BaseBlock getFullBlock(Vector position); /** * Get the biome at the given location. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java index 8c53d1ba5..cbd21675c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.extent; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.function.mask.Mask; - -import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.world.block.BlockStateHolder; /** * Requires that all mutating methods pass a given {@link Mask}. @@ -65,7 +65,7 @@ public class MaskingExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { return mask.test(location) && super.setBlock(location, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java index 1979bdaaf..93ffb6e94 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java @@ -22,18 +22,22 @@ package com.sk89q.worldedit.extent; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operation; -import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nullable; + /** * An extent that returns air blocks for all blocks and does not * pass on any changes. @@ -69,13 +73,13 @@ public class NullExtent implements Extent { } @Override - public BaseBlock getBlock(Vector position) { - return new BaseBlock(0); + public BlockState getBlock(Vector position) { + return BlockTypes.AIR.getDefaultState(); } @Override - public BaseBlock getLazyBlock(Vector position) { - return new BaseBlock(0); + public BaseBlock getFullBlock(Vector position) { + return getBlock(position).toBaseBlock(); } @Nullable @@ -85,7 +89,7 @@ public class NullExtent implements Extent { } @Override - public boolean setBlock(Vector position, BaseBlock block) throws WorldEditException { + public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException { return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java index cdb21d662..36747fd97 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java @@ -22,9 +22,9 @@ package com.sk89q.worldedit.extent; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BlockStateHolder; import javax.annotation.Nullable; @@ -35,8 +35,8 @@ public interface OutputExtent { /** * Change the block at the given location to the given block. The operation may - * not tie the given {@link BaseBlock} to the world, so future changes to the - * {@link BaseBlock} do not affect the world until this method is called again. + * not tie the given {@link BlockStateHolder} to the world, so future changes to the + * {@link BlockStateHolder} do not affect the world until this method is called again. * *

The return value of this method indicates whether the change was probably * successful. It may not be successful if, for example, the location is out @@ -50,7 +50,7 @@ public interface OutputExtent { * @return true if the block was successfully set (return value may not be accurate) * @throws WorldEditException thrown on an error */ - boolean setBlock(Vector position, BaseBlock block) throws WorldEditException; + boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException; /** * Set the biome. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java index abdef5478..3905f4ccb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java @@ -19,11 +19,11 @@ package com.sk89q.worldedit.extent.buffer; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; @@ -32,13 +32,13 @@ import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.regions.AbstractRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionOperationException; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Buffers changes to an {@link Extent} and allows later retrieval for * actual application of the changes. @@ -48,9 +48,7 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pattern { - private static final BaseBlock AIR = new BaseBlock(BlockID.AIR); - - private final Map buffer = new LinkedHashMap(); + private final Map buffer = new LinkedHashMap<>(); private final Mask mask; private Vector min = null; private Vector max = null; @@ -79,7 +77,7 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat } @Override - public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { // Update minimum if (min == null) { min = location; @@ -104,12 +102,12 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat } @Override - public BaseBlock apply(Vector pos) { - BaseBlock block = buffer.get(pos.toBlockVector()); + public BlockStateHolder apply(Vector pos) { + BlockStateHolder block = buffer.get(pos.toBlockVector()); if (block != null) { return block; } else { - return AIR; + return BlockTypes.AIR.getDefaultState(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java index 3e6150ed7..b4c4e267a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java @@ -21,13 +21,13 @@ package com.sk89q.worldedit.extent.cache; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.world.block.BlockState; /** - * Returns the same cached {@link BaseBlock} for repeated calls to - * {@link #getLazyBlock(Vector)} with the same position. + * Returns the same cached {@link BlockState} for repeated calls to + * {@link #getBlock(Vector)} with the same position. */ public class LastAccessExtentCache extends AbstractDelegateExtent { @@ -43,13 +43,13 @@ public class LastAccessExtentCache extends AbstractDelegateExtent { } @Override - public BaseBlock getLazyBlock(Vector position) { + public BlockState getBlock(Vector position) { BlockVector blockVector = position.toBlockVector(); CachedBlock lastBlock = this.lastBlock; if (lastBlock != null && lastBlock.position.equals(blockVector)) { return lastBlock.block; } else { - BaseBlock block = super.getLazyBlock(position); + BlockState block = super.getBlock(position); this.lastBlock = new CachedBlock(blockVector, block); return block; } @@ -57,9 +57,9 @@ public class LastAccessExtentCache extends AbstractDelegateExtent { private static class CachedBlock { private final BlockVector position; - private final BaseBlock block; + private final BlockState block; - private CachedBlock(BlockVector position, BaseBlock block) { + private CachedBlock(BlockVector position, BlockState block) { this.position = position; this.block = block; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java index 15c9b7345..eba334e5a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java @@ -19,24 +19,27 @@ package com.sk89q.worldedit.extent.clipboard; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BaseBiome; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Stores block data as a multi-dimensional array of {@link BaseBlock}s and @@ -45,9 +48,9 @@ import static com.google.common.base.Preconditions.checkNotNull; public class BlockArrayClipboard implements Clipboard { private final Region region; - private Vector origin = new Vector(); - private final BaseBlock[][][] blocks; - private final List entities = new ArrayList(); + private Vector origin; + private final BlockStateHolder[][][] blocks; + private final List entities = new ArrayList<>(); /** * Create a new instance. @@ -62,7 +65,7 @@ public class BlockArrayClipboard implements Clipboard { this.origin = region.getMinimumPoint(); Vector dimensions = getDimensions(); - blocks = new BaseBlock[dimensions.getBlockX()][dimensions.getBlockY()][dimensions.getBlockZ()]; + blocks = new BlockStateHolder[dimensions.getBlockX()][dimensions.getBlockY()][dimensions.getBlockZ()]; } @Override @@ -97,7 +100,7 @@ public class BlockArrayClipboard implements Clipboard { @Override public List getEntities(Region region) { - List filtered = new ArrayList(); + List filtered = new ArrayList<>(); for (Entity entity : entities) { if (region.contains(entity.getLocation().toVector())) { filtered.add(entity); @@ -120,28 +123,36 @@ public class BlockArrayClipboard implements Clipboard { } @Override - public BaseBlock getBlock(Vector position) { + public BlockState getBlock(Vector position) { if (region.contains(position)) { Vector v = position.subtract(region.getMinimumPoint()); - BaseBlock block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; + BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; if (block != null) { - return new BaseBlock(block); + return block.toImmutableState(); } } - return new BaseBlock(BlockID.AIR); + return BlockTypes.AIR.getDefaultState(); } @Override - public BaseBlock getLazyBlock(Vector position) { - return getBlock(position); - } - - @Override - public boolean setBlock(Vector position, BaseBlock block) throws WorldEditException { + public BaseBlock getFullBlock(Vector position) { if (region.contains(position)) { Vector v = position.subtract(region.getMinimumPoint()); - blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()] = new BaseBlock(block); + BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; + if (block != null) { + return block.toBaseBlock(); + } + } + + return BlockTypes.AIR.getDefaultState().toBaseBlock(); + } + + @Override + public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException { + if (region.contains(position)) { + Vector v = position.subtract(region.getMinimumPoint()); + blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()] = block; return true; } else { return false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java index 4311ada18..4b56e5e06 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.extent.clipboard; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.util.Location; -import static com.google.common.base.Preconditions.checkNotNull; - /** * An implementation of {@link Entity} that stores a {@link BaseEntity} with it. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java new file mode 100644 index 000000000..103a795f6 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java @@ -0,0 +1,147 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extent.clipboard.io; + +import com.google.common.collect.ImmutableSet; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.NBTInputStream; +import com.sk89q.jnbt.NBTOutputStream; +import com.sk89q.jnbt.NamedTag; +import com.sk89q.jnbt.Tag; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Map; +import java.util.Set; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +/** + * A collection of supported clipboard formats. + */ +public enum BuiltInClipboardFormat implements ClipboardFormat { + + /** + * The Schematic format used by MCEdit. + */ + MCEDIT_SCHEMATIC("mcedit", "mce", "schematic") { + + @Override + public String getPrimaryFileExtension() { + return "schematic"; + } + + @Override + public ClipboardReader getReader(InputStream inputStream) throws IOException { + NBTInputStream nbtStream = new NBTInputStream(new GZIPInputStream(inputStream)); + return new MCEditSchematicReader(nbtStream); + } + + @Override + public ClipboardWriter getWriter(OutputStream outputStream) throws IOException { + throw new IOException("This format does not support saving"); + } + + @Override + public boolean isFormat(File file) { + try (NBTInputStream str = new NBTInputStream(new GZIPInputStream(new FileInputStream(file)))) { + NamedTag rootTag = str.readNamedTag(); + if (!rootTag.getName().equals("Schematic")) { + return false; + } + CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); + + // Check + Map schematic = schematicTag.getValue(); + if (!schematic.containsKey("Materials")) { + return false; + } + } catch (Exception e) { + return false; + } + return true; + } + }, + SPONGE_SCHEMATIC("sponge", "schem") { + + @Override + public String getPrimaryFileExtension() { + return "schem"; + } + + @Override + public ClipboardReader getReader(InputStream inputStream) throws IOException { + NBTInputStream nbtStream = new NBTInputStream(new GZIPInputStream(inputStream)); + return new SpongeSchematicReader(nbtStream); + } + + @Override + public ClipboardWriter getWriter(OutputStream outputStream) throws IOException { + NBTOutputStream nbtStream = new NBTOutputStream(new GZIPOutputStream(outputStream)); + return new SpongeSchematicWriter(nbtStream); + } + + @Override + public boolean isFormat(File file) { + try (NBTInputStream str = new NBTInputStream(new GZIPInputStream(new FileInputStream(file)))) { + NamedTag rootTag = str.readNamedTag(); + if (!rootTag.getName().equals("Schematic")) { + return false; + } + CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); + + // Check + Map schematic = schematicTag.getValue(); + if (!schematic.containsKey("Version")) { + return false; + } + } catch (Exception e) { + return false; + } + + return true; + } + }; + + private final ImmutableSet aliases; + + BuiltInClipboardFormat(String... aliases) { + this.aliases = ImmutableSet.copyOf(aliases); + } + + @Override + public String getName() { + return name(); + } + + @Override + public Set getAliases() { + return this.aliases; + } + + @Override + public Set getFileExtensions() { + return ImmutableSet.of(getPrimaryFileExtension()); + } + +} \ No newline at end of file diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java index 460d23662..fd16d57c2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java @@ -19,96 +19,30 @@ package com.sk89q.worldedit.extent.clipboard.io; -import com.sk89q.jnbt.NBTConstants; -import com.sk89q.jnbt.NBTInputStream; -import com.sk89q.jnbt.NBTOutputStream; - -import javax.annotation.Nullable; -import java.io.DataInputStream; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.Arrays; -import java.util.Collections; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; import java.util.Set; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - -import static com.google.common.base.Preconditions.checkNotNull; /** * A collection of supported clipboard formats. */ -public enum ClipboardFormat { +public interface ClipboardFormat { /** - * The Schematic format used by many software. - */ - SCHEMATIC("mcedit", "mce", "schematic") { - @Override - public ClipboardReader getReader(InputStream inputStream) throws IOException { - NBTInputStream nbtStream = new NBTInputStream(new GZIPInputStream(inputStream)); - return new SchematicReader(nbtStream); - } - - @Override - public ClipboardWriter getWriter(OutputStream outputStream) throws IOException { - NBTOutputStream nbtStream = new NBTOutputStream(new GZIPOutputStream(outputStream)); - return new SchematicWriter(nbtStream); - } - - @Override - public boolean isFormat(File file) { - DataInputStream str = null; - try { - str = new DataInputStream(new GZIPInputStream(new FileInputStream(file))); - if ((str.readByte() & 0xFF) != NBTConstants.TYPE_COMPOUND) { - return false; - } - byte[] nameBytes = new byte[str.readShort() & 0xFFFF]; - str.readFully(nameBytes); - String name = new String(nameBytes, NBTConstants.CHARSET); - return name.equals("Schematic"); - } catch (IOException e) { - return false; - } finally { - if (str != null) { - try { - str.close(); - } catch (IOException ignored) { - } - } - } - } - }; - - private static final Map aliasMap = new HashMap(); - - private final String[] aliases; - - /** - * Create a new instance. + * Returns the name of this format. * - * @param aliases an array of aliases by which this format may be referred to + * @return The name of the format */ - private ClipboardFormat(String ... aliases) { - this.aliases = aliases; - } + String getName(); /** * Get a set of aliases. * * @return a set of aliases */ - public Set getAliases() { - return Collections.unmodifiableSet(new HashSet(Arrays.asList(aliases))); - } + Set getAliases(); /** * Create a reader. @@ -117,7 +51,7 @@ public enum ClipboardFormat { * @return a reader * @throws IOException thrown on I/O error */ - public abstract ClipboardReader getReader(InputStream inputStream) throws IOException; + ClipboardReader getReader(InputStream inputStream) throws IOException; /** * Create a writer. @@ -126,7 +60,7 @@ public enum ClipboardFormat { * @return a writer * @throws IOException thrown on I/O error */ - public abstract ClipboardWriter getWriter(OutputStream outputStream) throws IOException; + ClipboardWriter getWriter(OutputStream outputStream) throws IOException; /** * Return whether the given file is of this format. @@ -134,45 +68,20 @@ public enum ClipboardFormat { * @param file the file * @return true if the given file is of this format */ - public abstract boolean isFormat(File file); - - static { - for (ClipboardFormat format : EnumSet.allOf(ClipboardFormat.class)) { - for (String key : format.aliases) { - aliasMap.put(key, format); - } - } - } + boolean isFormat(File file); /** - * Find the clipboard format named by the given alias. + * Get the file extension this format primarily uses. * - * @param alias the alias - * @return the format, otherwise null if none is matched + * @return The primary file extension */ - @Nullable - public static ClipboardFormat findByAlias(String alias) { - checkNotNull(alias); - return aliasMap.get(alias.toLowerCase().trim()); - } + String getPrimaryFileExtension(); /** - * Detect the format given a file. + * Get the file extensions this format is commonly known to use. This should + * include {@link #getPrimaryFileExtension()}. * - * @param file the file - * @return the format, otherwise null if one cannot be detected + * @return The file extensions this format might be known by */ - @Nullable - public static ClipboardFormat findByFile(File file) { - checkNotNull(file); - - for (ClipboardFormat format : EnumSet.allOf(ClipboardFormat.class)) { - if (format.isFormat(file)) { - return format; - } - } - - return null; - } - + Set getFileExtensions(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java new file mode 100644 index 000000000..9663a9b1f --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java @@ -0,0 +1,125 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extent.clipboard.io; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.google.common.collect.Multimaps; +import com.sk89q.worldedit.WorldEdit; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.annotation.Nullable; + +public class ClipboardFormats { + + private static final Map aliasMap = new HashMap<>(); + private static final Multimap fileExtensionMap = HashMultimap.create(); + private static final List registeredFormats = new ArrayList<>(); + + public static void registerClipboardFormat(ClipboardFormat format) { + checkNotNull(format); + + for (String key : format.getAliases()) { + String lowKey = key.toLowerCase(Locale.ENGLISH); + ClipboardFormat old = aliasMap.put(lowKey, format); + if (old != null) { + aliasMap.put(lowKey, old); + WorldEdit.logger.warning(format.getClass().getName() + " cannot override existing alias '" + lowKey + "' used by " + old.getClass().getName()); + } + } + for (String ext : format.getFileExtensions()) { + String lowExt = ext.toLowerCase(Locale.ENGLISH); + fileExtensionMap.put(lowExt, format); + } + registeredFormats.add(format); + } + + static { + for (BuiltInClipboardFormat format : BuiltInClipboardFormat.values()) { + registerClipboardFormat(format); + } + } + + /** + * Find the clipboard format named by the given alias. + * + * @param alias + * the alias + * @return the format, otherwise null if none is matched + */ + @Nullable + public static ClipboardFormat findByAlias(String alias) { + checkNotNull(alias); + return aliasMap.get(alias.toLowerCase(Locale.ENGLISH).trim()); + } + + /** + * Detect the format of given a file. + * + * @param file + * the file + * @return the format, otherwise null if one cannot be detected + */ + @Nullable + public static ClipboardFormat findByFile(File file) { + checkNotNull(file); + + for (ClipboardFormat format : registeredFormats) { + if (format.isFormat(file)) { + return format; + } + } + + return null; + } + + /** + * @return a multimap from a file extension to the potential matching formats. + */ + public static Multimap getFileExtensionMap() { + return Multimaps.unmodifiableMultimap(fileExtensionMap); + } + + public static Collection getAll() { + return Collections.unmodifiableCollection(registeredFormats); + } + + /** + * Not public API, only used by SchematicCommands. + * It is not in SchematicCommands because it may rely on internal register calls. + */ + public static String[] getFileExtensionArray() { + return fileExtensionMap.keySet().toArray(new String[fileExtensionMap.keySet().size()]); + } + + private ClipboardFormats() { + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java index ccb74ee5b..94f76fe5f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java @@ -20,8 +20,8 @@ package com.sk89q.worldedit.extent.clipboard.io; import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.world.registry.WorldData; +import java.io.Closeable; import java.io.IOException; /** @@ -29,15 +29,14 @@ import java.io.IOException; * * @see Clipboard */ -public interface ClipboardReader { +public interface ClipboardReader extends Closeable { /** * Read a {@code Clipboard}. * - * @param data the world data space to convert the blocks to * @return the read clipboard * @throws IOException thrown on I/O error */ - Clipboard read(WorldData data) throws IOException; + Clipboard read() throws IOException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java index 9f5dc307b..1407f579e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java @@ -20,7 +20,6 @@ package com.sk89q.worldedit.extent.clipboard.io; import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.world.registry.WorldData; import java.io.Closeable; import java.io.IOException; @@ -36,9 +35,8 @@ public interface ClipboardWriter extends Closeable { * Writes a clipboard. * * @param clipboard the clipboard - * @param data the world data instance * @throws IOException thrown on I/O error */ - void write(Clipboard clipboard, WorldData data) throws IOException; + void write(Clipboard clipboard) throws IOException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java similarity index 64% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SchematicReader.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java index 771d850cf..aaa4b387e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.extent.clipboard.io; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.jnbt.ByteArrayTag; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.IntTag; @@ -31,32 +33,42 @@ import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.extent.clipboard.io.legacycompat.NBTCompatibilityHandler; +import com.sk89q.worldedit.extent.clipboard.io.legacycompat.SignCompatibilityHandler; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; -import com.sk89q.worldedit.world.registry.WorldData; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.entity.EntityType; +import com.sk89q.worldedit.world.entity.EntityTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.storage.NBTConversions; -import javax.annotation.Nullable; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkNotNull; - /** - * Reads schematic files based that are compatible with MCEdit and other editors. + * Reads schematic files that are compatible with MCEdit and other editors. */ -public class SchematicReader implements ClipboardReader { +public class MCEditSchematicReader extends NBTSchematicReader { - private static final Logger log = Logger.getLogger(SchematicReader.class.getCanonicalName()); + private static final List COMPATIBILITY_HANDLERS = new ArrayList<>(); + + static { + COMPATIBILITY_HANDLERS.add(new SignCompatibilityHandler()); + // TODO Add a handler for skulls, flower pots, note blocks, etc. + } + + private static final Logger log = Logger.getLogger(MCEditSchematicReader.class.getCanonicalName()); private final NBTInputStream inputStream; /** @@ -64,13 +76,13 @@ public class SchematicReader implements ClipboardReader { * * @param inputStream the input stream to read from */ - public SchematicReader(NBTInputStream inputStream) { + public MCEditSchematicReader(NBTInputStream inputStream) { checkNotNull(inputStream); this.inputStream = inputStream; } @Override - public Clipboard read(WorldData data) throws IOException { + public Clipboard read() throws IOException { // Schematic tag NamedTag rootTag = inputStream.readNamedTag(); if (!rootTag.getName().equals("Schematic")) { @@ -151,7 +163,7 @@ public class SchematicReader implements ClipboardReader { // Need to pull out tile entities List tileEntities = requireTag(schematic, "TileEntities", ListTag.class).getValue(); - Map> tileEntitiesMap = new HashMap>(); + Map> tileEntitiesMap = new HashMap<>(); for (Tag tag : tileEntities) { if (!(tag instanceof CompoundTag)) continue; @@ -161,26 +173,40 @@ public class SchematicReader implements ClipboardReader { int y = 0; int z = 0; - Map values = new HashMap(); + Map values = new HashMap<>(); for (Map.Entry entry : t.getValue().entrySet()) { - if (entry.getKey().equals("x")) { - if (entry.getValue() instanceof IntTag) { - x = ((IntTag) entry.getValue()).getValue(); - } - } else if (entry.getKey().equals("y")) { - if (entry.getValue() instanceof IntTag) { - y = ((IntTag) entry.getValue()).getValue(); - } - } else if (entry.getKey().equals("z")) { - if (entry.getValue() instanceof IntTag) { - z = ((IntTag) entry.getValue()).getValue(); - } + switch (entry.getKey()) { + case "x": + if (entry.getValue() instanceof IntTag) { + x = ((IntTag) entry.getValue()).getValue(); + } + break; + case "y": + if (entry.getValue() instanceof IntTag) { + y = ((IntTag) entry.getValue()).getValue(); + } + break; + case "z": + if (entry.getValue() instanceof IntTag) { + z = ((IntTag) entry.getValue()).getValue(); + } + break; } values.put(entry.getKey(), entry.getValue()); } + int index = y * width * length + z * width + x; + BlockState block = LegacyMapper.getInstance().getBlockFromLegacy(blocks[index], blockData[index]); + if (block != null) { + for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) { + if (handler.isAffectedBlock(block)) { + handler.updateNBT(block, values); + } + } + } + BlockVector vec = new BlockVector(x, y, z); tileEntitiesMap.put(vec, values); } @@ -196,14 +222,18 @@ public class SchematicReader implements ClipboardReader { for (int z = 0; z < length; ++z) { int index = y * width * length + z * width + x; BlockVector pt = new BlockVector(x, y, z); - BaseBlock block = new BaseBlock(blocks[index], blockData[index]); - - if (tileEntitiesMap.containsKey(pt)) { - block.setNbtData(new CompoundTag(tileEntitiesMap.get(pt))); - } + BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(blocks[index], blockData[index]); try { - clipboard.setBlock(region.getMinimumPoint().add(pt), block); + if (state != null) { + if (tileEntitiesMap.containsKey(pt)) { + clipboard.setBlock(region.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt)))); + } else { + clipboard.setBlock(region.getMinimumPoint().add(pt), state); + } + } else { + log.warning("Unknown block when pasting schematic: " + blocks[index] + ":" + blockData[index] + ". Please report this issue."); + } } catch (WorldEditException e) { switch (failedBlockSets) { case 0: @@ -231,12 +261,17 @@ public class SchematicReader implements ClipboardReader { for (Tag tag : entityTags) { if (tag instanceof CompoundTag) { CompoundTag compound = (CompoundTag) tag; - String id = compound.getString("id"); + String id = convertEntityId(compound.getString("id")); Location location = NBTConversions.toLocation(clipboard, compound.getListTag("Pos"), compound.getListTag("Rotation")); if (!id.isEmpty()) { - BaseEntity state = new BaseEntity(id, compound); - clipboard.createEntity(location, state); + EntityType entityType = EntityTypes.get(id.toLowerCase()); + if (entityType != null) { + BaseEntity state = new BaseEntity(entityType, compound); + clipboard.createEntity(location, state); + } else { + log.warning("Unknown entity when pasting schematic: " + id.toLowerCase()); + } } } } @@ -246,33 +281,38 @@ public class SchematicReader implements ClipboardReader { return clipboard; } - private static T requireTag(Map items, String key, Class expected) throws IOException { - if (!items.containsKey(key)) { - throw new IOException("Schematic file is missing a \"" + key + "\" tag"); + private String convertEntityId(String id) { + switch(id) { + case "xp_orb": + return "experience_orb"; + case "xp_bottle": + return "experience_bottle"; + case "eye_of_ender_signal": + return "eye_of_ender"; + case "ender_crystal": + return "end_crystal"; + case "fireworks_rocket": + return "firework_rocket"; + case "commandblock_minecart": + return "command_block_minecart"; + case "snowman": + return "snow_golem"; + case "villager_golem": + return "iron_golem"; + case "evocation_fangs": + return "evoker_fangs"; + case "evocation_illager": + return "evoker"; + case "vindication_illager": + return "vindicator"; + case "illusion_illager": + return "illusioner"; } - - Tag tag = items.get(key); - if (!expected.isInstance(tag)) { - throw new IOException(key + " tag is not of tag type " + expected.getName()); - } - - return expected.cast(tag); + return id; } - @Nullable - private static T getTag(CompoundTag tag, Class expected, String key) { - Map items = tag.getValue(); - - if (!items.containsKey(key)) { - return null; - } - - Tag test = items.get(key); - if (!expected.isInstance(test)) { - return null; - } - - return expected.cast(test); + @Override + public void close() throws IOException { + inputStream.close(); } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java new file mode 100644 index 000000000..424dffcc6 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java @@ -0,0 +1,63 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extent.clipboard.io; + +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.Tag; + +import java.io.IOException; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Base class for NBT schematic readers + */ +public abstract class NBTSchematicReader implements ClipboardReader { + + protected static T requireTag(Map items, String key, Class expected) throws IOException { + if (!items.containsKey(key)) { + throw new IOException("Schematic file is missing a \"" + key + "\" tag"); + } + + Tag tag = items.get(key); + if (!expected.isInstance(tag)) { + throw new IOException(key + " tag is not of tag type " + expected.getName()); + } + + return expected.cast(tag); + } + + @Nullable + protected static T getTag(CompoundTag tag, Class expected, String key) { + Map items = tag.getValue(); + + if (!items.containsKey(key)) { + return null; + } + + Tag test = items.get(key); + if (!expected.isInstance(test)) { + return null; + } + + return expected.cast(test); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SchematicWriter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SchematicWriter.java deleted file mode 100644 index b3546e4d5..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SchematicWriter.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.extent.clipboard.io; - -import com.sk89q.jnbt.ByteArrayTag; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.DoubleTag; -import com.sk89q.jnbt.FloatTag; -import com.sk89q.jnbt.IntTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.NBTOutputStream; -import com.sk89q.jnbt.ShortTag; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.entity.BaseEntity; -import com.sk89q.worldedit.entity.Entity; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.util.Location; -import com.sk89q.worldedit.world.registry.WorldData; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Writes schematic files based that are compatible with MCEdit and other editors. - */ -public class SchematicWriter implements ClipboardWriter { - - private static final int MAX_SIZE = Short.MAX_VALUE - Short.MIN_VALUE; - private final NBTOutputStream outputStream; - - /** - * Create a new schematic writer. - * - * @param outputStream the output stream to write to - */ - public SchematicWriter(NBTOutputStream outputStream) { - checkNotNull(outputStream); - this.outputStream = outputStream; - } - - @Override - public void write(Clipboard clipboard, WorldData data) throws IOException { - Region region = clipboard.getRegion(); - Vector origin = clipboard.getOrigin(); - Vector min = region.getMinimumPoint(); - Vector offset = min.subtract(origin); - int width = region.getWidth(); - int height = region.getHeight(); - int length = region.getLength(); - - if (width > MAX_SIZE) { - throw new IllegalArgumentException("Width of region too large for a .schematic"); - } - if (height > MAX_SIZE) { - throw new IllegalArgumentException("Height of region too large for a .schematic"); - } - if (length > MAX_SIZE) { - throw new IllegalArgumentException("Length of region too large for a .schematic"); - } - - // ==================================================================== - // Metadata - // ==================================================================== - - HashMap schematic = new HashMap(); - schematic.put("Width", new ShortTag((short) width)); - schematic.put("Length", new ShortTag((short) length)); - schematic.put("Height", new ShortTag((short) height)); - schematic.put("Materials", new StringTag("Alpha")); - schematic.put("WEOriginX", new IntTag(min.getBlockX())); - schematic.put("WEOriginY", new IntTag(min.getBlockY())); - schematic.put("WEOriginZ", new IntTag(min.getBlockZ())); - schematic.put("WEOffsetX", new IntTag(offset.getBlockX())); - schematic.put("WEOffsetY", new IntTag(offset.getBlockY())); - schematic.put("WEOffsetZ", new IntTag(offset.getBlockZ())); - - // ==================================================================== - // Block handling - // ==================================================================== - - byte[] blocks = new byte[width * height * length]; - byte[] addBlocks = null; - byte[] blockData = new byte[width * height * length]; - List tileEntities = new ArrayList(); - - for (Vector point : region) { - Vector relative = point.subtract(min); - int x = relative.getBlockX(); - int y = relative.getBlockY(); - int z = relative.getBlockZ(); - - int index = y * width * length + z * width + x; - BaseBlock block = clipboard.getBlock(point); - - // Save 4096 IDs in an AddBlocks section - if (block.getType() > 255) { - if (addBlocks == null) { // Lazily create section - addBlocks = new byte[(blocks.length >> 1) + 1]; - } - - addBlocks[index >> 1] = (byte) (((index & 1) == 0) ? - addBlocks[index >> 1] & 0xF0 | (block.getType() >> 8) & 0xF - : addBlocks[index >> 1] & 0xF | ((block.getType() >> 8) & 0xF) << 4); - } - - blocks[index] = (byte) block.getType(); - blockData[index] = (byte) block.getData(); - - // Store TileEntity data - CompoundTag rawTag = block.getNbtData(); - if (rawTag != null) { - Map values = new HashMap(); - for (Entry entry : rawTag.getValue().entrySet()) { - values.put(entry.getKey(), entry.getValue()); - } - - values.put("id", new StringTag(block.getNbtId())); - values.put("x", new IntTag(x)); - values.put("y", new IntTag(y)); - values.put("z", new IntTag(z)); - - CompoundTag tileEntityTag = new CompoundTag(values); - tileEntities.add(tileEntityTag); - } - } - - schematic.put("Blocks", new ByteArrayTag(blocks)); - schematic.put("Data", new ByteArrayTag(blockData)); - schematic.put("TileEntities", new ListTag(CompoundTag.class, tileEntities)); - - if (addBlocks != null) { - schematic.put("AddBlocks", new ByteArrayTag(addBlocks)); - } - - // ==================================================================== - // Entities - // ==================================================================== - - List entities = new ArrayList(); - for (Entity entity : clipboard.getEntities()) { - BaseEntity state = entity.getState(); - - if (state != null) { - Map values = new HashMap(); - - // Put NBT provided data - CompoundTag rawTag = state.getNbtData(); - if (rawTag != null) { - values.putAll(rawTag.getValue()); - } - - // Store our location data, overwriting any - values.put("id", new StringTag(state.getTypeId())); - values.put("Pos", writeVector(entity.getLocation().toVector(), "Pos")); - values.put("Rotation", writeRotation(entity.getLocation(), "Rotation")); - - CompoundTag entityTag = new CompoundTag(values); - entities.add(entityTag); - } - } - - schematic.put("Entities", new ListTag(CompoundTag.class, entities)); - - // ==================================================================== - // Output - // ==================================================================== - - CompoundTag schematicTag = new CompoundTag(schematic); - outputStream.writeNamedTag("Schematic", schematicTag); - } - - private Tag writeVector(Vector vector, String name) { - List list = new ArrayList(); - list.add(new DoubleTag(vector.getX())); - list.add(new DoubleTag(vector.getY())); - list.add(new DoubleTag(vector.getZ())); - return new ListTag(DoubleTag.class, list); - } - - private Tag writeRotation(Location location, String name) { - List list = new ArrayList(); - list.add(new FloatTag(location.getYaw())); - list.add(new FloatTag(location.getPitch())); - return new ListTag(FloatTag.class, list); - } - - @Override - public void close() throws IOException { - outputStream.close(); - } -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java new file mode 100644 index 000000000..c66203025 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java @@ -0,0 +1,230 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extent.clipboard.io; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.collect.Maps; +import com.sk89q.jnbt.ByteArrayTag; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.IntArrayTag; +import com.sk89q.jnbt.IntTag; +import com.sk89q.jnbt.ListTag; +import com.sk89q.jnbt.NBTInputStream; +import com.sk89q.jnbt.NamedTag; +import com.sk89q.jnbt.ShortTag; +import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; +import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.extent.clipboard.io.legacycompat.NBTCompatibilityHandler; +import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.world.block.BlockState; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +/** + * Reads schematic files using the Sponge Schematic Specification. + */ +public class SpongeSchematicReader extends NBTSchematicReader { + + private static final List COMPATIBILITY_HANDLERS = new ArrayList<>(); + + static { + // If NBT Compat handlers are needed - add them here. + } + + private static final Logger log = Logger.getLogger(SpongeSchematicReader.class.getCanonicalName()); + private final NBTInputStream inputStream; + + /** + * Create a new instance. + * + * @param inputStream the input stream to read from + */ + public SpongeSchematicReader(NBTInputStream inputStream) { + checkNotNull(inputStream); + this.inputStream = inputStream; + } + + @Override + public Clipboard read() throws IOException { + NamedTag rootTag = inputStream.readNamedTag(); + if (!rootTag.getName().equals("Schematic")) { + throw new IOException("Tag 'Schematic' does not exist or is not first"); + } + CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); + + // Check + Map schematic = schematicTag.getValue(); + int version = requireTag(schematic, "Version", IntTag.class).getValue(); + switch (version) { + case 1: + return readVersion1(schematic); + default: + throw new IOException("This schematic version is currently not supported"); + } + } + + private Clipboard readVersion1(Map schematic) throws IOException { + Vector origin; + Region region; + + Map metadata = requireTag(schematic, "Metadata", CompoundTag.class).getValue(); + + int width = requireTag(schematic, "Width", ShortTag.class).getValue(); + int height = requireTag(schematic, "Height", ShortTag.class).getValue(); + int length = requireTag(schematic, "Length", ShortTag.class).getValue(); + + int[] offsetParts = requireTag(schematic, "Offset", IntArrayTag.class).getValue(); + if (offsetParts.length != 3) { + throw new IOException("Invalid offset specified in schematic."); + } + + Vector min = new Vector(offsetParts[0], offsetParts[1], offsetParts[2]); + + if (metadata.containsKey("WEOffsetX")) { + // We appear to have WorldEdit Metadata + int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue(); + int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue(); + int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue(); + Vector offset = new Vector(offsetX, offsetY, offsetZ); + origin = min.subtract(offset); + region = new CuboidRegion(origin, origin.add(width, height, length).subtract(Vector.ONE)); + } else { + origin = min; + region = new CuboidRegion(origin, origin.add(width, height, length).subtract(Vector.ONE)); + } + + int paletteMax = requireTag(schematic, "PaletteMax", IntTag.class).getValue(); + Map paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue(); + if (paletteObject.size() != paletteMax) { + throw new IOException("Differing given palette size to actual size"); + } + + Map palette = new HashMap<>(); + + ParserContext parserContext = new ParserContext(); + parserContext.setRestricted(false); + parserContext.setTryLegacy(false); + parserContext.setPreferringWildcard(false); + + for (String palettePart : paletteObject.keySet()) { + int id = requireTag(paletteObject, palettePart, IntTag.class).getValue(); + BlockState state; + try { + state = WorldEdit.getInstance().getBlockFactory().parseFromInput(palettePart, parserContext).toImmutableState(); + } catch (InputParseException e) { + throw new IOException("Invalid BlockState in schematic: " + palettePart + ". Are you missing a mod of using a schematic made in a newer version of Minecraft?"); + } + palette.put(id, state); + } + + byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue(); + + Map> tileEntitiesMap = new HashMap<>(); + try { + List> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream() + .map(tag -> (CompoundTag) tag) + .map(CompoundTag::getValue) + .collect(Collectors.toList()); + + for (Map tileEntity : tileEntityTags) { + int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); + tileEntitiesMap.put(origin.add(new BlockVector(pos[0], pos[1], pos[2])).toBlockVector(), tileEntity); + } + } catch (Exception e) { + throw new IOException("Failed to load Tile Entities: " + e.getMessage()); + } + + BlockArrayClipboard clipboard = new BlockArrayClipboard(region); + clipboard.setOrigin(origin); + + int index = 0; + int i = 0; + int value = 0; + int varintLength = 0; + while (i < blocks.length) { + value = 0; + varintLength = 0; + + while (true) { + value |= (blocks[i] & 127) << (varintLength++ * 7); + if (varintLength > 5) { + throw new RuntimeException("VarInt too big (probably corrupted data)"); + } + if ((blocks[i] & 128) != 128) { + i++; + break; + } + i++; + } + // index = (y * length + z) * width + x + int y = origin.getBlockY() + index / (width * length); + int z = origin.getBlockZ() + (index % (width * length)) / width; + int x = origin.getBlockX() + (index % (width * length)) % width; + BlockState state = palette.get(value); + BlockVector pt = new BlockVector(x, y, z); + try { + if (tileEntitiesMap.containsKey(pt)) { + Map values = Maps.newHashMap(tileEntitiesMap.get(pt)); + for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) { + if (handler.isAffectedBlock(state)) { + handler.updateNBT(state, values); + } + } + values.put("x", new IntTag(pt.getBlockX())); + values.put("y", new IntTag(pt.getBlockY())); + values.put("z", new IntTag(pt.getBlockZ())); + values.put("id", values.get("Id")); + values.remove("Id"); + values.remove("Pos"); + clipboard.setBlock(pt, state.toBaseBlock(new CompoundTag(values))); + } else { + clipboard.setBlock(pt, state); + } + } catch (WorldEditException e) { + throw new IOException("Failed to load a block in the schematic"); + } + + index++; + } + + return clipboard; + } + + @Override + public void close() throws IOException { + inputStream.close(); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java new file mode 100644 index 000000000..8ed384e5e --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java @@ -0,0 +1,190 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extent.clipboard.io; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.jnbt.ByteArrayTag; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.IntArrayTag; +import com.sk89q.jnbt.IntTag; +import com.sk89q.jnbt.ListTag; +import com.sk89q.jnbt.NBTOutputStream; +import com.sk89q.jnbt.ShortTag; +import com.sk89q.jnbt.StringTag; +import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.regions.Region; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Writes schematic files using the Sponge schematic format. + */ +public class SpongeSchematicWriter implements ClipboardWriter { + + private static final int MAX_SIZE = Short.MAX_VALUE - Short.MIN_VALUE; + private final NBTOutputStream outputStream; + + /** + * Create a new schematic writer. + * + * @param outputStream the output stream to write to + */ + public SpongeSchematicWriter(NBTOutputStream outputStream) { + checkNotNull(outputStream); + this.outputStream = outputStream; + } + + @Override + public void write(Clipboard clipboard) throws IOException { + // For now always write the latest version. Maybe provide support for earlier if more appear. + outputStream.writeNamedTag("Schematic", new CompoundTag(write1(clipboard))); + } + + /** + * Writes a version 1 schematic file. + * + * @param clipboard The clipboard + * @return The schematic map + * @throws IOException If an error occurs + */ + private Map write1(Clipboard clipboard) throws IOException { + Region region = clipboard.getRegion(); + Vector origin = clipboard.getOrigin(); + Vector min = region.getMinimumPoint(); + Vector offset = min.subtract(origin); + int width = region.getWidth(); + int height = region.getHeight(); + int length = region.getLength(); + + if (width > MAX_SIZE) { + throw new IllegalArgumentException("Width of region too large for a .schematic"); + } + if (height > MAX_SIZE) { + throw new IllegalArgumentException("Height of region too large for a .schematic"); + } + if (length > MAX_SIZE) { + throw new IllegalArgumentException("Length of region too large for a .schematic"); + } + + Map schematic = new HashMap<>(); + schematic.put("Version", new IntTag(1)); + + Map metadata = new HashMap<>(); + metadata.put("WEOffsetX", new IntTag(offset.getBlockX())); + metadata.put("WEOffsetY", new IntTag(offset.getBlockY())); + metadata.put("WEOffsetZ", new IntTag(offset.getBlockZ())); + + schematic.put("Metadata", new CompoundTag(metadata)); + + schematic.put("Width", new ShortTag((short) width)); + schematic.put("Height", new ShortTag((short) height)); + schematic.put("Length", new ShortTag((short) length)); + + // The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin' + schematic.put("Offset", new IntArrayTag(new int[]{ + min.getBlockX(), + min.getBlockY(), + min.getBlockZ(), + })); + + int paletteMax = 0; + Map palette = new HashMap<>(); + + List tileEntities = new ArrayList<>(); + + ByteArrayOutputStream buffer = new ByteArrayOutputStream(width * height * length); + + for (int y = 0; y < height; y++) { + int y0 = min.getBlockY() + y; + for (int z = 0; z < length; z++) { + int z0 = min.getBlockZ() + z; + for (int x = 0; x < width; x++) { + int x0 = min.getBlockX() + x; + BlockVector point = new BlockVector(x0, y0, z0); + BaseBlock block = clipboard.getFullBlock(point); + if (block.getNbtData() != null) { + Map values = new HashMap<>(); + for (Map.Entry entry : block.getNbtData().getValue().entrySet()) { + values.put(entry.getKey(), entry.getValue()); + } + + values.remove("id"); // Remove 'id' if it exists. We want 'Id' + + // Positions are kept in NBT, we don't want that. + values.remove("x"); + values.remove("y"); + values.remove("z"); + + values.put("Id", new StringTag(block.getNbtId())); + values.put("Pos", new IntArrayTag(new int[]{ + x, + y, + z + })); + + tileEntities.add(new CompoundTag(values)); + } + + String blockKey = block.toImmutableState().getAsString(); + int blockId; + if (palette.containsKey(blockKey)) { + blockId = palette.get(blockKey); + } else { + blockId = paletteMax; + palette.put(blockKey, blockId); + paletteMax++; + } + + while ((blockId & -128) != 0) { + buffer.write(blockId & 127 | 128); + blockId >>>= 7; + } + buffer.write(blockId); + } + } + } + + schematic.put("PaletteMax", new IntTag(paletteMax)); + + Map paletteTag = new HashMap<>(); + palette.forEach((key, value) -> paletteTag.put(key, new IntTag(value))); + + schematic.put("Palette", new CompoundTag(paletteTag)); + schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray())); + schematic.put("TileEntities", new ListTag(CompoundTag.class, tileEntities)); + + return schematic; + } + + @Override + public void close() throws IOException { + outputStream.close(); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/NBTCompatibilityHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/NBTCompatibilityHandler.java new file mode 100644 index 000000000..16a60c80d --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/NBTCompatibilityHandler.java @@ -0,0 +1,30 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extent.clipboard.io.legacycompat; + +import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.world.block.BlockStateHolder; + +import java.util.Map; + +public interface NBTCompatibilityHandler { + boolean isAffectedBlock(BlockStateHolder block); + void updateNBT(BlockStateHolder block, Map values); +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java new file mode 100644 index 000000000..ae2d5f055 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java @@ -0,0 +1,72 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extent.clipboard.io.legacycompat; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSyntaxException; +import com.sk89q.jnbt.StringTag; +import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; + +import java.util.Map; + +public class SignCompatibilityHandler implements NBTCompatibilityHandler { + @Override + public boolean isAffectedBlock(BlockStateHolder block) { + return block.getBlockType() == BlockTypes.SIGN || block.getBlockType() == BlockTypes.WALL_SIGN; + } + + @Override + public void updateNBT(BlockStateHolder block, Map values) { + for (int i = 0; i < 4; ++i) { + String key = "Text" + (i + 1); + Tag value = values.get(key); + if (value instanceof StringTag) { + String storedString = ((StringTag) value).getValue(); + JsonElement jsonElement = null; + if (storedString != null && storedString.startsWith("{")) { + try { + jsonElement = new JsonParser().parse(storedString); + } catch (JsonSyntaxException ex) { + // ignore: jsonElement will be null in the next check + } + } + if (jsonElement == null) { + jsonElement = new JsonPrimitive(storedString == null ? "" : storedString); + } + if (jsonElement.isJsonObject()) { + continue; + } + + if (jsonElement.isJsonNull()) { + jsonElement = new JsonPrimitive(""); + } + + JsonObject jsonTextObject = new JsonObject(); + jsonTextObject.add("text", jsonElement); + values.put("Text" + (i + 1), new StringTag(jsonTextObject.toString())); + } + } + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java index 969ecbd84..d55771266 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java @@ -19,8 +19,9 @@ package com.sk89q.worldedit.extent.inventory; -import com.sk89q.worldedit.WorldVector; -import com.sk89q.worldedit.blocks.*; +import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypes; /** * Represents a source to get blocks from and store removed ones. @@ -30,147 +31,95 @@ public abstract class BlockBag { /** * Stores a block as if it was mined. * - * @param id the type ID - * @throws BlockBagException on error - * @deprecated Use {@link BlockBag#storeDroppedBlock(int, int)} instead - */ - @Deprecated - public void storeDroppedBlock(int id) throws BlockBagException { - storeDroppedBlock(id, 0); - } - - /** - * Stores a block as if it was mined. - * - * @param id the type ID - * @param data the data value + * @param blockState the block state * @throws BlockBagException on error */ - public void storeDroppedBlock(int id, int data) throws BlockBagException { - BaseItem dropped = BlockType.getBlockBagItem(id, data); + public void storeDroppedBlock(BlockState blockState) throws BlockBagException { + BlockState dropped = blockState; // TODO BlockType.getBlockBagItem(id, data); if (dropped == null) return; - if (dropped.getType() == BlockID.AIR) return; + if (dropped.getBlockType() == BlockTypes.AIR) return; - storeItem(dropped); + storeBlock(dropped); } /** * Sets a block as if it was placed by hand. * - * @param id the type ID - * @throws BlockBagException on error - * @deprecated Use {@link #fetchPlacedBlock(int,int)} instead - */ - @Deprecated - public void fetchPlacedBlock(int id) throws BlockBagException { - fetchPlacedBlock(id, 0); - } - - /** - * Sets a block as if it was placed by hand. - * - * @param id the type ID - * @param data the data value + * @param blockState The block state * @throws BlockBagException on error */ - public void fetchPlacedBlock(int id, int data) throws BlockBagException { + public void fetchPlacedBlock(BlockState blockState) throws BlockBagException { try { // Blocks that can't be fetched... - switch (id) { - case BlockID.BEDROCK: - case BlockID.GOLD_ORE: - case BlockID.IRON_ORE: - case BlockID.COAL_ORE: - case BlockID.DIAMOND_ORE: - case BlockID.TNT: - case BlockID.MOB_SPAWNER: - case BlockID.CROPS: - case BlockID.REDSTONE_ORE: - case BlockID.GLOWING_REDSTONE_ORE: - case BlockID.SNOW: - case BlockID.LIGHTSTONE: - case BlockID.PORTAL: - throw new UnplaceableBlockException(); - - case BlockID.WATER: - case BlockID.STATIONARY_WATER: - case BlockID.LAVA: - case BlockID.STATIONARY_LAVA: - // Override liquids - return; - - default: - fetchBlock(id); - break; - } - +// TODO switch (id) { +// case BlockID.BEDROCK: +// case BlockID.GOLD_ORE: +// case BlockID.IRON_ORE: +// case BlockID.COAL_ORE: +// case BlockID.DIAMOND_ORE: +// case BlockID.TNT: +// case BlockID.MOB_SPAWNER: +// case BlockID.CROPS: +// case BlockID.REDSTONE_ORE: +// case BlockID.GLOWING_REDSTONE_ORE: +// case BlockID.SNOW: +// case BlockID.LIGHTSTONE: +// case BlockID.PORTAL: +// throw new UnplaceableBlockException(); +// +// case BlockID.WATER: +// case BlockID.STATIONARY_WATER: +// case BlockID.LAVA: +// case BlockID.STATIONARY_LAVA: +// // Override liquids +// return; +// } + fetchBlock(blockState); } catch (OutOfBlocksException e) { - BaseItem placed = BlockType.getBlockBagItem(id, data); - if (placed == null) throw e; // TODO: check - if (placed.getType() == BlockID.AIR) throw e; // TODO: check + BlockState placed = blockState;// TODO BlockType.getBlockBagItem(id, data); + if (placed == null || placed.getBlockType() == BlockTypes.AIR) throw e; // TODO: check - fetchItem(placed); + fetchBlock(placed); } } /** * Get a block. * - *

Either this method or fetchItem needs to be overridden.

- * - * @param id the type ID + * @param blockState the block state * @throws BlockBagException on error */ - public void fetchBlock(int id) throws BlockBagException { - fetchItem(new BaseItem(id)); - } + public abstract void fetchBlock(BlockState blockState) throws BlockBagException; /** - * Get a block. + * Store a block. * - *

Either this method or fetchItem needs to be overridden.

- * - * @param item the item + * @param blockState The block state * @throws BlockBagException on error */ - public void fetchItem(BaseItem item) throws BlockBagException { - fetchBlock(item.getType()); + public void storeBlock(BlockState blockState) throws BlockBagException { + this.storeBlock(blockState, 1); } /** * Store a block. * - *

Either this method or fetchItem needs to be overridden.

- * - * @param id the type ID + * @param blockState The block state + * @param amount The amount * @throws BlockBagException on error */ - public void storeBlock(int id) throws BlockBagException { - storeItem(new BaseItem(id)); - } - - /** - * Store a block. - * - *

Either this method or fetchItem needs to be overridden.

- * - * @param item the item - * @throws BlockBagException on error - */ - public void storeItem(BaseItem item) throws BlockBagException { - storeBlock(item.getType()); - } + public abstract void storeBlock(BlockState blockState, int amount) throws BlockBagException; /** * Checks to see if a block exists without removing it. * - * @param id the type ID + * @param blockState the block state * @return whether the block exists */ - public boolean peekBlock(int id) { + public boolean peekBlock(BlockState blockState) { try { - fetchBlock(id); - storeBlock(id); + fetchBlock(blockState); + storeBlock(blockState); return true; } catch (BlockBagException e) { return false; @@ -187,12 +136,12 @@ public abstract class BlockBag { * * @param pos the position */ - public abstract void addSourcePosition(WorldVector pos); + public abstract void addSourcePosition(Location pos); /** * Adds a position to be used a source. * * @param pos the position */ - public abstract void addSingleSourcePosition(WorldVector pos); + public abstract void addSingleSourcePosition(Location pos); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java index 9cdc2b3ae..343181e25 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java @@ -21,20 +21,24 @@ package com.sk89q.worldedit.extent.inventory; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.Map; +import javax.annotation.Nullable; + /** * Applies a {@link BlockBag} to operations. */ public class BlockBagExtent extends AbstractDelegateExtent { - private Map missingBlocks = new HashMap(); + private Map missingBlocks = new HashMap<>(); private BlockBag blockBag; /** @@ -72,37 +76,35 @@ public class BlockBagExtent extends AbstractDelegateExtent { * * @return a map of missing blocks */ - public Map popMissing() { - Map missingBlocks = this.missingBlocks; - this.missingBlocks = new HashMap(); + public Map popMissing() { + Map missingBlocks = this.missingBlocks; + this.missingBlocks = new HashMap<>(); return missingBlocks; } @Override - public boolean setBlock(Vector position, BaseBlock block) throws WorldEditException { + public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException { if (blockBag != null) { - BaseBlock lazyBlock = getExtent().getLazyBlock(position); - int existing = lazyBlock.getType(); - final int type = block.getType(); + BlockState existing = getExtent().getBlock(position); - if (type > 0) { + if (block.getBlockType() != BlockTypes.AIR) { try { - blockBag.fetchPlacedBlock(type, 0); + blockBag.fetchPlacedBlock(block.toImmutableState()); } catch (UnplaceableBlockException e) { return false; } catch (BlockBagException e) { - if (!missingBlocks.containsKey(type)) { - missingBlocks.put(type, 1); + if (!missingBlocks.containsKey(block.getBlockType())) { + missingBlocks.put(block.getBlockType(), 1); } else { - missingBlocks.put(type, missingBlocks.get(type) + 1); + missingBlocks.put(block.getBlockType(), missingBlocks.get(block.getBlockType()) + 1); } return false; } } - if (existing > 0) { + if (existing.getBlockType() != BlockTypes.AIR) { try { - blockBag.storeDroppedBlock(existing, lazyBlock.getData()); + blockBag.storeDroppedBlock(existing); } catch (BlockBagException ignored) { } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java index 27eb6d1f4..fece9656c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java @@ -19,28 +19,30 @@ package com.sk89q.worldedit.extent.inventory; +import com.sk89q.worldedit.world.block.BlockType; + /** * Thrown when the target inventory of a block bag is full. */ public class OutOfSpaceException extends BlockBagException { - private int id; + private BlockType type; /** * Construct the object. * - * @param id the ID of the block + * @param type the type of the block */ - public OutOfSpaceException(int id) { - this.id = id; + public OutOfSpaceException(BlockType type) { + this.type = type; } /** - * Get the ID of the block + * Get the type of the block * - * @return the id + * @return the type */ - public int getID() { - return id; + public BlockType getType() { + return this.type; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/logging/AbstractLoggingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/logging/AbstractLoggingExtent.java deleted file mode 100644 index 41aae000c..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/logging/AbstractLoggingExtent.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.extent.logging; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.extent.AbstractDelegateExtent; -import com.sk89q.worldedit.extent.Extent; - -/** - * An abstract class to implement block loggers and so on with. - */ -public abstract class AbstractLoggingExtent extends AbstractDelegateExtent { - - /** - * Create a new instance. - * - * @param extent the extent - */ - protected AbstractLoggingExtent(Extent extent) { - super(extent); - } - - /** - * Called when a block is being changed. - * - * @param position the position - * @param newBlock the new block to replace the old one - */ - protected void onBlockChange(Vector position, BaseBlock newBlock) { - } - - @Override - public final boolean setBlock(Vector position, BaseBlock block) throws WorldEditException { - onBlockChange(position, block); - return super.setBlock(position, block); - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index d19a4b6c6..57be96226 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -24,27 +24,37 @@ import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.PlayerDirection; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.blocks.Blocks; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.operation.BlockMapEntryPlacer; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.OperationQueue; import com.sk89q.worldedit.function.operation.RunContext; +import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.collection.TupleArrayList; +import com.sk89q.worldedit.world.block.BlockCategories; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; -import java.util.*; +import java.util.Deque; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; /** * Re-orders blocks into several stages. */ public class MultiStageReorder extends AbstractDelegateExtent implements ReorderingExtent { - private TupleArrayList stage1 = new TupleArrayList(); - private TupleArrayList stage2 = new TupleArrayList(); - private TupleArrayList stage3 = new TupleArrayList(); + private TupleArrayList stage1 = new TupleArrayList<>(); + private TupleArrayList stage2 = new TupleArrayList<>(); + private TupleArrayList stage3 = new TupleArrayList<>(); private boolean enabled; /** @@ -86,28 +96,28 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder } @Override - public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { - BaseBlock lazyBlock = getLazyBlock(location); + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + BlockState existing = getBlock(location); if (!enabled) { return super.setBlock(location, block); } - if (BlockType.shouldPlaceLast(block.getType())) { + if (Blocks.shouldPlaceLast(block.getBlockType())) { // Place torches, etc. last stage2.put(location.toBlockVector(), block); - return !(lazyBlock.getType() == block.getType() && lazyBlock.getData() == block.getData()); - } else if (BlockType.shouldPlaceFinal(block.getType())) { + return !existing.equalsFuzzy(block); + } else if (Blocks.shouldPlaceFinal(block.getBlockType())) { // Place signs, reed, etc even later stage3.put(location.toBlockVector(), block); - return !(lazyBlock.getType() == block.getType() && lazyBlock.getData() == block.getData()); - } else if (BlockType.shouldPlaceLast(lazyBlock.getType())) { + return !existing.equalsFuzzy(block); + } else if (Blocks.shouldPlaceLast(existing.getBlockType())) { // Destroy torches, etc. first - super.setBlock(location, new BaseBlock(BlockID.AIR)); + super.setBlock(location, BlockTypes.AIR.getDefaultState()); return super.setBlock(location, block); } else { stage1.put(location.toBlockVector(), block); - return !(lazyBlock.getType() == block.getType() && lazyBlock.getData() == block.getData()); + return !existing.equalsFuzzy(block); } } @@ -126,9 +136,9 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder public Operation resume(RunContext run) throws WorldEditException { Extent extent = getExtent(); - final Set blocks = new HashSet(); - final Map blockTypes = new HashMap(); - for (Map.Entry entry : stage3) { + final Set blocks = new HashSet<>(); + final Map blockTypes = new HashMap<>(); + for (Map.Entry entry : stage3) { final BlockVector pt = entry.getKey(); blocks.add(pt); blockTypes.put(pt, entry.getValue()); @@ -140,49 +150,32 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder continue; } - final Deque walked = new LinkedList(); + final Deque walked = new LinkedList<>(); while (true) { walked.addFirst(current); assert (blockTypes.containsKey(current)); - final BaseBlock baseBlock = blockTypes.get(current); + final BlockStateHolder blockStateHolder = blockTypes.get(current); - final int type = baseBlock.getType(); - final int data = baseBlock.getData(); - - switch (type) { - case BlockID.WOODEN_DOOR: - case BlockID.ACACIA_DOOR: - case BlockID.BIRCH_DOOR: - case BlockID.JUNGLE_DOOR: - case BlockID.DARK_OAK_DOOR: - case BlockID.SPRUCE_DOOR: - case BlockID.IRON_DOOR: - if ((data & 0x8) == 0) { - // Deal with lower door halves being attached to the floor AND the upper half - BlockVector upperBlock = current.add(0, 1, 0).toBlockVector(); - if (blocks.contains(upperBlock) && !walked.contains(upperBlock)) { - walked.addFirst(upperBlock); - } + if (BlockCategories.DOORS.contains(blockStateHolder.getBlockType())) { + Property halfProperty = blockStateHolder.getBlockType().getProperty("half"); + if (blockStateHolder.getState(halfProperty).equals("lower")) { + // Deal with lower door halves being attached to the floor AND the upper half + BlockVector upperBlock = current.add(0, 1, 0).toBlockVector(); + if (blocks.contains(upperBlock) && !walked.contains(upperBlock)) { + walked.addFirst(upperBlock); } - break; - - case BlockID.MINECART_TRACKS: - case BlockID.POWERED_RAIL: - case BlockID.DETECTOR_RAIL: - case BlockID.ACTIVATOR_RAIL: - // Here, rails are hardcoded to be attached to the block below them. - // They're also attached to the block they're ascending towards via BlockType.getAttachment. - BlockVector lowerBlock = current.add(0, -1, 0).toBlockVector(); - if (blocks.contains(lowerBlock) && !walked.contains(lowerBlock)) { - walked.addFirst(lowerBlock); - } - break; + } + } else if (BlockCategories.RAILS.contains(blockStateHolder.getBlockType())) { + BlockVector lowerBlock = current.add(0, -1, 0).toBlockVector(); + if (blocks.contains(lowerBlock) && !walked.contains(lowerBlock)) { + walked.addFirst(lowerBlock); + } } - final PlayerDirection attachment = BlockType.getAttachment(type, data); + final PlayerDirection attachment = BlockType.getAttachment(blockStateHolder.getBlockType().getLegacyId(), 0); // TODO if (attachment == null) { // Block is not attached to anything => we can place it break; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java index dc634ed2f..7b44ce4b5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java @@ -19,20 +19,21 @@ package com.sk89q.worldedit.extent.transform; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.transform.Transform; -import com.sk89q.worldedit.world.registry.BlockRegistry; -import com.sk89q.worldedit.world.registry.State; -import com.sk89q.worldedit.world.registry.StateValue; +import com.sk89q.worldedit.registry.state.DirectionalProperty; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.util.Direction; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; import javax.annotation.Nullable; -import java.util.Map; - -import static com.google.common.base.Preconditions.checkNotNull; /** * Transforms blocks themselves (but not their position) according to a @@ -43,20 +44,16 @@ public class BlockTransformExtent extends AbstractDelegateExtent { private static final double RIGHT_ANGLE = Math.toRadians(90); private final Transform transform; - private final BlockRegistry blockRegistry; /** * Create a new instance. * * @param extent the extent - * @param blockRegistry the block registry used for block direction data */ - public BlockTransformExtent(Extent extent, Transform transform, BlockRegistry blockRegistry) { + public BlockTransformExtent(Extent extent, Transform transform) { super(extent); checkNotNull(transform); - checkNotNull(blockRegistry); this.transform = transform; - this.blockRegistry = blockRegistry; } /** @@ -75,24 +72,23 @@ public class BlockTransformExtent extends AbstractDelegateExtent { * @param reverse true to transform in the opposite direction * @return the same block */ - private BaseBlock transformBlock(BaseBlock block, boolean reverse) { - transform(block, reverse ? transform.inverse() : transform, blockRegistry); - return block; + private T transformBlock(T block, boolean reverse) { + return transform(block, reverse ? transform.inverse() : transform); } @Override - public BaseBlock getBlock(Vector position) { + public BlockState getBlock(Vector position) { return transformBlock(super.getBlock(position), false); } @Override - public BaseBlock getLazyBlock(Vector position) { - return transformBlock(super.getLazyBlock(position), false); + public BaseBlock getFullBlock(Vector position) { + return transformBlock(super.getFullBlock(position), false); } @Override - public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { - return super.setBlock(location, transformBlock(new BaseBlock(block), true)); + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + return super.setBlock(location, transformBlock(block, true)); } @@ -103,11 +99,10 @@ public class BlockTransformExtent extends AbstractDelegateExtent { * * @param block the block * @param transform the transform - * @param registry the registry * @return the same block */ - public static BaseBlock transform(BaseBlock block, Transform transform, BlockRegistry registry) { - return transform(block, transform, registry, block); + public static T transform(T block, Transform transform) { + return transform(block, transform, block); } /** @@ -115,28 +110,20 @@ public class BlockTransformExtent extends AbstractDelegateExtent { * * @param block the block * @param transform the transform - * @param registry the registry * @param changedBlock the block to change * @return the changed block */ - private static BaseBlock transform(BaseBlock block, Transform transform, BlockRegistry registry, BaseBlock changedBlock) { + private static T transform(T block, Transform transform, T changedBlock) { checkNotNull(block); checkNotNull(transform); - checkNotNull(registry); - Map states = registry.getStates(block); - - if (states == null) { - return changedBlock; - } - - for (State state : states.values()) { - if (state.hasDirection()) { - StateValue value = state.getValue(block); - if (value != null && value.getDirection() != null) { - StateValue newValue = getNewStateValue(state, transform, value.getDirection()); + for (Property property : block.getBlockType().getProperties()) { + if (property instanceof DirectionalProperty) { + Direction value = (Direction) block.getState(property); + if (value != null) { + Vector newValue = getNewStateValue((DirectionalProperty) property, transform, value.toVector()); if (newValue != null) { - newValue.set(changedBlock); + changedBlock = (T) changedBlock.with(property, Direction.findClosest(newValue, Direction.Flag.ALL)); } } } @@ -154,20 +141,18 @@ public class BlockTransformExtent extends AbstractDelegateExtent { * @return a new state or null if none could be found */ @Nullable - private static StateValue getNewStateValue(State state, Transform transform, Vector oldDirection) { + private static Vector getNewStateValue(DirectionalProperty state, Transform transform, Vector oldDirection) { Vector newDirection = transform.apply(oldDirection).subtract(transform.apply(Vector.ZERO)).normalize(); - StateValue newValue = null; + Vector newValue = null; double closest = -2; boolean found = false; - for (StateValue v : state.valueMap().values()) { - if (v.getDirection() != null) { - double dot = v.getDirection().normalize().dot(newDirection); - if (dot >= closest) { - closest = dot; - newValue = v; - found = true; - } + for (Direction v : state.getValues()) { + double dot = v.toVector().normalize().dot(newDirection); + if (dot >= closest) { + closest = dot; + newValue = v.toVector(); + found = true; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java index fc18d7257..c3332a250 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.extent.validation; +import static com.google.common.base.Preconditions.checkArgument; + import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; - -import static com.google.common.base.Preconditions.checkArgument; +import com.sk89q.worldedit.world.block.BlockStateHolder; /** * Limits the number of blocks that can be changed before a @@ -77,7 +77,7 @@ public class BlockChangeLimiter extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { if (limit >= 0) { if (count >= limit) { throw new MaxChangedBlocksException(limit); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java index e9a2752fa..ffb2b175a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java @@ -19,14 +19,15 @@ package com.sk89q.worldedit.extent.validation; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.World; - -import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; /** * Validates set data to prevent creating invalid blocks and such. @@ -48,28 +49,19 @@ public class DataValidatorExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { final int y = location.getBlockY(); - final int type = block.getType(); + final BlockType type = block.getBlockType(); if (y < 0 || y > world.getMaxY()) { return false; } // No invalid blocks - if (!world.isValidBlockType(type)) { + if (type == null) { return false; } - if (block.getData() < 0) { - throw new SevereValidationException("Cannot set a data value that is less than 0"); - } - return super.setBlock(location, block); } - private static class SevereValidationException extends WorldEditException { - private SevereValidationException(String message) { - super(message); - } - } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java index 46a40ed5c..25591defb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java @@ -19,16 +19,16 @@ package com.sk89q.worldedit.extent.world; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; -import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.World; - -import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; /** * Handles various quirks when setting blocks, such as ice turning @@ -51,14 +51,13 @@ public class BlockQuirkExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector position, BaseBlock block) throws WorldEditException { - BaseBlock lazyBlock = getExtent().getLazyBlock(position); - int existing = lazyBlock.getType(); + public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException { + BlockType existing = getExtent().getBlock(position).getBlockType(); - if (BlockType.isContainerBlock(existing)) { + if (existing.getMaterial().hasContainer()) { world.clearContainerBlockContents(position); // Clear the container block so that it doesn't drop items - } else if (existing == BlockID.ICE) { - world.setBlock(position, new BaseBlock(BlockID.AIR)); // Ice turns until water so this has to be done first + } else if (existing == BlockTypes.ICE) { + world.setBlock(position, BlockTypes.AIR.getDefaultState()); // Ice turns until water so this has to be done first } return super.setBlock(position, block); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java index f417a3c7f..845276a58 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.extent.world; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.World; - -import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.world.block.BlockStateHolder; /** * Automatically loads chunks when blocks are accessed. @@ -61,7 +61,7 @@ public class ChunkLoadingExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { world.checkLoadedChunk(location); return super.setBlock(location, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java index 42306a99d..9ad839a32 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java @@ -19,28 +19,28 @@ package com.sk89q.worldedit.extent.world; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.RunContext; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.HashSet; import java.util.List; import java.util.Set; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Implements "fast mode" which may skip physics, lighting, etc. */ public class FastModeExtent extends AbstractDelegateExtent { private final World world; - private final Set dirtyChunks = new HashSet(); + private final Set dirtyChunks = new HashSet<>(); private boolean enabled = true; /** @@ -84,7 +84,7 @@ public class FastModeExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { if (enabled) { dirtyChunks.add(new BlockVector2D(location.getBlockX() >> 4, location.getBlockZ() >> 4)); return world.setBlock(location, block, false); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java index de7c21b2c..97d8ee9c3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java @@ -19,15 +19,15 @@ package com.sk89q.worldedit.extent.world; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.World; - -import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; /** * Makes changes to the world as if a player had done so during survival mode. @@ -80,8 +80,8 @@ public class SurvivalModeExtent extends AbstractDelegateExtent { } @Override - public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { - if (toolUse && block.getType() == BlockID.AIR) { + public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException { + if (toolUse && block.getBlockType() == BlockTypes.AIR) { world.simulateBlockMine(location); return true; } else { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java index 4f6957c5a..ba853eba9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java @@ -19,19 +19,22 @@ package com.sk89q.worldedit.function; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import java.util.*; - -import static com.google.common.base.Preconditions.checkNotNull; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; /** * Executes several region functions in order. */ public class CombinedRegionFunction implements RegionFunction { - private final List functions = new ArrayList(); + private final List functions = new ArrayList<>(); /** * Create a combined region function. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java index d9ee8c917..07c1515ba 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/EditContext.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.function; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.regions.Region; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; - public class EditContext { private Extent destination; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java index 35a9802e4..ff287632c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.mask.Mask2D; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Passes calls to {@link #apply(com.sk89q.worldedit.Vector2D)} to the * delegate {@link com.sk89q.worldedit.function.FlatRegionFunction} if they diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java index ae130d6c6..2b14b57b2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.mask.Mask; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Applies a {@link RegionFunction} to the first ground block. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java index 1f773a188..673d411d2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.mask.Mask; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Passes calls to {@link #apply(com.sk89q.worldedit.Vector)} to the * delegate {@link com.sk89q.worldedit.function.RegionFunction} if they diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java index f877adce5..ac5fdf98d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.function.biome; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.FlatRegionFunction; import com.sk89q.worldedit.world.biome.BaseBiome; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Replaces the biome at the locations that this function is applied to. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java index a95c512e6..0013ade94 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.function.block; -import com.sk89q.worldedit.extent.Extent; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.pattern.Pattern; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Replaces blocks with a given pattern. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java index 94e39cd0c..223b419b3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java @@ -19,11 +19,13 @@ package com.sk89q.worldedit.function.block; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTagBuilder; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.internal.helper.MCDirections; @@ -31,8 +33,6 @@ import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Direction.Flag; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Copies blocks from one extent to another. */ @@ -68,7 +68,7 @@ public class ExtentBlockCopy implements RegionFunction { @Override public boolean apply(Vector position) throws WorldEditException { - BaseBlock block = source.getBlock(position); + BaseBlock block = source.getFullBlock(position); Vector orig = position.subtract(from); Vector transformed = transform.apply(orig); @@ -104,7 +104,7 @@ public class ExtentBlockCopy implements RegionFunction { builder.putByte("Rot", (byte) MCDirections.toRotation(newDirection)); - return new BaseBlock(state.getId(), state.getData(), builder.build()); + return state.toBaseBlock(builder.build()); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java index 5817e67ad..1c56d8a4f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java @@ -19,16 +19,16 @@ package com.sk89q.worldedit.function.block; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.collect.Sets; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.LayerFunction; -import com.sk89q.worldedit.masks.BlockMask; -import com.sk89q.worldedit.masks.Mask; - -import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.world.block.BlockTypes; /** * Makes a layer of grass on top, three layers of dirt below, and smooth stone @@ -38,10 +38,7 @@ import static com.google.common.base.Preconditions.checkNotNull; public class Naturalizer implements LayerFunction { private final EditSession editSession; - private final BaseBlock grass = new BaseBlock(BlockID.GRASS); - private final BaseBlock dirt = new BaseBlock(BlockID.DIRT); - private final BaseBlock stone = new BaseBlock(BlockID.STONE); - private final Mask mask = new BlockMask(grass, dirt, stone); + private final Mask mask; private int affected = 0; /** @@ -52,6 +49,11 @@ public class Naturalizer implements LayerFunction { public Naturalizer(EditSession editSession) { checkNotNull(editSession); this.editSession = editSession; + this.mask = new BlockMask(editSession, Sets.newHashSet( + BlockTypes.GRASS_BLOCK.getDefaultState(), + BlockTypes.DIRT.getDefaultState(), + BlockTypes.STONE.getDefaultState() + )); } /** @@ -65,24 +67,24 @@ public class Naturalizer implements LayerFunction { @Override public boolean isGround(Vector position) { - return mask.matches(editSession, position); + return mask.test(position); } @Override public boolean apply(Vector position, int depth) throws WorldEditException { - if (mask.matches(editSession, position)) { + if (mask.test(position)) { affected++; switch (depth) { case 0: - editSession.setBlock(position, grass); + editSession.setBlock(position, BlockTypes.GRASS_BLOCK.getDefaultState()); break; case 1: case 2: case 3: - editSession.setBlock(position, dirt); + editSession.setBlock(position, BlockTypes.DIRT.getDefaultState()); break; default: - editSession.setBlock(position, stone); + editSession.setBlock(position, BlockTypes.STONE.getDefaultState()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java index 58663ab3c..e157de444 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.function.entity; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTagBuilder; import com.sk89q.worldedit.Vector; @@ -33,8 +35,6 @@ import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Direction.Flag; import com.sk89q.worldedit.util.Location; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Copies entities provided to the function to the provided destination * {@code Extent}. @@ -167,7 +167,7 @@ public class ExtentEntityCopy implements EntityFunction { } } - return new BaseEntity(state.getTypeId(), builder.build()); + return new BaseEntity(state.getType(), builder.build()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java index b7695b795..324fe72f1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.function.factory; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; + import com.sk89q.worldedit.function.Contextual; import com.sk89q.worldedit.function.EditContext; import com.sk89q.worldedit.function.RegionFunction; @@ -27,9 +30,6 @@ import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.regions.NullRegion; import com.sk89q.worldedit.regions.Region; -import static com.google.common.base.Objects.firstNonNull; -import static com.google.common.base.Preconditions.checkNotNull; - public class Apply implements Contextual { private final Region region; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java index 1c206843c..d80ad4570 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java @@ -19,7 +19,9 @@ package com.sk89q.worldedit.function.factory; -import com.google.common.base.Objects; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; + import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; @@ -35,8 +37,6 @@ import com.sk89q.worldedit.regions.Region; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - public class Deform implements Contextual { private Extent destination; @@ -123,7 +123,7 @@ public class Deform implements Contextual { final Vector zero; Vector unit; - Region region = Objects.firstNonNull(context.getRegion(), this.region); + Region region = firstNonNull(context.getRegion(), this.region); switch (mode) { case UNIT_CUBE: diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Paint.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Paint.java index fe9c80a83..908608b81 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Paint.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Paint.java @@ -19,6 +19,12 @@ package com.sk89q.worldedit.function.factory; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.regions.Regions.asFlatRegion; +import static com.sk89q.worldedit.regions.Regions.maximumBlockY; +import static com.sk89q.worldedit.regions.Regions.minimumBlockY; +import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; + import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.function.Contextual; @@ -33,10 +39,6 @@ import com.sk89q.worldedit.math.noise.RandomNoise; import com.sk89q.worldedit.regions.NullRegion; import com.sk89q.worldedit.regions.Region; -import static com.google.common.base.Objects.firstNonNull; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.regions.Regions.*; - public class Paint implements Contextual { private final Extent destination; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java index 17d2547d6..3f6265de7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java @@ -22,12 +22,12 @@ package com.sk89q.worldedit.function.generator; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.RandomPattern; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; /** * Generates flora (which may include tall grass, flowers, etc.). @@ -83,9 +83,9 @@ public class FloraGenerator implements RegionFunction { */ public static Pattern getDesertPattern() { RandomPattern pattern = new RandomPattern(); - pattern.add(new BlockPattern(new BaseBlock(BlockID.DEAD_BUSH)), 30); - pattern.add(new BlockPattern(new BaseBlock(BlockID.CACTUS)), 20); - pattern.add(new BlockPattern(new BaseBlock(BlockID.AIR)), 300); + pattern.add(new BlockPattern(BlockTypes.DEAD_BUSH.getDefaultState()), 30); + pattern.add(new BlockPattern(BlockTypes.CACTUS.getDefaultState()), 20); + pattern.add(new BlockPattern(BlockTypes.AIR.getDefaultState()), 300); return pattern; } @@ -96,20 +96,20 @@ public class FloraGenerator implements RegionFunction { */ public static Pattern getTemperatePattern() { RandomPattern pattern = new RandomPattern(); - pattern.add(new BlockPattern(new BaseBlock(BlockID.LONG_GRASS, 1)), 300); - pattern.add(new BlockPattern(new BaseBlock(BlockID.RED_FLOWER)), 5); - pattern.add(new BlockPattern(new BaseBlock(BlockID.YELLOW_FLOWER)), 5); + pattern.add(new BlockPattern(BlockTypes.GRASS.getDefaultState()), 300); + pattern.add(new BlockPattern(BlockTypes.POPPY.getDefaultState()), 5); + pattern.add(new BlockPattern(BlockTypes.DANDELION.getDefaultState()), 5); return pattern; } @Override public boolean apply(Vector position) throws WorldEditException { - BaseBlock block = editSession.getBlock(position); + BlockStateHolder block = editSession.getBlock(position); - if (block.getType() == BlockID.GRASS) { + if (block.getBlockType() == BlockTypes.GRASS_BLOCK) { editSession.setBlock(position.add(0, 1, 0), temperatePattern.apply(position)); return true; - } else if (block.getType() == BlockID.SAND) { + } else if (block.getBlockType() == BlockTypes.SAND) { editSession.setBlock(position.add(0, 1, 0), desertPattern.apply(position)); return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java index cf38b7e56..bf37a4d9c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java @@ -22,10 +22,11 @@ package com.sk89q.worldedit.function.generator; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.util.TreeGenerator; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; /** * Generates forests by searching for the ground starting from the given upper Y @@ -33,34 +34,34 @@ import com.sk89q.worldedit.util.TreeGenerator; */ public class ForestGenerator implements RegionFunction { - private final TreeGenerator treeGenerator; + private final TreeGenerator.TreeType treeType; private final EditSession editSession; /** * Create a new instance. * * @param editSession the edit session - * @param treeGenerator a tree generator + * @param treeType a tree generator */ - public ForestGenerator(EditSession editSession, TreeGenerator treeGenerator) { + public ForestGenerator(EditSession editSession, TreeGenerator.TreeType treeType) { this.editSession = editSession; - this.treeGenerator = treeGenerator; + this.treeType = treeType; } @Override public boolean apply(Vector position) throws WorldEditException { - BaseBlock block = editSession.getBlock(position); - int t = block.getType(); + BlockStateHolder block = editSession.getBlock(position); + BlockType t = block.getBlockType(); - if (t == BlockID.GRASS || t == BlockID.DIRT) { - treeGenerator.generate(editSession, position.add(0, 1, 0)); + if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) { + treeType.generate(editSession, position.add(0, 1, 0)); return true; - } else if (t == BlockID.LONG_GRASS || t == BlockID.DEAD_BUSH || t == BlockID.RED_FLOWER || t == BlockID.YELLOW_FLOWER) { // TODO: This list needs to be moved - editSession.setBlock(position, new BaseBlock(0)); - treeGenerator.generate(editSession, position); + } else if (t == BlockTypes.GRASS || t == BlockTypes.DEAD_BUSH || t == BlockTypes.POPPY || t == BlockTypes.DANDELION) { // TODO: This list needs to be moved + editSession.setBlock(position, BlockTypes.AIR.getDefaultState()); + treeType.generate(editSession, position); return true; - } else if (t == BlockID.SNOW) { - editSession.setBlock(position, new BaseBlock(BlockID.AIR)); + } else if (t == BlockTypes.SNOW) { + editSession.setBlock(position, BlockTypes.AIR.getDefaultState()); return false; } else { // Trees won't grow on this! return false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java index a0032585c..b23af44ac 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java @@ -23,12 +23,12 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.RandomPattern; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.Random; @@ -86,25 +86,25 @@ public class GardenPatchGenerator implements RegionFunction { */ private void placeVine(Vector basePos, Vector pos) throws MaxChangedBlocksException { if (pos.distance(basePos) > 4) return; - if (editSession.getBlockType(pos) != 0) return; + if (editSession.getBlock(pos).getBlockType() != BlockTypes.AIR) return; for (int i = -1; i > -3; --i) { Vector testPos = pos.add(0, i, 0); - if (editSession.getBlockType(testPos) == BlockID.AIR) { + if (editSession.getBlock(testPos).getBlockType() == BlockTypes.AIR) { pos = testPos; } else { break; } } - editSession.setBlockIfAir(pos, new BaseBlock(BlockID.LEAVES)); + setBlockIfAir(editSession, pos, BlockTypes.OAK_LEAVES.getDefaultState()); affected++; int t = random.nextInt(4); int h = random.nextInt(3) - 1; Vector p; - BaseBlock log = new BaseBlock(BlockID.LOG); + BlockState log = BlockTypes.OAK_LOG.getDefaultState(); switch (t) { case 0: @@ -112,10 +112,10 @@ public class GardenPatchGenerator implements RegionFunction { placeVine(basePos, pos.add(1, 0, 0)); } if (random.nextBoolean()) { - editSession.setBlockIfAir(pos.add(1, h, -1), log); + setBlockIfAir(editSession, pos.add(1, h, -1), log); affected++; } - editSession.setBlockIfAir(p = pos.add(0, 0, -1), plant.apply(p)); + setBlockIfAir(editSession, p = pos.add(0, 0, -1), plant.apply(p)); affected++; break; @@ -124,10 +124,10 @@ public class GardenPatchGenerator implements RegionFunction { placeVine(basePos, pos.add(0, 0, 1)); } if (random.nextBoolean()) { - editSession.setBlockIfAir(pos.add(1, h, 0), log); + setBlockIfAir(editSession, pos.add(1, h, 0), log); affected++; } - editSession.setBlockIfAir(p = pos.add(1, 0, 1), plant.apply(p)); + setBlockIfAir(editSession, p = pos.add(1, 0, 1), plant.apply(p)); affected++; break; @@ -136,10 +136,10 @@ public class GardenPatchGenerator implements RegionFunction { placeVine(basePos, pos.add(0, 0, -1)); } if (random.nextBoolean()) { - editSession.setBlockIfAir(pos.add(-1, h, 0), log); + setBlockIfAir(editSession, pos.add(-1, h, 0), log); affected++; } - editSession.setBlockIfAir(p = pos.add(-1, 0, 1), plant.apply(p)); + setBlockIfAir(editSession, p = pos.add(-1, 0, 1), plant.apply(p)); affected++; break; @@ -148,10 +148,10 @@ public class GardenPatchGenerator implements RegionFunction { placeVine(basePos, pos.add(-1, 0, 0)); } if (random.nextBoolean()) { - editSession.setBlockIfAir(pos.add(-1, h, -1), log); + setBlockIfAir(editSession, pos.add(-1, h, -1), log); affected++; } - editSession.setBlockIfAir(p = pos.add(-1, 0, -1), plant.apply(p)); + setBlockIfAir(editSession, p = pos.add(-1, 0, -1), plant.apply(p)); affected++; break; } @@ -159,17 +159,19 @@ public class GardenPatchGenerator implements RegionFunction { @Override public boolean apply(Vector position) throws WorldEditException { - if (editSession.getBlock(position).getType() != BlockID.AIR) { + if (editSession.getBlock(position).getBlockType() != BlockTypes.AIR) { position = position.add(0, 1, 0); } - if (editSession.getBlock(position.add(0, -1, 0)).getType() != BlockID.GRASS) { + if (editSession.getBlock(position.add(0, -1, 0)).getBlockType() != BlockTypes.GRASS_BLOCK) { return false; } - BaseBlock leavesBlock = new BaseBlock(BlockID.LEAVES); + BlockState leavesBlock = BlockTypes.OAK_LEAVES.getDefaultState(); - editSession.setBlockIfAir(position, leavesBlock); + if (editSession.getBlock(position).getBlockType() == BlockTypes.AIR) { + editSession.setBlock(position, leavesBlock); + } placeVine(position, position.add(0, 0, 1)); placeVine(position, position.add(0, 0, -1)); @@ -185,11 +187,19 @@ public class GardenPatchGenerator implements RegionFunction { * @return a pumpkin pattern */ public static Pattern getPumpkinPattern() { - RandomPattern pattern = new RandomPattern(); - for (int i = 0; i < 4; i++) { - pattern.add(new BlockPattern(new BaseBlock(BlockID.PUMPKIN, i)), 100); - } - return pattern; + return new BlockPattern(BlockTypes.PUMPKIN.getDefaultState()); + } + + /** + * Set a block only if there's no block already there. + * + * @param position the position + * @param block the block to set + * @return if block was changed + * @throws MaxChangedBlocksException thrown if too many blocks are changed + */ + private static boolean setBlockIfAir(EditSession session, Vector position, BlockStateHolder block) throws MaxChangedBlocksException { + return session.getBlock(position).getBlockType() == BlockTypes.AIR && session.setBlock(position, block); } /** @@ -198,6 +208,6 @@ public class GardenPatchGenerator implements RegionFunction { * @return a melon pattern */ public static Pattern getMelonPattern() { - return new BlockPattern(new BaseBlock(BlockID.MELON_BLOCK)); + return new BlockPattern(BlockTypes.MELON.getDefaultState()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractExtentMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractExtentMask.java index 3a7d89aa2..dbb3f28cc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractExtentMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractExtentMask.java @@ -19,10 +19,10 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.extent.Extent; - import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.extent.Extent; + /** * An abstract implementation of {@link Mask} that takes uses an {@link Extent}. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java index 75240db18..d7bf33c8a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.function.mask; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.biome.BaseBiome; @@ -28,15 +30,13 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Tests true if the biome at applied points is the same as the one given. */ public class BiomeMask2D extends AbstractMask2D { private final Extent extent; - private final Set biomes = new HashSet(); + private final Set biomes = new HashSet<>(); /** * Create a new biome mask. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java index bd2e1c831..0eee90887 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java @@ -19,17 +19,18 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.world.block.BlockStateHolder; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Set; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * A mask that checks whether blocks at the given positions are matched by @@ -40,7 +41,7 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class BlockMask extends AbstractExtentMask { - private final Set blocks = new HashSet(); + private final Set blocks = new HashSet<>(); /** * Create a new block mask. @@ -48,7 +49,7 @@ public class BlockMask extends AbstractExtentMask { * @param extent the extent * @param blocks a list of blocks to match */ - public BlockMask(Extent extent, Collection blocks) { + public BlockMask(Extent extent, Collection blocks) { super(extent); checkNotNull(blocks); this.blocks.addAll(blocks); @@ -60,7 +61,7 @@ public class BlockMask extends AbstractExtentMask { * @param extent the extent * @param block an array of blocks to match */ - public BlockMask(Extent extent, BaseBlock... block) { + public BlockMask(Extent extent, BlockStateHolder... block) { this(extent, Arrays.asList(checkNotNull(block))); } @@ -69,7 +70,7 @@ public class BlockMask extends AbstractExtentMask { * * @param blocks a list of blocks */ - public void add(Collection blocks) { + public void add(Collection blocks) { checkNotNull(blocks); this.blocks.addAll(blocks); } @@ -79,7 +80,7 @@ public class BlockMask extends AbstractExtentMask { * * @param block an array of blocks */ - public void add(BaseBlock... block) { + public void add(BlockStateHolder... block) { add(Arrays.asList(checkNotNull(block))); } @@ -88,14 +89,20 @@ public class BlockMask extends AbstractExtentMask { * * @return a list of blocks */ - public Collection getBlocks() { + public Collection getBlocks() { return blocks; } @Override public boolean test(Vector vector) { - BaseBlock block = getExtent().getBlock(vector); - return blocks.contains(block) || blocks.contains(new BaseBlock(block.getType(), -1)); + BlockStateHolder block = getExtent().getBlock(vector); + for (BlockStateHolder testBlock : blocks) { + if (testBlock.equalsFuzzy(block)) { + return true; + } + } + + return false; } @Nullable diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java index fe35ff1ef..3622926e3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function.mask; +import static com.google.common.base.Preconditions.checkArgument; + import com.sk89q.worldedit.Vector; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkArgument; - /** * Has the criteria where the Y value of passed positions must be within * a certain range of Y values (inclusive). diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java index c3d8f1037..552197d10 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java @@ -19,9 +19,9 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.world.block.BlockTypes; import javax.annotation.Nullable; @@ -42,7 +42,7 @@ public class ExistingBlockMask extends AbstractExtentMask { @Override public boolean test(Vector vector) { - return getExtent().getLazyBlock(vector).getType() != BlockID.AIR; + return getExtent().getBlock(vector).getBlockType() != BlockTypes.AIR; } @Nullable diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java index d1d1e374b..d662e0fa3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.function.mask; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; @@ -27,8 +29,6 @@ import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; - /** * A mask that evaluates an expression. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java index 52fc28c57..2b4031ca8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.function.mask; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; -import static com.google.common.base.Preconditions.checkNotNull; - public class ExpressionMask2D extends AbstractMask2D { private final Expression expression; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java index 19a0b7590..8b47e2c2c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java @@ -20,28 +20,26 @@ package com.sk89q.worldedit.function.mask; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.Blocks; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.Collection; public class FuzzyBlockMask extends BlockMask { - public FuzzyBlockMask(Extent extent, Collection blocks) { + public FuzzyBlockMask(Extent extent, Collection blocks) { super(extent, blocks); } - public FuzzyBlockMask(Extent extent, BaseBlock... block) { + public FuzzyBlockMask(Extent extent, BlockStateHolder... block) { super(extent, block); } @Override public boolean test(Vector vector) { Extent extent = getExtent(); - Collection blocks = getBlocks(); - BaseBlock lazyBlock = extent.getLazyBlock(vector); - BaseBlock compare = new BaseBlock(lazyBlock.getType(), lazyBlock.getData()); - return Blocks.containsFuzzy(blocks, compare); + Collection blocks = getBlocks(); + return Blocks.containsFuzzy(blocks, extent.getFullBlock(vector)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java index d98fdadac..5968b3b6c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java @@ -19,9 +19,10 @@ package com.sk89q.worldedit.function.mask; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -29,7 +30,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Combines several masks and requires that all masks return true @@ -38,7 +39,7 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class MaskIntersection extends AbstractMask { - private final Set masks = new HashSet(); + private final Set masks = new HashSet<>(); /** * Create a new intersection. @@ -105,7 +106,7 @@ public class MaskIntersection extends AbstractMask { @Nullable @Override public Mask2D toMask2D() { - List mask2dList = new ArrayList(); + List mask2dList = new ArrayList<>(); for (Mask mask : masks) { Mask2D mask2d = mask.toMask2D(); if (mask2d != null) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java index 02e605ff9..07e43be38 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.function.mask; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector2D; import java.util.Arrays; @@ -26,14 +28,12 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Tests true if all contained masks test true. */ public class MaskIntersection2D implements Mask2D { - private final Set masks = new HashSet(); + private final Set masks = new HashSet<>(); /** * Create a new intersection. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java index 955ab779e..a54794255 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java @@ -21,11 +21,12 @@ package com.sk89q.worldedit.function.mask; import com.sk89q.worldedit.Vector; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import javax.annotation.Nullable; + /** * Combines several masks and requires that one or more masks return true * when a certain position is tested. It serves as a logical OR operation @@ -67,7 +68,7 @@ public class MaskUnion extends MaskIntersection { @Nullable @Override public Mask2D toMask2D() { - List mask2dList = new ArrayList(); + List mask2dList = new ArrayList<>(); for (Mask mask : getMasks()) { Mask2D mask2d = mask.toMask2D(); if (mask2d != null) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java index b6e94adc2..007520485 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.session.request.Request; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.Vector2D; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Various utility functions related to {@link Mask} and {@link Mask2D}. */ @@ -131,82 +131,6 @@ public final class Masks { }; } - /** - * Wrap an old-style mask and convert it to a new mask. - * - *

Note, however, that this is strongly not recommended because - * {@link com.sk89q.worldedit.masks.Mask#prepare(LocalSession, LocalPlayer, Vector)} - * is not called.

- * - * @param mask the old-style mask - * @param editSession the edit session to bind to - * @return a new-style mask - * @deprecated Please avoid if possible - */ - @Deprecated - @SuppressWarnings("deprecation") - public static Mask wrap(final com.sk89q.worldedit.masks.Mask mask, final EditSession editSession) { - checkNotNull(mask); - return new AbstractMask() { - @Override - public boolean test(Vector vector) { - return mask.matches(editSession, vector); - } - - @Nullable - @Override - public Mask2D toMask2D() { - return null; - } - }; - } - - /** - * Wrap an old-style mask and convert it to a new mask. - * - *

As an {@link EditSession} is not provided in this case, one will be - * taken from the {@link Request}, if possible. If not possible, then the - * mask will return false.

- * - * @param mask the old-style mask - * @return a new-style mask - */ - @SuppressWarnings("deprecation") - public static Mask wrap(final com.sk89q.worldedit.masks.Mask mask) { - checkNotNull(mask); - return new AbstractMask() { - @Override - public boolean test(Vector vector) { - EditSession editSession = Request.request().getEditSession(); - return editSession != null && mask.matches(editSession, vector); - } - - @Nullable - @Override - public Mask2D toMask2D() { - return null; - } - }; - } - - /** - * Convert a new-style mask to an old-style mask. - * - * @param mask the new-style mask - * @return an old-style mask - */ - @SuppressWarnings("deprecation") - public static com.sk89q.worldedit.masks.Mask wrap(final Mask mask) { - checkNotNull(mask); - return new com.sk89q.worldedit.masks.AbstractMask() { - @Override - public boolean matches(EditSession editSession, Vector position) { - Request.request().setEditSession(editSession); - return mask.test(position); - } - }; - } - private static class AlwaysTrue implements Mask, Mask2D { @Override public boolean test(Vector vector) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java index 61dd7b73a..04c793bde 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.function.mask; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.math.noise.NoiseGenerator; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - /** * A mask that uses a noise generator and returns true whenever the noise * generator returns a value above the given density. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java index 6a2146c58..fdcbcd59b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.Vector2D; -import com.sk89q.worldedit.math.noise.NoiseGenerator; - import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.math.noise.NoiseGenerator; + /** * A mask that uses a noise generator and returns true whenever the noise * generator returns a value above the given density. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java index b5358cb30..d8d3d455f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function.mask; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Checks whether another mask tests true for a position that is offset * a given vector. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java index 50d2835ba..74daead9d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java @@ -19,10 +19,10 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.Vector2D; - import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.Vector2D; + /** * Checks whether another mask tests true for a position that is offset * a given vector. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java index 1ddf891fe..7d2d78dfc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.function.mask; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.regions.Region; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; - /** * A mask that tests whether given positions are contained within a region. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java index b6a10972a..917c22f36 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java @@ -19,10 +19,9 @@ package com.sk89q.worldedit.function.mask; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.world.block.BlockState; import javax.annotation.Nullable; @@ -35,8 +34,8 @@ public class SolidBlockMask extends AbstractExtentMask { @Override public boolean test(Vector vector) { Extent extent = getExtent(); - BaseBlock lazyBlock = extent.getLazyBlock(vector); - return !BlockType.canPassThrough(lazyBlock.getType(), lazyBlock.getData()); + BlockState block = extent.getBlock(vector); + return block.getBlockType().getMaterial().isMovementBlocker(); } @Nullable diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BlockMapEntryPlacer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BlockMapEntryPlacer.java index a12850c10..849f3f73f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BlockMapEntryPlacer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BlockMapEntryPlacer.java @@ -19,17 +19,18 @@ package com.sk89q.worldedit.function.operation; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.Iterator; import java.util.List; import java.util.Map; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Sets block from an iterator of {@link Map.Entry} containing a * {@link BlockVector} as the key and a {@link BaseBlock} as the value. @@ -37,7 +38,7 @@ import static com.google.common.base.Preconditions.checkNotNull; public class BlockMapEntryPlacer implements Operation { private final Extent extent; - private final Iterator> iterator; + private final Iterator> iterator; /** * Create a new instance. @@ -45,7 +46,7 @@ public class BlockMapEntryPlacer implements Operation { * @param extent the extent to set the blocks on * @param iterator the iterator */ - public BlockMapEntryPlacer(Extent extent, Iterator> iterator) { + public BlockMapEntryPlacer(Extent extent, Iterator> iterator) { checkNotNull(extent); checkNotNull(iterator); this.extent = extent; @@ -55,7 +56,7 @@ public class BlockMapEntryPlacer implements Operation { @Override public Operation resume(RunContext run) throws WorldEditException { while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); + Map.Entry entry = iterator.next(); extent.setBlock(entry.getKey(), entry.getValue()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java index 93c0348e2..54ea500f0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java @@ -19,16 +19,16 @@ package com.sk89q.worldedit.function.operation; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.history.UndoContext; import com.sk89q.worldedit.history.change.Change; import com.sk89q.worldedit.history.changeset.ChangeSet; -import com.sk89q.worldedit.history.UndoContext; import java.util.Iterator; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Performs an undo or redo from a given {@link ChangeSet}. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java index 509b103c1..69560ec56 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function.operation; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.WorldEditException; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Executes a delegete operation, but returns to another operation upon * completing the delegate. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java index b1fafe611..3a9a38d4e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java @@ -19,9 +19,14 @@ package com.sk89q.worldedit.function.operation; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.collect.Lists; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Entity; +import com.sk89q.worldedit.entity.metadata.EntityProperties; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.CombinedRegionFunction; import com.sk89q.worldedit.function.RegionFunction; @@ -38,9 +43,6 @@ import com.sk89q.worldedit.regions.Region; import java.util.List; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Makes a copy of a portion of one extent to another extent or another point. * @@ -58,6 +60,7 @@ public class ForwardExtentCopy implements Operation { private int repetitions = 1; private Mask sourceMask = Masks.alwaysTrue(); private boolean removingEntities; + private boolean copyingEntities = true; // default to true for backwards compatibility, sort of private RegionFunction sourceFunction = null; private Transform transform = new Identity(); private Transform currentTransform = null; @@ -183,6 +186,24 @@ public class ForwardExtentCopy implements Operation { this.repetitions = repetitions; } + /** + * Return whether entities should be copied along with blocks. + * + * @return true if copying + */ + public boolean isCopyingEntities() { + return copyingEntities; + } + + /** + * Set whether entities should be copied along with blocks. + * + * @param copyingEntities true if copying + */ + public void setCopyingEntities(boolean copyingEntities) { + this.copyingEntities = copyingEntities; + } + /** * Return whether entities that are copied should be removed. * @@ -222,6 +243,8 @@ public class ForwardExtentCopy implements Operation { if (currentTransform == null) { currentTransform = transform; + } else { + currentTransform = currentTransform.combine(transform); } ExtentBlockCopy blockCopy = new ExtentBlockCopy(source, from, destination, to, currentTransform); @@ -229,14 +252,21 @@ public class ForwardExtentCopy implements Operation { RegionFunction function = sourceFunction != null ? new CombinedRegionFunction(filter, sourceFunction) : filter; RegionVisitor blockVisitor = new RegionVisitor(region, function); - ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform); - entityCopy.setRemoving(removingEntities); - List entities = source.getEntities(region); - EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy); - lastVisitor = blockVisitor; - currentTransform = currentTransform.combine(transform); - return new DelegateOperation(this, new OperationQueue(blockVisitor, entityVisitor)); + + if (copyingEntities) { + ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform); + entityCopy.setRemoving(removingEntities); + List entities = Lists.newArrayList(source.getEntities(region)); + entities.removeIf(entity -> { + EntityProperties properties = entity.getFacet(EntityProperties.class); + return properties != null && !properties.isPasteable(); + }); + EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy); + return new DelegateOperation(this, new OperationQueue(blockVisitor, entityVisitor)); + } else { + return new DelegateOperation(this, blockVisitor); + } } else { return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java index 49aa9d637..53e79fa3d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.function.operation; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEditException; @@ -27,15 +29,13 @@ import java.util.Collection; import java.util.Deque; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Executes multiple queues in order. */ public class OperationQueue implements Operation { private final List operations = Lists.newArrayList(); - private final Deque queue = new ArrayDeque(); + private final Deque queue = new ArrayDeque<>(); private Operation current; /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java index 8d088810d..c45b90986 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java @@ -19,24 +19,25 @@ package com.sk89q.worldedit.function.pattern; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; - import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockStateHolder; + /** * A pattern that returns the same {@link BaseBlock} each time. */ public class BlockPattern extends AbstractPattern { - private BaseBlock block; + private BlockStateHolder block; /** * Create a new pattern with the given block. * * @param block the block */ - public BlockPattern(BaseBlock block) { + public BlockPattern(BlockStateHolder block) { setBlock(block); } @@ -45,7 +46,7 @@ public class BlockPattern extends AbstractPattern { * * @return the block that is always returned */ - public BaseBlock getBlock() { + public BlockStateHolder getBlock() { return block; } @@ -54,13 +55,13 @@ public class BlockPattern extends AbstractPattern { * * @param block the block */ - public void setBlock(BaseBlock block) { + public void setBlock(BlockStateHolder block) { checkNotNull(block); this.block = block; } @Override - public BaseBlock apply(Vector position) { + public BlockStateHolder apply(Vector position) { return block; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java index c16718330..6f08d5b34 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function.pattern; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.extent.clipboard.Clipboard; - import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.world.block.BlockStateHolder; + /** * A pattern that reads from {@link Clipboard}. */ @@ -45,12 +45,12 @@ public class ClipboardPattern extends AbstractPattern { } @Override - public BaseBlock apply(Vector position) { + public BlockStateHolder apply(Vector position) { int xp = Math.abs(position.getBlockX()) % size.getBlockX(); int yp = Math.abs(position.getBlockY()) % size.getBlockY(); int zp = Math.abs(position.getBlockZ()) % size.getBlockZ(); - return clipboard.getBlock(clipboard.getMinimumPoint().add(new Vector(xp, yp, zp))); + return clipboard.getFullBlock(clipboard.getMinimumPoint().add(new Vector(xp, yp, zp))); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java index 08c74bfde..5b73f720b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java @@ -20,19 +20,19 @@ package com.sk89q.worldedit.function.pattern; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BlockStateHolder; /** - * Returns a {@link BaseBlock} for a given position. + * Returns a {@link BlockStateHolder} for a given position. */ public interface Pattern { /** - * Return a {@link BaseBlock} for the given position. + * Return a {@link BlockStateHolder} for the given position. * * @param position the position * @return a block */ - BaseBlock apply(Vector position); + BlockStateHolder apply(Vector position); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Patterns.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Patterns.java deleted file mode 100644 index 4bb67c610..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Patterns.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.function.pattern; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Utility methods related to {@link Pattern}s. - */ -public final class Patterns { - - private Patterns() { - } - - /** - * Wrap an old-style pattern and return a new pattern. - * - * @param pattern the pattern - * @return a new-style pattern - */ - public static Pattern wrap(final com.sk89q.worldedit.patterns.Pattern pattern) { - checkNotNull(pattern); - return new Pattern() { - @Override - public BaseBlock apply(Vector position) { - return pattern.next(position); - } - }; - } - - /** - * Wrap a new-style pattern and return an old-style pattern. - * - * @param pattern the pattern - * @return an old-style pattern - */ - public static com.sk89q.worldedit.patterns.Pattern wrap(final Pattern pattern) { - checkNotNull(pattern); - return new com.sk89q.worldedit.patterns.Pattern() { - @Override - public BaseBlock next(Vector position) { - return pattern.apply(position); - } - - @Override - public BaseBlock next(int x, int y, int z) { - return next(new Vector(x, y, z)); - } - }; - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java index 992eda5c5..c28c147f9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java @@ -19,22 +19,22 @@ package com.sk89q.worldedit.function.pattern; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.ArrayList; import java.util.List; import java.util.Random; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Uses a random pattern of a weighted list of patterns. */ public class RandomPattern extends AbstractPattern { private final Random random = new Random(); - private List patterns = new ArrayList(); + private List patterns = new ArrayList<>(); private double max = 0; /** @@ -53,7 +53,7 @@ public class RandomPattern extends AbstractPattern { } @Override - public BaseBlock apply(Vector position) { + public BlockStateHolder apply(Vector position) { double r = random.nextDouble(); double offset = 0; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java index 024c674fa..659fef612 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function.pattern; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.extent.Extent; - import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.world.block.BlockStateHolder; + /** * Returns the blocks from {@link Extent}, repeating when out of bounds. */ @@ -83,13 +83,13 @@ public class RepeatingExtentPattern extends AbstractPattern { } @Override - public BaseBlock apply(Vector position) { + public BlockStateHolder apply(Vector position) { Vector base = position.add(offset); Vector size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1); int x = base.getBlockX() % size.getBlockX(); int y = base.getBlockY() % size.getBlockY(); int z = base.getBlockZ() % size.getBlockZ(); - return extent.getBlock(new Vector(x, y, z)); + return extent.getFullBlock(new Vector(x, y, z)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java index c01e9bc9d..6a21a50c3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function.util; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.FlatRegionFunction; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Offsets the position parameter by adding a given offset vector. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java index 4d5338eaf..c1f395be6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function.util; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Offsets the position parameter by adding a given offset vector. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java index b935e0cf6..1601caf40 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java @@ -19,16 +19,22 @@ package com.sk89q.worldedit.function.visitor; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.RegionFunction; +import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.RunContext; -import java.util.*; - -import static com.google.common.base.Preconditions.checkNotNull; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Queue; +import java.util.Set; /** * Performs a breadth-first search starting from points added with @@ -44,9 +50,9 @@ import static com.google.common.base.Preconditions.checkNotNull; public abstract class BreadthFirstSearch implements Operation { private final RegionFunction function; - private final Queue queue = new ArrayDeque(); - private final Set visited = new HashSet(); - private final List directions = new ArrayList(); + private final Queue queue = new ArrayDeque<>(); + private final Set visited = new HashSet<>(); + private final List directions = new ArrayList<>(); private int affected = 0; /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java index ae57a4418..3788d547d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.function.visitor; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; import java.util.Collection; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Visits adjacent points on the same X-Z plane as long as the points * pass the given mask, and then executes the provided region diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java index b4c301ae4..c3ce36567 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.function.visitor; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.EntityFunction; @@ -28,8 +30,6 @@ import com.sk89q.worldedit.function.operation.RunContext; import java.util.Iterator; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Visits entities as provided by an {@code Iterator}. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java index 23dd74e4e..1f0d96e42 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.function.visitor; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.FlatRegionFunction; @@ -28,8 +30,6 @@ import com.sk89q.worldedit.regions.FlatRegion; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Applies region functions to columns in a {@link FlatRegion}. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java index f128b1301..b6dcf4882 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.function.visitor; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; @@ -31,9 +34,6 @@ import com.sk89q.worldedit.regions.FlatRegion; import java.util.List; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Visits the layers within a region. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java index 79bef13b4..ac89393a3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.function.visitor; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; -import static com.google.common.base.Preconditions.checkNotNull; - /** * An implementation of an {@link BreadthFirstSearch} that uses a mask to * determine where a block should be visited. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java index caec36d7d..d6fc7d45c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.function.visitor; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.RegionFunction; +import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.RunContext; import com.sk89q.worldedit.regions.Region; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java index 0b1e91e05..4bb94aa09 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.history.change; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.history.UndoContext; - -import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.world.block.BlockStateHolder; /** * Represents a block change that may be undone or replayed. @@ -37,8 +37,8 @@ import static com.google.common.base.Preconditions.checkNotNull; public class BlockChange implements Change { private final BlockVector position; - private final BaseBlock previous; - private final BaseBlock current; + private final BlockStateHolder previous; + private final BlockStateHolder current; /** * Create a new block change. @@ -47,7 +47,7 @@ public class BlockChange implements Change { * @param previous the previous block * @param current the current block */ - public BlockChange(BlockVector position, BaseBlock previous, BaseBlock current) { + public BlockChange(BlockVector position, BlockStateHolder previous, BlockStateHolder current) { checkNotNull(position); checkNotNull(previous); checkNotNull(current); @@ -70,7 +70,7 @@ public class BlockChange implements Change { * * @return the previous block */ - public BaseBlock getPrevious() { + public BlockStateHolder getPrevious() { return previous; } @@ -79,7 +79,7 @@ public class BlockChange implements Change { * * @return the current block */ - public BaseBlock getCurrent() { + public BlockStateHolder getCurrent() { return current; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/Change.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/Change.java index f9f644fe1..006839291 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/Change.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/Change.java @@ -20,8 +20,8 @@ package com.sk89q.worldedit.history.change; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.history.changeset.ChangeSet; import com.sk89q.worldedit.history.UndoContext; +import com.sk89q.worldedit.history.changeset.ChangeSet; /** * Describes a change that can be undone or re-applied. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java index 80d0bbcaa..e74f0cc84 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.history.change; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.history.UndoContext; import com.sk89q.worldedit.util.Location; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Logs the creation of an entity and removes the entity upon undo. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java index eef480a91..79f79e31a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.history.change; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.history.UndoContext; import com.sk89q.worldedit.util.Location; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Tracks the removal of an entity. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java index 7e980cdd1..bc13a5755 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.history.changeset; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.collect.Lists; import com.sk89q.worldedit.history.change.Change; @@ -26,14 +28,12 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Stores all {@link Change}s in an {@link ArrayList}. */ public class ArrayListHistory implements ChangeSet { - private final List changes = new ArrayList(); + private final List changes = new ArrayList<>(); @Override public void add(Change change) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java index d8286ffb5..3239789bc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java @@ -19,20 +19,20 @@ package com.sk89q.worldedit.history.changeset; +import static com.google.common.base.Preconditions.checkNotNull; +import static java.util.Map.Entry; + import com.google.common.base.Function; import com.google.common.collect.Iterators; import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.history.change.Change; import com.sk89q.worldedit.util.collection.TupleArrayList; +import com.sk89q.worldedit.world.block.BlockStateHolder; import java.util.ArrayList; import java.util.Iterator; -import static com.google.common.base.Preconditions.checkNotNull; -import static java.util.Map.Entry; - /** * An extension of {@link ArrayListHistory} that stores {@link BlockChange}s * separately in two {@link ArrayList}s. @@ -43,8 +43,8 @@ import static java.util.Map.Entry; */ public class BlockOptimizedHistory extends ArrayListHistory { - private final TupleArrayList previous = new TupleArrayList(); - private final TupleArrayList current = new TupleArrayList(); + private final TupleArrayList previous = new TupleArrayList<>(); + private final TupleArrayList current = new TupleArrayList<>(); @Override public void add(Change change) { @@ -85,13 +85,8 @@ public class BlockOptimizedHistory extends ArrayListHistory { * * @return a function */ - private Function, Change> createTransform() { - return new Function, Change>() { - @Override - public Change apply(Entry entry) { - return new BlockChange(entry.getKey(), entry.getValue(), entry.getValue()); - } - }; + private Function, Change> createTransform() { + return entry -> new BlockChange(entry.getKey(), entry.getValue(), entry.getValue()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/LocalWorldAdapter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/LocalWorldAdapter.java deleted file mode 100644 index 2ded7c439..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/LocalWorldAdapter.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.internal; - -import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.LocalWorld; -import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.Vector2D; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.entity.BaseEntity; -import com.sk89q.worldedit.entity.Entity; -import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.function.operation.Operation; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.util.TreeGenerator.TreeType; -import com.sk89q.worldedit.world.World; -import com.sk89q.worldedit.world.biome.BaseBiome; -import com.sk89q.worldedit.world.registry.WorldData; - -import javax.annotation.Nullable; -import java.util.List; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Wraps {@link World}s into {@link LocalWorld}. - */ -@SuppressWarnings("deprecation") -public class LocalWorldAdapter extends LocalWorld { - - private final World world; - - private LocalWorldAdapter(World world) { - checkNotNull(world); - this.world = world; - } - - @Override - public String getName() { - return world.getName(); - } - - @Override - public int getMaxY() { - return world.getMaxY(); - } - - @Override - public boolean isValidBlockType(int id) { - return world.isValidBlockType(id); - } - - @Override - public boolean usesBlockData(int id) { - return world.usesBlockData(id); - } - - @Override - public Mask createLiquidMask() { - return world.createLiquidMask(); - } - - @Override - @Deprecated - public int getBlockType(Vector pt) { - return world.getBlockType(pt); - } - - @Override - @Deprecated - public int getBlockData(Vector pt) { - return world.getBlockData(pt); - } - - @Override - public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException { - return world.setBlock(position, block, notifyAndLight); - } - - @Override - public int getBlockLightLevel(Vector position) { - return world.getBlockLightLevel(position); - } - - @Override - public boolean clearContainerBlockContents(Vector position) { - return world.clearContainerBlockContents(position); - } - - @Override - public BaseBiome getBiome(Vector2D position) { - return world.getBiome(position); - } - - @Override - public boolean setBiome(Vector2D position, BaseBiome biome) { - return world.setBiome(position, biome); - } - - @Override - public void dropItem(Vector position, BaseItemStack item, int count) { - world.dropItem(position, item, count); - } - - @Override - public void dropItem(Vector position, BaseItemStack item) { - world.dropItem(position, item); - } - - @Override - public void simulateBlockMine(Vector position) { - world.simulateBlockMine(position); - } - - @Override - public boolean regenerate(Region region, EditSession editSession) { - return world.regenerate(region, editSession); - } - - @Override - public boolean generateTree(TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException { - return world.generateTree(type, editSession, position); - } - - @Override - @Deprecated - public boolean generateTree(EditSession editSession, Vector position) throws MaxChangedBlocksException { - return world.generateTree(editSession, position); - } - - @Override - @Deprecated - public boolean generateBigTree(EditSession editSession, Vector position) throws MaxChangedBlocksException { - return world.generateBigTree(editSession, position); - } - - @Override - @Deprecated - public boolean generateBirchTree(EditSession editSession, Vector position) throws MaxChangedBlocksException { - return world.generateBirchTree(editSession, position); - } - - @Override - @Deprecated - public boolean generateRedwoodTree(EditSession editSession, Vector position) throws MaxChangedBlocksException { - return world.generateRedwoodTree(editSession, position); - } - - @Override - @Deprecated - public boolean generateTallRedwoodTree(EditSession editSession, Vector position) throws MaxChangedBlocksException { - return world.generateTallRedwoodTree(editSession, position); - } - - @Override - public void checkLoadedChunk(Vector position) { - world.checkLoadedChunk(position); - } - - @Override - public void fixAfterFastMode(Iterable chunks) { - world.fixAfterFastMode(chunks); - } - - @Override - public void fixLighting(Iterable chunks) { - world.fixLighting(chunks); - } - - @Override - public boolean playEffect(Vector position, int type, int data) { - return world.playEffect(position, type, data); - } - - @Override - public boolean queueBlockBreakEffect(Platform server, Vector position, int blockId, double priority) { - return world.queueBlockBreakEffect(server, position, blockId, priority); - } - - @Override - public WorldData getWorldData() { - return world.getWorldData(); - } - - @SuppressWarnings("EqualsWhichDoesntCheckParameterClass") - @Override - public boolean equals(Object other) { - return world.equals(other); - } - - @Override - public int hashCode() { - return world.hashCode(); - } - - @Override - public Vector getMinimumPoint() { - return world.getMinimumPoint(); - } - - @Override - public Vector getMaximumPoint() { - return world.getMaximumPoint(); - } - - @Override - public List getEntities(Region region) { - return world.getEntities(region); - } - - @Override - public BaseBlock getBlock(Vector position) { - return world.getBlock(position); - } - - @Override - public BaseBlock getLazyBlock(Vector position) { - return world.getLazyBlock(position); - } - - @Override - @Nullable - public Operation commit() { - return world.commit(); - } - - @Override - @Nullable - public Entity createEntity(com.sk89q.worldedit.util.Location location, BaseEntity entity) { - return world.createEntity(location, entity); - } - - @Override - public List getEntities() { - return world.getEntities(); - } - - public static LocalWorldAdapter adapt(World world) { - return new LocalWorldAdapter(world); - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/ServerInterfaceAdapter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/ServerInterfaceAdapter.java deleted file mode 100644 index af49c16f4..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/ServerInterfaceAdapter.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.internal; - -import com.sk89q.worldedit.LocalConfiguration; -import com.sk89q.worldedit.ServerInterface; -import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.extension.platform.Capability; -import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.extension.platform.Preference; -import com.sk89q.worldedit.util.command.Dispatcher; -import com.sk89q.worldedit.world.World; - -import javax.annotation.Nullable; -import java.util.List; -import java.util.Map; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Adapts {@link Platform}s into the legacy {@link ServerInterface}. - */ -@SuppressWarnings("ALL") -public class ServerInterfaceAdapter extends ServerInterface { - - private final Platform platform; - - /** - * Create a new adapter. - * - * @param platform the platform - */ - private ServerInterfaceAdapter(Platform platform) { - checkNotNull(platform); - this.platform = platform; - } - - @Override - public int resolveItem(String name) { - return platform.resolveItem(name); - } - - @Override - public boolean isValidMobType(String type) { - return platform.isValidMobType(type); - } - - @Override - public void reload() { - platform.reload(); - } - - @Override - public int schedule(long delay, long period, Runnable task) { - return platform.schedule(delay, period, task); - } - - @Override - public List getWorlds() { - return platform.getWorlds(); - } - - @Nullable - @Override - public Player matchPlayer(Player player) { - return platform.matchPlayer(player); - } - - @Nullable - @Override - public World matchWorld(World world) { - return platform.matchWorld(world); - } - - @Override - public void registerCommands(Dispatcher dispatcher) { - platform.registerCommands(dispatcher); - } - - @Override - public void registerGameHooks() { - } - - @Override - public LocalConfiguration getConfiguration() { - return platform.getConfiguration(); - } - - @Override - public String getVersion() { - return platform.getVersion(); - } - - @Override - public String getPlatformName() { - return platform.getPlatformName(); - } - - @Override - public String getPlatformVersion() { - return platform.getPlatformVersion(); - } - - @Override - public Map getCapabilities() { - return platform.getCapabilities(); - } - - /** - * Adapt an {@link Platform} instance into a {@link ServerInterface}. - * - * @param platform the platform - * @return the server interface - */ - public static ServerInterface adapt(Platform platform) { - return new ServerInterfaceAdapter(platform); - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java index 4633afc52..a6371961f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java @@ -19,10 +19,15 @@ package com.sk89q.worldedit.internal.command; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.Logging; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.IncompleteRegionException; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.util.command.parametric.AbstractInvokeListener; @@ -35,8 +40,6 @@ import java.lang.reflect.Method; import java.util.logging.Handler; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Logs called commands to a logger. */ @@ -99,7 +102,7 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv } if (logMode != null && sender.isPlayer()) { - Vector position = player.getPosition(); + Vector position = player.getLocation().toVector(); LocalSession session = worldEdit.getSessionManager().get(player); switch (logMode) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/UserCommandCompleter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/UserCommandCompleter.java index 63957cbca..a93363295 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/UserCommandCompleter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/UserCommandCompleter.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.internal.command; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.worldedit.extension.platform.Actor; @@ -33,8 +35,6 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Provides the names of connected users as suggestions. */ @@ -56,7 +56,7 @@ public class UserCommandCompleter implements CommandCompleter { public List getSuggestions(String arguments, CommandLocals locals) throws CommandException { Platform platform = platformManager.queryCapability(Capability.USER_COMMANDS); if (platform instanceof MultiUserPlatform) { - List suggestions = new ArrayList(); + List suggestions = new ArrayList<>(); Collection users = ((MultiUserPlatform) platform).getConnectedUsers(); for (Actor user : users) { if (user.getName().toLowerCase().startsWith(arguments.toLowerCase().trim())) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java index fbccb8204..664af4c4e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java @@ -26,12 +26,13 @@ import com.sk89q.worldedit.UnknownDirectionException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.Pattern; @@ -48,6 +49,8 @@ import com.sk89q.worldedit.util.command.parametric.ParameterException; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.Biomes; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.registry.BiomeRegistry; import java.util.Arrays; @@ -166,10 +169,10 @@ public class WorldEditBinding extends BindingHelper { * @throws ParameterException on error * @throws WorldEditException on error */ - @BindingMatch(type = BaseBlock.class, + @BindingMatch(type = {BaseBlock.class, BlockState.class, BlockStateHolder.class}, behavior = BindingBehavior.CONSUMES, consumedCount = 1) - public BaseBlock getBaseBlock(ArgumentStack context) throws ParameterException, WorldEditException { + public BlockStateHolder getBaseBlock(ArgumentStack context) throws ParameterException, WorldEditException { Actor actor = context.getContext().getLocals().get(Actor.class); ParserContext parserContext = new ParserContext(); parserContext.setActor(context.getContext().getLocals().get(Actor.class)); @@ -317,7 +320,8 @@ public class WorldEditBinding extends BindingHelper { throw new ParameterException("An entity is required."); } - BiomeRegistry biomeRegistry = world.getWorldData().getBiomeRegistry(); + BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager() + .queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry(); List knownBiomes = biomeRegistry.getBiomes(); BaseBiome biome = Biomes.findBiomeByName(knownBiomes, input, biomeRegistry); if (biome != null) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditExceptionConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditExceptionConverter.java index 8cd7aa2f6..10294c0a2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditExceptionConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditExceptionConverter.java @@ -19,9 +19,20 @@ package com.sk89q.worldedit.internal.command; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.minecraft.util.commands.CommandException; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.ItemType; +import com.sk89q.worldedit.DisallowedItemException; +import com.sk89q.worldedit.EmptyClipboardException; +import com.sk89q.worldedit.IncompleteRegionException; +import com.sk89q.worldedit.InvalidItemException; +import com.sk89q.worldedit.MaxBrushRadiusException; +import com.sk89q.worldedit.MaxChangedBlocksException; +import com.sk89q.worldedit.MaxRadiusException; +import com.sk89q.worldedit.UnknownDirectionException; +import com.sk89q.worldedit.UnknownItemException; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.command.InsufficientArgumentsException; import com.sk89q.worldedit.command.tool.InvalidToolBindException; import com.sk89q.worldedit.internal.expression.ExpressionException; @@ -35,8 +46,6 @@ import com.sk89q.worldedit.util.io.file.InvalidFilenameException; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static com.google.common.base.Preconditions.checkNotNull; - /** * converts WorldEdit exceptions and converts them into {@link CommandException}s. */ @@ -138,8 +147,7 @@ public class WorldEditExceptionConverter extends ExceptionConverterHelper { @ExceptionMatch public void convert(InvalidToolBindException e) throws CommandException { - throw new CommandException("Can't bind tool to " - + ItemType.toHeldName(e.getItemId()) + ": " + e.getMessage()); + throw new CommandException("Can't bind tool to " + e.getItemType().getName() + ": " + e.getMessage()); } @ExceptionMatch diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java index 5a61709f3..12190d532 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java @@ -68,9 +68,9 @@ import java.util.Stack; */ public class Expression { - private static final ThreadLocal> instance = new ThreadLocal>(); + private static final ThreadLocal> instance = new ThreadLocal<>(); - private final Map variables = new HashMap(); + private final Map variables = new HashMap<>(); private final String[] variableNames; private RValue root; private final Functions functions = new Functions(); @@ -148,7 +148,7 @@ public class Expression { private void pushInstance() { Stack foo = instance.get(); if (foo == null) { - instance.set(foo = new Stack()); + instance.set(foo = new Stack<>()); } foo.push(this); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/lexer/Lexer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/lexer/Lexer.java index 8a3aa4d05..8e5b3bbec 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/lexer/Lexer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/lexer/Lexer.java @@ -102,7 +102,7 @@ public class Lexer { ) ); - private static final Set characterTokens = new HashSet(); + private static final Set characterTokens = new HashSet<>(); static { characterTokens.add(','); characterTokens.add('('); @@ -114,13 +114,14 @@ public class Lexer { characterTokens.add(':'); } - private static final Set keywords = new HashSet(Arrays.asList("if", "else", "while", "do", "for", "break", "continue", "return", "switch", "case", "default")); + private static final Set keywords = + new HashSet<>(Arrays.asList("if", "else", "while", "do", "for", "break", "continue", "return", "switch", "case", "default")); private static final Pattern numberPattern = Pattern.compile("^([0-9]*(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?)"); private static final Pattern identifierPattern = Pattern.compile("^([A-Za-z][0-9A-Za-z_]*)"); private List tokenize() throws LexerException { - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); do { skipWhitespace(); @@ -189,7 +190,7 @@ public class Lexer { public class DecisionTree { private final String tokenName; - private final Map subTrees = new HashMap(); + private final Map subTrees = new HashMap<>(); private DecisionTree(String tokenName, Object... args) { this.tokenName = tokenName; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/parser/Parser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/parser/Parser.java index 3d6b7c30f..24f3dafa9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/parser/Parser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/parser/Parser.java @@ -92,7 +92,7 @@ public class Parser { } private RValue parseStatements(boolean singleStatement) throws ParserException { - List statements = new ArrayList(); + List statements = new ArrayList<>(); loop: while (position < tokens.size()) { boolean expectSemicolon = false; @@ -227,8 +227,8 @@ public class Parser { case 's': // switch ++position; final RValue parameter = parseBracket(); - final List values = new ArrayList(); - final List caseStatements = new ArrayList(); + final List values = new ArrayList<>(); + final List caseStatements = new ArrayList<>(); RValue defaultCase = null; consumeCharacter('{'); @@ -310,7 +310,7 @@ public class Parser { } private RValue parseExpression(boolean canBeEmpty) throws ParserException { - LinkedList halfProcessed = new LinkedList(); + LinkedList halfProcessed = new LinkedList<>(); // process brackets, numbers, functions, variables and detect prefix operators boolean expressionStart = true; @@ -397,7 +397,7 @@ public class Parser { return Functions.getFunction(identifierToken.getPosition(), identifierToken.value); } - List args = new ArrayList(); + List args = new ArrayList<>(); loop: while (true) { args.add(parseExpression(false)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/parser/ParserProcessors.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/parser/ParserProcessors.java index fc29e37d5..b50997cc6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/parser/ParserProcessors.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/parser/ParserProcessors.java @@ -26,14 +26,18 @@ import com.sk89q.worldedit.internal.expression.runtime.Conditional; import com.sk89q.worldedit.internal.expression.runtime.Operators; import com.sk89q.worldedit.internal.expression.runtime.RValue; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Map; /** * Helper classfor Parser. Contains processors for statements and operators. */ public final class ParserProcessors { - private static final Map unaryOpMap = new HashMap(); + private static final Map unaryOpMap = new HashMap<>(); private static final Map[] binaryOpMapsLA; private static final Map[] binaryOpMapsRA; @@ -111,7 +115,7 @@ public final class ParserProcessors { break; default: - Map m = lBinaryOpMapsLA[i] = new HashMap(); + Map m = lBinaryOpMapsLA[i] = new HashMap<>(); for (final Object[] element : a) { m.put((String) element[0], (String) element[1]); } @@ -133,7 +137,7 @@ public final class ParserProcessors { break; default: - Map m = lBinaryOpMapsRA[i] = new HashMap(); + Map m = lBinaryOpMapsRA[i] = new HashMap<>(); for (final Object[] element : a) { m.put((String) element[0], (String) element[1]); } @@ -153,8 +157,8 @@ public final class ParserProcessors { return processUnaryOps(input); } - LinkedList lhs = new LinkedList(); - LinkedList rhs = new LinkedList(); + LinkedList lhs = new LinkedList<>(); + LinkedList rhs = new LinkedList<>(); String operator = null; for (Iterator it = input.descendingIterator(); it.hasNext();) { @@ -195,8 +199,8 @@ public final class ParserProcessors { return processTernaryOps(input); } - LinkedList lhs = new LinkedList(); - LinkedList rhs = new LinkedList(); + LinkedList lhs = new LinkedList<>(); + LinkedList rhs = new LinkedList<>(); String operator = null; for (Identifiable identifiable : input) { @@ -232,9 +236,9 @@ public final class ParserProcessors { } private static RValue processTernaryOps(LinkedList input) throws ParserException { - LinkedList lhs = new LinkedList(); - LinkedList mhs = new LinkedList(); - LinkedList rhs = new LinkedList(); + LinkedList lhs = new LinkedList<>(); + LinkedList mhs = new LinkedList<>(); + LinkedList rhs = new LinkedList<>(); int partsFound = 0; int conditionalsFound = 0; @@ -290,7 +294,7 @@ public final class ParserProcessors { private static RValue processUnaryOps(LinkedList input) throws ParserException { // Preprocess postfix operators into unary operators final Identifiable center; - LinkedList postfixes = new LinkedList(); + LinkedList postfixes = new LinkedList<>(); do { if (input.isEmpty()) { throw new ParserException(-1, "Expression missing."); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java index a9cf3b684..4b4cbad13 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java @@ -123,7 +123,7 @@ public final class Functions { throw new NoSuchMethodException(); // TODO: return null (check for side-effects first) } - private static final Map> functions = new HashMap>(); + private static final Map> functions = new HashMap<>(); static { for (Method method : Functions.class.getMethods()) { try { @@ -138,10 +138,7 @@ public final class Functions { Overload overload = new Overload(method); - List overloads = functions.get(methodName); - if (overloads == null) { - functions.put(methodName, overloads = new ArrayList()); - } + List overloads = functions.computeIfAbsent(methodName, k -> new ArrayList<>()); overloads.add(overload); } @@ -279,8 +276,8 @@ public final class Functions { } - private static final Map gmegabuf = new HashMap(); - private final Map megabuf = new HashMap(); + private static final Map gmegabuf = new HashMap<>(); + private final Map megabuf = new HashMap<>(); public Map getMegabuf() { return megabuf; @@ -383,12 +380,7 @@ public final class Functions { return random.nextInt((int) Math.floor(max.getValue())); } - private static final ThreadLocal localPerlin = new ThreadLocal() { - @Override - protected PerlinNoise initialValue() { - return new PerlinNoise(); - } - }; + private static final ThreadLocal localPerlin = ThreadLocal.withInitial(PerlinNoise::new); public static double perlin(RValue seed, RValue x, RValue y, RValue z, RValue frequency, RValue octaves, RValue persistence) throws EvaluationException { PerlinNoise perlin = localPerlin.get(); @@ -403,12 +395,7 @@ public final class Functions { return perlin.noise(new Vector(x.getValue(), y.getValue(), z.getValue())); } - private static final ThreadLocal localVoronoi = new ThreadLocal() { - @Override - protected VoronoiNoise initialValue() { - return new VoronoiNoise(); - } - }; + private static final ThreadLocal localVoronoi = ThreadLocal.withInitial(VoronoiNoise::new); public static double voronoi(RValue seed, RValue x, RValue y, RValue z, RValue frequency) throws EvaluationException { VoronoiNoise voronoi = localVoronoi.get(); @@ -421,12 +408,7 @@ public final class Functions { return voronoi.noise(new Vector(x.getValue(), y.getValue(), z.getValue())); } - private static final ThreadLocal localRidgedMulti = new ThreadLocal() { - @Override - protected RidgedMultiFractalNoise initialValue() { - return new RidgedMultiFractalNoise(); - } - }; + private static final ThreadLocal localRidgedMulti = ThreadLocal.withInitial(RidgedMultiFractalNoise::new); public static double ridgedmulti(RValue seed, RValue x, RValue y, RValue z, RValue frequency, RValue octaves) throws EvaluationException { RidgedMultiFractalNoise ridgedMulti = localRidgedMulti.get(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Sequence.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Sequence.java index 0cdd92c51..f6458acce 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Sequence.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Sequence.java @@ -71,7 +71,7 @@ public class Sequence extends Node { @Override public RValue optimize() throws EvaluationException { - final List newSequence = new ArrayList(); + final List newSequence = new ArrayList<>(); RValue droppedLast = null; for (RValue invokable : sequence) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Switch.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Switch.java index 164293ff4..9f2f35764 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Switch.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Switch.java @@ -45,7 +45,7 @@ public class Switch extends Node implements RValue { } private static Map invertList(List values) { - Map valueMap = new HashMap(); + Map valueMap = new HashMap<>(); for (int i = 0; i < values.size(); ++i) { valueMap.put(values.get(i), i); } @@ -124,7 +124,7 @@ public class Switch extends Node implements RValue { @Override public RValue optimize() throws EvaluationException { final RValue optimizedParameter = parameter.optimize(); - final List newSequence = new ArrayList(); + final List newSequence = new ArrayList<>(); if (optimizedParameter instanceof Constant) { final double parameter = optimizedParameter.getValue(); @@ -165,9 +165,9 @@ public class Switch extends Node implements RValue { return new Switch(getPosition(), optimizedParameter, Collections.singletonMap(parameter, 0), newSequence, null); } - final Map newValueMap = new HashMap(); + final Map newValueMap = new HashMap<>(); - Map backMap = new HashMap(); + Map backMap = new HashMap<>(); for (Entry entry : valueMap.entrySet()) { backMap.put(entry.getValue(), entry.getKey()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java index 95563fcc0..506663a81 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java @@ -19,16 +19,16 @@ package com.sk89q.worldedit.internal.registry; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.NoMatchException; +import com.sk89q.worldedit.extension.input.ParserContext; import java.util.ArrayList; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * An abstract implementation of a factory for internal usage. * @@ -38,7 +38,7 @@ import static com.google.common.base.Preconditions.checkNotNull; public abstract class AbstractFactory { protected final WorldEdit worldEdit; - protected final List> parsers = new ArrayList>(); + protected final List> parsers = new ArrayList<>(); /** * Create a new factory. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java index 059c95ba4..77c05c2e3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/InputParser.java @@ -20,8 +20,8 @@ package com.sk89q.worldedit.internal.registry; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; /** * Input parser interface for {@link AbstractFactory}. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java index d4e38e34d..4f9f130c9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java @@ -22,7 +22,20 @@ package com.sk89q.worldedit.internal.util; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.NestedCommand; -import com.sk89q.worldedit.command.*; +import com.sk89q.worldedit.command.BiomeCommands; +import com.sk89q.worldedit.command.ChunkCommands; +import com.sk89q.worldedit.command.ClipboardCommands; +import com.sk89q.worldedit.command.GeneralCommands; +import com.sk89q.worldedit.command.GenerationCommands; +import com.sk89q.worldedit.command.HistoryCommands; +import com.sk89q.worldedit.command.NavigationCommands; +import com.sk89q.worldedit.command.RegionCommands; +import com.sk89q.worldedit.command.ScriptingCommands; +import com.sk89q.worldedit.command.SelectionCommands; +import com.sk89q.worldedit.command.SnapshotUtilCommands; +import com.sk89q.worldedit.command.ToolCommands; +import com.sk89q.worldedit.command.ToolUtilCommands; +import com.sk89q.worldedit.command.UtilityCommands; import java.io.File; import java.io.FileOutputStream; @@ -59,7 +72,7 @@ public final class DocumentationPrinter { } private static List> getCommandClasses(File dir) { - List> classes = new ArrayList>(); + List> classes = new ArrayList<>(); classes.add(BiomeCommands.class); classes.add(ChunkCommands.class); @@ -100,15 +113,9 @@ public final class DocumentationPrinter { private static void writePermissionsWikiTable(List> commandClasses) throws IOException { - FileOutputStream stream = null; - try { - stream = new FileOutputStream("wiki_permissions.txt"); + try (FileOutputStream stream = new FileOutputStream("wiki_permissions.txt")) { PrintStream print = new PrintStream(stream); writePermissionsWikiTable(print, commandClasses, "/"); - } finally { - if (stream != null) { - stream.close(); - } } } @@ -180,15 +187,9 @@ public final class DocumentationPrinter { private static void writeBukkitYAML() throws IOException { - FileOutputStream stream = null; - try { - stream = new FileOutputStream("plugin.yml"); + try (FileOutputStream stream = new FileOutputStream("plugin.yml")) { PrintStream print = new PrintStream(stream); writeBukkitYAML(print); - } finally { - if (stream != null) { - stream.close(); - } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/MathUtils.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/MathUtils.java index 743b6e5da..bb8541cb2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/MathUtils.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/MathUtils.java @@ -105,4 +105,16 @@ public final class MathUtils { return Math.sin(Math.toRadians(degrees)); } + /** + * Returns the rounded double of the given value, rounding to the + * nearest integer value away from zero on ties. + * + * This behavior is the same as {@link java.math.RoundingMode#HALF_UP}. + * + * @param value the value + * @return the rounded value + */ + public static double roundHalfUp(double value) { + return Math.signum(value) * Math.round(Math.abs(value)); + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/GaussianKernel.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/GaussianKernel.java index bc8b647f7..bb38201d2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/GaussianKernel.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/GaussianKernel.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.math.convolution; -import java.awt.image.Kernel; - /** * A Gaussian Kernel generator (2D bellcurve). */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java index 44f750760..0cfd4c35f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.math.convolution; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.regions.Region; - -import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypes; /** * Allows applications of Kernels onto the region's height map. @@ -44,22 +44,11 @@ public class HeightMap { /** * Constructs the HeightMap - * + * * @param session an edit session * @param region the region */ public HeightMap(EditSession session, Region region) { - this(session, region, false); - } - - /** - * Constructs the HeightMap - * - * @param session an edit session - * @param region the region - * @param naturalOnly ignore non-natural blocks - */ - public HeightMap(EditSession session, Region region, boolean naturalOnly) { checkNotNull(session); checkNotNull(region); @@ -78,7 +67,7 @@ public class HeightMap { data = new int[width * height]; for (int z = 0; z < height; ++z) { for (int x = 0; x < width; ++x) { - data[z * width + x] = session.getHighestTerrainBlock(x + minX, z + minZ, minY, maxY, naturalOnly); + data[z * width + x] = session.getHighestTerrainBlock(x + minX, z + minZ, minY, maxY); } } } @@ -122,7 +111,7 @@ public class HeightMap { int originZ = minY.getBlockZ(); int maxY = region.getMaximumPoint().getBlockY(); - BaseBlock fillerAir = new BaseBlock(BlockID.AIR); + BlockState fillerAir = BlockTypes.AIR.getDefaultState(); int blocksChanged = 0; @@ -145,11 +134,10 @@ public class HeightMap { // Depending on growing or shrinking we need to start at the bottom or top if (newHeight > curHeight) { // Set the top block of the column to be the same type (this might go wrong with rounding) - BaseBlock existing = session.getBlock(new Vector(xr, curHeight, zr)); + BlockState existing = session.getBlock(new Vector(xr, curHeight, zr)); // Skip water/lava - if (existing.getType() != BlockID.WATER && existing.getType() != BlockID.STATIONARY_WATER - && existing.getType() != BlockID.LAVA && existing.getType() != BlockID.STATIONARY_LAVA) { + if (existing.getBlockType() != BlockTypes.WATER && existing.getBlockType() != BlockTypes.LAVA) { session.setBlock(new Vector(xr, newHeight, zr), existing); ++blocksChanged; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMapFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMapFilter.java index 93f4f7c06..f58899fb4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMapFilter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMapFilter.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.math.convolution; -import java.awt.image.Kernel; - import static com.google.common.base.Preconditions.checkNotNull; /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/Kernel.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/Kernel.java new file mode 100644 index 000000000..efc051b63 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/Kernel.java @@ -0,0 +1,75 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.math.convolution; + +/* + * This class was originally part of the JDK, java.awt.image.Kernel, + * and has been modified to not load the entire AWT toolkit, since + * that was apparently added in Java 8, even though this class + * is completely standalone. + */ +public class Kernel { + + private int width; + private int height; + private int xOrigin; + private int yOrigin; + private float[] data; + + public Kernel(int width, int height, float[] data) { + this.width = width; + this.height = height; + this.xOrigin = (width - 1) >> 1; + this.yOrigin = (height - 1) >> 1; + int len = width * height; + if (data.length < len) { + throw new IllegalArgumentException("Data array too small (is " + data.length + " and should be " + len); + } + this.data = new float[len]; + System.arraycopy(data, 0, this.data, 0, len); + } + + public final int getXOrigin() { + return xOrigin; + } + + public final int getYOrigin() { + return yOrigin; + } + + public final int getWidth() { + return width; + } + + public final int getHeight() { + return height; + } + + public final float[] getKernelData(float[] data) { + if (data == null) { + data = new float[this.data.length]; + } else if (data.length < this.data.length) { + throw new IllegalArgumentException("Data array too small (should be " + this.data.length + " but is " + data.length + " )"); + } + System.arraycopy(this.data, 0, data, 0, this.data.length); + return data; + } + +} \ No newline at end of file diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/LinearKernel.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/LinearKernel.java index 3e31c199e..1de8dec57 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/LinearKernel.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/LinearKernel.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.math.convolution; -import java.awt.image.Kernel; - /** * A linear Kernel generator (all cells weight the same) */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java index c6f011243..007977d58 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java @@ -50,7 +50,7 @@ public final class Polygons { nPoints = maxPoints - 1; } - final List points = new ArrayList(nPoints); + final List points = new ArrayList<>(nPoints); for (int i = 0; i < nPoints; ++i) { double angle = i * (2.0 * Math.PI) / nPoints; final Vector2D pos = new Vector2D(Math.cos(angle), Math.sin(angle)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java index f953d3de6..f5f41313b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java @@ -21,13 +21,13 @@ package com.sk89q.worldedit.math.interpolation; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import java.util.Collections; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * A Kochanek-Bartels interpolation; continuous in the 2nd derivative. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/LinearInterpolation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/LinearInterpolation.java index 00fa7c12f..ea1962119 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/LinearInterpolation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/LinearInterpolation.java @@ -21,12 +21,12 @@ package com.sk89q.worldedit.math.interpolation; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Simple linear interpolation. Mainly used for testing. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java index 8a0df7b9f..d6920b829 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java @@ -21,6 +21,8 @@ package com.sk89q.worldedit.math.interpolation; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import java.util.List; @@ -28,8 +30,6 @@ import java.util.Map.Entry; import java.util.TreeMap; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Reparametrises another interpolation function by arc length. * @@ -42,7 +42,7 @@ public class ReparametrisingInterpolation implements Interpolation { private final Interpolation baseInterpolation; private double totalArcLength; - private final TreeMap cache = new TreeMap(); + private final TreeMap cache = new TreeMap<>(); public ReparametrisingInterpolation(Interpolation baseInterpolation) { checkNotNull(baseInterpolation); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java index 061d780c2..36db0566c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java @@ -165,7 +165,7 @@ public class AffineTransform implements Transform { double det = this.determinant(); return new AffineTransform( (m11 * m22 - m21 * m12) / det, - (m21 * m01 - m01 * m22) / det, + (m21 * m02 - m01 * m22) / det, (m01 * m12 - m11 * m02) / det, (m01 * (m22 * m13 - m12 * m23) + m02 * (m11 * m23 - m21 * m13) - m03 * (m11 * m22 - m21 * m12)) / det, diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/CombinedTransform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/CombinedTransform.java index eab410b99..646e2a209 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/CombinedTransform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/CombinedTransform.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.math.transform; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import java.util.ArrayList; @@ -26,8 +28,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Combines several transforms in order. */ @@ -75,7 +75,7 @@ public class CombinedTransform implements Transform { @Override public Transform inverse() { - List list = new ArrayList(); + List list = new ArrayList<>(); for (int i = transforms.length - 1; i >= 0; i--) { list.add(transforms[i].inverse()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Transforms.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Transforms.java index 71286507b..5d0412259 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Transforms.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Transforms.java @@ -19,10 +19,10 @@ package com.sk89q.worldedit.math.transform; -import com.sk89q.worldedit.util.Location; - import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.util.Location; + /** * Various utility methods related to {@link Transform}s. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java index 8005bc7c8..44f7070cb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java @@ -19,13 +19,19 @@ package com.sk89q.worldedit.regions; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.regions.iterator.RegionIterator; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.storage.ChunkStore; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; public abstract class AbstractRegion implements Region { @@ -55,11 +61,6 @@ public abstract class AbstractRegion implements Region { return world; } - @Override - public void setWorld(LocalWorld world) { - setWorld((World) world); - } - @Override public void setWorld(World world) { this.world = world; @@ -89,7 +90,7 @@ public abstract class AbstractRegion implements Region { final BlockVector min = getMinimumPoint().toBlockVector(); final BlockVector max = getMaximumPoint().toBlockVector(); - final List points = new ArrayList(4); + final List points = new ArrayList<>(4); points.add(new BlockVector2D(min.getX(), min.getZ())); points.add(new BlockVector2D(min.getX(), max.getZ())); @@ -160,7 +161,7 @@ public abstract class AbstractRegion implements Region { */ @Override public Set getChunks() { - final Set chunks = new HashSet(); + final Set chunks = new HashSet<>(); final Vector min = getMinimumPoint(); final Vector max = getMaximumPoint(); @@ -185,7 +186,7 @@ public abstract class AbstractRegion implements Region { @Override public Set getChunkCubes() { - final Set chunks = new HashSet(); + final Set chunks = new HashSet<>(); final Vector min = getMinimumPoint(); final Vector max = getMaximumPoint(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java index 2484cf062..fce016e23 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.regions; -import com.sk89q.worldedit.LocalWorld; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.regions.polyhedron.Edge; import com.sk89q.worldedit.regions.polyhedron.Triangle; import com.sk89q.worldedit.world.World; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @@ -33,24 +33,24 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; public class ConvexPolyhedralRegion extends AbstractRegion { /** * Vertices that are contained in the convex hull. */ - private final Set vertices = new LinkedHashSet(); + private final Set vertices = new LinkedHashSet<>(); /** * Triangles that form the convex hull. */ - private final List triangles = new ArrayList(); + private final List triangles = new ArrayList<>(); /** * Vertices that are coplanar to the first 3 vertices. */ - private final Set vertexBacklog = new LinkedHashSet(); + private final Set vertexBacklog = new LinkedHashSet<>(); /** * Minimum point of the axis-aligned bounding box. @@ -81,14 +81,6 @@ public class ConvexPolyhedralRegion extends AbstractRegion { super(world); } - /** - * @deprecated cast {@code world} to {@link World} - */ - @Deprecated - public ConvexPolyhedralRegion(LocalWorld world) { - super(world); - } - /** * Constructs an independent copy of the given region. * @@ -174,7 +166,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { } // Look for triangles that face the vertex and remove them - final Set borderEdges = new LinkedHashSet(); + final Set borderEdges = new LinkedHashSet<>(); for (Iterator it = triangles.iterator(); it.hasNext(); ) { final Triangle triangle = it.next(); @@ -207,7 +199,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { vertices.remove(vertex); // Clone, clear and work through the backlog - final List vertexBacklog2 = new ArrayList(vertexBacklog); + final List vertexBacklog2 = new ArrayList<>(vertexBacklog); vertexBacklog.clear(); for (Vector vertex2 : vertexBacklog2) { addVertex(vertex2); @@ -269,7 +261,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { } private static void shiftCollection(Collection collection, Vector change) { - final List tmp = new ArrayList(collection); + final List tmp = new ArrayList<>(collection); collection.clear(); for (Vector vertex : tmp) { collection.add(change.add(vertex)); @@ -323,7 +315,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { return vertices; } - final List ret = new ArrayList(vertices); + final List ret = new ArrayList<>(vertices); ret.addAll(vertexBacklog); return ret; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java index 258be2c6f..8269821c1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java @@ -19,7 +19,13 @@ package com.sk89q.worldedit.regions; -import com.sk89q.worldedit.*; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.BlockVector2D; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.storage.ChunkStore; @@ -27,9 +33,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - /** * An axis-aligned cuboid. It can be defined using two corners of the cuboid. */ @@ -48,14 +51,6 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { this(null, pos1, pos2); } - /** - * @deprecated cast {@code world} to {@link World} - */ - @Deprecated - public CuboidRegion(LocalWorld world, Vector pos1, Vector pos2) { - this((World) world, pos1, pos2); - } - /** * Construct a new instance of this cuboid using two corners of the cuboid. * @@ -295,7 +290,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { @Override public Set getChunks() { - Set chunks = new HashSet(); + Set chunks = new HashSet<>(); Vector min = getMinimumPoint(); Vector max = getMaximumPoint(); @@ -311,7 +306,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { @Override public Set getChunkCubes() { - Set chunks = new HashSet(); + Set chunks = new HashSet<>(); Vector min = getMinimumPoint(); Vector max = getMaximumPoint(); @@ -380,38 +375,33 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { @Override public Iterable asFlatRegion() { - return new Iterable() { + return () -> new Iterator() { + private Vector min = getMinimumPoint(); + private Vector max = getMaximumPoint(); + private int nextX = min.getBlockX(); + private int nextZ = min.getBlockZ(); + @Override - public Iterator iterator() { - return new Iterator() { - private Vector min = getMinimumPoint(); - private Vector max = getMaximumPoint(); - private int nextX = min.getBlockX(); - private int nextZ = min.getBlockZ(); + public boolean hasNext() { + return (nextX != Integer.MIN_VALUE); + } - @Override - public boolean hasNext() { - return (nextX != Integer.MIN_VALUE); + @Override + public Vector2D next() { + if (!hasNext()) throw new java.util.NoSuchElementException(); + Vector2D answer = new Vector2D(nextX, nextZ); + if (++nextX > max.getBlockX()) { + nextX = min.getBlockX(); + if (++nextZ > max.getBlockZ()) { + nextX = Integer.MIN_VALUE; } + } + return answer; + } - @Override - public Vector2D next() { - if (!hasNext()) throw new java.util.NoSuchElementException(); - Vector2D answer = new Vector2D(nextX, nextZ); - if (++nextX > max.getBlockX()) { - nextX = min.getBlockX(); - if (++nextZ > max.getBlockZ()) { - nextX = Integer.MIN_VALUE; - } - } - return answer; - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - }; + @Override + public void remove() { + throw new UnsupportedOperationException(); } }; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java index 0f483be4e..ed0e70822 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java @@ -19,9 +19,10 @@ package com.sk89q.worldedit.regions; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.extent.Extent; @@ -33,8 +34,6 @@ import com.sk89q.worldedit.world.World; import java.util.Iterator; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Represents a cylindrical region. */ @@ -53,13 +52,6 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { this((World) null); } - /** - * @deprecated cast {@code world} to {@link World} - */ - @Deprecated - public CylinderRegion(LocalWorld world) { - this((World) world); - } /** * Construct the region. * @@ -70,11 +62,6 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { hasY = false; } - @Deprecated - public CylinderRegion(LocalWorld world, Vector center, Vector2D radius, int minY, int maxY) { - this((World) world, center, radius, minY, maxY); - } - /** * Construct the region. * @@ -120,16 +107,6 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { return center.toVector((maxY + minY) / 2); } - /** - * Sets the main center point of the region - * - * @deprecated replaced by {@link #setCenter(Vector2D)} - */ - @Deprecated - public void setCenter(Vector center) { - setCenter(center.toVector2D()); - } - /** * Sets the main center point of the region * @@ -344,12 +321,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { @Override public Iterable asFlatRegion() { - return new Iterable() { - @Override - public Iterator iterator() { - return new FlatRegionIterator(CylinderRegion.this); - } - }; + return () -> new FlatRegionIterator(CylinderRegion.this); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java index 48e0a0609..069cdaff3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java @@ -21,13 +21,13 @@ package com.sk89q.worldedit.regions; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.storage.ChunkStore; -import java.util.Set; + import java.util.HashSet; +import java.util.Set; /** * Represents an ellipsoid region. @@ -54,11 +54,6 @@ public class EllipsoidRegion extends AbstractRegion { this(null, pos1, pos2); } - @Deprecated - public EllipsoidRegion(LocalWorld world, Vector center, Vector radius) { - this((World) world, center, radius); - } - /** * Construct a new instance of this ellipsoid region. * @@ -183,7 +178,7 @@ public class EllipsoidRegion extends AbstractRegion { @Override public Set getChunks() { - final Set chunks = new HashSet(); + final Set chunks = new HashSet<>(); final Vector min = getMinimumPoint(); final Vector max = getMaximumPoint(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/NullRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/NullRegion.java index 611835550..5f1c9653e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/NullRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/NullRegion.java @@ -19,11 +19,17 @@ package com.sk89q.worldedit.regions; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.world.World; -import java.util.*; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Set; /** * A region that contains no points. @@ -107,11 +113,6 @@ public class NullRegion implements Region { this.world = world; } - @Override - public void setWorld(LocalWorld world) { - setWorld((World) world); - } - @Override public NullRegion clone() { return new NullRegion(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java index f3e207380..b7d607d9d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java @@ -21,7 +21,6 @@ package com.sk89q.worldedit.regions; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.regions.iterator.FlatRegion3DIterator; @@ -52,11 +51,6 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { this((World) null); } - @Deprecated - public Polygonal2DRegion(LocalWorld world) { - this((World) world); - } - /** * Construct the region. * @@ -67,11 +61,6 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { hasY = false; } - @Deprecated - public Polygonal2DRegion(LocalWorld world, List points, int minY, int maxY) { - this((World) world, points, minY, maxY); - } - /** * Construct the region. * @@ -82,7 +71,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { */ public Polygonal2DRegion(World world, List points, int minY, int maxY) { super(world); - this.points = new ArrayList(points); + this.points = new ArrayList<>(points); this.minY = minY; this.maxY = maxY; hasY = true; @@ -182,11 +171,6 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { return minY; } - @Deprecated - public int getMininumY() { - return minY; - } - /** * Set the minimum Y. * @@ -420,12 +404,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { @Override public Iterable asFlatRegion() { - return new Iterable() { - @Override - public Iterator iterator() { - return new FlatRegionIterator(Polygonal2DRegion.this); - } - }; + return () -> new FlatRegionIterator(Polygonal2DRegion.this); } /** @@ -451,7 +430,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { @Override public Polygonal2DRegion clone() { Polygonal2DRegion clone = (Polygonal2DRegion) super.clone(); - clone.points = new ArrayList(points); + clone.points = new ArrayList<>(points); return clone; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java index 954296565..77bfa8440 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java @@ -21,15 +21,15 @@ package com.sk89q.worldedit.regions; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.world.World; -import javax.annotation.Nullable; import java.util.List; import java.util.Set; +import javax.annotation.Nullable; + /** * Represents a physical shape. */ @@ -40,14 +40,14 @@ public interface Region extends Iterable, Cloneable { * * @return min. point */ - public Vector getMinimumPoint(); + Vector getMinimumPoint(); /** * Get the upper point of a region. * * @return max. point */ - public Vector getMaximumPoint(); + Vector getMaximumPoint(); /** * Get the center point of a region. @@ -56,35 +56,35 @@ public interface Region extends Iterable, Cloneable { * * @return center point */ - public Vector getCenter(); + Vector getCenter(); /** * Get the number of blocks in the region. * * @return number of blocks */ - public int getArea(); + int getArea(); /** * Get X-size. * * @return width */ - public int getWidth(); + int getWidth(); /** * Get Y-size. * * @return height */ - public int getHeight(); + int getHeight(); /** * Get Z-size. * * @return length */ - public int getLength(); + int getLength(); /** * Expand the region. @@ -92,7 +92,7 @@ public interface Region extends Iterable, Cloneable { * @param changes array/arguments with multiple related changes * @throws RegionOperationException */ - public void expand(Vector... changes) throws RegionOperationException; + void expand(Vector... changes) throws RegionOperationException; /** * Contract the region. @@ -100,7 +100,7 @@ public interface Region extends Iterable, Cloneable { * @param changes array/arguments with multiple related changes * @throws RegionOperationException */ - public void contract(Vector... changes) throws RegionOperationException; + void contract(Vector... changes) throws RegionOperationException; /** * Shift the region. @@ -108,7 +108,7 @@ public interface Region extends Iterable, Cloneable { * @param change the change * @throws RegionOperationException */ - public void shift(Vector change) throws RegionOperationException; + void shift(Vector change) throws RegionOperationException; /** * Returns true based on whether the region contains the point. @@ -116,51 +116,42 @@ public interface Region extends Iterable, Cloneable { * @param position the position * @return true if contained */ - public boolean contains(Vector position); + boolean contains(Vector position); /** * Get a list of chunks. * * @return a list of chunk coordinates */ - public Set getChunks(); + Set getChunks(); /** * Return a list of 16*16*16 chunks in a region * * @return the chunk cubes this region overlaps with */ - public Set getChunkCubes(); + Set getChunkCubes(); /** * Sets the world that the selection is in. * * @return the world, or null */ - @Nullable - public World getWorld(); + @Nullable World getWorld(); /** * Sets the world that the selection is in. * * @param world the world, which may be null */ - public void setWorld(@Nullable World world); - - /** - * Sets the world that the selection is in. - * - * @param world the world, which may be null - */ - @Deprecated - public void setWorld(@Nullable LocalWorld world); + void setWorld(@Nullable World world); /** * Make a clone of the region. * * @return a cloned version */ - public Region clone(); + Region clone(); /** * Polygonizes a cross-section or a 2D projection of the region orthogonal to the Y axis. @@ -168,5 +159,5 @@ public interface Region extends Iterable, Cloneable { * @param maxPoints maximum number of points to generate. -1 for no limit. * @return the points. */ - public List polygonize(int maxPoints); + List polygonize(int maxPoints); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java index 070a3527f..ad93903ee 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java @@ -19,19 +19,19 @@ package com.sk89q.worldedit.regions; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.collect.Iterators; import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.world.World; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - /** * An intersection of several other regions. Any location that is contained in one * of the child regions is considered as contained by this region. @@ -43,7 +43,7 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class RegionIntersection extends AbstractRegion { - private final List regions = new ArrayList(); + private final List regions = new ArrayList<>(); /** * Create a new instance with the included list of regions. @@ -69,13 +69,11 @@ public class RegionIntersection extends AbstractRegion { * @param world the world * @param regions a list of regions, which is copied */ - public RegionIntersection(LocalWorld world, List regions) { + public RegionIntersection(World world, List regions) { super(world); checkNotNull(regions); checkArgument(!regions.isEmpty(), "empty region list is not supported"); - for (Region region : regions) { - this.regions.add(region); - } + this.regions.addAll(regions); } /** @@ -84,7 +82,7 @@ public class RegionIntersection extends AbstractRegion { * @param world the world * @param regions an array of regions, which is copied */ - public RegionIntersection(LocalWorld world, Region... regions) { + public RegionIntersection(World world, Region... regions) { super(world); checkNotNull(regions); checkArgument(regions.length > 0, "empty region list is not supported"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java index 1e7e723f6..52329f86c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java @@ -27,9 +27,10 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.world.World; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + /** * Region selectors create {@link Region}s from a series of "selected points." * They are used, for example, to allow users to create a {@link CuboidRegion} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/TransformRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/TransformRegion.java index 3ffb59a03..338d5f0e9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/TransformRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/TransformRegion.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.regions; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.Vector; @@ -26,12 +28,11 @@ import com.sk89q.worldedit.math.transform.Identity; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.world.World; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Transforms another region according to a provided vector {@code Transform}. @@ -154,7 +155,7 @@ public class TransformRegion extends AbstractRegion { @Override public List polygonize(int maxPoints) { List origPoints = region.polygonize(maxPoints); - List transformedPoints = new ArrayList(); + List transformedPoints = new ArrayList<>(); for (BlockVector2D vector : origPoints) { transformedPoints.add(transform.apply(vector.toVector(0)).toVector2D().toBlockVector2D()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegion3DIterator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegion3DIterator.java index 7cfeff11e..8c6628616 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegion3DIterator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegion3DIterator.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.regions.iterator; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.regions.FlatRegion; @@ -26,8 +28,6 @@ import com.sk89q.worldedit.regions.FlatRegion; import java.util.Iterator; import java.util.NoSuchElementException; -import static com.google.common.base.Preconditions.checkNotNull; - public class FlatRegion3DIterator implements Iterator { private Iterator flatIterator; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java index 6657613b2..60018afeb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.regions.iterator; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.regions.Region; import java.util.Iterator; -import static com.google.common.base.Preconditions.checkNotNull; - public class FlatRegionIterator implements Iterator { private Region region; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/RegionIterator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/RegionIterator.java index 9d3b4542d..35700595c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/RegionIterator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/RegionIterator.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.regions.iterator; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.regions.Region; import java.util.Iterator; -import static com.google.common.base.Preconditions.checkNotNull; - public class RegionIterator implements Iterator { private final Region region; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Edge.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Edge.java index 875af7659..3495fee83 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Edge.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Edge.java @@ -19,10 +19,10 @@ package com.sk89q.worldedit.regions.polyhedron; -import com.sk89q.worldedit.Vector; - import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.Vector; + public class Edge { private final Vector start; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Triangle.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Triangle.java index ed1ee46c8..01bd7f8ae 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Triangle.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Triangle.java @@ -19,10 +19,10 @@ package com.sk89q.worldedit.regions.polyhedron; -import com.sk89q.worldedit.Vector; - import static com.google.common.base.Preconditions.checkNotNull; +import com.sk89q.worldedit.Vector; + public class Triangle { private String tag = "Triangle"; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java index 5dc3af057..afbcb1ae1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java @@ -19,7 +19,8 @@ package com.sk89q.worldedit.regions.selector; -import com.google.common.base.Optional; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.IncompleteRegionException; @@ -36,19 +37,19 @@ import com.sk89q.worldedit.regions.polyhedron.Triangle; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.world.World; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Creates a {@code ConvexPolyhedralRegion} from a user's selections. */ -public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions.ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion { +public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion { private final transient ConvexPolyhedralRegion region; private transient BlockVector pos1; @@ -96,7 +97,7 @@ public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions. region = new ConvexPolyhedralRegion(oldRegion.getWorld()); - for (final BlockVector2D pt : new ArrayList(oldRegion.polygonize(Integer.MAX_VALUE))) { + for (final BlockVector2D pt : new ArrayList<>(oldRegion.polygonize(Integer.MAX_VALUE))) { region.addVertex(pt.toVector(minY)); region.addVertex(pt.toVector(maxY)); } @@ -183,7 +184,7 @@ public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions. @Override public List getInformationLines() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); ret.add("Vertices: "+region.getVertices().size()); ret.add("Triangles: "+region.getTriangles().size()); @@ -239,7 +240,7 @@ public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions. Collection vertices = region.getVertices(); Collection triangles = region.getTriangles(); - Map vertexIds = new HashMap(vertices.size()); + Map vertexIds = new HashMap<>(vertices.size()); int lastVertexId = -1; for (Vector vertex : vertices) { vertexIds.put(vertex, ++lastVertexId); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java index 4265490f1..182c08f0f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java @@ -19,7 +19,12 @@ package com.sk89q.worldedit.regions.selector; -import com.sk89q.worldedit.*; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.IncompleteRegionException; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionPointEvent; @@ -29,16 +34,15 @@ import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.world.World; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Creates a {@code CuboidRegion} from a user's selections. */ -public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegionSelector implements RegionSelector, CUIRegion { +public class CuboidRegionSelector implements RegionSelector, CUIRegion { protected transient BlockVector position1; protected transient BlockVector position2; @@ -234,7 +238,7 @@ public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegi @Override public List getInformationLines() { - final List lines = new ArrayList(); + final List lines = new ArrayList<>(); if (position1 != null) { lines.add("Position 1: " + position1); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java index b2d3002c2..8e4ce873c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java @@ -19,26 +19,34 @@ package com.sk89q.worldedit.regions.selector; -import com.sk89q.worldedit.*; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.IncompleteRegionException; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.internal.cui.*; +import com.sk89q.worldedit.internal.cui.CUIRegion; +import com.sk89q.worldedit.internal.cui.SelectionCylinderEvent; +import com.sk89q.worldedit.internal.cui.SelectionMinMaxEvent; +import com.sk89q.worldedit.internal.cui.SelectionPointEvent; import com.sk89q.worldedit.regions.CylinderRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.world.World; -import javax.annotation.Nullable; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Creates a {@code CylinderRegionSelector} from a user's selections. */ -public class CylinderRegionSelector extends com.sk89q.worldedit.regions.CylinderRegionSelector implements RegionSelector, CUIRegion { +public class CylinderRegionSelector implements RegionSelector, CUIRegion { protected static transient final NumberFormat NUMBER_FORMAT; protected transient CylinderRegion region; @@ -225,7 +233,7 @@ public class CylinderRegionSelector extends com.sk89q.worldedit.regions.Cylinder @Override public List getInformationLines() { - final List lines = new ArrayList(); + final List lines = new ArrayList<>(); if (!region.getCenter().equals(Vector.ZERO)) { lines.add("Center: " + region.getCenter()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java index 5f3a956d4..ca32ac3dc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java @@ -19,7 +19,12 @@ package com.sk89q.worldedit.regions.selector; -import com.sk89q.worldedit.*; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.IncompleteRegionException; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionEllipsoidPointEvent; @@ -30,16 +35,15 @@ import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.world.World; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Creates a {@code EllipsoidRegionSelector} from a user's selections. */ -public class EllipsoidRegionSelector extends com.sk89q.worldedit.regions.EllipsoidRegionSelector implements RegionSelector, CUIRegion { +public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { protected transient EllipsoidRegion region; protected transient boolean started = false; @@ -201,7 +205,7 @@ public class EllipsoidRegionSelector extends com.sk89q.worldedit.regions.Ellipso @Override public List getInformationLines() { - final List lines = new ArrayList(); + final List lines = new ArrayList<>(); final Vector center = region.getCenter(); if (center.lengthSq() > 0) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java index c9611c05f..2cf8682b8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java @@ -19,8 +19,13 @@ package com.sk89q.worldedit.regions.selector; -import com.google.common.base.Optional; -import com.sk89q.worldedit.*; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.BlockVector2D; +import com.sk89q.worldedit.IncompleteRegionException; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionMinMaxEvent; @@ -32,16 +37,16 @@ import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.world.World; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import java.util.Optional; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Creates a {@code Polygonal2DRegion} from a user's selections. */ -public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polygonal2DRegionSelector implements RegionSelector, CUIRegion { +public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { private transient BlockVector pos1; private transient Polygonal2DRegion region; @@ -93,14 +98,6 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg } } - /** - * @deprecated cast {@code world} to {@link World} - */ - @Deprecated - public Polygonal2DRegionSelector(@Nullable LocalWorld world, List points, int minY, int maxY) { - this((World) world, points, minY, maxY); - } - /** * Create a new selector. * @@ -248,7 +245,6 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg * * @return the number of points */ - @Override public int getPointCount() { return region.getPoints().size(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/RegionSelectorType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/RegionSelectorType.java index c522ed532..9ce56af45 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/RegionSelectorType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/RegionSelectorType.java @@ -57,9 +57,7 @@ public enum RegionSelectorType { public RegionSelector createSelector() { try { return getSelectorClass().newInstance(); - } catch (InstantiationException e) { - throw new RuntimeException("Could not create selector", e); - } catch (IllegalAccessException e) { + } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException("Could not create selector", e); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/limit/PermissiveSelectorLimits.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/limit/PermissiveSelectorLimits.java index 17d965840..ff68702d5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/limit/PermissiveSelectorLimits.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/limit/PermissiveSelectorLimits.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.regions.selector.limit; -import com.google.common.base.Optional; +import java.util.Optional; /** * No limits at all. @@ -33,12 +33,12 @@ public class PermissiveSelectorLimits implements SelectorLimits { @Override public Optional getPolygonVertexLimit() { - return Optional.absent(); + return Optional.empty(); } @Override public Optional getPolyhedronVertexLimit() { - return Optional.absent(); + return Optional.empty(); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/limit/SelectorLimits.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/limit/SelectorLimits.java index 143efb49d..1f66c055b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/limit/SelectorLimits.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/limit/SelectorLimits.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.regions.selector.limit; -import com.google.common.base.Optional; +import java.util.Optional; /** * Defines limits for selections. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java index 8bac020a7..7629637d4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java @@ -22,10 +22,9 @@ package com.sk89q.worldedit.regions.shape; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.patterns.Pattern; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.world.block.BlockStateHolder; /** * Generates solid and hollow shapes according to materials returned by the @@ -34,45 +33,15 @@ import com.sk89q.worldedit.regions.Region; public abstract class ArbitraryShape { protected final Region extent; - private int cacheOffsetX; - private int cacheOffsetY; - private int cacheOffsetZ; - @SuppressWarnings("FieldCanBeLocal") - private int cacheSizeX; - private int cacheSizeY; - private int cacheSizeZ; public ArbitraryShape(Region extent) { this.extent = extent; - - Vector min = extent.getMinimumPoint(); - Vector max = extent.getMaximumPoint(); - - cacheOffsetX = min.getBlockX() - 1; - cacheOffsetY = min.getBlockY() - 1; - cacheOffsetZ = min.getBlockZ() - 1; - - cacheSizeX = (int) (max.getX() - cacheOffsetX + 2); - cacheSizeY = (int) (max.getY() - cacheOffsetY + 2); - cacheSizeZ = (int) (max.getZ() - cacheOffsetZ + 2); - - cache = new short[cacheSizeX * cacheSizeY * cacheSizeZ]; } protected Region getExtent() { return extent; } - - /** - * Cache entries: - * 0 = unknown - * -1 = outside - * -2 = inside but type and data 0 - * > 0 = inside, value = (type | (data << 8)), not handling data < 0 - */ - private final short[] cache; - /** * Override this function to specify the shape to generate. * @@ -82,60 +51,7 @@ public abstract class ArbitraryShape { * @param defaultMaterial The material returned by the pattern for the current block. * @return material to place or null to not place anything. */ - protected abstract BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial); - - private BaseBlock getMaterialCached(int x, int y, int z, Pattern pattern) { - final int index = (y - cacheOffsetY) + (z - cacheOffsetZ) * cacheSizeY + (x - cacheOffsetX) * cacheSizeY * cacheSizeZ; - - final short cacheEntry = cache[index]; - switch (cacheEntry) { - case 0: - // unknown, fetch material - final BaseBlock material = getMaterial(x, y, z, pattern.next(new BlockVector(x, y, z))); - if (material == null) { - // outside - cache[index] = -1; - return null; - } - - short newCacheEntry = (short) (material.getType() | ((material.getData() + 1) << 8)); - if (newCacheEntry == 0) { - // type and data 0 - newCacheEntry = -2; - } - - cache[index] = newCacheEntry; - return material; - - case -1: - // outside - return null; - - case -2: - // type and data 0 - return new BaseBlock(0, 0); - } - - return new BaseBlock(cacheEntry & 255, ((cacheEntry >> 8) - 1) & 15); - } - - private boolean isInsideCached(int x, int y, int z, Pattern pattern) { - final int index = (y - cacheOffsetY) + (z - cacheOffsetZ) * cacheSizeY + (x - cacheOffsetX) * cacheSizeY * cacheSizeZ; - - switch (cache[index]) { - case 0: - // unknown block, meaning they must be outside the extent at this stage, but might still be inside the shape - return getMaterialCached(x, y, z, pattern) != null; - - case -1: - // outside - return false; - - default: - // inside - return true; - } - } + protected abstract BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial); /** * Generates the shape. @@ -155,7 +71,7 @@ public abstract class ArbitraryShape { int z = position.getBlockZ(); if (!hollow) { - final BaseBlock material = getMaterial(x, y, z, pattern.next(position)); + final BlockStateHolder material = getMaterial(x, y, z, pattern.apply(position)); if (material != null && editSession.setBlock(position, material)) { ++affected; } @@ -163,43 +79,11 @@ public abstract class ArbitraryShape { continue; } - final BaseBlock material = getMaterialCached(x, y, z, pattern); + final BlockStateHolder material = getMaterial(x, y, z, pattern.apply(position)); if (material == null) { continue; } - boolean draw = false; - do { - if (!isInsideCached(x + 1, y, z, pattern)) { - draw = true; - break; - } - if (!isInsideCached(x - 1, y, z, pattern)) { - draw = true; - break; - } - if (!isInsideCached(x, y, z + 1, pattern)) { - draw = true; - break; - } - if (!isInsideCached(x, y, z - 1, pattern)) { - draw = true; - break; - } - if (!isInsideCached(x, y + 1, z, pattern)) { - draw = true; - break; - } - if (!isInsideCached(x, y - 1, z, pattern)) { - draw = true; - break; - } - } while (false); - - if (!draw) { - continue; - } - if (editSession.setBlock(position, material)) { ++affected; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java index 94478527a..e8419cf00 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java @@ -20,8 +20,8 @@ package com.sk89q.worldedit.regions.shape; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.world.block.BlockStateHolder; /** * Generates solid and hollow shapes according to materials returned by the @@ -34,7 +34,7 @@ public class RegionShape extends ArbitraryShape { } @Override - protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial) { + protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) { if (!this.extent.contains(new Vector(x, y, z))) { return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java index 744d53609..8757235a3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java @@ -48,32 +48,32 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment { @Override public int getBlockType(double x, double y, double z) { - return editSession.getBlockType(toWorld(x, y, z)); + return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId(); } @Override public int getBlockData(double x, double y, double z) { - return editSession.getBlockData(toWorld(x, y, z)); + return 0; } @Override public int getBlockTypeAbs(double x, double y, double z) { - return editSession.getBlockType(new Vector(x, y, z)); + return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId(); } @Override public int getBlockDataAbs(double x, double y, double z) { - return editSession.getBlockData(new Vector(x, y, z)); + return 0; } @Override public int getBlockTypeRel(double x, double y, double z) { - return editSession.getBlockType(toWorldRel(x, y, z)); + return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId(); } @Override public int getBlockDataRel(double x, double y, double z) { - return editSession.getBlockData(toWorldRel(x, y, z)); + return 0; } public void setCurrentBlock(Vector current) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Category.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Category.java new file mode 100644 index 000000000..ee077cd70 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Category.java @@ -0,0 +1,62 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.registry; + +import java.util.HashSet; +import java.util.Set; + +public abstract class Category { + private final Set set = new HashSet<>(); + protected final String id; + private boolean empty = true; + + protected Category(final String id) { + this.id = id; + } + + public final String getId() { + return this.id; + } + + public final Set getAll() { + if (this.empty) { + this.set.addAll(this.load()); + this.empty = false; + } + return this.set; + } + + protected abstract Set load(); + + /** + * Checks if this category contains {@code object}. + * + * @param object the object + * @return {@code true} if this category contains the object + */ + public boolean contains(final T object) { + return this.getAll().contains(object); + } + + public void invalidateCache() { + this.set.clear(); + this.empty = true; + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java new file mode 100644 index 000000000..d3b151f6e --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java @@ -0,0 +1,56 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.registry; + +import static com.google.common.base.Preconditions.checkState; +import static java.util.Objects.requireNonNull; + +import javax.annotation.Nullable; + +public final class NamespacedRegistry extends Registry { + private static final String MINECRAFT_NAMESPACE = "minecraft"; + private final String defaultNamespace; + + public NamespacedRegistry(final String name) { + this(name, MINECRAFT_NAMESPACE); + } + + public NamespacedRegistry(final String name, final String defaultNamespace) { + super(name); + this.defaultNamespace = defaultNamespace; + } + + public @Nullable V get(final String key) { + return super.get(this.orDefaultNamespace(key)); + } + + public V register(final String key, final V value) { + requireNonNull(key, "key"); + checkState(key.indexOf(':') > -1, "key is not namespaced"); + return super.register(key, value); + } + + private String orDefaultNamespace(final String key) { + if (key.indexOf(':') == -1) { + return defaultNamespace + ':' + key; + } + return key; + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Registry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Registry.java new file mode 100644 index 000000000..7545068de --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Registry.java @@ -0,0 +1,69 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.registry; + +import static com.google.common.base.Preconditions.checkState; +import static java.util.Objects.requireNonNull; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.annotation.Nullable; + +public class Registry implements Iterable { + private final Map map = new HashMap<>(); + private final String name; + + public Registry(final String name) { + this.name = name; + } + + public @Nullable V get(final String key) { + checkState(key.equals(key.toLowerCase()), "key must be lowercase"); + return this.map.get(key); + } + + public V register(final String key, final V value) { + requireNonNull(key, "key"); + requireNonNull(value, "value"); + checkState(key.equals(key.toLowerCase()), "key must be lowercase"); + checkState(!this.map.containsKey(key), "key '%s' already has an associated %s", key, this.name); + this.map.put(key, value); + return value; + } + + public Set keySet() { + return Collections.unmodifiableSet(this.map.keySet()); + } + + public Collection values() { + return Collections.unmodifiableCollection(this.map.values()); + } + + @Override + public Iterator iterator() { + return this.map.values().iterator(); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java new file mode 100644 index 000000000..75e0765c4 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java @@ -0,0 +1,66 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.registry.state; + +import static com.google.common.base.Preconditions.checkState; + +import java.util.List; + +public abstract class AbstractProperty implements Property { + + private String name; + private List values; + + public AbstractProperty(final String name, final List values) { + this.name = name; + this.values = values; + } + + @Override + public List getValues() { + return this.values; + } + + @Override + public String getName() { + return this.name; + } + + /** + * Internal method for name setting post-deserialise. Do not use. + */ + public void setName(final String name) { + checkState(this.name == null, "name already set"); + this.name = name; + } + + @Override + public int hashCode() { + return name.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Property)) { + return false; + } + return getName().equals(((Property) obj).getName()); + } +} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RegionMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/BooleanProperty.java similarity index 59% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RegionMask.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/BooleanProperty.java index 220aaf4b9..b6502f3ff 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RegionMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/BooleanProperty.java @@ -17,25 +17,25 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.masks; +package com.sk89q.worldedit.registry.state; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.regions.Region; +import java.util.List; -/** - * @deprecated See {@link com.sk89q.worldedit.function.mask.RegionMask} - */ -@Deprecated -public class RegionMask extends AbstractMask { - private final Region region; +import javax.annotation.Nullable; - public RegionMask(Region region) { - this.region = region.clone(); +public class BooleanProperty extends AbstractProperty { + + public BooleanProperty(final String name, final List values) { + super(name, values); } + @Nullable @Override - public boolean matches(EditSession editSession, Vector position) { - return region.contains(position); + public Boolean getValueFor(String string) { + boolean val = Boolean.parseBoolean(string); + if (!getValues().contains(val)) { + throw new IllegalArgumentException("Invalid boolean value: " + string + ". Must be in " + getValues().toString()); + } + return val; } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitItem.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/DirectionalProperty.java similarity index 55% rename from worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitItem.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/DirectionalProperty.java index 01ea7ad50..32c0e1435 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitItem.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/DirectionalProperty.java @@ -17,27 +17,27 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.bukkit.entity; +package com.sk89q.worldedit.registry.state; -import com.sk89q.worldedit.Location; -import com.sk89q.worldedit.bukkit.BukkitUtil; -import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; +import com.sk89q.worldedit.util.Direction; -import java.util.UUID; +import java.util.List; -public class BukkitItem extends BukkitEntity { +import javax.annotation.Nullable; - private final ItemStack stack; - public BukkitItem(Location loc, ItemStack stack, UUID entityId) { - super(loc, EntityType.DROPPED_ITEM, entityId); - this.stack = stack; +public class DirectionalProperty extends AbstractProperty { + + public DirectionalProperty(final String name, final List values) { + super(name, values); } + @Nullable @Override - public boolean spawn(Location weLoc) { - org.bukkit.Location loc = BukkitUtil.toLocation(weLoc); - return loc.getWorld().dropItem(loc, stack) != null; + public Direction getValueFor(final String string) { + Direction direction = Direction.valueOf(string.toUpperCase()); + if (!getValues().contains(direction)) { + throw new IllegalArgumentException("Invalid direction value: " + string + ". Must be in " + getValues().toString()); + } + return direction; } - } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RandomMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/EnumProperty.java similarity index 62% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RandomMask.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/EnumProperty.java index a9e657ca6..d593eb062 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/RandomMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/EnumProperty.java @@ -17,25 +17,24 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.masks; +package com.sk89q.worldedit.registry.state; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.function.mask.NoiseFilter; +import java.util.List; -/** - * @deprecated See {@link NoiseFilter} - */ -@Deprecated -public class RandomMask extends AbstractMask { - private final double ratio; +import javax.annotation.Nullable; - public RandomMask(double ratio) { - this.ratio = ratio; +public class EnumProperty extends AbstractProperty { + + public EnumProperty(final String name, final List values) { + super(name, values); } + @Nullable @Override - public boolean matches(EditSession editSession, Vector position) { - return Math.random() < ratio; + public String getValueFor(String string) { + if (!getValues().contains(string)) { + throw new IllegalArgumentException("Invalid value: " + string + ". Must be in " + getValues().toString()); + } + return string; } } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/DynamicRegionMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/IntegerProperty.java similarity index 54% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/DynamicRegionMask.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/IntegerProperty.java index ebe866f57..fe7b7b7de 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/DynamicRegionMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/IntegerProperty.java @@ -17,30 +17,29 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.masks; +package com.sk89q.worldedit.registry.state; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.session.request.RequestSelection; +import java.util.List; -/** - * @deprecated Use {@link RequestSelection} with {@link com.sk89q.worldedit.function.mask.RegionMask} - */ -@Deprecated -public class DynamicRegionMask extends AbstractMask { - private Region region; +import javax.annotation.Nullable; +public class IntegerProperty extends AbstractProperty { + + public IntegerProperty(final String name, final List values) { + super(name, values); + } + + @Nullable @Override - public void prepare(LocalSession session, LocalPlayer player, Vector target) { + public Integer getValueFor(String string) { try { - region = session.getSelection(player.getWorld()); - } catch (IncompleteRegionException exc) { - region = null; + int val = Integer.parseInt(string); + if (!getValues().contains(val)) { + throw new IllegalArgumentException("Invalid int value: " + string + ". Must be in " + getValues().toString()); + } + return val; + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Invalid int value: " + string + ". Not an int."); } } - - @Override - public boolean matches(EditSession editSession, Vector position) { - return region == null || region.contains(position); - } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/State.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/Property.java similarity index 60% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/State.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/Property.java index a8cbfde3c..856bdd850 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/State.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/Property.java @@ -17,12 +17,11 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.world.registry; +package com.sk89q.worldedit.registry.state; -import com.sk89q.worldedit.blocks.BaseBlock; +import java.util.List; import javax.annotation.Nullable; -import java.util.Map; /** * Describes a state property of a block. @@ -30,32 +29,29 @@ import java.util.Map; *

Example states include "variant" (indicating material or type) and * "facing" (indicating orientation).

*/ -public interface State { +public interface Property { /** - * Return a map of available values for this state. + * Returns the name of this state. * - *

Keys are the value of state and map values describe that - * particular state value.

- * - * @return the map of state values + * @return The state name */ - Map valueMap(); + String getName(); /** - * Get the value that the block is set to. + * Return a list of available values for this state. * - * @param block the block - * @return the state, otherwise null if the block isn't set to any of the values + * @return the list of state values + */ + List getValues(); + + /** + * Gets the value for the given string, or null. + * + * @param string The string + * @return The value, or null + * @throws IllegalArgumentException When the value is invalid. */ @Nullable - StateValue getValue(BaseBlock block); - - /** - * Returns whether this state contains directional data. - * - * @return true if directional data is available - */ - boolean hasDirection(); - + T getValueFor(String string) throws IllegalArgumentException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java deleted file mode 100644 index 10afbb826..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java +++ /dev/null @@ -1,340 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.schematic; - -import com.sk89q.jnbt.ByteArrayTag; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.IntTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.NBTConstants; -import com.sk89q.jnbt.NBTInputStream; -import com.sk89q.jnbt.NBTOutputStream; -import com.sk89q.jnbt.NamedTag; -import com.sk89q.jnbt.ShortTag; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.CuboidClipboard; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.data.DataException; - -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - -public class MCEditSchematicFormat extends SchematicFormat { - - private static final int MAX_SIZE = Short.MAX_VALUE - Short.MIN_VALUE; - - protected MCEditSchematicFormat() { - super("MCEdit", "mcedit", "mce"); - } - - public CuboidClipboard load(InputStream stream) throws IOException, DataException { - NBTInputStream nbtStream = new NBTInputStream( - new GZIPInputStream(stream)); - - Vector origin = new Vector(); - Vector offset = new Vector(); - - // Schematic tag - NamedTag rootTag = nbtStream.readNamedTag(); - nbtStream.close(); - if (!rootTag.getName().equals("Schematic")) { - throw new DataException("Tag \"Schematic\" does not exist or is not first"); - } - - CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); - - // Check - Map schematic = schematicTag.getValue(); - if (!schematic.containsKey("Blocks")) { - throw new DataException("Schematic file is missing a \"Blocks\" tag"); - } - - // Get information - short width = getChildTag(schematic, "Width", ShortTag.class).getValue(); - short length = getChildTag(schematic, "Length", ShortTag.class).getValue(); - short height = getChildTag(schematic, "Height", ShortTag.class).getValue(); - - try { - int originX = getChildTag(schematic, "WEOriginX", IntTag.class).getValue(); - int originY = getChildTag(schematic, "WEOriginY", IntTag.class).getValue(); - int originZ = getChildTag(schematic, "WEOriginZ", IntTag.class).getValue(); - origin = new Vector(originX, originY, originZ); - } catch (DataException e) { - // No origin data - } - - try { - int offsetX = getChildTag(schematic, "WEOffsetX", IntTag.class).getValue(); - int offsetY = getChildTag(schematic, "WEOffsetY", IntTag.class).getValue(); - int offsetZ = getChildTag(schematic, "WEOffsetZ", IntTag.class).getValue(); - offset = new Vector(offsetX, offsetY, offsetZ); - } catch (DataException e) { - // No offset data - } - - // Check type of Schematic - String materials = getChildTag(schematic, "Materials", StringTag.class).getValue(); - if (!materials.equals("Alpha")) { - throw new DataException("Schematic file is not an Alpha schematic"); - } - - // Get blocks - byte[] blockId = getChildTag(schematic, "Blocks", ByteArrayTag.class).getValue(); - byte[] blockData = getChildTag(schematic, "Data", ByteArrayTag.class).getValue(); - byte[] addId = new byte[0]; - short[] blocks = new short[blockId.length]; // Have to later combine IDs - - // We support 4096 block IDs using the same method as vanilla Minecraft, where - // the highest 4 bits are stored in a separate byte array. - if (schematic.containsKey("AddBlocks")) { - addId = getChildTag(schematic, "AddBlocks", ByteArrayTag.class).getValue(); - } - - // Combine the AddBlocks data with the first 8-bit block ID - for (int index = 0; index < blockId.length; index++) { - if ((index >> 1) >= addId.length) { // No corresponding AddBlocks index - blocks[index] = (short) (blockId[index] & 0xFF); - } else { - if ((index & 1) == 0) { - blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (blockId[index] & 0xFF)); - } else { - blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (blockId[index] & 0xFF)); - } - } - } - - // Need to pull out tile entities - List tileEntities = getChildTag(schematic, "TileEntities", ListTag.class) - .getValue(); - Map> tileEntitiesMap = - new HashMap>(); - - for (Tag tag : tileEntities) { - if (!(tag instanceof CompoundTag)) continue; - CompoundTag t = (CompoundTag) tag; - - int x = 0; - int y = 0; - int z = 0; - - Map values = new HashMap(); - - for (Map.Entry entry : t.getValue().entrySet()) { - if (entry.getKey().equals("x")) { - if (entry.getValue() instanceof IntTag) { - x = ((IntTag) entry.getValue()).getValue(); - } - } else if (entry.getKey().equals("y")) { - if (entry.getValue() instanceof IntTag) { - y = ((IntTag) entry.getValue()).getValue(); - } - } else if (entry.getKey().equals("z")) { - if (entry.getValue() instanceof IntTag) { - z = ((IntTag) entry.getValue()).getValue(); - } - } - - values.put(entry.getKey(), entry.getValue()); - } - - BlockVector vec = new BlockVector(x, y, z); - tileEntitiesMap.put(vec, values); - } - - Vector size = new Vector(width, height, length); - CuboidClipboard clipboard = new CuboidClipboard(size); - clipboard.setOrigin(origin); - clipboard.setOffset(offset); - - for (int x = 0; x < width; ++x) { - for (int y = 0; y < height; ++y) { - for (int z = 0; z < length; ++z) { - int index = y * width * length + z * width + x; - BlockVector pt = new BlockVector(x, y, z); - BaseBlock block = getBlockForId(blocks[index], blockData[index]); - - if (tileEntitiesMap.containsKey(pt)) { - block.setNbtData(new CompoundTag(tileEntitiesMap.get(pt))); - } - clipboard.setBlock(pt, block); - } - } - } - - return clipboard; - } - - @Override - public CuboidClipboard load(File file) throws IOException, DataException { - return load(new FileInputStream(file)); - } - - @Override - public void save(CuboidClipboard clipboard, File file) throws IOException, DataException { - int width = clipboard.getWidth(); - int height = clipboard.getHeight(); - int length = clipboard.getLength(); - - if (width > MAX_SIZE) { - throw new DataException("Width of region too large for a .schematic"); - } - if (height > MAX_SIZE) { - throw new DataException("Height of region too large for a .schematic"); - } - if (length > MAX_SIZE) { - throw new DataException("Length of region too large for a .schematic"); - } - - HashMap schematic = new HashMap(); - schematic.put("Width", new ShortTag((short) width)); - schematic.put("Length", new ShortTag((short) length)); - schematic.put("Height", new ShortTag((short) height)); - schematic.put("Materials", new StringTag("Alpha")); - schematic.put("WEOriginX", new IntTag(clipboard.getOrigin().getBlockX())); - schematic.put("WEOriginY", new IntTag(clipboard.getOrigin().getBlockY())); - schematic.put("WEOriginZ", new IntTag(clipboard.getOrigin().getBlockZ())); - schematic.put("WEOffsetX", new IntTag(clipboard.getOffset().getBlockX())); - schematic.put("WEOffsetY", new IntTag(clipboard.getOffset().getBlockY())); - schematic.put("WEOffsetZ", new IntTag(clipboard.getOffset().getBlockZ())); - - // Copy - byte[] blocks = new byte[width * height * length]; - byte[] addBlocks = null; - byte[] blockData = new byte[width * height * length]; - ArrayList tileEntities = new ArrayList(); - - for (int x = 0; x < width; ++x) { - for (int y = 0; y < height; ++y) { - for (int z = 0; z < length; ++z) { - int index = y * width * length + z * width + x; - BaseBlock block = clipboard.getPoint(new BlockVector(x, y, z)); - - // Save 4096 IDs in an AddBlocks section - if (block.getType() > 255) { - if (addBlocks == null) { // Lazily create section - addBlocks = new byte[(blocks.length >> 1) + 1]; - } - - addBlocks[index >> 1] = (byte) (((index & 1) == 0) ? - addBlocks[index >> 1] & 0xF0 | (block.getType() >> 8) & 0xF - : addBlocks[index >> 1] & 0xF | ((block.getType() >> 8) & 0xF) << 4); - } - - blocks[index] = (byte) block.getType(); - blockData[index] = (byte) block.getData(); - - // Get the list of key/values from the block - CompoundTag rawTag = block.getNbtData(); - if (rawTag != null) { - Map values = new HashMap(); - for (Entry entry : rawTag.getValue().entrySet()) { - values.put(entry.getKey(), entry.getValue()); - } - - values.put("id", new StringTag(block.getNbtId())); - values.put("x", new IntTag(x)); - values.put("y", new IntTag(y)); - values.put("z", new IntTag(z)); - - CompoundTag tileEntityTag = new CompoundTag(values); - tileEntities.add(tileEntityTag); - } - } - } - } - - schematic.put("Blocks", new ByteArrayTag(blocks)); - schematic.put("Data", new ByteArrayTag(blockData)); - schematic.put("Entities", new ListTag(CompoundTag.class, new ArrayList())); - schematic.put("TileEntities", new ListTag(CompoundTag.class, tileEntities)); - if (addBlocks != null) { - schematic.put("AddBlocks", new ByteArrayTag(addBlocks)); - } - - // Build and output - CompoundTag schematicTag = new CompoundTag(schematic); - NBTOutputStream stream = new NBTOutputStream(new GZIPOutputStream(new FileOutputStream(file))); - stream.writeNamedTag("Schematic", schematicTag); - stream.close(); - } - - @Override - public boolean isOfFormat(File file) { - DataInputStream str = null; - try { - str = new DataInputStream(new GZIPInputStream(new FileInputStream(file))); - if ((str.readByte() & 0xFF) != NBTConstants.TYPE_COMPOUND) { - return false; - } - byte[] nameBytes = new byte[str.readShort() & 0xFFFF]; - str.readFully(nameBytes); - String name = new String(nameBytes, NBTConstants.CHARSET); - return name.equals("Schematic"); - } catch (IOException e) { - return false; - } finally { - if (str != null) { - try { - str.close(); - } catch (IOException ignore) { - // blargh - } - } - } - } - - /** - * Get child tag of a NBT structure. - * - * @param items The parent tag map - * @param key The name of the tag to get - * @param expected The expected type of the tag - * @return child tag casted to the expected type - * @throws DataException if the tag does not exist or the tag is not of the expected type - */ - private static T getChildTag(Map items, String key, - Class expected) throws DataException { - - if (!items.containsKey(key)) { - throw new DataException("Schematic file is missing a \"" + key + "\" tag"); - } - Tag tag = items.get(key); - if (!expected.isInstance(tag)) { - throw new DataException( - key + " tag is not of tag type " + expected.getName()); - } - return expected.cast(tag); - } - -} \ No newline at end of file diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/SchematicFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/SchematicFormat.java deleted file mode 100644 index 1de675822..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/schematic/SchematicFormat.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.schematic; - -import com.sk89q.worldedit.CuboidClipboard; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.data.DataException; - -import java.io.File; -import java.io.IOException; -import java.util.*; - -public abstract class SchematicFormat { - - private static final Map SCHEMATIC_FORMATS = new HashMap(); - - // Built-in schematic formats - public static final SchematicFormat MCEDIT = new MCEditSchematicFormat(); - - public static Set getFormats() { - return Collections.unmodifiableSet(new HashSet(SCHEMATIC_FORMATS.values())); - } - - public static SchematicFormat getFormat(String lookupName) { - return SCHEMATIC_FORMATS.get(lookupName.toLowerCase()); - } - - public static SchematicFormat getFormat(File file) { - if (!file.isFile()) { - return null; - } - - for (SchematicFormat format : SCHEMATIC_FORMATS.values()) { - if (format.isOfFormat(file)) { - return format; - } - } - return null; - } - - private final String name; - private final String[] lookupNames; - - protected SchematicFormat(String name, String... lookupNames) { - this.name = name; - List registeredLookupNames = new ArrayList(lookupNames.length); - for (int i = 0; i < lookupNames.length; ++i) { - if (i == 0 || !SCHEMATIC_FORMATS.containsKey(lookupNames[i].toLowerCase())) { - SCHEMATIC_FORMATS.put(lookupNames[i].toLowerCase(), this); - registeredLookupNames.add(lookupNames[i].toLowerCase()); - } - } - this.lookupNames = registeredLookupNames.toArray(new String[registeredLookupNames.size()]); - } - - /** - * Gets the official/display name for this schematic format - * - * @return The display name for this schematic format - */ - public String getName() { - return name; - } - - public String[] getLookupNames() { - return lookupNames; - } - - public BaseBlock getBlockForId(int id, short data) { - BaseBlock block; - switch (id) { - /*case BlockID.WALL_SIGN: - case BlockID.SIGN_POST: - block = new SignBlock(id, data); - break; - - case BlockID.CHEST: - block = new ChestBlock(data); - break; - - case BlockID.FURNACE: - case BlockID.BURNING_FURNACE: - block = new FurnaceBlock(id, data); - break; - - case BlockID.DISPENSER: - block = new DispenserBlock(data); - break; - - case BlockID.MOB_SPAWNER: - block = new MobSpawnerBlock(id); - break; - - case BlockID.NOTE_BLOCK: - block = new NoteBlock(data); - break;*/ - - default: - block = new BaseBlock(id, data); - break; - } - return block; - } - - /** - * Loads a schematic from the given file into a CuboidClipboard - * @param file The file to load from - * @return The CuboidClipboard containing the contents of this schematic - * @throws IOException If an error occurs while reading data - * @throws DataException if data is not in the correct format - */ - public abstract CuboidClipboard load(File file) throws IOException, DataException; - - /** - * Saves the data from the specified CuboidClipboard to the given file, overwriting any - * existing data in the file - * @param clipboard The clipboard to get data from - * @param file The file to save to - * @throws IOException If an error occurs while writing data - * @throws DataException If the clipboard has data which cannot be stored - */ - public abstract void save(CuboidClipboard clipboard, File file) throws IOException, DataException; - - public abstract boolean isOfFormat(File file); - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java index bca3f641a..98c62ec59 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java @@ -19,13 +19,20 @@ package com.sk89q.worldedit.scripting; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.DisallowedItemException; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.UnknownItemException; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.command.InsufficientArgumentsException; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.patterns.Pattern; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.util.io.file.FilenameException; +import com.sk89q.worldedit.world.block.BlockStateHolder; import java.io.File; import java.util.ArrayList; @@ -36,10 +43,9 @@ import java.util.Set; /** * The context given to scripts. */ -@SuppressWarnings("deprecation") public class CraftScriptContext extends CraftScriptEnvironment { - private List editSessions = new ArrayList(); + private List editSessions = new ArrayList<>(); private String[] args; public CraftScriptContext(WorldEdit controller, @@ -143,7 +149,7 @@ public class CraftScriptContext extends CraftScriptEnvironment { } /** - * Get an item ID from an item name or an item ID number. + * Get an item from an item name or an item ID number. * * @param input input to parse * @param allAllowed true to ignore blacklists @@ -151,8 +157,15 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws UnknownItemException * @throws DisallowedItemException */ - public BaseBlock getBlock(String input, boolean allAllowed) throws WorldEditException { - return controller.getBlock(player, input, allAllowed); + public BlockStateHolder getBlock(String input, boolean allAllowed) throws WorldEditException { + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + context.setRestricted(!allAllowed); + context.setPreferringWildcard(false); + + return controller.getBlockFactory().parseFromListInput(input, context).stream().findFirst().orElse(null); } /** @@ -163,8 +176,8 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws UnknownItemException * @throws DisallowedItemException */ - public BaseBlock getBlock(String id) throws WorldEditException { - return controller.getBlock(player, id, false); + public BlockStateHolder getBlock(String id) throws WorldEditException { + return getBlock(id, false); } /** @@ -176,7 +189,11 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws DisallowedItemException */ public Pattern getBlockPattern(String list) throws WorldEditException { - return controller.getBlockPattern(player, list); + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + return controller.getPatternFactory().parseFromInput(list, context); } /** @@ -188,27 +205,13 @@ public class CraftScriptContext extends CraftScriptEnvironment { * @throws UnknownItemException * @throws DisallowedItemException */ - public Set getBlockIDs(String list, boolean allBlocksAllowed) throws WorldEditException { - return controller.getBlockIDs(player, list, allBlocksAllowed); - } - - /** - * Gets the path to a file. This method will check to see if the filename - * has valid characters and has an extension. It also prevents directory - * traversal exploits by checking the root directory and the file directory. - * On success, a {@code java.io.File} object will be returned. - * - *

Use this method if you need to read a file from a directory.

- * - * @param folder sub-directory to look in - * @param filename filename (user-submitted) - * @return a file - * @throws FilenameException - */ - @Deprecated - public File getSafeFile(String folder, String filename) throws FilenameException { - File dir = controller.getWorkingDirectoryFile(folder); - return controller.getSafeOpenFile(player, dir, filename, null, (String[]) null); + public Set getBlocks(String list, boolean allBlocksAllowed) throws WorldEditException { + ParserContext context = new ParserContext(); + context.setActor(player); + context.setWorld(player.getWorld()); + context.setSession(session); + context.setRestricted(!allBlocksAllowed); + return controller.getBlockFactory().parseFromListInput(list, context); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptEngine.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptEngine.java index fbadc0fa1..e86ae6efc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptEngine.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptEngine.java @@ -20,6 +20,7 @@ package com.sk89q.worldedit.scripting; import java.util.Map; + import javax.script.ScriptException; public interface CraftScriptEngine { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/RhinoCraftScriptEngine.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/RhinoCraftScriptEngine.java index 7f3354bbc..79d51cefb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/RhinoCraftScriptEngine.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/RhinoCraftScriptEngine.java @@ -19,8 +19,7 @@ package com.sk89q.worldedit.scripting; -import java.util.Map; -import javax.script.ScriptException; +import com.sk89q.worldedit.WorldEditException; import org.mozilla.javascript.Context; import org.mozilla.javascript.ImporterTopLevel; import org.mozilla.javascript.JavaScriptException; @@ -29,7 +28,9 @@ import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.ScriptableObject; import org.mozilla.javascript.WrappedException; -import com.sk89q.worldedit.WorldEditException; +import java.util.Map; + +import javax.script.ScriptException; public class RhinoCraftScriptEngine implements CraftScriptEngine { private int timeLimit; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/java/RhinoScriptEngine.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/java/RhinoScriptEngine.java index bf64e4e12..afab20c3a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/java/RhinoScriptEngine.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/java/RhinoScriptEngine.java @@ -19,6 +19,14 @@ package com.sk89q.worldedit.scripting.java; +import com.sk89q.worldedit.scripting.RhinoContextFactory; +import org.mozilla.javascript.Context; +import org.mozilla.javascript.ImporterTopLevel; +import org.mozilla.javascript.JavaScriptException; +import org.mozilla.javascript.RhinoException; +import org.mozilla.javascript.Scriptable; +import org.mozilla.javascript.ScriptableObject; + import java.io.IOException; import java.io.Reader; @@ -30,14 +38,6 @@ import javax.script.ScriptEngineFactory; import javax.script.ScriptException; import javax.script.SimpleBindings; -import org.mozilla.javascript.Context; -import org.mozilla.javascript.ImporterTopLevel; -import org.mozilla.javascript.JavaScriptException; -import org.mozilla.javascript.RhinoException; -import org.mozilla.javascript.Scriptable; -import org.mozilla.javascript.ScriptableObject; -import com.sk89q.worldedit.scripting.RhinoContextFactory; - public class RhinoScriptEngine extends AbstractScriptEngine { private ScriptEngineFactory factory; private Context cx; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/java/RhinoScriptEngineFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/java/RhinoScriptEngineFactory.java index 0e3c4be1d..ee312229c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/java/RhinoScriptEngineFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/java/RhinoScriptEngineFactory.java @@ -22,6 +22,7 @@ package com.sk89q.worldedit.scripting.java; import java.util.ArrayList; import java.util.Collections; import java.util.List; + import javax.script.ScriptEngine; import javax.script.ScriptEngineFactory; @@ -31,7 +32,7 @@ public class RhinoScriptEngineFactory implements ScriptEngineFactory { private static List extensions; static { - names = new ArrayList(5); + names = new ArrayList<>(5); names.add("ECMAScript"); names.add("ecmascript"); names.add("JavaScript"); @@ -39,14 +40,14 @@ public class RhinoScriptEngineFactory implements ScriptEngineFactory { names.add("js"); names = Collections.unmodifiableList(names); - mimeTypes = new ArrayList(4); + mimeTypes = new ArrayList<>(4); mimeTypes.add("application/ecmascript"); mimeTypes.add("text/ecmascript"); mimeTypes.add("application/javascript"); mimeTypes.add("text/javascript"); mimeTypes = Collections.unmodifiableList(mimeTypes); - extensions = new ArrayList(2); + extensions = new ArrayList<>(2); extensions.add("emcascript"); extensions.add("js"); extensions = Collections.unmodifiableList(extensions); @@ -116,20 +117,21 @@ public class RhinoScriptEngineFactory implements ScriptEngineFactory { @Override public Object getParameter(String key) { - if (key.equals(ScriptEngine.ENGINE)) { - return getEngineName(); - } else if (key.equals(ScriptEngine.ENGINE_VERSION)) { - return getEngineVersion(); - } else if (key.equals(ScriptEngine.NAME)) { - return getEngineName(); - } else if (key.equals(ScriptEngine.LANGUAGE)) { - return getLanguageName(); - } else if (key.equals(ScriptEngine.LANGUAGE_VERSION)) { - return getLanguageVersion(); - } else if (key.equals("THREADING")) { - return "MULTITHREADED"; - } else { - throw new IllegalArgumentException("Invalid key"); + switch (key) { + case ScriptEngine.ENGINE: + return getEngineName(); + case ScriptEngine.ENGINE_VERSION: + return getEngineVersion(); + case ScriptEngine.NAME: + return getEngineName(); + case ScriptEngine.LANGUAGE: + return getLanguageName(); + case ScriptEngine.LANGUAGE_VERSION: + return getLanguageVersion(); + case "THREADING": + return "MULTITHREADED"; + default: + throw new IllegalArgumentException("Invalid key"); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/ClipboardHolder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/ClipboardHolder.java index 37bb50de8..097c05cf6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/ClipboardHolder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/ClipboardHolder.java @@ -19,20 +19,18 @@ package com.sk89q.worldedit.session; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.math.transform.Identity; import com.sk89q.worldedit.math.transform.Transform; -import com.sk89q.worldedit.world.registry.WorldData; - -import static com.google.common.base.Preconditions.checkNotNull; /** * Holds the clipboard and the current transform on the clipboard. */ public class ClipboardHolder { - private final WorldData worldData; private final Clipboard clipboard; private Transform transform = new Identity(); @@ -40,22 +38,10 @@ public class ClipboardHolder { * Create a new instance with the given clipboard. * * @param clipboard the clipboard - * @param worldData the mapping of blocks, entities, and so on */ - public ClipboardHolder(Clipboard clipboard, WorldData worldData) { + public ClipboardHolder(Clipboard clipboard) { checkNotNull(clipboard); - checkNotNull(worldData); this.clipboard = clipboard; - this.worldData = worldData; - } - - /** - * Get the mapping used for blocks, entities, and so on. - * - * @return the mapping - */ - public WorldData getWorldData() { - return worldData; } /** @@ -94,8 +80,8 @@ public class ClipboardHolder { * * @return a builder */ - public PasteBuilder createPaste(Extent targetExtent, WorldData targetWorldData) { - return new PasteBuilder(this, targetExtent, targetWorldData); + public PasteBuilder createPaste(Extent targetExtent) { + return new PasteBuilder(this, targetExtent); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java index 5abe2e5f6..e4a9ade5a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.session; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.Clipboard; @@ -27,9 +29,6 @@ import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.math.transform.Transform; -import com.sk89q.worldedit.world.registry.WorldData; - -import static com.google.common.base.Preconditions.checkNotNull; /** * Builds an operation to paste the contents of a clipboard. @@ -37,10 +36,8 @@ import static com.google.common.base.Preconditions.checkNotNull; public class PasteBuilder { private final Clipboard clipboard; - private final WorldData worldData; private final Transform transform; private final Extent targetExtent; - private final WorldData targetWorldData; private Vector to = new Vector(); private boolean ignoreAirBlocks; @@ -50,17 +47,13 @@ public class PasteBuilder { * * @param holder the clipboard holder * @param targetExtent an extent - * @param targetWorldData world data of the target */ - PasteBuilder(ClipboardHolder holder, Extent targetExtent, WorldData targetWorldData) { + PasteBuilder(ClipboardHolder holder, Extent targetExtent) { checkNotNull(holder); checkNotNull(targetExtent); - checkNotNull(targetWorldData); this.clipboard = holder.getClipboard(); - this.worldData = holder.getWorldData(); this.transform = holder.getTransform(); this.targetExtent = targetExtent; - this.targetWorldData = targetWorldData; } /** @@ -90,7 +83,7 @@ public class PasteBuilder { * @return the operation */ public Operation build() { - BlockTransformExtent extent = new BlockTransformExtent(clipboard, transform, targetWorldData.getBlockRegistry()); + BlockTransformExtent extent = new BlockTransformExtent(clipboard, transform); ForwardExtentCopy copy = new ForwardExtentCopy(extent, clipboard.getRegion(), clipboard.getOrigin(), targetExtent, to); copy.setTransform(transform); if (ignoreAirBlocks) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index 60c788ca9..aa9b9e5df 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.session; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; @@ -33,8 +35,8 @@ import com.sk89q.worldedit.session.storage.SessionStore; import com.sk89q.worldedit.session.storage.VoidStore; import com.sk89q.worldedit.util.concurrency.EvenMoreExecutors; import com.sk89q.worldedit.util.eventbus.Subscribe; +import com.sk89q.worldedit.world.gamemode.GameModes; -import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.util.HashMap; @@ -47,7 +49,7 @@ import java.util.concurrent.Callable; import java.util.logging.Level; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Session manager for WorldEdit. @@ -64,7 +66,7 @@ public class SessionManager { private static final Logger log = Logger.getLogger(SessionManager.class.getCanonicalName()); private final Timer timer = new Timer(); private final WorldEdit worldEdit; - private final Map sessions = new HashMap(); + private final Map sessions = new HashMap<>(); private SessionStore store = new VoidStore(); /** @@ -186,7 +188,7 @@ public class SessionManager { session.setUseInventory(config.useInventory && !(config.useInventoryOverride && (owner.hasPermission("worldedit.inventory.unrestricted") - || (config.useInventoryCreativeOverride && (!(owner instanceof Player) || ((Player) owner).hasCreativeMode()))))); + || (config.useInventoryCreativeOverride && (!(owner instanceof Player) || ((Player) owner).getGameMode() == GameModes.CREATIVE))))); return session; } @@ -204,30 +206,27 @@ public class SessionManager { return Futures.immediateFuture(sessions); } - return executorService.submit(new Callable() { - @Override - public Object call() throws Exception { - Exception exception = null; + return executorService.submit((Callable) () -> { + Exception exception = null; - for (Map.Entry entry : sessions.entrySet()) { - SessionKey key = entry.getKey(); + for (Map.Entry entry : sessions.entrySet()) { + SessionKey key = entry.getKey(); - if (key.isPersistent()) { - try { - store.save(getKey(key), entry.getValue()); - } catch (IOException e) { - log.log(Level.WARNING, "Failed to write session for UUID " + getKey(key), e); - exception = e; - } + if (key.isPersistent()) { + try { + store.save(getKey(key), entry.getValue()); + } catch (IOException e) { + log.log(Level.WARNING, "Failed to write session for UUID " + getKey(key), e); + exception = e; } } - - if (exception != null) { - throw exception; - } - - return sessions; } + + if (exception != null) { + throw exception; + } + + return sessions; }); } @@ -305,7 +304,7 @@ public class SessionManager { synchronized (SessionManager.this) { long now = System.currentTimeMillis(); Iterator it = sessions.values().iterator(); - Map saveQueue = new HashMap(); + Map saveQueue = new HashMap<>(); while (it.hasNext()) { SessionHolder stored = it.next(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java index 99993ffa3..fd7cd2dde 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java @@ -30,12 +30,7 @@ import javax.annotation.Nullable; */ public final class Request { - private static final ThreadLocal threadLocal = - new ThreadLocal() { - @Override protected Request initialValue() { - return new Request(); - } - }; + private static final ThreadLocal threadLocal = ThreadLocal.withInitial(Request::new); private @Nullable World world; private @Nullable LocalSession session; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestSelection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestSelection.java index d714508a8..72ae6ef2b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestSelection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestSelection.java @@ -19,7 +19,12 @@ package com.sk89q.worldedit.session.request; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.BlockVector2D; +import com.sk89q.worldedit.IncompleteRegionException; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.regions.NullRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionOperationException; @@ -31,7 +36,7 @@ import java.util.Set; /** * A region that mirrors the current selection according to the current - * {@link LocalSession} and {@link LocalWorld} set on the current + * {@link LocalSession} and {@link World} set on the current * {@link Request}. * *

If a selection cannot be taken, then the selection will be assumed to be @@ -128,11 +133,6 @@ public class RequestSelection implements Region { return getRegion().getWorld(); } - @Override - public void setWorld(LocalWorld world) { - setWorld((World) world); - } - @Override public void setWorld(World world) { getRegion().setWorld(world); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java index 7247a52cd..d7b2a9893 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.session.storage; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonIOException; @@ -38,8 +40,6 @@ import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Stores sessions as JSON files in a directory. * @@ -85,8 +85,7 @@ public class JsonFileSessionStore implements SessionStore { @Override public LocalSession load(UUID id) throws IOException { File file = getPath(id); - Closer closer = Closer.create(); - try { + try (Closer closer = Closer.create()) { FileReader fr = closer.register(new FileReader(file)); BufferedReader br = closer.register(new BufferedReader(fr)); return gson.fromJson(br, LocalSession.class); @@ -94,11 +93,6 @@ public class JsonFileSessionStore implements SessionStore { throw new IOException(e); } catch (FileNotFoundException e) { return new LocalSession(); - } finally { - try { - closer.close(); - } catch (IOException ignored) { - } } } @@ -106,19 +100,13 @@ public class JsonFileSessionStore implements SessionStore { public void save(UUID id, LocalSession session) throws IOException { File finalFile = getPath(id); File tempFile = new File(finalFile.getParentFile(), finalFile.getName() + ".tmp"); - Closer closer = Closer.create(); - try { + try (Closer closer = Closer.create()) { FileWriter fr = closer.register(new FileWriter(tempFile)); BufferedWriter bw = closer.register(new BufferedWriter(fr)); gson.toJson(session, bw); } catch (JsonIOException e) { throw new IOException(e); - } finally { - try { - closer.close(); - } catch (IOException ignored) { - } } if (finalFile.exists()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Countable.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Countable.java index e1f48d135..e522c3ae6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Countable.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Countable.java @@ -67,12 +67,6 @@ public class Countable implements Comparable> { @Override public int compareTo(Countable other) { - if (amount > other.amount) { - return 1; - } else if (amount == other.amount) { - return 0; - } else { - return -1; - } + return Integer.compare(amount, other.amount); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java index 1bd8607b0..0907753a4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java @@ -53,7 +53,7 @@ public enum Direction { private final Vector direction; private final int flags; - private Direction(Vector vector, int flags) { + Direction(Vector vector, int flags) { this.direction = vector.normalize(); this.flags = flags; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Enums.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Enums.java index 9f397c127..7e9160eb0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Enums.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Enums.java @@ -19,10 +19,10 @@ package com.sk89q.worldedit.util; -import javax.annotation.Nullable; - import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; + /** * Helper methods for enums. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/FileDialogUtil.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/FileDialogUtil.java index 47659b036..b44850ca7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/FileDialogUtil.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/FileDialogUtil.java @@ -21,13 +21,14 @@ package com.sk89q.worldedit.util; import com.sk89q.util.StringUtil; -import javax.swing.*; -import javax.swing.filechooser.FileFilter; import java.io.File; import java.util.Arrays; import java.util.HashSet; import java.util.Set; +import javax.swing.JFileChooser; +import javax.swing.filechooser.FileFilter; + public final class FileDialogUtil { private FileDialogUtil() { } @@ -69,7 +70,7 @@ public final class FileDialogUtil { private String desc; private ExtensionFilter(String[] exts) { - this.exts = new HashSet(Arrays.asList(exts)); + this.exts = new HashSet<>(Arrays.asList(exts)); desc = StringUtil.joinString(exts, ","); } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/data/DataException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/GuavaUtil.java similarity index 71% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/data/DataException.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/util/GuavaUtil.java index 442ffc35f..861858aed 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/data/DataException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/GuavaUtil.java @@ -17,18 +17,17 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.data; +package com.sk89q.worldedit.util; -/** - * @deprecated Switch to {@link com.sk89q.worldedit.world.DataException} - */ -@Deprecated -public class DataException extends com.sk89q.worldedit.world.DataException { +import static com.google.common.base.Preconditions.checkNotNull; - public DataException(String msg) { - super(msg); - } +import javax.annotation.Nullable; - public DataException() { +public final class GuavaUtil { + + private GuavaUtil() {} + + public static T firstNonNull(@Nullable T first, @Nullable T second) { + return first != null ? first : checkNotNull(second); } } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBagException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/HandSide.java similarity index 81% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBagException.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/util/HandSide.java index 8b3ace06f..b74b31908 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/BlockBagException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/HandSide.java @@ -17,13 +17,9 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.bags; - - -/** - * @deprecated Block bags are currently not a supported feature of WorldEdit - */ -@Deprecated -public class BlockBagException extends Exception { +package com.sk89q.worldedit.util; +public enum HandSide { + MAIN_HAND, + OFF_HAND } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Java8Detector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Java8Detector.java deleted file mode 100644 index 71a05d667..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Java8Detector.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ -package com.sk89q.worldedit.util; - -import com.google.common.base.Joiner; -import com.sk89q.worldedit.WorldEdit; - -public final class Java8Detector { - - public static void notifyIfNot8() { - String[] ver = System.getProperty("java.version").split("\\."); - int major = Integer.parseInt(ver[1]); - if (major <= 7) { - // Implicitly java 7 because we compile against 7, so this won't - // even launch on 6. - WorldEdit.logger.warning( - "WorldEdit has detected you are using Java 7" - + " (based on detected version " - + Joiner.on('.').join(ver) + ")."); - WorldEdit.logger.warning( - "WorldEdit will stop supporting Java less than version 8 in the future," - + " due to Java 7 being EOL since April 2015." - + " Please update your server to Java 8."); - } - } - - private Java8Detector() { - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java index 4d75c45bd..521545b37 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java @@ -19,11 +19,11 @@ package com.sk89q.worldedit.util; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.extent.Extent; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Represents a location in a world with has a direction. * @@ -217,6 +217,15 @@ public class Location { xz * Math.cos(yaw)); } + /** + * Get the direction as a {@link Direction}. + * + * @return The direction + */ + public Direction getDirectionEnum() { + return Direction.findClosest(getDirection(), Direction.Flag.ALL); + } + /** * Create a clone of this object with the given direction. * @@ -356,6 +365,16 @@ public class Location { return new Location(extent, position.setZ(z), yaw, pitch); } + /** + * Return a copy of this object with the position set to the given value. + * + * @param position The new position + * @return a new immutable instance + */ + public Location setPosition(Vector position) { + return new Location(extent, position, yaw, pitch); + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java index 8dbbe210c..472796c4a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java @@ -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.LegacyMapper; import com.sk89q.worldedit.world.snapshot.SnapshotRepository; import java.io.File; @@ -33,6 +34,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.util.Arrays; import java.util.HashSet; import java.util.Properties; import java.util.Set; @@ -63,26 +65,17 @@ public class PropertiesConfiguration extends LocalConfiguration { @Override public void load() { - InputStream stream = null; - try { - stream = new FileInputStream(path); + try (InputStream stream = new FileInputStream(path)) { properties.load(stream); } catch (FileNotFoundException ignored) { } catch (IOException e) { log.log(Level.WARNING, "Failed to read configuration", e); - } finally { - if (stream != null) { - try { - stream.close(); - } catch (IOException ignored) { - } - } } loadExtra(); profile = getBool("profile", profile); - disallowedBlocks = getIntSet("disallowed-blocks", defaultDisallowedBlocks); + disallowedBlocks = getStringSet("disallowed-blocks", defaultDisallowedBlocks); defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit); maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit); defaultMaxPolygonalPoints = getInt("default-max-polygon-points", defaultMaxPolygonalPoints); @@ -95,15 +88,24 @@ public class PropertiesConfiguration extends LocalConfiguration { maxBrushRadius = getInt("max-brush-radius", maxBrushRadius); logCommands = getBool("log-commands", logCommands); logFile = getString("log-file", logFile); + logFormat = getString("log-format", logFormat); registerHelp = getBool("register-help", registerHelp); - wandItem = getInt("wand-item", wandItem); + wandItem = getString("wand-item", wandItem); + try { + wandItem = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(wandItem)).getId(); + } catch (Throwable e) { + } superPickaxeDrop = getBool("super-pickaxe-drop-items", superPickaxeDrop); superPickaxeManyDrop = getBool("super-pickaxe-many-drop-items", superPickaxeManyDrop); noDoubleSlash = getBool("no-double-slash", noDoubleSlash); useInventory = getBool("use-inventory", useInventory); useInventoryOverride = getBool("use-inventory-override", useInventoryOverride); useInventoryCreativeOverride = getBool("use-inventory-creative-override", useInventoryCreativeOverride); - navigationWand = getInt("nav-wand-item", navigationWand); + navigationWand = getString("nav-wand-item", navigationWand); + try { + navigationWand = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(navigationWand)).getId(); + } catch (Throwable e) { + } navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance); navigationUseGlass = getBool("nav-use-glass", navigationUseGlass); scriptTimeout = getInt("scripting-timeout", scriptTimeout); @@ -120,22 +122,11 @@ public class PropertiesConfiguration extends LocalConfiguration { snapshotRepo = new SnapshotRepository(snapshotsDir); } - OutputStream output = null; path.getParentFile().mkdirs(); - try { - output = new FileOutputStream(path); + try (OutputStream output = new FileOutputStream(path)) { properties.store(output, "Don't put comments; they get removed"); - } catch (FileNotFoundException e) { - log.log(Level.WARNING, "Failed to write configuration", e); } catch (IOException e) { log.log(Level.WARNING, "Failed to write configuration", e); - } finally { - if (output != null) { - try { - output.close(); - } catch (IOException ignored) { - } - } } } @@ -238,13 +229,13 @@ public class PropertiesConfiguration extends LocalConfiguration { String val = properties.getProperty(key); if (val == null) { properties.setProperty(key, StringUtil.joinString(def, ",", 0)); - Set set = new HashSet(); + Set set = new HashSet<>(); for (int i : def) { set.add(i); } return set; } else { - Set set = new HashSet(); + Set set = new HashSet<>(); String[] parts = val.split(","); for (String part : parts) { try { @@ -257,4 +248,30 @@ public class PropertiesConfiguration extends LocalConfiguration { } } + /** + * Get a String set. + * + * @param key the key + * @param def the default value + * @return the value + */ + protected Set getStringSet(String key, String[] def) { + String val = properties.getProperty(key); + if (val == null) { + properties.setProperty(key, StringUtil.joinString(def, ",", 0)); + return new HashSet<>(Arrays.asList(def)); + } else { + Set set = new HashSet<>(); + String[] parts = val.split(","); + for (String part : parts) { + try { + String v = part.trim(); + set.add(v); + } catch (NumberFormatException ignored) { + } + } + return set; + } + } + } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java index d647ca067..a703e6baf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java @@ -19,11 +19,10 @@ package com.sk89q.worldedit.util; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BlockID; -import com.sk89q.worldedit.blocks.BlockType; +import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.internal.LocalWorldAdapter; +import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockTypes; /** * This class uses an inefficient method to figure out what block a player @@ -34,7 +33,7 @@ import com.sk89q.worldedit.internal.LocalWorldAdapter; */ public class TargetBlock { - private LocalWorld world; + private World world; private int maxDistance; private double checkDistance, curDistance; private Vector targetPos = new Vector(); @@ -47,33 +46,22 @@ public class TargetBlock { * * @param player player to work with */ - public TargetBlock(LocalPlayer player) { - this.world = LocalWorldAdapter.adapt(player.getWorld()); - this.setValues(player.getPosition(), player.getYaw(), player.getPitch(), + public TargetBlock(Player player) { + this.world = player.getWorld(); + this.setValues(player.getLocation().toVector(), player.getLocation().getYaw(), player.getLocation().getPitch(), 300, 1.65, 0.2); } /** * Constructor requiring a player, max distance and a checking distance * - * @param player LocalPlayer to work with - * @param maxDistance how far it checks for blocks - * @param checkDistance how often to check for blocks, the smaller the more precise - */ - public TargetBlock(LocalPlayer player, int maxDistance, double checkDistance) { - this((Player) player, maxDistance, checkDistance); - } - - /** - * Constructor requiring a player, max distance and a checking distance - * - * @param player LocalPlayer to work with + * @param player Player to work with * @param maxDistance how far it checks for blocks * @param checkDistance how often to check for blocks, the smaller the more precise */ public TargetBlock(Player player, int maxDistance, double checkDistance) { - this.world = LocalWorldAdapter.adapt(player.getWorld()); - this.setValues(player.getPosition(), player.getYaw(), player.getPitch(), maxDistance, 1.65, checkDistance); + this.world = player.getWorld(); + this.setValues(player.getLocation().toVector(), player.getLocation().getYaw(), player.getLocation().getPitch(), maxDistance, 1.65, checkDistance); } /** @@ -86,8 +74,7 @@ public class TargetBlock { * @param viewHeight where the view is positioned in y-axis * @param checkDistance how often to check for blocks, the smaller the more precise */ - private void setValues(Vector loc, double xRotation, double yRotation, - int maxDistance, double viewHeight, double checkDistance) { + private void setValues(Vector loc, double xRotation, double yRotation, int maxDistance, double viewHeight, double checkDistance) { this.maxDistance = maxDistance; this.checkDistance = checkDistance; this.curDistance = 0; @@ -111,11 +98,11 @@ public class TargetBlock { * * @return Block */ - public BlockWorldVector getAnyTargetBlock() { + public Location getAnyTargetBlock() { boolean searchForLastBlock = true; - BlockWorldVector lastBlock = null; + Location lastBlock = null; while (getNextBlock() != null) { - if (world.getBlockType(getCurrentBlock()) == BlockID.AIR) { + if (world.getBlock(getCurrentBlock().toVector()).getBlockType() == BlockTypes.AIR) { if (searchForLastBlock) { lastBlock = getCurrentBlock(); if (lastBlock.getBlockY() <= 0 || lastBlock.getBlockY() >= world.getMaxY()) { @@ -126,7 +113,7 @@ public class TargetBlock { break; } } - BlockWorldVector currentBlock = getCurrentBlock(); + Location currentBlock = getCurrentBlock(); return (currentBlock != null ? currentBlock : lastBlock); } @@ -136,8 +123,8 @@ public class TargetBlock { * * @return Block */ - public BlockWorldVector getTargetBlock() { - while (getNextBlock() != null && world.getBlockType(getCurrentBlock()) == 0) ; + public Location getTargetBlock() { + while (getNextBlock() != null && world.getBlock(getCurrentBlock().toVector()).getBlockType() == BlockTypes.AIR) ; return getCurrentBlock(); } @@ -147,8 +134,8 @@ public class TargetBlock { * * @return Block */ - public BlockWorldVector getSolidTargetBlock() { - while (getNextBlock() != null && BlockType.canPassThrough(world.getBlock(getCurrentBlock()))) ; + public Location getSolidTargetBlock() { + while (getNextBlock() != null && !world.getBlock(getCurrentBlock().toVector()).getBlockType().getMaterial().isMovementBlocker()) ; return getCurrentBlock(); } @@ -157,7 +144,7 @@ public class TargetBlock { * * @return next block position */ - public BlockWorldVector getNextBlock() { + public Location getNextBlock() { prevPos = targetPos; do { curDistance += checkDistance; @@ -175,7 +162,7 @@ public class TargetBlock { return null; } - return new BlockWorldVector(world, targetPos); + return new Location(world, targetPos); } /** @@ -183,11 +170,11 @@ public class TargetBlock { * * @return block position */ - public BlockWorldVector getCurrentBlock() { + public Location getCurrentBlock() { if (curDistance > maxDistance) { return null; } else { - return new BlockWorldVector(world, targetPos); + return new Location(world, targetPos); } } @@ -196,18 +183,18 @@ public class TargetBlock { * * @return block position */ - public BlockWorldVector getPreviousBlock() { - return new BlockWorldVector(world, prevPos); + public Location getPreviousBlock() { + return new Location(world, prevPos); } - public WorldVectorFace getAnyTargetBlockFace() { + public Location getAnyTargetBlockFace() { getAnyTargetBlock(); - return WorldVectorFace.getWorldVectorFace(world, getCurrentBlock(), getPreviousBlock()); + return getCurrentBlock().setDirection(getCurrentBlock().toVector().subtract(getPreviousBlock().toVector())); } - public WorldVectorFace getTargetBlockFace() { + public Location getTargetBlockFace() { getAnyTargetBlock(); - return WorldVectorFace.getWorldVectorFace(world, getCurrentBlock(), getPreviousBlock()); + return getCurrentBlock().setDirection(getCurrentBlock().toVector().subtract(getPreviousBlock().toVector())); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java index 18c9b0702..d0167bc73 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java @@ -23,10 +23,10 @@ import com.google.common.collect.Sets; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; -import javax.annotation.Nullable; import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; @@ -34,6 +34,8 @@ import java.util.Map; import java.util.Random; import java.util.Set; +import javax.annotation.Nullable; + /** * Tree generator. */ @@ -107,7 +109,7 @@ public class TreeGenerator { /** * Stores a map of the names for fast access. */ - private static final Map lookup = new HashMap(); + private static final Map lookup = new HashMap<>(); private static final Set primaryAliases = Sets.newHashSet(); private final String name; @@ -162,32 +164,11 @@ public class TreeGenerator { } } + private TreeGenerator() { + } + private static final Random RANDOM = new Random(); - private TreeType type; - - /** - * Construct the tree generator with a tree type. - * - * @param type the tree type - */ - @Deprecated - public TreeGenerator(TreeType type) { - this.type = type; - } - - /** - * Generate a tree. - * - * @param editSession the edit session - * @param position the position to generate the tree at - * @return true if generation was successful - * @throws MaxChangedBlocksException - */ - public boolean generate(EditSession editSession, Vector position) throws MaxChangedBlocksException { - return type.generate(editSession, position); - } - /** * Makes a terrible looking pine tree. * @@ -198,12 +179,12 @@ public class TreeGenerator { int trunkHeight = (int) Math.floor(Math.random() * 2) + 3; int height = (int) Math.floor(Math.random() * 5) + 8; - BaseBlock logBlock = new BaseBlock(BlockID.LOG); - BaseBlock leavesBlock = new BaseBlock(BlockID.LEAVES); + BlockState logBlock = BlockTypes.OAK_LOG.getDefaultState(); + BlockState leavesBlock = BlockTypes.OAK_LEAVES.getDefaultState(); // Create trunk for (int i = 0; i < trunkHeight; ++i) { - if (!editSession.setBlockIfAir(basePosition.add(0, i, 0), logBlock)) { + if (!setBlockIfAir(editSession, basePosition.add(0, i, 0), logBlock)) { return; } } @@ -213,38 +194,38 @@ public class TreeGenerator { // Create tree + leaves for (int i = 0; i < height; ++i) { - editSession.setBlockIfAir(basePosition.add(0, i, 0), logBlock); + setBlockIfAir(editSession, basePosition.add(0, i, 0), logBlock); // Less leaves at these levels double chance = ((i == 0 || i == height - 1) ? 0.6 : 1); // Inner leaves - editSession.setChanceBlockIfAir(basePosition.add(-1, i, 0), leavesBlock, chance); - editSession.setChanceBlockIfAir(basePosition.add(1, i, 0), leavesBlock, chance); - editSession.setChanceBlockIfAir(basePosition.add(0, i, -1), leavesBlock, chance); - editSession.setChanceBlockIfAir(basePosition.add(0, i, 1), leavesBlock, chance); - editSession.setChanceBlockIfAir(basePosition.add(1, i, 1), leavesBlock, chance); - editSession.setChanceBlockIfAir(basePosition.add(-1, i, 1), leavesBlock, chance); - editSession.setChanceBlockIfAir(basePosition.add(1, i, -1), leavesBlock, chance); - editSession.setChanceBlockIfAir(basePosition.add(-1, i, -1), leavesBlock, chance); + setChanceBlockIfAir(editSession, basePosition.add(-1, i, 0), leavesBlock, chance); + setChanceBlockIfAir(editSession, basePosition.add(1, i, 0), leavesBlock, chance); + setChanceBlockIfAir(editSession, basePosition.add(0, i, -1), leavesBlock, chance); + setChanceBlockIfAir(editSession, basePosition.add(0, i, 1), leavesBlock, chance); + setChanceBlockIfAir(editSession, basePosition.add(1, i, 1), leavesBlock, chance); + setChanceBlockIfAir(editSession, basePosition.add(-1, i, 1), leavesBlock, chance); + setChanceBlockIfAir(editSession, basePosition.add(1, i, -1), leavesBlock, chance); + setChanceBlockIfAir(editSession, basePosition.add(-1, i, -1), leavesBlock, chance); if (!(i == 0 || i == height - 1)) { for (int j = -2; j <= 2; ++j) { - editSession.setChanceBlockIfAir(basePosition.add(-2, i, j), leavesBlock, 0.6); + setChanceBlockIfAir(editSession, basePosition.add(-2, i, j), leavesBlock, 0.6); } for (int j = -2; j <= 2; ++j) { - editSession.setChanceBlockIfAir(basePosition.add(2, i, j), leavesBlock, 0.6); + setChanceBlockIfAir(editSession, basePosition.add(2, i, j), leavesBlock, 0.6); } for (int j = -2; j <= 2; ++j) { - editSession.setChanceBlockIfAir(basePosition.add(j, i, -2), leavesBlock, 0.6); + setChanceBlockIfAir(editSession, basePosition.add(j, i, -2), leavesBlock, 0.6); } for (int j = -2; j <= 2; ++j) { - editSession.setChanceBlockIfAir(basePosition.add(j, i, 2), leavesBlock, 0.6); + setChanceBlockIfAir(editSession, basePosition.add(j, i, 2), leavesBlock, 0.6); } } } - editSession.setBlockIfAir(basePosition.add(0, height, 0), leavesBlock); + setBlockIfAir(editSession, basePosition.add(0, height, 0), leavesBlock); } /** @@ -259,4 +240,30 @@ public class TreeGenerator { return TreeType.lookup(type); } + /** + * Set a block (only if a previous block was not there) if {@link Math#random()} + * returns a number less than the given probability. + * + * @param position the position + * @param block the block + * @param probability a probability between 0 and 1, inclusive + * @return whether a block was changed + * @throws MaxChangedBlocksException thrown if too many blocks are changed + */ + private static boolean setChanceBlockIfAir(EditSession session, Vector position, BlockStateHolder block, double probability) + throws MaxChangedBlocksException { + return Math.random() <= probability && setBlockIfAir(session, position, block); + } + + /** + * Set a block only if there's no block already there. + * + * @param position the position + * @param block the block to set + * @return if block was changed + * @throws MaxChangedBlocksException thrown if too many blocks are changed + */ + private static boolean setBlockIfAir(EditSession session, Vector position, BlockStateHolder block) throws MaxChangedBlocksException { + return session.getBlock(position).getBlockType() == BlockTypes.AIR && session.setBlock(position, block); + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/WeightedChoice.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/WeightedChoice.java index 3e5d5d440..e384ecf73 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/WeightedChoice.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/WeightedChoice.java @@ -19,11 +19,11 @@ package com.sk89q.worldedit.util; -import com.google.common.base.Function; -import com.google.common.base.Optional; - import static com.google.common.base.Preconditions.checkNotNull; +import java.util.Optional; +import java.util.function.Function; + /** * Returns the best choice given a weighting function and a target weight. * @@ -60,12 +60,10 @@ public class WeightedChoice { public void consider(T object) { checkNotNull(object); Number value = checkNotNull(function.apply(object)); - if (value != null) { - double distance = Math.abs(target - value.doubleValue()); - if (current == null || distance <= best) { - best = distance; - current = object; - } + double distance = Math.abs(target - value.doubleValue()); + if (current == null || distance <= best) { + best = distance; + current = object; } } @@ -76,9 +74,9 @@ public class WeightedChoice { */ public Optional> getChoice() { if (current != null) { - return Optional.of(new Choice(current, best)); + return Optional.of(new Choice<>(current, best)); } else { - return Optional.absent(); + return Optional.empty(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java index 3110c5bf9..c6ab2b7db 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.util; +import com.google.common.collect.Lists; import com.sk89q.util.yaml.YAMLProcessor; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; @@ -53,7 +54,7 @@ public class YAMLConfiguration extends LocalConfiguration { } profile = config.getBoolean("debug", profile); - wandItem = config.getInt("wand-item", wandItem); + wandItem = convertLegacyItem(config.getString("wand-item", wandItem)); defaultChangeLimit = Math.max(-1, config.getInt( "limits.max-blocks-changed.default", defaultChangeLimit)); @@ -76,12 +77,13 @@ public class YAMLConfiguration extends LocalConfiguration { butcherDefaultRadius = Math.max(-1, config.getInt("limits.butcher-radius.default", butcherDefaultRadius)); butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius)); - disallowedBlocks = new HashSet(config.getIntList("limits.disallowed-blocks", null)); - allowedDataCycleBlocks = new HashSet(config.getIntList("limits.allowed-data-cycle-blocks", null)); + disallowedBlocks = new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(defaultDisallowedBlocks))); + allowedDataCycleBlocks = new HashSet<>(config.getStringList("limits.allowed-data-cycle-blocks", null)); registerHelp = config.getBoolean("register-help", true); logCommands = config.getBoolean("logging.log-commands", logCommands); logFile = config.getString("logging.file", logFile); + logFormat = config.getString("logging.format", logFormat); superPickaxeDrop = config.getBoolean("super-pickaxe.drop-items", superPickaxeDrop); @@ -96,7 +98,7 @@ public class YAMLConfiguration extends LocalConfiguration { useInventoryCreativeOverride = config.getBoolean("use-inventory.creative-mode-overrides", useInventoryCreativeOverride); - navigationWand = config.getInt("navigation-wand.item", navigationWand); + navigationWand = convertLegacyItem(config.getString("navigation-wand.item", navigationWand)); navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance); navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/DoubleArrayList.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/DoubleArrayList.java index f2b0a2539..70c233704 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/DoubleArrayList.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/DoubleArrayList.java @@ -19,11 +19,11 @@ package com.sk89q.worldedit.util.collection; -import java.util.List; import java.util.ArrayList; -import java.util.Map; import java.util.Iterator; +import java.util.List; import java.util.ListIterator; +import java.util.Map; import java.util.NoSuchElementException; /** @@ -33,8 +33,8 @@ import java.util.NoSuchElementException; */ public class DoubleArrayList implements Iterable> { - private List listA = new ArrayList(); - private List listB = new ArrayList(); + private List listA = new ArrayList<>(); + private List listB = new ArrayList<>(); private boolean isReversed = false; /** @@ -81,11 +81,11 @@ public class DoubleArrayList implements Iterable> { */ public Iterator> iterator(boolean reversed) { if (reversed) { - return new ReverseEntryIterator>( + return new ReverseEntryIterator<>( listA.listIterator(listA.size()), listB.listIterator(listB.size())); } else { - return new ForwardEntryIterator>( + return new ForwardEntryIterator<>( listA.iterator(), listB.iterator()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/FastListIterator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/FastListIterator.java index 638de0194..3182502f6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/FastListIterator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/FastListIterator.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.util.collection; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - /** * A fast iterator for lists that uses an internal index integer * and caches the size of the list. The size of the list cannot change @@ -93,7 +93,7 @@ public class FastListIterator implements Iterator { * @return an iterator */ public static Iterator forwardIterator(List list) { - return new FastListIterator(list, 0, list.size(), 1); + return new FastListIterator<>(list, 0, list.size(), 1); } /** @@ -105,9 +105,9 @@ public class FastListIterator implements Iterator { */ public static Iterator reverseIterator(List list) { if (!list.isEmpty()) { - return new FastListIterator(list, list.size() - 1, list.size(), -1); + return new FastListIterator<>(list, list.size() - 1, list.size(), -1); } else { - return new FastListIterator(list, 0, 0, -1); + return new FastListIterator<>(list, 0, 0, -1); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/TupleArrayList.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/TupleArrayList.java index f4d9b1f4b..8247607f1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/TupleArrayList.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/TupleArrayList.java @@ -39,7 +39,7 @@ public class TupleArrayList extends ArrayList> { * @param b the 'value' */ public void put(A a, B b) { - add(new Tuple(a, b)); + add(new Tuple<>(a, b)); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/Dispatcher.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/Dispatcher.java index 568db508e..a7f1405f8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/Dispatcher.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/Dispatcher.java @@ -19,10 +19,11 @@ package com.sk89q.worldedit.util.command; -import javax.annotation.Nullable; import java.util.Collection; import java.util.Set; +import javax.annotation.Nullable; + /** * Executes a command based on user input. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/InvalidUsageException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/InvalidUsageException.java index f121a2fe8..0ffbc4c1e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/InvalidUsageException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/InvalidUsageException.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.util.command; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.minecraft.util.commands.CommandException; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Thrown when a command is not used properly. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/PrimaryAliasComparator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/PrimaryAliasComparator.java index b7b980acf..bca779d4b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/PrimaryAliasComparator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/PrimaryAliasComparator.java @@ -19,10 +19,11 @@ package com.sk89q.worldedit.util.command; -import javax.annotation.Nullable; import java.util.Comparator; import java.util.regex.Pattern; +import javax.annotation.Nullable; + /** * Compares the primary aliases of two {@link CommandMapping} using * {@link String#compareTo(String)}. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDescription.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDescription.java index ad3047117..4bea65d91 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDescription.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDescription.java @@ -28,8 +28,8 @@ import java.util.List; */ public class SimpleDescription implements Description { - private List parameters = new ArrayList(); - private List permissions = new ArrayList(); + private List parameters = new ArrayList<>(); + private List permissions = new ArrayList<>(); private String description; private String help; private String overrideUsage; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java index 8478c76e9..1f67fe51c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java @@ -40,7 +40,7 @@ import java.util.Set; */ public class SimpleDispatcher implements Dispatcher { - private final Map commands = new HashMap(); + private final Map commands = new HashMap<>(); private final SimpleDescription description = new SimpleDescription(); /** @@ -74,7 +74,7 @@ public class SimpleDispatcher implements Dispatcher { @Override public Set getCommands() { - return Collections.unmodifiableSet(new HashSet(commands.values())); + return Collections.unmodifiableSet(new HashSet<>(commands.values())); } @Override @@ -84,7 +84,7 @@ public class SimpleDispatcher implements Dispatcher { @Override public Set getPrimaryAliases() { - Set aliases = new HashSet(); + Set aliases = new HashSet<>(); for (CommandMapping mapping : getCommands()) { aliases.add(mapping.getPrimaryAlias()); } @@ -143,7 +143,7 @@ public class SimpleDispatcher implements Dispatcher { if (split.length <= 1) { String prefix = split.length > 0 ? split[0] : ""; - List suggestions = new ArrayList(); + List suggestions = new ArrayList<>(); for (CommandMapping mapping : getCommands()) { if (mapping.getCallable().testPermission(locals)) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/binding/PrimitiveBindings.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/binding/PrimitiveBindings.java index 2a5ee0ccf..3a4d78edf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/binding/PrimitiveBindings.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/binding/PrimitiveBindings.java @@ -28,9 +28,10 @@ import com.sk89q.worldedit.util.command.parametric.BindingHelper; import com.sk89q.worldedit.util.command.parametric.BindingMatch; import com.sk89q.worldedit.util.command.parametric.ParameterException; -import javax.annotation.Nullable; import java.lang.annotation.Annotation; +import javax.annotation.Nullable; + /** * Handles basic Java types such as {@link String}s, {@link Byte}s, etc. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/FlagParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/FlagParser.java index 2868a3ba8..479a62d6f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/FlagParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/FlagParser.java @@ -25,21 +25,22 @@ import com.google.common.collect.Maps; import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.worldedit.util.command.argument.CommandArgs; -import com.sk89q.worldedit.util.command.composition.FlagParser.FlagData; import com.sk89q.worldedit.util.command.argument.MissingArgumentException; +import com.sk89q.worldedit.util.command.composition.FlagParser.FlagData; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import javax.annotation.Nullable; + public class FlagParser implements CommandExecutor { private final Map> flags = Maps.newHashMap(); public Flag registerFlag(char flag, CommandExecutor executor) { - Flag ret = new Flag(flag); + Flag ret = new Flag<>(flag); flags.put(flag, executor); return ret; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/ProvidedValue.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/ProvidedValue.java index 7620bc7c3..5528728b7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/ProvidedValue.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/composition/ProvidedValue.java @@ -63,7 +63,7 @@ public class ProvidedValue implements CommandExecutor { } public static ProvidedValue create(T value, String description) { - return new ProvidedValue(value, description); + return new ProvidedValue<>(value, description); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingHelper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingHelper.java index a29d6ddd3..73b59f087 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingHelper.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingHelper.java @@ -54,8 +54,8 @@ public class BindingHelper implements Binding { * Create a new instance. */ public BindingHelper() { - List bindings = new ArrayList(); - List types = new ArrayList(); + List bindings = new ArrayList<>(); + List types = new ArrayList<>(); for (Method method : this.getClass().getMethods()) { BindingMatch info = method.getAnnotation(BindingMatch.class); @@ -145,7 +145,7 @@ public class BindingHelper implements Binding { public Object bind(ParameterData parameter, ArgumentStack scoped, boolean onlyConsume) throws ParameterException, CommandException, InvocationTargetException { BoundMethod binding = match(parameter); - List args = new ArrayList(); + List args = new ArrayList<>(); args.add(scoped); if (binding.classifier != null) { @@ -184,7 +184,7 @@ public class BindingHelper implements Binding { @Override public List getSuggestions(ParameterData parameter, String prefix) { - return new ArrayList(); + return new ArrayList<>(); } private static class BoundMethod implements Comparable { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ExceptionConverterHelper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ExceptionConverterHelper.java index 2341e5816..5b2d9fd5d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ExceptionConverterHelper.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ExceptionConverterHelper.java @@ -42,7 +42,7 @@ public abstract class ExceptionConverterHelper implements ExceptionConverter { @SuppressWarnings("unchecked") public ExceptionConverterHelper() { - List handlers = new ArrayList(); + List handlers = new ArrayList<>(); for (Method method : this.getClass().getMethods()) { if (method.getAnnotation(ExceptionMatch.class) == null) { @@ -76,9 +76,7 @@ public abstract class ExceptionConverterHelper implements ExceptionConverter { throw (CommandException) e.getCause(); } throw new WrappedCommandException(e); - } catch (IllegalArgumentException e) { - throw new WrappedCommandException(e); - } catch (IllegalAccessException e) { + } catch (IllegalArgumentException | IllegalAccessException e) { throw new WrappedCommandException(e); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricBuilder.java index b02178874..422cd9982 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricBuilder.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.util.command.parametric; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.collect.ImmutableBiMap.Builder; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; @@ -43,8 +45,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Creates commands using annotations placed on methods and individual parameters of * such methods. @@ -54,9 +54,9 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class ParametricBuilder { - private final Map bindings = new HashMap(); + private final Map bindings = new HashMap<>(); private final Paranamer paranamer = new CachingParanamer(); - private final List invokeListeners = new ArrayList(); + private final List invokeListeners = new ArrayList<>(); private Authorizer authorizer = new NullAuthorizer(); private CommandCompleter defaultCompleter = new NullCompleter(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java index 5492a2e81..10932717d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java @@ -20,15 +20,30 @@ package com.sk89q.worldedit.util.command.parametric; import com.google.common.primitives.Chars; -import com.sk89q.minecraft.util.commands.*; -import com.sk89q.worldedit.util.command.*; +import com.sk89q.minecraft.util.commands.Command; +import com.sk89q.minecraft.util.commands.CommandContext; +import com.sk89q.minecraft.util.commands.CommandException; +import com.sk89q.minecraft.util.commands.CommandLocals; +import com.sk89q.minecraft.util.commands.CommandPermissions; +import com.sk89q.minecraft.util.commands.CommandPermissionsException; +import com.sk89q.minecraft.util.commands.WrappedCommandException; +import com.sk89q.worldedit.util.command.CommandCallable; +import com.sk89q.worldedit.util.command.InvalidUsageException; +import com.sk89q.worldedit.util.command.MissingParameterException; +import com.sk89q.worldedit.util.command.Parameter; +import com.sk89q.worldedit.util.command.SimpleDescription; +import com.sk89q.worldedit.util.command.UnconsumedParameterException; import com.sk89q.worldedit.util.command.binding.Switch; import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Type; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; /** * The implementation of a {@link CommandCallable} for the {@link ParametricBuilder}. @@ -39,9 +54,9 @@ class ParametricCallable implements CommandCallable { private final Object object; private final Method method; private final ParameterData[] parameters; - private final Set valueFlags = new HashSet(); + private final Set valueFlags = new HashSet<>(); private final boolean anyFlags; - private final Set legacyFlags = new HashSet(); + private final Set legacyFlags = new HashSet<>(); private final SimpleDescription description = new SimpleDescription(); private final CommandPermissions commandPermissions; @@ -63,7 +78,7 @@ class ParametricCallable implements CommandCallable { String[] names = builder.getParanamer().lookupParameterNames(method, false); Type[] types = method.getGenericParameterTypes(); parameters = new ParameterData[types.length]; - List userParameters = new ArrayList(); + List userParameters = new ArrayList<>(); // This helps keep tracks of @Nullables that appear in the middle of a list // of parameters @@ -186,7 +201,7 @@ class ParametricCallable implements CommandCallable { try { // preProcess handlers - List handlers = new ArrayList(); + List handlers = new ArrayList<>(); for (InvokeListener listener : builder.getInvokeListeners()) { InvokeHandler handler = listener.createInvokeHandler(); handlers.add(handler); @@ -422,7 +437,7 @@ class ParametricCallable implements CommandCallable { if (!found) { if (unusedFlags == null) { - unusedFlags = new HashSet(); + unusedFlags = new HashSet<>(); } unusedFlags.add(flag); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/StringArgumentStack.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/StringArgumentStack.java index 7d93070fa..9d4142adc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/StringArgumentStack.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/StringArgumentStack.java @@ -20,8 +20,8 @@ package com.sk89q.worldedit.util.command.parametric; import com.sk89q.minecraft.util.commands.CommandContext; -import com.sk89q.worldedit.util.command.MissingParameterException; import com.sk89q.util.StringUtil; +import com.sk89q.worldedit.util.command.MissingParameterException; /** * A virtual scope that does not actually read from the underlying diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/EvenMoreExecutors.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/EvenMoreExecutors.java index 6a5ee3430..5272039a1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/EvenMoreExecutors.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/EvenMoreExecutors.java @@ -46,7 +46,7 @@ public final class EvenMoreExecutors { ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor( minThreads, maxThreads, 60L, TimeUnit.SECONDS, - new ArrayBlockingQueue(queueSize)); + new ArrayBlockingQueue<>(queueSize)); threadPoolExecutor.allowCoreThreadTimeOut(true); return threadPoolExecutor; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java index 0ee7b7d65..d8cbe8b20 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java @@ -19,7 +19,8 @@ package com.sk89q.worldedit.util.eventbus; -import com.google.common.base.Supplier; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.google.common.collect.SetMultimap; @@ -27,12 +28,17 @@ import com.google.common.eventbus.DeadEvent; import com.sk89q.worldedit.internal.annotation.RequiresNewerGuava; import java.lang.reflect.InvocationTargetException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Dispatches events to listeners, and provides ways for listeners to register * themselves. @@ -50,13 +56,7 @@ public class EventBus { private final Logger logger = Logger.getLogger(EventBus.class.getCanonicalName()); private final SetMultimap, EventHandler> handlersByType = - Multimaps.newSetMultimap(new HashMap, Collection>(), - new Supplier>() { - @Override - public Set get() { - return newHandlerSet(); - } - }); + Multimaps.newSetMultimap(new HashMap<>(), this::newHandlerSet); /** * Strategy for finding handler methods in registered objects. Currently, @@ -153,7 +153,7 @@ public class EventBus { * @param event event to post. */ public void post(Object event) { - List dispatching = new ArrayList(); + List dispatching = new ArrayList<>(); synchronized (this) { Set> dispatchTypes = flattenHierarchy(event.getClass()); @@ -211,7 +211,7 @@ public class EventBus { * @return a new, mutable set for handlers. */ protected synchronized Set newHandlerSet() { - return new HashSet(); + return new HashSet<>(); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventHandler.java index 6488af945..aaafb4dc8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventHandler.java @@ -19,10 +19,10 @@ package com.sk89q.worldedit.util.eventbus; -import java.lang.reflect.InvocationTargetException; - import static com.google.common.base.Preconditions.checkNotNull; +import java.lang.reflect.InvocationTargetException; + /** * Event handler object for {@link EventBus} that is able to dispatch * an event. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/HierarchyCache.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/HierarchyCache.java index 31aeb1f53..92f1cb56b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/HierarchyCache.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/HierarchyCache.java @@ -23,7 +23,11 @@ import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.sk89q.worldedit.internal.annotation.RequiresNewerGuava; -import java.util.*; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.WeakHashMap; /** * Holds a cache of class hierarchy. @@ -34,7 +38,7 @@ import java.util.*; @RequiresNewerGuava class HierarchyCache { - private final Map, Set>> cache = new WeakHashMap, Set>>(); + private final Map, Set>> cache = new WeakHashMap<>(); public Set> get(Class concreteClass) { Set> ret = cache.get(concreteClass); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/MethodEventHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/MethodEventHandler.java index a0575e83f..1d825927e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/MethodEventHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/MethodEventHandler.java @@ -19,10 +19,10 @@ package com.sk89q.worldedit.util.eventbus; -import java.lang.reflect.Method; - import static com.google.common.base.Preconditions.checkNotNull; +import java.lang.reflect.Method; + /** * Invokes a {@link Method} to dispatch an event. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/Subscribe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/Subscribe.java index 6616ea65e..88b3222ee 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/Subscribe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/Subscribe.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.util.eventbus; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + import java.lang.annotation.Retention; import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - /** * Used to mark methods as event handlers. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java index c6bb755bd..0134827f5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/ColorCodeBuilder.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.util.formatting; import com.google.common.base.Joiner; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -125,11 +126,8 @@ public class ColorCodeBuilder { return builder.toString(); } else if (!resetFrom.hasEqualFormatting(resetTo) || (resetFrom.getColor() != null && resetTo.getColor() == null)) { - StringBuilder builder = new StringBuilder(); // Have to set reset code and add back all the formatting codes - builder.append(Style.RESET); - builder.append(getCode(resetTo)); - return builder.toString(); + return String.valueOf(Style.RESET) + getCode(resetTo); } else { if (resetFrom.getColor() != resetTo.getColor()) { return String.valueOf(resetTo.getColor()); @@ -162,7 +160,7 @@ public class ColorCodeBuilder { char[] rawChars = (rawString + ' ').toCharArray(); // add a trailing space to trigger pagination StringBuilder word = new StringBuilder(); StringBuilder line = new StringBuilder(); - List lines = new LinkedList(); + List lines = new LinkedList<>(); int lineColorChars = 0; for (int i = 0; i < rawChars.length; i++) { @@ -183,9 +181,7 @@ public class ColorCodeBuilder { if ((transformed = transform(wordStr)) != null) { line.append(transformed); } else { - for (String partialWord : word.toString().split("(?<=\\G.{" + lineLength + "})")) { - lines.add(partialWord); - } + lines.addAll(Arrays.asList(word.toString().split("(?<=\\G.{" + lineLength + "})"))); } } else if (line.length() + word.length() - lineColorChars == lineLength) { // Line exactly the correct length...newline line.append(' '); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/Style.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/Style.java index c6fd71ddb..e46e6a7a4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/Style.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/Style.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.util.formatting; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.collect.Maps; import java.util.Map; import java.util.regex.Pattern; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - /** * All supported color values for chat. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/StyledFragment.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/StyledFragment.java index eaa4293cc..9ef38446b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/StyledFragment.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/StyledFragment.java @@ -27,7 +27,7 @@ import java.util.List; */ public class StyledFragment extends Fragment { - private final List children = new ArrayList(); + private final List children = new ArrayList<>(); private StyleSet style; private Fragment lastText; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandUsageBox.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandUsageBox.java index 4f27aa6c1..00a16c24e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandUsageBox.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandUsageBox.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.util.formatting.component; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.worldedit.extension.platform.CommandManager; import com.sk89q.worldedit.util.command.CommandCallable; @@ -28,12 +30,10 @@ import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.util.command.PrimaryAliasComparator; import com.sk89q.worldedit.util.formatting.StyledFragment; -import javax.annotation.Nullable; import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * A box to describe usage of a command. @@ -71,8 +71,8 @@ public class CommandUsageBox extends StyledFragment { CommandListBox box = new CommandListBox("Subcommands"); String prefix = !commandString.isEmpty() ? commandString + " " : ""; - List list = new ArrayList(dispatcher.getCommands()); - Collections.sort(list, new PrimaryAliasComparator(CommandManager.COMMAND_CLEAN_PATTERN)); + List list = new ArrayList<>(dispatcher.getCommands()); + list.sort(new PrimaryAliasComparator(CommandManager.COMMAND_CLEAN_PATTERN)); for (CommandMapping mapping : list) { if (locals == null || mapping.getCallable().testPermission(locals)) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/MessageBox.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/MessageBox.java index 757006d7c..086ce05e9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/MessageBox.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/MessageBox.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.util.formatting.component; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.util.formatting.ColorCodeBuilder; import com.sk89q.worldedit.util.formatting.Style; import com.sk89q.worldedit.util.formatting.StyledFragment; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Makes for a box with a border above and below. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/function/LevenshteinDistance.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/function/LevenshteinDistance.java index 723db8123..1020d92cd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/function/LevenshteinDistance.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/function/LevenshteinDistance.java @@ -19,12 +19,13 @@ package com.sk89q.worldedit.util.function; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.base.Function; -import javax.annotation.Nullable; import java.util.regex.Pattern; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Provides a Levenshtein distance between a given string and each string diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java index 6b5c37efe..26ef6a0f9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.util.io; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Throwables; @@ -31,8 +33,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.zip.ZipFile; -import static com.google.common.base.Preconditions.checkNotNull; - public final class Closer implements Closeable { private static final Logger logger = Logger.getLogger(Closer.class.getCanonicalName()); @@ -55,8 +55,8 @@ public final class Closer implements Closeable { final Suppressor suppressor; // only need space for 2 elements in most cases, so try to use the smallest array possible - private final Deque stack = new ArrayDeque(4); - private final Deque zipStack = new ArrayDeque(4); + private final Deque stack = new ArrayDeque<>(4); + private final Deque zipStack = new ArrayDeque<>(4); private Throwable thrown; @VisibleForTesting Closer(Suppressor suppressor) { @@ -102,7 +102,8 @@ public final class Closer implements Closeable { public RuntimeException rethrow(Throwable e) throws IOException { thrown = e; Throwables.propagateIfPossible(e, IOException.class); - throw Throwables.propagate(e); + Throwables.throwIfUnchecked(e); + throw new RuntimeException(e); } /** @@ -124,7 +125,8 @@ public final class Closer implements Closeable { thrown = e; Throwables.propagateIfPossible(e, IOException.class); Throwables.propagateIfPossible(e, declaredType); - throw Throwables.propagate(e); + Throwables.throwIfUnchecked(e); + throw new RuntimeException(e); } /** @@ -147,7 +149,8 @@ public final class Closer implements Closeable { thrown = e; Throwables.propagateIfPossible(e, IOException.class); Throwables.propagateIfPossible(e, declaredType1, declaredType2); - throw Throwables.propagate(e); + Throwables.throwIfUnchecked(e); + throw new RuntimeException(e); } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/DynamicStreamHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/DynamicStreamHandler.java index 500b77aef..0c9e89c8c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/DynamicStreamHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/DynamicStreamHandler.java @@ -19,9 +19,15 @@ package com.sk89q.worldedit.util.logging; -import javax.annotation.Nullable; import java.io.UnsupportedEncodingException; -import java.util.logging.*; +import java.util.logging.Filter; +import java.util.logging.Formatter; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.SimpleFormatter; +import java.util.logging.StreamHandler; + +import javax.annotation.Nullable; /** * A {@link StreamHandler} delegate that allows for the swap and disable of diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/LogFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/LogFormat.java index e37284ff8..d48b3d89a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/LogFormat.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/logging/LogFormat.java @@ -19,45 +19,65 @@ package com.sk89q.worldedit.util.logging; -import java.util.logging.Formatter; -import java.util.logging.LogRecord; -import java.util.logging.Level; import java.io.PrintWriter; import java.io.StringWriter; +import java.util.Date; +import java.util.logging.Formatter; +import java.util.logging.LogRecord; /** * A standard logging format for WorldEdit. */ public class LogFormat extends Formatter { + public static final String DEFAULT_FORMAT = "[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s]: %5$s%6$s%n"; + private final Date dat = new Date(); + private final String format; + + public LogFormat() { + this(null); + } + + public LogFormat(String format) { + if (format == null || format.isEmpty()) { + format = DEFAULT_FORMAT; + } + try { + //noinspection ResultOfMethodCallIgnored + String.format(format, new Date(), "", "", "", "", ""); + } catch (IllegalArgumentException var3) { + format = DEFAULT_FORMAT; + } + this.format = format; + } + @Override public String format(LogRecord record) { - StringBuilder text = new StringBuilder(); - Level level = record.getLevel(); - - if (level == Level.FINEST) { - text.append("[FINEST] "); - } else if (level == Level.FINER) { - text.append("[FINER] "); - } else if (level == Level.FINE) { - text.append("[FINE] "); - } else if (level == Level.INFO) { - text.append("[INFO] "); - } else if (level == Level.WARNING) { - text.append("[WARNING] "); - } else if (level == Level.SEVERE) { - text.append("[SEVERE] "); + dat.setTime(record.getMillis()); + String source; + if (record.getSourceClassName() != null) { + source = record.getSourceClassName(); + if (record.getSourceMethodName() != null) { + source += " " + record.getSourceMethodName(); + } + } else { + source = record.getLoggerName(); } - - text.append(record.getMessage()); - text.append("\r\n"); - - Throwable t = record.getThrown(); - if (t != null) { - StringWriter writer = new StringWriter(); - t.printStackTrace(new PrintWriter(writer)); - text.append(writer); + String message = formatMessage(record); + String throwable = ""; + if (record.getThrown() != null) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + pw.println(); + record.getThrown().printStackTrace(pw); + pw.close(); + throwable = sw.toString(); } - - return text.toString(); + return String.format(format, + dat, + source, + record.getLoggerName(), + record.getLevel().getName(), + message, + throwable); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java index eec33e90d..d0c399c0d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java @@ -20,31 +20,29 @@ package com.sk89q.worldedit.world; import com.sk89q.worldedit.BlockVector2D; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.blocks.BlockID; -import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.util.Direction; -import com.sk89q.worldedit.util.TreeGenerator.TreeType; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; + +import java.util.PriorityQueue; import javax.annotation.Nullable; -import java.util.PriorityQueue; /** * An abstract implementation of {@link World}. */ public abstract class AbstractWorld implements World { - private final PriorityQueue effectQueue = new PriorityQueue(); + private final PriorityQueue effectQueue = new PriorityQueue<>(); private int taskId = -1; @Override @@ -53,33 +51,7 @@ public abstract class AbstractWorld implements World { } @Override - public final boolean setBlockType(Vector position, int type) { - try { - return setBlock(position, new BaseBlock(type)); - } catch (WorldEditException ignored) { - return false; - } - } - - @Override - public final void setBlockData(Vector position, int data) { - try { - setBlock(position, new BaseBlock(getLazyBlock(position).getType(), data)); - } catch (WorldEditException ignored) { - } - } - - @Override - public final boolean setTypeIdAndData(Vector position, int type, int data) { - try { - return setBlock(position, new BaseBlock(type, data)); - } catch (WorldEditException ignored) { - return false; - } - } - - @Override - public final boolean setBlock(Vector pt, BaseBlock block) throws WorldEditException { + public final boolean setBlock(Vector pt, BlockStateHolder block) throws WorldEditException { return setBlock(pt, block, true); } @@ -88,34 +60,11 @@ public abstract class AbstractWorld implements World { return getMaximumPoint().getBlockY(); } - @Override - public boolean isValidBlockType(int type) { - return BlockType.fromID(type) != null; - } - - @Override - public boolean usesBlockData(int type) { - // We future proof here by assuming all unknown blocks use data - return BlockType.usesData(type) || BlockType.fromID(type) == null; - } - @Override public Mask createLiquidMask() { return new BlockMask(this, - new BaseBlock(BlockID.STATIONARY_LAVA, -1), - new BaseBlock(BlockID.LAVA, -1), - new BaseBlock(BlockID.STATIONARY_WATER, -1), - new BaseBlock(BlockID.WATER, -1)); - } - - @Override - public int getBlockType(Vector pt) { - return getLazyBlock(pt).getType(); - } - - @Override - public int getBlockData(Vector pt) { - return getLazyBlock(pt).getData(); + BlockTypes.LAVA.getDefaultState().toFuzzy(), + BlockTypes.WATER.getDefaultState().toFuzzy()); } @Override @@ -125,52 +74,6 @@ public abstract class AbstractWorld implements World { } } - @Override - public void simulateBlockMine(Vector pt) { - BaseBlock block = getLazyBlock(pt); - BaseItemStack stack = BlockType.getBlockDrop(block.getId(), (short) block.getData()); - - if (stack != null) { - final int amount = stack.getAmount(); - if (amount > 1) { - dropItem(pt, new BaseItemStack(stack.getType(), 1, stack.getData()), amount); - } else { - dropItem(pt, stack, amount); - } - } - - try { - setBlock(pt, new BaseBlock(BlockID.AIR)); - } catch (WorldEditException e) { - throw new RuntimeException(e); - } - } - - @Override - public boolean generateTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { - return generateTree(TreeType.TREE, editSession, pt); - } - - @Override - public boolean generateBigTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { - return generateTree(TreeType.BIG_TREE, editSession, pt); - } - - @Override - public boolean generateBirchTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { - return generateTree(TreeType.BIRCH, editSession, pt); - } - - @Override - public boolean generateRedwoodTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { - return generateTree(TreeType.REDWOOD, editSession, pt); - } - - @Override - public boolean generateTallRedwoodTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { - return generateTree(TreeType.TALL_REDWOOD, editSession, pt); - } - @Override public void checkLoadedChunk(Vector pt) { } @@ -188,19 +91,15 @@ public abstract class AbstractWorld implements World { return false; } - @SuppressWarnings("deprecation") @Override - public boolean queueBlockBreakEffect(Platform server, Vector position, int blockId, double priority) { + public boolean queueBlockBreakEffect(Platform server, Vector position, BlockType blockType, double priority) { if (taskId == -1) { - taskId = server.schedule(0, 1, new Runnable() { - @Override - public void run() { - int max = Math.max(1, Math.min(30, effectQueue.size() / 3)); - for (int i = 0; i < max; ++i) { - if (effectQueue.isEmpty()) return; + taskId = server.schedule(0, 1, () -> { + int max = Math.max(1, Math.min(30, effectQueue.size() / 3)); + for (int i = 0; i < max; ++i) { + if (effectQueue.isEmpty()) return; - effectQueue.poll().play(); - } + effectQueue.poll().play(); } }); } @@ -209,7 +108,7 @@ public abstract class AbstractWorld implements World { return false; } - effectQueue.offer(new QueuedEffect(position, blockId, priority)); + effectQueue.offer(new QueuedEffect(position, blockType, priority)); return true; } @@ -231,17 +130,17 @@ public abstract class AbstractWorld implements World { private class QueuedEffect implements Comparable { private final Vector position; - private final int blockId; + private final BlockType blockType; private final double priority; - private QueuedEffect(Vector position, int blockId, double priority) { + private QueuedEffect(Vector position, BlockType blockType, double priority) { this.position = position; - this.blockId = blockId; + this.blockType = blockType; this.priority = priority; } public void play() { - playEffect(position, 2001, blockId); + playEffect(position, 2001, blockType.getLegacyId()); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NbtValued.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NbtValued.java index 50262730d..458a16957 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NbtValued.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NbtValued.java @@ -36,7 +36,7 @@ public interface NbtValued { * * @return true if there is NBT data */ - public boolean hasNbtData(); + boolean hasNbtData(); /** * Get the object's NBT data (tile entity data). The returned tag, if diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java index 1edfaadb3..8161957e8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java @@ -24,22 +24,24 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.world.biome.BaseBiome; -import com.sk89q.worldedit.world.registry.LegacyWorldData; -import com.sk89q.worldedit.world.registry.WorldData; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.weather.WeatherType; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nullable; + /** * A null implementation of {@link World} that drops all changes and * returns dummy data. @@ -57,7 +59,7 @@ public class NullWorld extends AbstractWorld { } @Override - public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException { + public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { return false; } @@ -85,6 +87,10 @@ public class NullWorld extends AbstractWorld { public void dropItem(Vector position, BaseItemStack item) { } + @Override + public void simulateBlockMine(Vector position) { + } + @Override public boolean regenerate(Region region, EditSession editSession) { return false; @@ -96,18 +102,31 @@ public class NullWorld extends AbstractWorld { } @Override - public WorldData getWorldData() { - return LegacyWorldData.getInstance(); + public WeatherType getWeather() { + return null; } @Override - public BaseBlock getBlock(Vector position) { - return new BaseBlock(BlockID.AIR); + public long getRemainingWeatherDuration() { + return 0; } @Override - public BaseBlock getLazyBlock(Vector position) { - return new BaseBlock(BlockID.AIR); + public void setWeather(WeatherType weatherType) { + } + + @Override + public void setWeather(WeatherType weatherType, long duration) { + } + + @Override + public BlockState getBlock(Vector position) { + return BlockTypes.AIR.getDefaultState(); + } + + @Override + public BaseBlock getFullBlock(Vector position) { + return getBlock(position).toBaseBlock(); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java index 0269e1866..ed0234e6c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java @@ -24,7 +24,6 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.extension.platform.Platform; @@ -33,8 +32,9 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.TreeGenerator; -import com.sk89q.worldedit.util.TreeGenerator.TreeType; -import com.sk89q.worldedit.world.registry.WorldData; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.weather.WeatherType; /** * Represents a world (dimension). @@ -55,23 +55,6 @@ public interface World extends Extent { */ int getMaxY(); - /** - * Checks whether the given block ID is a valid block ID. - * - * @param id the block ID - * @return true if the block ID is a valid one - */ - boolean isValidBlockType(int id); - - /** - * Checks whether the given block ID uses data values for differentiating - * types of blocks. - * - * @param id the block ID - * @return true if the block uses data values - */ - boolean usesBlockData(int id); - /** * Create a mask that matches all liquids. * @@ -92,19 +75,7 @@ public interface World extends Extent { boolean useItem(Vector position, BaseItem item, Direction face); /** - * @deprecated Use {@link #getLazyBlock(Vector)} - */ - @Deprecated - int getBlockType(Vector pt); - - /** - * @deprecated Use {@link #getLazyBlock(Vector)} - */ - @Deprecated - int getBlockData(Vector pt); - - /** - * Similar to {@link Extent#setBlock(Vector, BaseBlock)} but a + * Similar to {@link Extent#setBlock(Vector, BlockStateHolder)} but a * {@code notifyAndLight} parameter indicates whether adjacent blocks * should be notified that changes have been made and lighting operations * should be executed. @@ -121,25 +92,7 @@ public interface World extends Extent { * @param notifyAndLight true to to notify and light * @return true if the block was successfully set (return value may not be accurate) */ - boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException; - - /** - * @deprecated Use {@link #setBlock(Vector, BaseBlock)} - */ - @Deprecated - boolean setBlockType(Vector position, int type); - - /** - * @deprecated Use {@link #setBlock(Vector, BaseBlock)} - */ - @Deprecated - void setBlockData(Vector position, int data); - - /** - * @deprecated Use {@link #setBlock(Vector, BaseBlock)} - */ - @Deprecated - boolean setTypeIdAndData(Vector position, int type, int data); + boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException; /** * Get the light level at the given block. @@ -202,36 +155,6 @@ public interface World extends Extent { */ boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException; - /** - * @deprecated Use {@link #generateTree(TreeType, EditSession, Vector)} - */ - @Deprecated - boolean generateTree(EditSession editSession, Vector position) throws MaxChangedBlocksException; - - /** - * @deprecated Use {@link #generateTree(TreeType, EditSession, Vector)} - */ - @Deprecated - boolean generateBigTree(EditSession editSession, Vector position) throws MaxChangedBlocksException; - - /** - * @deprecated Use {@link #generateTree(TreeType, EditSession, Vector)} - */ - @Deprecated - boolean generateBirchTree(EditSession editSession, Vector position) throws MaxChangedBlocksException; - - /** - * @deprecated Use {@link #generateTree(TreeType, EditSession, Vector)} - */ - @Deprecated - boolean generateRedwoodTree(EditSession editSession, Vector position) throws MaxChangedBlocksException; - - /** - * @deprecated Use {@link #generateTree(TreeType, EditSession, Vector)} - */ - @Deprecated - boolean generateTallRedwoodTree(EditSession editSession, Vector position) throws MaxChangedBlocksException; - /** * Load the chunk at the given position if it isn't loaded. * @@ -242,7 +165,7 @@ public interface World extends Extent { /** * Fix the given chunks after fast mode was used. * - *

Fast mode makes calls to {@link #setBlock(Vector, BaseBlock, boolean)} + *

Fast mode makes calls to {@link #setBlock(Vector, BlockStateHolder, boolean)} * with {@code false} for the {@code notifyAndLight} parameter, which * may causes lighting errors to accumulate. Use of this method, if * it is implemented by the underlying world, corrects those lighting @@ -274,18 +197,40 @@ public interface World extends Extent { * * @param server the server * @param position the position - * @param blockId the block ID + * @param blockType the block type * @param priority the priority * @return true if the effect was played */ - boolean queueBlockBreakEffect(Platform server, Vector position, int blockId, double priority); + boolean queueBlockBreakEffect(Platform server, Vector position, BlockType blockType, double priority); /** - * Get the data for blocks and so on for this world. + * Gets the weather type of the world. * - * @return the world data + * @return The weather */ - WorldData getWorldData(); + WeatherType getWeather(); + + /** + * Gets the remaining weather duration. + * + * @return The weather duration + */ + long getRemainingWeatherDuration(); + + /** + * Sets the weather type of the world. + * + * @param weatherType The weather type + */ + void setWeather(WeatherType weatherType); + + /** + * Sets the weather type of the world. + * + * @param weatherType The weather type + * @param duration The duration of the weather + */ + void setWeather(WeatherType weatherType, long duration); @Override boolean equals(Object other); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java index 145d891cb..45018ed41 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.world.biome; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.base.Function; import com.sk89q.worldedit.world.registry.BiomeRegistry; import javax.annotation.Nullable; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Returns the name of a biome using a given {@code BiomeRegistry}. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java index c19c2ac93..0282227db 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java @@ -19,18 +19,19 @@ package com.sk89q.worldedit.world.biome; -import com.google.common.base.Function; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.base.Functions; -import com.google.common.base.Optional; import com.sk89q.worldedit.util.WeightedChoice; import com.sk89q.worldedit.util.WeightedChoice.Choice; import com.sk89q.worldedit.util.function.LevenshteinDistance; import com.sk89q.worldedit.world.registry.BiomeRegistry; -import javax.annotation.Nullable; import java.util.Collection; +import java.util.Optional; +import java.util.function.Function; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * Utility methods related to biomes. @@ -55,7 +56,7 @@ public final class Biomes { checkNotNull(registry); Function compare = new LevenshteinDistance(name, false, LevenshteinDistance.STANDARD_CHARS); - WeightedChoice chooser = new WeightedChoice(Functions.compose(compare, new BiomeName(registry)), 0); + WeightedChoice chooser = new WeightedChoice<>(Functions.compose(compare::apply, new BiomeName(registry)), 0); for (BaseBiome biome : biomes) { chooser.consider(biome); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java new file mode 100644 index 000000000..58d8d1235 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java @@ -0,0 +1,211 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.block; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.StringTag; +import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.blocks.TileEntityBlock; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.registry.state.Property; + +import java.util.Map; +import java.util.Objects; + +import javax.annotation.Nullable; + +/** + * Represents a mutable "snapshot" of a block. + * + *

An instance of this block contains all the information needed to + * accurately reproduce the block, provided that the instance was + * made correctly. In some implementations, it may not be possible to get a + * snapshot of blocks correctly, so, for example, the NBT data for a block + * may be missing.

+ * + *

A peculiar detail of this class is that it accepts {@code -1} as a + * valid data value. This is due to legacy reasons: WorldEdit uses -1 + * as a "wildcard" block value, even though a {@link Mask} would be + * more appropriate.

+ */ +public class BaseBlock implements BlockStateHolder, TileEntityBlock { + + private BlockState blockState; + @Nullable private CompoundTag nbtData; + + /** + * Construct a block with a state. + * + * @param blockState The blockstate + */ + protected BaseBlock(BlockState blockState) { + this.blockState = blockState; + } + + /** + * Construct a block with the given ID, data value and NBT data structure. + * + * @param state The block state + * @param nbtData NBT data, which must be provided + */ + protected BaseBlock(BlockState state, CompoundTag nbtData) { + checkNotNull(nbtData); + this.blockState = state; + this.nbtData = nbtData; + } + + /** + * Create a clone of another block. + * + * @param other the other block + */ + public BaseBlock(BaseBlock other) { + this(other.toImmutableState(), other.getNbtData()); + } + + /** + * Gets a map of state to statevalue + * + * @return The state map + */ + @Override + public Map, Object> getStates() { + return this.blockState.getStates(); + } + + @Override + public BlockType getBlockType() { + return this.blockState.getBlockType(); + } + + @Override + public BaseBlock with(Property property, V value) { + return new BaseBlock(this.blockState.with(property, value), getNbtData()); + } + + /** + * Gets the State for this Block. + * + * @param property The state to get the value for + * @return The state value + */ + @Override + public V getState(Property property) { + return this.blockState.getState(property); + } + + @Override + public boolean hasNbtData() { + return getNbtData() != null; + } + + @Override + public String getNbtId() { + CompoundTag nbtData = getNbtData(); + if (nbtData == null) { + return ""; + } + Tag idTag = nbtData.getValue().get("id"); + if (idTag instanceof StringTag) { + return ((StringTag) idTag).getValue(); + } else { + return ""; + } + } + + @Nullable + @Override + public CompoundTag getNbtData() { + return this.nbtData; + } + + @Override + public void setNbtData(@Nullable CompoundTag nbtData) { + throw new UnsupportedOperationException("This class is immutable."); + } + + /** + * Checks whether the type ID and data value are equal. + */ + @Override + public boolean equals(Object o) { + if (!(o instanceof BaseBlock)) { + return false; + } + + final BaseBlock otherBlock = (BaseBlock) o; + + return this.toImmutableState().equals(otherBlock.toImmutableState()) && Objects.equals(getNbtData(), otherBlock.getNbtData()); + + } + + /** + * Checks if the type is the same, and if the matched states are the same. + * + * @param o other block + * @return true if equal + */ + @Override + public boolean equalsFuzzy(BlockStateHolder o) { + return this.toImmutableState().equalsFuzzy(o); + } + + @Override + public BlockState toImmutableState() { + return this.blockState; + } + + @Override + public BaseBlock toBaseBlock() { + return this; + } + + @Override + public BaseBlock toBaseBlock(CompoundTag compoundTag) { + if (compoundTag == null) { + return this.blockState.toBaseBlock(); + } else if (compoundTag == this.nbtData) { + return this; + } else { + return new BaseBlock(this.blockState, compoundTag); + } + } + + @Override + public int hashCode() { + int ret = toImmutableState().hashCode() << 3; + if (hasNbtData()) { + ret += getNbtData().hashCode(); + } + return ret; + } + + @Override + public String toString() { +// if (getNbtData() != null) { // TODO Maybe make some JSON serialiser to make this not awful. +// return blockState.getAsString() + " {" + String.valueOf(getNbtData()) + "}"; +// } else { + return blockState.getAsString(); +// } + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java new file mode 100644 index 000000000..d60c96985 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java @@ -0,0 +1,76 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.block; + +import javax.annotation.Nullable; + +/** + * Stores a list of categories of Block Types. + */ +public final class BlockCategories { + + public static final BlockCategory ACACIA_LOGS = register("minecraft:acacia_logs"); + public static final BlockCategory ANVIL = register("minecraft:anvil"); + public static final BlockCategory BANNERS = register("minecraft:banners"); + public static final BlockCategory BIRCH_LOGS = register("minecraft:birch_logs"); + public static final BlockCategory BUTTONS = register("minecraft:buttons"); + public static final BlockCategory CARPETS = register("minecraft:carpets"); + public static final BlockCategory CORAL = register("minecraft:coral"); + public static final BlockCategory CORAL_PLANTS = register("minecraft:coral_plants"); + public static final BlockCategory DARK_OAK_LOGS = register("minecraft:dark_oak_logs"); + public static final BlockCategory DOORS = register("minecraft:doors"); + public static final BlockCategory ENDERMAN_HOLDABLE = register("minecraft:enderman_holdable"); + public static final BlockCategory FLOWER_POTS = register("minecraft:flower_pots"); + public static final BlockCategory ICE = register("minecraft:ice"); + public static final BlockCategory JUNGLE_LOGS = register("minecraft:jungle_logs"); + public static final BlockCategory LEAVES = register("minecraft:leaves"); + public static final BlockCategory LOGS = register("minecraft:logs"); + public static final BlockCategory OAK_LOGS = register("minecraft:oak_logs"); + public static final BlockCategory PLANKS = register("minecraft:planks"); + public static final BlockCategory RAILS = register("minecraft:rails"); + public static final BlockCategory SAND = register("minecraft:sand"); + public static final BlockCategory SAPLINGS = register("minecraft:saplings"); + public static final BlockCategory SLABS = register("minecraft:slabs"); + public static final BlockCategory SPRUCE_LOGS = register("minecraft:spruce_logs"); + public static final BlockCategory STAIRS = register("minecraft:stairs"); + public static final BlockCategory STONE_BRICKS = register("minecraft:stone_bricks"); + public static final BlockCategory VALID_SPAWN = register("minecraft:valid_spawn"); + public static final BlockCategory WOODEN_BUTTONS = register("minecraft:wooden_buttons"); + public static final BlockCategory WOODEN_DOORS = register("minecraft:wooden_doors"); + public static final BlockCategory WOODEN_PRESSURE_PLATES = register("minecraft:wooden_pressure_plates"); + public static final BlockCategory WOODEN_SLABS = register("minecraft:wooden_slabs"); + public static final BlockCategory WOODEN_STAIRS = register("minecraft:wooden_stairs"); + public static final BlockCategory WOOL = register("minecraft:wool"); + + private BlockCategories() { + } + + private static BlockCategory register(final String id) { + return register(new BlockCategory(id)); + } + + public static BlockCategory register(final BlockCategory tag) { + return BlockCategory.REGISTRY.register(tag.getId(), tag); + } + + public static @Nullable BlockCategory get(final String id) { + return BlockCategory.REGISTRY.get(id); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java new file mode 100644 index 000000000..8debc2c47 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java @@ -0,0 +1,58 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.block; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.registry.Category; +import com.sk89q.worldedit.registry.NamespacedRegistry; + +import java.util.Set; + +/** + * A category of blocks. This is due to the splitting up of + * blocks such as wool into separate ids. + */ +public class BlockCategory extends Category { + + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("block tag"); + + public BlockCategory(final String id) { + super(id); + } + + @Override + protected Set load() { + return WorldEdit.getInstance().getPlatformManager() + .queryCapability(Capability.GAME_HOOKS).getRegistries() + .getBlockCategoryRegistry().getAll(this); + } + + /** + * Checks whether the BlockStateHolder is contained within + * this category. + * + * @param blockStateHolder The blockstateholder + * @return If it's a part of this category + */ + public boolean contains(BlockStateHolder blockStateHolder) { + return this.getAll().contains(blockStateHolder.getBlockType()); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java new file mode 100644 index 000000000..2b89d9195 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -0,0 +1,238 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.block; + +import com.google.common.collect.ArrayTable; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Table; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.registry.state.Property; + +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +/** + * An immutable class that represents the state a block can be in. + */ +@SuppressWarnings("unchecked") +public class BlockState implements BlockStateHolder { + + private final BlockType blockType; + private final Map, Object> values; + private final boolean fuzzy; + + private BaseBlock emptyBaseBlock; + + // Neighbouring state table. + private Table, Object, BlockState> states; + + private BlockState(BlockType blockType) { + this.blockType = blockType; + this.values = new LinkedHashMap<>(); + this.emptyBaseBlock = new BaseBlock(this); + this.fuzzy = false; + } + + /** + * Creates a fuzzy BlockState. This can be used for partial matching. + * + * @param blockType The block type + * @param values The block state values + */ + private BlockState(BlockType blockType, Map, Object> values) { + this.blockType = blockType; + this.values = values; + this.fuzzy = true; + } + + static Map, Object>, BlockState> generateStateMap(BlockType blockType) { + Map, Object>, BlockState> stateMap = new LinkedHashMap<>(); + List properties = blockType.getProperties(); + + if (!properties.isEmpty()) { + List> separatedValues = Lists.newArrayList(); + for (Property prop : properties) { + List vals = Lists.newArrayList(); + vals.addAll(prop.getValues()); + separatedValues.add(vals); + } + List> valueLists = Lists.cartesianProduct(separatedValues); + for (List valueList : valueLists) { + Map, Object> valueMap = Maps.newTreeMap(Comparator.comparing(Property::getName)); + BlockState stateMaker = new BlockState(blockType); + for (int i = 0; i < valueList.size(); i++) { + Property property = properties.get(i); + Object value = valueList.get(i); + valueMap.put(property, value); + stateMaker.setState(property, value); + } + stateMap.put(valueMap, stateMaker); + } + } + + if (stateMap.isEmpty()) { + // No properties. + stateMap.put(new LinkedHashMap<>(), new BlockState(blockType)); + } + + for (BlockState state : stateMap.values()) { + state.populate(stateMap); + } + + return stateMap; + } + + private void populate(Map, Object>, BlockState> stateMap) { + final Table, Object, BlockState> states = HashBasedTable.create(); + + for(final Map.Entry, Object> entry : this.values.entrySet()) { + final Property property = entry.getKey(); + + property.getValues().forEach(value -> { + if(value != entry.getValue()) { + BlockState modifiedState = stateMap.get(this.withValue(property, value)); + if (modifiedState != null) { + states.put(property, value, modifiedState); + } else { + System.out.println(stateMap); + WorldEdit.logger.warning("Found a null state at " + this.withValue(property, value)); + } + } + }); + } + + this.states = states.isEmpty() ? states : ArrayTable.create(states); + } + + private Map, Object> withValue(final Property property, final V value) { + final Map, Object> values = Maps.newHashMap(this.values); + values.put(property, value); + return values; + } + + @Override + public BlockType getBlockType() { + return this.blockType; + } + + @Override + public BlockState with(final Property property, final V value) { + if (fuzzy) { + return setState(property, value); + } else { + BlockState result = states.get(property, value); + return result == null ? this : result; + } + } + + @Override + public V getState(final Property property) { + return (V) this.values.get(property); + } + + @Override + public Map, Object> getStates() { + return Collections.unmodifiableMap(this.values); + } + + public BlockState toFuzzy() { + return new BlockState(this.getBlockType(), new HashMap<>()); + } + + @Override + public boolean equalsFuzzy(BlockStateHolder o) { + if (!getBlockType().equals(o.getBlockType())) { + return false; + } + + Set differingProperties = new HashSet<>(); + for (Object state : o.getStates().keySet()) { + if (getState((Property) state) == null) { + differingProperties.add((Property) state); + } + } + for (Property property : getStates().keySet()) { + if (o.getState(property) == null) { + differingProperties.add(property); + } + } + + for (Property property : getStates().keySet()) { + if (differingProperties.contains(property)) { + continue; + } + if (!Objects.equals(getState(property), o.getState(property))) { + return false; + } + } + + return true; + } + + @Override + public BlockState toImmutableState() { + return this; + } + + @Override + public BaseBlock toBaseBlock() { + if (this.fuzzy) { + throw new IllegalArgumentException("Can't create a BaseBlock from a fuzzy BlockState!"); + } + return this.emptyBaseBlock; + } + + @Override + public BaseBlock toBaseBlock(CompoundTag compoundTag) { + if (compoundTag == null) { + return toBaseBlock(); + } + return new BaseBlock(this, compoundTag); + } + + /** + * Internal method used for creating the initial BlockState. + * + * Sets a value. DO NOT USE THIS. + * + * @param property The state + * @param value The value + * @return The blockstate, for chaining + */ + private BlockState setState(final Property property, final Object value) { + this.values.put(property, value); + return this; + } + + @Override + public String toString() { + return getAsString(); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java new file mode 100644 index 000000000..fe90a3c49 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java @@ -0,0 +1,101 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.block; + +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.registry.state.Property; + +import java.util.Map; +import java.util.stream.Collectors; + +public interface BlockStateHolder { + + /** + * Get the block type + * + * @return The type + */ + BlockType getBlockType(); + + /** + * Returns a BlockState with the given state and value applied. + * + * @param property The state + * @param value The value + * @return The modified state, or same if could not be applied + */ + T with(final Property property, final V value); + + /** + * Gets the value at the given state + * + * @param property The state + * @return The value + */ + V getState(Property property); + + /** + * Gets an immutable collection of the states. + * + * @return The states + */ + Map, Object> getStates(); + + /** + * Checks if the type is the same, and if the matched states are the same. + * + * @param o other block + * @return true if equal + */ + boolean equalsFuzzy(BlockStateHolder o); + + /** + * Returns an immutable {@link BlockState} from this BlockStateHolder. + * + * @return A BlockState + */ + BlockState toImmutableState(); + + /** + * Gets a {@link BaseBlock} from this BlockStateHolder. + * + * @return The BaseBlock + */ + BaseBlock toBaseBlock(); + + /** + * Gets a {@link BaseBlock} from this BlockStateHolder. + * + * @param compoundTag The NBT Data to apply + * @return The BaseBlock + */ + BaseBlock toBaseBlock(CompoundTag compoundTag); + + default String getAsString() { + if (getStates().isEmpty()) { + return this.getBlockType().getId(); + } else { + String properties = + getStates().entrySet().stream().map(entry -> entry.getKey().getName() + "=" + entry.getValue().toString().toLowerCase()).collect(Collectors.joining( + ",")); + return this.getBlockType().getId() + "[" + properties + "]"; + } + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java new file mode 100644 index 000000000..a6ecd79dc --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -0,0 +1,187 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.block; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.world.registry.BlockMaterial; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.registry.NamespacedRegistry; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; +import com.sk89q.worldedit.world.registry.BundledBlockData; +import com.sk89q.worldedit.world.registry.LegacyMapper; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import javax.annotation.Nullable; + +public class BlockType { + + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("block type"); + + private String id; + private BlockState defaultState; + private Map properties; + private BlockMaterial blockMaterial; + + public BlockType(String id) { + this(id, null); + } + + public BlockType(String id, Function values) { + // If it has no namespace, assume minecraft. + if (!id.contains(":")) { + id = "minecraft:" + id; + } + this.id = id; + this.defaultState = new ArrayList<>(BlockState.generateStateMap(this).values()).get(0); + if (values != null) { + this.defaultState = values.apply(this.defaultState); + } + } + + /** + * Gets the ID of this block. + * + * @return The id + */ + public String getId() { + return this.id; + } + + /** + * Gets the name of this block, or the ID if the name cannot be found. + * + * @return The name, or ID + */ + public String getName() { + BundledBlockData.BlockEntry entry = BundledBlockData.getInstance().findById(this.id); + if (entry == null) { + return getId(); + } else { + return entry.localizedName; + } + } + + /** + * Gets the properties of this BlockType in a key->property mapping. + * + * @return The properties map + */ + public Map getPropertyMap() { + if (properties == null) { + properties = ImmutableMap.copyOf(WorldEdit.getInstance().getPlatformManager() + .queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getProperties(this)); + } + return this.properties; + } + + /** + * Gets the properties of this BlockType. + * + * @return the properties + */ + public List getProperties() { + return ImmutableList.copyOf(this.getPropertyMap().values()); + } + + /** + * Gets a property by name. + * + * @param name The name + * @return The property + */ + public Property getProperty(String name) { + return getPropertyMap().get(name); + } + + /** + * Gets the default state of this block type. + * + * @return The default state + */ + public BlockState getDefaultState() { + return this.defaultState; + } + + /** + * Gets whether this block type has an item representation. + * + * @return If it has an item + */ + public boolean hasItemType() { + return getItemType() != null; + } + + /** + * Gets the item representation of this block type, if it exists. + * + * @return The item representation + */ + @Nullable + public ItemType getItemType() { + return ItemTypes.get(this.id); + } + + /** + * Get the material for this BlockType. + * + * @return The material + */ + public BlockMaterial getMaterial() { + if (this.blockMaterial == null) { + this.blockMaterial = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getMaterial(this); + } + return this.blockMaterial; + } + + /** + * Gets the legacy ID. Needed for legacy reasons. + * + * DO NOT USE THIS. + * + * @return legacy id or 0, if unknown + */ + @Deprecated + public int getLegacyId() { + int[] id = LegacyMapper.getInstance().getLegacyFromBlock(this.getDefaultState()); + if (id != null) { + return id[0]; + } else { + return 0; + } + } + + @Override + public int hashCode() { + return this.id.hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof BlockType && this.id.equals(((BlockType) obj).id); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java new file mode 100644 index 000000000..d8bc3d84a --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java @@ -0,0 +1,645 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.block; + +import com.sk89q.worldedit.util.Direction; + +import java.util.function.Function; + +import javax.annotation.Nullable; + +/** + * Stores a list of common Block String IDs. + */ +public final class BlockTypes { + + public static final BlockType ACACIA_BUTTON = register("minecraft:acacia_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType ACACIA_DOOR = register("minecraft:acacia_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType ACACIA_FENCE = register("minecraft:acacia_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType ACACIA_FENCE_GATE = register("minecraft:acacia_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType ACACIA_LEAVES = register("minecraft:acacia_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); + public static final BlockType ACACIA_LOG = register("minecraft:acacia_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType ACACIA_PLANKS = register("minecraft:acacia_planks"); + public static final BlockType ACACIA_PRESSURE_PLATE = register("minecraft:acacia_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType ACACIA_SAPLING = register("minecraft:acacia_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); + public static final BlockType ACACIA_SLAB = register("minecraft:acacia_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType ACACIA_STAIRS = register("minecraft:acacia_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType ACACIA_TRAPDOOR = register("minecraft:acacia_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType ACACIA_WOOD = register("minecraft:acacia_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType ACTIVATOR_RAIL = register("minecraft:activator_rail", state -> state.with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("shape"), "north_south")); + public static final BlockType AIR = register("minecraft:air"); + public static final BlockType ALLIUM = register("minecraft:allium"); + public static final BlockType ANDESITE = register("minecraft:andesite"); + public static final BlockType ANVIL = register("minecraft:anvil", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType ATTACHED_MELON_STEM = register("minecraft:attached_melon_stem", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType ATTACHED_PUMPKIN_STEM = register("minecraft:attached_pumpkin_stem", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType AZURE_BLUET = register("minecraft:azure_bluet"); + public static final BlockType BARRIER = register("minecraft:barrier"); + public static final BlockType BEACON = register("minecraft:beacon"); + public static final BlockType BEDROCK = register("minecraft:bedrock"); + public static final BlockType BEETROOTS = register("minecraft:beetroots", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType BIRCH_BUTTON = register("minecraft:birch_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType BIRCH_DOOR = register("minecraft:birch_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType BIRCH_FENCE = register("minecraft:birch_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType BIRCH_FENCE_GATE = register("minecraft:birch_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType BIRCH_LEAVES = register("minecraft:birch_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); + public static final BlockType BIRCH_LOG = register("minecraft:birch_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType BIRCH_PLANKS = register("minecraft:birch_planks"); + public static final BlockType BIRCH_PRESSURE_PLATE = register("minecraft:birch_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType BIRCH_SAPLING = register("minecraft:birch_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); + public static final BlockType BIRCH_SLAB = register("minecraft:birch_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType BIRCH_STAIRS = register("minecraft:birch_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType BIRCH_TRAPDOOR = register("minecraft:birch_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType BIRCH_WOOD = register("minecraft:birch_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType BLACK_BANNER = register("minecraft:black_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType BLACK_BED = register("minecraft:black_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType BLACK_CARPET = register("minecraft:black_carpet"); + public static final BlockType BLACK_CONCRETE = register("minecraft:black_concrete"); + public static final BlockType BLACK_CONCRETE_POWDER = register("minecraft:black_concrete_powder"); + public static final BlockType BLACK_GLAZED_TERRACOTTA = register("minecraft:black_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType BLACK_SHULKER_BOX = register("minecraft:black_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType BLACK_STAINED_GLASS = register("minecraft:black_stained_glass"); + public static final BlockType BLACK_STAINED_GLASS_PANE = register("minecraft:black_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType BLACK_TERRACOTTA = register("minecraft:black_terracotta"); + public static final BlockType BLACK_WALL_BANNER = register("minecraft:black_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType BLACK_WOOL = register("minecraft:black_wool"); + public static final BlockType BLUE_BANNER = register("minecraft:blue_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType BLUE_BED = register("minecraft:blue_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType BLUE_CARPET = register("minecraft:blue_carpet"); + public static final BlockType BLUE_CONCRETE = register("minecraft:blue_concrete"); + public static final BlockType BLUE_CONCRETE_POWDER = register("minecraft:blue_concrete_powder"); + public static final BlockType BLUE_GLAZED_TERRACOTTA = register("minecraft:blue_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType BLUE_ICE = register("minecraft:blue_ice"); + public static final BlockType BLUE_ORCHID = register("minecraft:blue_orchid"); + public static final BlockType BLUE_SHULKER_BOX = register("minecraft:blue_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType BLUE_STAINED_GLASS = register("minecraft:blue_stained_glass"); + public static final BlockType BLUE_STAINED_GLASS_PANE = register("minecraft:blue_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType BLUE_TERRACOTTA = register("minecraft:blue_terracotta"); + public static final BlockType BLUE_WALL_BANNER = register("minecraft:blue_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType BLUE_WOOL = register("minecraft:blue_wool"); + public static final BlockType BONE_BLOCK = register("minecraft:bone_block", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType BOOKSHELF = register("minecraft:bookshelf"); + public static final BlockType BRAIN_CORAL = register("minecraft:brain_coral"); + public static final BlockType BRAIN_CORAL_BLOCK = register("minecraft:brain_coral_block"); + public static final BlockType BRAIN_CORAL_FAN = register("minecraft:brain_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType BRAIN_CORAL_WALL_FAN = register("minecraft:brain_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType BREWING_STAND = register("minecraft:brewing_stand", state -> state.with(state.getBlockType().getProperty("has_bottle_0"), false).with(state.getBlockType().getProperty("has_bottle_1"), false).with(state.getBlockType().getProperty("has_bottle_2"), false)); + public static final BlockType BRICK_SLAB = register("minecraft:brick_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType BRICK_STAIRS = register("minecraft:brick_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType BRICKS = register("minecraft:bricks"); + public static final BlockType BROWN_BANNER = register("minecraft:brown_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType BROWN_BED = register("minecraft:brown_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType BROWN_CARPET = register("minecraft:brown_carpet"); + public static final BlockType BROWN_CONCRETE = register("minecraft:brown_concrete"); + public static final BlockType BROWN_CONCRETE_POWDER = register("minecraft:brown_concrete_powder"); + public static final BlockType BROWN_GLAZED_TERRACOTTA = register("minecraft:brown_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType BROWN_MUSHROOM = register("minecraft:brown_mushroom"); + public static final BlockType BROWN_MUSHROOM_BLOCK = register("minecraft:brown_mushroom_block", state -> state.with(state.getBlockType().getProperty("down"), true).with(state.getBlockType().getProperty("east"), true).with(state.getBlockType().getProperty("north"), true).with(state.getBlockType().getProperty("south"), true).with(state.getBlockType().getProperty("up"), true).with(state.getBlockType().getProperty("west"), true)); + public static final BlockType BROWN_SHULKER_BOX = register("minecraft:brown_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType BROWN_STAINED_GLASS = register("minecraft:brown_stained_glass"); + public static final BlockType BROWN_STAINED_GLASS_PANE = register("minecraft:brown_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType BROWN_TERRACOTTA = register("minecraft:brown_terracotta"); + public static final BlockType BROWN_WALL_BANNER = register("minecraft:brown_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType BROWN_WOOL = register("minecraft:brown_wool"); + public static final BlockType BUBBLE_COLUMN = register("minecraft:bubble_column", state -> state.with(state.getBlockType().getProperty("drag"), true)); + public static final BlockType BUBBLE_CORAL = register("minecraft:bubble_coral"); + public static final BlockType BUBBLE_CORAL_BLOCK = register("minecraft:bubble_coral_block"); + public static final BlockType BUBBLE_CORAL_FAN = register("minecraft:bubble_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType BUBBLE_CORAL_WALL_FAN = register("minecraft:bubble_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType CACTUS = register("minecraft:cactus", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType CAKE = register("minecraft:cake", state -> state.with(state.getBlockType().getProperty("bites"), 0)); + public static final BlockType CARROTS = register("minecraft:carrots", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType CARVED_PUMPKIN = register("minecraft:carved_pumpkin", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType CAULDRON = register("minecraft:cauldron", state -> state.with(state.getBlockType().getProperty("level"), 0)); + public static final BlockType CAVE_AIR = register("minecraft:cave_air"); + public static final BlockType CHAIN_COMMAND_BLOCK = register("minecraft:chain_command_block", state -> state.with(state.getBlockType().getProperty("conditional"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType CHEST = register("minecraft:chest", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("type"), "SINGLE").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType CHIPPED_ANVIL = register("minecraft:chipped_anvil", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType CHISELED_QUARTZ_BLOCK = register("minecraft:chiseled_quartz_block"); + public static final BlockType CHISELED_RED_SANDSTONE = register("minecraft:chiseled_red_sandstone"); + public static final BlockType CHISELED_SANDSTONE = register("minecraft:chiseled_sandstone"); + public static final BlockType CHISELED_STONE_BRICKS = register("minecraft:chiseled_stone_bricks"); + public static final BlockType CHORUS_FLOWER = register("minecraft:chorus_flower", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType CHORUS_PLANT = register("minecraft:chorus_plant", state -> state.with(state.getBlockType().getProperty("down"), false).with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("up"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType CLAY = register("minecraft:clay"); + public static final BlockType COAL_BLOCK = register("minecraft:coal_block"); + public static final BlockType COAL_ORE = register("minecraft:coal_ore"); + public static final BlockType COARSE_DIRT = register("minecraft:coarse_dirt"); + public static final BlockType COBBLESTONE = register("minecraft:cobblestone"); + public static final BlockType COBBLESTONE_SLAB = register("minecraft:cobblestone_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType COBBLESTONE_STAIRS = register("minecraft:cobblestone_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType COBBLESTONE_WALL = register("minecraft:cobblestone_wall", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("up"), true).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType COBWEB = register("minecraft:cobweb"); + public static final BlockType COCOA = register("minecraft:cocoa", state -> state.with(state.getBlockType().getProperty("age"), 0).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType COMMAND_BLOCK = register("minecraft:command_block", state -> state.with(state.getBlockType().getProperty("conditional"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType COMPARATOR = register("minecraft:comparator", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("mode"), "compare").with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType CONDUIT = register("minecraft:conduit"); + public static final BlockType CRACKED_STONE_BRICKS = register("minecraft:cracked_stone_bricks"); + public static final BlockType CRAFTING_TABLE = register("minecraft:crafting_table"); + public static final BlockType CREEPER_HEAD = register("minecraft:creeper_head", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType CREEPER_WALL_HEAD = register("minecraft:creeper_wall_head", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType CUT_RED_SANDSTONE = register("minecraft:cut_red_sandstone"); + public static final BlockType CUT_SANDSTONE = register("minecraft:cut_sandstone"); + public static final BlockType CYAN_BANNER = register("minecraft:cyan_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType CYAN_BED = register("minecraft:cyan_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType CYAN_CARPET = register("minecraft:cyan_carpet"); + public static final BlockType CYAN_CONCRETE = register("minecraft:cyan_concrete"); + public static final BlockType CYAN_CONCRETE_POWDER = register("minecraft:cyan_concrete_powder"); + public static final BlockType CYAN_GLAZED_TERRACOTTA = register("minecraft:cyan_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType CYAN_SHULKER_BOX = register("minecraft:cyan_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType CYAN_STAINED_GLASS = register("minecraft:cyan_stained_glass"); + public static final BlockType CYAN_STAINED_GLASS_PANE = register("minecraft:cyan_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType CYAN_TERRACOTTA = register("minecraft:cyan_terracotta"); + public static final BlockType CYAN_WALL_BANNER = register("minecraft:cyan_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType CYAN_WOOL = register("minecraft:cyan_wool"); + public static final BlockType DAMAGED_ANVIL = register("minecraft:damaged_anvil", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType DANDELION = register("minecraft:dandelion"); + public static final BlockType DARK_OAK_BUTTON = register("minecraft:dark_oak_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType DARK_OAK_DOOR = register("minecraft:dark_oak_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType DARK_OAK_FENCE = register("minecraft:dark_oak_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType DARK_OAK_FENCE_GATE = register("minecraft:dark_oak_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType DARK_OAK_LEAVES = register("minecraft:dark_oak_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); + public static final BlockType DARK_OAK_LOG = register("minecraft:dark_oak_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType DARK_OAK_PLANKS = register("minecraft:dark_oak_planks"); + public static final BlockType DARK_OAK_PRESSURE_PLATE = register("minecraft:dark_oak_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType DARK_OAK_SAPLING = register("minecraft:dark_oak_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); + public static final BlockType DARK_OAK_SLAB = register("minecraft:dark_oak_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType DARK_OAK_STAIRS = register("minecraft:dark_oak_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType DARK_OAK_TRAPDOOR = register("minecraft:dark_oak_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType DARK_OAK_WOOD = register("minecraft:dark_oak_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType DARK_PRISMARINE = register("minecraft:dark_prismarine"); + public static final BlockType DARK_PRISMARINE_SLAB = register("minecraft:dark_prismarine_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType DARK_PRISMARINE_STAIRS = register("minecraft:dark_prismarine_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType DAYLIGHT_DETECTOR = register("minecraft:daylight_detector", state -> state.with(state.getBlockType().getProperty("inverted"), false).with(state.getBlockType().getProperty("power"), 0)); + public static final BlockType DEAD_BRAIN_CORAL_BLOCK = register("minecraft:dead_brain_coral_block"); + public static final BlockType DEAD_BRAIN_CORAL_FAN = register("minecraft:dead_brain_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_BRAIN_CORAL_WALL_FAN = register("minecraft:dead_brain_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_BUBBLE_CORAL_BLOCK = register("minecraft:dead_bubble_coral_block"); + public static final BlockType DEAD_BUBBLE_CORAL_FAN = register("minecraft:dead_bubble_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_BUBBLE_CORAL_WALL_FAN = register("minecraft:dead_bubble_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_BUSH = register("minecraft:dead_bush"); + public static final BlockType DEAD_FIRE_CORAL_BLOCK = register("minecraft:dead_fire_coral_block"); + public static final BlockType DEAD_FIRE_CORAL_FAN = register("minecraft:dead_fire_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_FIRE_CORAL_WALL_FAN = register("minecraft:dead_fire_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_HORN_CORAL_BLOCK = register("minecraft:dead_horn_coral_block"); + public static final BlockType DEAD_HORN_CORAL_FAN = register("minecraft:dead_horn_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_HORN_CORAL_WALL_FAN = register("minecraft:dead_horn_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_TUBE_CORAL_BLOCK = register("minecraft:dead_tube_coral_block"); + public static final BlockType DEAD_TUBE_CORAL_FAN = register("minecraft:dead_tube_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_TUBE_CORAL_WALL_FAN = register("minecraft:dead_tube_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DETECTOR_RAIL = register("minecraft:detector_rail", state -> state.with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("shape"), "north_south")); + public static final BlockType DIAMOND_BLOCK = register("minecraft:diamond_block"); + public static final BlockType DIAMOND_ORE = register("minecraft:diamond_ore"); + public static final BlockType DIORITE = register("minecraft:diorite"); + public static final BlockType DIRT = register("minecraft:dirt"); + public static final BlockType DISPENSER = register("minecraft:dispenser", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("triggered"), false)); + public static final BlockType DRAGON_EGG = register("minecraft:dragon_egg"); + public static final BlockType DRAGON_HEAD = register("minecraft:dragon_head", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType DRAGON_WALL_HEAD = register("minecraft:dragon_wall_head", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType DRIED_KELP_BLOCK = register("minecraft:dried_kelp_block"); + public static final BlockType DROPPER = register("minecraft:dropper", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("triggered"), false)); + public static final BlockType EMERALD_BLOCK = register("minecraft:emerald_block"); + public static final BlockType EMERALD_ORE = register("minecraft:emerald_ore"); + public static final BlockType ENCHANTING_TABLE = register("minecraft:enchanting_table"); + public static final BlockType END_GATEWAY = register("minecraft:end_gateway"); + public static final BlockType END_PORTAL = register("minecraft:end_portal"); + public static final BlockType END_PORTAL_FRAME = register("minecraft:end_portal_frame", state -> state.with(state.getBlockType().getProperty("eye"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType END_ROD = register("minecraft:end_rod", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType END_STONE = register("minecraft:end_stone"); + public static final BlockType END_STONE_BRICKS = register("minecraft:end_stone_bricks"); + public static final BlockType ENDER_CHEST = register("minecraft:ender_chest", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType FARMLAND = register("minecraft:farmland", state -> state.with(state.getBlockType().getProperty("moisture"), 0)); + public static final BlockType FERN = register("minecraft:fern"); + public static final BlockType FIRE = register("minecraft:fire", state -> state.with(state.getBlockType().getProperty("age"), 0).with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("up"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType FIRE_CORAL = register("minecraft:fire_coral"); + public static final BlockType FIRE_CORAL_BLOCK = register("minecraft:fire_coral_block"); + public static final BlockType FIRE_CORAL_FAN = register("minecraft:fire_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType FIRE_CORAL_WALL_FAN = register("minecraft:fire_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType FLOWER_POT = register("minecraft:flower_pot"); + public static final BlockType FROSTED_ICE = register("minecraft:frosted_ice", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType FURNACE = register("minecraft:furnace", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("lit"), false)); + public static final BlockType GLASS = register("minecraft:glass"); + public static final BlockType GLASS_PANE = register("minecraft:glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType GLOWSTONE = register("minecraft:glowstone"); + public static final BlockType GOLD_BLOCK = register("minecraft:gold_block"); + public static final BlockType GOLD_ORE = register("minecraft:gold_ore"); + public static final BlockType GRANITE = register("minecraft:granite"); + public static final BlockType GRASS = register("minecraft:grass"); + public static final BlockType GRASS_BLOCK = register("minecraft:grass_block", state -> state.with(state.getBlockType().getProperty("snowy"), false)); + public static final BlockType GRASS_PATH = register("minecraft:grass_path"); + public static final BlockType GRAVEL = register("minecraft:gravel"); + public static final BlockType GRAY_BANNER = register("minecraft:gray_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType GRAY_BED = register("minecraft:gray_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType GRAY_CARPET = register("minecraft:gray_carpet"); + public static final BlockType GRAY_CONCRETE = register("minecraft:gray_concrete"); + public static final BlockType GRAY_CONCRETE_POWDER = register("minecraft:gray_concrete_powder"); + public static final BlockType GRAY_GLAZED_TERRACOTTA = register("minecraft:gray_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType GRAY_SHULKER_BOX = register("minecraft:gray_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType GRAY_STAINED_GLASS = register("minecraft:gray_stained_glass"); + public static final BlockType GRAY_STAINED_GLASS_PANE = register("minecraft:gray_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType GRAY_TERRACOTTA = register("minecraft:gray_terracotta"); + public static final BlockType GRAY_WALL_BANNER = register("minecraft:gray_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType GRAY_WOOL = register("minecraft:gray_wool"); + public static final BlockType GREEN_BANNER = register("minecraft:green_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType GREEN_BED = register("minecraft:green_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType GREEN_CARPET = register("minecraft:green_carpet"); + public static final BlockType GREEN_CONCRETE = register("minecraft:green_concrete"); + public static final BlockType GREEN_CONCRETE_POWDER = register("minecraft:green_concrete_powder"); + public static final BlockType GREEN_GLAZED_TERRACOTTA = register("minecraft:green_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType GREEN_SHULKER_BOX = register("minecraft:green_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType GREEN_STAINED_GLASS = register("minecraft:green_stained_glass"); + public static final BlockType GREEN_STAINED_GLASS_PANE = register("minecraft:green_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType GREEN_TERRACOTTA = register("minecraft:green_terracotta"); + public static final BlockType GREEN_WALL_BANNER = register("minecraft:green_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType GREEN_WOOL = register("minecraft:green_wool"); + public static final BlockType HAY_BLOCK = register("minecraft:hay_block", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType HEAVY_WEIGHTED_PRESSURE_PLATE = register("minecraft:heavy_weighted_pressure_plate", state -> state.with(state.getBlockType().getProperty("power"), 0)); + public static final BlockType HOPPER = register("minecraft:hopper", state -> state.with(state.getBlockType().getProperty("enabled"), true).with(state.getBlockType().getProperty("facing"), Direction.DOWN)); + public static final BlockType HORN_CORAL = register("minecraft:horn_coral"); + public static final BlockType HORN_CORAL_BLOCK = register("minecraft:horn_coral_block"); + public static final BlockType HORN_CORAL_FAN = register("minecraft:horn_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType HORN_CORAL_WALL_FAN = register("minecraft:horn_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType ICE = register("minecraft:ice"); + public static final BlockType INFESTED_CHISELED_STONE_BRICKS = register("minecraft:infested_chiseled_stone_bricks"); + public static final BlockType INFESTED_COBBLESTONE = register("minecraft:infested_cobblestone"); + public static final BlockType INFESTED_CRACKED_STONE_BRICKS = register("minecraft:infested_cracked_stone_bricks"); + public static final BlockType INFESTED_MOSSY_STONE_BRICKS = register("minecraft:infested_mossy_stone_bricks"); + public static final BlockType INFESTED_STONE = register("minecraft:infested_stone"); + public static final BlockType INFESTED_STONE_BRICKS = register("minecraft:infested_stone_bricks"); + public static final BlockType IRON_BARS = register("minecraft:iron_bars", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType IRON_BLOCK = register("minecraft:iron_block"); + public static final BlockType IRON_DOOR = register("minecraft:iron_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType IRON_ORE = register("minecraft:iron_ore"); + public static final BlockType IRON_TRAPDOOR = register("minecraft:iron_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType JACK_O_LANTERN = register("minecraft:jack_o_lantern", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType JUKEBOX = register("minecraft:jukebox", state -> state.with(state.getBlockType().getProperty("has_record"), false)); + public static final BlockType JUNGLE_BUTTON = register("minecraft:jungle_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType JUNGLE_DOOR = register("minecraft:jungle_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType JUNGLE_FENCE = register("minecraft:jungle_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType JUNGLE_FENCE_GATE = register("minecraft:jungle_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType JUNGLE_LEAVES = register("minecraft:jungle_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); + public static final BlockType JUNGLE_LOG = register("minecraft:jungle_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType JUNGLE_PLANKS = register("minecraft:jungle_planks"); + public static final BlockType JUNGLE_PRESSURE_PLATE = register("minecraft:jungle_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType JUNGLE_SAPLING = register("minecraft:jungle_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); + public static final BlockType JUNGLE_SLAB = register("minecraft:jungle_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType JUNGLE_STAIRS = register("minecraft:jungle_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType JUNGLE_TRAPDOOR = register("minecraft:jungle_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType JUNGLE_WOOD = register("minecraft:jungle_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType KELP = register("minecraft:kelp", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType KELP_PLANT = register("minecraft:kelp_plant"); + public static final BlockType LADDER = register("minecraft:ladder", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType LAPIS_BLOCK = register("minecraft:lapis_block"); + public static final BlockType LAPIS_ORE = register("minecraft:lapis_ore"); + public static final BlockType LARGE_FERN = register("minecraft:large_fern", state -> state.with(state.getBlockType().getProperty("half"), "lower")); + public static final BlockType LAVA = register("minecraft:lava", state -> state.with(state.getBlockType().getProperty("level"), 0)); + public static final BlockType LEVER = register("minecraft:lever", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType LIGHT_BLUE_BANNER = register("minecraft:light_blue_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType LIGHT_BLUE_BED = register("minecraft:light_blue_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType LIGHT_BLUE_CARPET = register("minecraft:light_blue_carpet"); + public static final BlockType LIGHT_BLUE_CONCRETE = register("minecraft:light_blue_concrete"); + public static final BlockType LIGHT_BLUE_CONCRETE_POWDER = register("minecraft:light_blue_concrete_powder"); + public static final BlockType LIGHT_BLUE_GLAZED_TERRACOTTA = register("minecraft:light_blue_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType LIGHT_BLUE_SHULKER_BOX = register("minecraft:light_blue_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType LIGHT_BLUE_STAINED_GLASS = register("minecraft:light_blue_stained_glass"); + public static final BlockType LIGHT_BLUE_STAINED_GLASS_PANE = register("minecraft:light_blue_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType LIGHT_BLUE_TERRACOTTA = register("minecraft:light_blue_terracotta"); + public static final BlockType LIGHT_BLUE_WALL_BANNER = register("minecraft:light_blue_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType LIGHT_BLUE_WOOL = register("minecraft:light_blue_wool"); + public static final BlockType LIGHT_GRAY_BANNER = register("minecraft:light_gray_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType LIGHT_GRAY_BED = register("minecraft:light_gray_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType LIGHT_GRAY_CARPET = register("minecraft:light_gray_carpet"); + public static final BlockType LIGHT_GRAY_CONCRETE = register("minecraft:light_gray_concrete"); + public static final BlockType LIGHT_GRAY_CONCRETE_POWDER = register("minecraft:light_gray_concrete_powder"); + public static final BlockType LIGHT_GRAY_GLAZED_TERRACOTTA = register("minecraft:light_gray_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType LIGHT_GRAY_SHULKER_BOX = register("minecraft:light_gray_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType LIGHT_GRAY_STAINED_GLASS = register("minecraft:light_gray_stained_glass"); + public static final BlockType LIGHT_GRAY_STAINED_GLASS_PANE = register("minecraft:light_gray_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType LIGHT_GRAY_TERRACOTTA = register("minecraft:light_gray_terracotta"); + public static final BlockType LIGHT_GRAY_WALL_BANNER = register("minecraft:light_gray_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType LIGHT_GRAY_WOOL = register("minecraft:light_gray_wool"); + public static final BlockType LIGHT_WEIGHTED_PRESSURE_PLATE = register("minecraft:light_weighted_pressure_plate", state -> state.with(state.getBlockType().getProperty("power"), 0)); + public static final BlockType LILAC = register("minecraft:lilac", state -> state.with(state.getBlockType().getProperty("half"), "lower")); + public static final BlockType LILY_PAD = register("minecraft:lily_pad"); + public static final BlockType LIME_BANNER = register("minecraft:lime_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType LIME_BED = register("minecraft:lime_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType LIME_CARPET = register("minecraft:lime_carpet"); + public static final BlockType LIME_CONCRETE = register("minecraft:lime_concrete"); + public static final BlockType LIME_CONCRETE_POWDER = register("minecraft:lime_concrete_powder"); + public static final BlockType LIME_GLAZED_TERRACOTTA = register("minecraft:lime_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType LIME_SHULKER_BOX = register("minecraft:lime_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType LIME_STAINED_GLASS = register("minecraft:lime_stained_glass"); + public static final BlockType LIME_STAINED_GLASS_PANE = register("minecraft:lime_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType LIME_TERRACOTTA = register("minecraft:lime_terracotta"); + public static final BlockType LIME_WALL_BANNER = register("minecraft:lime_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType LIME_WOOL = register("minecraft:lime_wool"); + public static final BlockType MAGENTA_BANNER = register("minecraft:magenta_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType MAGENTA_BED = register("minecraft:magenta_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType MAGENTA_CARPET = register("minecraft:magenta_carpet"); + public static final BlockType MAGENTA_CONCRETE = register("minecraft:magenta_concrete"); + public static final BlockType MAGENTA_CONCRETE_POWDER = register("minecraft:magenta_concrete_powder"); + public static final BlockType MAGENTA_GLAZED_TERRACOTTA = register("minecraft:magenta_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType MAGENTA_SHULKER_BOX = register("minecraft:magenta_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType MAGENTA_STAINED_GLASS = register("minecraft:magenta_stained_glass"); + public static final BlockType MAGENTA_STAINED_GLASS_PANE = register("minecraft:magenta_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType MAGENTA_TERRACOTTA = register("minecraft:magenta_terracotta"); + public static final BlockType MAGENTA_WALL_BANNER = register("minecraft:magenta_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType MAGENTA_WOOL = register("minecraft:magenta_wool"); + public static final BlockType MAGMA_BLOCK = register("minecraft:magma_block"); + public static final BlockType MELON = register("minecraft:melon"); + public static final BlockType MELON_STEM = register("minecraft:melon_stem", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType MOSSY_COBBLESTONE = register("minecraft:mossy_cobblestone"); + public static final BlockType MOSSY_COBBLESTONE_WALL = register("minecraft:mossy_cobblestone_wall", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("up"), true).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType MOSSY_STONE_BRICKS = register("minecraft:mossy_stone_bricks"); + public static final BlockType MOVING_PISTON = register("minecraft:moving_piston", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("type"), "normal")); + public static final BlockType MUSHROOM_STEM = register("minecraft:mushroom_stem", state -> state.with(state.getBlockType().getProperty("down"), true).with(state.getBlockType().getProperty("east"), true).with(state.getBlockType().getProperty("north"), true).with(state.getBlockType().getProperty("south"), true).with(state.getBlockType().getProperty("up"), true).with(state.getBlockType().getProperty("west"), true)); + public static final BlockType MYCELIUM = register("minecraft:mycelium", state -> state.with(state.getBlockType().getProperty("snowy"), false)); + public static final BlockType NETHER_BRICK_FENCE = register("minecraft:nether_brick_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType NETHER_BRICK_SLAB = register("minecraft:nether_brick_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType NETHER_BRICK_STAIRS = register("minecraft:nether_brick_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType NETHER_BRICKS = register("minecraft:nether_bricks"); + public static final BlockType NETHER_PORTAL = register("minecraft:nether_portal", state -> state.with(state.getBlockType().getProperty("axis"), "x")); + public static final BlockType NETHER_QUARTZ_ORE = register("minecraft:nether_quartz_ore"); + public static final BlockType NETHER_WART = register("minecraft:nether_wart", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType NETHER_WART_BLOCK = register("minecraft:nether_wart_block"); + public static final BlockType NETHERRACK = register("minecraft:netherrack"); + public static final BlockType NOTE_BLOCK = register("minecraft:note_block", state -> state.with(state.getBlockType().getProperty("instrument"), "HARP").with(state.getBlockType().getProperty("note"), 0).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType OAK_BUTTON = register("minecraft:oak_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType OAK_DOOR = register("minecraft:oak_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType OAK_FENCE = register("minecraft:oak_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType OAK_FENCE_GATE = register("minecraft:oak_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType OAK_LEAVES = register("minecraft:oak_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); + public static final BlockType OAK_LOG = register("minecraft:oak_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType OAK_PLANKS = register("minecraft:oak_planks"); + public static final BlockType OAK_PRESSURE_PLATE = register("minecraft:oak_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType OAK_SAPLING = register("minecraft:oak_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); + public static final BlockType OAK_SLAB = register("minecraft:oak_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType OAK_STAIRS = register("minecraft:oak_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType OAK_TRAPDOOR = register("minecraft:oak_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType OAK_WOOD = register("minecraft:oak_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType OBSERVER = register("minecraft:observer", state -> state.with(state.getBlockType().getProperty("facing"), Direction.SOUTH).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType OBSIDIAN = register("minecraft:obsidian"); + public static final BlockType ORANGE_BANNER = register("minecraft:orange_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType ORANGE_BED = register("minecraft:orange_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType ORANGE_CARPET = register("minecraft:orange_carpet"); + public static final BlockType ORANGE_CONCRETE = register("minecraft:orange_concrete"); + public static final BlockType ORANGE_CONCRETE_POWDER = register("minecraft:orange_concrete_powder"); + public static final BlockType ORANGE_GLAZED_TERRACOTTA = register("minecraft:orange_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType ORANGE_SHULKER_BOX = register("minecraft:orange_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType ORANGE_STAINED_GLASS = register("minecraft:orange_stained_glass"); + public static final BlockType ORANGE_STAINED_GLASS_PANE = register("minecraft:orange_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType ORANGE_TERRACOTTA = register("minecraft:orange_terracotta"); + public static final BlockType ORANGE_TULIP = register("minecraft:orange_tulip"); + public static final BlockType ORANGE_WALL_BANNER = register("minecraft:orange_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType ORANGE_WOOL = register("minecraft:orange_wool"); + public static final BlockType OXEYE_DAISY = register("minecraft:oxeye_daisy"); + public static final BlockType PACKED_ICE = register("minecraft:packed_ice"); + public static final BlockType PEONY = register("minecraft:peony", state -> state.with(state.getBlockType().getProperty("half"), "lower")); + public static final BlockType PETRIFIED_OAK_SLAB = register("minecraft:petrified_oak_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType PINK_BANNER = register("minecraft:pink_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType PINK_BED = register("minecraft:pink_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType PINK_CARPET = register("minecraft:pink_carpet"); + public static final BlockType PINK_CONCRETE = register("minecraft:pink_concrete"); + public static final BlockType PINK_CONCRETE_POWDER = register("minecraft:pink_concrete_powder"); + public static final BlockType PINK_GLAZED_TERRACOTTA = register("minecraft:pink_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType PINK_SHULKER_BOX = register("minecraft:pink_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType PINK_STAINED_GLASS = register("minecraft:pink_stained_glass"); + public static final BlockType PINK_STAINED_GLASS_PANE = register("minecraft:pink_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType PINK_TERRACOTTA = register("minecraft:pink_terracotta"); + public static final BlockType PINK_TULIP = register("minecraft:pink_tulip"); + public static final BlockType PINK_WALL_BANNER = register("minecraft:pink_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType PINK_WOOL = register("minecraft:pink_wool"); + public static final BlockType PISTON = register("minecraft:piston", state -> state.with(state.getBlockType().getProperty("extended"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType PISTON_HEAD = register("minecraft:piston_head", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("short"), false).with(state.getBlockType().getProperty("type"), "normal")); + public static final BlockType PLAYER_HEAD = register("minecraft:player_head", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType PLAYER_WALL_HEAD = register("minecraft:player_wall_head", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType PODZOL = register("minecraft:podzol", state -> state.with(state.getBlockType().getProperty("snowy"), false)); + public static final BlockType POLISHED_ANDESITE = register("minecraft:polished_andesite"); + public static final BlockType POLISHED_DIORITE = register("minecraft:polished_diorite"); + public static final BlockType POLISHED_GRANITE = register("minecraft:polished_granite"); + public static final BlockType POPPY = register("minecraft:poppy"); + public static final BlockType POTATOES = register("minecraft:potatoes", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType POTTED_ACACIA_SAPLING = register("minecraft:potted_acacia_sapling"); + public static final BlockType POTTED_ALLIUM = register("minecraft:potted_allium"); + public static final BlockType POTTED_AZURE_BLUET = register("minecraft:potted_azure_bluet"); + public static final BlockType POTTED_BIRCH_SAPLING = register("minecraft:potted_birch_sapling"); + public static final BlockType POTTED_BLUE_ORCHID = register("minecraft:potted_blue_orchid"); + public static final BlockType POTTED_BROWN_MUSHROOM = register("minecraft:potted_brown_mushroom"); + public static final BlockType POTTED_CACTUS = register("minecraft:potted_cactus"); + public static final BlockType POTTED_DANDELION = register("minecraft:potted_dandelion"); + public static final BlockType POTTED_DARK_OAK_SAPLING = register("minecraft:potted_dark_oak_sapling"); + public static final BlockType POTTED_DEAD_BUSH = register("minecraft:potted_dead_bush"); + public static final BlockType POTTED_FERN = register("minecraft:potted_fern"); + public static final BlockType POTTED_JUNGLE_SAPLING = register("minecraft:potted_jungle_sapling"); + public static final BlockType POTTED_OAK_SAPLING = register("minecraft:potted_oak_sapling"); + public static final BlockType POTTED_ORANGE_TULIP = register("minecraft:potted_orange_tulip"); + public static final BlockType POTTED_OXEYE_DAISY = register("minecraft:potted_oxeye_daisy"); + public static final BlockType POTTED_PINK_TULIP = register("minecraft:potted_pink_tulip"); + public static final BlockType POTTED_POPPY = register("minecraft:potted_poppy"); + public static final BlockType POTTED_RED_MUSHROOM = register("minecraft:potted_red_mushroom"); + public static final BlockType POTTED_RED_TULIP = register("minecraft:potted_red_tulip"); + public static final BlockType POTTED_SPRUCE_SAPLING = register("minecraft:potted_spruce_sapling"); + public static final BlockType POTTED_WHITE_TULIP = register("minecraft:potted_white_tulip"); + public static final BlockType POWERED_RAIL = register("minecraft:powered_rail", state -> state.with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("shape"), "north_south")); + public static final BlockType PRISMARINE = register("minecraft:prismarine"); + public static final BlockType PRISMARINE_BRICK_SLAB = register("minecraft:prismarine_brick_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType PRISMARINE_BRICK_STAIRS = register("minecraft:prismarine_brick_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType PRISMARINE_BRICKS = register("minecraft:prismarine_bricks"); + public static final BlockType PRISMARINE_SLAB = register("minecraft:prismarine_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType PRISMARINE_STAIRS = register("minecraft:prismarine_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType PUMPKIN = register("minecraft:pumpkin"); + public static final BlockType PUMPKIN_STEM = register("minecraft:pumpkin_stem", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType PURPLE_BANNER = register("minecraft:purple_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType PURPLE_BED = register("minecraft:purple_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType PURPLE_CARPET = register("minecraft:purple_carpet"); + public static final BlockType PURPLE_CONCRETE = register("minecraft:purple_concrete"); + public static final BlockType PURPLE_CONCRETE_POWDER = register("minecraft:purple_concrete_powder"); + public static final BlockType PURPLE_GLAZED_TERRACOTTA = register("minecraft:purple_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType PURPLE_SHULKER_BOX = register("minecraft:purple_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType PURPLE_STAINED_GLASS = register("minecraft:purple_stained_glass"); + public static final BlockType PURPLE_STAINED_GLASS_PANE = register("minecraft:purple_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType PURPLE_TERRACOTTA = register("minecraft:purple_terracotta"); + public static final BlockType PURPLE_WALL_BANNER = register("minecraft:purple_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType PURPLE_WOOL = register("minecraft:purple_wool"); + public static final BlockType PURPUR_BLOCK = register("minecraft:purpur_block"); + public static final BlockType PURPUR_PILLAR = register("minecraft:purpur_pillar", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType PURPUR_SLAB = register("minecraft:purpur_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType PURPUR_STAIRS = register("minecraft:purpur_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType QUARTZ_BLOCK = register("minecraft:quartz_block"); + public static final BlockType QUARTZ_PILLAR = register("minecraft:quartz_pillar", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType QUARTZ_SLAB = register("minecraft:quartz_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType QUARTZ_STAIRS = register("minecraft:quartz_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType RAIL = register("minecraft:rail", state -> state.with(state.getBlockType().getProperty("shape"), "north_south")); + public static final BlockType RED_BANNER = register("minecraft:red_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType RED_BED = register("minecraft:red_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType RED_CARPET = register("minecraft:red_carpet"); + public static final BlockType RED_CONCRETE = register("minecraft:red_concrete"); + public static final BlockType RED_CONCRETE_POWDER = register("minecraft:red_concrete_powder"); + public static final BlockType RED_GLAZED_TERRACOTTA = register("minecraft:red_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType RED_MUSHROOM = register("minecraft:red_mushroom"); + public static final BlockType RED_MUSHROOM_BLOCK = register("minecraft:red_mushroom_block", state -> state.with(state.getBlockType().getProperty("down"), true).with(state.getBlockType().getProperty("east"), true).with(state.getBlockType().getProperty("north"), true).with(state.getBlockType().getProperty("south"), true).with(state.getBlockType().getProperty("up"), true).with(state.getBlockType().getProperty("west"), true)); + public static final BlockType RED_NETHER_BRICKS = register("minecraft:red_nether_bricks"); + public static final BlockType RED_SAND = register("minecraft:red_sand"); + public static final BlockType RED_SANDSTONE = register("minecraft:red_sandstone"); + public static final BlockType RED_SANDSTONE_SLAB = register("minecraft:red_sandstone_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType RED_SANDSTONE_STAIRS = register("minecraft:red_sandstone_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType RED_SHULKER_BOX = register("minecraft:red_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType RED_STAINED_GLASS = register("minecraft:red_stained_glass"); + public static final BlockType RED_STAINED_GLASS_PANE = register("minecraft:red_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType RED_TERRACOTTA = register("minecraft:red_terracotta"); + public static final BlockType RED_TULIP = register("minecraft:red_tulip"); + public static final BlockType RED_WALL_BANNER = register("minecraft:red_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType RED_WOOL = register("minecraft:red_wool"); + public static final BlockType REDSTONE_BLOCK = register("minecraft:redstone_block"); + public static final BlockType REDSTONE_LAMP = register("minecraft:redstone_lamp", state -> state.with(state.getBlockType().getProperty("lit"), false)); + public static final BlockType REDSTONE_ORE = register("minecraft:redstone_ore", state -> state.with(state.getBlockType().getProperty("lit"), false)); + public static final BlockType REDSTONE_TORCH = register("minecraft:redstone_torch", state -> state.with(state.getBlockType().getProperty("lit"), true)); + public static final BlockType REDSTONE_WALL_TORCH = register("minecraft:redstone_wall_torch", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("lit"), true)); + public static final BlockType REDSTONE_WIRE = register("minecraft:redstone_wire", state -> state.with(state.getBlockType().getProperty("east"), "none").with(state.getBlockType().getProperty("north"), "none").with(state.getBlockType().getProperty("power"), 0).with(state.getBlockType().getProperty("south"), "none").with(state.getBlockType().getProperty("west"), "none")); + public static final BlockType REPEATER = register("minecraft:repeater", state -> state.with(state.getBlockType().getProperty("delay"), 1).with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("locked"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType REPEATING_COMMAND_BLOCK = register("minecraft:repeating_command_block", state -> state.with(state.getBlockType().getProperty("conditional"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType ROSE_BUSH = register("minecraft:rose_bush", state -> state.with(state.getBlockType().getProperty("half"), "lower")); + public static final BlockType SAND = register("minecraft:sand"); + public static final BlockType SANDSTONE = register("minecraft:sandstone"); + public static final BlockType SANDSTONE_SLAB = register("minecraft:sandstone_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType SANDSTONE_STAIRS = register("minecraft:sandstone_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType SEA_LANTERN = register("minecraft:sea_lantern"); + public static final BlockType SEA_PICKLE = register("minecraft:sea_pickle", state -> state.with(state.getBlockType().getProperty("pickles"), 1).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType SEAGRASS = register("minecraft:seagrass"); + public static final BlockType SHULKER_BOX = register("minecraft:shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType SIGN = register("minecraft:sign", state -> state.with(state.getBlockType().getProperty("rotation"), 0).with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType SKELETON_SKULL = register("minecraft:skeleton_skull", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType SKELETON_WALL_SKULL = register("minecraft:skeleton_wall_skull", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType SLIME_BLOCK = register("minecraft:slime_block"); + public static final BlockType SMOOTH_QUARTZ = register("minecraft:smooth_quartz"); + public static final BlockType SMOOTH_RED_SANDSTONE = register("minecraft:smooth_red_sandstone"); + public static final BlockType SMOOTH_SANDSTONE = register("minecraft:smooth_sandstone"); + public static final BlockType SMOOTH_STONE = register("minecraft:smooth_stone"); + public static final BlockType SNOW = register("minecraft:snow", state -> state.with(state.getBlockType().getProperty("layers"), 1)); + public static final BlockType SNOW_BLOCK = register("minecraft:snow_block"); + public static final BlockType SOUL_SAND = register("minecraft:soul_sand"); + public static final BlockType SPAWNER = register("minecraft:spawner"); + public static final BlockType SPONGE = register("minecraft:sponge"); + public static final BlockType SPRUCE_BUTTON = register("minecraft:spruce_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType SPRUCE_DOOR = register("minecraft:spruce_door", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "lower").with(state.getBlockType().getProperty("hinge"), "left").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType SPRUCE_FENCE = register("minecraft:spruce_fence", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType SPRUCE_FENCE_GATE = register("minecraft:spruce_fence_gate", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("in_wall"), false).with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType SPRUCE_LEAVES = register("minecraft:spruce_leaves", state -> state.with(state.getBlockType().getProperty("distance"), 7).with(state.getBlockType().getProperty("persistent"), false)); + public static final BlockType SPRUCE_LOG = register("minecraft:spruce_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType SPRUCE_PLANKS = register("minecraft:spruce_planks"); + public static final BlockType SPRUCE_PRESSURE_PLATE = register("minecraft:spruce_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType SPRUCE_SAPLING = register("minecraft:spruce_sapling", state -> state.with(state.getBlockType().getProperty("stage"), 0)); + public static final BlockType SPRUCE_SLAB = register("minecraft:spruce_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType SPRUCE_STAIRS = register("minecraft:spruce_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType SPRUCE_TRAPDOOR = register("minecraft:spruce_trapdoor", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("open"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType SPRUCE_WOOD = register("minecraft:spruce_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STICKY_PISTON = register("minecraft:sticky_piston", state -> state.with(state.getBlockType().getProperty("extended"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType STONE = register("minecraft:stone"); + public static final BlockType STONE_BRICK_SLAB = register("minecraft:stone_brick_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType STONE_BRICK_STAIRS = register("minecraft:stone_brick_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType STONE_BRICKS = register("minecraft:stone_bricks"); + public static final BlockType STONE_BUTTON = register("minecraft:stone_button", state -> state.with(state.getBlockType().getProperty("face"), "WALL").with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType STONE_PRESSURE_PLATE = register("minecraft:stone_pressure_plate", state -> state.with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType STONE_SLAB = register("minecraft:stone_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType STRIPPED_ACACIA_LOG = register("minecraft:stripped_acacia_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRIPPED_ACACIA_WOOD = register("minecraft:stripped_acacia_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRIPPED_BIRCH_LOG = register("minecraft:stripped_birch_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRIPPED_BIRCH_WOOD = register("minecraft:stripped_birch_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRIPPED_DARK_OAK_LOG = register("minecraft:stripped_dark_oak_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRIPPED_DARK_OAK_WOOD = register("minecraft:stripped_dark_oak_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRIPPED_JUNGLE_LOG = register("minecraft:stripped_jungle_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRIPPED_JUNGLE_WOOD = register("minecraft:stripped_jungle_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRIPPED_OAK_LOG = register("minecraft:stripped_oak_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRIPPED_OAK_WOOD = register("minecraft:stripped_oak_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRIPPED_SPRUCE_LOG = register("minecraft:stripped_spruce_log", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRIPPED_SPRUCE_WOOD = register("minecraft:stripped_spruce_wood", state -> state.with(state.getBlockType().getProperty("axis"), "y")); + public static final BlockType STRUCTURE_BLOCK = register("minecraft:structure_block", state -> state.with(state.getBlockType().getProperty("mode"), "SAVE")); + public static final BlockType STRUCTURE_VOID = register("minecraft:structure_void"); + public static final BlockType SUGAR_CANE = register("minecraft:sugar_cane", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType SUNFLOWER = register("minecraft:sunflower", state -> state.with(state.getBlockType().getProperty("half"), "lower")); + public static final BlockType TALL_GRASS = register("minecraft:tall_grass", state -> state.with(state.getBlockType().getProperty("half"), "lower")); + public static final BlockType TALL_SEAGRASS = register("minecraft:tall_seagrass", state -> state.with(state.getBlockType().getProperty("half"), "lower")); + public static final BlockType TERRACOTTA = register("minecraft:terracotta"); + public static final BlockType TNT = register("minecraft:tnt"); + public static final BlockType TORCH = register("minecraft:torch"); + public static final BlockType TRAPPED_CHEST = register("minecraft:trapped_chest", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("type"), "SINGLE").with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType TRIPWIRE = register("minecraft:tripwire", state -> state.with(state.getBlockType().getProperty("attached"), false).with(state.getBlockType().getProperty("disarmed"), false).with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType TRIPWIRE_HOOK = register("minecraft:tripwire_hook", state -> state.with(state.getBlockType().getProperty("attached"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); + public static final BlockType TUBE_CORAL = register("minecraft:tube_coral"); + public static final BlockType TUBE_CORAL_BLOCK = register("minecraft:tube_coral_block"); + public static final BlockType TUBE_CORAL_FAN = register("minecraft:tube_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType TUBE_CORAL_WALL_FAN = register("minecraft:tube_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType TURTLE_EGG = register("minecraft:turtle_egg", state -> state.with(state.getBlockType().getProperty("eggs"), 1).with(state.getBlockType().getProperty("hatch"), 0)); + public static final BlockType VINE = register("minecraft:vine", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("up"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType VOID_AIR = register("minecraft:void_air"); + public static final BlockType WALL_SIGN = register("minecraft:wall_sign", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), false)); + public static final BlockType WALL_TORCH = register("minecraft:wall_torch", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType WATER = register("minecraft:water", state -> state.with(state.getBlockType().getProperty("level"), 0)); + public static final BlockType WET_SPONGE = register("minecraft:wet_sponge"); + public static final BlockType WHEAT = register("minecraft:wheat", state -> state.with(state.getBlockType().getProperty("age"), 0)); + public static final BlockType WHITE_BANNER = register("minecraft:white_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType WHITE_BED = register("minecraft:white_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType WHITE_CARPET = register("minecraft:white_carpet"); + public static final BlockType WHITE_CONCRETE = register("minecraft:white_concrete"); + public static final BlockType WHITE_CONCRETE_POWDER = register("minecraft:white_concrete_powder"); + public static final BlockType WHITE_GLAZED_TERRACOTTA = register("minecraft:white_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType WHITE_SHULKER_BOX = register("minecraft:white_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType WHITE_STAINED_GLASS = register("minecraft:white_stained_glass"); + public static final BlockType WHITE_STAINED_GLASS_PANE = register("minecraft:white_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType WHITE_TERRACOTTA = register("minecraft:white_terracotta"); + public static final BlockType WHITE_TULIP = register("minecraft:white_tulip"); + public static final BlockType WHITE_WALL_BANNER = register("minecraft:white_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType WHITE_WOOL = register("minecraft:white_wool"); + public static final BlockType WITHER_SKELETON_SKULL = register("minecraft:wither_skeleton_skull", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType WITHER_SKELETON_WALL_SKULL = register("minecraft:wither_skeleton_wall_skull", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType YELLOW_BANNER = register("minecraft:yellow_banner", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType YELLOW_BED = register("minecraft:yellow_bed", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("occupied"), false).with(state.getBlockType().getProperty("part"), "foot")); + public static final BlockType YELLOW_CARPET = register("minecraft:yellow_carpet"); + public static final BlockType YELLOW_CONCRETE = register("minecraft:yellow_concrete"); + public static final BlockType YELLOW_CONCRETE_POWDER = register("minecraft:yellow_concrete_powder"); + public static final BlockType YELLOW_GLAZED_TERRACOTTA = register("minecraft:yellow_glazed_terracotta", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType YELLOW_SHULKER_BOX = register("minecraft:yellow_shulker_box", state -> state.with(state.getBlockType().getProperty("facing"), Direction.UP)); + public static final BlockType YELLOW_STAINED_GLASS = register("minecraft:yellow_stained_glass"); + public static final BlockType YELLOW_STAINED_GLASS_PANE = register("minecraft:yellow_stained_glass_pane", state -> state.with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("waterlogged"), false).with(state.getBlockType().getProperty("west"), false)); + public static final BlockType YELLOW_TERRACOTTA = register("minecraft:yellow_terracotta"); + public static final BlockType YELLOW_WALL_BANNER = register("minecraft:yellow_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + public static final BlockType YELLOW_WOOL = register("minecraft:yellow_wool"); + public static final BlockType ZOMBIE_HEAD = register("minecraft:zombie_head", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); + public static final BlockType ZOMBIE_WALL_HEAD = register("minecraft:zombie_wall_head", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); + + private BlockTypes() { + } + + private static BlockType register(final String id) { + return register(new BlockType(id)); + } + + private static BlockType register(final String id, Function values) { + return register(new BlockType(id, values)); + } + + public static BlockType register(final BlockType block) { + return BlockType.REGISTRY.register(block.getId(), block); + } + + public static @Nullable BlockType get(final String id) { + return BlockType.REGISTRY.get(id); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java index f52f6d969..0f0d70d05 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java @@ -28,17 +28,19 @@ import com.sk89q.jnbt.NBTUtils; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.TileEntityBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.storage.InvalidFormatException; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.Nullable; + public class AnvilChunk implements Chunk { private CompoundTag rootTag; @@ -118,8 +120,7 @@ public class AnvilChunk implements Chunk { } } - @Override - public int getBlockID(Vector position) throws DataException { + private int getBlockID(Vector position) throws DataException { int x = position.getBlockX() - rootX * 16; int y = position.getBlockY(); int z = position.getBlockZ() - rootZ * 16; @@ -130,9 +131,6 @@ public class AnvilChunk implements Chunk { } int yindex = y & 0x0F; - if (yindex < 0 || yindex >= 16) { - throw new DataException("Chunk does not contain position " + position); - } int index = x + (z * 16 + (yindex * 16 * 16)); @@ -155,8 +153,7 @@ public class AnvilChunk implements Chunk { } } - @Override - public int getBlockData(Vector position) throws DataException { + private int getBlockData(Vector position) throws DataException { int x = position.getBlockX() - rootX * 16; int y = position.getBlockY(); int z = position.getBlockZ() - rootZ * 16; @@ -167,10 +164,6 @@ public class AnvilChunk implements Chunk { if (section < 0 || section >= blocks.length) { throw new DataException("Chunk does not contain position " + position); } - - if (yIndex < 0 || yIndex >= 16) { - throw new DataException("Chunk does not contain position " + position); - } int index = x + (z * 16 + (yIndex * 16 * 16)); boolean shift = index % 2 == 0; @@ -196,12 +189,11 @@ public class AnvilChunk implements Chunk { List tags = NBTUtils.getChildTag(rootTag.getValue(), "TileEntities", ListTag.class).getValue(); - tileEntities = new HashMap>(); + tileEntities = new HashMap<>(); for (Tag tag : tags) { if (!(tag instanceof CompoundTag)) { - throw new InvalidFormatException( - "CompoundTag expected in TileEntities"); + throw new InvalidFormatException("CompoundTag expected in TileEntities"); } CompoundTag t = (CompoundTag) tag; @@ -210,21 +202,25 @@ public class AnvilChunk implements Chunk { int y = 0; int z = 0; - Map values = new HashMap(); + Map values = new HashMap<>(); for (Map.Entry entry : t.getValue().entrySet()) { - if (entry.getKey().equals("x")) { - if (entry.getValue() instanceof IntTag) { - x = ((IntTag) entry.getValue()).getValue(); - } - } else if (entry.getKey().equals("y")) { - if (entry.getValue() instanceof IntTag) { - y = ((IntTag) entry.getValue()).getValue(); - } - } else if (entry.getKey().equals("z")) { - if (entry.getValue() instanceof IntTag) { - z = ((IntTag) entry.getValue()).getValue(); - } + switch (entry.getKey()) { + case "x": + if (entry.getValue() instanceof IntTag) { + x = ((IntTag) entry.getValue()).getValue(); + } + break; + case "y": + if (entry.getValue() instanceof IntTag) { + y = ((IntTag) entry.getValue()).getValue(); + } + break; + case "z": + if (entry.getValue() instanceof IntTag) { + z = ((IntTag) entry.getValue()).getValue(); + } + break; } values.put(entry.getKey(), entry.getValue()); @@ -262,30 +258,11 @@ public class AnvilChunk implements Chunk { public BaseBlock getBlock(Vector position) throws DataException { int id = getBlockID(position); int data = getBlockData(position); - BaseBlock block; - - /*if (id == BlockID.WALL_SIGN || id == BlockID.SIGN_POST) { - block = new SignBlock(id, data); - } else if (id == BlockID.CHEST) { - block = new ChestBlock(data); - } else if (id == BlockID.FURNACE || id == BlockID.BURNING_FURNACE) { - block = new FurnaceBlock(id, data); - } else if (id == BlockID.DISPENSER) { - block = new DispenserBlock(data); - } else if (id == BlockID.MOB_SPAWNER) { - block = new MobSpawnerBlock(data); - } else if (id == BlockID.NOTE_BLOCK) { - block = new NoteBlock(data); - } else {*/ - block = new BaseBlock(id, data); - //} + BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data); CompoundTag tileEntity = getBlockTileEntity(position); - if (tileEntity != null) { - ((TileEntityBlock) block).setNbtData(tileEntity); - } - return block; + return state.toBaseBlock(tileEntity); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java index 03eff63be..6ba2e8a54 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java @@ -20,32 +20,13 @@ package com.sk89q.worldedit.world.chunk; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.DataException; /** * A 16 by 16 block chunk. */ public interface Chunk { - - /** - * Get the block ID of a block. - * - * @param position the position of the block - * @return the type ID of the block - * @throws DataException thrown on data error - */ - public int getBlockID(Vector position) throws DataException; - - /** - * Get the block data of a block. - * - * @param position the position of the block - * @return the data value of the block - * @throws DataException thrown on data error - */ - public int getBlockData(Vector position) throws DataException; - /** * Get a block; @@ -54,6 +35,6 @@ public interface Chunk { * @return block the block * @throws DataException thrown on data error */ - public BaseBlock getBlock(Vector position) throws DataException; + BaseBlock getBlock(Vector position) throws DataException; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java index 98849cdcb..e11d0cefb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java @@ -27,9 +27,12 @@ import com.sk89q.jnbt.NBTUtils; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.storage.InvalidFormatException; import java.util.HashMap; @@ -76,43 +79,6 @@ public class OldChunk implements Chunk { } } - @Override - public int getBlockID(Vector position) throws DataException { - if(position.getBlockY() >= 128) return 0; - - int x = position.getBlockX() - rootX * 16; - int y = position.getBlockY(); - int z = position.getBlockZ() - rootZ * 16; - int index = y + (z * 128 + (x * 128 * 16)); - try { - return blocks[index]; - } catch (IndexOutOfBoundsException e) { - throw new DataException("Chunk does not contain position " + position); - } - } - - @Override - public int getBlockData(Vector position) throws DataException { - if(position.getBlockY() >= 128) return 0; - - int x = position.getBlockX() - rootX * 16; - int y = position.getBlockY(); - int z = position.getBlockZ() - rootZ * 16; - int index = y + (z * 128 + (x * 128 * 16)); - boolean shift = index % 2 == 0; - index /= 2; - - try { - if (!shift) { - return (data[index] & 0xF0) >> 4; - } else { - return data[index] & 0xF; - } - } catch (IndexOutOfBoundsException e) { - throw new DataException("Chunk does not contain position " + position); - } - } - /** * Used to load the tile entities. * @@ -123,7 +89,7 @@ public class OldChunk implements Chunk { rootTag.getValue(), "TileEntities", ListTag.class) .getValue(); - tileEntities = new HashMap>(); + tileEntities = new HashMap<>(); for (Tag tag : tags) { if (!(tag instanceof CompoundTag)) { @@ -136,21 +102,25 @@ public class OldChunk implements Chunk { int y = 0; int z = 0; - Map values = new HashMap(); + Map values = new HashMap<>(); for (Map.Entry entry : t.getValue().entrySet()) { - if (entry.getKey().equals("x")) { - if (entry.getValue() instanceof IntTag) { - x = ((IntTag) entry.getValue()).getValue(); - } - } else if (entry.getKey().equals("y")) { - if (entry.getValue() instanceof IntTag) { - y = ((IntTag) entry.getValue()).getValue(); - } - } else if (entry.getKey().equals("z")) { - if (entry.getValue() instanceof IntTag) { - z = ((IntTag) entry.getValue()).getValue(); - } + switch (entry.getKey()) { + case "x": + if (entry.getValue() instanceof IntTag) { + x = ((IntTag) entry.getValue()).getValue(); + } + break; + case "y": + if (entry.getValue() instanceof IntTag) { + y = ((IntTag) entry.getValue()).getValue(); + } + break; + case "z": + if (entry.getValue() instanceof IntTag) { + z = ((IntTag) entry.getValue()).getValue(); + } + break; } values.put(entry.getKey(), entry.getValue()); @@ -184,32 +154,36 @@ public class OldChunk implements Chunk { @Override public BaseBlock getBlock(Vector position) throws DataException { - int id = getBlockID(position); - int data = getBlockData(position); - BaseBlock block; + if(position.getBlockY() >= 128) BlockTypes.AIR.getDefaultState().toBaseBlock(); + int id, dataVal; - /*if (id == BlockID.WALL_SIGN || id == BlockID.SIGN_POST) { - block = new SignBlock(id, data); - } else if (id == BlockID.CHEST) { - block = new ChestBlock(data); - } else if (id == BlockID.FURNACE || id == BlockID.BURNING_FURNACE) { - block = new FurnaceBlock(id, data); - } else if (id == BlockID.DISPENSER) { - block = new DispenserBlock(data); - } else if (id == BlockID.MOB_SPAWNER) { - block = new MobSpawnerBlock(data); - } else if (id == BlockID.NOTE_BLOCK) { - block = new NoteBlock(data); - } else {*/ - block = new BaseBlock(id, data); - //} - - CompoundTag tileEntity = getBlockTileEntity(position); - if (tileEntity != null) { - block.setNbtData(tileEntity); + int x = position.getBlockX() - rootX * 16; + int y = position.getBlockY(); + int z = position.getBlockZ() - rootZ * 16; + int index = y + (z * 128 + (x * 128 * 16)); + try { + id = blocks[index]; + } catch (IndexOutOfBoundsException e) { + throw new DataException("Chunk does not contain position " + position); } - return block; + boolean shift = index % 2 == 0; + index /= 2; + + try { + if (!shift) { + dataVal = (data[index] & 0xF0) >> 4; + } else { + dataVal = data[index] & 0xF; + } + } catch (IndexOutOfBoundsException e) { + throw new DataException("Chunk does not contain position " + position); + } + + BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, dataVal); + CompoundTag tileEntity = getBlockTileEntity(position); + + return state.toBaseBlock(tileEntity); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleStateValue.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityType.java similarity index 50% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleStateValue.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityType.java index 791bc684a..1f7cb5925 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleStateValue.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityType.java @@ -17,39 +17,45 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.world.registry; +package com.sk89q.worldedit.world.entity; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.registry.NamespacedRegistry; -class SimpleStateValue implements StateValue { +public class EntityType { - private SimpleState state; - private Byte data; - private Vector direction; + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("entity type"); - void setState(SimpleState state) { - this.state = state; - } + private String id; - @Override - public boolean isSet(BaseBlock block) { - return data != null && (block.getData() & state.getDataMask()) == data; - } - - @Override - public boolean set(BaseBlock block) { - if (data != null) { - block.setData((block.getData() & ~state.getDataMask()) | data); - return true; - } else { - return false; + public EntityType(String id) { + // If it has no namespace, assume minecraft. + if (!id.contains(":")) { + id = "minecraft:" + id; } + this.id = id; + } + + public String getId() { + return this.id; + } + + /** + * Gets the name of this item, or the ID if the name cannot be found. + * + * @return The name, or ID + */ + public String getName() { + return getId(); } @Override - public Vector getDirection() { - return direction; + public int hashCode() { + return this.id.hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EntityType && this.id.equals(((EntityType) obj).id); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java new file mode 100644 index 000000000..9c8d44210 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java @@ -0,0 +1,137 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.entity; + +import javax.annotation.Nullable; + +public class EntityTypes { + + public static final EntityType AREA_EFFECT_CLOUD = register("minecraft:area_effect_cloud"); + public static final EntityType ARMOR_STAND = register("minecraft:armor_stand"); + public static final EntityType ARROW = register("minecraft:arrow"); + public static final EntityType BAT = register("minecraft:bat"); + public static final EntityType BLAZE = register("minecraft:blaze"); + public static final EntityType BOAT = register("minecraft:boat"); + public static final EntityType CAVE_SPIDER = register("minecraft:cave_spider"); + public static final EntityType CHEST_MINECART = register("minecraft:chest_minecart"); + public static final EntityType CHICKEN = register("minecraft:chicken"); + public static final EntityType COD = register("minecraft:cod"); + public static final EntityType COMMAND_BLOCK_MINECART = register("minecraft:command_block_minecart"); + public static final EntityType COW = register("minecraft:cow"); + public static final EntityType CREEPER = register("minecraft:creeper"); + public static final EntityType DOLPHIN = register("minecraft:dolphin"); + public static final EntityType DONKEY = register("minecraft:donkey"); + public static final EntityType DRAGON_FIREBALL = register("minecraft:dragon_fireball"); + public static final EntityType DROWNED = register("minecraft:drowned"); + public static final EntityType EGG = register("minecraft:egg"); + public static final EntityType ELDER_GUARDIAN = register("minecraft:elder_guardian"); + public static final EntityType END_CRYSTAL = register("minecraft:end_crystal"); + public static final EntityType ENDER_DRAGON = register("minecraft:ender_dragon"); + public static final EntityType ENDER_PEARL = register("minecraft:ender_pearl"); + public static final EntityType ENDERMAN = register("minecraft:enderman"); + public static final EntityType ENDERMITE = register("minecraft:endermite"); + public static final EntityType EVOKER = register("minecraft:evoker"); + public static final EntityType EVOKER_FANGS = register("minecraft:evoker_fangs"); + public static final EntityType EXPERIENCE_BOTTLE = register("minecraft:experience_bottle"); + public static final EntityType EXPERIENCE_ORB = register("minecraft:experience_orb"); + public static final EntityType EYE_OF_ENDER = register("minecraft:eye_of_ender"); + public static final EntityType FALLING_BLOCK = register("minecraft:falling_block"); + public static final EntityType FIREBALL = register("minecraft:fireball"); + public static final EntityType FIREWORK_ROCKET = register("minecraft:firework_rocket"); + public static final EntityType FISHING_BOBBER = register("minecraft:fishing_bobber"); + public static final EntityType FURNACE_MINECART = register("minecraft:furnace_minecart"); + public static final EntityType GHAST = register("minecraft:ghast"); + public static final EntityType GIANT = register("minecraft:giant"); + public static final EntityType GUARDIAN = register("minecraft:guardian"); + public static final EntityType HOPPER_MINECART = register("minecraft:hopper_minecart"); + public static final EntityType HORSE = register("minecraft:horse"); + public static final EntityType HUSK = register("minecraft:husk"); + public static final EntityType ILLUSIONER = register("minecraft:illusioner"); + public static final EntityType IRON_GOLEM = register("minecraft:iron_golem"); + public static final EntityType ITEM = register("minecraft:item"); + public static final EntityType ITEM_FRAME = register("minecraft:item_frame"); + public static final EntityType LEASH_KNOT = register("minecraft:leash_knot"); + public static final EntityType LIGHTNING_BOLT = register("minecraft:lightning_bolt"); + public static final EntityType LLAMA = register("minecraft:llama"); + public static final EntityType LLAMA_SPIT = register("minecraft:llama_spit"); + public static final EntityType MAGMA_CUBE = register("minecraft:magma_cube"); + public static final EntityType MINECART = register("minecraft:minecart"); + public static final EntityType MOOSHROOM = register("minecraft:mooshroom"); + public static final EntityType MULE = register("minecraft:mule"); + public static final EntityType OCELOT = register("minecraft:ocelot"); + public static final EntityType PAINTING = register("minecraft:painting"); + public static final EntityType PARROT = register("minecraft:parrot"); + public static final EntityType PHANTOM = register("minecraft:phantom"); + public static final EntityType PIG = register("minecraft:pig"); + public static final EntityType PLAYER = register("minecraft:player"); + public static final EntityType POLAR_BEAR = register("minecraft:polar_bear"); + public static final EntityType POTION = register("minecraft:potion"); + public static final EntityType PUFFERFISH = register("minecraft:pufferfish"); + public static final EntityType RABBIT = register("minecraft:rabbit"); + public static final EntityType SALMON = register("minecraft:salmon"); + public static final EntityType SHEEP = register("minecraft:sheep"); + public static final EntityType SHULKER = register("minecraft:shulker"); + public static final EntityType SHULKER_BULLET = register("minecraft:shulker_bullet"); + public static final EntityType SILVERFISH = register("minecraft:silverfish"); + public static final EntityType SKELETON = register("minecraft:skeleton"); + public static final EntityType SKELETON_HORSE = register("minecraft:skeleton_horse"); + public static final EntityType SLIME = register("minecraft:slime"); + public static final EntityType SMALL_FIREBALL = register("minecraft:small_fireball"); + public static final EntityType SNOW_GOLEM = register("minecraft:snow_golem"); + public static final EntityType SNOWBALL = register("minecraft:snowball"); + public static final EntityType SPAWNER_MINECART = register("minecraft:spawner_minecart"); + public static final EntityType SPECTRAL_ARROW = register("minecraft:spectral_arrow"); + public static final EntityType SPIDER = register("minecraft:spider"); + public static final EntityType SQUID = register("minecraft:squid"); + public static final EntityType STRAY = register("minecraft:stray"); + public static final EntityType TNT = register("minecraft:tnt"); + public static final EntityType TNT_MINECART = register("minecraft:tnt_minecart"); + public static final EntityType TRIDENT = register("minecraft:trident"); + public static final EntityType TROPICAL_FISH = register("minecraft:tropical_fish"); + public static final EntityType TURTLE = register("minecraft:turtle"); + public static final EntityType VEX = register("minecraft:vex"); + public static final EntityType VILLAGER = register("minecraft:villager"); + public static final EntityType VINDICATOR = register("minecraft:vindicator"); + public static final EntityType WITCH = register("minecraft:witch"); + public static final EntityType WITHER = register("minecraft:wither"); + public static final EntityType WITHER_SKELETON = register("minecraft:wither_skeleton"); + public static final EntityType WITHER_SKULL = register("minecraft:wither_skull"); + public static final EntityType WOLF = register("minecraft:wolf"); + public static final EntityType ZOMBIE = register("minecraft:zombie"); + public static final EntityType ZOMBIE_HORSE = register("minecraft:zombie_horse"); + public static final EntityType ZOMBIE_PIGMAN = register("minecraft:zombie_pigman"); + public static final EntityType ZOMBIE_VILLAGER = register("minecraft:zombie_villager"); + + private EntityTypes() { + } + + private static EntityType register(final String id) { + return register(new EntityType(id)); + } + + public static EntityType register(final EntityType entityType) { + return EntityType.REGISTRY.register(entityType.getId(), entityType); + } + + public static @Nullable EntityType get(final String id) { + return EntityType.REGISTRY.get(id); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalEntity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidCategories.java similarity index 55% rename from worldedit-core/src/main/java/com/sk89q/worldedit/LocalEntity.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidCategories.java index dcddfde2a..c86c9f487 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalEntity.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidCategories.java @@ -17,33 +17,30 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit; +package com.sk89q.worldedit.world.fluid; -import com.sk89q.worldedit.entity.BaseEntity; -import com.sk89q.worldedit.entity.Entity; +import javax.annotation.Nullable; /** - * Holds an entity. - * - * @deprecated replaced with the new entity API using {@link Entity} and {@link BaseEntity} + * Stores a list of categories of Block Types. */ -@Deprecated -public abstract class LocalEntity { +public final class FluidCategories { - private final Location position; + public static final FluidCategory LAVA = register("minecraft:lava"); + public static final FluidCategory WATER = register("minecraft:water"); - protected LocalEntity(Location position) { - this.position = position; + private FluidCategories() { } - public Location getPosition() { - return position; + private static FluidCategory register(final String id) { + return register(new FluidCategory(id)); } - public boolean spawn() { - return spawn(getPosition()); + public static FluidCategory register(final FluidCategory tag) { + return FluidCategory.REGISTRY.register(tag.getId(), tag); } - public abstract boolean spawn(Location loc); - + public static @Nullable FluidCategory get(final String id) { + return FluidCategory.REGISTRY.get(id); + } } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidCategory.java similarity index 50% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedMask.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidCategory.java index d86ac89b3..52685cb56 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidCategory.java @@ -17,36 +17,31 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.masks; +package com.sk89q.worldedit.world.fluid; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.LocalPlayer; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.function.mask.Masks; +import com.sk89q.worldedit.registry.Category; +import com.sk89q.worldedit.registry.NamespacedRegistry; + +import java.util.Collections; +import java.util.Set; /** - * @deprecated See {@link Masks#negate(com.sk89q.worldedit.function.mask.Mask)} + * A category of fluids. This is due to the splitting up of + * blocks such as wool into separate ids. */ -@Deprecated -public class InvertedMask extends AbstractMask { - private final Mask mask; +public class FluidCategory extends Category { - public InvertedMask(Mask mask) { - this.mask = mask; + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("fluid tag"); + + public FluidCategory(final String id) { + super(id); } @Override - public void prepare(LocalSession session, LocalPlayer player, Vector target) { - mask.prepare(session, player, target); - } - - @Override - public boolean matches(EditSession editSession, Vector position) { - return !mask.matches(editSession, position); - } - - public Mask getInvertedMask() { - return mask; + protected Set load() { + return Collections.emptySet(); // TODO Make this work. + // return WorldEdit.getInstance().getPlatformManager() +// .queryCapability(Capability.GAME_HOOKS).getRegistries() +// .getBlockCategoryRegistry().getCategorisedByName(this.id); } } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/SingleBlockPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidType.java similarity index 56% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/SingleBlockPattern.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidType.java index 325b85112..3207619ca 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/SingleBlockPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidType.java @@ -17,46 +17,40 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.patterns; +package com.sk89q.worldedit.world.fluid; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.function.pattern.BlockPattern; +import com.sk89q.worldedit.registry.NamespacedRegistry; /** - * @deprecated See {@link BlockPattern} + * Minecraft now has a 'fluid' system. This is a + * stub class to represent what it may be in the future. */ -@Deprecated -public class SingleBlockPattern implements Pattern { +public class FluidType { - private BaseBlock block; + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("fluid type"); - /** - * Construct the object. - * - * @param block the block - */ - public SingleBlockPattern(BaseBlock block) { - this.block = block; + private String id; + + public FluidType(String id) { + this.id = id; } /** - * Get the block. + * Gets the ID of this block. * - * @return the block + * @return The id */ - public BaseBlock getBlock() { - return block; + public String getId() { + return this.id; } @Override - public BaseBlock next(Vector position) { - return block; + public int hashCode() { + return this.id.hashCode(); } @Override - public BaseBlock next(int x, int y, int z) { - return block; + public boolean equals(Object obj) { + return obj instanceof FluidType && this.id.equals(((FluidType) obj).id); } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidTypes.java new file mode 100644 index 000000000..0e18a4355 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidTypes.java @@ -0,0 +1,49 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.fluid; + +import javax.annotation.Nullable; + +/** + * Stores a list of common Fluid String IDs. + */ +public final class FluidTypes { + + public static final FluidType EMPTY = register("minecraft:empty"); + public static final FluidType FLOWING_LAVA = register("minecraft:flowing_lava"); + public static final FluidType FLOWING_WATER = register("minecraft:flowing_water"); + public static final FluidType LAVA = register("minecraft:lava"); + public static final FluidType WATER = register("minecraft:water"); + + private FluidTypes() { + } + + private static FluidType register(final String id) { + return register(new FluidType(id)); + } + + public static FluidType register(final FluidType fluid) { + return FluidType.REGISTRY.register(fluid.getId(), fluid); + } + + public static @Nullable FluidType get(final String id) { + return FluidType.REGISTRY.get(id); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/gamemode/GameMode.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/gamemode/GameMode.java new file mode 100644 index 000000000..bb0d0d6cf --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/gamemode/GameMode.java @@ -0,0 +1,57 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.gamemode; + +import com.sk89q.worldedit.registry.Registry; + +public class GameMode { + + public static final Registry REGISTRY = new Registry<>("game mode"); + + private String id; + + public GameMode(String id) { + this.id = id; + } + + public String getId() { + return this.id; + } + + /** + * Gets the name of this game mode, or the ID if the name cannot be found. + * + * @return The name, or ID + */ + public String getName() { + return getId(); + } + + @Override + public int hashCode() { + return this.id.hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof GameMode && this.id.equals(((GameMode) obj).id); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/StateValue.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/gamemode/GameModes.java similarity index 52% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/StateValue.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/gamemode/GameModes.java index 4e565cb19..ab5b9fc69 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/StateValue.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/gamemode/GameModes.java @@ -17,40 +17,31 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.world.registry; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +package com.sk89q.worldedit.world.gamemode; import javax.annotation.Nullable; -/** - * Describes a possible value for a {@code State}. - */ -public interface StateValue { +public class GameModes { - /** - * Return whether this state is set on the given block. - * - * @param block the block - * @return true if this value is set - */ - boolean isSet(BaseBlock block); + public static final GameMode NOT_SET = register(""); + public static final GameMode SURVIVAL = register("survival"); + public static final GameMode CREATIVE = register("creative"); + public static final GameMode ADVENTURE = register("adventure"); + public static final GameMode SPECTATOR = register("spectator"); - /** - * Set the state to this value on the given block. - * - * @param block the block to change - * @return true if the value was set successfully - */ - boolean set(BaseBlock block); + private GameModes() { + } - /** - * Return the direction associated with this value. - * - * @return the direction, otherwise null - */ - @Nullable - Vector getDirection(); + private static GameMode register(final String id) { + return register(new GameMode(id)); + } + + public static GameMode register(final GameMode gameMode) { + return GameMode.REGISTRY.register(gameMode.getId(), gameMode); + } + + public static @Nullable GameMode get(final String id) { + return GameMode.REGISTRY.get(id); + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java new file mode 100644 index 000000000..68f232d7b --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java @@ -0,0 +1,74 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.item; + +import javax.annotation.Nullable; + +/** + * Stores a list of categories of Item Types. + */ +public final class ItemCategories { + + public static final ItemCategory ACACIA_LOGS = register("minecraft:acacia_logs"); + public static final ItemCategory ANVIL = register("minecraft:anvil"); + public static final ItemCategory BANNERS = register("minecraft:banners"); + public static final ItemCategory BIRCH_LOGS = register("minecraft:birch_logs"); + public static final ItemCategory BOATS = register("minecraft:boats"); + public static final ItemCategory BUTTONS = register("minecraft:buttons"); + public static final ItemCategory CARPETS = register("minecraft:carpets"); + public static final ItemCategory CORAL = register("minecraft:coral"); + public static final ItemCategory CORAL_PLANTS = register("minecraft:coral_plants"); + public static final ItemCategory DARK_OAK_LOGS = register("minecraft:dark_oak_logs"); + public static final ItemCategory DOORS = register("minecraft:doors"); + public static final ItemCategory FISHES = register("minecraft:fishes"); + public static final ItemCategory JUNGLE_LOGS = register("minecraft:jungle_logs"); + public static final ItemCategory LEAVES = register("minecraft:leaves"); + public static final ItemCategory LOGS = register("minecraft:logs"); + public static final ItemCategory OAK_LOGS = register("minecraft:oak_logs"); + public static final ItemCategory PLANKS = register("minecraft:planks"); + public static final ItemCategory RAILS = register("minecraft:rails"); + public static final ItemCategory SAND = register("minecraft:sand"); + public static final ItemCategory SAPLINGS = register("minecraft:saplings"); + public static final ItemCategory SLABS = register("minecraft:slabs"); + public static final ItemCategory SPRUCE_LOGS = register("minecraft:spruce_logs"); + public static final ItemCategory STAIRS = register("minecraft:stairs"); + public static final ItemCategory STONE_BRICKS = register("minecraft:stone_bricks"); + public static final ItemCategory WOODEN_BUTTONS = register("minecraft:wooden_buttons"); + public static final ItemCategory WOODEN_DOORS = register("minecraft:wooden_doors"); + public static final ItemCategory WOODEN_PRESSURE_PLATES = register("minecraft:wooden_pressure_plates"); + public static final ItemCategory WOODEN_SLABS = register("minecraft:wooden_slabs"); + public static final ItemCategory WOODEN_STAIRS = register("minecraft:wooden_stairs"); + public static final ItemCategory WOOL = register("minecraft:wool"); + + private ItemCategories() { + } + + private static ItemCategory register(final String id) { + return register(new ItemCategory(id)); + } + + public static ItemCategory register(final ItemCategory tag) { + return ItemCategory.REGISTRY.register(tag.getId(), tag); + } + + public static @Nullable ItemCategory get(final String id) { + return ItemCategory.REGISTRY.get(id); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategory.java new file mode 100644 index 000000000..c5efdb4b9 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategory.java @@ -0,0 +1,59 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.item; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.blocks.BaseItem; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.registry.Category; +import com.sk89q.worldedit.registry.NamespacedRegistry; + +import java.util.Set; + +/** + * A category of items. This is due to the splitting up of + * items such as wool into separate ids. + */ +public class ItemCategory extends Category { + + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("item tag"); + + public ItemCategory(final String id) { + super(id); + } + + @Override + protected Set load() { + return WorldEdit.getInstance().getPlatformManager() + .queryCapability(Capability.GAME_HOOKS).getRegistries() + .getItemCategoryRegistry().getAll(this); + } + + /** + * Checks whether the BaseItem is contained within + * this category. + * + * @param baseItem The item + * @return If it's a part of this category + */ + public boolean contains(BaseItem baseItem) { + return this.getAll().contains(baseItem.getType()); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java new file mode 100644 index 000000000..6452451d0 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java @@ -0,0 +1,90 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.item; + +import com.sk89q.worldedit.registry.NamespacedRegistry; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.registry.BundledItemData; + +import javax.annotation.Nullable; + +public class ItemType { + + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("item type"); + + private String id; + + public ItemType(String id) { + // If it has no namespace, assume minecraft. + if (!id.contains(":")) { + id = "minecraft:" + id; + } + this.id = id; + } + + public String getId() { + return this.id; + } + + /** + * Gets the name of this item, or the ID if the name cannot be found. + * + * @return The name, or ID + */ + public String getName() { + BundledItemData.ItemEntry entry = BundledItemData.getInstance().findById(this.id); + if (entry == null) { + return getId(); + } else { + return entry.localizedName; + } + } + + + /** + * Gets whether this item type has a block representation. + * + * @return If it has a block + */ + public boolean hasBlockType() { + return getBlockType() != null; + } + + /** + * Gets the block representation of this item type, if it exists. + * + * @return The block representation + */ + @Nullable + public BlockType getBlockType() { + return BlockTypes.get(this.id); + } + + @Override + public int hashCode() { + return this.id.hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof ItemType && this.id.equals(((ItemType) obj).id); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java new file mode 100644 index 000000000..918fde039 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java @@ -0,0 +1,826 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.item; + +import javax.annotation.Nullable; + +public final class ItemTypes { + + public static final ItemType ACACIA_BOAT = register("minecraft:acacia_boat"); + public static final ItemType ACACIA_BUTTON = register("minecraft:acacia_button"); + public static final ItemType ACACIA_DOOR = register("minecraft:acacia_door"); + public static final ItemType ACACIA_FENCE = register("minecraft:acacia_fence"); + public static final ItemType ACACIA_FENCE_GATE = register("minecraft:acacia_fence_gate"); + public static final ItemType ACACIA_LEAVES = register("minecraft:acacia_leaves"); + public static final ItemType ACACIA_LOG = register("minecraft:acacia_log"); + public static final ItemType ACACIA_PLANKS = register("minecraft:acacia_planks"); + public static final ItemType ACACIA_PRESSURE_PLATE = register("minecraft:acacia_pressure_plate"); + public static final ItemType ACACIA_SAPLING = register("minecraft:acacia_sapling"); + public static final ItemType ACACIA_SLAB = register("minecraft:acacia_slab"); + public static final ItemType ACACIA_STAIRS = register("minecraft:acacia_stairs"); + public static final ItemType ACACIA_TRAPDOOR = register("minecraft:acacia_trapdoor"); + public static final ItemType ACACIA_WOOD = register("minecraft:acacia_wood"); + public static final ItemType ACTIVATOR_RAIL = register("minecraft:activator_rail"); + public static final ItemType AIR = register("minecraft:air"); + public static final ItemType ALLIUM = register("minecraft:allium"); + public static final ItemType ANDESITE = register("minecraft:andesite"); + public static final ItemType ANVIL = register("minecraft:anvil"); + public static final ItemType APPLE = register("minecraft:apple"); + public static final ItemType ARMOR_STAND = register("minecraft:armor_stand"); + public static final ItemType ARROW = register("minecraft:arrow"); + public static final ItemType AZURE_BLUET = register("minecraft:azure_bluet"); + public static final ItemType BAKED_POTATO = register("minecraft:baked_potato"); + public static final ItemType BARRIER = register("minecraft:barrier"); + public static final ItemType BAT_SPAWN_EGG = register("minecraft:bat_spawn_egg"); + public static final ItemType BEACON = register("minecraft:beacon"); + public static final ItemType BEDROCK = register("minecraft:bedrock"); + public static final ItemType BEEF = register("minecraft:beef"); + public static final ItemType BEETROOT = register("minecraft:beetroot"); + public static final ItemType BEETROOT_SEEDS = register("minecraft:beetroot_seeds"); + public static final ItemType BEETROOT_SOUP = register("minecraft:beetroot_soup"); + public static final ItemType BIRCH_BOAT = register("minecraft:birch_boat"); + public static final ItemType BIRCH_BUTTON = register("minecraft:birch_button"); + public static final ItemType BIRCH_DOOR = register("minecraft:birch_door"); + public static final ItemType BIRCH_FENCE = register("minecraft:birch_fence"); + public static final ItemType BIRCH_FENCE_GATE = register("minecraft:birch_fence_gate"); + public static final ItemType BIRCH_LEAVES = register("minecraft:birch_leaves"); + public static final ItemType BIRCH_LOG = register("minecraft:birch_log"); + public static final ItemType BIRCH_PLANKS = register("minecraft:birch_planks"); + public static final ItemType BIRCH_PRESSURE_PLATE = register("minecraft:birch_pressure_plate"); + public static final ItemType BIRCH_SAPLING = register("minecraft:birch_sapling"); + public static final ItemType BIRCH_SLAB = register("minecraft:birch_slab"); + public static final ItemType BIRCH_STAIRS = register("minecraft:birch_stairs"); + public static final ItemType BIRCH_TRAPDOOR = register("minecraft:birch_trapdoor"); + public static final ItemType BIRCH_WOOD = register("minecraft:birch_wood"); + public static final ItemType BLACK_BANNER = register("minecraft:black_banner"); + public static final ItemType BLACK_BED = register("minecraft:black_bed"); + public static final ItemType BLACK_CARPET = register("minecraft:black_carpet"); + public static final ItemType BLACK_CONCRETE = register("minecraft:black_concrete"); + public static final ItemType BLACK_CONCRETE_POWDER = register("minecraft:black_concrete_powder"); + public static final ItemType BLACK_GLAZED_TERRACOTTA = register("minecraft:black_glazed_terracotta"); + public static final ItemType BLACK_SHULKER_BOX = register("minecraft:black_shulker_box"); + public static final ItemType BLACK_STAINED_GLASS = register("minecraft:black_stained_glass"); + public static final ItemType BLACK_STAINED_GLASS_PANE = register("minecraft:black_stained_glass_pane"); + public static final ItemType BLACK_TERRACOTTA = register("minecraft:black_terracotta"); + public static final ItemType BLACK_WOOL = register("minecraft:black_wool"); + public static final ItemType BLAZE_POWDER = register("minecraft:blaze_powder"); + public static final ItemType BLAZE_ROD = register("minecraft:blaze_rod"); + public static final ItemType BLAZE_SPAWN_EGG = register("minecraft:blaze_spawn_egg"); + public static final ItemType BLUE_BANNER = register("minecraft:blue_banner"); + public static final ItemType BLUE_BED = register("minecraft:blue_bed"); + public static final ItemType BLUE_CARPET = register("minecraft:blue_carpet"); + public static final ItemType BLUE_CONCRETE = register("minecraft:blue_concrete"); + public static final ItemType BLUE_CONCRETE_POWDER = register("minecraft:blue_concrete_powder"); + public static final ItemType BLUE_GLAZED_TERRACOTTA = register("minecraft:blue_glazed_terracotta"); + public static final ItemType BLUE_ICE = register("minecraft:blue_ice"); + public static final ItemType BLUE_ORCHID = register("minecraft:blue_orchid"); + public static final ItemType BLUE_SHULKER_BOX = register("minecraft:blue_shulker_box"); + public static final ItemType BLUE_STAINED_GLASS = register("minecraft:blue_stained_glass"); + public static final ItemType BLUE_STAINED_GLASS_PANE = register("minecraft:blue_stained_glass_pane"); + public static final ItemType BLUE_TERRACOTTA = register("minecraft:blue_terracotta"); + public static final ItemType BLUE_WOOL = register("minecraft:blue_wool"); + public static final ItemType BONE = register("minecraft:bone"); + public static final ItemType BONE_BLOCK = register("minecraft:bone_block"); + public static final ItemType BONE_MEAL = register("minecraft:bone_meal"); + public static final ItemType BOOK = register("minecraft:book"); + public static final ItemType BOOKSHELF = register("minecraft:bookshelf"); + public static final ItemType BOW = register("minecraft:bow"); + public static final ItemType BOWL = register("minecraft:bowl"); + public static final ItemType BRAIN_CORAL = register("minecraft:brain_coral"); + public static final ItemType BRAIN_CORAL_BLOCK = register("minecraft:brain_coral_block"); + public static final ItemType BRAIN_CORAL_FAN = register("minecraft:brain_coral_fan"); + public static final ItemType BREAD = register("minecraft:bread"); + public static final ItemType BREWING_STAND = register("minecraft:brewing_stand"); + public static final ItemType BRICK = register("minecraft:brick"); + public static final ItemType BRICK_SLAB = register("minecraft:brick_slab"); + public static final ItemType BRICK_STAIRS = register("minecraft:brick_stairs"); + public static final ItemType BRICKS = register("minecraft:bricks"); + public static final ItemType BROWN_BANNER = register("minecraft:brown_banner"); + public static final ItemType BROWN_BED = register("minecraft:brown_bed"); + public static final ItemType BROWN_CARPET = register("minecraft:brown_carpet"); + public static final ItemType BROWN_CONCRETE = register("minecraft:brown_concrete"); + public static final ItemType BROWN_CONCRETE_POWDER = register("minecraft:brown_concrete_powder"); + public static final ItemType BROWN_GLAZED_TERRACOTTA = register("minecraft:brown_glazed_terracotta"); + public static final ItemType BROWN_MUSHROOM = register("minecraft:brown_mushroom"); + public static final ItemType BROWN_MUSHROOM_BLOCK = register("minecraft:brown_mushroom_block"); + public static final ItemType BROWN_SHULKER_BOX = register("minecraft:brown_shulker_box"); + public static final ItemType BROWN_STAINED_GLASS = register("minecraft:brown_stained_glass"); + public static final ItemType BROWN_STAINED_GLASS_PANE = register("minecraft:brown_stained_glass_pane"); + public static final ItemType BROWN_TERRACOTTA = register("minecraft:brown_terracotta"); + public static final ItemType BROWN_WOOL = register("minecraft:brown_wool"); + public static final ItemType BUBBLE_CORAL = register("minecraft:bubble_coral"); + public static final ItemType BUBBLE_CORAL_BLOCK = register("minecraft:bubble_coral_block"); + public static final ItemType BUBBLE_CORAL_FAN = register("minecraft:bubble_coral_fan"); + public static final ItemType BUCKET = register("minecraft:bucket"); + public static final ItemType CACTUS = register("minecraft:cactus"); + public static final ItemType CACTUS_GREEN = register("minecraft:cactus_green"); + public static final ItemType CAKE = register("minecraft:cake"); + public static final ItemType CARROT = register("minecraft:carrot"); + public static final ItemType CARROT_ON_A_STICK = register("minecraft:carrot_on_a_stick"); + public static final ItemType CARVED_PUMPKIN = register("minecraft:carved_pumpkin"); + public static final ItemType CAULDRON = register("minecraft:cauldron"); + public static final ItemType CAVE_SPIDER_SPAWN_EGG = register("minecraft:cave_spider_spawn_egg"); + public static final ItemType CHAIN_COMMAND_BLOCK = register("minecraft:chain_command_block"); + public static final ItemType CHAINMAIL_BOOTS = register("minecraft:chainmail_boots"); + public static final ItemType CHAINMAIL_CHESTPLATE = register("minecraft:chainmail_chestplate"); + public static final ItemType CHAINMAIL_HELMET = register("minecraft:chainmail_helmet"); + public static final ItemType CHAINMAIL_LEGGINGS = register("minecraft:chainmail_leggings"); + public static final ItemType CHARCOAL = register("minecraft:charcoal"); + public static final ItemType CHEST = register("minecraft:chest"); + public static final ItemType CHEST_MINECART = register("minecraft:chest_minecart"); + public static final ItemType CHICKEN = register("minecraft:chicken"); + public static final ItemType CHICKEN_SPAWN_EGG = register("minecraft:chicken_spawn_egg"); + public static final ItemType CHIPPED_ANVIL = register("minecraft:chipped_anvil"); + public static final ItemType CHISELED_QUARTZ_BLOCK = register("minecraft:chiseled_quartz_block"); + public static final ItemType CHISELED_RED_SANDSTONE = register("minecraft:chiseled_red_sandstone"); + public static final ItemType CHISELED_SANDSTONE = register("minecraft:chiseled_sandstone"); + public static final ItemType CHISELED_STONE_BRICKS = register("minecraft:chiseled_stone_bricks"); + public static final ItemType CHORUS_FLOWER = register("minecraft:chorus_flower"); + public static final ItemType CHORUS_FRUIT = register("minecraft:chorus_fruit"); + public static final ItemType CHORUS_PLANT = register("minecraft:chorus_plant"); + public static final ItemType CLAY = register("minecraft:clay"); + public static final ItemType CLAY_BALL = register("minecraft:clay_ball"); + public static final ItemType CLOCK = register("minecraft:clock"); + public static final ItemType COAL = register("minecraft:coal"); + public static final ItemType COAL_BLOCK = register("minecraft:coal_block"); + public static final ItemType COAL_ORE = register("minecraft:coal_ore"); + public static final ItemType COARSE_DIRT = register("minecraft:coarse_dirt"); + public static final ItemType COBBLESTONE = register("minecraft:cobblestone"); + public static final ItemType COBBLESTONE_SLAB = register("minecraft:cobblestone_slab"); + public static final ItemType COBBLESTONE_STAIRS = register("minecraft:cobblestone_stairs"); + public static final ItemType COBBLESTONE_WALL = register("minecraft:cobblestone_wall"); + public static final ItemType COBWEB = register("minecraft:cobweb"); + public static final ItemType COCOA_BEANS = register("minecraft:cocoa_beans"); + public static final ItemType COD = register("minecraft:cod"); + public static final ItemType COD_BUCKET = register("minecraft:cod_bucket"); + public static final ItemType COD_SPAWN_EGG = register("minecraft:cod_spawn_egg"); + public static final ItemType COMMAND_BLOCK = register("minecraft:command_block"); + public static final ItemType COMMAND_BLOCK_MINECART = register("minecraft:command_block_minecart"); + public static final ItemType COMPARATOR = register("minecraft:comparator"); + public static final ItemType COMPASS = register("minecraft:compass"); + public static final ItemType CONDUIT = register("minecraft:conduit"); + public static final ItemType COOKED_BEEF = register("minecraft:cooked_beef"); + public static final ItemType COOKED_CHICKEN = register("minecraft:cooked_chicken"); + public static final ItemType COOKED_COD = register("minecraft:cooked_cod"); + public static final ItemType COOKED_MUTTON = register("minecraft:cooked_mutton"); + public static final ItemType COOKED_PORKCHOP = register("minecraft:cooked_porkchop"); + public static final ItemType COOKED_RABBIT = register("minecraft:cooked_rabbit"); + public static final ItemType COOKED_SALMON = register("minecraft:cooked_salmon"); + public static final ItemType COOKIE = register("minecraft:cookie"); + public static final ItemType COW_SPAWN_EGG = register("minecraft:cow_spawn_egg"); + public static final ItemType CRACKED_STONE_BRICKS = register("minecraft:cracked_stone_bricks"); + public static final ItemType CRAFTING_TABLE = register("minecraft:crafting_table"); + public static final ItemType CREEPER_HEAD = register("minecraft:creeper_head"); + public static final ItemType CREEPER_SPAWN_EGG = register("minecraft:creeper_spawn_egg"); + public static final ItemType CUT_RED_SANDSTONE = register("minecraft:cut_red_sandstone"); + public static final ItemType CUT_SANDSTONE = register("minecraft:cut_sandstone"); + public static final ItemType CYAN_BANNER = register("minecraft:cyan_banner"); + public static final ItemType CYAN_BED = register("minecraft:cyan_bed"); + public static final ItemType CYAN_CARPET = register("minecraft:cyan_carpet"); + public static final ItemType CYAN_CONCRETE = register("minecraft:cyan_concrete"); + public static final ItemType CYAN_CONCRETE_POWDER = register("minecraft:cyan_concrete_powder"); + public static final ItemType CYAN_DYE = register("minecraft:cyan_dye"); + public static final ItemType CYAN_GLAZED_TERRACOTTA = register("minecraft:cyan_glazed_terracotta"); + public static final ItemType CYAN_SHULKER_BOX = register("minecraft:cyan_shulker_box"); + public static final ItemType CYAN_STAINED_GLASS = register("minecraft:cyan_stained_glass"); + public static final ItemType CYAN_STAINED_GLASS_PANE = register("minecraft:cyan_stained_glass_pane"); + public static final ItemType CYAN_TERRACOTTA = register("minecraft:cyan_terracotta"); + public static final ItemType CYAN_WOOL = register("minecraft:cyan_wool"); + public static final ItemType DAMAGED_ANVIL = register("minecraft:damaged_anvil"); + public static final ItemType DANDELION = register("minecraft:dandelion"); + public static final ItemType DANDELION_YELLOW = register("minecraft:dandelion_yellow"); + public static final ItemType DARK_OAK_BOAT = register("minecraft:dark_oak_boat"); + public static final ItemType DARK_OAK_BUTTON = register("minecraft:dark_oak_button"); + public static final ItemType DARK_OAK_DOOR = register("minecraft:dark_oak_door"); + public static final ItemType DARK_OAK_FENCE = register("minecraft:dark_oak_fence"); + public static final ItemType DARK_OAK_FENCE_GATE = register("minecraft:dark_oak_fence_gate"); + public static final ItemType DARK_OAK_LEAVES = register("minecraft:dark_oak_leaves"); + public static final ItemType DARK_OAK_LOG = register("minecraft:dark_oak_log"); + public static final ItemType DARK_OAK_PLANKS = register("minecraft:dark_oak_planks"); + public static final ItemType DARK_OAK_PRESSURE_PLATE = register("minecraft:dark_oak_pressure_plate"); + public static final ItemType DARK_OAK_SAPLING = register("minecraft:dark_oak_sapling"); + public static final ItemType DARK_OAK_SLAB = register("minecraft:dark_oak_slab"); + public static final ItemType DARK_OAK_STAIRS = register("minecraft:dark_oak_stairs"); + public static final ItemType DARK_OAK_TRAPDOOR = register("minecraft:dark_oak_trapdoor"); + public static final ItemType DARK_OAK_WOOD = register("minecraft:dark_oak_wood"); + public static final ItemType DARK_PRISMARINE = register("minecraft:dark_prismarine"); + public static final ItemType DARK_PRISMARINE_SLAB = register("minecraft:dark_prismarine_slab"); + public static final ItemType DARK_PRISMARINE_STAIRS = register("minecraft:dark_prismarine_stairs"); + public static final ItemType DAYLIGHT_DETECTOR = register("minecraft:daylight_detector"); + public static final ItemType DEAD_BRAIN_CORAL_BLOCK = register("minecraft:dead_brain_coral_block"); + public static final ItemType DEAD_BRAIN_CORAL_FAN = register("minecraft:dead_brain_coral_fan"); + public static final ItemType DEAD_BUBBLE_CORAL_BLOCK = register("minecraft:dead_bubble_coral_block"); + public static final ItemType DEAD_BUBBLE_CORAL_FAN = register("minecraft:dead_bubble_coral_fan"); + public static final ItemType DEAD_BUSH = register("minecraft:dead_bush"); + public static final ItemType DEAD_FIRE_CORAL_BLOCK = register("minecraft:dead_fire_coral_block"); + public static final ItemType DEAD_FIRE_CORAL_FAN = register("minecraft:dead_fire_coral_fan"); + public static final ItemType DEAD_HORN_CORAL_BLOCK = register("minecraft:dead_horn_coral_block"); + public static final ItemType DEAD_HORN_CORAL_FAN = register("minecraft:dead_horn_coral_fan"); + public static final ItemType DEAD_TUBE_CORAL_BLOCK = register("minecraft:dead_tube_coral_block"); + public static final ItemType DEAD_TUBE_CORAL_FAN = register("minecraft:dead_tube_coral_fan"); + public static final ItemType DEBUG_STICK = register("minecraft:debug_stick"); + public static final ItemType DETECTOR_RAIL = register("minecraft:detector_rail"); + public static final ItemType DIAMOND = register("minecraft:diamond"); + public static final ItemType DIAMOND_AXE = register("minecraft:diamond_axe"); + public static final ItemType DIAMOND_BLOCK = register("minecraft:diamond_block"); + public static final ItemType DIAMOND_BOOTS = register("minecraft:diamond_boots"); + public static final ItemType DIAMOND_CHESTPLATE = register("minecraft:diamond_chestplate"); + public static final ItemType DIAMOND_HELMET = register("minecraft:diamond_helmet"); + public static final ItemType DIAMOND_HOE = register("minecraft:diamond_hoe"); + public static final ItemType DIAMOND_HORSE_ARMOR = register("minecraft:diamond_horse_armor"); + public static final ItemType DIAMOND_LEGGINGS = register("minecraft:diamond_leggings"); + public static final ItemType DIAMOND_ORE = register("minecraft:diamond_ore"); + public static final ItemType DIAMOND_PICKAXE = register("minecraft:diamond_pickaxe"); + public static final ItemType DIAMOND_SHOVEL = register("minecraft:diamond_shovel"); + public static final ItemType DIAMOND_SWORD = register("minecraft:diamond_sword"); + public static final ItemType DIORITE = register("minecraft:diorite"); + public static final ItemType DIRT = register("minecraft:dirt"); + public static final ItemType DISPENSER = register("minecraft:dispenser"); + public static final ItemType DOLPHIN_SPAWN_EGG = register("minecraft:dolphin_spawn_egg"); + public static final ItemType DONKEY_SPAWN_EGG = register("minecraft:donkey_spawn_egg"); + public static final ItemType DRAGON_BREATH = register("minecraft:dragon_breath"); + public static final ItemType DRAGON_EGG = register("minecraft:dragon_egg"); + public static final ItemType DRAGON_HEAD = register("minecraft:dragon_head"); + public static final ItemType DRIED_KELP = register("minecraft:dried_kelp"); + public static final ItemType DRIED_KELP_BLOCK = register("minecraft:dried_kelp_block"); + public static final ItemType DROPPER = register("minecraft:dropper"); + public static final ItemType DROWNED_SPAWN_EGG = register("minecraft:drowned_spawn_egg"); + public static final ItemType EGG = register("minecraft:egg"); + public static final ItemType ELDER_GUARDIAN_SPAWN_EGG = register("minecraft:elder_guardian_spawn_egg"); + public static final ItemType ELYTRA = register("minecraft:elytra"); + public static final ItemType EMERALD = register("minecraft:emerald"); + public static final ItemType EMERALD_BLOCK = register("minecraft:emerald_block"); + public static final ItemType EMERALD_ORE = register("minecraft:emerald_ore"); + public static final ItemType ENCHANTED_BOOK = register("minecraft:enchanted_book"); + public static final ItemType ENCHANTED_GOLDEN_APPLE = register("minecraft:enchanted_golden_apple"); + public static final ItemType ENCHANTING_TABLE = register("minecraft:enchanting_table"); + public static final ItemType END_CRYSTAL = register("minecraft:end_crystal"); + public static final ItemType END_PORTAL_FRAME = register("minecraft:end_portal_frame"); + public static final ItemType END_ROD = register("minecraft:end_rod"); + public static final ItemType END_STONE = register("minecraft:end_stone"); + public static final ItemType END_STONE_BRICKS = register("minecraft:end_stone_bricks"); + public static final ItemType ENDER_CHEST = register("minecraft:ender_chest"); + public static final ItemType ENDER_EYE = register("minecraft:ender_eye"); + public static final ItemType ENDER_PEARL = register("minecraft:ender_pearl"); + public static final ItemType ENDERMAN_SPAWN_EGG = register("minecraft:enderman_spawn_egg"); + public static final ItemType ENDERMITE_SPAWN_EGG = register("minecraft:endermite_spawn_egg"); + public static final ItemType EVOKER_SPAWN_EGG = register("minecraft:evoker_spawn_egg"); + public static final ItemType EXPERIENCE_BOTTLE = register("minecraft:experience_bottle"); + public static final ItemType FARMLAND = register("minecraft:farmland"); + public static final ItemType FEATHER = register("minecraft:feather"); + public static final ItemType FERMENTED_SPIDER_EYE = register("minecraft:fermented_spider_eye"); + public static final ItemType FERN = register("minecraft:fern"); + public static final ItemType FILLED_MAP = register("minecraft:filled_map"); + public static final ItemType FIRE_CHARGE = register("minecraft:fire_charge"); + public static final ItemType FIRE_CORAL = register("minecraft:fire_coral"); + public static final ItemType FIRE_CORAL_BLOCK = register("minecraft:fire_coral_block"); + public static final ItemType FIRE_CORAL_FAN = register("minecraft:fire_coral_fan"); + public static final ItemType FIREWORK_ROCKET = register("minecraft:firework_rocket"); + public static final ItemType FIREWORK_STAR = register("minecraft:firework_star"); + public static final ItemType FISHING_ROD = register("minecraft:fishing_rod"); + public static final ItemType FLINT = register("minecraft:flint"); + public static final ItemType FLINT_AND_STEEL = register("minecraft:flint_and_steel"); + public static final ItemType FLOWER_POT = register("minecraft:flower_pot"); + public static final ItemType FURNACE = register("minecraft:furnace"); + public static final ItemType FURNACE_MINECART = register("minecraft:furnace_minecart"); + public static final ItemType GHAST_SPAWN_EGG = register("minecraft:ghast_spawn_egg"); + public static final ItemType GHAST_TEAR = register("minecraft:ghast_tear"); + public static final ItemType GLASS = register("minecraft:glass"); + public static final ItemType GLASS_BOTTLE = register("minecraft:glass_bottle"); + public static final ItemType GLASS_PANE = register("minecraft:glass_pane"); + public static final ItemType GLISTERING_MELON_SLICE = register("minecraft:glistering_melon_slice"); + public static final ItemType GLOWSTONE = register("minecraft:glowstone"); + public static final ItemType GLOWSTONE_DUST = register("minecraft:glowstone_dust"); + public static final ItemType GOLD_BLOCK = register("minecraft:gold_block"); + public static final ItemType GOLD_INGOT = register("minecraft:gold_ingot"); + public static final ItemType GOLD_NUGGET = register("minecraft:gold_nugget"); + public static final ItemType GOLD_ORE = register("minecraft:gold_ore"); + public static final ItemType GOLDEN_APPLE = register("minecraft:golden_apple"); + public static final ItemType GOLDEN_AXE = register("minecraft:golden_axe"); + public static final ItemType GOLDEN_BOOTS = register("minecraft:golden_boots"); + public static final ItemType GOLDEN_CARROT = register("minecraft:golden_carrot"); + public static final ItemType GOLDEN_CHESTPLATE = register("minecraft:golden_chestplate"); + public static final ItemType GOLDEN_HELMET = register("minecraft:golden_helmet"); + public static final ItemType GOLDEN_HOE = register("minecraft:golden_hoe"); + public static final ItemType GOLDEN_HORSE_ARMOR = register("minecraft:golden_horse_armor"); + public static final ItemType GOLDEN_LEGGINGS = register("minecraft:golden_leggings"); + public static final ItemType GOLDEN_PICKAXE = register("minecraft:golden_pickaxe"); + public static final ItemType GOLDEN_SHOVEL = register("minecraft:golden_shovel"); + public static final ItemType GOLDEN_SWORD = register("minecraft:golden_sword"); + public static final ItemType GRANITE = register("minecraft:granite"); + public static final ItemType GRASS = register("minecraft:grass"); + public static final ItemType GRASS_BLOCK = register("minecraft:grass_block"); + public static final ItemType GRASS_PATH = register("minecraft:grass_path"); + public static final ItemType GRAVEL = register("minecraft:gravel"); + public static final ItemType GRAY_BANNER = register("minecraft:gray_banner"); + public static final ItemType GRAY_BED = register("minecraft:gray_bed"); + public static final ItemType GRAY_CARPET = register("minecraft:gray_carpet"); + public static final ItemType GRAY_CONCRETE = register("minecraft:gray_concrete"); + public static final ItemType GRAY_CONCRETE_POWDER = register("minecraft:gray_concrete_powder"); + public static final ItemType GRAY_DYE = register("minecraft:gray_dye"); + public static final ItemType GRAY_GLAZED_TERRACOTTA = register("minecraft:gray_glazed_terracotta"); + public static final ItemType GRAY_SHULKER_BOX = register("minecraft:gray_shulker_box"); + public static final ItemType GRAY_STAINED_GLASS = register("minecraft:gray_stained_glass"); + public static final ItemType GRAY_STAINED_GLASS_PANE = register("minecraft:gray_stained_glass_pane"); + public static final ItemType GRAY_TERRACOTTA = register("minecraft:gray_terracotta"); + public static final ItemType GRAY_WOOL = register("minecraft:gray_wool"); + public static final ItemType GREEN_BANNER = register("minecraft:green_banner"); + public static final ItemType GREEN_BED = register("minecraft:green_bed"); + public static final ItemType GREEN_CARPET = register("minecraft:green_carpet"); + public static final ItemType GREEN_CONCRETE = register("minecraft:green_concrete"); + public static final ItemType GREEN_CONCRETE_POWDER = register("minecraft:green_concrete_powder"); + public static final ItemType GREEN_GLAZED_TERRACOTTA = register("minecraft:green_glazed_terracotta"); + public static final ItemType GREEN_SHULKER_BOX = register("minecraft:green_shulker_box"); + public static final ItemType GREEN_STAINED_GLASS = register("minecraft:green_stained_glass"); + public static final ItemType GREEN_STAINED_GLASS_PANE = register("minecraft:green_stained_glass_pane"); + public static final ItemType GREEN_TERRACOTTA = register("minecraft:green_terracotta"); + public static final ItemType GREEN_WOOL = register("minecraft:green_wool"); + public static final ItemType GUARDIAN_SPAWN_EGG = register("minecraft:guardian_spawn_egg"); + public static final ItemType GUNPOWDER = register("minecraft:gunpowder"); + public static final ItemType HAY_BLOCK = register("minecraft:hay_block"); + public static final ItemType HEART_OF_THE_SEA = register("minecraft:heart_of_the_sea"); + public static final ItemType HEAVY_WEIGHTED_PRESSURE_PLATE = register("minecraft:heavy_weighted_pressure_plate"); + public static final ItemType HOPPER = register("minecraft:hopper"); + public static final ItemType HOPPER_MINECART = register("minecraft:hopper_minecart"); + public static final ItemType HORN_CORAL = register("minecraft:horn_coral"); + public static final ItemType HORN_CORAL_BLOCK = register("minecraft:horn_coral_block"); + public static final ItemType HORN_CORAL_FAN = register("minecraft:horn_coral_fan"); + public static final ItemType HORSE_SPAWN_EGG = register("minecraft:horse_spawn_egg"); + public static final ItemType HUSK_SPAWN_EGG = register("minecraft:husk_spawn_egg"); + public static final ItemType ICE = register("minecraft:ice"); + public static final ItemType INFESTED_CHISELED_STONE_BRICKS = register("minecraft:infested_chiseled_stone_bricks"); + public static final ItemType INFESTED_COBBLESTONE = register("minecraft:infested_cobblestone"); + public static final ItemType INFESTED_CRACKED_STONE_BRICKS = register("minecraft:infested_cracked_stone_bricks"); + public static final ItemType INFESTED_MOSSY_STONE_BRICKS = register("minecraft:infested_mossy_stone_bricks"); + public static final ItemType INFESTED_STONE = register("minecraft:infested_stone"); + public static final ItemType INFESTED_STONE_BRICKS = register("minecraft:infested_stone_bricks"); + public static final ItemType INK_SAC = register("minecraft:ink_sac"); + public static final ItemType IRON_AXE = register("minecraft:iron_axe"); + public static final ItemType IRON_BARS = register("minecraft:iron_bars"); + public static final ItemType IRON_BLOCK = register("minecraft:iron_block"); + public static final ItemType IRON_BOOTS = register("minecraft:iron_boots"); + public static final ItemType IRON_CHESTPLATE = register("minecraft:iron_chestplate"); + public static final ItemType IRON_DOOR = register("minecraft:iron_door"); + public static final ItemType IRON_HELMET = register("minecraft:iron_helmet"); + public static final ItemType IRON_HOE = register("minecraft:iron_hoe"); + public static final ItemType IRON_HORSE_ARMOR = register("minecraft:iron_horse_armor"); + public static final ItemType IRON_INGOT = register("minecraft:iron_ingot"); + public static final ItemType IRON_LEGGINGS = register("minecraft:iron_leggings"); + public static final ItemType IRON_NUGGET = register("minecraft:iron_nugget"); + public static final ItemType IRON_ORE = register("minecraft:iron_ore"); + public static final ItemType IRON_PICKAXE = register("minecraft:iron_pickaxe"); + public static final ItemType IRON_SHOVEL = register("minecraft:iron_shovel"); + public static final ItemType IRON_SWORD = register("minecraft:iron_sword"); + public static final ItemType IRON_TRAPDOOR = register("minecraft:iron_trapdoor"); + public static final ItemType ITEM_FRAME = register("minecraft:item_frame"); + public static final ItemType JACK_O_LANTERN = register("minecraft:jack_o_lantern"); + public static final ItemType JUKEBOX = register("minecraft:jukebox"); + public static final ItemType JUNGLE_BOAT = register("minecraft:jungle_boat"); + public static final ItemType JUNGLE_BUTTON = register("minecraft:jungle_button"); + public static final ItemType JUNGLE_DOOR = register("minecraft:jungle_door"); + public static final ItemType JUNGLE_FENCE = register("minecraft:jungle_fence"); + public static final ItemType JUNGLE_FENCE_GATE = register("minecraft:jungle_fence_gate"); + public static final ItemType JUNGLE_LEAVES = register("minecraft:jungle_leaves"); + public static final ItemType JUNGLE_LOG = register("minecraft:jungle_log"); + public static final ItemType JUNGLE_PLANKS = register("minecraft:jungle_planks"); + public static final ItemType JUNGLE_PRESSURE_PLATE = register("minecraft:jungle_pressure_plate"); + public static final ItemType JUNGLE_SAPLING = register("minecraft:jungle_sapling"); + public static final ItemType JUNGLE_SLAB = register("minecraft:jungle_slab"); + public static final ItemType JUNGLE_STAIRS = register("minecraft:jungle_stairs"); + public static final ItemType JUNGLE_TRAPDOOR = register("minecraft:jungle_trapdoor"); + public static final ItemType JUNGLE_WOOD = register("minecraft:jungle_wood"); + public static final ItemType KELP = register("minecraft:kelp"); + public static final ItemType KNOWLEDGE_BOOK = register("minecraft:knowledge_book"); + public static final ItemType LADDER = register("minecraft:ladder"); + public static final ItemType LAPIS_BLOCK = register("minecraft:lapis_block"); + public static final ItemType LAPIS_LAZULI = register("minecraft:lapis_lazuli"); + public static final ItemType LAPIS_ORE = register("minecraft:lapis_ore"); + public static final ItemType LARGE_FERN = register("minecraft:large_fern"); + public static final ItemType LAVA_BUCKET = register("minecraft:lava_bucket"); + public static final ItemType LEAD = register("minecraft:lead"); + public static final ItemType LEATHER = register("minecraft:leather"); + public static final ItemType LEATHER_BOOTS = register("minecraft:leather_boots"); + public static final ItemType LEATHER_CHESTPLATE = register("minecraft:leather_chestplate"); + public static final ItemType LEATHER_HELMET = register("minecraft:leather_helmet"); + public static final ItemType LEATHER_LEGGINGS = register("minecraft:leather_leggings"); + public static final ItemType LEVER = register("minecraft:lever"); + public static final ItemType LIGHT_BLUE_BANNER = register("minecraft:light_blue_banner"); + public static final ItemType LIGHT_BLUE_BED = register("minecraft:light_blue_bed"); + public static final ItemType LIGHT_BLUE_CARPET = register("minecraft:light_blue_carpet"); + public static final ItemType LIGHT_BLUE_CONCRETE = register("minecraft:light_blue_concrete"); + public static final ItemType LIGHT_BLUE_CONCRETE_POWDER = register("minecraft:light_blue_concrete_powder"); + public static final ItemType LIGHT_BLUE_DYE = register("minecraft:light_blue_dye"); + public static final ItemType LIGHT_BLUE_GLAZED_TERRACOTTA = register("minecraft:light_blue_glazed_terracotta"); + public static final ItemType LIGHT_BLUE_SHULKER_BOX = register("minecraft:light_blue_shulker_box"); + public static final ItemType LIGHT_BLUE_STAINED_GLASS = register("minecraft:light_blue_stained_glass"); + public static final ItemType LIGHT_BLUE_STAINED_GLASS_PANE = register("minecraft:light_blue_stained_glass_pane"); + public static final ItemType LIGHT_BLUE_TERRACOTTA = register("minecraft:light_blue_terracotta"); + public static final ItemType LIGHT_BLUE_WOOL = register("minecraft:light_blue_wool"); + public static final ItemType LIGHT_GRAY_BANNER = register("minecraft:light_gray_banner"); + public static final ItemType LIGHT_GRAY_BED = register("minecraft:light_gray_bed"); + public static final ItemType LIGHT_GRAY_CARPET = register("minecraft:light_gray_carpet"); + public static final ItemType LIGHT_GRAY_CONCRETE = register("minecraft:light_gray_concrete"); + public static final ItemType LIGHT_GRAY_CONCRETE_POWDER = register("minecraft:light_gray_concrete_powder"); + public static final ItemType LIGHT_GRAY_DYE = register("minecraft:light_gray_dye"); + public static final ItemType LIGHT_GRAY_GLAZED_TERRACOTTA = register("minecraft:light_gray_glazed_terracotta"); + public static final ItemType LIGHT_GRAY_SHULKER_BOX = register("minecraft:light_gray_shulker_box"); + public static final ItemType LIGHT_GRAY_STAINED_GLASS = register("minecraft:light_gray_stained_glass"); + public static final ItemType LIGHT_GRAY_STAINED_GLASS_PANE = register("minecraft:light_gray_stained_glass_pane"); + public static final ItemType LIGHT_GRAY_TERRACOTTA = register("minecraft:light_gray_terracotta"); + public static final ItemType LIGHT_GRAY_WOOL = register("minecraft:light_gray_wool"); + public static final ItemType LIGHT_WEIGHTED_PRESSURE_PLATE = register("minecraft:light_weighted_pressure_plate"); + public static final ItemType LILAC = register("minecraft:lilac"); + public static final ItemType LILY_PAD = register("minecraft:lily_pad"); + public static final ItemType LIME_BANNER = register("minecraft:lime_banner"); + public static final ItemType LIME_BED = register("minecraft:lime_bed"); + public static final ItemType LIME_CARPET = register("minecraft:lime_carpet"); + public static final ItemType LIME_CONCRETE = register("minecraft:lime_concrete"); + public static final ItemType LIME_CONCRETE_POWDER = register("minecraft:lime_concrete_powder"); + public static final ItemType LIME_DYE = register("minecraft:lime_dye"); + public static final ItemType LIME_GLAZED_TERRACOTTA = register("minecraft:lime_glazed_terracotta"); + public static final ItemType LIME_SHULKER_BOX = register("minecraft:lime_shulker_box"); + public static final ItemType LIME_STAINED_GLASS = register("minecraft:lime_stained_glass"); + public static final ItemType LIME_STAINED_GLASS_PANE = register("minecraft:lime_stained_glass_pane"); + public static final ItemType LIME_TERRACOTTA = register("minecraft:lime_terracotta"); + public static final ItemType LIME_WOOL = register("minecraft:lime_wool"); + public static final ItemType LINGERING_POTION = register("minecraft:lingering_potion"); + public static final ItemType LLAMA_SPAWN_EGG = register("minecraft:llama_spawn_egg"); + public static final ItemType MAGENTA_BANNER = register("minecraft:magenta_banner"); + public static final ItemType MAGENTA_BED = register("minecraft:magenta_bed"); + public static final ItemType MAGENTA_CARPET = register("minecraft:magenta_carpet"); + public static final ItemType MAGENTA_CONCRETE = register("minecraft:magenta_concrete"); + public static final ItemType MAGENTA_CONCRETE_POWDER = register("minecraft:magenta_concrete_powder"); + public static final ItemType MAGENTA_DYE = register("minecraft:magenta_dye"); + public static final ItemType MAGENTA_GLAZED_TERRACOTTA = register("minecraft:magenta_glazed_terracotta"); + public static final ItemType MAGENTA_SHULKER_BOX = register("minecraft:magenta_shulker_box"); + public static final ItemType MAGENTA_STAINED_GLASS = register("minecraft:magenta_stained_glass"); + public static final ItemType MAGENTA_STAINED_GLASS_PANE = register("minecraft:magenta_stained_glass_pane"); + public static final ItemType MAGENTA_TERRACOTTA = register("minecraft:magenta_terracotta"); + public static final ItemType MAGENTA_WOOL = register("minecraft:magenta_wool"); + public static final ItemType MAGMA_BLOCK = register("minecraft:magma_block"); + public static final ItemType MAGMA_CREAM = register("minecraft:magma_cream"); + public static final ItemType MAGMA_CUBE_SPAWN_EGG = register("minecraft:magma_cube_spawn_egg"); + public static final ItemType MAP = register("minecraft:map"); + public static final ItemType MELON = register("minecraft:melon"); + public static final ItemType MELON_SEEDS = register("minecraft:melon_seeds"); + public static final ItemType MELON_SLICE = register("minecraft:melon_slice"); + public static final ItemType MILK_BUCKET = register("minecraft:milk_bucket"); + public static final ItemType MINECART = register("minecraft:minecart"); + public static final ItemType MOOSHROOM_SPAWN_EGG = register("minecraft:mooshroom_spawn_egg"); + public static final ItemType MOSSY_COBBLESTONE = register("minecraft:mossy_cobblestone"); + public static final ItemType MOSSY_COBBLESTONE_WALL = register("minecraft:mossy_cobblestone_wall"); + public static final ItemType MOSSY_STONE_BRICKS = register("minecraft:mossy_stone_bricks"); + public static final ItemType MULE_SPAWN_EGG = register("minecraft:mule_spawn_egg"); + public static final ItemType MUSHROOM_STEM = register("minecraft:mushroom_stem"); + public static final ItemType MUSHROOM_STEW = register("minecraft:mushroom_stew"); + public static final ItemType MUSIC_DISC_11 = register("minecraft:music_disc_11"); + public static final ItemType MUSIC_DISC_13 = register("minecraft:music_disc_13"); + public static final ItemType MUSIC_DISC_BLOCKS = register("minecraft:music_disc_blocks"); + public static final ItemType MUSIC_DISC_CAT = register("minecraft:music_disc_cat"); + public static final ItemType MUSIC_DISC_CHIRP = register("minecraft:music_disc_chirp"); + public static final ItemType MUSIC_DISC_FAR = register("minecraft:music_disc_far"); + public static final ItemType MUSIC_DISC_MALL = register("minecraft:music_disc_mall"); + public static final ItemType MUSIC_DISC_MELLOHI = register("minecraft:music_disc_mellohi"); + public static final ItemType MUSIC_DISC_STAL = register("minecraft:music_disc_stal"); + public static final ItemType MUSIC_DISC_STRAD = register("minecraft:music_disc_strad"); + public static final ItemType MUSIC_DISC_WAIT = register("minecraft:music_disc_wait"); + public static final ItemType MUSIC_DISC_WARD = register("minecraft:music_disc_ward"); + public static final ItemType MUTTON = register("minecraft:mutton"); + public static final ItemType MYCELIUM = register("minecraft:mycelium"); + public static final ItemType NAME_TAG = register("minecraft:name_tag"); + public static final ItemType NAUTILUS_SHELL = register("minecraft:nautilus_shell"); + public static final ItemType NETHER_BRICK = register("minecraft:nether_brick"); + public static final ItemType NETHER_BRICK_FENCE = register("minecraft:nether_brick_fence"); + public static final ItemType NETHER_BRICK_SLAB = register("minecraft:nether_brick_slab"); + public static final ItemType NETHER_BRICK_STAIRS = register("minecraft:nether_brick_stairs"); + public static final ItemType NETHER_BRICKS = register("minecraft:nether_bricks"); + public static final ItemType NETHER_QUARTZ_ORE = register("minecraft:nether_quartz_ore"); + public static final ItemType NETHER_STAR = register("minecraft:nether_star"); + public static final ItemType NETHER_WART = register("minecraft:nether_wart"); + public static final ItemType NETHER_WART_BLOCK = register("minecraft:nether_wart_block"); + public static final ItemType NETHERRACK = register("minecraft:netherrack"); + public static final ItemType NOTE_BLOCK = register("minecraft:note_block"); + public static final ItemType OAK_BOAT = register("minecraft:oak_boat"); + public static final ItemType OAK_BUTTON = register("minecraft:oak_button"); + public static final ItemType OAK_DOOR = register("minecraft:oak_door"); + public static final ItemType OAK_FENCE = register("minecraft:oak_fence"); + public static final ItemType OAK_FENCE_GATE = register("minecraft:oak_fence_gate"); + public static final ItemType OAK_LEAVES = register("minecraft:oak_leaves"); + public static final ItemType OAK_LOG = register("minecraft:oak_log"); + public static final ItemType OAK_PLANKS = register("minecraft:oak_planks"); + public static final ItemType OAK_PRESSURE_PLATE = register("minecraft:oak_pressure_plate"); + public static final ItemType OAK_SAPLING = register("minecraft:oak_sapling"); + public static final ItemType OAK_SLAB = register("minecraft:oak_slab"); + public static final ItemType OAK_STAIRS = register("minecraft:oak_stairs"); + public static final ItemType OAK_TRAPDOOR = register("minecraft:oak_trapdoor"); + public static final ItemType OAK_WOOD = register("minecraft:oak_wood"); + public static final ItemType OBSERVER = register("minecraft:observer"); + public static final ItemType OBSIDIAN = register("minecraft:obsidian"); + public static final ItemType OCELOT_SPAWN_EGG = register("minecraft:ocelot_spawn_egg"); + public static final ItemType ORANGE_BANNER = register("minecraft:orange_banner"); + public static final ItemType ORANGE_BED = register("minecraft:orange_bed"); + public static final ItemType ORANGE_CARPET = register("minecraft:orange_carpet"); + public static final ItemType ORANGE_CONCRETE = register("minecraft:orange_concrete"); + public static final ItemType ORANGE_CONCRETE_POWDER = register("minecraft:orange_concrete_powder"); + public static final ItemType ORANGE_DYE = register("minecraft:orange_dye"); + public static final ItemType ORANGE_GLAZED_TERRACOTTA = register("minecraft:orange_glazed_terracotta"); + public static final ItemType ORANGE_SHULKER_BOX = register("minecraft:orange_shulker_box"); + public static final ItemType ORANGE_STAINED_GLASS = register("minecraft:orange_stained_glass"); + public static final ItemType ORANGE_STAINED_GLASS_PANE = register("minecraft:orange_stained_glass_pane"); + public static final ItemType ORANGE_TERRACOTTA = register("minecraft:orange_terracotta"); + public static final ItemType ORANGE_TULIP = register("minecraft:orange_tulip"); + public static final ItemType ORANGE_WOOL = register("minecraft:orange_wool"); + public static final ItemType OXEYE_DAISY = register("minecraft:oxeye_daisy"); + public static final ItemType PACKED_ICE = register("minecraft:packed_ice"); + public static final ItemType PAINTING = register("minecraft:painting"); + public static final ItemType PAPER = register("minecraft:paper"); + public static final ItemType PARROT_SPAWN_EGG = register("minecraft:parrot_spawn_egg"); + public static final ItemType PEONY = register("minecraft:peony"); + public static final ItemType PETRIFIED_OAK_SLAB = register("minecraft:petrified_oak_slab"); + public static final ItemType PHANTOM_MEMBRANE = register("minecraft:phantom_membrane"); + public static final ItemType PHANTOM_SPAWN_EGG = register("minecraft:phantom_spawn_egg"); + public static final ItemType PIG_SPAWN_EGG = register("minecraft:pig_spawn_egg"); + public static final ItemType PINK_BANNER = register("minecraft:pink_banner"); + public static final ItemType PINK_BED = register("minecraft:pink_bed"); + public static final ItemType PINK_CARPET = register("minecraft:pink_carpet"); + public static final ItemType PINK_CONCRETE = register("minecraft:pink_concrete"); + public static final ItemType PINK_CONCRETE_POWDER = register("minecraft:pink_concrete_powder"); + public static final ItemType PINK_DYE = register("minecraft:pink_dye"); + public static final ItemType PINK_GLAZED_TERRACOTTA = register("minecraft:pink_glazed_terracotta"); + public static final ItemType PINK_SHULKER_BOX = register("minecraft:pink_shulker_box"); + public static final ItemType PINK_STAINED_GLASS = register("minecraft:pink_stained_glass"); + public static final ItemType PINK_STAINED_GLASS_PANE = register("minecraft:pink_stained_glass_pane"); + public static final ItemType PINK_TERRACOTTA = register("minecraft:pink_terracotta"); + public static final ItemType PINK_TULIP = register("minecraft:pink_tulip"); + public static final ItemType PINK_WOOL = register("minecraft:pink_wool"); + public static final ItemType PISTON = register("minecraft:piston"); + public static final ItemType PLAYER_HEAD = register("minecraft:player_head"); + public static final ItemType PODZOL = register("minecraft:podzol"); + public static final ItemType POISONOUS_POTATO = register("minecraft:poisonous_potato"); + public static final ItemType POLAR_BEAR_SPAWN_EGG = register("minecraft:polar_bear_spawn_egg"); + public static final ItemType POLISHED_ANDESITE = register("minecraft:polished_andesite"); + public static final ItemType POLISHED_DIORITE = register("minecraft:polished_diorite"); + public static final ItemType POLISHED_GRANITE = register("minecraft:polished_granite"); + public static final ItemType POPPED_CHORUS_FRUIT = register("minecraft:popped_chorus_fruit"); + public static final ItemType POPPY = register("minecraft:poppy"); + public static final ItemType PORKCHOP = register("minecraft:porkchop"); + public static final ItemType POTATO = register("minecraft:potato"); + public static final ItemType POTION = register("minecraft:potion"); + public static final ItemType POWERED_RAIL = register("minecraft:powered_rail"); + public static final ItemType PRISMARINE = register("minecraft:prismarine"); + public static final ItemType PRISMARINE_BRICK_SLAB = register("minecraft:prismarine_brick_slab"); + public static final ItemType PRISMARINE_BRICK_STAIRS = register("minecraft:prismarine_brick_stairs"); + public static final ItemType PRISMARINE_BRICKS = register("minecraft:prismarine_bricks"); + public static final ItemType PRISMARINE_CRYSTALS = register("minecraft:prismarine_crystals"); + public static final ItemType PRISMARINE_SHARD = register("minecraft:prismarine_shard"); + public static final ItemType PRISMARINE_SLAB = register("minecraft:prismarine_slab"); + public static final ItemType PRISMARINE_STAIRS = register("minecraft:prismarine_stairs"); + public static final ItemType PUFFERFISH = register("minecraft:pufferfish"); + public static final ItemType PUFFERFISH_BUCKET = register("minecraft:pufferfish_bucket"); + public static final ItemType PUFFERFISH_SPAWN_EGG = register("minecraft:pufferfish_spawn_egg"); + public static final ItemType PUMPKIN = register("minecraft:pumpkin"); + public static final ItemType PUMPKIN_PIE = register("minecraft:pumpkin_pie"); + public static final ItemType PUMPKIN_SEEDS = register("minecraft:pumpkin_seeds"); + public static final ItemType PURPLE_BANNER = register("minecraft:purple_banner"); + public static final ItemType PURPLE_BED = register("minecraft:purple_bed"); + public static final ItemType PURPLE_CARPET = register("minecraft:purple_carpet"); + public static final ItemType PURPLE_CONCRETE = register("minecraft:purple_concrete"); + public static final ItemType PURPLE_CONCRETE_POWDER = register("minecraft:purple_concrete_powder"); + public static final ItemType PURPLE_DYE = register("minecraft:purple_dye"); + public static final ItemType PURPLE_GLAZED_TERRACOTTA = register("minecraft:purple_glazed_terracotta"); + public static final ItemType PURPLE_SHULKER_BOX = register("minecraft:purple_shulker_box"); + public static final ItemType PURPLE_STAINED_GLASS = register("minecraft:purple_stained_glass"); + public static final ItemType PURPLE_STAINED_GLASS_PANE = register("minecraft:purple_stained_glass_pane"); + public static final ItemType PURPLE_TERRACOTTA = register("minecraft:purple_terracotta"); + public static final ItemType PURPLE_WOOL = register("minecraft:purple_wool"); + public static final ItemType PURPUR_BLOCK = register("minecraft:purpur_block"); + public static final ItemType PURPUR_PILLAR = register("minecraft:purpur_pillar"); + public static final ItemType PURPUR_SLAB = register("minecraft:purpur_slab"); + public static final ItemType PURPUR_STAIRS = register("minecraft:purpur_stairs"); + public static final ItemType QUARTZ = register("minecraft:quartz"); + public static final ItemType QUARTZ_BLOCK = register("minecraft:quartz_block"); + public static final ItemType QUARTZ_PILLAR = register("minecraft:quartz_pillar"); + public static final ItemType QUARTZ_SLAB = register("minecraft:quartz_slab"); + public static final ItemType QUARTZ_STAIRS = register("minecraft:quartz_stairs"); + public static final ItemType RABBIT = register("minecraft:rabbit"); + public static final ItemType RABBIT_FOOT = register("minecraft:rabbit_foot"); + public static final ItemType RABBIT_HIDE = register("minecraft:rabbit_hide"); + public static final ItemType RABBIT_SPAWN_EGG = register("minecraft:rabbit_spawn_egg"); + public static final ItemType RABBIT_STEW = register("minecraft:rabbit_stew"); + public static final ItemType RAIL = register("minecraft:rail"); + public static final ItemType RED_BANNER = register("minecraft:red_banner"); + public static final ItemType RED_BED = register("minecraft:red_bed"); + public static final ItemType RED_CARPET = register("minecraft:red_carpet"); + public static final ItemType RED_CONCRETE = register("minecraft:red_concrete"); + public static final ItemType RED_CONCRETE_POWDER = register("minecraft:red_concrete_powder"); + public static final ItemType RED_GLAZED_TERRACOTTA = register("minecraft:red_glazed_terracotta"); + public static final ItemType RED_MUSHROOM = register("minecraft:red_mushroom"); + public static final ItemType RED_MUSHROOM_BLOCK = register("minecraft:red_mushroom_block"); + public static final ItemType RED_NETHER_BRICKS = register("minecraft:red_nether_bricks"); + public static final ItemType RED_SAND = register("minecraft:red_sand"); + public static final ItemType RED_SANDSTONE = register("minecraft:red_sandstone"); + public static final ItemType RED_SANDSTONE_SLAB = register("minecraft:red_sandstone_slab"); + public static final ItemType RED_SANDSTONE_STAIRS = register("minecraft:red_sandstone_stairs"); + public static final ItemType RED_SHULKER_BOX = register("minecraft:red_shulker_box"); + public static final ItemType RED_STAINED_GLASS = register("minecraft:red_stained_glass"); + public static final ItemType RED_STAINED_GLASS_PANE = register("minecraft:red_stained_glass_pane"); + public static final ItemType RED_TERRACOTTA = register("minecraft:red_terracotta"); + public static final ItemType RED_TULIP = register("minecraft:red_tulip"); + public static final ItemType RED_WOOL = register("minecraft:red_wool"); + public static final ItemType REDSTONE = register("minecraft:redstone"); + public static final ItemType REDSTONE_BLOCK = register("minecraft:redstone_block"); + public static final ItemType REDSTONE_LAMP = register("minecraft:redstone_lamp"); + public static final ItemType REDSTONE_ORE = register("minecraft:redstone_ore"); + public static final ItemType REDSTONE_TORCH = register("minecraft:redstone_torch"); + public static final ItemType REPEATER = register("minecraft:repeater"); + public static final ItemType REPEATING_COMMAND_BLOCK = register("minecraft:repeating_command_block"); + public static final ItemType ROSE_BUSH = register("minecraft:rose_bush"); + public static final ItemType ROSE_RED = register("minecraft:rose_red"); + public static final ItemType ROTTEN_FLESH = register("minecraft:rotten_flesh"); + public static final ItemType SADDLE = register("minecraft:saddle"); + public static final ItemType SALMON = register("minecraft:salmon"); + public static final ItemType SALMON_BUCKET = register("minecraft:salmon_bucket"); + public static final ItemType SALMON_SPAWN_EGG = register("minecraft:salmon_spawn_egg"); + public static final ItemType SAND = register("minecraft:sand"); + public static final ItemType SANDSTONE = register("minecraft:sandstone"); + public static final ItemType SANDSTONE_SLAB = register("minecraft:sandstone_slab"); + public static final ItemType SANDSTONE_STAIRS = register("minecraft:sandstone_stairs"); + public static final ItemType SCUTE = register("minecraft:scute"); + public static final ItemType SEA_LANTERN = register("minecraft:sea_lantern"); + public static final ItemType SEA_PICKLE = register("minecraft:sea_pickle"); + public static final ItemType SEAGRASS = register("minecraft:seagrass"); + public static final ItemType SHEARS = register("minecraft:shears"); + public static final ItemType SHEEP_SPAWN_EGG = register("minecraft:sheep_spawn_egg"); + public static final ItemType SHIELD = register("minecraft:shield"); + public static final ItemType SHULKER_BOX = register("minecraft:shulker_box"); + public static final ItemType SHULKER_SHELL = register("minecraft:shulker_shell"); + public static final ItemType SHULKER_SPAWN_EGG = register("minecraft:shulker_spawn_egg"); + public static final ItemType SIGN = register("minecraft:sign"); + public static final ItemType SILVERFISH_SPAWN_EGG = register("minecraft:silverfish_spawn_egg"); + public static final ItemType SKELETON_HORSE_SPAWN_EGG = register("minecraft:skeleton_horse_spawn_egg"); + public static final ItemType SKELETON_SKULL = register("minecraft:skeleton_skull"); + public static final ItemType SKELETON_SPAWN_EGG = register("minecraft:skeleton_spawn_egg"); + public static final ItemType SLIME_BALL = register("minecraft:slime_ball"); + public static final ItemType SLIME_BLOCK = register("minecraft:slime_block"); + public static final ItemType SLIME_SPAWN_EGG = register("minecraft:slime_spawn_egg"); + public static final ItemType SMOOTH_QUARTZ = register("minecraft:smooth_quartz"); + public static final ItemType SMOOTH_RED_SANDSTONE = register("minecraft:smooth_red_sandstone"); + public static final ItemType SMOOTH_SANDSTONE = register("minecraft:smooth_sandstone"); + public static final ItemType SMOOTH_STONE = register("minecraft:smooth_stone"); + public static final ItemType SNOW = register("minecraft:snow"); + public static final ItemType SNOW_BLOCK = register("minecraft:snow_block"); + public static final ItemType SNOWBALL = register("minecraft:snowball"); + public static final ItemType SOUL_SAND = register("minecraft:soul_sand"); + public static final ItemType SPAWNER = register("minecraft:spawner"); + public static final ItemType SPECTRAL_ARROW = register("minecraft:spectral_arrow"); + public static final ItemType SPIDER_EYE = register("minecraft:spider_eye"); + public static final ItemType SPIDER_SPAWN_EGG = register("minecraft:spider_spawn_egg"); + public static final ItemType SPLASH_POTION = register("minecraft:splash_potion"); + public static final ItemType SPONGE = register("minecraft:sponge"); + public static final ItemType SPRUCE_BOAT = register("minecraft:spruce_boat"); + public static final ItemType SPRUCE_BUTTON = register("minecraft:spruce_button"); + public static final ItemType SPRUCE_DOOR = register("minecraft:spruce_door"); + public static final ItemType SPRUCE_FENCE = register("minecraft:spruce_fence"); + public static final ItemType SPRUCE_FENCE_GATE = register("minecraft:spruce_fence_gate"); + public static final ItemType SPRUCE_LEAVES = register("minecraft:spruce_leaves"); + public static final ItemType SPRUCE_LOG = register("minecraft:spruce_log"); + public static final ItemType SPRUCE_PLANKS = register("minecraft:spruce_planks"); + public static final ItemType SPRUCE_PRESSURE_PLATE = register("minecraft:spruce_pressure_plate"); + public static final ItemType SPRUCE_SAPLING = register("minecraft:spruce_sapling"); + public static final ItemType SPRUCE_SLAB = register("minecraft:spruce_slab"); + public static final ItemType SPRUCE_STAIRS = register("minecraft:spruce_stairs"); + public static final ItemType SPRUCE_TRAPDOOR = register("minecraft:spruce_trapdoor"); + public static final ItemType SPRUCE_WOOD = register("minecraft:spruce_wood"); + public static final ItemType SQUID_SPAWN_EGG = register("minecraft:squid_spawn_egg"); + public static final ItemType STICK = register("minecraft:stick"); + public static final ItemType STICKY_PISTON = register("minecraft:sticky_piston"); + public static final ItemType STONE = register("minecraft:stone"); + public static final ItemType STONE_AXE = register("minecraft:stone_axe"); + public static final ItemType STONE_BRICK_SLAB = register("minecraft:stone_brick_slab"); + public static final ItemType STONE_BRICK_STAIRS = register("minecraft:stone_brick_stairs"); + public static final ItemType STONE_BRICKS = register("minecraft:stone_bricks"); + public static final ItemType STONE_BUTTON = register("minecraft:stone_button"); + public static final ItemType STONE_HOE = register("minecraft:stone_hoe"); + public static final ItemType STONE_PICKAXE = register("minecraft:stone_pickaxe"); + public static final ItemType STONE_PRESSURE_PLATE = register("minecraft:stone_pressure_plate"); + public static final ItemType STONE_SHOVEL = register("minecraft:stone_shovel"); + public static final ItemType STONE_SLAB = register("minecraft:stone_slab"); + public static final ItemType STONE_SWORD = register("minecraft:stone_sword"); + public static final ItemType STRAY_SPAWN_EGG = register("minecraft:stray_spawn_egg"); + public static final ItemType STRING = register("minecraft:string"); + public static final ItemType STRIPPED_ACACIA_LOG = register("minecraft:stripped_acacia_log"); + public static final ItemType STRIPPED_ACACIA_WOOD = register("minecraft:stripped_acacia_wood"); + public static final ItemType STRIPPED_BIRCH_LOG = register("minecraft:stripped_birch_log"); + public static final ItemType STRIPPED_BIRCH_WOOD = register("minecraft:stripped_birch_wood"); + public static final ItemType STRIPPED_DARK_OAK_LOG = register("minecraft:stripped_dark_oak_log"); + public static final ItemType STRIPPED_DARK_OAK_WOOD = register("minecraft:stripped_dark_oak_wood"); + public static final ItemType STRIPPED_JUNGLE_LOG = register("minecraft:stripped_jungle_log"); + public static final ItemType STRIPPED_JUNGLE_WOOD = register("minecraft:stripped_jungle_wood"); + public static final ItemType STRIPPED_OAK_LOG = register("minecraft:stripped_oak_log"); + public static final ItemType STRIPPED_OAK_WOOD = register("minecraft:stripped_oak_wood"); + public static final ItemType STRIPPED_SPRUCE_LOG = register("minecraft:stripped_spruce_log"); + public static final ItemType STRIPPED_SPRUCE_WOOD = register("minecraft:stripped_spruce_wood"); + public static final ItemType STRUCTURE_BLOCK = register("minecraft:structure_block"); + public static final ItemType STRUCTURE_VOID = register("minecraft:structure_void"); + public static final ItemType SUGAR = register("minecraft:sugar"); + public static final ItemType SUGAR_CANE = register("minecraft:sugar_cane"); + public static final ItemType SUNFLOWER = register("minecraft:sunflower"); + public static final ItemType TALL_GRASS = register("minecraft:tall_grass"); + public static final ItemType TERRACOTTA = register("minecraft:terracotta"); + public static final ItemType TIPPED_ARROW = register("minecraft:tipped_arrow"); + public static final ItemType TNT = register("minecraft:tnt"); + public static final ItemType TNT_MINECART = register("minecraft:tnt_minecart"); + public static final ItemType TORCH = register("minecraft:torch"); + public static final ItemType TOTEM_OF_UNDYING = register("minecraft:totem_of_undying"); + public static final ItemType TRAPPED_CHEST = register("minecraft:trapped_chest"); + public static final ItemType TRIDENT = register("minecraft:trident"); + public static final ItemType TRIPWIRE_HOOK = register("minecraft:tripwire_hook"); + public static final ItemType TROPICAL_FISH = register("minecraft:tropical_fish"); + public static final ItemType TROPICAL_FISH_BUCKET = register("minecraft:tropical_fish_bucket"); + public static final ItemType TROPICAL_FISH_SPAWN_EGG = register("minecraft:tropical_fish_spawn_egg"); + public static final ItemType TUBE_CORAL = register("minecraft:tube_coral"); + public static final ItemType TUBE_CORAL_BLOCK = register("minecraft:tube_coral_block"); + public static final ItemType TUBE_CORAL_FAN = register("minecraft:tube_coral_fan"); + public static final ItemType TURTLE_EGG = register("minecraft:turtle_egg"); + public static final ItemType TURTLE_HELMET = register("minecraft:turtle_helmet"); + public static final ItemType TURTLE_SPAWN_EGG = register("minecraft:turtle_spawn_egg"); + public static final ItemType VEX_SPAWN_EGG = register("minecraft:vex_spawn_egg"); + public static final ItemType VILLAGER_SPAWN_EGG = register("minecraft:villager_spawn_egg"); + public static final ItemType VINDICATOR_SPAWN_EGG = register("minecraft:vindicator_spawn_egg"); + public static final ItemType VINE = register("minecraft:vine"); + public static final ItemType WATER_BUCKET = register("minecraft:water_bucket"); + public static final ItemType WET_SPONGE = register("minecraft:wet_sponge"); + public static final ItemType WHEAT = register("minecraft:wheat"); + public static final ItemType WHEAT_SEEDS = register("minecraft:wheat_seeds"); + public static final ItemType WHITE_BANNER = register("minecraft:white_banner"); + public static final ItemType WHITE_BED = register("minecraft:white_bed"); + public static final ItemType WHITE_CARPET = register("minecraft:white_carpet"); + public static final ItemType WHITE_CONCRETE = register("minecraft:white_concrete"); + public static final ItemType WHITE_CONCRETE_POWDER = register("minecraft:white_concrete_powder"); + public static final ItemType WHITE_GLAZED_TERRACOTTA = register("minecraft:white_glazed_terracotta"); + public static final ItemType WHITE_SHULKER_BOX = register("minecraft:white_shulker_box"); + public static final ItemType WHITE_STAINED_GLASS = register("minecraft:white_stained_glass"); + public static final ItemType WHITE_STAINED_GLASS_PANE = register("minecraft:white_stained_glass_pane"); + public static final ItemType WHITE_TERRACOTTA = register("minecraft:white_terracotta"); + public static final ItemType WHITE_TULIP = register("minecraft:white_tulip"); + public static final ItemType WHITE_WOOL = register("minecraft:white_wool"); + public static final ItemType WITCH_SPAWN_EGG = register("minecraft:witch_spawn_egg"); + public static final ItemType WITHER_SKELETON_SKULL = register("minecraft:wither_skeleton_skull"); + public static final ItemType WITHER_SKELETON_SPAWN_EGG = register("minecraft:wither_skeleton_spawn_egg"); + public static final ItemType WOLF_SPAWN_EGG = register("minecraft:wolf_spawn_egg"); + public static final ItemType WOODEN_AXE = register("minecraft:wooden_axe"); + public static final ItemType WOODEN_HOE = register("minecraft:wooden_hoe"); + public static final ItemType WOODEN_PICKAXE = register("minecraft:wooden_pickaxe"); + public static final ItemType WOODEN_SHOVEL = register("minecraft:wooden_shovel"); + public static final ItemType WOODEN_SWORD = register("minecraft:wooden_sword"); + public static final ItemType WRITABLE_BOOK = register("minecraft:writable_book"); + public static final ItemType WRITTEN_BOOK = register("minecraft:written_book"); + public static final ItemType YELLOW_BANNER = register("minecraft:yellow_banner"); + public static final ItemType YELLOW_BED = register("minecraft:yellow_bed"); + public static final ItemType YELLOW_CARPET = register("minecraft:yellow_carpet"); + public static final ItemType YELLOW_CONCRETE = register("minecraft:yellow_concrete"); + public static final ItemType YELLOW_CONCRETE_POWDER = register("minecraft:yellow_concrete_powder"); + public static final ItemType YELLOW_GLAZED_TERRACOTTA = register("minecraft:yellow_glazed_terracotta"); + public static final ItemType YELLOW_SHULKER_BOX = register("minecraft:yellow_shulker_box"); + public static final ItemType YELLOW_STAINED_GLASS = register("minecraft:yellow_stained_glass"); + public static final ItemType YELLOW_STAINED_GLASS_PANE = register("minecraft:yellow_stained_glass_pane"); + public static final ItemType YELLOW_TERRACOTTA = register("minecraft:yellow_terracotta"); + public static final ItemType YELLOW_WOOL = register("minecraft:yellow_wool"); + public static final ItemType ZOMBIE_HEAD = register("minecraft:zombie_head"); + public static final ItemType ZOMBIE_HORSE_SPAWN_EGG = register("minecraft:zombie_horse_spawn_egg"); + public static final ItemType ZOMBIE_PIGMAN_SPAWN_EGG = register("minecraft:zombie_pigman_spawn_egg"); + public static final ItemType ZOMBIE_SPAWN_EGG = register("minecraft:zombie_spawn_egg"); + public static final ItemType ZOMBIE_VILLAGER_SPAWN_EGG = register("minecraft:zombie_villager_spawn_egg"); + + private ItemTypes() { + } + + private static ItemType register(final String id) { + return register(new ItemType(id)); + } + + public static ItemType register(final ItemType item) { + return ItemType.REGISTRY.register(item.getId(), item); + } + + public static @Nullable ItemType get(final String id) { + return ItemType.REGISTRY.get(id); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java index ab3942463..8a581b7a6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java @@ -22,9 +22,10 @@ package com.sk89q.worldedit.world.registry; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; -import javax.annotation.Nullable; import java.util.List; +import javax.annotation.Nullable; + /** * Provides information on biomes. */ diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/UnplaceableBlockException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockCategoryRegistry.java similarity index 79% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/UnplaceableBlockException.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockCategoryRegistry.java index b1ab13802..3ec851246 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/UnplaceableBlockException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockCategoryRegistry.java @@ -17,13 +17,13 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.bags; +package com.sk89q.worldedit.world.registry; +import com.sk89q.worldedit.world.block.BlockType; /** - * @deprecated Block bags are currently not a supported feature of WorldEdit + * A registry for BlockType categories. */ -@Deprecated -public class UnplaceableBlockException extends BlockBagException { +public interface BlockCategoryRegistry extends CategoryRegistry { } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockMaterial.java similarity index 77% rename from worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockMaterial.java index bf9e3abb0..9f8d32a15 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockMaterial.java @@ -17,20 +17,13 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.blocks; +package com.sk89q.worldedit.world.registry; /** * Describes the material for a block. */ public interface BlockMaterial { - /** - * Get whether this block is rendered like a normal block. - * - * @return the value of the test - */ - boolean isRenderedAsNormalBlock(); - /** * Get whether this block is a full sized cube. * @@ -87,27 +80,6 @@ public interface BlockMaterial { */ float getSlipperiness(); - /** - * Get whether this block blocks grass from growing. - * - * @return whether this block blocks grass - */ - boolean isGrassBlocking(); - - /** - * Get the ambient occlusion light value. - * - * @return the ambient occlusion light value - */ - float getAmbientOcclusionLightValue(); - - /** - * Get the opacity of this block for light to pass through. - * - * @return the opacity - */ - int getLightOpacity(); - /** * Get the light value for this block. * @@ -129,13 +101,6 @@ public interface BlockMaterial { */ boolean isUnpushable(); - /** - * Get whether this block can be used in adventure mode. - * - * @return true if the block can be used in adventure mode - */ - boolean isAdventureModeExempt(); - /** * Get whether this block is ticked randomly. * @@ -143,13 +108,6 @@ public interface BlockMaterial { */ boolean isTicksRandomly(); - /** - * Gets whether this block uses a neighbor's light value. - * - * @return true if this block does - */ - boolean isUsingNeighborLight(); - /** * Get whether this block prevents movement. * @@ -180,4 +138,17 @@ public interface BlockMaterial { */ boolean isReplacedDuringPlacement(); + /** + * Get whether this block is translucent. + * + * @return true if the block is translucent + */ + boolean isTranslucent(); + + /** + * Gets whether the block has a container (Item container) + * + * @return If it has a container + */ + boolean hasContainer(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java index 7448835cf..0e87b084e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java @@ -19,51 +19,33 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockMaterial; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.block.BlockType; + +import java.util.Map; import javax.annotation.Nullable; -import java.util.Map; /** * Provides information on blocks and provides methods to create them. */ public interface BlockRegistry { - /** - * Create a new block using its ID. - * - * @param id the id - * @return the block, which may be null if no block exists - */ - @Nullable - BaseBlock createFromId(String id); - - /** - * Create a new block using its legacy numeric ID. - * - * @param id the id - * @return the block, which may be null if no block exists - */ - @Nullable - BaseBlock createFromId(int id); - /** * Get the material for the given block. * - * @param block the block + * @param blockType the block * @return the material, or null if the material information is not known */ @Nullable - BlockMaterial getMaterial(BaseBlock block); + BlockMaterial getMaterial(BlockType blockType); /** * Get an unmodifiable map of states for this block. * - * @param block the block + * @param blockType the block * @return a map of states where the key is the state's ID */ - @Nullable - Map getStates(BaseBlock block); + Map getProperties(BlockType blockType); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java index 5a34a8f3e..afe73c368 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java @@ -24,10 +24,8 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BlockMaterial; import com.sk89q.worldedit.util.gson.VectorAdapter; -import javax.annotation.Nullable; import java.io.IOException; import java.net.URL; import java.nio.charset.Charset; @@ -37,6 +35,8 @@ import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; +import javax.annotation.Nullable; + /** * Provides block data based on the built-in block database that is bundled * with WorldEdit. @@ -51,10 +51,9 @@ import java.util.logging.Logger; public class BundledBlockData { private static final Logger log = Logger.getLogger(BundledBlockData.class.getCanonicalName()); - private static final BundledBlockData INSTANCE = new BundledBlockData(); + private static BundledBlockData INSTANCE; - private final Map idMap = new HashMap(); - private final Map legacyMap = new HashMap(); // Trove usage removed temporarily + private final Map idMap = new HashMap<>(); /** * Create a new instance. @@ -62,7 +61,7 @@ public class BundledBlockData { private BundledBlockData() { try { loadFromResource(); - } catch (IOException e) { + } catch (Throwable e) { log.log(Level.WARNING, "Failed to load the built-in block registry", e); } } @@ -84,9 +83,7 @@ public class BundledBlockData { List entries = gson.fromJson(data, new TypeToken>() {}.getType()); for (BlockEntry entry : entries) { - entry.postDeserialization(); idMap.put(entry.id, entry); - legacyMap.put(entry.legacyId, entry); } } @@ -97,45 +94,22 @@ public class BundledBlockData { * @return the entry, or null */ @Nullable - private BlockEntry findById(String id) { - return idMap.get(id); - } - - /** - * Return the entry for the given block legacy numeric ID. - * - * @param id the ID - * @return the entry, or null - */ - @Nullable - private BlockEntry findById(int id) { - return legacyMap.get(id); - } - - /** - * Convert the given string ID to a legacy numeric ID. - * - * @param id the ID - * @return the legacy ID, which may be null if the block does not have a legacy ID - */ - @Nullable - public Integer toLegacyId(String id) { - BlockEntry entry = findById(id); - if (entry != null) { - return entry.legacyId; - } else { - return null; + public BlockEntry findById(String id) { + // If it has no namespace, assume minecraft. + if (!id.contains(":")) { + id = "minecraft:" + id; } + return idMap.get(id); } /** * Get the material properties for the given block. * - * @param id the legacy numeric ID + * @param id the string ID * @return the material's properties, or null */ @Nullable - public BlockMaterial getMaterialById(int id) { + public BlockMaterial getMaterialById(String id) { BlockEntry entry = findById(id); if (entry != null) { return entry.material; @@ -144,44 +118,22 @@ public class BundledBlockData { } } - /** - * Get the states for the given block. - * - * @param id the legacy numeric ID - * @return the block's states, or null if no information is available - */ - @Nullable - public Map getStatesById(int id) { - BlockEntry entry = findById(id); - if (entry != null) { - return entry.states; - } else { - return null; - } - } - /** * Get a singleton instance of this object. * * @return the instance */ public static BundledBlockData getInstance() { + if (INSTANCE == null) { + INSTANCE = new BundledBlockData(); + } return INSTANCE; } - private static class BlockEntry { - private int legacyId; + public static class BlockEntry { private String id; - private String unlocalizedName; - private List aliases; - private Map states = new HashMap(); + public String localizedName; private SimpleBlockMaterial material = new SimpleBlockMaterial(); - - void postDeserialization() { - for (SimpleState state : states.values()) { - state.postDeserialization(); - } - } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyBlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java similarity index 57% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyBlockRegistry.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java index e846e7984..40e123959 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyBlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java @@ -19,45 +19,30 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockMaterial; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.block.BlockType; + +import java.util.Collections; +import java.util.Map; import javax.annotation.Nullable; -import java.util.Map; /** * A block registry that uses {@link BundledBlockData} to serve information * about blocks. */ -public class LegacyBlockRegistry implements BlockRegistry { +public class BundledBlockRegistry implements BlockRegistry { @Nullable @Override - public BaseBlock createFromId(String id) { - Integer legacyId = BundledBlockData.getInstance().toLegacyId(id); - if (legacyId != null) { - return createFromId(legacyId); - } else { - return null; - } + public BlockMaterial getMaterial(BlockType blockType) { + return new PassthroughBlockMaterial(BundledBlockData.getInstance().getMaterialById(blockType.getId())); } @Nullable @Override - public BaseBlock createFromId(int id) { - return new BaseBlock(id); - } - - @Nullable - @Override - public BlockMaterial getMaterial(BaseBlock block) { - return BundledBlockData.getInstance().getMaterialById(block.getId()); - } - - @Nullable - @Override - public Map getStates(BaseBlock block) { - return BundledBlockData.getInstance().getStatesById(block.getId()); + public Map getProperties(BlockType blockType) { + return Collections.emptyMap(); // Oof } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java new file mode 100644 index 000000000..00cafb244 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java @@ -0,0 +1,125 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.registry; + +import com.google.common.io.Resources; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.util.gson.VectorAdapter; + +import java.io.IOException; +import java.net.URL; +import java.nio.charset.Charset; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.annotation.Nullable; + +/** + * Provides item data based on the built-in item database that is bundled + * with WorldEdit. + * + *

A new instance cannot be created. Use {@link #getInstance()} to get + * an instance.

+ * + *

The data is read from a JSON file that is bundled with WorldEdit. If + * reading fails (which occurs when this class is first instantiated), then + * the methods will return {@code null}s for all items.

+ */ +public class BundledItemData { + + private static final Logger log = Logger.getLogger(BundledItemData.class.getCanonicalName()); + private static BundledItemData INSTANCE; + + private final Map idMap = new HashMap<>(); + + /** + * Create a new instance. + */ + private BundledItemData() { + try { + loadFromResource(); + } catch (Throwable e) { + log.log(Level.WARNING, "Failed to load the built-in item registry", e); + } + } + + /** + * Attempt to load the data from file. + * + * @throws IOException thrown on I/O error + */ + private void loadFromResource() throws IOException { + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.registerTypeAdapter(Vector.class, new VectorAdapter()); + Gson gson = gsonBuilder.create(); + URL url = BundledItemData.class.getResource("items.json"); + if (url == null) { + throw new IOException("Could not find items.json"); + } + String data = Resources.toString(url, Charset.defaultCharset()); + List entries = gson.fromJson(data, new TypeToken>() {}.getType()); + + for (ItemEntry entry : entries) { + idMap.put(entry.id, entry); + } + } + + /** + * Return the entry for the given item ID. + * + * @param id the ID + * @return the entry, or null + */ + @Nullable + public ItemEntry findById(String id) { + // If it has no namespace, assume minecraft. + if (!id.contains(":")) { + id = "minecraft:" + id; + } + return idMap.get(id); + } + + /** + * Get a singleton instance of this object. + * + * @return the instance + */ + public static BundledItemData getInstance() { + if (INSTANCE == null) { + INSTANCE = new BundledItemData(); + } + return INSTANCE; + } + + public static class ItemEntry { + private String id; + private String unlocalizedName; + public String localizedName; + private int maxDamage; + private int maxStackSize; + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java similarity index 73% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullItemRegistry.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java index bcaf3698d..11e723f21 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java @@ -20,21 +20,21 @@ package com.sk89q.worldedit.world.registry; import com.sk89q.worldedit.blocks.BaseItem; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; import javax.annotation.Nullable; -public class NullItemRegistry implements ItemRegistry { +/** + * A item registry that uses {@link BundledItemRegistry} to serve information + * about items. + */ +public class BundledItemRegistry implements ItemRegistry { @Nullable @Override public BaseItem createFromId(String id) { - return null; + ItemType itemType = ItemTypes.get(id); + return itemType == null ? null : new BaseItem(itemType); } - - @Nullable - @Override - public BaseItem createFromId(int id) { - return null; - } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyWorldData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledRegistries.java similarity index 62% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyWorldData.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledRegistries.java index c5e116c66..7c6abc390 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyWorldData.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledRegistries.java @@ -20,21 +20,23 @@ package com.sk89q.worldedit.world.registry; /** - * An implementation of {@link WorldData} that uses legacy numeric IDs and - * a built-in block database. + * An implementation of {@link Registries} that converts legacy numeric IDs and + * a contains a built-in block and item database. */ -public class LegacyWorldData implements WorldData { +public class BundledRegistries implements Registries { - private static final LegacyWorldData INSTANCE = new LegacyWorldData(); - private final LegacyBlockRegistry blockRegistry = new LegacyBlockRegistry(); - private final NullItemRegistry itemRegistry = new NullItemRegistry(); + private static final BundledRegistries INSTANCE = new BundledRegistries(); + private final BundledBlockRegistry blockRegistry = new BundledBlockRegistry(); + private final BundledItemRegistry itemRegistry = new BundledItemRegistry(); private final NullEntityRegistry entityRegistry = new NullEntityRegistry(); private final NullBiomeRegistry biomeRegistry = new NullBiomeRegistry(); + private final NullBlockCategoryRegistry blockCategoryRegistry = new NullBlockCategoryRegistry(); + private final NullItemCategoryRegistry itemCategoryRegistry = new NullItemCategoryRegistry(); /** * Create a new instance. */ - protected LegacyWorldData() { + protected BundledRegistries() { } @Override @@ -57,12 +59,22 @@ public class LegacyWorldData implements WorldData { return biomeRegistry; } + @Override + public BlockCategoryRegistry getBlockCategoryRegistry() { + return blockCategoryRegistry; + } + + @Override + public ItemCategoryRegistry getItemCategoryRegistry() { + return itemCategoryRegistry; + } + /** * Get a singleton instance. * * @return an instance */ - public static LegacyWorldData getInstance() { + public static BundledRegistries getInstance() { return INSTANCE; } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditAPI.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/CategoryRegistry.java similarity index 57% rename from worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditAPI.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/CategoryRegistry.java index 85a38ac9b..1a54c7961 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditAPI.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/CategoryRegistry.java @@ -17,32 +17,32 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.bukkit; +package com.sk89q.worldedit.world.registry; -import org.bukkit.entity.Player; -import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.registry.Category; + +import java.util.Set; /** - * @deprecated use the regular API + * A registry of categories. Minecraft internally calls these 'Tags'. */ -@Deprecated -public class WorldEditAPI { - - private WorldEditPlugin plugin; - - public WorldEditAPI(WorldEditPlugin plugin) { - this.plugin = plugin; - } +public interface CategoryRegistry { /** - * Get the session for a player. + * Gets a set of values with a given category. * - * @param player the player - * @return a session + * @param category The category + * @return A set of values */ - public LocalSession getSession(Player player) { - return plugin.getWorldEdit().getSession( - new BukkitPlayer(plugin, plugin.getServerInterface(), player)); - } + Set getCategorisedByName(String category); + Set getAll(final Category category); + + /** + * Gets a list of categories given to a value. + * + * @param categorised The value + * @return A set of categories + */ + Set getCategories(T categorised); } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfBlocksException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemCategoryRegistry.java similarity index 80% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfBlocksException.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemCategoryRegistry.java index 197d9c241..94f32507f 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfBlocksException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemCategoryRegistry.java @@ -17,13 +17,13 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.bags; +package com.sk89q.worldedit.world.registry; +import com.sk89q.worldedit.world.item.ItemType; /** - * @deprecated Block bags are currently not a supported feature of WorldEdit + * A registry for ItemType categories. */ -@Deprecated -public class OutOfBlocksException extends BlockBagException { +public interface ItemCategoryRegistry extends CategoryRegistry { } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java index 31afa867f..749aa6a37 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java @@ -34,13 +34,4 @@ public interface ItemRegistry { @Nullable BaseItem createFromId(String id); - /** - * Create a new item using its legacy numeric ID. - * - * @param id the id - * @return the item, which may be null if no item exists - */ - @Nullable - BaseItem createFromId(int id); - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java new file mode 100644 index 000000000..78bc48131 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java @@ -0,0 +1,163 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.registry; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.google.common.io.Resources; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.util.gson.VectorAdapter; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; + +import java.io.IOException; +import java.net.URL; +import java.nio.charset.Charset; +import java.util.Arrays; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.annotation.Nullable; + +public class LegacyMapper { + + private static final Logger log = Logger.getLogger(LegacyMapper.class.getCanonicalName()); + private static LegacyMapper INSTANCE; + + private Multimap stringToBlockMap = HashMultimap.create(); + private Multimap blockToStringMap = HashMultimap.create(); + private Multimap stringToItemMap = HashMultimap.create(); + private Multimap itemToStringMap = HashMultimap.create(); + + /** + * Create a new instance. + */ + private LegacyMapper() { + try { + loadFromResource(); + } catch (Throwable e) { + log.log(Level.WARNING, "Failed to load the built-in legacy id registry", e); + } + } + + /** + * Attempt to load the data from file. + * + * @throws IOException thrown on I/O error + */ + private void loadFromResource() throws IOException { + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.registerTypeAdapter(Vector.class, new VectorAdapter()); + Gson gson = gsonBuilder.disableHtmlEscaping().create(); + URL url = LegacyMapper.class.getResource("legacy.json"); + if (url == null) { + throw new IOException("Could not find legacy.json"); + } + String data = Resources.toString(url, Charset.defaultCharset()); + LegacyDataFile dataFile = gson.fromJson(data, new TypeToken() {}.getType()); + + ParserContext parserContext = new ParserContext(); + parserContext.setPreferringWildcard(false); + parserContext.setRestricted(false); + parserContext.setTryLegacy(false); // This is legacy. Don't match itself. + + for (Map.Entry blockEntry : dataFile.blocks.entrySet()) { + try { + String id = blockEntry.getKey(); + BlockState state = WorldEdit.getInstance().getBlockFactory().parseFromInput(blockEntry.getValue(), parserContext).toImmutableState(); + blockToStringMap.put(state, id); + stringToBlockMap.put(id, state); + } catch (Exception e) { + log.warning("Unknown block: " + blockEntry.getValue()); + } + } + + for (Map.Entry itemEntry : dataFile.items.entrySet()) { + try { + String id = itemEntry.getKey(); + ItemType type = ItemTypes.get(itemEntry.getValue()); + itemToStringMap.put(type, id); + stringToItemMap.put(id, type); + } catch (Exception e) { + log.warning("Unknown item: " + itemEntry.getValue()); + } + } + } + + @Nullable + public ItemType getItemFromLegacy(int legacyId) { + return getItemFromLegacy(legacyId, 0); + } + + @Nullable + public ItemType getItemFromLegacy(int legacyId, int data) { + return stringToItemMap.get(legacyId + ":" + data).stream().findFirst().orElse(null); + } + + @Nullable + public int[] getLegacyFromItem(ItemType itemType) { + if (!itemToStringMap.containsKey(itemType)) { + return null; + } else { + String value = itemToStringMap.get(itemType).stream().findFirst().get(); + return Arrays.stream(value.split(":")).mapToInt(Integer::parseInt).toArray(); + } + } + + @Nullable + public BlockState getBlockFromLegacy(int legacyId) { + return getBlockFromLegacy(legacyId, 0); + } + + @Nullable + public BlockState getBlockFromLegacy(int legacyId, int data) { + return stringToBlockMap.get(legacyId + ":" + data).stream().findFirst().orElse(null); + } + + @Nullable + public int[] getLegacyFromBlock(BlockState blockState) { + if (!blockToStringMap.containsKey(blockState)) { + return null; + } else { + String value = blockToStringMap.get(blockState).stream().findFirst().get(); + return Arrays.stream(value.split(":")).mapToInt(Integer::parseInt).toArray(); + } + } + + public static LegacyMapper getInstance() { + if (INSTANCE == null) { + INSTANCE = new LegacyMapper(); + } + return INSTANCE; + } + + @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection", "unused"}) + private static class LegacyDataFile { + private Map blocks; + private Map items; + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java index 8bbf7c1ff..551cbc039 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java @@ -22,10 +22,11 @@ package com.sk89q.worldedit.world.registry; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; +import javax.annotation.Nullable; + /** * A biome registry that knows nothing. */ diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockTypeMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBlockCategoryRegistry.java similarity index 59% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockTypeMask.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBlockCategoryRegistry.java index 5d195c4fc..b26286498 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/BlockTypeMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBlockCategoryRegistry.java @@ -17,38 +17,28 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.masks; +package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.registry.Category; +import com.sk89q.worldedit.world.block.BlockType; +import java.util.Collections; import java.util.Set; -/** - * A filter that matches blocks based on block types. - * - * @deprecated replaced by {@link #BlockMask} - */ -@Deprecated -public class BlockTypeMask extends BlockMask { +public class NullBlockCategoryRegistry implements BlockCategoryRegistry { - public BlockTypeMask() { - super(); + @Override + public Set getCategorisedByName(String category) { + return Collections.emptySet(); } - public BlockTypeMask(Set types) { - super(); - for (int type : types) { - add(type); - } + @Override + public Set getAll(final Category category) { + return Collections.emptySet(); } - public BlockTypeMask(int type) { - this(); - add(type); + @Override + public Set getCategories(BlockType categorised) { + return Collections.emptySet(); } - - public void add(int type) { - add(new BaseBlock(type)); - } - } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedBlockTypeMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullItemCategoryRegistry.java similarity index 60% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedBlockTypeMask.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullItemCategoryRegistry.java index 61ae5a9a5..d047706c2 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/masks/InvertedBlockTypeMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullItemCategoryRegistry.java @@ -17,33 +17,28 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.masks; +package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.registry.Category; +import com.sk89q.worldedit.world.item.ItemType; +import java.util.Collections; import java.util.Set; -/** - * A block type mask that only matches blocks that are not in the list. - */ -@Deprecated -public class InvertedBlockTypeMask extends BlockTypeMask { +public class NullItemCategoryRegistry implements ItemCategoryRegistry { - public InvertedBlockTypeMask() { - } - - public InvertedBlockTypeMask(Set types) { - super(types); - } - - public InvertedBlockTypeMask(int type) { - super(type); + @Override + public Set getCategorisedByName(String category) { + return Collections.emptySet(); } @Override - public boolean matches(EditSession editSession, Vector position) { - return !super.matches(editSession, position); + public Set getAll(final Category category) { + return Collections.emptySet(); } + @Override + public Set getCategories(ItemType categorised) { + return Collections.emptySet(); + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java new file mode 100644 index 000000000..97dd617f9 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java @@ -0,0 +1,193 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.registry; + +import javax.annotation.Nullable; + +public class PassthroughBlockMaterial implements BlockMaterial { + + @Nullable private final BlockMaterial blockMaterial; + + public PassthroughBlockMaterial(@Nullable BlockMaterial material) { + this.blockMaterial = material; + } + + @Override + public boolean isFullCube() { + if (blockMaterial == null) { + return true; + } else { + return blockMaterial.isFullCube(); + } + } + + @Override + public boolean isOpaque() { + if (blockMaterial == null) { + return true; + } else { + return blockMaterial.isOpaque(); + } + } + + @Override + public boolean isPowerSource() { + if (blockMaterial == null) { + return false; + } else { + return blockMaterial.isPowerSource(); + } + } + + @Override + public boolean isLiquid() { + if (blockMaterial == null) { + return false; + } else { + return blockMaterial.isLiquid(); + } + } + + @Override + public boolean isSolid() { + if (blockMaterial == null) { + return true; + } else { + return blockMaterial.isSolid(); + } + } + + @Override + public float getHardness() { + if (blockMaterial == null) { + return 0; + } else { + return blockMaterial.getHardness(); + } + } + + @Override + public float getResistance() { + if (blockMaterial == null) { + return 0; + } else { + return blockMaterial.getResistance(); + } + } + + @Override + public float getSlipperiness() { + if (blockMaterial == null) { + return 0; + } else { + return blockMaterial.getSlipperiness(); + } + } + + @Override + public int getLightValue() { + if (blockMaterial == null) { + return 0; + } else { + return blockMaterial.getLightValue(); + } + } + + @Override + public boolean isFragileWhenPushed() { + if (blockMaterial == null) { + return false; + } else { + return blockMaterial.isFragileWhenPushed(); + } + } + + @Override + public boolean isUnpushable() { + if (blockMaterial == null) { + return false; + } else { + return blockMaterial.isUnpushable(); + } + } + + @Override + public boolean isTicksRandomly() { + if (blockMaterial == null) { + return true; + } else { + return blockMaterial.isTicksRandomly(); + } + } + + @Override + public boolean isMovementBlocker() { + if (blockMaterial == null) { + return true; + } else { + return blockMaterial.isMovementBlocker(); + } + } + + @Override + public boolean isBurnable() { + if (blockMaterial == null) { + return true; + } else { + return blockMaterial.isOpaque(); + } + } + + @Override + public boolean isToolRequired() { + if (blockMaterial == null) { + return true; + } else { + return blockMaterial.isToolRequired(); + } + } + + @Override + public boolean isReplacedDuringPlacement() { + if (blockMaterial == null) { + return false; + } else { + return blockMaterial.isReplacedDuringPlacement(); + } + } + + @Override + public boolean isTranslucent() { + if (blockMaterial == null) { + return !isOpaque(); + } else { + return blockMaterial.isTranslucent(); + } + } + + @Override + public boolean hasContainer() { + if (blockMaterial == null) { + return false; + } else { + return blockMaterial.hasContainer(); + } + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/WorldData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/Registries.java similarity index 77% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/WorldData.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/Registries.java index ada70dd3c..aea32e09a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/WorldData.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/Registries.java @@ -20,10 +20,9 @@ package com.sk89q.worldedit.world.registry; /** - * Describes the necessary data for blocks, entities, and other objects - * on a world. + * Contains getters for the various registries. */ -public interface WorldData { +public interface Registries { /** * Get the block registry. @@ -53,4 +52,18 @@ public interface WorldData { */ BiomeRegistry getBiomeRegistry(); + /** + * Get the block category registry. + * + * @return the block category registry + */ + BlockCategoryRegistry getBlockCategoryRegistry(); + + /** + * Get the item category registry. + * + * @return the item category registry + */ + ItemCategoryRegistry getItemCategoryRegistry(); + } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java index 7b190c740..e0247ce49 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java @@ -19,11 +19,8 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BlockMaterial; - class SimpleBlockMaterial implements BlockMaterial { - private boolean renderedAsNormalBlock; private boolean fullCube; private boolean opaque; private boolean powerSource; @@ -32,28 +29,16 @@ class SimpleBlockMaterial implements BlockMaterial { private float hardness; private float resistance; private float slipperiness; - private boolean grassBlocking; - private float ambientOcclusionLightValue; - private int lightOpacity; private int lightValue; private boolean fragileWhenPushed; private boolean unpushable; - private boolean adventureModeExempt; private boolean ticksRandomly; - private boolean usingNeighborLight; private boolean movementBlocker; private boolean burnable; private boolean toolRequired; private boolean replacedDuringPlacement; - - @Override - public boolean isRenderedAsNormalBlock() { - return renderedAsNormalBlock; - } - - public void setRenderedAsNormalBlock(boolean renderedAsNormalBlock) { - this.renderedAsNormalBlock = renderedAsNormalBlock; - } + private boolean isTranslucent; + private boolean hasContainer; @Override public boolean isFullCube() { @@ -127,33 +112,6 @@ class SimpleBlockMaterial implements BlockMaterial { this.slipperiness = slipperiness; } - @Override - public boolean isGrassBlocking() { - return grassBlocking; - } - - public void setGrassBlocking(boolean grassBlocking) { - this.grassBlocking = grassBlocking; - } - - @Override - public float getAmbientOcclusionLightValue() { - return ambientOcclusionLightValue; - } - - public void setAmbientOcclusionLightValue(float ambientOcclusionLightValue) { - this.ambientOcclusionLightValue = ambientOcclusionLightValue; - } - - @Override - public int getLightOpacity() { - return lightOpacity; - } - - public void setLightOpacity(int lightOpacity) { - this.lightOpacity = lightOpacity; - } - @Override public int getLightValue() { return lightValue; @@ -181,15 +139,6 @@ class SimpleBlockMaterial implements BlockMaterial { this.unpushable = unpushable; } - @Override - public boolean isAdventureModeExempt() { - return adventureModeExempt; - } - - public void setAdventureModeExempt(boolean adventureModeExempt) { - this.adventureModeExempt = adventureModeExempt; - } - @Override public boolean isTicksRandomly() { return ticksRandomly; @@ -199,15 +148,6 @@ class SimpleBlockMaterial implements BlockMaterial { this.ticksRandomly = ticksRandomly; } - @Override - public boolean isUsingNeighborLight() { - return usingNeighborLight; - } - - public void setUsingNeighborLight(boolean usingNeighborLight) { - this.usingNeighborLight = usingNeighborLight; - } - @Override public boolean isMovementBlocker() { return movementBlocker; @@ -240,7 +180,25 @@ class SimpleBlockMaterial implements BlockMaterial { return replacedDuringPlacement; } + public void setTranslucent(boolean isTranslucent) { + this.isTranslucent = isTranslucent; + } + + @Override + public boolean isTranslucent() { + return this.isTranslucent; + } + public void setReplacedDuringPlacement(boolean replacedDuringPlacement) { this.replacedDuringPlacement = replacedDuringPlacement; } + + @Override + public boolean hasContainer() { + return this.hasContainer; + } + + public void setHasContainer(boolean hasContainer) { + this.hasContainer = hasContainer; + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleState.java deleted file mode 100644 index 4cc78de9b..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleState.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.world.registry; - -import com.sk89q.worldedit.blocks.BaseBlock; - -import javax.annotation.Nullable; -import java.util.Collections; -import java.util.Map; - -class SimpleState implements State { - - private Byte dataMask; - private Map values; - - @Override - public Map valueMap() { - return Collections.unmodifiableMap(values); - } - - @Nullable - @Override - public StateValue getValue(BaseBlock block) { - for (StateValue value : values.values()) { - if (value.isSet(block)) { - return value; - } - } - - return null; - } - - byte getDataMask() { - return dataMask != null ? dataMask : 0xF; - } - - @Override - public boolean hasDirection() { - for (SimpleStateValue value : values.values()) { - if (value.getDirection() != null) { - return true; - } - } - - return false; - } - - void postDeserialization() { - for (SimpleStateValue v : values.values()) { - v.setState(this); - } - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java index d087b5b28..6b9cafcb5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/Snapshot.java @@ -22,7 +22,14 @@ package com.sk89q.worldedit.world.snapshot; import com.sk89q.worldedit.world.DataException; -import com.sk89q.worldedit.world.storage.*; +import com.sk89q.worldedit.world.storage.ChunkStore; +import com.sk89q.worldedit.world.storage.FileLegacyChunkStore; +import com.sk89q.worldedit.world.storage.FileMcRegionChunkStore; +import com.sk89q.worldedit.world.storage.TrueZipLegacyChunkStore; +import com.sk89q.worldedit.world.storage.TrueZipMcRegionChunkStore; +import com.sk89q.worldedit.world.storage.ZippedLegacyChunkStore; +import com.sk89q.worldedit.world.storage.ZippedMcRegionChunkStore; + import java.io.File; import java.io.IOException; import java.util.Calendar; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotDateParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotDateParser.java index b3d499148..0c1887e37 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotDateParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotDateParser.java @@ -19,10 +19,11 @@ package com.sk89q.worldedit.world.snapshot; -import javax.annotation.Nullable; import java.io.File; import java.util.Calendar; +import javax.annotation.Nullable; + /** * A name parser attempts to make sense of a filename for a snapshot. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRepository.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRepository.java index 0b6ede080..72650a408 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRepository.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRepository.java @@ -23,7 +23,6 @@ package com.sk89q.worldedit.world.snapshot; import com.sk89q.worldedit.world.storage.MissingWorldException; -import javax.annotation.Nullable; import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; @@ -31,13 +30,15 @@ import java.util.Calendar; import java.util.Collections; import java.util.List; +import javax.annotation.Nullable; + /** * A repository contains zero or more snapshots. */ public class SnapshotRepository { protected File dir; - protected List dateParsers = new ArrayList(); + protected List dateParsers = new ArrayList<>(); /** * Create a new instance of a repository. @@ -71,19 +72,16 @@ public class SnapshotRepository { * @return a list of snapshots */ public List getSnapshots(boolean newestFirst, String worldName) throws MissingWorldException { - FilenameFilter filter = new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - File f = new File(dir, name); - return isValidSnapshot(f); - } + FilenameFilter filter = (dir, name) -> { + File f = new File(dir, name); + return isValidSnapshot(f); }; File[] snapshotFiles = dir.listFiles(); if (snapshotFiles == null) { throw new MissingWorldException(worldName); } - List list = new ArrayList(snapshotFiles.length); + List list = new ArrayList<>(snapshotFiles.length); for (File file : snapshotFiles) { if (isValidSnapshot(file)) { @@ -102,7 +100,7 @@ public class SnapshotRepository { } if (newestFirst) { - Collections.sort(list, Collections.reverseOrder()); + list.sort(Collections.reverseOrder()); } else { Collections.sort(list); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java index ca636e007..814818a5c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java @@ -24,14 +24,13 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.chunk.Chunk; import com.sk89q.worldedit.world.storage.ChunkStore; import com.sk89q.worldedit.world.storage.MissingChunkException; -import com.sk89q.worldedit.world.storage.MissingWorldException; import java.io.IOException; import java.util.ArrayList; @@ -44,7 +43,7 @@ import java.util.Map; */ public class SnapshotRestore { - private final Map> neededChunks = new LinkedHashMap>(); + private final Map> neededChunks = new LinkedHashMap<>(); private final ChunkStore chunkStore; private final EditSession editSession; private ArrayList missingChunks; @@ -111,7 +110,7 @@ public class SnapshotRestore { // Unidentified chunk if (!neededChunks.containsKey(chunkPos)) { - neededChunks.put(chunkPos, new ArrayList()); + neededChunks.put(chunkPos, new ArrayList<>()); } neededChunks.get(chunkPos).add(pos); @@ -133,8 +132,8 @@ public class SnapshotRestore { */ public void restore() throws MaxChangedBlocksException { - missingChunks = new ArrayList(); - errorChunks = new ArrayList(); + missingChunks = new ArrayList<>(); + errorChunks = new ArrayList<>(); // Now let's start restoring! for (Map.Entry> entry : neededChunks.entrySet()) { @@ -156,15 +155,9 @@ public class SnapshotRestore { } } catch (MissingChunkException me) { missingChunks.add(chunkPos); - } catch (MissingWorldException me) { + } catch (IOException | DataException me) { errorChunks.add(chunkPos); lastErrorMessage = me.getMessage(); - } catch (DataException de) { - errorChunks.add(chunkPos); - lastErrorMessage = de.getMessage(); - } catch (IOException ioe) { - errorChunks.add(chunkPos); - lastErrorMessage = ioe.getMessage(); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/BlockData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/BlockData.java deleted file mode 100644 index 3df632d76..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/BlockData.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.world.storage; - -import com.sk89q.worldedit.CuboidClipboard.FlipDirection; - -/** - * Block data related classes. - * - * @deprecated use {@link com.sk89q.worldedit.blocks.BlockData} - */ -@Deprecated -public final class BlockData { - - private BlockData() { - } - - /** - * Rotate a block's data value 90 degrees (north->east->south->west->north); - * - * @param type type ID of the block - * @param data data value of the block - * @return a new data value - * @deprecated use {@link com.sk89q.worldedit.blocks.BlockData#rotate90(int, int)} - */ - @Deprecated - public static int rotate90(int type, int data) { - return com.sk89q.worldedit.blocks.BlockData.rotate90(type, data); - } - - /** - * Rotate a block's data value -90 degrees (north<-east<-south<-west<-north); - * - * @param type type ID of the block - * @param data data value of the block - * @return a new data value - * @deprecated use {@link com.sk89q.worldedit.blocks.BlockData#rotate90Reverse(int, int)} - */ - @Deprecated - public static int rotate90Reverse(int type, int data) { - return com.sk89q.worldedit.blocks.BlockData.rotate90Reverse(type, data); - } - - /** - * Flip a block's data value. - * - * @param type type ID of the block - * @param data data value of the block - * @return a new data value - * @deprecated use return {@link com.sk89q.worldedit.blocks.BlockData#flip(int, int)} - */ - @Deprecated - public static int flip(int type, int data) { - return rotate90(type, rotate90(type, data)); - } - - /** - * Flip a block's data value. - * - * @param type type ID of the block - * @param data data value of the block - * @param direction the direction to flip - * @return a new data value - * @deprecated use {@link com.sk89q.worldedit.blocks.BlockData#flip(int, int, FlipDirection)} - */ - @Deprecated - public static int flip(int type, int data, FlipDirection direction) { - return com.sk89q.worldedit.blocks.BlockData.flip(type, data, direction); - } - - /** - * Cycle a block's data value. This usually goes through some rotational pattern - * depending on the block. If it returns -1, it means the id and data specified - * do not have anything to cycle to. - * - * @param type block id to be cycled - * @param data block data value that it starts at - * @param increment whether to go forward (1) or backward (-1) in the cycle - * @return the new data value for the block - * @deprecated use {@link com.sk89q.worldedit.blocks.BlockData#cycle(int, int, int)} - */ - @Deprecated - public static int cycle(int type, int data, int increment) { - return com.sk89q.worldedit.blocks.BlockData.cycle(type, data, increment); - } - - /** - * Returns the data value for the next color of cloth in the rainbow. This - * should not be used if you want to just increment the data value. - * - * @param data the data value - * @return a new data value - * @deprecated use {@link com.sk89q.worldedit.blocks.BlockData#nextClothColor(int)} - */ - @Deprecated - public static int nextClothColor(int data) { - return com.sk89q.worldedit.blocks.BlockData.nextClothColor(data); - } - - /** - * Returns the data value for the previous ext color of cloth in the rainbow. - * This should not be used if you want to just increment the data value. - * - * @param data the data value - * @return a new data value - * @deprecated use {@link com.sk89q.worldedit.blocks.BlockData#prevClothColor(int)} - */ - @Deprecated - public static int prevClothColor(int data) { - return com.sk89q.worldedit.blocks.BlockData.prevClothColor(data); - } - - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java index 57296cc3e..f096496f7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java @@ -30,13 +30,14 @@ import com.sk89q.worldedit.world.chunk.AnvilChunk; import com.sk89q.worldedit.world.chunk.Chunk; import com.sk89q.worldedit.world.chunk.OldChunk; +import java.io.Closeable; import java.io.IOException; import java.util.Map; /** * Represents chunk storage mechanisms. */ -public abstract class ChunkStore { +public abstract class ChunkStore implements Closeable { /** * >> to chunk @@ -86,11 +87,6 @@ public abstract class ChunkStore { return new OldChunk(world, tag); } - /** - * Close resources. - * - * @throws IOException on I/O error - */ public void close() throws IOException { } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java index b46467ea4..568c4615e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.world.storage; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; @@ -80,11 +80,9 @@ public abstract class LegacyChunkStore extends ChunkStore { + "." + Integer.toString(z, 36) + ".dat"; InputStream stream = getInputStream(folder1, folder2, filename); - NBTInputStream nbt = new NBTInputStream( - new GZIPInputStream(stream)); Tag tag; - try { + try (NBTInputStream nbt = new NBTInputStream(new GZIPInputStream(stream))) { tag = nbt.readNamedTag().getTag(); if (!(tag instanceof CompoundTag)) { throw new ChunkStoreException("CompoundTag expected for chunk; got " @@ -112,8 +110,6 @@ public abstract class LegacyChunkStore extends ChunkStore { } return rootTag; - } finally { - nbt.close(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java index f7c5fd691..30b2b42ff 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java @@ -71,10 +71,9 @@ public abstract class McRegionChunkStore extends ChunkStore { McRegionReader reader = getReader(position, world.getName()); InputStream stream = reader.getChunkInputStream(position); - NBTInputStream nbt = new NBTInputStream(stream); Tag tag; - try { + try (NBTInputStream nbt = new NBTInputStream(stream)) { tag = nbt.readNamedTag().getTag(); if (!(tag instanceof CompoundTag)) { throw new ChunkStoreException("CompoundTag expected for chunk; got " + tag.getClass().getName()); @@ -100,8 +99,6 @@ public abstract class McRegionChunkStore extends ChunkStore { } return rootTag; - } finally { - nbt.close(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/NBTConversions.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/NBTConversions.java index ad10929ae..6b61bddf9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/NBTConversions.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/NBTConversions.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.world.storage; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.jnbt.ListTag; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.util.Location; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Utility methods for working with NBT data used in Minecraft. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java index 30c9fa41a..967e456ac 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java @@ -24,11 +24,11 @@ import com.sk89q.worldedit.world.DataException; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.util.Enumeration; import java.util.regex.Pattern; import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipFile; -import java.util.Enumeration; /** * Represents the chunk store used by Minecraft alpha but zipped. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java index b6c7ff569..e8979d06c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java @@ -26,11 +26,11 @@ import com.sk89q.worldedit.world.DataException; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.util.Enumeration; import java.util.regex.Pattern; import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipFile; -import java.util.Enumeration; /** * Represents the chunk store used by Minecraft alpha but zipped. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/weather/WeatherType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/weather/WeatherType.java new file mode 100644 index 000000000..dac65115f --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/weather/WeatherType.java @@ -0,0 +1,57 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.weather; + +import com.sk89q.worldedit.registry.Registry; + +public class WeatherType { + + public static final Registry REGISTRY = new Registry<>("weather type"); + + private String id; + + public WeatherType(String id) { + this.id = id; + } + + public String getId() { + return this.id; + } + + /** + * Gets the name of this weather, or the ID if the name cannot be found. + * + * @return The name, or ID + */ + public String getName() { + return getId(); + } + + @Override + public int hashCode() { + return this.id.hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof WeatherType && this.id.equals(((WeatherType) obj).id); + } + +} diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/BlockChance.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/weather/WeatherTypes.java similarity index 54% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/BlockChance.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/weather/WeatherTypes.java index 35c45a132..1aa1c9f12 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/patterns/BlockChance.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/weather/WeatherTypes.java @@ -17,42 +17,28 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.patterns; +package com.sk89q.worldedit.world.weather; -import com.sk89q.worldedit.blocks.BaseBlock; +import javax.annotation.Nullable; -/** - * @deprecated Will be removed in the future -- there is no replacement - */ -@Deprecated -public class BlockChance { +public class WeatherTypes { - private BaseBlock block; - private double chance; + public static final WeatherType CLEAR = register("clear"); + public static final WeatherType RAIN = register("rain"); + public static final WeatherType THUNDER_STORM = register("thunder_storm"); - /** - * Construct the object. - * - * @param block the block - * @param chance the probability of the block - */ - public BlockChance(BaseBlock block, double chance) { - this.block = block; - this.chance = chance; + private WeatherTypes() { } - /** - * @return the block - */ - public BaseBlock getBlock() { - return block; + private static WeatherType register(final String id) { + return register(new WeatherType(id)); } - /** - * @return the chance - */ - public double getChance() { - return chance; + public static WeatherType register(final WeatherType weatherType) { + return WeatherType.REGISTRY.register(weatherType.getId(), weatherType); } + public static @Nullable WeatherType get(final String id) { + return WeatherType.REGISTRY.get(id); + } } diff --git a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json index ac8fefd48..3e163855a 100644 --- a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json +++ b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json @@ -1,21 +1,365 @@ [ { - "legacyId": 0, + "id": "minecraft:acacia_button", + "localizedName": "Acacia Button", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_door", + "localizedName": "Acacia Door", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_fence", + "localizedName": "Acacia Fence", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_fence_gate", + "localizedName": "Acacia Fence Gate", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_leaves", + "localizedName": "Acacia Leaves", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": true, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_log", + "localizedName": "Acacia Log", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_planks", + "localizedName": "Acacia Planks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_pressure_plate", + "localizedName": "Acacia Pressure Plate", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_sapling", + "localizedName": "Acacia Sapling", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_slab", + "localizedName": "Acacia Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_stairs", + "localizedName": "Acacia Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_trapdoor", + "localizedName": "Acacia Trapdoor", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:acacia_wood", + "localizedName": "Acacia Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:activator_rail", + "localizedName": "Activator Rail", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.7, + "resistance": 0.7, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { "id": "minecraft:air", - "unlocalizedName": "tile.air", "localizedName": "Air", - "states": {}, "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": false, "hardness": 0.0, "resistance": 0.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": false, "movementBlocker": false, @@ -25,305 +369,22 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 1, - "id": "minecraft:stone", - "unlocalizedName": "tile.stone", - "localizedName": "Stone", - "states": { - "variant": { - "dataMask": 7, - "values": { - "stone": { - "data": 0 - }, - "granite": { - "data": 1 - }, - "smooth_granite": { - "data": 2 - }, - "diorite": { - "data": 3 - }, - "smooth_diorite": { - "data": 4 - }, - "andesite": { - "data": 5 - }, - "smooth_andesite": { - "data": 6 - } - } - } - }, + "id": "minecraft:allium", + "localizedName": "Allium", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 1.5, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 2, - "id": "minecraft:grass", - "unlocalizedName": "tile.grass", - "localizedName": "Grass Block", - "states": { - "snowy": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.6, - "resistance": 3.0, - "ticksRandomly": true, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 3, - "id": "minecraft:dirt", - "unlocalizedName": "tile.dirt", - "localizedName": "Dirt", - "states": { - "snowy": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "variant": { - "dataMask": 3, - "values": { - "dirt": { - "data": 0 - }, - "coarse_dirt": { - "data": 1 - }, - "podzol": { - "data": 2 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 4, - "id": "minecraft:cobblestone", - "unlocalizedName": "tile.stonebrick", - "localizedName": "Cobblestone", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 5, - "id": "minecraft:planks", - "unlocalizedName": "tile.wood", - "localizedName": "Wooden Planks", - "states": { - "variant": { - "dataMask": 7, - "values": { - "oak": { - "data": 0 - }, - "spruce": { - "data": 1 - }, - "birch": { - "data": 2 - }, - "jungle": { - "data": 3 - }, - "acacia": { - "data": 4 - }, - "dark_oak": { - "data": 5 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 6, - "id": "minecraft:sapling", - "unlocalizedName": "tile.sapling", - "localizedName": "Oak Sapling", - "states": { - "stage": { - "dataMask": 8, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 8 - } - } - }, - "type": { - "dataMask": 7, - "values": { - "oak": { - "data": 0 - }, - "spruce": { - "data": 1 - }, - "birch": { - "data": 2 - }, - "jungle": { - "data": 3 - }, - "acacia": { - "data": 4 - }, - "dark_oak": { - "data": 5 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, "hardness": 0.0, "resistance": 0.0, - "ticksRandomly": true, + "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": false, "movementBlocker": false, @@ -333,28 +394,197 @@ "toolRequired": false, "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:andesite", + "localizedName": "Andesite", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:anvil", + "localizedName": "Anvil", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 5.0, + "resistance": 1200.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": true, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:attached_melon_stem", + "localizedName": "Attached Melon Stem", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:attached_pumpkin_stem", + "localizedName": "Attached Pumpkin Stem", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:azure_bluet", + "localizedName": "Azure Bluet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:barrier", + "localizedName": "Barrier", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": -1.0, + "resistance": 3600000.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": true, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:beacon", + "localizedName": "Beacon", + "material": { + "powerSource": false, + "lightValue": 15, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true } }, { - "legacyId": 7, "id": "minecraft:bedrock", - "unlocalizedName": "tile.bedrock", "localizedName": "Bedrock", - "states": {}, "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, "hardness": -1.0, - "resistance": 1.8E7, + "resistance": 3600000.0, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -364,1106 +594,22 @@ "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 8, - "id": "minecraft:flowing_water", - "unlocalizedName": "tile.water", - "localizedName": "Water", - "states": { - "level": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, + "id": "minecraft:beetroots", + "localizedName": "Beetroots", "material": { "powerSource": false, - "lightOpacity": 3, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 100.0, - "resistance": 500.0, + "hardness": 0.0, + "resistance": 0.0, "ticksRandomly": true, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": true, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": true, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 9, - "id": "minecraft:water", - "unlocalizedName": "tile.water", - "localizedName": "Water", - "states": { - "level": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 3, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 100.0, - "resistance": 500.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": true, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": true, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 10, - "id": "minecraft:flowing_lava", - "unlocalizedName": "tile.lava", - "localizedName": "Lava", - "states": { - "level": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 15, - "usingNeighborLight": true, - "hardness": 100.0, - "resistance": 500.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": true, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": true, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 11, - "id": "minecraft:lava", - "unlocalizedName": "tile.lava", - "localizedName": "Lava", - "states": { - "level": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 15, - "usingNeighborLight": true, - "hardness": 100.0, - "resistance": 500.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": true, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": true, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 12, - "id": "minecraft:sand", - "unlocalizedName": "tile.sand", - "localizedName": "Sand", - "states": { - "variant": { - "dataMask": 1, - "values": { - "sand": { - "data": 0 - }, - "red_sand": { - "data": 1 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 13, - "id": "minecraft:gravel", - "unlocalizedName": "tile.gravel", - "localizedName": "Gravel", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.6, - "resistance": 3.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 14, - "id": "minecraft:gold_ore", - "unlocalizedName": "tile.oreGold", - "localizedName": "Gold Ore", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 15, - "id": "minecraft:iron_ore", - "unlocalizedName": "tile.oreIron", - "localizedName": "Iron Ore", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 16, - "id": "minecraft:coal_ore", - "unlocalizedName": "tile.oreCoal", - "localizedName": "Coal Ore", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 17, - "id": "minecraft:log", - "unlocalizedName": "tile.log", - "localizedName": "Wood", - "states": { - "axis": { - "dataMask": 12, - "values": { - "x": { - "data": 4 - }, - "y": { - "data": 0 - }, - "z": { - "data": 8 - }, - "none": { - "data": 12 - } - } - }, - "variant": { - "dataMask": 3, - "values": { - "oak": { - "data": 0 - }, - "spruce": { - "data": 1 - }, - "birch": { - "data": 2 - }, - "jungle": { - "data": 3 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 18, - "id": "minecraft:leaves", - "unlocalizedName": "tile.leaves", - "localizedName": "Leaves", - "states": { - "check_decay": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "decayable": { - "dataMask": 4, - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 4 - } - } - }, - "variant": { - "dataMask": 3, - "values": { - "oak": { - "data": 0 - }, - "spruce": { - "data": 1 - }, - "birch": { - "data": 2 - }, - "jungle": { - "data": 3 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 1, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.2, - "resistance": 1.0, - "ticksRandomly": true, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 19, - "id": "minecraft:sponge", - "unlocalizedName": "tile.sponge", - "localizedName": "Sponge", - "states": { - "wet": { - "dataMask": 1, - "values": { - "true": { - "data": 1 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.6, - "resistance": 3.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 20, - "id": "minecraft:glass", - "unlocalizedName": "tile.glass", - "localizedName": "Glass", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.3, - "resistance": 1.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 21, - "id": "minecraft:lapis_ore", - "unlocalizedName": "tile.oreLapis", - "localizedName": "Lapis Lazuli Ore", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 22, - "id": "minecraft:lapis_block", - "unlocalizedName": "tile.blockLapis", - "localizedName": "Lapis Lazuli Block", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 23, - "id": "minecraft:dispenser", - "unlocalizedName": "tile.dispenser", - "localizedName": "Dispenser", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "triggered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.5, - "resistance": 17.5, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 24, - "id": "minecraft:sandstone", - "unlocalizedName": "tile.sandStone", - "localizedName": "Sandstone", - "states": { - "type": { - "dataMask": 3, - "values": { - "sandstone": { - "data": 0 - }, - "chiseled_sandstone": { - "data": 1 - }, - "smooth_sandstone": { - "data": 2 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.8, - "resistance": 4.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 25, - "id": "minecraft:noteblock", - "unlocalizedName": "tile.musicBlock", - "localizedName": "Note Block", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.8, - "resistance": 4.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 26, - "id": "minecraft:bed", - "unlocalizedName": "tile.bed", - "localizedName": "Bed", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "occupied": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "part": { - "dataMask": 8, - "values": { - "head": { - "data": 8 - }, - "foot": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.2, - "resistance": 1.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 27, - "id": "minecraft:golden_rail", - "unlocalizedName": "tile.goldenRail", - "localizedName": "Powered Rail", - "states": { - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "north_south": { - "data": 0 - }, - "east_west": { - "data": 1 - }, - "ascending_east": { - "data": 2 - }, - "ascending_west": { - "data": 3 - }, - "ascending_north": { - "data": 4 - }, - "ascending_south": { - "data": 5 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.7, - "resistance": 3.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": false, "movementBlocker": false, @@ -1473,689 +619,22 @@ "toolRequired": false, "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 28, - "id": "minecraft:detector_rail", - "unlocalizedName": "tile.detectorRail", - "localizedName": "Detector Rail", - "states": { - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "north_south": { - "data": 0 - }, - "east_west": { - "data": 1 - }, - "ascending_east": { - "data": 2 - }, - "ascending_west": { - "data": 3 - }, - "ascending_north": { - "data": 4 - }, - "ascending_south": { - "data": 5 - } - } - } - }, + "id": "minecraft:birch_button", + "localizedName": "Birch Button", "material": { "powerSource": true, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.7, - "resistance": 3.5, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 29, - "id": "minecraft:sticky_piston", - "unlocalizedName": "tile.pistonStickyBase", - "localizedName": "Sticky Piston", - "states": { - "extended": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, "hardness": 0.5, - "resistance": 2.5, + "resistance": 0.5, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": true, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 30, - "id": "minecraft:web", - "unlocalizedName": "tile.web", - "localizedName": "Cobweb", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 1, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 4.0, - "resistance": 20.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 31, - "id": "minecraft:tallgrass", - "unlocalizedName": "tile.tallgrass", - "localizedName": "Grass", - "states": { - "type": { - "dataMask": 3, - "values": { - "dead_bush": { - "data": 0 - }, - "tall_grass": { - "data": 1 - }, - "fern": { - "data": 2 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": true, - "opaque": false, - "replacedDuringPlacement": true, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 32, - "id": "minecraft:deadbush", - "unlocalizedName": "tile.deadbush", - "localizedName": "Dead Bush", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": true, - "opaque": false, - "replacedDuringPlacement": true, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 33, - "id": "minecraft:piston", - "unlocalizedName": "tile.pistonBase", - "localizedName": "Piston", - "states": { - "extended": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": true, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 34, - "id": "minecraft:piston_head", - "unlocalizedName": "tile.pistonBase", - "localizedName": "Piston", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "short": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "type": { - "dataMask": 8, - "values": { - "normal": { - "data": 0 - }, - "sticky": { - "data": 8 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": true, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 35, - "id": "minecraft:wool", - "unlocalizedName": "tile.cloth", - "localizedName": "Wool", - "states": { - "color": { - "dataMask": 15, - "values": { - "white": { - "data": 0 - }, - "orange": { - "data": 1 - }, - "magenta": { - "data": 2 - }, - "light_blue": { - "data": 3 - }, - "yellow": { - "data": 4 - }, - "lime": { - "data": 5 - }, - "pink": { - "data": 6 - }, - "gray": { - "data": 7 - }, - "silver": { - "data": 8 - }, - "cyan": { - "data": 9 - }, - "purple": { - "data": 10 - }, - "blue": { - "data": 11 - }, - "brown": { - "data": 12 - }, - "green": { - "data": 13 - }, - "red": { - "data": 14 - }, - "black": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.8, - "resistance": 4.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 36, - "id": "minecraft:piston_extension", - "unlocalizedName": "tile.null", - "localizedName": "tile.null.name", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "type": { - "dataMask": 8, - "values": { - "normal": { - "data": 0 - }, - "sticky": { - "data": 8 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": -1.0, - "resistance": 0.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": true, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 37, - "id": "minecraft:yellow_flower", - "unlocalizedName": "tile.flower1", - "localizedName": "Flower", - "states": { - "type": { - "values": { - "dandelion": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": false, "movementBlocker": false, @@ -2165,434 +644,22 @@ "toolRequired": false, "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 38, - "id": "minecraft:red_flower", - "unlocalizedName": "tile.flower2", - "localizedName": "Flower", - "states": { - "type": { - "dataMask": 8, - "values": { - "poppy": { - "data": 0 - }, - "blue_orchid": { - "data": 1 - }, - "allium": { - "data": 2 - }, - "houstonia": { - "data": 3 - }, - "red_tulip": { - "data": 4 - }, - "orange_tulip": { - "data": 5 - }, - "white_tulip": { - "data": 6 - }, - "pink_tulip": { - "data": 7 - }, - "oxeye_daisy": { - "data": 8 - } - } - } - }, + "id": "minecraft:birch_door", + "localizedName": "Birch Door", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 39, - "id": "minecraft:brown_mushroom", - "unlocalizedName": "tile.mushroom", - "localizedName": "Mushroom", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 1, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 40, - "id": "minecraft:red_mushroom", - "unlocalizedName": "tile.mushroom", - "localizedName": "Mushroom", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 41, - "id": "minecraft:gold_block", - "unlocalizedName": "tile.blockGold", - "localizedName": "Block of Gold", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, "hardness": 3.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 42, - "id": "minecraft:iron_block", - "unlocalizedName": "tile.blockIron", - "localizedName": "Block of Iron", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 5.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 43, - "id": "minecraft:double_stone_slab", - "unlocalizedName": "tile.stoneSlab", - "localizedName": "Stone Slab", - "states": { - "seamless": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "variant": { - "dataMask": 7, - "values": { - "stone": { - "data": 0 - }, - "sandstone": { - "data": 1 - }, - "wood_old": { - "data": 2 - }, - "cobblestone": { - "data": 3 - }, - "brick": { - "data": 4 - }, - "stone_brick": { - "data": 5 - }, - "nether_brick": { - "data": 6 - }, - "quartz": { - "data": 7 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 44, - "id": "minecraft:stone_slab", - "unlocalizedName": "tile.stoneSlab", - "localizedName": "Stone Slab", - "states": { - "half": { - "dataMask": 8, - "values": { - "top": { - "data": 8 - }, - "bottom": { - "data": 0 - } - } - }, - "variant": { - "dataMask": 7, - "values": { - "stone": { - "data": 0 - }, - "sandstone": { - "data": 1 - }, - "wood_old": { - "data": 2 - }, - "cobblestone": { - "data": 3 - }, - "brick": { - "data": 4 - }, - "stone_brick": { - "data": 5 - }, - "nether_brick": { - "data": 6 - }, - "quartz": { - "data": 7 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 30.0, + "resistance": 3.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 45, - "id": "minecraft:brick_block", - "unlocalizedName": "tile.brick", - "localizedName": "Bricks", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 46, - "id": "minecraft:tnt", - "unlocalizedName": "tile.tnt", - "localizedName": "TNT", - "states": { - "explode": { - "dataMask": 1, - "values": { - "true": { - "data": 1 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 47, - "id": "minecraft:bookshelf", - "unlocalizedName": "tile.bookshelf", - "localizedName": "Bookshelf", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 1.5, - "resistance": 7.5, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -2602,402 +669,122 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 48, - "id": "minecraft:mossy_cobblestone", - "unlocalizedName": "tile.stoneMoss", - "localizedName": "Moss Stone", - "states": {}, + "id": "minecraft:birch_fence", + "localizedName": "Birch Fence", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, "hardness": 2.0, - "resistance": 30.0, + "resistance": 3.0, "ticksRandomly": false, - "fullCube": true, + "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, - "burnable": false, + "burnable": true, "opaque": true, "replacedDuringPlacement": false, - "toolRequired": true, + "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 49, - "id": "minecraft:obsidian", - "unlocalizedName": "tile.obsidian", - "localizedName": "Obsidian", - "states": {}, + "id": "minecraft:birch_fence_gate", + "localizedName": "Birch Fence Gate", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 50.0, - "resistance": 6000.0, + "hardness": 2.0, + "resistance": 3.0, "ticksRandomly": false, - "fullCube": true, + "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, - "burnable": false, + "burnable": true, "opaque": true, "replacedDuringPlacement": false, - "toolRequired": true, + "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 50, - "id": "minecraft:torch", - "unlocalizedName": "tile.torch", - "localizedName": "Torch", - "states": { - "facing": { - "dataMask": 7, - "values": { - "up": { - "data": 5, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 4, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 1, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:birch_leaves", + "localizedName": "Birch Leaves", "material": { "powerSource": false, - "lightOpacity": 0, - "lightValue": 14, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, "ticksRandomly": true, - "fullCube": false, + "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, + "solid": true, + "movementBlocker": true, + "burnable": true, "opaque": false, "replacedDuringPlacement": false, "toolRequired": false, "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 51, - "id": "minecraft:fire", - "unlocalizedName": "tile.fire", - "localizedName": "Fire", - "states": { - "age": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - }, - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "up": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, + "id": "minecraft:birch_log", + "localizedName": "Birch Log", "material": { "powerSource": false, - "lightOpacity": 0, - "lightValue": 15, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": true, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 52, - "id": "minecraft:mob_spawner", - "unlocalizedName": "tile.mobSpawner", - "localizedName": "Monster Spawner", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 5.0, - "resistance": 25.0, + "hardness": 2.0, + "resistance": 2.0, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, - "burnable": false, + "burnable": true, "opaque": true, "replacedDuringPlacement": false, - "toolRequired": true, + "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 53, - "id": "minecraft:oak_stairs", - "unlocalizedName": "tile.stairsWood", - "localizedName": "Oak Wood Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, + "id": "minecraft:birch_planks", + "localizedName": "Birch Planks", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": true, "hardness": 2.0, - "resistance": 15.0, + "resistance": 3.0, "ticksRandomly": false, - "fullCube": false, + "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -3007,296 +794,22 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 54, - "id": "minecraft:chest", - "unlocalizedName": "tile.chest", - "localizedName": "Chest", - "states": { - "facing": { - "dataMask": 7, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.5, - "resistance": 12.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 55, - "id": "minecraft:redstone_wire", - "unlocalizedName": "tile.redstoneDust", - "localizedName": "Redstone Dust", - "states": { - "east": { - "values": { - "up": { - "data": 0 - }, - "side": { - "data": 0 - }, - "none": { - "data": 0 - } - } - }, - "north": { - "values": { - "up": { - "data": 0 - }, - "side": { - "data": 0 - }, - "none": { - "data": 0 - } - } - }, - "power": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - }, - "south": { - "values": { - "up": { - "data": 0 - }, - "side": { - "data": 0 - }, - "none": { - "data": 0 - } - } - }, - "west": { - "values": { - "up": { - "data": 0 - }, - "side": { - "data": 0 - }, - "none": { - "data": 0 - } - } - } - }, + "id": "minecraft:birch_pressure_plate", + "localizedName": "Birch Pressure Plate", "material": { "powerSource": true, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, + "hardness": 0.5, + "resistance": 0.5, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 56, - "id": "minecraft:diamond_ore", - "unlocalizedName": "tile.oreDiamond", - "localizedName": "Diamond Ore", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 57, - "id": "minecraft:diamond_block", - "unlocalizedName": "tile.blockDiamond", - "localizedName": "Block of Diamond", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 5.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 58, - "id": "minecraft:crafting_table", - "unlocalizedName": "tile.workbench", - "localizedName": "Crafting Table", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 2.5, - "resistance": 12.5, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -3306,58 +819,22 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 59, - "id": "minecraft:wheat", - "unlocalizedName": "tile.crops", - "localizedName": "Crops", - "states": { - "age": { - "dataMask": 7, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - } - } - } - }, + "id": "minecraft:birch_sapling", + "localizedName": "Birch Sapling", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, "hardness": 0.0, "resistance": 0.0, "ticksRandomly": true, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": false, "movementBlocker": false, @@ -3367,281 +844,122 @@ "toolRequired": false, "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 60, - "id": "minecraft:farmland", - "unlocalizedName": "tile.farmland", - "localizedName": "Farmland", - "states": { - "moisture": { - "dataMask": 7, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - } - } - } - }, + "id": "minecraft:birch_slab", + "localizedName": "Birch Slab", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.6, + "hardness": 2.0, "resistance": 3.0, - "ticksRandomly": true, + "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, - "burnable": false, + "burnable": true, "opaque": true, "replacedDuringPlacement": false, "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 61, - "id": "minecraft:furnace", - "unlocalizedName": "tile.furnace", - "localizedName": "Furnace", - "states": { - "facing": { - "dataMask": 7, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:birch_stairs", + "localizedName": "Birch Stairs", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.5, - "resistance": 17.5, + "hardness": 2.0, + "resistance": 3.0, "ticksRandomly": false, - "fullCube": true, + "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, - "burnable": false, + "burnable": true, "opaque": true, "replacedDuringPlacement": false, - "toolRequired": true, + "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 62, - "id": "minecraft:lit_furnace", - "unlocalizedName": "tile.furnace", - "localizedName": "Furnace", - "states": { - "facing": { - "dataMask": 7, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:birch_trapdoor", + "localizedName": "Birch Trapdoor", "material": { "powerSource": false, - "lightOpacity": 255, - "lightValue": 13, - "usingNeighborLight": false, - "hardness": 3.5, - "resistance": 17.5, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, "ticksRandomly": false, - "fullCube": true, + "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, - "burnable": false, + "burnable": true, "opaque": true, "replacedDuringPlacement": false, - "toolRequired": true, + "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 63, - "id": "minecraft:standing_sign", - "unlocalizedName": "tile.sign", - "localizedName": "Sign", - "states": { - "rotation": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, + "id": "minecraft:birch_wood", + "localizedName": "Birch Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:black_banner", + "localizedName": "Black Banner", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, "hardness": 1.0, - "resistance": 5.0, + "resistance": 1.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -3651,108 +969,22 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true } }, { - "legacyId": 64, - "id": "minecraft:wooden_door", - "unlocalizedName": "tile.doorOak", - "localizedName": "Oak Door", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 1, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 8, - "values": { - "upper": { - "data": 8 - }, - "lower": { - "data": 0 - } - } - }, - "hinge": { - "values": { - "left": { - "data": 0 - }, - "right": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, + "id": "minecraft:black_bed", + "localizedName": "Black Bed", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 3.0, - "resistance": 15.0, + "hardness": 0.2, + "resistance": 0.2, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -3762,233 +994,122 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 65, - "id": "minecraft:ladder", - "unlocalizedName": "tile.ladder", - "localizedName": "Ladder", - "states": { - "facing": { - "dataMask": 7, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:black_carpet", + "localizedName": "Black Carpet", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.4, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:black_concrete", + "localizedName": "Black Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:black_concrete_powder", + "localizedName": "Black Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:black_glazed_terracotta", + "localizedName": "Black Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:black_shulker_box", + "localizedName": "Black Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, "resistance": 2.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 66, - "id": "minecraft:rail", - "unlocalizedName": "tile.rail", - "localizedName": "Rail", - "states": { - "shape": { - "dataMask": 12, - "values": { - "north_south": { - "data": 0 - }, - "east_west": { - "data": 1 - }, - "ascending_east": { - "data": 2 - }, - "ascending_west": { - "data": 3 - }, - "ascending_north": { - "data": 4 - }, - "ascending_south": { - "data": 5 - }, - "south_east": { - "data": 6 - }, - "south_west": { - "data": 7 - }, - "north_west": { - "data": 8 - }, - "north_east": { - "data": 9 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.7, - "resistance": 3.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 67, - "id": "minecraft:stone_stairs", - "unlocalizedName": "tile.stairsStone", - "localizedName": "Cobblestone Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -3998,66 +1119,97 @@ "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true } }, { - "legacyId": 68, - "id": "minecraft:wall_sign", - "unlocalizedName": "tile.sign", - "localizedName": "Sign", - "states": { - "facing": { - "dataMask": 7, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:black_stained_glass", + "localizedName": "Black Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:black_stained_glass_pane", + "localizedName": "Black Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:black_terracotta", + "localizedName": "Black Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:black_wall_banner", + "localizedName": "Air", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, "hardness": 1.0, - "resistance": 5.0, + "resistance": 1.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -4067,266 +1219,22 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true } }, { - "legacyId": 69, - "id": "minecraft:lever", - "unlocalizedName": "tile.lever", - "localizedName": "Lever", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down_x": { - "data": 0 - }, - "east": { - "data": 1 - }, - "west": { - "data": 2 - }, - "south": { - "data": 3 - }, - "north": { - "data": 4 - }, - "up_z": { - "data": 5 - }, - "up_x": { - "data": 6 - }, - "down_z": { - "data": 7 - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 70, - "id": "minecraft:stone_pressure_plate", - "unlocalizedName": "tile.pressurePlateStone", - "localizedName": "Stone Pressure Plate", - "states": { - "powered": { - "dataMask": 1, - "values": { - "true": { - "data": 1 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 71, - "id": "minecraft:iron_door", - "unlocalizedName": "tile.doorIron", - "localizedName": "Iron Door", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 1, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 8, - "values": { - "upper": { - "data": 8 - }, - "lower": { - "data": 0 - } - } - }, - "hinge": { - "values": { - "left": { - "data": 0 - }, - "right": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, + "id": "minecraft:black_wool", + "localizedName": "Black Wool", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 5.0, - "resistance": 25.0, + "hardness": 0.8, + "resistance": 0.8, "ticksRandomly": false, - "fullCube": false, + "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 72, - "id": "minecraft:wooden_pressure_plate", - "unlocalizedName": "tile.pressurePlateWood", - "localizedName": "Wooden Pressure Plate", - "states": { - "powered": { - "dataMask": 1, - "values": { - "true": { - "data": 1 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -4336,401 +1244,3847 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 73, - "id": "minecraft:redstone_ore", - "unlocalizedName": "tile.oreRedstone", - "localizedName": "Redstone Ore", - "states": {}, + "id": "minecraft:blue_banner", + "localizedName": "Blue Banner", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.0, - "resistance": 15.0, + "hardness": 1.0, + "resistance": 1.0, "ticksRandomly": false, - "fullCube": true, + "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, - "burnable": false, + "burnable": true, "opaque": true, "replacedDuringPlacement": false, - "toolRequired": true, + "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true } }, { - "legacyId": 74, - "id": "minecraft:lit_redstone_ore", - "unlocalizedName": "tile.oreRedstone", - "localizedName": "Redstone Ore", - "states": {}, + "id": "minecraft:blue_bed", + "localizedName": "Blue Bed", "material": { "powerSource": false, - "lightOpacity": 255, - "lightValue": 9, - "usingNeighborLight": false, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": true, - "fullCube": true, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, - "burnable": false, + "burnable": true, "opaque": true, "replacedDuringPlacement": false, - "toolRequired": true, + "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 75, - "id": "minecraft:unlit_redstone_torch", - "unlocalizedName": "tile.notGate", - "localizedName": "Redstone Torch", - "states": { - "facing": { - "dataMask": 7, - "values": { - "up": { - "data": 5, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 4, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 1, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 76, - "id": "minecraft:redstone_torch", - "unlocalizedName": "tile.notGate", - "localizedName": "Redstone Torch", - "states": { - "facing": { - "dataMask": 7, - "values": { - "up": { - "data": 5, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 4, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 1, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 7, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 77, - "id": "minecraft:stone_button", - "unlocalizedName": "tile.button", - "localizedName": "Button", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 5, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 4, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 1, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 78, - "id": "minecraft:snow_layer", - "unlocalizedName": "tile.snow", - "localizedName": "Snow", - "states": { - "layers": { - "dataMask": 7, - "values": { - "1": { - "data": 0 - }, - "2": { - "data": 1 - }, - "3": { - "data": 2 - }, - "4": { - "data": 3 - }, - "5": { - "data": 4 - }, - "6": { - "data": 5 - }, - "7": { - "data": 6 - }, - "8": { - "data": 7 - } - } - } - }, + "id": "minecraft:blue_carpet", + "localizedName": "Blue Carpet", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:blue_concrete", + "localizedName": "Blue Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:blue_concrete_powder", + "localizedName": "Blue Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:blue_glazed_terracotta", + "localizedName": "Blue Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:blue_ice", + "localizedName": "Blue Ice", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.8, + "resistance": 2.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.989, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a0a0ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:blue_orchid", + "localizedName": "Blue Orchid", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:blue_shulker_box", + "localizedName": "Blue Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:blue_stained_glass", + "localizedName": "Blue Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:blue_stained_glass_pane", + "localizedName": "Blue Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:blue_terracotta", + "localizedName": "Blue Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:blue_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:blue_wool", + "localizedName": "Blue Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:bone_block", + "localizedName": "Bone Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:bookshelf", + "localizedName": "Bookshelf", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 1.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brain_coral", + "localizedName": "Brain Coral", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brain_coral_block", + "localizedName": "Brain Coral Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brain_coral_fan", + "localizedName": "Brain Coral Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brain_coral_wall_fan", + "localizedName": "Brain Coral Wall Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brewing_stand", + "localizedName": "Brewing Stand", + "material": { + "powerSource": false, + "lightValue": 1, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:brick_slab", + "localizedName": "Brick Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brick_stairs", + "localizedName": "Brick Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:bricks", + "localizedName": "Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brown_banner", + "localizedName": "Brown Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:brown_bed", + "localizedName": "Brown Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brown_carpet", + "localizedName": "Brown Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brown_concrete", + "localizedName": "Brown Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brown_concrete_powder", + "localizedName": "Brown Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brown_glazed_terracotta", + "localizedName": "Brown Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brown_mushroom", + "localizedName": "Brown Mushroom", + "material": { + "powerSource": false, + "lightValue": 1, + "hardness": 0.0, + "resistance": 0.0, "ticksRandomly": true, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brown_mushroom_block", + "localizedName": "Brown Mushroom Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brown_shulker_box", + "localizedName": "Brown Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:brown_stained_glass", + "localizedName": "Brown Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brown_stained_glass_pane", + "localizedName": "Brown Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brown_terracotta", + "localizedName": "Brown Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:brown_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:brown_wool", + "localizedName": "Brown Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:bubble_column", + "localizedName": "Bubble Column", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": true, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:bubble_coral", + "localizedName": "Bubble Coral", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:bubble_coral_block", + "localizedName": "Bubble Coral Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:bubble_coral_fan", + "localizedName": "Bubble Coral Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:bubble_coral_wall_fan", + "localizedName": "Bubble Coral Wall Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cactus", + "localizedName": "Cactus", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.4, + "resistance": 0.4, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cake", + "localizedName": "Cake", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:carrots", + "localizedName": "Carrots", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:carved_pumpkin", + "localizedName": "Carved Pumpkin", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cauldron", + "localizedName": "Cauldron", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cave_air", + "localizedName": "Cave Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, "liquid": false, "solid": false, "movementBlocker": false, "burnable": false, "opaque": false, "replacedDuringPlacement": true, - "toolRequired": true, - "fragileWhenPushed": true, + "toolRequired": false, + "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 79, - "id": "minecraft:ice", - "unlocalizedName": "tile.ice", - "localizedName": "Ice", - "states": {}, + "id": "minecraft:chain_command_block", + "localizedName": "Chain Command Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": -1.0, + "resistance": 3600000.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:chest", + "localizedName": "Chest", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.5, + "resistance": 2.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:chipped_anvil", + "localizedName": "Chipped Anvil", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 5.0, + "resistance": 1200.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": true, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:chiseled_quartz_block", + "localizedName": "Chiseled Quartz Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:chiseled_red_sandstone", + "localizedName": "Chiseled Red Sandstone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:chiseled_sandstone", + "localizedName": "Chiseled Sandstone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:chiseled_stone_bricks", + "localizedName": "Chiseled Stone Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:chorus_flower", + "localizedName": "Chorus Flower", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.4, + "resistance": 0.4, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:chorus_plant", + "localizedName": "Chorus Plant", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.4, + "resistance": 0.4, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:clay", + "localizedName": "Clay", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.6, + "resistance": 0.6, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a4a8b8", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:coal_block", + "localizedName": "Block of Coal", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 5.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:coal_ore", + "localizedName": "Coal Ore", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:coarse_dirt", + "localizedName": "Coarse Dirt", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#976d4d", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cobblestone", + "localizedName": "Cobblestone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cobblestone_slab", + "localizedName": "Cobblestone Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cobblestone_stairs", + "localizedName": "Cobblestone Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cobblestone_wall", + "localizedName": "Cobblestone Wall", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cobweb", + "localizedName": "Cobweb", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 4.0, + "resistance": 4.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cocoa", + "localizedName": "Cocoa", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 3.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:command_block", + "localizedName": "Command Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": -1.0, + "resistance": 3600000.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:comparator", + "localizedName": "Redstone Comparator", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:conduit", + "localizedName": "Conduit", + "material": { + "powerSource": false, + "lightValue": 15, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:cracked_stone_bricks", + "localizedName": "Cracked Stone Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:crafting_table", + "localizedName": "Crafting Table", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.5, + "resistance": 2.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:creeper_head", + "localizedName": "Creeper Head", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:creeper_wall_head", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:cut_red_sandstone", + "localizedName": "Cut Red Sandstone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cut_sandstone", + "localizedName": "Cut Sandstone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cyan_banner", + "localizedName": "Cyan Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:cyan_bed", + "localizedName": "Cyan Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cyan_carpet", + "localizedName": "Cyan Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cyan_concrete", + "localizedName": "Cyan Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cyan_concrete_powder", + "localizedName": "Cyan Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cyan_glazed_terracotta", + "localizedName": "Cyan Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cyan_shulker_box", + "localizedName": "Cyan Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:cyan_stained_glass", + "localizedName": "Cyan Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cyan_stained_glass_pane", + "localizedName": "Cyan Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cyan_terracotta", + "localizedName": "Cyan Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:cyan_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:cyan_wool", + "localizedName": "Cyan Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:damaged_anvil", + "localizedName": "Damaged Anvil", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 5.0, + "resistance": 1200.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": true, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dandelion", + "localizedName": "Dandelion", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_button", + "localizedName": "Dark Oak Button", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_door", + "localizedName": "Dark Oak Door", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_fence", + "localizedName": "Dark Oak Fence", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_fence_gate", + "localizedName": "Dark Oak Fence Gate", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_leaves", + "localizedName": "Dark Oak Leaves", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": true, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_log", + "localizedName": "Dark Oak Log", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_planks", + "localizedName": "Dark Oak Planks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_pressure_plate", + "localizedName": "Dark Oak Pressure Plate", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_sapling", + "localizedName": "Dark Oak Sapling", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_slab", + "localizedName": "Dark Oak Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_stairs", + "localizedName": "Dark Oak Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_trapdoor", + "localizedName": "Dark Oak Trapdoor", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_oak_wood", + "localizedName": "Dark Oak Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_prismarine", + "localizedName": "Dark Prismarine", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_prismarine_slab", + "localizedName": "Dark Prismarine Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dark_prismarine_stairs", + "localizedName": "Dark Prismarine Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:daylight_detector", + "localizedName": "Daylight Detector", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:dead_brain_coral_block", + "localizedName": "Dead Brain Coral Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_brain_coral_fan", + "localizedName": "Dead Brain Coral Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_brain_coral_wall_fan", + "localizedName": "Dead Brain Coral Wall Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_bubble_coral_block", + "localizedName": "Dead Bubble Coral Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_bubble_coral_fan", + "localizedName": "Dead Bubble Coral Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_bubble_coral_wall_fan", + "localizedName": "Dead Bubble Coral Wall Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_bush", + "localizedName": "Dead Bush", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_fire_coral_block", + "localizedName": "Dead Fire Coral Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_fire_coral_fan", + "localizedName": "Dead Fire Coral Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_fire_coral_wall_fan", + "localizedName": "Dead Fire Coral Wall Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_horn_coral_block", + "localizedName": "Dead Horn Coral Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_horn_coral_fan", + "localizedName": "Dead Horn Coral Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_horn_coral_wall_fan", + "localizedName": "Dead Horn Coral Wall Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_tube_coral_block", + "localizedName": "Dead Tube Coral Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_tube_coral_fan", + "localizedName": "Dead Tube Coral Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dead_tube_coral_wall_fan", + "localizedName": "Dead Tube Coral Wall Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:detector_rail", + "localizedName": "Detector Rail", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.7, + "resistance": 0.7, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:diamond_block", + "localizedName": "Block of Diamond", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 5.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:diamond_ore", + "localizedName": "Diamond Ore", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:diorite", + "localizedName": "Diorite", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dirt", + "localizedName": "Dirt", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#976d4d", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dispenser", + "localizedName": "Dispenser", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.5, + "resistance": 3.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:dragon_egg", + "localizedName": "Dragon Egg", + "material": { + "powerSource": false, + "lightValue": 1, + "hardness": 3.0, + "resistance": 9.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dragon_head", + "localizedName": "Dragon Head", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:dragon_wall_head", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:dried_kelp_block", + "localizedName": "Dried Kelp Block", "material": { "powerSource": false, - "lightOpacity": 3, "lightValue": 0, - "usingNeighborLight": false, "hardness": 0.5, "resistance": 2.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#7fb238", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:dropper", + "localizedName": "Dropper", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.5, + "resistance": 3.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:emerald_block", + "localizedName": "Block of Emerald", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 5.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:emerald_ore", + "localizedName": "Emerald Ore", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:enchanting_table", + "localizedName": "Enchanting Table", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 5.0, + "resistance": 1200.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:end_gateway", + "localizedName": "End Gateway", + "material": { + "powerSource": false, + "lightValue": 15, + "hardness": -1.0, + "resistance": 3600000.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": true, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:end_portal", + "localizedName": "End Portal", + "material": { + "powerSource": false, + "lightValue": 15, + "hardness": -1.0, + "resistance": 3600000.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": true, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:end_portal_frame", + "localizedName": "End Portal Frame", + "material": { + "powerSource": false, + "lightValue": 1, + "hardness": -1.0, + "resistance": 3600000.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:end_rod", + "localizedName": "End Rod", + "material": { + "powerSource": false, + "lightValue": 14, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:end_stone", + "localizedName": "End Stone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 9.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:end_stone_bricks", + "localizedName": "End Stone Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:ender_chest", + "localizedName": "Ender Chest", + "material": { + "powerSource": false, + "lightValue": 7, + "hardness": 22.5, + "resistance": 600.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:farmland", + "localizedName": "Farmland", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.6, + "resistance": 0.6, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#976d4d", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:fern", + "localizedName": "Fern", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:fire", + "localizedName": "Fire", + "material": { + "powerSource": false, + "lightValue": 15, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:fire_coral", + "localizedName": "Fire Coral", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:fire_coral_block", + "localizedName": "Fire Coral Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:fire_coral_fan", + "localizedName": "Fire Coral Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:fire_coral_wall_fan", + "localizedName": "Fire Coral Wall Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:flower_pot", + "localizedName": "Flower Pot", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:frosted_ice", + "localizedName": "Frosted Ice", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, "ticksRandomly": true, "fullCube": true, "slipperiness": 0.98, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -4740,28 +5094,22 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#a0a0ff", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 80, - "id": "minecraft:snow", - "unlocalizedName": "tile.snow", - "localizedName": "Snow", - "states": {}, + "id": "minecraft:furnace", + "localizedName": "Furnace", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.2, - "resistance": 1.0, - "ticksRandomly": true, + "hardness": 3.5, + "resistance": 3.5, + "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -4771,82 +5119,22 @@ "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": true } }, { - "legacyId": 81, - "id": "minecraft:cactus", - "unlocalizedName": "tile.cactus", - "localizedName": "Cactus", - "states": { - "age": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, + "id": "minecraft:glass", + "localizedName": "Glass", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.4, - "resistance": 2.0, - "ticksRandomly": true, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -4854,330 +5142,99 @@ "opaque": false, "replacedDuringPlacement": false, "toolRequired": false, - "fragileWhenPushed": true, + "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 82, - "id": "minecraft:clay", - "unlocalizedName": "tile.clay", - "localizedName": "Clay", - "states": {}, + "id": "minecraft:glass_pane", + "localizedName": "Glass Pane", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.6, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:glowstone", + "localizedName": "Glowstone", + "material": { + "powerSource": false, + "lightValue": 15, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:gold_block", + "localizedName": "Block of Gold", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:gold_ore", + "localizedName": "Gold Ore", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, "resistance": 3.0, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 83, - "id": "minecraft:reeds", - "unlocalizedName": "tile.reeds", - "localizedName": "Sugar cane", - "states": { - "age": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 84, - "id": "minecraft:jukebox", - "unlocalizedName": "tile.jukebox", - "localizedName": "Jukebox", - "states": { - "has_record": { - "dataMask": 1, - "values": { - "true": { - "data": 1 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 85, - "id": "minecraft:fence", - "unlocalizedName": "tile.fence", - "localizedName": "Oak Fence", - "states": { - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 86, - "id": "minecraft:pumpkin", - "unlocalizedName": "tile.pumpkin", - "localizedName": "Pumpkin", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 1.0, - "resistance": 5.0, - "ticksRandomly": true, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 87, - "id": "minecraft:netherrack", - "unlocalizedName": "tile.hellrock", - "localizedName": "Netherrack", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.4, - "resistance": 2.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -5187,701 +5244,22 @@ "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 88, - "id": "minecraft:soul_sand", - "unlocalizedName": "tile.hellsand", - "localizedName": "Soul Sand", - "states": {}, + "id": "minecraft:granite", + "localizedName": "Granite", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 89, - "id": "minecraft:glowstone", - "unlocalizedName": "tile.lightgem", - "localizedName": "Glowstone", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 15, - "usingNeighborLight": false, - "hardness": 0.3, - "resistance": 1.5, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 90, - "id": "minecraft:portal", - "unlocalizedName": "tile.portal", - "localizedName": "Portal", - "states": { - "axis": { - "dataMask": 1, - "values": { - "x": { - "data": 1 - }, - "z": { - "data": 2 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 11, - "usingNeighborLight": true, - "hardness": -1.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": true, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 91, - "id": "minecraft:lit_pumpkin", - "unlocalizedName": "tile.litpumpkin", - "localizedName": "Jack o\u0027Lantern", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 15, - "usingNeighborLight": false, - "hardness": 1.0, - "resistance": 5.0, - "ticksRandomly": true, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 92, - "id": "minecraft:cake", - "unlocalizedName": "tile.cake", - "localizedName": "Cake", - "states": { - "bites": { - "dataMask": 7, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 93, - "id": "minecraft:unpowered_repeater", - "unlocalizedName": "tile.diode", - "localizedName": "Redstone Repeater", - "states": { - "delay": { - "dataMask": 12, - "values": { - "1": { - "data": 0 - }, - "2": { - "data": 4 - }, - "3": { - "data": 8 - }, - "4": { - "data": 12 - } - } - }, - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "locked": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 94, - "id": "minecraft:powered_repeater", - "unlocalizedName": "tile.diode", - "localizedName": "Redstone Repeater", - "states": { - "delay": { - "dataMask": 12, - "values": { - "1": { - "data": 0 - }, - "2": { - "data": 4 - }, - "3": { - "data": 8 - }, - "4": { - "data": 12 - } - } - }, - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "locked": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 95, - "id": "minecraft:stained_glass", - "unlocalizedName": "tile.stainedGlass", - "localizedName": "Stained Glass", - "states": { - "color": { - "dataMask": 15, - "values": { - "white": { - "data": 0 - }, - "orange": { - "data": 1 - }, - "magenta": { - "data": 2 - }, - "light_blue": { - "data": 3 - }, - "yellow": { - "data": 4 - }, - "lime": { - "data": 5 - }, - "pink": { - "data": 6 - }, - "gray": { - "data": 7 - }, - "silver": { - "data": 8 - }, - "cyan": { - "data": 9 - }, - "purple": { - "data": 10 - }, - "blue": { - "data": 11 - }, - "brown": { - "data": 12 - }, - "green": { - "data": 13 - }, - "red": { - "data": 14 - }, - "black": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.3, - "resistance": 1.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 96, - "id": "minecraft:trapdoor", - "unlocalizedName": "tile.trapdoor", - "localizedName": "Wooden Trapdoor", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 0, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 1, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 8, - "values": { - "top": { - "data": 8 - }, - "bottom": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 97, - "id": "minecraft:monster_egg", - "unlocalizedName": "tile.monsterStoneEgg", - "localizedName": "Stone Monster Egg", - "states": { - "variant": { - "dataMask": 7, - "values": { - "stone": { - "data": 0 - }, - "cobblestone": { - "data": 1 - }, - "stone_brick": { - "data": 2 - }, - "mossy_brick": { - "data": 3 - }, - "cracked_brick": { - "data": 4 - }, - "chiseled_brick": { - "data": 5 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.75, - "resistance": 3.75, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 98, - "id": "minecraft:stonebrick", - "unlocalizedName": "tile.stonebricksmooth", - "localizedName": "Stone Bricks", - "states": { - "variant": { - "dataMask": 3, - "values": { - "stonebrick": { - "data": 0 - }, - "mossy_stonebrick": { - "data": 1 - }, - "cracked_stonebrick": { - "data": 2 - }, - "chiseled_stonebrick": { - "data": 3 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, "hardness": 1.5, - "resistance": 30.0, + "resistance": 6.0, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -5891,621 +5269,22 @@ "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 99, - "id": "minecraft:brown_mushroom_block", - "unlocalizedName": "tile.mushroom", - "localizedName": "Mushroom", - "states": { - "variant": { - "dataMask": 15, - "values": { - "north_west": { - "data": 1 - }, - "north": { - "data": 2 - }, - "north_east": { - "data": 3 - }, - "west": { - "data": 4 - }, - "center": { - "data": 5 - }, - "east": { - "data": 6 - }, - "south_west": { - "data": 7 - }, - "south": { - "data": 8 - }, - "south_east": { - "data": 9 - }, - "stem": { - "data": 10 - }, - "all_inside": { - "data": 0 - }, - "all_outside": { - "data": 14 - }, - "all_stem": { - "data": 15 - } - } - } - }, + "id": "minecraft:grass", + "localizedName": "Grass", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.2, - "resistance": 1.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 100, - "id": "minecraft:red_mushroom_block", - "unlocalizedName": "tile.mushroom", - "localizedName": "Mushroom", - "states": { - "variant": { - "dataMask": 15, - "values": { - "north_west": { - "data": 1 - }, - "north": { - "data": 2 - }, - "north_east": { - "data": 3 - }, - "west": { - "data": 4 - }, - "center": { - "data": 5 - }, - "east": { - "data": 6 - }, - "south_west": { - "data": 7 - }, - "south": { - "data": 8 - }, - "south_east": { - "data": 9 - }, - "stem": { - "data": 10 - }, - "all_inside": { - "data": 0 - }, - "all_outside": { - "data": 14 - }, - "all_stem": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.2, - "resistance": 1.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 101, - "id": "minecraft:iron_bars", - "unlocalizedName": "tile.fenceIron", - "localizedName": "Iron Bars", - "states": { - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 5.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 102, - "id": "minecraft:glass_pane", - "unlocalizedName": "tile.thinGlass", - "localizedName": "Glass Pane", - "states": { - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.3, - "resistance": 1.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 103, - "id": "minecraft:melon_block", - "unlocalizedName": "tile.melon", - "localizedName": "Melon", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 1.0, - "resistance": 5.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 104, - "id": "minecraft:pumpkin_stem", - "unlocalizedName": "tile.pumpkinStem", - "localizedName": "Pumpkin Stem", - "states": { - "age": { - "dataMask": 7, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - } - } - }, - "facing": { - "dataMask": 7, - "values": { - "up": { - "data": 0, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 0, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 0, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, "hardness": 0.0, "resistance": 0.0, - "ticksRandomly": true, + "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 105, - "id": "minecraft:melon_stem", - "unlocalizedName": "tile.pumpkinStem", - "localizedName": "Pumpkin Stem", - "states": { - "age": { - "dataMask": 7, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - } - } - }, - "facing": { - "dataMask": 7, - "values": { - "up": { - "data": 0, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 0, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 0, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 106, - "id": "minecraft:vine", - "unlocalizedName": "tile.vine", - "localizedName": "Vines", - "states": { - "east": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "dataMask": 1, - "values": { - "true": { - "data": 1 - }, - "false": { - "data": 0 - } - } - }, - "up": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 2 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.2, - "resistance": 1.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": false, "movementBlocker": false, @@ -6515,340 +5294,22 @@ "toolRequired": false, "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 107, - "id": "minecraft:fence_gate", - "unlocalizedName": "tile.fenceGate", - "localizedName": "Oak Fence Gate", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "in_wall": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, + "id": "minecraft:grass_block", + "localizedName": "Grass Block", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 108, - "id": "minecraft:brick_stairs", - "unlocalizedName": "tile.stairsBrick", - "localizedName": "Brick Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 109, - "id": "minecraft:stone_brick_stairs", - "unlocalizedName": "tile.stairsStoneBrickSmooth", - "localizedName": "Stone Brick Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 1.5, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 110, - "id": "minecraft:mycelium", - "unlocalizedName": "tile.mycel", - "localizedName": "Mycelium", - "states": { - "snowy": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, "hardness": 0.6, - "resistance": 3.0, + "resistance": 0.6, "ticksRandomly": true, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -6858,628 +5319,47 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#7fb238", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 111, - "id": "minecraft:waterlily", - "unlocalizedName": "tile.waterlily", - "localizedName": "Lily Pad", - "states": {}, + "id": "minecraft:grass_path", + "localizedName": "Grass Path", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, + "hardness": 0.65, + "resistance": 0.65, + "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, - "solid": false, - "movementBlocker": false, + "solid": true, + "movementBlocker": true, "burnable": false, - "opaque": false, + "opaque": true, "replacedDuringPlacement": false, "toolRequired": false, - "fragileWhenPushed": true, + "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#976d4d", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 112, - "id": "minecraft:nether_brick", - "unlocalizedName": "tile.netherBrick", - "localizedName": "Nether Brick", - "states": {}, + "id": "minecraft:gravel", + "localizedName": "Gravel", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 2.0, - "resistance": 30.0, + "hardness": 0.6, + "resistance": 0.6, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 113, - "id": "minecraft:nether_brick_fence", - "unlocalizedName": "tile.netherFence", - "localizedName": "Nether Brick Fence", - "states": { - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 114, - "id": "minecraft:nether_brick_stairs", - "unlocalizedName": "tile.stairsNetherBrick", - "localizedName": "Nether Brick Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 115, - "id": "minecraft:nether_wart", - "unlocalizedName": "tile.netherStalk", - "localizedName": "Nether Wart", - "states": { - "age": { - "dataMask": 3, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 116, - "id": "minecraft:enchanting_table", - "unlocalizedName": "tile.enchantmentTable", - "localizedName": "Enchantment Table", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 5.0, - "resistance": 6000.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 117, - "id": "minecraft:brewing_stand", - "unlocalizedName": "tile.brewingStand", - "localizedName": "Brewing Stand", - "states": { - "has_bottle_0": { - "dataMask": 1, - "values": { - "true": { - "data": 1 - }, - "false": { - "data": 0 - } - } - }, - "has_bottle_1": { - "values": { - "true": { - "data": 2 - }, - "false": { - "data": 0 - } - } - }, - "has_bottle_2": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 1, - "usingNeighborLight": true, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 118, - "id": "minecraft:cauldron", - "unlocalizedName": "tile.cauldron", - "localizedName": "Cauldron", - "states": { - "level": { - "dataMask": 3, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 119, - "id": "minecraft:end_portal", - "unlocalizedName": "tile.null", - "localizedName": "tile.null.name", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 15, - "usingNeighborLight": true, - "hardness": -1.0, - "resistance": 1.8E7, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": true, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 120, - "id": "minecraft:end_portal_frame", - "unlocalizedName": "tile.endPortalFrame", - "localizedName": "End Portal", - "states": { - "eye": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 1, - "usingNeighborLight": true, - "hardness": -1.0, - "resistance": 1.8E7, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 121, - "id": "minecraft:end_stone", - "unlocalizedName": "tile.whiteStone", - "localizedName": "End Stone", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.0, - "resistance": 45.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 122, - "id": "minecraft:dragon_egg", - "unlocalizedName": "tile.dragonEgg", - "localizedName": "Dragon Egg", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 1, - "usingNeighborLight": true, - "hardness": 3.0, - "resistance": 45.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 123, - "id": "minecraft:redstone_lamp", - "unlocalizedName": "tile.redstoneLight", - "localizedName": "Redstone Lamp", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.3, - "resistance": 1.5, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -7489,1648 +5369,1147 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 124, - "id": "minecraft:lit_redstone_lamp", - "unlocalizedName": "tile.redstoneLight", - "localizedName": "Redstone Lamp", - "states": {}, + "id": "minecraft:gray_banner", + "localizedName": "Gray Banner", "material": { "powerSource": false, - "lightOpacity": 255, - "lightValue": 15, - "usingNeighborLight": false, - "hardness": 0.3, - "resistance": 1.5, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 125, - "id": "minecraft:double_wooden_slab", - "unlocalizedName": "tile.woodSlab", - "localizedName": "Wood Slab", - "states": { - "variant": { - "dataMask": 7, - "values": { - "oak": { - "data": 0 - }, - "spruce": { - "data": 1 - }, - "birch": { - "data": 2 - }, - "jungle": { - "data": 3 - }, - "acacia": { - "data": 4 - }, - "dark_oak": { - "data": 5 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 126, - "id": "minecraft:wooden_slab", - "unlocalizedName": "tile.woodSlab", - "localizedName": "Wood Slab", - "states": { - "half": { - "dataMask": 8, - "values": { - "top": { - "data": 8 - }, - "bottom": { - "data": 0 - } - } - }, - "variant": { - "dataMask": 7, - "values": { - "oak": { - "data": 0 - }, - "spruce": { - "data": 1 - }, - "birch": { - "data": 2 - }, - "jungle": { - "data": 3 - }, - "acacia": { - "data": 4 - }, - "dark_oak": { - "data": 5 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 127, - "id": "minecraft:cocoa", - "unlocalizedName": "tile.cocoa", - "localizedName": "Cocoa", - "states": { - "age": { - "dataMask": 8, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 4 - }, - "2": { - "data": 8 - } - } - }, - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.2, - "resistance": 15.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 128, - "id": "minecraft:sandstone_stairs", - "unlocalizedName": "tile.stairsSandStone", - "localizedName": "Sandstone Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.8, - "resistance": 4.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 129, - "id": "minecraft:emerald_ore", - "unlocalizedName": "tile.oreEmerald", - "localizedName": "Emerald Ore", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 130, - "id": "minecraft:ender_chest", - "unlocalizedName": "tile.enderChest", - "localizedName": "Ender Chest", - "states": { - "facing": { - "dataMask": 7, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 7, - "usingNeighborLight": true, - "hardness": 22.5, - "resistance": 3000.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 131, - "id": "minecraft:tripwire_hook", - "unlocalizedName": "tile.tripWireSource", - "localizedName": "Tripwire Hook", - "states": { - "attached": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 132, - "id": "minecraft:tripwire", - "unlocalizedName": "tile.tripWire", - "localizedName": "Tripwire", - "states": { - "attached": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "disarmed": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "dataMask": 1, - "values": { - "true": { - "data": 1 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 133, - "id": "minecraft:emerald_block", - "unlocalizedName": "tile.blockEmerald", - "localizedName": "Block of Emerald", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 5.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 134, - "id": "minecraft:spruce_stairs", - "unlocalizedName": "tile.stairsWoodSpruce", - "localizedName": "Spruce Wood Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 135, - "id": "minecraft:birch_stairs", - "unlocalizedName": "tile.stairsWoodBirch", - "localizedName": "Birch Wood Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 136, - "id": "minecraft:jungle_stairs", - "unlocalizedName": "tile.stairsWoodJungle", - "localizedName": "Jungle Wood Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 137, - "id": "minecraft:command_block", - "unlocalizedName": "tile.commandBlock", - "localizedName": "Command Block", - "states": { - "conditional": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": -1.0, - "resistance": 1.8E7, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 138, - "id": "minecraft:beacon", - "unlocalizedName": "tile.beacon", - "localizedName": "Beacon", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 15, - "usingNeighborLight": true, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 139, - "id": "minecraft:cobblestone_wall", - "unlocalizedName": "tile.cobbleWall", - "localizedName": "Cobblestone Wall", - "states": { - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "up": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "variant": { - "dataMask": 1, - "values": { - "cobblestone": { - "data": 0 - }, - "mossy_cobblestone": { - "data": 1 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 140, - "id": "minecraft:flower_pot", - "unlocalizedName": "tile.flowerPot", - "localizedName": "Flower Pot", - "states": { - "contents": { - "values": { - "empty": { - "data": 0 - }, - "rose": { - "data": 0 - }, - "blue_orchid": { - "data": 0 - }, - "allium": { - "data": 0 - }, - "houstonia": { - "data": 0 - }, - "red_tulip": { - "data": 0 - }, - "orange_tulip": { - "data": 0 - }, - "white_tulip": { - "data": 0 - }, - "pink_tulip": { - "data": 0 - }, - "oxeye_daisy": { - "data": 0 - }, - "dandelion": { - "data": 0 - }, - "oak_sapling": { - "data": 0 - }, - "spruce_sapling": { - "data": 0 - }, - "birch_sapling": { - "data": 0 - }, - "jungle_sapling": { - "data": 0 - }, - "acacia_sapling": { - "data": 0 - }, - "dark_oak_sapling": { - "data": 0 - }, - "mushroom_red": { - "data": 0 - }, - "mushroom_brown": { - "data": 0 - }, - "dead_bush": { - "data": 0 - }, - "fern": { - "data": 0 - }, - "cactus": { - "data": 0 - } - } - }, - "legacy_data": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 141, - "id": "minecraft:carrots", - "unlocalizedName": "tile.carrots", - "localizedName": "Carrots", - "states": { - "age": { - "dataMask": 7, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 142, - "id": "minecraft:potatoes", - "unlocalizedName": "tile.potatoes", - "localizedName": "Potatoes", - "states": { - "age": { - "dataMask": 7, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 143, - "id": "minecraft:wooden_button", - "unlocalizedName": "tile.button", - "localizedName": "Button", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 5, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 4, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 1, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 144, - "id": "minecraft:skull", - "unlocalizedName": "tile.skull", - "localizedName": "tile.skull.skeleton.name", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "nodrop": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:gray_bed", + "localizedName": "Gray Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:gray_carpet", + "localizedName": "Gray Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:gray_concrete", + "localizedName": "Gray Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:gray_concrete_powder", + "localizedName": "Gray Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:gray_glazed_terracotta", + "localizedName": "Gray Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:gray_shulker_box", + "localizedName": "Gray Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:gray_stained_glass", + "localizedName": "Gray Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:gray_stained_glass_pane", + "localizedName": "Gray Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:gray_terracotta", + "localizedName": "Gray Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:gray_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:gray_wool", + "localizedName": "Gray Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:green_banner", + "localizedName": "Green Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:green_bed", + "localizedName": "Green Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:green_carpet", + "localizedName": "Green Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:green_concrete", + "localizedName": "Green Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:green_concrete_powder", + "localizedName": "Green Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:green_glazed_terracotta", + "localizedName": "Green Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:green_shulker_box", + "localizedName": "Green Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:green_stained_glass", + "localizedName": "Green Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:green_stained_glass_pane", + "localizedName": "Green Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:green_terracotta", + "localizedName": "Green Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:green_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:green_wool", + "localizedName": "Green Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:hay_block", + "localizedName": "Hay Bale", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#7fb238", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:heavy_weighted_pressure_plate", + "localizedName": "Heavy Weighted Pressure Plate", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:hopper", + "localizedName": "Hopper", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 4.8, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:horn_coral", + "localizedName": "Horn Coral", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:horn_coral_block", + "localizedName": "Horn Coral Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:horn_coral_fan", + "localizedName": "Horn Coral Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:horn_coral_wall_fan", + "localizedName": "Horn Coral Wall Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:ice", + "localizedName": "Ice", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": true, + "fullCube": true, + "slipperiness": 0.98, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a0a0ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:infested_chiseled_stone_bricks", + "localizedName": "Infested Chiseled Stone Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.75, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a4a8b8", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:infested_cobblestone", + "localizedName": "Infested Cobblestone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.75, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a4a8b8", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:infested_cracked_stone_bricks", + "localizedName": "Infested Cracked Stone Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.75, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a4a8b8", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:infested_mossy_stone_bricks", + "localizedName": "Infested Mossy Stone Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.75, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a4a8b8", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:infested_stone", + "localizedName": "Infested Stone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.75, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a4a8b8", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:infested_stone_bricks", + "localizedName": "Infested Stone Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.75, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a4a8b8", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:iron_bars", + "localizedName": "Iron Bars", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 5.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:iron_block", + "localizedName": "Block of Iron", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 5.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:iron_door", + "localizedName": "Iron Door", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 5.0, "resistance": 5.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:iron_ore", + "localizedName": "Iron Ore", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:iron_trapdoor", + "localizedName": "Iron Trapdoor", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 5.0, + "resistance": 5.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jack_o_lantern", + "localizedName": "Jack o\u0027Lantern", + "material": { + "powerSource": false, + "lightValue": 15, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jukebox", + "localizedName": "Jukebox", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:jungle_button", + "localizedName": "Jungle Button", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, "liquid": false, "solid": false, "movementBlocker": false, @@ -9140,80 +6519,397 @@ "toolRequired": false, "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 145, - "id": "minecraft:anvil", - "unlocalizedName": "tile.anvil", - "localizedName": "Anvil", - "states": { - "damage": { - "dataMask": 8, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 4 - }, - "2": { - "data": 8 - } - } - }, - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:jungle_door", + "localizedName": "Jungle Door", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 5.0, - "resistance": 6000.0, + "hardness": 3.0, + "resistance": 3.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jungle_fence", + "localizedName": "Jungle Fence", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jungle_fence_gate", + "localizedName": "Jungle Fence Gate", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jungle_leaves", + "localizedName": "Jungle Leaves", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": true, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jungle_log", + "localizedName": "Jungle Log", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jungle_planks", + "localizedName": "Jungle Planks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jungle_pressure_plate", + "localizedName": "Jungle Pressure Plate", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jungle_sapling", + "localizedName": "Jungle Sapling", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jungle_slab", + "localizedName": "Jungle Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jungle_stairs", + "localizedName": "Jungle Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jungle_trapdoor", + "localizedName": "Jungle Trapdoor", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:jungle_wood", + "localizedName": "Jungle Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:kelp", + "localizedName": "Kelp", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:kelp_plant", + "localizedName": "Kelp Plant", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:ladder", + "localizedName": "Ladder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.4, + "resistance": 0.4, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lapis_block", + "localizedName": "Lapis Lazuli Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, "liquid": false, "solid": true, "movementBlocker": true, @@ -9222,535 +6918,1623 @@ "replacedDuringPlacement": false, "toolRequired": true, "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lapis_ore", + "localizedName": "Lapis Lazuli Ore", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:large_fern", + "localizedName": "Large Fern", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lava", + "localizedName": "Lava", + "material": { + "powerSource": false, + "lightValue": 15, + "hardness": 100.0, + "resistance": 100.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": true, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#ff0000", + "isTranslucent": true, + "hasContainer": false + } + }, + { + "id": "minecraft:lever", + "localizedName": "Lever", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_blue_banner", + "localizedName": "Light Blue Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:light_blue_bed", + "localizedName": "Light Blue Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_blue_carpet", + "localizedName": "Light Blue Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_blue_concrete", + "localizedName": "Light Blue Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_blue_concrete_powder", + "localizedName": "Light Blue Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_blue_glazed_terracotta", + "localizedName": "Light Blue Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_blue_shulker_box", + "localizedName": "Light Blue Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:light_blue_stained_glass", + "localizedName": "Light Blue Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_blue_stained_glass_pane", + "localizedName": "Light Blue Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_blue_terracotta", + "localizedName": "Light Blue Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_blue_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:light_blue_wool", + "localizedName": "Light Blue Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_gray_banner", + "localizedName": "Light Gray Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:light_gray_bed", + "localizedName": "Light Gray Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_gray_carpet", + "localizedName": "Light Gray Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_gray_concrete", + "localizedName": "Light Gray Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_gray_concrete_powder", + "localizedName": "Light Gray Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_gray_glazed_terracotta", + "localizedName": "Light Gray Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_gray_shulker_box", + "localizedName": "Light Gray Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:light_gray_stained_glass", + "localizedName": "Light Gray Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_gray_stained_glass_pane", + "localizedName": "Light Gray Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_gray_terracotta", + "localizedName": "Light Gray Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_gray_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:light_gray_wool", + "localizedName": "Light Gray Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:light_weighted_pressure_plate", + "localizedName": "Light Weighted Pressure Plate", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lilac", + "localizedName": "Lilac", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lily_pad", + "localizedName": "Lily Pad", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lime_banner", + "localizedName": "Lime Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:lime_bed", + "localizedName": "Lime Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lime_carpet", + "localizedName": "Lime Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lime_concrete", + "localizedName": "Lime Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lime_concrete_powder", + "localizedName": "Lime Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lime_glazed_terracotta", + "localizedName": "Lime Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lime_shulker_box", + "localizedName": "Lime Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:lime_stained_glass", + "localizedName": "Lime Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lime_stained_glass_pane", + "localizedName": "Lime Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lime_terracotta", + "localizedName": "Lime Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:lime_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:lime_wool", + "localizedName": "Lime Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:magenta_banner", + "localizedName": "Magenta Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:magenta_bed", + "localizedName": "Magenta Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:magenta_carpet", + "localizedName": "Magenta Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:magenta_concrete", + "localizedName": "Magenta Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:magenta_concrete_powder", + "localizedName": "Magenta Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:magenta_glazed_terracotta", + "localizedName": "Magenta Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:magenta_shulker_box", + "localizedName": "Magenta Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:magenta_stained_glass", + "localizedName": "Magenta Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:magenta_stained_glass_pane", + "localizedName": "Magenta Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:magenta_terracotta", + "localizedName": "Magenta Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:magenta_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:magenta_wool", + "localizedName": "Magenta Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:magma_block", + "localizedName": "Magma Block", + "material": { + "powerSource": false, + "lightValue": 3, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": true, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:melon", + "localizedName": "Melon", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:melon_stem", + "localizedName": "Melon Stem", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:mossy_cobblestone", + "localizedName": "Mossy Cobblestone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:mossy_cobblestone_wall", + "localizedName": "Mossy Cobblestone Wall", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:mossy_stone_bricks", + "localizedName": "Mossy Stone Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:moving_piston", + "localizedName": "Moving Piston", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": -1.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, "unpushable": true, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true } }, { - "legacyId": 146, - "id": "minecraft:trapped_chest", - "unlocalizedName": "tile.chestTrap", - "localizedName": "Trapped Chest", - "states": { - "facing": { - "dataMask": 7, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:mushroom_stem", + "localizedName": "Mushroom Stem", "material": { - "powerSource": true, - "lightOpacity": 0, + "powerSource": false, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.5, - "resistance": 12.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 147, - "id": "minecraft:light_weighted_pressure_plate", - "unlocalizedName": "tile.weightedPlate_light", - "localizedName": "Weighted Pressure Plate (Light)", - "states": { - "power": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 148, - "id": "minecraft:heavy_weighted_pressure_plate", - "unlocalizedName": "tile.weightedPlate_heavy", - "localizedName": "Weighted Pressure Plate (Heavy)", - "states": { - "power": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 149, - "id": "minecraft:unpowered_comparator", - "unlocalizedName": "tile.comparator", - "localizedName": "Redstone Comparator", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "mode": { - "dataMask": 4, - "values": { - "compare": { - "data": 0 - }, - "subtract": { - "data": 4 - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 150, - "id": "minecraft:powered_comparator", - "unlocalizedName": "tile.comparator", - "localizedName": "Redstone Comparator", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "mode": { - "dataMask": 4, - "values": { - "compare": { - "data": 0 - }, - "subtract": { - "data": 4 - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 9, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 151, - "id": "minecraft:daylight_detector", - "unlocalizedName": "tile.daylightDetector", - "localizedName": "Daylight Sensor", - "states": { - "power": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, "hardness": 0.2, - "resistance": 1.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 152, - "id": "minecraft:redstone_block", - "unlocalizedName": "tile.blockRedstone", - "localizedName": "Block of Redstone", - "states": {}, - "material": { - "powerSource": true, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 5.0, - "resistance": 30.0, + "resistance": 0.2, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:mycelium", + "localizedName": "Mycelium", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.6, + "resistance": 0.6, + "ticksRandomly": true, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#7fb238", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:nether_brick_fence", + "localizedName": "Nether Brick Fence", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, "liquid": false, "solid": true, "movementBlocker": true, @@ -9760,28 +8544,122 @@ "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 153, - "id": "minecraft:quartz_ore", - "unlocalizedName": "tile.netherquartz", + "id": "minecraft:nether_brick_slab", + "localizedName": "Nether Brick Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:nether_brick_stairs", + "localizedName": "Nether Brick Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:nether_bricks", + "localizedName": "Nether Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:nether_portal", + "localizedName": "Nether Portal", + "material": { + "powerSource": false, + "lightValue": 11, + "hardness": -1.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": true, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:nether_quartz_ore", "localizedName": "Nether Quartz Ore", - "states": {}, "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, "hardness": 3.0, - "resistance": 15.0, + "resistance": 3.0, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -9791,303 +8669,22 @@ "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 154, - "id": "minecraft:hopper", - "unlocalizedName": "tile.hopper", - "localizedName": "Hopper", - "states": { - "enabled": { - "dataMask": 8, - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 8 - } - } - }, - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:nether_wart", + "localizedName": "Nether Wart", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 3.0, - "resistance": 24.0, - "ticksRandomly": false, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 155, - "id": "minecraft:quartz_block", - "unlocalizedName": "tile.quartzBlock", - "localizedName": "Block of Quartz", - "states": { - "variant": { - "dataMask": 4, - "values": { - "default": { - "data": 0 - }, - "chiseled": { - "data": 1 - }, - "lines_y": { - "data": 2 - }, - "lines_x": { - "data": 3 - }, - "lines_z": { - "data": 4 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.8, - "resistance": 4.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 156, - "id": "minecraft:quartz_stairs", - "unlocalizedName": "tile.stairsQuartz", - "localizedName": "Quartz Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.8, - "resistance": 4.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 157, - "id": "minecraft:activator_rail", - "unlocalizedName": "tile.activatorRail", - "localizedName": "Activator Rail", - "states": { - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "north_south": { - "data": 0 - }, - "east_west": { - "data": 1 - }, - "ascending_east": { - "data": 2 - }, - "ascending_west": { - "data": 3 - }, - "ascending_north": { - "data": 4 - }, - "ascending_south": { - "data": 5 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.7, - "resistance": 3.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": false, "movementBlocker": false, @@ -10097,368 +8694,197 @@ "toolRequired": false, "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 158, - "id": "minecraft:dropper", - "unlocalizedName": "tile.dropper", - "localizedName": "Dropper", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "triggered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, + "id": "minecraft:nether_wart_block", + "localizedName": "Nether Wart Block", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.5, - "resistance": 17.5, + "hardness": 1.0, + "resistance": 1.0, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, "burnable": false, "opaque": true, "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 159, - "id": "minecraft:stained_hardened_clay", - "unlocalizedName": "tile.clayHardenedStained", - "localizedName": "Stained Hardened Clay", - "states": { - "color": { - "dataMask": 15, - "values": { - "white": { - "data": 0 - }, - "orange": { - "data": 1 - }, - "magenta": { - "data": 2 - }, - "light_blue": { - "data": 3 - }, - "yellow": { - "data": 4 - }, - "lime": { - "data": 5 - }, - "pink": { - "data": 6 - }, - "gray": { - "data": 7 - }, - "silver": { - "data": 8 - }, - "cyan": { - "data": 9 - }, - "purple": { - "data": 10 - }, - "blue": { - "data": 11 - }, - "brown": { - "data": 12 - }, - "green": { - "data": 13 - }, - "red": { - "data": 14 - }, - "black": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 1.25, - "resistance": 21.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 160, - "id": "minecraft:stained_glass_pane", - "unlocalizedName": "tile.thinStainedGlass", - "localizedName": "Stained Glass Pane", - "states": { - "color": { - "dataMask": 15, - "values": { - "white": { - "data": 0 - }, - "orange": { - "data": 1 - }, - "magenta": { - "data": 2 - }, - "light_blue": { - "data": 3 - }, - "yellow": { - "data": 4 - }, - "lime": { - "data": 5 - }, - "pink": { - "data": 6 - }, - "gray": { - "data": 7 - }, - "silver": { - "data": 8 - }, - "cyan": { - "data": 9 - }, - "purple": { - "data": 10 - }, - "blue": { - "data": 11 - }, - "brown": { - "data": 12 - }, - "green": { - "data": 13 - }, - "red": { - "data": 14 - }, - "black": { - "data": 15 - } - } - }, - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.3, - "resistance": 1.5, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#7fb238", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 161, - "id": "minecraft:leaves2", - "unlocalizedName": "tile.leaves", - "localizedName": "Leaves", - "states": { - "check_decay": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "decayable": { - "dataMask": 4, - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 4 - } - } - }, - "variant": { - "dataMask": 1, - "values": { - "acacia": { - "data": 0 - }, - "dark_oak": { - "data": 1 - } - } - } - }, + "id": "minecraft:netherrack", + "localizedName": "Netherrack", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.4, + "resistance": 0.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:note_block", + "localizedName": "Note Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:oak_button", + "localizedName": "Oak Button", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:oak_door", + "localizedName": "Oak Door", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:oak_fence", + "localizedName": "Oak Fence", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:oak_fence_gate", + "localizedName": "Oak Fence Gate", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:oak_leaves", + "localizedName": "Oak Leaves", "material": { "powerSource": false, - "lightOpacity": 1, "lightValue": 0, - "usingNeighborLight": false, "hardness": 0.2, - "resistance": 1.0, + "resistance": 0.2, "ticksRandomly": true, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -10468,57 +8894,22 @@ "toolRequired": false, "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 162, - "id": "minecraft:log2", - "unlocalizedName": "tile.log", - "localizedName": "Wood", - "states": { - "axis": { - "dataMask": 12, - "values": { - "x": { - "data": 4 - }, - "y": { - "data": 0 - }, - "z": { - "data": 8 - }, - "none": { - "data": 12 - } - } - }, - "variant": { - "dataMask": 1, - "values": { - "acacia": { - "data": 0 - }, - "dark_oak": { - "data": 1 - } - } - } - }, + "id": "minecraft:oak_log", + "localizedName": "Oak Log", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, "hardness": 2.0, - "resistance": 10.0, + "resistance": 2.0, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -10528,97 +8919,47 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 163, - "id": "minecraft:acacia_stairs", - "unlocalizedName": "tile.stairsWoodAcacia", - "localizedName": "Acacia Wood Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, + "id": "minecraft:oak_planks", + "localizedName": "Oak Planks", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": true, "hardness": 2.0, - "resistance": 15.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:oak_pressure_plate", + "localizedName": "Oak Pressure Plate", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -10628,97 +8969,47 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 164, - "id": "minecraft:dark_oak_stairs", - "unlocalizedName": "tile.stairsWoodDarkOak", - "localizedName": "Dark Oak Wood Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, + "id": "minecraft:oak_sapling", + "localizedName": "Oak Sapling", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:oak_slab", + "localizedName": "Oak Slab", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": true, "hardness": 2.0, - "resistance": 15.0, + "resistance": 3.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -10728,28 +9019,3422 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 165, - "id": "minecraft:slime", - "unlocalizedName": "tile.slime", + "id": "minecraft:oak_stairs", + "localizedName": "Oak Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:oak_trapdoor", + "localizedName": "Oak Trapdoor", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:oak_wood", + "localizedName": "Oak Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:observer", + "localizedName": "Observer", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:obsidian", + "localizedName": "Obsidian", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 50.0, + "resistance": 1200.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:orange_banner", + "localizedName": "Orange Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:orange_bed", + "localizedName": "Orange Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:orange_carpet", + "localizedName": "Orange Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:orange_concrete", + "localizedName": "Orange Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:orange_concrete_powder", + "localizedName": "Orange Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:orange_glazed_terracotta", + "localizedName": "Orange Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:orange_shulker_box", + "localizedName": "Orange Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:orange_stained_glass", + "localizedName": "Orange Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:orange_stained_glass_pane", + "localizedName": "Orange Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:orange_terracotta", + "localizedName": "Orange Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:orange_tulip", + "localizedName": "Orange Tulip", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:orange_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:orange_wool", + "localizedName": "Orange Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:oxeye_daisy", + "localizedName": "Oxeye Daisy", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:packed_ice", + "localizedName": "Packed Ice", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.98, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a0a0ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:peony", + "localizedName": "Peony", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:petrified_oak_slab", + "localizedName": "Petrified Oak Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pink_banner", + "localizedName": "Pink Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:pink_bed", + "localizedName": "Pink Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pink_carpet", + "localizedName": "Pink Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pink_concrete", + "localizedName": "Pink Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pink_concrete_powder", + "localizedName": "Pink Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pink_glazed_terracotta", + "localizedName": "Pink Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pink_shulker_box", + "localizedName": "Pink Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:pink_stained_glass", + "localizedName": "Pink Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pink_stained_glass_pane", + "localizedName": "Pink Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pink_terracotta", + "localizedName": "Pink Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pink_tulip", + "localizedName": "Pink Tulip", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pink_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:pink_wool", + "localizedName": "Pink Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:piston", + "localizedName": "Piston", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": true, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:piston_head", + "localizedName": "Piston Head", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": true, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:player_head", + "localizedName": "Player Head", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:player_wall_head", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:podzol", + "localizedName": "Podzol", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#976d4d", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:polished_andesite", + "localizedName": "Polished Andesite", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:polished_diorite", + "localizedName": "Polished Diorite", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:polished_granite", + "localizedName": "Polished Granite", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:poppy", + "localizedName": "Poppy", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potatoes", + "localizedName": "Potatoes", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_acacia_sapling", + "localizedName": "Potted Acacia Sapling", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_allium", + "localizedName": "Potted Allium", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_azure_bluet", + "localizedName": "Potted Azure Bluet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_birch_sapling", + "localizedName": "Potted Birch Sapling", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_blue_orchid", + "localizedName": "Potted Blue Orchid", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_brown_mushroom", + "localizedName": "Potted Brown Mushroom", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_cactus", + "localizedName": "Potted Cactus", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_dandelion", + "localizedName": "Potted Dandelion", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_dark_oak_sapling", + "localizedName": "Potted Dark Oak Sapling", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_dead_bush", + "localizedName": "Potted Dead Bush", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_fern", + "localizedName": "Potted Fern", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_jungle_sapling", + "localizedName": "Potted Jungle Sapling", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_oak_sapling", + "localizedName": "Potted Oak Sapling", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_orange_tulip", + "localizedName": "Potted Orange Tulip", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_oxeye_daisy", + "localizedName": "Potted Oxeye Daisy", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_pink_tulip", + "localizedName": "Potted Pink Tulip", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_poppy", + "localizedName": "Potted Poppy", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_red_mushroom", + "localizedName": "Potted Red Mushroom", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_red_tulip", + "localizedName": "Potted Red Tulip", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_spruce_sapling", + "localizedName": "Potted Spruce Sapling", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:potted_white_tulip", + "localizedName": "Potted White Tulip", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:powered_rail", + "localizedName": "Powered Rail", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.7, + "resistance": 0.7, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:prismarine", + "localizedName": "Prismarine", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:prismarine_brick_slab", + "localizedName": "Prismarine Brick Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:prismarine_brick_stairs", + "localizedName": "Prismarine Brick Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:prismarine_bricks", + "localizedName": "Prismarine Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:prismarine_slab", + "localizedName": "Prismarine Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:prismarine_stairs", + "localizedName": "Prismarine Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pumpkin", + "localizedName": "Pumpkin", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:pumpkin_stem", + "localizedName": "Pumpkin Stem", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purple_banner", + "localizedName": "Purple Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:purple_bed", + "localizedName": "Purple Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purple_carpet", + "localizedName": "Purple Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purple_concrete", + "localizedName": "Purple Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purple_concrete_powder", + "localizedName": "Purple Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purple_glazed_terracotta", + "localizedName": "Purple Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purple_shulker_box", + "localizedName": "Purple Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:purple_stained_glass", + "localizedName": "Purple Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purple_stained_glass_pane", + "localizedName": "Purple Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purple_terracotta", + "localizedName": "Purple Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purple_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:purple_wool", + "localizedName": "Purple Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purpur_block", + "localizedName": "Purpur Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purpur_pillar", + "localizedName": "Purpur Pillar", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purpur_slab", + "localizedName": "Purpur Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:purpur_stairs", + "localizedName": "Purpur Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:quartz_block", + "localizedName": "Block of Quartz", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:quartz_pillar", + "localizedName": "Quartz Pillar", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:quartz_slab", + "localizedName": "Quartz Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:quartz_stairs", + "localizedName": "Quartz Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:rail", + "localizedName": "Rail", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.7, + "resistance": 0.7, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_banner", + "localizedName": "Red Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:red_bed", + "localizedName": "Red Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_carpet", + "localizedName": "Red Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_concrete", + "localizedName": "Red Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_concrete_powder", + "localizedName": "Red Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_glazed_terracotta", + "localizedName": "Red Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_mushroom", + "localizedName": "Red Mushroom", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_mushroom_block", + "localizedName": "Red Mushroom Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_nether_bricks", + "localizedName": "Red Nether Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_sand", + "localizedName": "Red Sand", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_sandstone", + "localizedName": "Red Sandstone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_sandstone_slab", + "localizedName": "Red Sandstone Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_sandstone_stairs", + "localizedName": "Red Sandstone Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_shulker_box", + "localizedName": "Red Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:red_stained_glass", + "localizedName": "Red Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_stained_glass_pane", + "localizedName": "Red Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_terracotta", + "localizedName": "Red Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_tulip", + "localizedName": "Red Tulip", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:red_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:red_wool", + "localizedName": "Red Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:redstone_block", + "localizedName": "Block of Redstone", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 5.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:redstone_lamp", + "localizedName": "Redstone Lamp", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:redstone_ore", + "localizedName": "Redstone Ore", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": true, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:redstone_torch", + "localizedName": "Redstone Torch", + "material": { + "powerSource": true, + "lightValue": 7, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:redstone_wall_torch", + "localizedName": "Air", + "material": { + "powerSource": true, + "lightValue": 7, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:redstone_wire", + "localizedName": "Redstone Dust", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:repeater", + "localizedName": "Redstone Repeater", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:repeating_command_block", + "localizedName": "Repeating Command Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": -1.0, + "resistance": 3600000.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:rose_bush", + "localizedName": "Rose Bush", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:sand", + "localizedName": "Sand", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:sandstone", + "localizedName": "Sandstone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:sandstone_slab", + "localizedName": "Sandstone Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:sandstone_stairs", + "localizedName": "Sandstone Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:sea_lantern", + "localizedName": "Sea Lantern", + "material": { + "powerSource": false, + "lightValue": 15, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:sea_pickle", + "localizedName": "Sea Pickle", + "material": { + "powerSource": false, + "lightValue": 6, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:seagrass", + "localizedName": "Seagrass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:shulker_box", + "localizedName": "Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:sign", + "localizedName": "Sign", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:skeleton_skull", + "localizedName": "Skeleton Skull", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:skeleton_wall_skull", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:slime_block", "localizedName": "Slime Block", - "states": {}, "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, "hardness": 0.0, "resistance": 0.0, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.8, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -10759,28 +12444,22 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#a4a8b8", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 166, - "id": "minecraft:barrier", - "unlocalizedName": "tile.barrier", - "localizedName": "Barrier", - "states": {}, + "id": "minecraft:smooth_quartz", + "localizedName": "Smooth Quartz", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": -1.0, - "resistance": 1.8000004E7, + "hardness": 2.0, + "resistance": 6.0, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -10789,135 +12468,573 @@ "replacedDuringPlacement": false, "toolRequired": true, "fragileWhenPushed": false, - "unpushable": true, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 167, - "id": "minecraft:iron_trapdoor", - "unlocalizedName": "tile.ironTrapdoor", - "localizedName": "Iron Trapdoor", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 0, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 1, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 8, - "values": { - "top": { - "data": 8 - }, - "bottom": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - } - }, + "id": "minecraft:smooth_red_sandstone", + "localizedName": "Smooth Red Sandstone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:smooth_sandstone", + "localizedName": "Smooth Sandstone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:smooth_stone", + "localizedName": "Smooth Stone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:snow", + "localizedName": "Snow", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": true, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#ffffff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:snow_block", + "localizedName": "Snow Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": true, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#ffffff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:soul_sand", + "localizedName": "Soul Sand", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": true, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spawner", + "localizedName": "Spawner", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, "hardness": 5.0, - "resistance": 25.0, + "resistance": 5.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:sponge", + "localizedName": "Sponge", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.6, + "resistance": 0.6, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#e5e533", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_button", + "localizedName": "Spruce Button", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, - "solid": true, - "movementBlocker": true, + "solid": false, + "movementBlocker": false, "burnable": false, - "opaque": true, + "opaque": false, "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, + "toolRequired": false, + "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 168, - "id": "minecraft:prismarine", - "unlocalizedName": "tile.prismarine", - "localizedName": "Prismarine", - "states": { - "variant": { - "dataMask": 3, - "values": { - "prismarine": { - "data": 0 - }, - "prismarine_bricks": { - "data": 1 - }, - "dark_prismarine": { - "data": 2 - } - } - } - }, + "id": "minecraft:spruce_door", + "localizedName": "Spruce Door", "material": { "powerSource": false, - "lightOpacity": 255, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 1.5, - "resistance": 30.0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_fence", + "localizedName": "Spruce Fence", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_fence_gate", + "localizedName": "Spruce Fence Gate", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_leaves", + "localizedName": "Spruce Leaves", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": true, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_log", + "localizedName": "Spruce Log", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_planks", + "localizedName": "Spruce Planks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_pressure_plate", + "localizedName": "Spruce Pressure Plate", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_sapling", + "localizedName": "Spruce Sapling", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_slab", + "localizedName": "Spruce Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_stairs", + "localizedName": "Spruce Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_trapdoor", + "localizedName": "Spruce Trapdoor", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 3.0, + "resistance": 3.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:spruce_wood", + "localizedName": "Spruce Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:sticky_piston", + "localizedName": "Sticky Piston", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": true, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stone", + "localizedName": "Stone", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -10927,252 +13044,872 @@ "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 169, - "id": "minecraft:sea_lantern", - "unlocalizedName": "tile.seaLantern", - "localizedName": "Sea Lantern", - "states": {}, + "id": "minecraft:stone_brick_slab", + "localizedName": "Stone Brick Slab", "material": { "powerSource": false, - "lightOpacity": 255, - "lightValue": 15, - "usingNeighborLight": false, - "hardness": 0.3, - "resistance": 1.5, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, "ticksRandomly": false, - "fullCube": true, + "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stone_brick_stairs", + "localizedName": "Stone Brick Stairs", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stone_bricks", + "localizedName": "Stone Bricks", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stone_button", + "localizedName": "Stone Button", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stone_pressure_plate", + "localizedName": "Stone Pressure Plate", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stone_slab", + "localizedName": "Stone Slab", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 6.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_acacia_log", + "localizedName": "Stripped Acacia Log", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_acacia_wood", + "localizedName": "Stripped Acacia Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_birch_log", + "localizedName": "Stripped Birch Log", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_birch_wood", + "localizedName": "Stripped Birch Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_dark_oak_log", + "localizedName": "Stripped Dark Oak Log", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_dark_oak_wood", + "localizedName": "Stripped Dark Oak Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_jungle_log", + "localizedName": "Stripped Jungle Log", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_jungle_wood", + "localizedName": "Stripped Jungle Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_oak_log", + "localizedName": "Stripped Oak Log", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_oak_wood", + "localizedName": "Stripped Oak Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_spruce_log", + "localizedName": "Stripped Spruce Log", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:stripped_spruce_wood", + "localizedName": "Stripped Spruce Wood", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:structure_block", + "localizedName": "Structure Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": -1.0, + "resistance": 3600000.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#a7a7a7", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:structure_void", + "localizedName": "Structure Void", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:sugar_cane", + "localizedName": "Sugar Cane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:sunflower", + "localizedName": "Sunflower", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:tall_grass", + "localizedName": "Tall Grass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:tall_seagrass", + "localizedName": "Tall Seagrass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": true, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:terracotta", + "localizedName": "Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:tnt", + "localizedName": "TNT", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, "opaque": false, "replacedDuringPlacement": false, "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#ff0000", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 170, - "id": "minecraft:hay_block", - "unlocalizedName": "tile.hayBlock", - "localizedName": "Hay Bale", - "states": { - "axis": { - "dataMask": 8, - "values": { - "x": { - "data": 4 - }, - "y": { - "data": 0 - }, - "z": { - "data": 8 - } - } - } - }, + "id": "minecraft:torch", + "localizedName": "Torch", "material": { "powerSource": false, - "lightOpacity": 255, + "lightValue": 14, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:trapped_chest", + "localizedName": "Trapped Chest", + "material": { + "powerSource": true, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.5, + "hardness": 2.5, "resistance": 2.5, "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:tripwire", + "localizedName": "Tripwire", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:tripwire_hook", + "localizedName": "Tripwire Hook", + "material": { + "powerSource": true, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:tube_coral", + "localizedName": "Tube Coral", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:tube_coral_block", + "localizedName": "Tube Coral Block", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.5, + "resistance": 6.0, + "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, "burnable": false, "opaque": true, "replacedDuringPlacement": false, - "toolRequired": false, + "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 171, - "id": "minecraft:carpet", - "unlocalizedName": "tile.woolCarpet", - "localizedName": "Carpet", - "states": { - "color": { - "dataMask": 15, - "values": { - "white": { - "data": 0 - }, - "orange": { - "data": 1 - }, - "magenta": { - "data": 2 - }, - "light_blue": { - "data": 3 - }, - "yellow": { - "data": 4 - }, - "lime": { - "data": 5 - }, - "pink": { - "data": 6 - }, - "gray": { - "data": 7 - }, - "silver": { - "data": 8 - }, - "cyan": { - "data": 9 - }, - "purple": { - "data": 10 - }, - "blue": { - "data": 11 - }, - "brown": { - "data": 12 - }, - "green": { - "data": 13 - }, - "red": { - "data": 14 - }, - "black": { - "data": 15 - } - } - } - }, + "id": "minecraft:tube_coral_fan", + "localizedName": "Tube Coral Fan", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.1, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:tube_coral_wall_fan", + "localizedName": "Tube Coral Wall Fan", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#4040ff", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:turtle_egg", + "localizedName": "Turtle Egg", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, "resistance": 0.5, "ticksRandomly": true, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": true, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 172, - "id": "minecraft:hardened_clay", - "unlocalizedName": "tile.clayHardened", - "localizedName": "Hardened Clay", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 1.25, - "resistance": 21.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 173, - "id": "minecraft:coal_block", - "unlocalizedName": "tile.blockCoal", - "localizedName": "Block of Coal", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 5.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 174, - "id": "minecraft:packed_ice", - "unlocalizedName": "tile.icePacked", - "localizedName": "Packed Ice", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.98, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -11180,101 +13917,24 @@ "opaque": true, "replacedDuringPlacement": false, "toolRequired": false, - "fragileWhenPushed": false, + "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 175, - "id": "minecraft:double_plant", - "unlocalizedName": "tile.doublePlant", - "localizedName": "Plant", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 0, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 0, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "values": { - "upper": { - "data": 10 - }, - "lower": { - "data": 0 - } - } - }, - "variant": { - "dataMask": 7, - "values": { - "sunflower": { - "data": 0 - }, - "syringa": { - "data": 1 - }, - "double_grass": { - "data": 2 - }, - "double_fern": { - "data": 3 - }, - "double_rose": { - "data": 4 - }, - "paeonia": { - "data": 5 - } - } - } - }, + "id": "minecraft:vine", + "localizedName": "Vines", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, + "hardness": 0.2, + "resistance": 0.2, "ticksRandomly": true, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": false, "movementBlocker": false, @@ -11284,236 +13944,47 @@ "toolRequired": false, "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 176, - "id": "minecraft:standing_banner", - "unlocalizedName": "tile.banner", - "localizedName": "White Banner", - "states": { - "rotation": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, + "id": "minecraft:void_air", + "localizedName": "Void Air", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 1.0, - "resistance": 5.0, + "hardness": 0.0, + "resistance": 0.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": true, "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 177, - "id": "minecraft:wall_banner", - "unlocalizedName": "tile.banner", - "localizedName": "White Banner", - "states": { - "facing": { - "dataMask": 7, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:wall_sign", + "localizedName": "Air", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, "hardness": 1.0, - "resistance": 5.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 178, - "id": "minecraft:daylight_detector_inverted", - "unlocalizedName": "tile.daylightDetector", - "localizedName": "Daylight Sensor", - "states": { - "power": { - "dataMask": 15, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - }, - "6": { - "data": 6 - }, - "7": { - "data": 7 - }, - "8": { - "data": 8 - }, - "9": { - "data": 9 - }, - "10": { - "data": 10 - }, - "11": { - "data": 11 - }, - "12": { - "data": 12 - }, - "13": { - "data": 13 - }, - "14": { - "data": 14 - }, - "15": { - "data": 15 - } - } - } - }, - "material": { - "powerSource": true, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.2, "resistance": 1.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -11523,1748 +13994,22 @@ "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true } }, { - "legacyId": 179, - "id": "minecraft:red_sandstone", - "unlocalizedName": "tile.redSandStone", - "localizedName": "Red Sandstone", - "states": { - "type": { - "dataMask": 3, - "values": { - "red_sandstone": { - "data": 0 - }, - "chiseled_red_sandstone": { - "data": 1 - }, - "smooth_red_sandstone": { - "data": 2 - } - } - } - }, + "id": "minecraft:wall_torch", + "localizedName": "Air", "material": { "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.8, - "resistance": 4.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 180, - "id": "minecraft:red_sandstone_stairs", - "unlocalizedName": "tile.stairsRedSandStone", - "localizedName": "Red Sandstone Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.8, - "resistance": 4.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 181, - "id": "minecraft:double_stone_slab2", - "unlocalizedName": "tile.stoneSlab2", - "localizedName": "Red Sandstone Slab", - "states": { - "seamless": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "variant": { - "values": { - "red_sandstone": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 182, - "id": "minecraft:stone_slab2", - "unlocalizedName": "tile.stoneSlab2", - "localizedName": "Red Sandstone Slab", - "states": { - "half": { - "dataMask": 8, - "values": { - "top": { - "data": 8 - }, - "bottom": { - "data": 0 - } - } - }, - "variant": { - "values": { - "red_sandstone": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 183, - "id": "minecraft:spruce_fence_gate", - "unlocalizedName": "tile.spruceFenceGate", - "localizedName": "Spruce Fence Gate", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "in_wall": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 184, - "id": "minecraft:birch_fence_gate", - "unlocalizedName": "tile.birchFenceGate", - "localizedName": "Birch Fence Gate", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "in_wall": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 185, - "id": "minecraft:jungle_fence_gate", - "unlocalizedName": "tile.jungleFenceGate", - "localizedName": "Jungle Fence Gate", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "in_wall": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 186, - "id": "minecraft:dark_oak_fence_gate", - "unlocalizedName": "tile.darkOakFenceGate", - "localizedName": "Dark Oak Fence Gate", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "in_wall": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 187, - "id": "minecraft:acacia_fence_gate", - "unlocalizedName": "tile.acaciaFenceGate", - "localizedName": "Acacia Fence Gate", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 0, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 3, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "in_wall": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 188, - "id": "minecraft:spruce_fence", - "unlocalizedName": "tile.spruceFence", - "localizedName": "Spruce Fence", - "states": { - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 189, - "id": "minecraft:birch_fence", - "unlocalizedName": "tile.birchFence", - "localizedName": "Birch Fence", - "states": { - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 190, - "id": "minecraft:jungle_fence", - "unlocalizedName": "tile.jungleFence", - "localizedName": "Jungle Fence", - "states": { - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 191, - "id": "minecraft:dark_oak_fence", - "unlocalizedName": "tile.darkOakFence", - "localizedName": "Dark Oak Fence", - "states": { - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 192, - "id": "minecraft:acacia_fence", - "unlocalizedName": "tile.acaciaFence", - "localizedName": "Acacia Fence", - "states": { - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 193, - "id": "minecraft:spruce_door", - "unlocalizedName": "tile.doorSpruce", - "localizedName": "Spruce Door", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 1, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 8, - "values": { - "upper": { - "data": 8 - }, - "lower": { - "data": 0 - } - } - }, - "hinge": { - "values": { - "left": { - "data": 0 - }, - "right": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 194, - "id": "minecraft:birch_door", - "unlocalizedName": "tile.doorBirch", - "localizedName": "Birch Door", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 1, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 8, - "values": { - "upper": { - "data": 8 - }, - "lower": { - "data": 0 - } - } - }, - "hinge": { - "values": { - "left": { - "data": 0 - }, - "right": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 195, - "id": "minecraft:jungle_door", - "unlocalizedName": "tile.doorJungle", - "localizedName": "Jungle Door", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 1, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 8, - "values": { - "upper": { - "data": 8 - }, - "lower": { - "data": 0 - } - } - }, - "hinge": { - "values": { - "left": { - "data": 0 - }, - "right": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 196, - "id": "minecraft:acacia_door", - "unlocalizedName": "tile.doorAcacia", - "localizedName": "Acacia Door", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 1, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 8, - "values": { - "upper": { - "data": 8 - }, - "lower": { - "data": 0 - } - } - }, - "hinge": { - "values": { - "left": { - "data": 0 - }, - "right": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 197, - "id": "minecraft:dark_oak_door", - "unlocalizedName": "tile.doorDarkOak", - "localizedName": "Dark Oak Door", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 1, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 2, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 8, - "values": { - "upper": { - "data": 8 - }, - "lower": { - "data": 0 - } - } - }, - "hinge": { - "values": { - "left": { - "data": 0 - }, - "right": { - "data": 0 - } - } - }, - "open": { - "dataMask": 4, - "values": { - "true": { - "data": 4 - }, - "false": { - "data": 0 - } - } - }, - "powered": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 3.0, - "resistance": 15.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": true, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 198, - "id": "minecraft:end_rod", - "unlocalizedName": "tile.endRod", - "localizedName": "End Rod", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, "lightValue": 14, - "usingNeighborLight": true, "hardness": 0.0, "resistance": 0.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": false, "movementBlocker": false, @@ -13274,1059 +14019,172 @@ "toolRequired": false, "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 199, - "id": "minecraft:chorus_plant", - "unlocalizedName": "tile.chorusPlant", - "localizedName": "Chorus Plant", - "states": { - "down": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "east": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "north": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "south": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "up": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - }, - "west": { - "values": { - "true": { - "data": 0 - }, - "false": { - "data": 0 - } - } - } - }, + "id": "minecraft:water", + "localizedName": "Water", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.4, - "resistance": 2.0, + "hardness": 100.0, + "resistance": 100.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 200, - "id": "minecraft:chorus_flower", - "unlocalizedName": "tile.chorusFlower", - "localizedName": "Chorus Flower", - "states": { - "age": { - "dataMask": 7, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - }, - "4": { - "data": 4 - }, - "5": { - "data": 5 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.4, - "resistance": 2.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 201, - "id": "minecraft:purpur_block", - "unlocalizedName": "tile.purpurBlock", - "localizedName": "Purpur Block", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 1.5, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 202, - "id": "minecraft:purpur_pillar", - "unlocalizedName": "tile.purpurPillar", - "localizedName": "Purpur Pillar", - "states": { - "axis": { - "dataMask": 8, - "values": { - "x": { - "data": 4 - }, - "y": { - "data": 0 - }, - "z": { - "data": 8 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 1.5, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 203, - "id": "minecraft:purpur_stairs", - "unlocalizedName": "tile.stairsPurpur", - "localizedName": "Purpur Stairs", - "states": { - "facing": { - "dataMask": 3, - "values": { - "north": { - "data": 3, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 2, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 1, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 0, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "half": { - "dataMask": 4, - "values": { - "top": { - "data": 4 - }, - "bottom": { - "data": 0 - } - } - }, - "shape": { - "dataMask": 7, - "values": { - "straight": { - "data": 0 - }, - "inner_left": { - "data": 0 - }, - "inner_right": { - "data": 0 - }, - "outer_left": { - "data": 0 - }, - "outer_right": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 1.5, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 204, - "id": "minecraft:purpur_double_slab", - "unlocalizedName": "tile.purpurSlab", - "localizedName": "Purpur Slab", - "states": { - "variant": { - "values": { - "default": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 205, - "id": "minecraft:purpur_slab", - "unlocalizedName": "tile.purpurSlab", - "localizedName": "Purpur Slab", - "states": { - "half": { - "dataMask": 8, - "values": { - "top": { - "data": 8 - }, - "bottom": { - "data": 0 - } - } - }, - "variant": { - "values": { - "default": { - "data": 0 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 206, - "id": "minecraft:end_bricks", - "unlocalizedName": "tile.endBricks", - "localizedName": "End Stone Bricks", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.8, - "resistance": 4.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 207, - "id": "minecraft:beetroots", - "unlocalizedName": "tile.beetroots", - "localizedName": "Beetroots", - "states": { - "age": { - "dataMask": 3, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": true, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": true, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 208, - "id": "minecraft:grass_path", - "unlocalizedName": "tile.grassPath", - "localizedName": "Grass Path", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.65, - "resistance": 3.25, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 209, - "id": "minecraft:end_gateway", - "unlocalizedName": "tile.null", - "localizedName": "tile.null.name", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 15, - "usingNeighborLight": true, - "hardness": -1.0, - "resistance": 1.8E7, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": false, - "movementBlocker": false, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": true, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 210, - "id": "minecraft:repeating_command_block", - "unlocalizedName": "tile.repeatingCommandBlock", - "localizedName": "Repeating Command Block", - "states": { - "conditional": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": -1.0, - "resistance": 1.8E7, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 211, - "id": "minecraft:chain_command_block", - "unlocalizedName": "tile.chainCommandBlock", - "localizedName": "Chain Command Block", - "states": { - "conditional": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - }, - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": -1.0, - "resistance": 1.8E7, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 212, - "id": "minecraft:frosted_ice", - "unlocalizedName": "tile.frostedIce", - "localizedName": "Frosted Ice", - "states": { - "age": { - "dataMask": 3, - "values": { - "0": { - "data": 0 - }, - "1": { - "data": 1 - }, - "2": { - "data": 2 - }, - "3": { - "data": 3 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 3, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": true, - "fullCube": true, - "slipperiness": 0.98, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": false, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": true, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 213, - "id": "minecraft:magma", - "unlocalizedName": "tile.magma", - "localizedName": "Magma Block", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 3, - "usingNeighborLight": false, - "hardness": 0.5, - "resistance": 2.5, - "ticksRandomly": true, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 214, - "id": "minecraft:nether_wart_block", - "unlocalizedName": "tile.netherWartBlock", - "localizedName": "Nether Wart Block", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 1.0, - "resistance": 5.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": false, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 215, - "id": "minecraft:red_nether_brick", - "unlocalizedName": "tile.redNetherBrick", - "localizedName": "Red Nether Brick", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 2.0, - "resistance": 30.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 216, - "id": "minecraft:bone_block", - "unlocalizedName": "tile.boneBlock", - "localizedName": "Bone Block", - "states": { - "axis": { - "dataMask": 8, - "values": { - "x": { - "data": 4 - }, - "y": { - "data": 0 - }, - "z": { - "data": 8 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": true, - "slipperiness": 0.6, - "renderedAsNormalBlock": true, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false - } - }, - { - "legacyId": 217, - "id": "minecraft:structure_void", - "unlocalizedName": "tile.structureVoid", - "localizedName": "Structure Void", - "states": {}, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 0.0, - "resistance": 0.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, + "liquid": true, "solid": false, "movementBlocker": false, "burnable": false, "opaque": false, "replacedDuringPlacement": true, "toolRequired": false, - "fragileWhenPushed": false, + "fragileWhenPushed": true, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#4040ff", + "isTranslucent": true, + "hasContainer": false } }, { - "legacyId": 218, - "id": "minecraft:observer", - "unlocalizedName": "tile.observer", - "localizedName": "Observer", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - }, - "powered": { - "dataMask": 8, - "values": { - "true": { - "data": 8 - }, - "false": { - "data": 0 - } - } - } - }, + "id": "minecraft:wet_sponge", + "localizedName": "Wet Sponge", "material": { - "powerSource": true, - "lightOpacity": 255, + "powerSource": false, "lightValue": 0, - "usingNeighborLight": false, - "hardness": 3.0, - "resistance": 15.0, + "hardness": 0.6, + "resistance": 0.6, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#e5e533", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:wheat", + "localizedName": "Wheat Crops", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": true, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:white_banner", + "localizedName": "White Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:white_bed", + "localizedName": "White Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:white_carpet", + "localizedName": "White Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:white_concrete", + "localizedName": "White Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -14336,82 +14194,72 @@ "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:white_concrete_powder", + "localizedName": "White Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:white_glazed_terracotta", + "localizedName": "White Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 219, "id": "minecraft:white_shulker_box", - "unlocalizedName": "tile.shulkerBoxWhite", "localizedName": "White Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, "hardness": 2.0, - "resistance": 10.0, + "resistance": 2.0, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, @@ -14421,1321 +14269,72 @@ "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true } }, { - "legacyId": 220, - "id": "minecraft:orange_shulker_box", - "unlocalizedName": "tile.shulkerBoxOrange", - "localizedName": "Orange Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:white_stained_glass", + "localizedName": "White Stained Glass", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, + "hardness": 0.3, + "resistance": 0.3, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, "burnable": false, - "opaque": true, + "opaque": false, "replacedDuringPlacement": false, - "toolRequired": true, + "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 221, - "id": "minecraft:magenta_shulker_box", - "unlocalizedName": "tile.shulkerBoxMagenta", - "localizedName": "Magenta Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:white_stained_glass_pane", + "localizedName": "White Stained Glass Pane", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, + "hardness": 0.3, + "resistance": 0.3, "ticksRandomly": false, "fullCube": false, "slipperiness": 0.6, - "renderedAsNormalBlock": false, "liquid": false, "solid": true, "movementBlocker": true, "burnable": false, - "opaque": true, + "opaque": false, "replacedDuringPlacement": false, - "toolRequired": true, + "toolRequired": false, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false } }, { - "legacyId": 222, - "id": "minecraft:light_blue_shulker_box", - "unlocalizedName": "tile.shulkerBoxLightBlue", - "localizedName": "Light Blue Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, + "id": "minecraft:white_terracotta", + "localizedName": "White Terracotta", "material": { "powerSource": false, - "lightOpacity": 0, "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 223, - "id": "minecraft:yellow_shulker_box", - "unlocalizedName": "tile.shulkerBoxYellow", - "localizedName": "Yellow Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 224, - "id": "minecraft:lime_shulker_box", - "unlocalizedName": "tile.shulkerBoxLime", - "localizedName": "Lime Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 225, - "id": "minecraft:pink_shulker_box", - "unlocalizedName": "tile.shulkerBoxPink", - "localizedName": "Pink Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 226, - "id": "minecraft:gray_shulker_box", - "unlocalizedName": "tile.shulkerBoxGray", - "localizedName": "Gray Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 227, - "id": "minecraft:silver_shulker_box", - "unlocalizedName": "tile.shulkerBoxSilver", - "localizedName": "Light Gray Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 228, - "id": "minecraft:cyan_shulker_box", - "unlocalizedName": "tile.shulkerBoxCyan", - "localizedName": "Cyan Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 229, - "id": "minecraft:purple_shulker_box", - "unlocalizedName": "tile.shulkerBoxPurple", - "localizedName": "Purple Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 230, - "id": "minecraft:blue_shulker_box", - "unlocalizedName": "tile.shulkerBoxBlue", - "localizedName": "Blue Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 231, - "id": "minecraft:brown_shulker_box", - "unlocalizedName": "tile.shulkerBoxBrown", - "localizedName": "Brown Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 232, - "id": "minecraft:green_shulker_box", - "unlocalizedName": "tile.shulkerBoxGreen", - "localizedName": "Green Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 233, - "id": "minecraft:red_shulker_box", - "unlocalizedName": "tile.shulkerBoxRed", - "localizedName": "Red Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 234, - "id": "minecraft:black_shulker_box", - "unlocalizedName": "tile.shulkerBoxBlack", - "localizedName": "Black Shulker Box", - "states": { - "facing": { - "dataMask": 7, - "values": { - "down": { - "data": 0, - "direction": [ - 0, - -1, - 0 - ] - }, - "up": { - "data": 1, - "direction": [ - 0, - 1, - 0 - ] - }, - "north": { - "data": 2, - "direction": [ - 0, - 0, - -1 - ] - }, - "south": { - "data": 3, - "direction": [ - 0, - 0, - 1 - ] - }, - "west": { - "data": 4, - "direction": [ - -1, - 0, - 0 - ] - }, - "east": { - "data": 5, - "direction": [ - 1, - 0, - 0 - ] - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 0, - "lightValue": 0, - "usingNeighborLight": true, - "hardness": 2.0, - "resistance": 10.0, - "ticksRandomly": false, - "fullCube": false, - "slipperiness": 0.6, - "renderedAsNormalBlock": false, - "liquid": false, - "solid": true, - "movementBlocker": true, - "burnable": false, - "opaque": true, - "replacedDuringPlacement": false, - "toolRequired": true, - "fragileWhenPushed": false, - "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 1.0, - "grassBlocking": false - } - }, - { - "legacyId": 255, - "id": "minecraft:structure_block", - "unlocalizedName": "tile.structureBlock", - "localizedName": "Structure Block", - "states": { - "mode": { - "dataMask": 3, - "values": { - "save": { - "data": 0 - }, - "load": { - "data": 1 - }, - "corner": { - "data": 2 - }, - "data": { - "data": 3 - } - } - } - }, - "material": { - "powerSource": false, - "lightOpacity": 255, - "lightValue": 0, - "usingNeighborLight": false, - "hardness": -1.0, - "resistance": 1.8E7, + "hardness": 1.25, + "resistance": 4.2, "ticksRandomly": false, "fullCube": true, "slipperiness": 0.6, - "renderedAsNormalBlock": true, "liquid": false, "solid": true, "movementBlocker": true, @@ -15745,9 +14344,484 @@ "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "adventureModeExempt": false, - "ambientOcclusionLightValue": 0.2, - "grassBlocking": false + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:white_tulip", + "localizedName": "White Tulip", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#007c00", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:white_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:white_wool", + "localizedName": "White Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:wither_skeleton_skull", + "localizedName": "Wither Skeleton Skull", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:wither_skeleton_wall_skull", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:yellow_banner", + "localizedName": "Yellow Banner", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:yellow_bed", + "localizedName": "Yellow Bed", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.2, + "resistance": 0.2, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:yellow_carpet", + "localizedName": "Yellow Carpet", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.1, + "resistance": 0.1, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": true, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:yellow_concrete", + "localizedName": "Yellow Concrete", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.8, + "resistance": 1.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:yellow_concrete_powder", + "localizedName": "Yellow Concrete Powder", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.5, + "resistance": 0.5, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#f7e9a3", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:yellow_glazed_terracotta", + "localizedName": "Yellow Glazed Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.4, + "resistance": 1.4, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:yellow_shulker_box", + "localizedName": "Yellow Shulker Box", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 2.0, + "resistance": 2.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": true, + "hasContainer": true + } + }, + { + "id": "minecraft:yellow_stained_glass", + "localizedName": "Yellow Stained Glass", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:yellow_stained_glass_pane", + "localizedName": "Yellow Stained Glass Pane", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.3, + "resistance": 0.3, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:yellow_terracotta", + "localizedName": "Yellow Terracotta", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.25, + "resistance": 4.2, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:yellow_wall_banner", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#8f7748", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:yellow_wool", + "localizedName": "Yellow Wool", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.8, + "resistance": 0.8, + "ticksRandomly": false, + "fullCube": true, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": true, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#c7c7c7", + "isTranslucent": false, + "hasContainer": false + } + }, + { + "id": "minecraft:zombie_head", + "localizedName": "Zombie Head", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true + } + }, + { + "id": "minecraft:zombie_wall_head", + "localizedName": "Air", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 1.0, + "resistance": 1.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": false, + "movementBlocker": false, + "burnable": false, + "opaque": false, + "replacedDuringPlacement": false, + "toolRequired": false, + "fragileWhenPushed": true, + "unpushable": false, + "mapColor": "#000000", + "isTranslucent": false, + "hasContainer": true } } ] \ No newline at end of file diff --git a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/items.json b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/items.json new file mode 100644 index 000000000..c9eeb23b8 --- /dev/null +++ b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/items.json @@ -0,0 +1,3142 @@ +[ + { + "id": "minecraft:acacia_boat", + "localizedName": "Acacia Boat" + }, + { + "id": "minecraft:acacia_button", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_door", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_fence", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_fence_gate", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_leaves", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_log", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_planks", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_pressure_plate", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_sapling", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_trapdoor", + "localizedName": "Air" + }, + { + "id": "minecraft:acacia_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:activator_rail", + "localizedName": "Air" + }, + { + "id": "minecraft:air", + "localizedName": "Air" + }, + { + "id": "minecraft:allium", + "localizedName": "Air" + }, + { + "id": "minecraft:andesite", + "localizedName": "Air" + }, + { + "id": "minecraft:anvil", + "localizedName": "Air" + }, + { + "id": "minecraft:apple", + "localizedName": "Apple" + }, + { + "id": "minecraft:armor_stand", + "localizedName": "Armor Stand" + }, + { + "id": "minecraft:arrow", + "localizedName": "Arrow" + }, + { + "id": "minecraft:azure_bluet", + "localizedName": "Air" + }, + { + "id": "minecraft:baked_potato", + "localizedName": "Baked Potato" + }, + { + "id": "minecraft:barrier", + "localizedName": "Air" + }, + { + "id": "minecraft:bat_spawn_egg", + "localizedName": "Bat Spawn Egg" + }, + { + "id": "minecraft:beacon", + "localizedName": "Air" + }, + { + "id": "minecraft:bedrock", + "localizedName": "Air" + }, + { + "id": "minecraft:beef", + "localizedName": "Raw Beef" + }, + { + "id": "minecraft:beetroot", + "localizedName": "Beetroot" + }, + { + "id": "minecraft:beetroot_seeds", + "localizedName": "Beetroot Seeds" + }, + { + "id": "minecraft:beetroot_soup", + "localizedName": "Beetroot Soup" + }, + { + "id": "minecraft:birch_boat", + "localizedName": "Birch Boat" + }, + { + "id": "minecraft:birch_button", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_door", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_fence", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_fence_gate", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_leaves", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_log", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_planks", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_pressure_plate", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_sapling", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_trapdoor", + "localizedName": "Air" + }, + { + "id": "minecraft:birch_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:black_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:black_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:black_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:black_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:black_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:black_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:black_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:black_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:black_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:black_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:black_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:blaze_powder", + "localizedName": "Blaze Powder" + }, + { + "id": "minecraft:blaze_rod", + "localizedName": "Blaze Rod" + }, + { + "id": "minecraft:blaze_spawn_egg", + "localizedName": "Blaze Spawn Egg" + }, + { + "id": "minecraft:blue_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_ice", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_orchid", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:blue_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:bone", + "localizedName": "Bone" + }, + { + "id": "minecraft:bone_block", + "localizedName": "Air" + }, + { + "id": "minecraft:bone_meal", + "localizedName": "Bone Meal" + }, + { + "id": "minecraft:book", + "localizedName": "Book" + }, + { + "id": "minecraft:bookshelf", + "localizedName": "Air" + }, + { + "id": "minecraft:bow", + "localizedName": "Bow" + }, + { + "id": "minecraft:bowl", + "localizedName": "Bowl" + }, + { + "id": "minecraft:brain_coral", + "localizedName": "Air" + }, + { + "id": "minecraft:brain_coral_block", + "localizedName": "Air" + }, + { + "id": "minecraft:brain_coral_fan", + "localizedName": "Air" + }, + { + "id": "minecraft:bread", + "localizedName": "Bread" + }, + { + "id": "minecraft:brewing_stand", + "localizedName": "Air" + }, + { + "id": "minecraft:brick", + "localizedName": "Brick" + }, + { + "id": "minecraft:brick_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:brick_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_mushroom", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_mushroom_block", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:brown_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:bubble_coral", + "localizedName": "Air" + }, + { + "id": "minecraft:bubble_coral_block", + "localizedName": "Air" + }, + { + "id": "minecraft:bubble_coral_fan", + "localizedName": "Air" + }, + { + "id": "minecraft:bucket", + "localizedName": "Bucket" + }, + { + "id": "minecraft:cactus", + "localizedName": "Air" + }, + { + "id": "minecraft:cactus_green", + "localizedName": "Cactus Green" + }, + { + "id": "minecraft:cake", + "localizedName": "Air" + }, + { + "id": "minecraft:carrot", + "localizedName": "Carrot" + }, + { + "id": "minecraft:carrot_on_a_stick", + "localizedName": "Carrot on a Stick" + }, + { + "id": "minecraft:carved_pumpkin", + "localizedName": "Air" + }, + { + "id": "minecraft:cauldron", + "localizedName": "Air" + }, + { + "id": "minecraft:cave_spider_spawn_egg", + "localizedName": "Cave Spider Spawn Egg" + }, + { + "id": "minecraft:chain_command_block", + "localizedName": "Air" + }, + { + "id": "minecraft:chainmail_boots", + "localizedName": "Chainmail Boots" + }, + { + "id": "minecraft:chainmail_chestplate", + "localizedName": "Chainmail Chestplate" + }, + { + "id": "minecraft:chainmail_helmet", + "localizedName": "Chainmail Helmet" + }, + { + "id": "minecraft:chainmail_leggings", + "localizedName": "Chainmail Leggings" + }, + { + "id": "minecraft:charcoal", + "localizedName": "Charcoal" + }, + { + "id": "minecraft:chest", + "localizedName": "Air" + }, + { + "id": "minecraft:chest_minecart", + "localizedName": "Minecart with Chest" + }, + { + "id": "minecraft:chicken", + "localizedName": "Raw Chicken" + }, + { + "id": "minecraft:chicken_spawn_egg", + "localizedName": "Chicken Spawn Egg" + }, + { + "id": "minecraft:chipped_anvil", + "localizedName": "Air" + }, + { + "id": "minecraft:chiseled_quartz_block", + "localizedName": "Air" + }, + { + "id": "minecraft:chiseled_red_sandstone", + "localizedName": "Air" + }, + { + "id": "minecraft:chiseled_sandstone", + "localizedName": "Air" + }, + { + "id": "minecraft:chiseled_stone_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:chorus_flower", + "localizedName": "Air" + }, + { + "id": "minecraft:chorus_fruit", + "localizedName": "Chorus Fruit" + }, + { + "id": "minecraft:chorus_plant", + "localizedName": "Air" + }, + { + "id": "minecraft:clay", + "localizedName": "Air" + }, + { + "id": "minecraft:clay_ball", + "localizedName": "Clay" + }, + { + "id": "minecraft:clock", + "localizedName": "Clock" + }, + { + "id": "minecraft:coal", + "localizedName": "Coal" + }, + { + "id": "minecraft:coal_block", + "localizedName": "Air" + }, + { + "id": "minecraft:coal_ore", + "localizedName": "Air" + }, + { + "id": "minecraft:coarse_dirt", + "localizedName": "Air" + }, + { + "id": "minecraft:cobblestone", + "localizedName": "Air" + }, + { + "id": "minecraft:cobblestone_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:cobblestone_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:cobblestone_wall", + "localizedName": "Air" + }, + { + "id": "minecraft:cobweb", + "localizedName": "Air" + }, + { + "id": "minecraft:cocoa_beans", + "localizedName": "Cocoa Beans" + }, + { + "id": "minecraft:cod", + "localizedName": "Raw Cod" + }, + { + "id": "minecraft:cod_bucket", + "localizedName": "Bucket of Cod" + }, + { + "id": "minecraft:cod_spawn_egg", + "localizedName": "Cod Spawn Egg" + }, + { + "id": "minecraft:command_block", + "localizedName": "Air" + }, + { + "id": "minecraft:command_block_minecart", + "localizedName": "Minecart with Command Block" + }, + { + "id": "minecraft:comparator", + "localizedName": "Air" + }, + { + "id": "minecraft:compass", + "localizedName": "Compass" + }, + { + "id": "minecraft:conduit", + "localizedName": "Air" + }, + { + "id": "minecraft:cooked_beef", + "localizedName": "Steak" + }, + { + "id": "minecraft:cooked_chicken", + "localizedName": "Cooked Chicken" + }, + { + "id": "minecraft:cooked_cod", + "localizedName": "Cooked Cod" + }, + { + "id": "minecraft:cooked_mutton", + "localizedName": "Cooked Mutton" + }, + { + "id": "minecraft:cooked_porkchop", + "localizedName": "Cooked Porkchop" + }, + { + "id": "minecraft:cooked_rabbit", + "localizedName": "Cooked Rabbit" + }, + { + "id": "minecraft:cooked_salmon", + "localizedName": "Cooked Salmon" + }, + { + "id": "minecraft:cookie", + "localizedName": "Cookie" + }, + { + "id": "minecraft:cow_spawn_egg", + "localizedName": "Cow Spawn Egg" + }, + { + "id": "minecraft:cracked_stone_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:crafting_table", + "localizedName": "Air" + }, + { + "id": "minecraft:creeper_head", + "localizedName": "Air" + }, + { + "id": "minecraft:creeper_spawn_egg", + "localizedName": "Creeper Spawn Egg" + }, + { + "id": "minecraft:cut_red_sandstone", + "localizedName": "Air" + }, + { + "id": "minecraft:cut_sandstone", + "localizedName": "Air" + }, + { + "id": "minecraft:cyan_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:cyan_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:cyan_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:cyan_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:cyan_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:cyan_dye", + "localizedName": "Cyan Dye" + }, + { + "id": "minecraft:cyan_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:cyan_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:cyan_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:cyan_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:cyan_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:cyan_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:damaged_anvil", + "localizedName": "Air" + }, + { + "id": "minecraft:dandelion", + "localizedName": "Air" + }, + { + "id": "minecraft:dandelion_yellow", + "localizedName": "Dandelion Yellow" + }, + { + "id": "minecraft:dark_oak_boat", + "localizedName": "Dark Oak Boat" + }, + { + "id": "minecraft:dark_oak_button", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_door", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_fence", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_fence_gate", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_leaves", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_log", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_planks", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_pressure_plate", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_sapling", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_trapdoor", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_oak_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_prismarine", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_prismarine_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:dark_prismarine_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:daylight_detector", + "localizedName": "Air" + }, + { + "id": "minecraft:dead_brain_coral_block", + "localizedName": "Air" + }, + { + "id": "minecraft:dead_brain_coral_fan", + "localizedName": "Air" + }, + { + "id": "minecraft:dead_bubble_coral_block", + "localizedName": "Air" + }, + { + "id": "minecraft:dead_bubble_coral_fan", + "localizedName": "Air" + }, + { + "id": "minecraft:dead_bush", + "localizedName": "Air" + }, + { + "id": "minecraft:dead_fire_coral_block", + "localizedName": "Air" + }, + { + "id": "minecraft:dead_fire_coral_fan", + "localizedName": "Air" + }, + { + "id": "minecraft:dead_horn_coral_block", + "localizedName": "Air" + }, + { + "id": "minecraft:dead_horn_coral_fan", + "localizedName": "Air" + }, + { + "id": "minecraft:dead_tube_coral_block", + "localizedName": "Air" + }, + { + "id": "minecraft:dead_tube_coral_fan", + "localizedName": "Air" + }, + { + "id": "minecraft:debug_stick", + "localizedName": "Debug Stick" + }, + { + "id": "minecraft:detector_rail", + "localizedName": "Air" + }, + { + "id": "minecraft:diamond", + "localizedName": "Diamond" + }, + { + "id": "minecraft:diamond_axe", + "localizedName": "Diamond Axe" + }, + { + "id": "minecraft:diamond_block", + "localizedName": "Air" + }, + { + "id": "minecraft:diamond_boots", + "localizedName": "Diamond Boots" + }, + { + "id": "minecraft:diamond_chestplate", + "localizedName": "Diamond Chestplate" + }, + { + "id": "minecraft:diamond_helmet", + "localizedName": "Diamond Helmet" + }, + { + "id": "minecraft:diamond_hoe", + "localizedName": "Diamond Hoe" + }, + { + "id": "minecraft:diamond_horse_armor", + "localizedName": "Diamond Horse Armor" + }, + { + "id": "minecraft:diamond_leggings", + "localizedName": "Diamond Leggings" + }, + { + "id": "minecraft:diamond_ore", + "localizedName": "Air" + }, + { + "id": "minecraft:diamond_pickaxe", + "localizedName": "Diamond Pickaxe" + }, + { + "id": "minecraft:diamond_shovel", + "localizedName": "Diamond Shovel" + }, + { + "id": "minecraft:diamond_sword", + "localizedName": "Diamond Sword" + }, + { + "id": "minecraft:diorite", + "localizedName": "Air" + }, + { + "id": "minecraft:dirt", + "localizedName": "Air" + }, + { + "id": "minecraft:dispenser", + "localizedName": "Air" + }, + { + "id": "minecraft:dolphin_spawn_egg", + "localizedName": "Dolphin Spawn Egg" + }, + { + "id": "minecraft:donkey_spawn_egg", + "localizedName": "Donkey Spawn Egg" + }, + { + "id": "minecraft:dragon_breath", + "localizedName": "Dragon\u0027s Breath" + }, + { + "id": "minecraft:dragon_egg", + "localizedName": "Air" + }, + { + "id": "minecraft:dragon_head", + "localizedName": "Air" + }, + { + "id": "minecraft:dried_kelp", + "localizedName": "Dried Kelp" + }, + { + "id": "minecraft:dried_kelp_block", + "localizedName": "Air" + }, + { + "id": "minecraft:dropper", + "localizedName": "Air" + }, + { + "id": "minecraft:drowned_spawn_egg", + "localizedName": "Drowned Spawn Egg" + }, + { + "id": "minecraft:egg", + "localizedName": "Egg" + }, + { + "id": "minecraft:elder_guardian_spawn_egg", + "localizedName": "Elder Guardian Spawn Egg" + }, + { + "id": "minecraft:elytra", + "localizedName": "Elytra" + }, + { + "id": "minecraft:emerald", + "localizedName": "Emerald" + }, + { + "id": "minecraft:emerald_block", + "localizedName": "Air" + }, + { + "id": "minecraft:emerald_ore", + "localizedName": "Air" + }, + { + "id": "minecraft:enchanted_book", + "localizedName": "Enchanted Book" + }, + { + "id": "minecraft:enchanted_golden_apple", + "localizedName": "Enchanted Golden Apple" + }, + { + "id": "minecraft:enchanting_table", + "localizedName": "Air" + }, + { + "id": "minecraft:end_crystal", + "localizedName": "End Crystal" + }, + { + "id": "minecraft:end_portal_frame", + "localizedName": "Air" + }, + { + "id": "minecraft:end_rod", + "localizedName": "Air" + }, + { + "id": "minecraft:end_stone", + "localizedName": "Air" + }, + { + "id": "minecraft:end_stone_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:ender_chest", + "localizedName": "Air" + }, + { + "id": "minecraft:ender_eye", + "localizedName": "Eye of Ender" + }, + { + "id": "minecraft:ender_pearl", + "localizedName": "Ender Pearl" + }, + { + "id": "minecraft:enderman_spawn_egg", + "localizedName": "Enderman Spawn Egg" + }, + { + "id": "minecraft:endermite_spawn_egg", + "localizedName": "Endermite Spawn Egg" + }, + { + "id": "minecraft:evoker_spawn_egg", + "localizedName": "Evoker Spawn Egg" + }, + { + "id": "minecraft:experience_bottle", + "localizedName": "Bottle o\u0027 Enchanting" + }, + { + "id": "minecraft:farmland", + "localizedName": "Air" + }, + { + "id": "minecraft:feather", + "localizedName": "Feather" + }, + { + "id": "minecraft:fermented_spider_eye", + "localizedName": "Fermented Spider Eye" + }, + { + "id": "minecraft:fern", + "localizedName": "Air" + }, + { + "id": "minecraft:filled_map", + "localizedName": "Map" + }, + { + "id": "minecraft:fire_charge", + "localizedName": "Fire Charge" + }, + { + "id": "minecraft:fire_coral", + "localizedName": "Air" + }, + { + "id": "minecraft:fire_coral_block", + "localizedName": "Air" + }, + { + "id": "minecraft:fire_coral_fan", + "localizedName": "Air" + }, + { + "id": "minecraft:firework_rocket", + "localizedName": "Firework Rocket" + }, + { + "id": "minecraft:firework_star", + "localizedName": "Firework Star" + }, + { + "id": "minecraft:fishing_rod", + "localizedName": "Fishing Rod" + }, + { + "id": "minecraft:flint", + "localizedName": "Flint" + }, + { + "id": "minecraft:flint_and_steel", + "localizedName": "Flint and Steel" + }, + { + "id": "minecraft:flower_pot", + "localizedName": "Air" + }, + { + "id": "minecraft:furnace", + "localizedName": "Air" + }, + { + "id": "minecraft:furnace_minecart", + "localizedName": "Minecart with Furnace" + }, + { + "id": "minecraft:ghast_spawn_egg", + "localizedName": "Ghast Spawn Egg" + }, + { + "id": "minecraft:ghast_tear", + "localizedName": "Ghast Tear" + }, + { + "id": "minecraft:glass", + "localizedName": "Air" + }, + { + "id": "minecraft:glass_bottle", + "localizedName": "Glass Bottle" + }, + { + "id": "minecraft:glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:glistering_melon_slice", + "localizedName": "Glistering Melon Slice" + }, + { + "id": "minecraft:glowstone", + "localizedName": "Air" + }, + { + "id": "minecraft:glowstone_dust", + "localizedName": "Glowstone Dust" + }, + { + "id": "minecraft:gold_block", + "localizedName": "Air" + }, + { + "id": "minecraft:gold_ingot", + "localizedName": "Gold Ingot" + }, + { + "id": "minecraft:gold_nugget", + "localizedName": "Gold Nugget" + }, + { + "id": "minecraft:gold_ore", + "localizedName": "Air" + }, + { + "id": "minecraft:golden_apple", + "localizedName": "Golden Apple" + }, + { + "id": "minecraft:golden_axe", + "localizedName": "Golden Axe" + }, + { + "id": "minecraft:golden_boots", + "localizedName": "Golden Boots" + }, + { + "id": "minecraft:golden_carrot", + "localizedName": "Golden Carrot" + }, + { + "id": "minecraft:golden_chestplate", + "localizedName": "Golden Chestplate" + }, + { + "id": "minecraft:golden_helmet", + "localizedName": "Golden Helmet" + }, + { + "id": "minecraft:golden_hoe", + "localizedName": "Golden Hoe" + }, + { + "id": "minecraft:golden_horse_armor", + "localizedName": "Golden Horse Armor" + }, + { + "id": "minecraft:golden_leggings", + "localizedName": "Golden Leggings" + }, + { + "id": "minecraft:golden_pickaxe", + "localizedName": "Golden Pickaxe" + }, + { + "id": "minecraft:golden_shovel", + "localizedName": "Golden Shovel" + }, + { + "id": "minecraft:golden_sword", + "localizedName": "Golden Sword" + }, + { + "id": "minecraft:granite", + "localizedName": "Air" + }, + { + "id": "minecraft:grass", + "localizedName": "Air" + }, + { + "id": "minecraft:grass_block", + "localizedName": "Air" + }, + { + "id": "minecraft:grass_path", + "localizedName": "Air" + }, + { + "id": "minecraft:gravel", + "localizedName": "Air" + }, + { + "id": "minecraft:gray_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:gray_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:gray_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:gray_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:gray_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:gray_dye", + "localizedName": "Gray Dye" + }, + { + "id": "minecraft:gray_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:gray_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:gray_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:gray_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:gray_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:gray_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:green_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:green_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:green_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:green_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:green_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:green_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:green_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:green_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:green_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:green_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:green_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:guardian_spawn_egg", + "localizedName": "Guardian Spawn Egg" + }, + { + "id": "minecraft:gunpowder", + "localizedName": "Gunpowder" + }, + { + "id": "minecraft:hay_block", + "localizedName": "Air" + }, + { + "id": "minecraft:heart_of_the_sea", + "localizedName": "Heart of the Sea" + }, + { + "id": "minecraft:heavy_weighted_pressure_plate", + "localizedName": "Air" + }, + { + "id": "minecraft:hopper", + "localizedName": "Air" + }, + { + "id": "minecraft:hopper_minecart", + "localizedName": "Minecart with Hopper" + }, + { + "id": "minecraft:horn_coral", + "localizedName": "Air" + }, + { + "id": "minecraft:horn_coral_block", + "localizedName": "Air" + }, + { + "id": "minecraft:horn_coral_fan", + "localizedName": "Air" + }, + { + "id": "minecraft:horse_spawn_egg", + "localizedName": "Horse Spawn Egg" + }, + { + "id": "minecraft:husk_spawn_egg", + "localizedName": "Husk Spawn Egg" + }, + { + "id": "minecraft:ice", + "localizedName": "Air" + }, + { + "id": "minecraft:infested_chiseled_stone_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:infested_cobblestone", + "localizedName": "Air" + }, + { + "id": "minecraft:infested_cracked_stone_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:infested_mossy_stone_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:infested_stone", + "localizedName": "Air" + }, + { + "id": "minecraft:infested_stone_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:ink_sac", + "localizedName": "Ink Sac" + }, + { + "id": "minecraft:iron_axe", + "localizedName": "Iron Axe" + }, + { + "id": "minecraft:iron_bars", + "localizedName": "Air" + }, + { + "id": "minecraft:iron_block", + "localizedName": "Air" + }, + { + "id": "minecraft:iron_boots", + "localizedName": "Iron Boots" + }, + { + "id": "minecraft:iron_chestplate", + "localizedName": "Iron Chestplate" + }, + { + "id": "minecraft:iron_door", + "localizedName": "Air" + }, + { + "id": "minecraft:iron_helmet", + "localizedName": "Iron Helmet" + }, + { + "id": "minecraft:iron_hoe", + "localizedName": "Iron Hoe" + }, + { + "id": "minecraft:iron_horse_armor", + "localizedName": "Iron Horse Armor" + }, + { + "id": "minecraft:iron_ingot", + "localizedName": "Iron Ingot" + }, + { + "id": "minecraft:iron_leggings", + "localizedName": "Iron Leggings" + }, + { + "id": "minecraft:iron_nugget", + "localizedName": "Iron Nugget" + }, + { + "id": "minecraft:iron_ore", + "localizedName": "Air" + }, + { + "id": "minecraft:iron_pickaxe", + "localizedName": "Iron Pickaxe" + }, + { + "id": "minecraft:iron_shovel", + "localizedName": "Iron Shovel" + }, + { + "id": "minecraft:iron_sword", + "localizedName": "Iron Sword" + }, + { + "id": "minecraft:iron_trapdoor", + "localizedName": "Air" + }, + { + "id": "minecraft:item_frame", + "localizedName": "Item Frame" + }, + { + "id": "minecraft:jack_o_lantern", + "localizedName": "Air" + }, + { + "id": "minecraft:jukebox", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_boat", + "localizedName": "Jungle Boat" + }, + { + "id": "minecraft:jungle_button", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_door", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_fence", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_fence_gate", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_leaves", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_log", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_planks", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_pressure_plate", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_sapling", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_trapdoor", + "localizedName": "Air" + }, + { + "id": "minecraft:jungle_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:kelp", + "localizedName": "Air" + }, + { + "id": "minecraft:knowledge_book", + "localizedName": "Knowledge Book" + }, + { + "id": "minecraft:ladder", + "localizedName": "Air" + }, + { + "id": "minecraft:lapis_block", + "localizedName": "Air" + }, + { + "id": "minecraft:lapis_lazuli", + "localizedName": "Lapis Lazuli" + }, + { + "id": "minecraft:lapis_ore", + "localizedName": "Air" + }, + { + "id": "minecraft:large_fern", + "localizedName": "Air" + }, + { + "id": "minecraft:lava_bucket", + "localizedName": "Lava Bucket" + }, + { + "id": "minecraft:lead", + "localizedName": "Lead" + }, + { + "id": "minecraft:leather", + "localizedName": "Leather" + }, + { + "id": "minecraft:leather_boots", + "localizedName": "Leather Boots" + }, + { + "id": "minecraft:leather_chestplate", + "localizedName": "Leather Tunic" + }, + { + "id": "minecraft:leather_helmet", + "localizedName": "Leather Cap" + }, + { + "id": "minecraft:leather_leggings", + "localizedName": "Leather Pants" + }, + { + "id": "minecraft:lever", + "localizedName": "Air" + }, + { + "id": "minecraft:light_blue_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:light_blue_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:light_blue_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:light_blue_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:light_blue_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:light_blue_dye", + "localizedName": "Light Blue Dye" + }, + { + "id": "minecraft:light_blue_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:light_blue_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:light_blue_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:light_blue_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:light_blue_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:light_blue_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:light_gray_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:light_gray_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:light_gray_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:light_gray_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:light_gray_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:light_gray_dye", + "localizedName": "Light Gray Dye" + }, + { + "id": "minecraft:light_gray_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:light_gray_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:light_gray_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:light_gray_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:light_gray_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:light_gray_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:light_weighted_pressure_plate", + "localizedName": "Air" + }, + { + "id": "minecraft:lilac", + "localizedName": "Air" + }, + { + "id": "minecraft:lily_pad", + "localizedName": "Air" + }, + { + "id": "minecraft:lime_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:lime_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:lime_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:lime_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:lime_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:lime_dye", + "localizedName": "Lime Dye" + }, + { + "id": "minecraft:lime_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:lime_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:lime_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:lime_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:lime_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:lime_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:lingering_potion", + "localizedName": "Lingering Potion" + }, + { + "id": "minecraft:llama_spawn_egg", + "localizedName": "Llama Spawn Egg" + }, + { + "id": "minecraft:magenta_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:magenta_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:magenta_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:magenta_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:magenta_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:magenta_dye", + "localizedName": "Magenta Dye" + }, + { + "id": "minecraft:magenta_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:magenta_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:magenta_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:magenta_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:magenta_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:magenta_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:magma_block", + "localizedName": "Air" + }, + { + "id": "minecraft:magma_cream", + "localizedName": "Magma Cream" + }, + { + "id": "minecraft:magma_cube_spawn_egg", + "localizedName": "Magma Cube Spawn Egg" + }, + { + "id": "minecraft:map", + "localizedName": "Empty Map" + }, + { + "id": "minecraft:melon", + "localizedName": "Air" + }, + { + "id": "minecraft:melon_seeds", + "localizedName": "Melon Seeds" + }, + { + "id": "minecraft:melon_slice", + "localizedName": "Melon Slice" + }, + { + "id": "minecraft:milk_bucket", + "localizedName": "Milk Bucket" + }, + { + "id": "minecraft:minecart", + "localizedName": "Minecart" + }, + { + "id": "minecraft:mooshroom_spawn_egg", + "localizedName": "Mooshroom Spawn Egg" + }, + { + "id": "minecraft:mossy_cobblestone", + "localizedName": "Air" + }, + { + "id": "minecraft:mossy_cobblestone_wall", + "localizedName": "Air" + }, + { + "id": "minecraft:mossy_stone_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:mule_spawn_egg", + "localizedName": "Mule Spawn Egg" + }, + { + "id": "minecraft:mushroom_stem", + "localizedName": "Air" + }, + { + "id": "minecraft:mushroom_stew", + "localizedName": "Mushroom Stew" + }, + { + "id": "minecraft:music_disc_11", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:music_disc_13", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:music_disc_blocks", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:music_disc_cat", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:music_disc_chirp", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:music_disc_far", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:music_disc_mall", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:music_disc_mellohi", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:music_disc_stal", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:music_disc_strad", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:music_disc_wait", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:music_disc_ward", + "localizedName": "Music Disc" + }, + { + "id": "minecraft:mutton", + "localizedName": "Raw Mutton" + }, + { + "id": "minecraft:mycelium", + "localizedName": "Air" + }, + { + "id": "minecraft:name_tag", + "localizedName": "Name Tag" + }, + { + "id": "minecraft:nautilus_shell", + "localizedName": "Nautilus Shell" + }, + { + "id": "minecraft:nether_brick", + "localizedName": "Nether Brick" + }, + { + "id": "minecraft:nether_brick_fence", + "localizedName": "Air" + }, + { + "id": "minecraft:nether_brick_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:nether_brick_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:nether_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:nether_quartz_ore", + "localizedName": "Air" + }, + { + "id": "minecraft:nether_star", + "localizedName": "Nether Star" + }, + { + "id": "minecraft:nether_wart", + "localizedName": "Nether Wart" + }, + { + "id": "minecraft:nether_wart_block", + "localizedName": "Air" + }, + { + "id": "minecraft:netherrack", + "localizedName": "Air" + }, + { + "id": "minecraft:note_block", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_boat", + "localizedName": "Oak Boat" + }, + { + "id": "minecraft:oak_button", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_door", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_fence", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_fence_gate", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_leaves", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_log", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_planks", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_pressure_plate", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_sapling", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_trapdoor", + "localizedName": "Air" + }, + { + "id": "minecraft:oak_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:observer", + "localizedName": "Air" + }, + { + "id": "minecraft:obsidian", + "localizedName": "Air" + }, + { + "id": "minecraft:ocelot_spawn_egg", + "localizedName": "Ocelot Spawn Egg" + }, + { + "id": "minecraft:orange_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:orange_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:orange_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:orange_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:orange_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:orange_dye", + "localizedName": "Orange Dye" + }, + { + "id": "minecraft:orange_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:orange_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:orange_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:orange_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:orange_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:orange_tulip", + "localizedName": "Air" + }, + { + "id": "minecraft:orange_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:oxeye_daisy", + "localizedName": "Air" + }, + { + "id": "minecraft:packed_ice", + "localizedName": "Air" + }, + { + "id": "minecraft:painting", + "localizedName": "Painting" + }, + { + "id": "minecraft:paper", + "localizedName": "Paper" + }, + { + "id": "minecraft:parrot_spawn_egg", + "localizedName": "Parrot Spawn Egg" + }, + { + "id": "minecraft:peony", + "localizedName": "Air" + }, + { + "id": "minecraft:petrified_oak_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:phantom_membrane", + "localizedName": "Phantom Membrane" + }, + { + "id": "minecraft:phantom_spawn_egg", + "localizedName": "Phantom Spawn Egg" + }, + { + "id": "minecraft:pig_spawn_egg", + "localizedName": "Pig Spawn Egg" + }, + { + "id": "minecraft:pink_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:pink_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:pink_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:pink_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:pink_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:pink_dye", + "localizedName": "Pink Dye" + }, + { + "id": "minecraft:pink_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:pink_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:pink_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:pink_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:pink_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:pink_tulip", + "localizedName": "Air" + }, + { + "id": "minecraft:pink_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:piston", + "localizedName": "Air" + }, + { + "id": "minecraft:player_head", + "localizedName": "Air" + }, + { + "id": "minecraft:podzol", + "localizedName": "Air" + }, + { + "id": "minecraft:poisonous_potato", + "localizedName": "Poisonous Potato" + }, + { + "id": "minecraft:polar_bear_spawn_egg", + "localizedName": "Polar Bear Spawn Egg" + }, + { + "id": "minecraft:polished_andesite", + "localizedName": "Air" + }, + { + "id": "minecraft:polished_diorite", + "localizedName": "Air" + }, + { + "id": "minecraft:polished_granite", + "localizedName": "Air" + }, + { + "id": "minecraft:popped_chorus_fruit", + "localizedName": "Popped Chorus Fruit" + }, + { + "id": "minecraft:poppy", + "localizedName": "Air" + }, + { + "id": "minecraft:porkchop", + "localizedName": "Raw Porkchop" + }, + { + "id": "minecraft:potato", + "localizedName": "Potato" + }, + { + "id": "minecraft:potion", + "localizedName": "Potion" + }, + { + "id": "minecraft:powered_rail", + "localizedName": "Air" + }, + { + "id": "minecraft:prismarine", + "localizedName": "Air" + }, + { + "id": "minecraft:prismarine_brick_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:prismarine_brick_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:prismarine_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:prismarine_crystals", + "localizedName": "Prismarine Crystals" + }, + { + "id": "minecraft:prismarine_shard", + "localizedName": "Prismarine Shard" + }, + { + "id": "minecraft:prismarine_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:prismarine_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:pufferfish", + "localizedName": "Pufferfish" + }, + { + "id": "minecraft:pufferfish_bucket", + "localizedName": "Bucket of Pufferfish" + }, + { + "id": "minecraft:pufferfish_spawn_egg", + "localizedName": "Pufferfish Spawn Egg" + }, + { + "id": "minecraft:pumpkin", + "localizedName": "Air" + }, + { + "id": "minecraft:pumpkin_pie", + "localizedName": "Pumpkin Pie" + }, + { + "id": "minecraft:pumpkin_seeds", + "localizedName": "Pumpkin Seeds" + }, + { + "id": "minecraft:purple_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:purple_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:purple_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:purple_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:purple_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:purple_dye", + "localizedName": "Purple Dye" + }, + { + "id": "minecraft:purple_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:purple_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:purple_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:purple_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:purple_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:purple_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:purpur_block", + "localizedName": "Air" + }, + { + "id": "minecraft:purpur_pillar", + "localizedName": "Air" + }, + { + "id": "minecraft:purpur_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:purpur_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:quartz", + "localizedName": "Nether Quartz" + }, + { + "id": "minecraft:quartz_block", + "localizedName": "Air" + }, + { + "id": "minecraft:quartz_pillar", + "localizedName": "Air" + }, + { + "id": "minecraft:quartz_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:quartz_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:rabbit", + "localizedName": "Raw Rabbit" + }, + { + "id": "minecraft:rabbit_foot", + "localizedName": "Rabbit\u0027s Foot" + }, + { + "id": "minecraft:rabbit_hide", + "localizedName": "Rabbit Hide" + }, + { + "id": "minecraft:rabbit_spawn_egg", + "localizedName": "Rabbit Spawn Egg" + }, + { + "id": "minecraft:rabbit_stew", + "localizedName": "Rabbit Stew" + }, + { + "id": "minecraft:rail", + "localizedName": "Air" + }, + { + "id": "minecraft:red_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:red_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:red_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:red_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:red_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:red_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:red_mushroom", + "localizedName": "Air" + }, + { + "id": "minecraft:red_mushroom_block", + "localizedName": "Air" + }, + { + "id": "minecraft:red_nether_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:red_sand", + "localizedName": "Air" + }, + { + "id": "minecraft:red_sandstone", + "localizedName": "Air" + }, + { + "id": "minecraft:red_sandstone_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:red_sandstone_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:red_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:red_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:red_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:red_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:red_tulip", + "localizedName": "Air" + }, + { + "id": "minecraft:red_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:redstone", + "localizedName": "Air" + }, + { + "id": "minecraft:redstone_block", + "localizedName": "Air" + }, + { + "id": "minecraft:redstone_lamp", + "localizedName": "Air" + }, + { + "id": "minecraft:redstone_ore", + "localizedName": "Air" + }, + { + "id": "minecraft:redstone_torch", + "localizedName": "Air" + }, + { + "id": "minecraft:repeater", + "localizedName": "Air" + }, + { + "id": "minecraft:repeating_command_block", + "localizedName": "Air" + }, + { + "id": "minecraft:rose_bush", + "localizedName": "Air" + }, + { + "id": "minecraft:rose_red", + "localizedName": "Rose Red" + }, + { + "id": "minecraft:rotten_flesh", + "localizedName": "Rotten Flesh" + }, + { + "id": "minecraft:saddle", + "localizedName": "Saddle" + }, + { + "id": "minecraft:salmon", + "localizedName": "Raw Salmon" + }, + { + "id": "minecraft:salmon_bucket", + "localizedName": "Bucket of Salmon" + }, + { + "id": "minecraft:salmon_spawn_egg", + "localizedName": "Salmon Spawn Egg" + }, + { + "id": "minecraft:sand", + "localizedName": "Air" + }, + { + "id": "minecraft:sandstone", + "localizedName": "Air" + }, + { + "id": "minecraft:sandstone_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:sandstone_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:scute", + "localizedName": "Scute" + }, + { + "id": "minecraft:sea_lantern", + "localizedName": "Air" + }, + { + "id": "minecraft:sea_pickle", + "localizedName": "Air" + }, + { + "id": "minecraft:seagrass", + "localizedName": "Air" + }, + { + "id": "minecraft:shears", + "localizedName": "Shears" + }, + { + "id": "minecraft:sheep_spawn_egg", + "localizedName": "Sheep Spawn Egg" + }, + { + "id": "minecraft:shield", + "localizedName": "Shield" + }, + { + "id": "minecraft:shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:shulker_shell", + "localizedName": "Shulker Shell" + }, + { + "id": "minecraft:shulker_spawn_egg", + "localizedName": "Shulker Spawn Egg" + }, + { + "id": "minecraft:sign", + "localizedName": "Air" + }, + { + "id": "minecraft:silverfish_spawn_egg", + "localizedName": "Silverfish Spawn Egg" + }, + { + "id": "minecraft:skeleton_horse_spawn_egg", + "localizedName": "Skeleton Horse Spawn Egg" + }, + { + "id": "minecraft:skeleton_skull", + "localizedName": "Air" + }, + { + "id": "minecraft:skeleton_spawn_egg", + "localizedName": "Skeleton Spawn Egg" + }, + { + "id": "minecraft:slime_ball", + "localizedName": "Slimeball" + }, + { + "id": "minecraft:slime_block", + "localizedName": "Air" + }, + { + "id": "minecraft:slime_spawn_egg", + "localizedName": "Slime Spawn Egg" + }, + { + "id": "minecraft:smooth_quartz", + "localizedName": "Air" + }, + { + "id": "minecraft:smooth_red_sandstone", + "localizedName": "Air" + }, + { + "id": "minecraft:smooth_sandstone", + "localizedName": "Air" + }, + { + "id": "minecraft:smooth_stone", + "localizedName": "Air" + }, + { + "id": "minecraft:snow", + "localizedName": "Air" + }, + { + "id": "minecraft:snow_block", + "localizedName": "Air" + }, + { + "id": "minecraft:snowball", + "localizedName": "Snowball" + }, + { + "id": "minecraft:soul_sand", + "localizedName": "Air" + }, + { + "id": "minecraft:spawner", + "localizedName": "Air" + }, + { + "id": "minecraft:spectral_arrow", + "localizedName": "Spectral Arrow" + }, + { + "id": "minecraft:spider_eye", + "localizedName": "Spider Eye" + }, + { + "id": "minecraft:spider_spawn_egg", + "localizedName": "Spider Spawn Egg" + }, + { + "id": "minecraft:splash_potion", + "localizedName": "Splash Potion" + }, + { + "id": "minecraft:sponge", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_boat", + "localizedName": "Spruce Boat" + }, + { + "id": "minecraft:spruce_button", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_door", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_fence", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_fence_gate", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_leaves", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_log", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_planks", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_pressure_plate", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_sapling", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_trapdoor", + "localizedName": "Air" + }, + { + "id": "minecraft:spruce_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:squid_spawn_egg", + "localizedName": "Squid Spawn Egg" + }, + { + "id": "minecraft:stick", + "localizedName": "Stick" + }, + { + "id": "minecraft:sticky_piston", + "localizedName": "Air" + }, + { + "id": "minecraft:stone", + "localizedName": "Air" + }, + { + "id": "minecraft:stone_axe", + "localizedName": "Stone Axe" + }, + { + "id": "minecraft:stone_brick_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:stone_brick_stairs", + "localizedName": "Air" + }, + { + "id": "minecraft:stone_bricks", + "localizedName": "Air" + }, + { + "id": "minecraft:stone_button", + "localizedName": "Air" + }, + { + "id": "minecraft:stone_hoe", + "localizedName": "Stone Hoe" + }, + { + "id": "minecraft:stone_pickaxe", + "localizedName": "Stone Pickaxe" + }, + { + "id": "minecraft:stone_pressure_plate", + "localizedName": "Air" + }, + { + "id": "minecraft:stone_shovel", + "localizedName": "Stone Shovel" + }, + { + "id": "minecraft:stone_slab", + "localizedName": "Air" + }, + { + "id": "minecraft:stone_sword", + "localizedName": "Stone Sword" + }, + { + "id": "minecraft:stray_spawn_egg", + "localizedName": "Stray Spawn Egg" + }, + { + "id": "minecraft:string", + "localizedName": "String" + }, + { + "id": "minecraft:stripped_acacia_log", + "localizedName": "Air" + }, + { + "id": "minecraft:stripped_acacia_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:stripped_birch_log", + "localizedName": "Air" + }, + { + "id": "minecraft:stripped_birch_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:stripped_dark_oak_log", + "localizedName": "Air" + }, + { + "id": "minecraft:stripped_dark_oak_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:stripped_jungle_log", + "localizedName": "Air" + }, + { + "id": "minecraft:stripped_jungle_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:stripped_oak_log", + "localizedName": "Air" + }, + { + "id": "minecraft:stripped_oak_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:stripped_spruce_log", + "localizedName": "Air" + }, + { + "id": "minecraft:stripped_spruce_wood", + "localizedName": "Air" + }, + { + "id": "minecraft:structure_block", + "localizedName": "Air" + }, + { + "id": "minecraft:structure_void", + "localizedName": "Air" + }, + { + "id": "minecraft:sugar", + "localizedName": "Sugar" + }, + { + "id": "minecraft:sugar_cane", + "localizedName": "Air" + }, + { + "id": "minecraft:sunflower", + "localizedName": "Air" + }, + { + "id": "minecraft:tall_grass", + "localizedName": "Air" + }, + { + "id": "minecraft:terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:tipped_arrow", + "localizedName": "Tipped Arrow" + }, + { + "id": "minecraft:tnt", + "localizedName": "Air" + }, + { + "id": "minecraft:tnt_minecart", + "localizedName": "Minecart with TNT" + }, + { + "id": "minecraft:torch", + "localizedName": "Air" + }, + { + "id": "minecraft:totem_of_undying", + "localizedName": "Totem of Undying" + }, + { + "id": "minecraft:trapped_chest", + "localizedName": "Air" + }, + { + "id": "minecraft:trident", + "localizedName": "Trident" + }, + { + "id": "minecraft:tripwire_hook", + "localizedName": "Air" + }, + { + "id": "minecraft:tropical_fish", + "localizedName": "Tropical Fish" + }, + { + "id": "minecraft:tropical_fish_bucket", + "localizedName": "Bucket of Tropical Fish" + }, + { + "id": "minecraft:tropical_fish_spawn_egg", + "localizedName": "Tropical Fish Spawn Egg" + }, + { + "id": "minecraft:tube_coral", + "localizedName": "Air" + }, + { + "id": "minecraft:tube_coral_block", + "localizedName": "Air" + }, + { + "id": "minecraft:tube_coral_fan", + "localizedName": "Air" + }, + { + "id": "minecraft:turtle_egg", + "localizedName": "Air" + }, + { + "id": "minecraft:turtle_helmet", + "localizedName": "Turtle Shell" + }, + { + "id": "minecraft:turtle_spawn_egg", + "localizedName": "Turtle Spawn Egg" + }, + { + "id": "minecraft:vex_spawn_egg", + "localizedName": "Vex Spawn Egg" + }, + { + "id": "minecraft:villager_spawn_egg", + "localizedName": "Villager Spawn Egg" + }, + { + "id": "minecraft:vindicator_spawn_egg", + "localizedName": "Vindicator Spawn Egg" + }, + { + "id": "minecraft:vine", + "localizedName": "Air" + }, + { + "id": "minecraft:water_bucket", + "localizedName": "Water Bucket" + }, + { + "id": "minecraft:wet_sponge", + "localizedName": "Air" + }, + { + "id": "minecraft:wheat", + "localizedName": "Wheat" + }, + { + "id": "minecraft:wheat_seeds", + "localizedName": "Wheat Seeds" + }, + { + "id": "minecraft:white_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:white_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:white_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:white_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:white_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:white_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:white_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:white_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:white_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:white_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:white_tulip", + "localizedName": "Air" + }, + { + "id": "minecraft:white_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:witch_spawn_egg", + "localizedName": "Witch Spawn Egg" + }, + { + "id": "minecraft:wither_skeleton_skull", + "localizedName": "Air" + }, + { + "id": "minecraft:wither_skeleton_spawn_egg", + "localizedName": "Wither Skeleton Spawn Egg" + }, + { + "id": "minecraft:wolf_spawn_egg", + "localizedName": "Wolf Spawn Egg" + }, + { + "id": "minecraft:wooden_axe", + "localizedName": "Wooden Axe" + }, + { + "id": "minecraft:wooden_hoe", + "localizedName": "Wooden Hoe" + }, + { + "id": "minecraft:wooden_pickaxe", + "localizedName": "Wooden Pickaxe" + }, + { + "id": "minecraft:wooden_shovel", + "localizedName": "Wooden Shovel" + }, + { + "id": "minecraft:wooden_sword", + "localizedName": "Wooden Sword" + }, + { + "id": "minecraft:writable_book", + "localizedName": "Book and Quill" + }, + { + "id": "minecraft:written_book", + "localizedName": "Written Book" + }, + { + "id": "minecraft:yellow_banner", + "localizedName": "Air" + }, + { + "id": "minecraft:yellow_bed", + "localizedName": "Air" + }, + { + "id": "minecraft:yellow_carpet", + "localizedName": "Air" + }, + { + "id": "minecraft:yellow_concrete", + "localizedName": "Air" + }, + { + "id": "minecraft:yellow_concrete_powder", + "localizedName": "Air" + }, + { + "id": "minecraft:yellow_glazed_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:yellow_shulker_box", + "localizedName": "Air" + }, + { + "id": "minecraft:yellow_stained_glass", + "localizedName": "Air" + }, + { + "id": "minecraft:yellow_stained_glass_pane", + "localizedName": "Air" + }, + { + "id": "minecraft:yellow_terracotta", + "localizedName": "Air" + }, + { + "id": "minecraft:yellow_wool", + "localizedName": "Air" + }, + { + "id": "minecraft:zombie_head", + "localizedName": "Air" + }, + { + "id": "minecraft:zombie_horse_spawn_egg", + "localizedName": "Zombie Horse Spawn Egg" + }, + { + "id": "minecraft:zombie_pigman_spawn_egg", + "localizedName": "Zombie Pigman Spawn Egg" + }, + { + "id": "minecraft:zombie_spawn_egg", + "localizedName": "Zombie Spawn Egg" + }, + { + "id": "minecraft:zombie_villager_spawn_egg", + "localizedName": "Zombie Villager Spawn Egg" + } +] \ No newline at end of file diff --git a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json new file mode 100644 index 000000000..de49e6443 --- /dev/null +++ b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json @@ -0,0 +1,2332 @@ +{ + "blocks": { + "0:0": "minecraft:air", + "1:0": "minecraft:stone", + "1:1": "minecraft:granite", + "1:2": "minecraft:polished_granite", + "1:3": "minecraft:diorite", + "1:4": "minecraft:polished_diorite", + "1:5": "minecraft:andesite", + "1:6": "minecraft:polished_andesite", + "2:0": "minecraft:grass_block[snowy=false]", + "3:0": "minecraft:dirt", + "3:1": "minecraft:coarse_dirt", + "3:2": "minecraft:podzol[snowy=false]", + "4:0": "minecraft:cobblestone", + "5:0": "minecraft:oak_planks", + "5:1": "minecraft:spruce_planks", + "5:2": "minecraft:birch_planks", + "5:3": "minecraft:jungle_planks", + "5:4": "minecraft:acacia_planks", + "5:5": "minecraft:dark_oak_planks", + "6:0": "minecraft:oak_sapling[stage=0]", + "6:1": "minecraft:spruce_sapling[stage=0]", + "6:2": "minecraft:birch_sapling[stage=0]", + "6:3": "minecraft:jungle_sapling[stage=0]", + "6:4": "minecraft:acacia_sapling[stage=0]", + "6:5": "minecraft:dark_oak_sapling[stage=0]", + "6:8": "minecraft:oak_sapling[stage=1]", + "6:9": "minecraft:spruce_sapling[stage=1]", + "6:10": "minecraft:birch_sapling[stage=1]", + "6:11": "minecraft:jungle_sapling[stage=1]", + "6:12": "minecraft:acacia_sapling[stage=1]", + "6:13": "minecraft:dark_oak_sapling[stage=1]", + "7:0": "minecraft:bedrock", + "8:0": "minecraft:water[level=0]", + "8:1": "minecraft:water[level=1]", + "8:2": "minecraft:water[level=2]", + "8:3": "minecraft:water[level=3]", + "8:4": "minecraft:water[level=4]", + "8:5": "minecraft:water[level=5]", + "8:6": "minecraft:water[level=6]", + "8:7": "minecraft:water[level=7]", + "8:8": "minecraft:water[level=8]", + "8:9": "minecraft:water[level=9]", + "8:10": "minecraft:water[level=10]", + "8:11": "minecraft:water[level=11]", + "8:12": "minecraft:water[level=12]", + "8:13": "minecraft:water[level=13]", + "8:14": "minecraft:water[level=14]", + "8:15": "minecraft:water[level=15]", + "9:0": "minecraft:water[level=0]", + "9:1": "minecraft:water[level=1]", + "9:2": "minecraft:water[level=2]", + "9:3": "minecraft:water[level=3]", + "9:4": "minecraft:water[level=4]", + "9:5": "minecraft:water[level=5]", + "9:6": "minecraft:water[level=6]", + "9:7": "minecraft:water[level=7]", + "9:8": "minecraft:water[level=8]", + "9:9": "minecraft:water[level=9]", + "9:10": "minecraft:water[level=10]", + "9:11": "minecraft:water[level=11]", + "9:12": "minecraft:water[level=12]", + "9:13": "minecraft:water[level=13]", + "9:14": "minecraft:water[level=14]", + "9:15": "minecraft:water[level=15]", + "10:0": "minecraft:lava[level=0]", + "10:1": "minecraft:lava[level=1]", + "10:2": "minecraft:lava[level=2]", + "10:3": "minecraft:lava[level=3]", + "10:4": "minecraft:lava[level=4]", + "10:5": "minecraft:lava[level=5]", + "10:6": "minecraft:lava[level=6]", + "10:7": "minecraft:lava[level=7]", + "10:8": "minecraft:lava[level=8]", + "10:9": "minecraft:lava[level=9]", + "10:10": "minecraft:lava[level=10]", + "10:11": "minecraft:lava[level=11]", + "10:12": "minecraft:lava[level=12]", + "10:13": "minecraft:lava[level=13]", + "10:14": "minecraft:lava[level=14]", + "10:15": "minecraft:lava[level=15]", + "11:0": "minecraft:lava[level=0]", + "11:1": "minecraft:lava[level=1]", + "11:2": "minecraft:lava[level=2]", + "11:3": "minecraft:lava[level=3]", + "11:4": "minecraft:lava[level=4]", + "11:5": "minecraft:lava[level=5]", + "11:6": "minecraft:lava[level=6]", + "11:7": "minecraft:lava[level=7]", + "11:8": "minecraft:lava[level=8]", + "11:9": "minecraft:lava[level=9]", + "11:10": "minecraft:lava[level=10]", + "11:11": "minecraft:lava[level=11]", + "11:12": "minecraft:lava[level=12]", + "11:13": "minecraft:lava[level=13]", + "11:14": "minecraft:lava[level=14]", + "11:15": "minecraft:lava[level=15]", + "12:0": "minecraft:sand", + "12:1": "minecraft:red_sand", + "13:0": "minecraft:gravel", + "14:0": "minecraft:gold_ore", + "15:0": "minecraft:iron_ore", + "16:0": "minecraft:coal_ore", + "17:0": "minecraft:oak_log[axis=y]", + "17:1": "minecraft:spruce_log[axis=y]", + "17:2": "minecraft:birch_log[axis=y]", + "17:3": "minecraft:jungle_log[axis=y]", + "17:4": "minecraft:oak_log[axis=x]", + "17:5": "minecraft:spruce_log[axis=x]", + "17:6": "minecraft:birch_log[axis=x]", + "17:7": "minecraft:jungle_log[axis=x]", + "17:8": "minecraft:oak_log[axis=z]", + "17:9": "minecraft:spruce_log[axis=z]", + "17:10": "minecraft:birch_log[axis=z]", + "17:11": "minecraft:jungle_log[axis=z]", + "17:12": "minecraft:oak_wood", + "17:13": "minecraft:spruce_wood", + "17:14": "minecraft:birch_wood", + "17:15": "minecraft:jungle_wood", + "18:0": "minecraft:oak_leaves[persistent=false,distance=1]", + "18:1": "minecraft:spruce_leaves[persistent=false,distance=1]", + "18:2": "minecraft:birch_leaves[persistent=false,distance=1]", + "18:3": "minecraft:jungle_leaves[persistent=false,distance=1]", + "18:4": "minecraft:oak_leaves[persistent=true,distance=1]", + "18:5": "minecraft:spruce_leaves[persistent=true,distance=1]", + "18:6": "minecraft:birch_leaves[persistent=true,distance=1]", + "18:7": "minecraft:jungle_leaves[persistent=true,distance=1]", + "18:8": "minecraft:oak_leaves[persistent=false,distance=1]", + "18:9": "minecraft:spruce_leaves[persistent=false,distance=1]", + "18:10": "minecraft:birch_leaves[persistent=false,distance=1]", + "18:11": "minecraft:jungle_leaves[persistent=false,distance=1]", + "18:12": "minecraft:oak_leaves[persistent=true,distance=1]", + "18:13": "minecraft:spruce_leaves[persistent=true,distance=1]", + "18:14": "minecraft:birch_leaves[persistent=true,distance=1]", + "18:15": "minecraft:jungle_leaves[persistent=true,distance=1]", + "19:0": "minecraft:sponge", + "19:1": "minecraft:wet_sponge", + "20:0": "minecraft:glass", + "21:0": "minecraft:lapis_ore", + "22:0": "minecraft:lapis_block", + "23:0": "minecraft:dispenser[triggered=false,facing=down]", + "23:1": "minecraft:dispenser[triggered=false,facing=up]", + "23:2": "minecraft:dispenser[triggered=false,facing=north]", + "23:3": "minecraft:dispenser[triggered=false,facing=south]", + "23:4": "minecraft:dispenser[triggered=false,facing=west]", + "23:5": "minecraft:dispenser[triggered=false,facing=east]", + "23:8": "minecraft:dispenser[triggered=true,facing=down]", + "23:9": "minecraft:dispenser[triggered=true,facing=up]", + "23:10": "minecraft:dispenser[triggered=true,facing=north]", + "23:11": "minecraft:dispenser[triggered=true,facing=south]", + "23:12": "minecraft:dispenser[triggered=true,facing=west]", + "23:13": "minecraft:dispenser[triggered=true,facing=east]", + "24:0": "minecraft:sandstone", + "24:1": "minecraft:chiseled_sandstone", + "24:2": "minecraft:cut_sandstone", + "25:0": "minecraft:note_block", + "26:0": "minecraft:red_bed[part=foot,facing=south,occupied=false]", + "26:1": "minecraft:red_bed[part=foot,facing=west,occupied=false]", + "26:2": "minecraft:red_bed[part=foot,facing=north,occupied=false]", + "26:3": "minecraft:red_bed[part=foot,facing=east,occupied=false]", + "26:4": "minecraft:red_bed[part=foot,facing=south,occupied=true]", + "26:5": "minecraft:red_bed[part=foot,facing=west,occupied=true]", + "26:6": "minecraft:red_bed[part=foot,facing=north,occupied=true]", + "26:7": "minecraft:red_bed[part=foot,facing=east,occupied=true]", + "26:8": "minecraft:red_bed[part=head,facing=south,occupied=false]", + "26:9": "minecraft:red_bed[part=head,facing=west,occupied=false]", + "26:10": "minecraft:red_bed[part=head,facing=north,occupied=false]", + "26:11": "minecraft:red_bed[part=head,facing=east,occupied=false]", + "26:12": "minecraft:red_bed[part=head,facing=south,occupied=true]", + "26:13": "minecraft:red_bed[part=head,facing=west,occupied=true]", + "26:14": "minecraft:red_bed[part=head,facing=north,occupied=true]", + "26:15": "minecraft:red_bed[part=head,facing=east,occupied=true]", + "27:0": "minecraft:powered_rail[shape=north_south,powered=false]", + "27:1": "minecraft:powered_rail[shape=east_west,powered=false]", + "27:2": "minecraft:powered_rail[shape=ascending_east,powered=false]", + "27:3": "minecraft:powered_rail[shape=ascending_west,powered=false]", + "27:4": "minecraft:powered_rail[shape=ascending_north,powered=false]", + "27:5": "minecraft:powered_rail[shape=ascending_south,powered=false]", + "27:8": "minecraft:powered_rail[shape=north_south,powered=true]", + "27:9": "minecraft:powered_rail[shape=east_west,powered=true]", + "27:10": "minecraft:powered_rail[shape=ascending_east,powered=true]", + "27:11": "minecraft:powered_rail[shape=ascending_west,powered=true]", + "27:12": "minecraft:powered_rail[shape=ascending_north,powered=true]", + "27:13": "minecraft:powered_rail[shape=ascending_south,powered=true]", + "28:0": "minecraft:detector_rail[shape=north_south,powered=false]", + "28:1": "minecraft:detector_rail[shape=east_west,powered=false]", + "28:2": "minecraft:detector_rail[shape=ascending_east,powered=false]", + "28:3": "minecraft:detector_rail[shape=ascending_west,powered=false]", + "28:4": "minecraft:detector_rail[shape=ascending_north,powered=false]", + "28:5": "minecraft:detector_rail[shape=ascending_south,powered=false]", + "28:8": "minecraft:detector_rail[shape=north_south,powered=true]", + "28:9": "minecraft:detector_rail[shape=east_west,powered=true]", + "28:10": "minecraft:detector_rail[shape=ascending_east,powered=true]", + "28:11": "minecraft:detector_rail[shape=ascending_west,powered=true]", + "28:12": "minecraft:detector_rail[shape=ascending_north,powered=true]", + "28:13": "minecraft:detector_rail[shape=ascending_south,powered=true]", + "29:0": "minecraft:sticky_piston[facing=down,extended=false]", + "29:1": "minecraft:sticky_piston[facing=up,extended=false]", + "29:2": "minecraft:sticky_piston[facing=north,extended=false]", + "29:3": "minecraft:sticky_piston[facing=south,extended=false]", + "29:4": "minecraft:sticky_piston[facing=west,extended=false]", + "29:5": "minecraft:sticky_piston[facing=east,extended=false]", + "29:8": "minecraft:sticky_piston[facing=down,extended=true]", + "29:9": "minecraft:sticky_piston[facing=up,extended=true]", + "29:10": "minecraft:sticky_piston[facing=north,extended=true]", + "29:11": "minecraft:sticky_piston[facing=south,extended=true]", + "29:12": "minecraft:sticky_piston[facing=west,extended=true]", + "29:13": "minecraft:sticky_piston[facing=east,extended=true]", + "30:0": "minecraft:cobweb", + "31:0": "minecraft:dead_bush", + "31:1": "minecraft:grass", + "31:2": "minecraft:fern", + "32:0": "minecraft:dead_bush", + "33:0": "minecraft:piston[facing=down,extended=false]", + "33:1": "minecraft:piston[facing=up,extended=false]", + "33:2": "minecraft:piston[facing=north,extended=false]", + "33:3": "minecraft:piston[facing=south,extended=false]", + "33:4": "minecraft:piston[facing=west,extended=false]", + "33:5": "minecraft:piston[facing=east,extended=false]", + "33:8": "minecraft:piston[facing=down,extended=true]", + "33:9": "minecraft:piston[facing=up,extended=true]", + "33:10": "minecraft:piston[facing=north,extended=true]", + "33:11": "minecraft:piston[facing=south,extended=true]", + "33:12": "minecraft:piston[facing=west,extended=true]", + "33:13": "minecraft:piston[facing=east,extended=true]", + "34:0": "minecraft:piston_head[short=false,facing=down,type=normal]", + "34:1": "minecraft:piston_head[short=false,facing=up,type=normal]", + "34:2": "minecraft:piston_head[short=false,facing=north,type=normal]", + "34:3": "minecraft:piston_head[short=false,facing=south,type=normal]", + "34:4": "minecraft:piston_head[short=false,facing=west,type=normal]", + "34:5": "minecraft:piston_head[short=false,facing=east,type=normal]", + "34:8": "minecraft:piston_head[short=false,facing=down,type=sticky]", + "34:9": "minecraft:piston_head[short=false,facing=up,type=sticky]", + "34:10": "minecraft:piston_head[short=false,facing=north,type=sticky]", + "34:11": "minecraft:piston_head[short=false,facing=south,type=sticky]", + "34:12": "minecraft:piston_head[short=false,facing=west,type=sticky]", + "34:13": "minecraft:piston_head[short=false,facing=east,type=sticky]", + "35:0": "minecraft:white_wool", + "35:1": "minecraft:orange_wool", + "35:2": "minecraft:magenta_wool", + "35:3": "minecraft:light_blue_wool", + "35:4": "minecraft:yellow_wool", + "35:5": "minecraft:lime_wool", + "35:6": "minecraft:pink_wool", + "35:7": "minecraft:gray_wool", + "35:8": "minecraft:light_gray_wool", + "35:9": "minecraft:cyan_wool", + "35:10": "minecraft:purple_wool", + "35:11": "minecraft:blue_wool", + "35:12": "minecraft:brown_wool", + "35:13": "minecraft:green_wool", + "35:14": "minecraft:red_wool", + "35:15": "minecraft:black_wool", + "36:0": "minecraft:moving_piston[facing=down,type=normal]", + "36:1": "minecraft:moving_piston[facing=up,type=normal]", + "36:2": "minecraft:moving_piston[facing=north,type=normal]", + "36:3": "minecraft:moving_piston[facing=south,type=normal]", + "36:4": "minecraft:moving_piston[facing=west,type=normal]", + "36:5": "minecraft:moving_piston[facing=east,type=normal]", + "36:8": "minecraft:moving_piston[facing=down,type=sticky]", + "36:9": "minecraft:moving_piston[facing=up,type=sticky]", + "36:10": "minecraft:moving_piston[facing=north,type=sticky]", + "36:11": "minecraft:moving_piston[facing=south,type=sticky]", + "36:12": "minecraft:moving_piston[facing=west,type=sticky]", + "36:13": "minecraft:moving_piston[facing=east,type=sticky]", + "37:0": "minecraft:dandelion", + "38:0": "minecraft:poppy", + "38:1": "minecraft:blue_orchid", + "38:2": "minecraft:allium", + "38:3": "minecraft:azure_bluet", + "38:4": "minecraft:red_tulip", + "38:5": "minecraft:orange_tulip", + "38:6": "minecraft:white_tulip", + "38:7": "minecraft:pink_tulip", + "38:8": "minecraft:oxeye_daisy", + "39:0": "minecraft:brown_mushroom", + "40:0": "minecraft:red_mushroom", + "41:0": "minecraft:gold_block", + "42:0": "minecraft:iron_block", + "43:0": "minecraft:stone_slab[type=double]", + "43:1": "minecraft:sandstone_slab[type=double]", + "43:2": "minecraft:petrified_oak_slab[type=double]", + "43:3": "minecraft:cobblestone_slab[type=double]", + "43:4": "minecraft:brick_slab[type=double]", + "43:5": "minecraft:stone_brick_slab[type=double]", + "43:6": "minecraft:nether_brick_slab[type=double]", + "43:7": "minecraft:quartz_slab[type=double]", + "43:8": "minecraft:smooth_stone", + "43:9": "minecraft:smooth_sandstone", + "43:10": "minecraft:petrified_oak_slab[type=double]", + "43:11": "minecraft:cobblestone_slab[type=double]", + "43:12": "minecraft:brick_slab[type=double]", + "43:13": "minecraft:stone_brick_slab[type=double]", + "43:14": "minecraft:nether_brick_slab[type=double]", + "43:15": "minecraft:smooth_quartz", + "44:0": "minecraft:stone_slab[type=bottom]", + "44:1": "minecraft:sandstone_slab[type=bottom]", + "44:2": "minecraft:petrified_oak_slab[type=bottom]", + "44:3": "minecraft:cobblestone_slab[type=bottom]", + "44:4": "minecraft:brick_slab[type=bottom]", + "44:5": "minecraft:stone_brick_slab[type=bottom]", + "44:6": "minecraft:nether_brick_slab[type=bottom]", + "44:7": "minecraft:quartz_slab[type=bottom]", + "44:8": "minecraft:stone_slab[type=top]", + "44:9": "minecraft:sandstone_slab[type=top]", + "44:10": "minecraft:petrified_oak_slab[type=top]", + "44:11": "minecraft:cobblestone_slab[type=top]", + "44:12": "minecraft:brick_slab[type=top]", + "44:13": "minecraft:stone_brick_slab[type=top]", + "44:14": "minecraft:nether_brick_slab[type=top]", + "44:15": "minecraft:quartz_slab[type=top]", + "45:0": "minecraft:bricks", + "46:0": "minecraft:tnt[unstable=false]", + "46:1": "minecraft:tnt[unstable=true]", + "47:0": "minecraft:bookshelf", + "48:0": "minecraft:mossy_cobblestone", + "49:0": "minecraft:obsidian", + "50:1": "minecraft:wall_torch[facing=east]", + "50:2": "minecraft:wall_torch[facing=west]", + "50:3": "minecraft:wall_torch[facing=south]", + "50:4": "minecraft:wall_torch[facing=north]", + "50:5": "minecraft:torch", + "51:0": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=0]", + "51:1": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=1]", + "51:2": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=2]", + "51:3": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=3]", + "51:4": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=4]", + "51:5": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=5]", + "51:6": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=6]", + "51:7": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=7]", + "51:8": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=8]", + "51:9": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=9]", + "51:10": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=10]", + "51:11": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=11]", + "51:12": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=12]", + "51:13": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=13]", + "51:14": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=14]", + "51:15": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=15]", + "52:0": "minecraft:spawner", + "53:0": "minecraft:oak_stairs[half=bottom,shape=outer_right,facing=east]", + "53:1": "minecraft:oak_stairs[half=bottom,shape=outer_right,facing=west]", + "53:2": "minecraft:oak_stairs[half=bottom,shape=outer_right,facing=south]", + "53:3": "minecraft:oak_stairs[half=bottom,shape=outer_right,facing=north]", + "53:4": "minecraft:oak_stairs[half=top,shape=outer_right,facing=east]", + "53:5": "minecraft:oak_stairs[half=top,shape=outer_right,facing=west]", + "53:6": "minecraft:oak_stairs[half=top,shape=outer_right,facing=south]", + "53:7": "minecraft:oak_stairs[half=top,shape=outer_right,facing=north]", + "54:2": "minecraft:chest[facing=north,type=single]", + "54:3": "minecraft:chest[facing=south,type=single]", + "54:4": "minecraft:chest[facing=west,type=single]", + "54:5": "minecraft:chest[facing=east,type=single]", + "55:0": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=0]", + "55:1": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=1]", + "55:2": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=2]", + "55:3": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=3]", + "55:4": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=4]", + "55:5": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=5]", + "55:6": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=6]", + "55:7": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=7]", + "55:8": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=8]", + "55:9": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=9]", + "55:10": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=10]", + "55:11": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=11]", + "55:12": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=12]", + "55:13": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=13]", + "55:14": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=14]", + "55:15": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=15]", + "56:0": "minecraft:diamond_ore", + "57:0": "minecraft:diamond_block", + "58:0": "minecraft:crafting_table", + "59:0": "minecraft:wheat[age=0]", + "59:1": "minecraft:wheat[age=1]", + "59:2": "minecraft:wheat[age=2]", + "59:3": "minecraft:wheat[age=3]", + "59:4": "minecraft:wheat[age=4]", + "59:5": "minecraft:wheat[age=5]", + "59:6": "minecraft:wheat[age=6]", + "59:7": "minecraft:wheat[age=7]", + "60:0": "minecraft:farmland[moisture=0]", + "60:1": "minecraft:farmland[moisture=1]", + "60:2": "minecraft:farmland[moisture=2]", + "60:3": "minecraft:farmland[moisture=3]", + "60:4": "minecraft:farmland[moisture=4]", + "60:5": "minecraft:farmland[moisture=5]", + "60:6": "minecraft:farmland[moisture=6]", + "60:7": "minecraft:farmland[moisture=7]", + "61:2": "minecraft:furnace[facing=north,lit=false]", + "61:3": "minecraft:furnace[facing=south,lit=false]", + "61:4": "minecraft:furnace[facing=west,lit=false]", + "61:5": "minecraft:furnace[facing=east,lit=false]", + "62:2": "minecraft:furnace[facing=north,lit=true]", + "62:3": "minecraft:furnace[facing=south,lit=true]", + "62:4": "minecraft:furnace[facing=west,lit=true]", + "62:5": "minecraft:furnace[facing=east,lit=true]", + "63:0": "minecraft:sign[rotation=0]", + "63:1": "minecraft:sign[rotation=1]", + "63:2": "minecraft:sign[rotation=2]", + "63:3": "minecraft:sign[rotation=3]", + "63:4": "minecraft:sign[rotation=4]", + "63:5": "minecraft:sign[rotation=5]", + "63:6": "minecraft:sign[rotation=6]", + "63:7": "minecraft:sign[rotation=7]", + "63:8": "minecraft:sign[rotation=8]", + "63:9": "minecraft:sign[rotation=9]", + "63:10": "minecraft:sign[rotation=10]", + "63:11": "minecraft:sign[rotation=11]", + "63:12": "minecraft:sign[rotation=12]", + "63:13": "minecraft:sign[rotation=13]", + "63:14": "minecraft:sign[rotation=14]", + "63:15": "minecraft:sign[rotation=15]", + "64:0": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=east,open=false]", + "64:1": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=south,open=false]", + "64:2": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=west,open=false]", + "64:3": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=north,open=false]", + "64:4": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=east,open=true]", + "64:5": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=south,open=true]", + "64:6": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=west,open=true]", + "64:7": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=north,open=true]", + "64:8": "minecraft:oak_door[hinge=left,half=upper,powered=false,facing=east,open=false]", + "64:9": "minecraft:oak_door[hinge=right,half=upper,powered=false,facing=east,open=false]", + "64:10": "minecraft:oak_door[hinge=left,half=upper,powered=true,facing=east,open=false]", + "64:11": "minecraft:oak_door[hinge=right,half=upper,powered=true,facing=east,open=false]", + "65:2": "minecraft:ladder[facing=north]", + "65:3": "minecraft:ladder[facing=south]", + "65:4": "minecraft:ladder[facing=west]", + "65:5": "minecraft:ladder[facing=east]", + "66:0": "minecraft:rail[shape=north_south]", + "66:1": "minecraft:rail[shape=east_west]", + "66:2": "minecraft:rail[shape=ascending_east]", + "66:3": "minecraft:rail[shape=ascending_west]", + "66:4": "minecraft:rail[shape=ascending_north]", + "66:5": "minecraft:rail[shape=ascending_south]", + "66:6": "minecraft:rail[shape=south_east]", + "66:7": "minecraft:rail[shape=south_west]", + "66:8": "minecraft:rail[shape=north_west]", + "66:9": "minecraft:rail[shape=north_east]", + "67:0": "minecraft:cobblestone_stairs[half=bottom,shape=outer_right,facing=east]", + "67:1": "minecraft:cobblestone_stairs[half=bottom,shape=outer_right,facing=west]", + "67:2": "minecraft:cobblestone_stairs[half=bottom,shape=outer_right,facing=south]", + "67:3": "minecraft:cobblestone_stairs[half=bottom,shape=outer_right,facing=north]", + "67:4": "minecraft:cobblestone_stairs[half=top,shape=outer_right,facing=east]", + "67:5": "minecraft:cobblestone_stairs[half=top,shape=outer_right,facing=west]", + "67:6": "minecraft:cobblestone_stairs[half=top,shape=outer_right,facing=south]", + "67:7": "minecraft:cobblestone_stairs[half=top,shape=outer_right,facing=north]", + "68:2": "minecraft:wall_sign[facing=north]", + "68:3": "minecraft:wall_sign[facing=south]", + "68:4": "minecraft:wall_sign[facing=west]", + "68:5": "minecraft:wall_sign[facing=east]", + "69:0": "minecraft:lever[powered=false,facing=north,face=ceiling]", + "69:1": "minecraft:lever[powered=false,facing=east,face=wall]", + "69:2": "minecraft:lever[powered=false,facing=west,face=wall]", + "69:3": "minecraft:lever[powered=false,facing=south,face=wall]", + "69:4": "minecraft:lever[powered=false,facing=north,face=wall]", + "69:5": "minecraft:lever[powered=false,facing=east,face=floor]", + "69:6": "minecraft:lever[powered=false,facing=north,face=floor]", + "69:7": "minecraft:lever[powered=false,facing=east,face=ceiling]", + "69:8": "minecraft:lever[powered=true,facing=north,face=ceiling]", + "69:9": "minecraft:lever[powered=true,facing=east,face=wall]", + "69:10": "minecraft:lever[powered=true,facing=west,face=wall]", + "69:11": "minecraft:lever[powered=true,facing=south,face=wall]", + "69:12": "minecraft:lever[powered=true,facing=north,face=wall]", + "69:13": "minecraft:lever[powered=true,facing=east,face=floor]", + "69:14": "minecraft:lever[powered=true,facing=north,face=floor]", + "69:15": "minecraft:lever[powered=true,facing=east,face=ceiling]", + "70:0": "minecraft:stone_pressure_plate[powered=false]", + "70:1": "minecraft:stone_pressure_plate[powered=true]", + "71:0": "minecraft:iron_door[hinge=right,half=lower,powered=false,facing=east,open=false]", + "71:1": "minecraft:iron_door[hinge=right,half=lower,powered=false,facing=south,open=false]", + "71:2": "minecraft:iron_door[hinge=right,half=lower,powered=false,facing=west,open=false]", + "71:3": "minecraft:iron_door[hinge=right,half=lower,powered=false,facing=north,open=false]", + "71:4": "minecraft:iron_door[hinge=right,half=lower,powered=false,facing=east,open=true]", + "71:5": "minecraft:iron_door[hinge=right,half=lower,powered=false,facing=south,open=true]", + "71:6": "minecraft:iron_door[hinge=right,half=lower,powered=false,facing=west,open=true]", + "71:7": "minecraft:iron_door[hinge=right,half=lower,powered=false,facing=north,open=true]", + "71:8": "minecraft:iron_door[hinge=left,half=upper,powered=false,facing=east,open=false]", + "71:9": "minecraft:iron_door[hinge=right,half=upper,powered=false,facing=east,open=false]", + "71:10": "minecraft:iron_door[hinge=left,half=upper,powered=true,facing=east,open=false]", + "71:11": "minecraft:iron_door[hinge=right,half=upper,powered=true,facing=east,open=false]", + "72:0": "minecraft:oak_pressure_plate[powered=false]", + "72:1": "minecraft:oak_pressure_plate[powered=true]", + "73:0": "minecraft:redstone_ore[lit=false]", + "74:0": "minecraft:redstone_ore[lit=true]", + "75:1": "minecraft:redstone_wall_torch[facing=east,lit=false]", + "75:2": "minecraft:redstone_wall_torch[facing=west,lit=false]", + "75:3": "minecraft:redstone_wall_torch[facing=south,lit=false]", + "75:4": "minecraft:redstone_wall_torch[facing=north,lit=false]", + "75:5": "minecraft:redstone_torch[lit=false]", + "76:1": "minecraft:redstone_wall_torch[facing=east,lit=true]", + "76:2": "minecraft:redstone_wall_torch[facing=west,lit=true]", + "76:3": "minecraft:redstone_wall_torch[facing=south,lit=true]", + "76:4": "minecraft:redstone_wall_torch[facing=north,lit=true]", + "76:5": "minecraft:redstone_torch[lit=true]", + "77:0": "minecraft:stone_button[powered=false,facing=east,face=ceiling]", + "77:1": "minecraft:stone_button[powered=false,facing=east,face=wall]", + "77:2": "minecraft:stone_button[powered=false,facing=west,face=wall]", + "77:3": "minecraft:stone_button[powered=false,facing=south,face=wall]", + "77:4": "minecraft:stone_button[powered=false,facing=north,face=wall]", + "77:5": "minecraft:stone_button[powered=false,facing=east,face=floor]", + "77:8": "minecraft:stone_button[powered=true,facing=south,face=ceiling]", + "77:9": "minecraft:stone_button[powered=true,facing=east,face=wall]", + "77:10": "minecraft:stone_button[powered=true,facing=west,face=wall]", + "77:11": "minecraft:stone_button[powered=true,facing=south,face=wall]", + "77:12": "minecraft:stone_button[powered=true,facing=north,face=wall]", + "77:13": "minecraft:stone_button[powered=true,facing=south,face=floor]", + "78:0": "minecraft:snow[layers=1]", + "78:1": "minecraft:snow[layers=2]", + "78:2": "minecraft:snow[layers=3]", + "78:3": "minecraft:snow[layers=4]", + "78:4": "minecraft:snow[layers=5]", + "78:5": "minecraft:snow[layers=6]", + "78:6": "minecraft:snow[layers=7]", + "78:7": "minecraft:snow[layers=8]", + "79:0": "minecraft:ice", + "80:0": "minecraft:snow_block", + "81:0": "minecraft:cactus[age=0]", + "81:1": "minecraft:cactus[age=1]", + "81:2": "minecraft:cactus[age=2]", + "81:3": "minecraft:cactus[age=3]", + "81:4": "minecraft:cactus[age=4]", + "81:5": "minecraft:cactus[age=5]", + "81:6": "minecraft:cactus[age=6]", + "81:7": "minecraft:cactus[age=7]", + "81:8": "minecraft:cactus[age=8]", + "81:9": "minecraft:cactus[age=9]", + "81:10": "minecraft:cactus[age=10]", + "81:11": "minecraft:cactus[age=11]", + "81:12": "minecraft:cactus[age=12]", + "81:13": "minecraft:cactus[age=13]", + "81:14": "minecraft:cactus[age=14]", + "81:15": "minecraft:cactus[age=15]", + "82:0": "minecraft:clay", + "83:0": "minecraft:sugar_cane[age=0]", + "83:1": "minecraft:sugar_cane[age=1]", + "83:2": "minecraft:sugar_cane[age=2]", + "83:3": "minecraft:sugar_cane[age=3]", + "83:4": "minecraft:sugar_cane[age=4]", + "83:5": "minecraft:sugar_cane[age=5]", + "83:6": "minecraft:sugar_cane[age=6]", + "83:7": "minecraft:sugar_cane[age=7]", + "83:8": "minecraft:sugar_cane[age=8]", + "83:9": "minecraft:sugar_cane[age=9]", + "83:10": "minecraft:sugar_cane[age=10]", + "83:11": "minecraft:sugar_cane[age=11]", + "83:12": "minecraft:sugar_cane[age=12]", + "83:13": "minecraft:sugar_cane[age=13]", + "83:14": "minecraft:sugar_cane[age=14]", + "83:15": "minecraft:sugar_cane[age=15]", + "84:0": "minecraft:jukebox[has_record=false]", + "84:1": "minecraft:jukebox[has_record=true]", + "85:0": "minecraft:oak_fence[east=false,south=false,north=false,west=false]", + "86:0": "minecraft:carved_pumpkin[facing=south]", + "86:1": "minecraft:carved_pumpkin[facing=west]", + "86:2": "minecraft:carved_pumpkin[facing=north]", + "86:3": "minecraft:carved_pumpkin[facing=east]", + "87:0": "minecraft:netherrack", + "88:0": "minecraft:soul_sand", + "89:0": "minecraft:glowstone", + "90:1": "minecraft:nether_portal[axis=x]", + "90:2": "minecraft:nether_portal[axis=z]", + "91:0": "minecraft:jack_o_lantern[facing=south]", + "91:1": "minecraft:jack_o_lantern[facing=west]", + "91:2": "minecraft:jack_o_lantern[facing=north]", + "91:3": "minecraft:jack_o_lantern[facing=east]", + "92:0": "minecraft:cake[bites=0]", + "92:1": "minecraft:cake[bites=1]", + "92:2": "minecraft:cake[bites=2]", + "92:3": "minecraft:cake[bites=3]", + "92:4": "minecraft:cake[bites=4]", + "92:5": "minecraft:cake[bites=5]", + "92:6": "minecraft:cake[bites=6]", + "93:0": "minecraft:repeater[delay=1,facing=south,locked=false,powered=false]", + "93:1": "minecraft:repeater[delay=1,facing=west,locked=false,powered=false]", + "93:2": "minecraft:repeater[delay=1,facing=north,locked=false,powered=false]", + "93:3": "minecraft:repeater[delay=1,facing=east,locked=false,powered=false]", + "93:4": "minecraft:repeater[delay=2,facing=south,locked=false,powered=false]", + "93:5": "minecraft:repeater[delay=2,facing=west,locked=false,powered=false]", + "93:6": "minecraft:repeater[delay=2,facing=north,locked=false,powered=false]", + "93:7": "minecraft:repeater[delay=2,facing=east,locked=false,powered=false]", + "93:8": "minecraft:repeater[delay=3,facing=south,locked=false,powered=false]", + "93:9": "minecraft:repeater[delay=3,facing=west,locked=false,powered=false]", + "93:10": "minecraft:repeater[delay=3,facing=north,locked=false,powered=false]", + "93:11": "minecraft:repeater[delay=3,facing=east,locked=false,powered=false]", + "93:12": "minecraft:repeater[delay=4,facing=south,locked=false,powered=false]", + "93:13": "minecraft:repeater[delay=4,facing=west,locked=false,powered=false]", + "93:14": "minecraft:repeater[delay=4,facing=north,locked=false,powered=false]", + "93:15": "minecraft:repeater[delay=4,facing=east,locked=false,powered=false]", + "94:0": "minecraft:repeater[delay=1,facing=south,locked=false,powered=true]", + "94:1": "minecraft:repeater[delay=1,facing=west,locked=false,powered=true]", + "94:2": "minecraft:repeater[delay=1,facing=north,locked=false,powered=true]", + "94:3": "minecraft:repeater[delay=1,facing=east,locked=false,powered=true]", + "94:4": "minecraft:repeater[delay=2,facing=south,locked=false,powered=true]", + "94:5": "minecraft:repeater[delay=2,facing=west,locked=false,powered=true]", + "94:6": "minecraft:repeater[delay=2,facing=north,locked=false,powered=true]", + "94:7": "minecraft:repeater[delay=2,facing=east,locked=false,powered=true]", + "94:8": "minecraft:repeater[delay=3,facing=south,locked=false,powered=true]", + "94:9": "minecraft:repeater[delay=3,facing=west,locked=false,powered=true]", + "94:10": "minecraft:repeater[delay=3,facing=north,locked=false,powered=true]", + "94:11": "minecraft:repeater[delay=3,facing=east,locked=false,powered=true]", + "94:12": "minecraft:repeater[delay=4,facing=south,locked=false,powered=true]", + "94:13": "minecraft:repeater[delay=4,facing=west,locked=false,powered=true]", + "94:14": "minecraft:repeater[delay=4,facing=north,locked=false,powered=true]", + "94:15": "minecraft:repeater[delay=4,facing=east,locked=false,powered=true]", + "95:0": "minecraft:white_stained_glass", + "95:1": "minecraft:orange_stained_glass", + "95:2": "minecraft:magenta_stained_glass", + "95:3": "minecraft:light_blue_stained_glass", + "95:4": "minecraft:yellow_stained_glass", + "95:5": "minecraft:lime_stained_glass", + "95:6": "minecraft:pink_stained_glass", + "95:7": "minecraft:gray_stained_glass", + "95:8": "minecraft:light_gray_stained_glass", + "95:9": "minecraft:cyan_stained_glass", + "95:10": "minecraft:purple_stained_glass", + "95:11": "minecraft:blue_stained_glass", + "95:12": "minecraft:brown_stained_glass", + "95:13": "minecraft:green_stained_glass", + "95:14": "minecraft:red_stained_glass", + "95:15": "minecraft:black_stained_glass", + "96:0": "minecraft:oak_trapdoor[half=bottom,facing=north,open=false,powered=false]", + "96:1": "minecraft:oak_trapdoor[half=bottom,facing=south,open=false,powered=false]", + "96:2": "minecraft:oak_trapdoor[half=bottom,facing=west,open=false,powered=false]", + "96:3": "minecraft:oak_trapdoor[half=bottom,facing=east,open=false,powered=false]", + "96:4": "minecraft:oak_trapdoor[half=bottom,facing=north,open=true,powered=true]", + "96:5": "minecraft:oak_trapdoor[half=bottom,facing=south,open=true,powered=true]", + "96:6": "minecraft:oak_trapdoor[half=bottom,facing=west,open=true,powered=true]", + "96:7": "minecraft:oak_trapdoor[half=bottom,facing=east,open=true,powered=true]", + "96:8": "minecraft:oak_trapdoor[half=top,facing=north,open=false,powered=false]", + "96:9": "minecraft:oak_trapdoor[half=top,facing=south,open=false,powered=false]", + "96:10": "minecraft:oak_trapdoor[half=top,facing=west,open=false,powered=false]", + "96:11": "minecraft:oak_trapdoor[half=top,facing=east,open=false,powered=false]", + "96:12": "minecraft:oak_trapdoor[half=top,facing=north,open=true,powered=true]", + "96:13": "minecraft:oak_trapdoor[half=top,facing=south,open=true,powered=true]", + "96:14": "minecraft:oak_trapdoor[half=top,facing=west,open=true,powered=true]", + "96:15": "minecraft:oak_trapdoor[half=top,facing=east,open=true,powered=true]", + "97:0": "minecraft:infested_stone", + "97:1": "minecraft:infested_cobblestone", + "97:2": "minecraft:infested_stone_bricks", + "97:3": "minecraft:infested_mossy_stone_bricks", + "97:4": "minecraft:infested_cracked_stone_bricks", + "97:5": "minecraft:infested_chiseled_stone_bricks", + "98:0": "minecraft:stone_bricks", + "98:1": "minecraft:mossy_stone_bricks", + "98:2": "minecraft:cracked_stone_bricks", + "98:3": "minecraft:chiseled_stone_bricks", + "99:0": "minecraft:brown_mushroom_block[north=false,east=false,south=false,west=false,up=false,down=false]", + "99:1": "minecraft:brown_mushroom_block[north=true,east=false,south=false,west=true,up=true,down=false]", + "99:2": "minecraft:brown_mushroom_block[north=true,east=false,south=false,west=false,up=true,down=false]", + "99:3": "minecraft:brown_mushroom_block[north=true,east=true,south=false,west=false,up=true,down=false]", + "99:4": "minecraft:brown_mushroom_block[north=false,east=false,south=false,west=true,up=true,down=false]", + "99:5": "minecraft:brown_mushroom_block[north=false,east=false,south=false,west=false,up=true,down=false]", + "99:6": "minecraft:brown_mushroom_block[north=false,east=true,south=false,west=false,up=true,down=false]", + "99:7": "minecraft:brown_mushroom_block[north=false,east=false,south=true,west=true,up=true,down=false]", + "99:8": "minecraft:brown_mushroom_block[north=false,east=false,south=true,west=false,up=true,down=false]", + "99:9": "minecraft:brown_mushroom_block[north=false,east=true,south=true,west=false,up=true,down=false]", + "99:10": "minecraft:mushroom_stem[north=true,east=true,south=true,west=true,up=false,down=false]", + "99:14": "minecraft:brown_mushroom_block[north=true,east=true,south=true,west=true,up=true,down=true]", + "99:15": "minecraft:mushroom_stem[north=true,east=true,south=true,west=true,up=true,down=true]", + "100:0": "minecraft:red_mushroom_block[north=false,east=false,south=false,west=false,up=false,down=false]", + "100:1": "minecraft:red_mushroom_block[north=true,east=false,south=false,west=true,up=true,down=false]", + "100:2": "minecraft:red_mushroom_block[north=true,east=false,south=false,west=false,up=true,down=false]", + "100:3": "minecraft:red_mushroom_block[north=true,east=true,south=false,west=false,up=true,down=false]", + "100:4": "minecraft:red_mushroom_block[north=false,east=false,south=false,west=true,up=true,down=false]", + "100:5": "minecraft:red_mushroom_block[north=false,east=false,south=false,west=false,up=true,down=false]", + "100:6": "minecraft:red_mushroom_block[north=false,east=true,south=false,west=false,up=true,down=false]", + "100:7": "minecraft:red_mushroom_block[north=false,east=false,south=true,west=true,up=true,down=false]", + "100:8": "minecraft:red_mushroom_block[north=false,east=false,south=true,west=false,up=true,down=false]", + "100:9": "minecraft:red_mushroom_block[north=false,east=true,south=true,west=false,up=true,down=false]", + "100:10": "minecraft:mushroom_stem[north=true,east=true,south=true,west=true,up=false,down=false]", + "100:14": "minecraft:red_mushroom_block[north=true,east=true,south=true,west=true,up=true,down=true]", + "100:15": "minecraft:mushroom_stem[north=true,east=true,south=true,west=true,up=true,down=true]", + "101:0": "minecraft:iron_bars[east=false,south=false,north=false,west=false]", + "102:0": "minecraft:glass_pane[east=false,south=false,north=false,west=false]", + "103:0": "minecraft:melon", + "104:0": "minecraft:pumpkin_stem[age=0]", + "104:1": "minecraft:pumpkin_stem[age=1]", + "104:2": "minecraft:pumpkin_stem[age=2]", + "104:3": "minecraft:pumpkin_stem[age=3]", + "104:4": "minecraft:pumpkin_stem[age=4]", + "104:5": "minecraft:pumpkin_stem[age=5]", + "104:6": "minecraft:pumpkin_stem[age=6]", + "104:7": "minecraft:pumpkin_stem[age=7]", + "105:0": "minecraft:melon_stem[age=0]", + "105:1": "minecraft:melon_stem[age=1]", + "105:2": "minecraft:melon_stem[age=2]", + "105:3": "minecraft:melon_stem[age=3]", + "105:4": "minecraft:melon_stem[age=4]", + "105:5": "minecraft:melon_stem[age=5]", + "105:6": "minecraft:melon_stem[age=6]", + "105:7": "minecraft:melon_stem[age=7]", + "106:0": "minecraft:vine[east=false,south=false,north=false,west=false,up=false]", + "106:1": "minecraft:vine[east=false,south=true,north=false,west=false,up=false]", + "106:2": "minecraft:vine[east=false,south=false,north=false,west=true,up=false]", + "106:3": "minecraft:vine[east=false,south=true,north=false,west=true,up=false]", + "106:4": "minecraft:vine[east=false,south=false,north=true,west=false,up=false]", + "106:5": "minecraft:vine[east=false,south=true,north=true,west=false,up=false]", + "106:6": "minecraft:vine[east=false,south=false,north=true,west=true,up=false]", + "106:7": "minecraft:vine[east=false,south=true,north=true,west=true,up=false]", + "106:8": "minecraft:vine[east=true,south=false,north=false,west=false,up=false]", + "106:9": "minecraft:vine[east=true,south=true,north=false,west=false,up=false]", + "106:10": "minecraft:vine[east=true,south=false,north=false,west=true,up=false]", + "106:11": "minecraft:vine[east=true,south=true,north=false,west=true,up=false]", + "106:12": "minecraft:vine[east=true,south=false,north=true,west=false,up=false]", + "106:13": "minecraft:vine[east=true,south=true,north=true,west=false,up=false]", + "106:14": "minecraft:vine[east=true,south=false,north=true,west=true,up=false]", + "106:15": "minecraft:vine[east=true,south=true,north=true,west=true,up=false]", + "107:0": "minecraft:oak_fence_gate[in_wall=false,powered=false,facing=south,open=false]", + "107:1": "minecraft:oak_fence_gate[in_wall=false,powered=false,facing=west,open=false]", + "107:2": "minecraft:oak_fence_gate[in_wall=false,powered=false,facing=north,open=false]", + "107:3": "minecraft:oak_fence_gate[in_wall=false,powered=false,facing=east,open=false]", + "107:4": "minecraft:oak_fence_gate[in_wall=false,powered=false,facing=south,open=true]", + "107:5": "minecraft:oak_fence_gate[in_wall=false,powered=false,facing=west,open=true]", + "107:6": "minecraft:oak_fence_gate[in_wall=false,powered=false,facing=north,open=true]", + "107:7": "minecraft:oak_fence_gate[in_wall=false,powered=false,facing=east,open=true]", + "107:8": "minecraft:oak_fence_gate[in_wall=false,powered=true,facing=south,open=false]", + "107:9": "minecraft:oak_fence_gate[in_wall=false,powered=true,facing=west,open=false]", + "107:10": "minecraft:oak_fence_gate[in_wall=false,powered=true,facing=north,open=false]", + "107:11": "minecraft:oak_fence_gate[in_wall=false,powered=true,facing=east,open=false]", + "107:12": "minecraft:oak_fence_gate[in_wall=false,powered=true,facing=south,open=true]", + "107:13": "minecraft:oak_fence_gate[in_wall=false,powered=true,facing=west,open=true]", + "107:14": "minecraft:oak_fence_gate[in_wall=false,powered=true,facing=north,open=true]", + "107:15": "minecraft:oak_fence_gate[in_wall=false,powered=true,facing=east,open=true]", + "108:0": "minecraft:brick_stairs[half=bottom,shape=outer_right,facing=east]", + "108:1": "minecraft:brick_stairs[half=bottom,shape=outer_right,facing=west]", + "108:2": "minecraft:brick_stairs[half=bottom,shape=outer_right,facing=south]", + "108:3": "minecraft:brick_stairs[half=bottom,shape=outer_right,facing=north]", + "108:4": "minecraft:brick_stairs[half=top,shape=outer_right,facing=east]", + "108:5": "minecraft:brick_stairs[half=top,shape=outer_right,facing=west]", + "108:6": "minecraft:brick_stairs[half=top,shape=outer_right,facing=south]", + "108:7": "minecraft:brick_stairs[half=top,shape=outer_right,facing=north]", + "109:0": "minecraft:stone_brick_stairs[half=bottom,shape=outer_right,facing=east]", + "109:1": "minecraft:stone_brick_stairs[half=bottom,shape=outer_right,facing=west]", + "109:2": "minecraft:stone_brick_stairs[half=bottom,shape=outer_right,facing=south]", + "109:3": "minecraft:stone_brick_stairs[half=bottom,shape=outer_right,facing=north]", + "109:4": "minecraft:stone_brick_stairs[half=top,shape=outer_right,facing=east]", + "109:5": "minecraft:stone_brick_stairs[half=top,shape=outer_right,facing=west]", + "109:6": "minecraft:stone_brick_stairs[half=top,shape=outer_right,facing=south]", + "109:7": "minecraft:stone_brick_stairs[half=top,shape=outer_right,facing=north]", + "110:0": "minecraft:mycelium[snowy=false]", + "111:0": "minecraft:lily_pad", + "112:0": "minecraft:nether_bricks", + "113:0": "minecraft:nether_brick_fence[east=false,south=false,north=false,west=false]", + "114:0": "minecraft:nether_brick_stairs[half=bottom,shape=outer_right,facing=east]", + "114:1": "minecraft:nether_brick_stairs[half=bottom,shape=outer_right,facing=west]", + "114:2": "minecraft:nether_brick_stairs[half=bottom,shape=outer_right,facing=south]", + "114:3": "minecraft:nether_brick_stairs[half=bottom,shape=outer_right,facing=north]", + "114:4": "minecraft:nether_brick_stairs[half=top,shape=outer_right,facing=east]", + "114:5": "minecraft:nether_brick_stairs[half=top,shape=outer_right,facing=west]", + "114:6": "minecraft:nether_brick_stairs[half=top,shape=outer_right,facing=south]", + "114:7": "minecraft:nether_brick_stairs[half=top,shape=outer_right,facing=north]", + "115:0": "minecraft:nether_wart[age=0]", + "115:1": "minecraft:nether_wart[age=1]", + "115:2": "minecraft:nether_wart[age=2]", + "115:3": "minecraft:nether_wart[age=3]", + "116:0": "minecraft:enchanting_table", + "117:0": "minecraft:brewing_stand[has_bottle_0=false,has_bottle_1=false,has_bottle_2=false]", + "117:1": "minecraft:brewing_stand[has_bottle_0=true,has_bottle_1=false,has_bottle_2=false]", + "117:2": "minecraft:brewing_stand[has_bottle_0=false,has_bottle_1=true,has_bottle_2=false]", + "117:3": "minecraft:brewing_stand[has_bottle_0=true,has_bottle_1=true,has_bottle_2=false]", + "117:4": "minecraft:brewing_stand[has_bottle_0=false,has_bottle_1=false,has_bottle_2=true]", + "117:5": "minecraft:brewing_stand[has_bottle_0=true,has_bottle_1=false,has_bottle_2=true]", + "117:6": "minecraft:brewing_stand[has_bottle_0=false,has_bottle_1=true,has_bottle_2=true]", + "117:7": "minecraft:brewing_stand[has_bottle_0=true,has_bottle_1=true,has_bottle_2=true]", + "118:0": "minecraft:cauldron[level=0]", + "118:1": "minecraft:cauldron[level=1]", + "118:2": "minecraft:cauldron[level=2]", + "118:3": "minecraft:cauldron[level=3]", + "119:0": "minecraft:end_portal", + "120:0": "minecraft:end_portal_frame[eye=false,facing=south]", + "120:1": "minecraft:end_portal_frame[eye=false,facing=west]", + "120:2": "minecraft:end_portal_frame[eye=false,facing=north]", + "120:3": "minecraft:end_portal_frame[eye=false,facing=east]", + "120:4": "minecraft:end_portal_frame[eye=true,facing=south]", + "120:5": "minecraft:end_portal_frame[eye=true,facing=west]", + "120:6": "minecraft:end_portal_frame[eye=true,facing=north]", + "120:7": "minecraft:end_portal_frame[eye=true,facing=east]", + "121:0": "minecraft:end_stone", + "122:0": "minecraft:dragon_egg", + "123:0": "minecraft:redstone_lamp[lit=false]", + "124:0": "minecraft:redstone_lamp[lit=true]", + "125:0": "minecraft:oak_slab[type=double]", + "125:1": "minecraft:spruce_slab[type=double]", + "125:2": "minecraft:birch_slab[type=double]", + "125:3": "minecraft:jungle_slab[type=double]", + "125:4": "minecraft:acacia_slab[type=double]", + "125:5": "minecraft:dark_oak_slab[type=double]", + "126:0": "minecraft:oak_slab[type=bottom]", + "126:1": "minecraft:spruce_slab[type=bottom]", + "126:2": "minecraft:birch_slab[type=bottom]", + "126:3": "minecraft:jungle_slab[type=bottom]", + "126:4": "minecraft:acacia_slab[type=bottom]", + "126:5": "minecraft:dark_oak_slab[type=bottom]", + "126:8": "minecraft:oak_slab[type=top]", + "126:9": "minecraft:spruce_slab[type=top]", + "126:10": "minecraft:birch_slab[type=top]", + "126:11": "minecraft:jungle_slab[type=top]", + "126:12": "minecraft:acacia_slab[type=top]", + "126:13": "minecraft:dark_oak_slab[type=top]", + "127:0": "minecraft:cocoa[facing=south,age=0]", + "127:1": "minecraft:cocoa[facing=west,age=0]", + "127:2": "minecraft:cocoa[facing=north,age=0]", + "127:3": "minecraft:cocoa[facing=east,age=0]", + "127:4": "minecraft:cocoa[facing=south,age=1]", + "127:5": "minecraft:cocoa[facing=west,age=1]", + "127:6": "minecraft:cocoa[facing=north,age=1]", + "127:7": "minecraft:cocoa[facing=east,age=1]", + "127:8": "minecraft:cocoa[facing=south,age=2]", + "127:9": "minecraft:cocoa[facing=west,age=2]", + "127:10": "minecraft:cocoa[facing=north,age=2]", + "127:11": "minecraft:cocoa[facing=east,age=2]", + "128:0": "minecraft:sandstone_stairs[half=bottom,shape=outer_right,facing=east]", + "128:1": "minecraft:sandstone_stairs[half=bottom,shape=outer_right,facing=west]", + "128:2": "minecraft:sandstone_stairs[half=bottom,shape=outer_right,facing=south]", + "128:3": "minecraft:sandstone_stairs[half=bottom,shape=outer_right,facing=north]", + "128:4": "minecraft:sandstone_stairs[half=top,shape=outer_right,facing=east]", + "128:5": "minecraft:sandstone_stairs[half=top,shape=outer_right,facing=west]", + "128:6": "minecraft:sandstone_stairs[half=top,shape=outer_right,facing=south]", + "128:7": "minecraft:sandstone_stairs[half=top,shape=outer_right,facing=north]", + "129:0": "minecraft:emerald_ore", + "130:2": "minecraft:ender_chest[facing=north]", + "130:3": "minecraft:ender_chest[facing=south]", + "130:4": "minecraft:ender_chest[facing=west]", + "130:5": "minecraft:ender_chest[facing=east]", + "131:0": "minecraft:tripwire_hook[powered=false,attached=false,facing=south]", + "131:1": "minecraft:tripwire_hook[powered=false,attached=false,facing=west]", + "131:2": "minecraft:tripwire_hook[powered=false,attached=false,facing=north]", + "131:3": "minecraft:tripwire_hook[powered=false,attached=false,facing=east]", + "131:4": "minecraft:tripwire_hook[powered=false,attached=true,facing=south]", + "131:5": "minecraft:tripwire_hook[powered=false,attached=true,facing=west]", + "131:6": "minecraft:tripwire_hook[powered=false,attached=true,facing=north]", + "131:7": "minecraft:tripwire_hook[powered=false,attached=true,facing=east]", + "131:8": "minecraft:tripwire_hook[powered=true,attached=false,facing=south]", + "131:9": "minecraft:tripwire_hook[powered=true,attached=false,facing=west]", + "131:10": "minecraft:tripwire_hook[powered=true,attached=false,facing=north]", + "131:11": "minecraft:tripwire_hook[powered=true,attached=false,facing=east]", + "131:12": "minecraft:tripwire_hook[powered=true,attached=true,facing=south]", + "131:13": "minecraft:tripwire_hook[powered=true,attached=true,facing=west]", + "131:14": "minecraft:tripwire_hook[powered=true,attached=true,facing=north]", + "131:15": "minecraft:tripwire_hook[powered=true,attached=true,facing=east]", + "132:0": "minecraft:tripwire[disarmed=false,east=false,powered=false,south=false,north=false,west=false,attached=false]", + "132:1": "minecraft:tripwire[disarmed=false,east=false,powered=true,south=false,north=false,west=false,attached=false]", + "132:4": "minecraft:tripwire[disarmed=false,east=false,powered=false,south=false,north=false,west=false,attached=true]", + "132:5": "minecraft:tripwire[disarmed=false,east=false,powered=true,south=false,north=false,west=false,attached=true]", + "132:8": "minecraft:tripwire[disarmed=true,east=false,powered=false,south=false,north=false,west=false,attached=false]", + "132:9": "minecraft:tripwire[disarmed=true,east=false,powered=true,south=false,north=false,west=false,attached=false]", + "132:12": "minecraft:tripwire[disarmed=true,east=false,powered=false,south=false,north=false,west=false,attached=true]", + "132:13": "minecraft:tripwire[disarmed=true,east=false,powered=true,south=false,north=false,west=false,attached=true]", + "133:0": "minecraft:emerald_block", + "134:0": "minecraft:spruce_stairs[half=bottom,shape=outer_right,facing=east]", + "134:1": "minecraft:spruce_stairs[half=bottom,shape=outer_right,facing=west]", + "134:2": "minecraft:spruce_stairs[half=bottom,shape=outer_right,facing=south]", + "134:3": "minecraft:spruce_stairs[half=bottom,shape=outer_right,facing=north]", + "134:4": "minecraft:spruce_stairs[half=top,shape=outer_right,facing=east]", + "134:5": "minecraft:spruce_stairs[half=top,shape=outer_right,facing=west]", + "134:6": "minecraft:spruce_stairs[half=top,shape=outer_right,facing=south]", + "134:7": "minecraft:spruce_stairs[half=top,shape=outer_right,facing=north]", + "135:0": "minecraft:birch_stairs[half=bottom,shape=outer_right,facing=east]", + "135:1": "minecraft:birch_stairs[half=bottom,shape=outer_right,facing=west]", + "135:2": "minecraft:birch_stairs[half=bottom,shape=outer_right,facing=south]", + "135:3": "minecraft:birch_stairs[half=bottom,shape=outer_right,facing=north]", + "135:4": "minecraft:birch_stairs[half=top,shape=outer_right,facing=east]", + "135:5": "minecraft:birch_stairs[half=top,shape=outer_right,facing=west]", + "135:6": "minecraft:birch_stairs[half=top,shape=outer_right,facing=south]", + "135:7": "minecraft:birch_stairs[half=top,shape=outer_right,facing=north]", + "136:0": "minecraft:jungle_stairs[half=bottom,shape=outer_right,facing=east]", + "136:1": "minecraft:jungle_stairs[half=bottom,shape=outer_right,facing=west]", + "136:2": "minecraft:jungle_stairs[half=bottom,shape=outer_right,facing=south]", + "136:3": "minecraft:jungle_stairs[half=bottom,shape=outer_right,facing=north]", + "136:4": "minecraft:jungle_stairs[half=top,shape=outer_right,facing=east]", + "136:5": "minecraft:jungle_stairs[half=top,shape=outer_right,facing=west]", + "136:6": "minecraft:jungle_stairs[half=top,shape=outer_right,facing=south]", + "136:7": "minecraft:jungle_stairs[half=top,shape=outer_right,facing=north]", + "137:0": "minecraft:command_block[conditional=false,facing=down]", + "137:1": "minecraft:command_block[conditional=false,facing=up]", + "137:2": "minecraft:command_block[conditional=false,facing=north]", + "137:3": "minecraft:command_block[conditional=false,facing=south]", + "137:4": "minecraft:command_block[conditional=false,facing=west]", + "137:5": "minecraft:command_block[conditional=false,facing=east]", + "137:8": "minecraft:command_block[conditional=true,facing=down]", + "137:9": "minecraft:command_block[conditional=true,facing=up]", + "137:10": "minecraft:command_block[conditional=true,facing=north]", + "137:11": "minecraft:command_block[conditional=true,facing=south]", + "137:12": "minecraft:command_block[conditional=true,facing=west]", + "137:13": "minecraft:command_block[conditional=true,facing=east]", + "138:0": "minecraft:beacon", + "139:0": "minecraft:cobblestone_wall[east=false,south=false,north=false,west=false,up=false]", + "139:1": "minecraft:mossy_cobblestone_wall[east=false,south=false,north=false,west=false,up=false]", + "140:0": "minecraft:flower_pot", + "140:1": "minecraft:potted_poppy", + "140:2": "minecraft:potted_dandelion", + "140:3": "minecraft:potted_oak_sapling", + "140:4": "minecraft:potted_spruce_sapling", + "140:5": "minecraft:potted_birch_sapling", + "140:6": "minecraft:potted_jungle_sapling", + "140:7": "minecraft:potted_red_mushroom", + "140:8": "minecraft:potted_brown_mushroom", + "140:9": "minecraft:potted_cactus", + "140:10": "minecraft:potted_dead_bush", + "140:11": "minecraft:potted_fern", + "140:12": "minecraft:potted_acacia_sapling", + "140:13": "minecraft:potted_dark_oak_sapling", + "140:14": "minecraft:potted_blue_orchid", + "140:15": "minecraft:potted_allium", + "141:0": "minecraft:carrots[age=0]", + "141:1": "minecraft:carrots[age=1]", + "141:2": "minecraft:carrots[age=2]", + "141:3": "minecraft:carrots[age=3]", + "141:4": "minecraft:carrots[age=4]", + "141:5": "minecraft:carrots[age=5]", + "141:6": "minecraft:carrots[age=6]", + "141:7": "minecraft:carrots[age=7]", + "142:0": "minecraft:potatoes[age=0]", + "142:1": "minecraft:potatoes[age=1]", + "142:2": "minecraft:potatoes[age=2]", + "142:3": "minecraft:potatoes[age=3]", + "142:4": "minecraft:potatoes[age=4]", + "142:5": "minecraft:potatoes[age=5]", + "142:6": "minecraft:potatoes[age=6]", + "142:7": "minecraft:potatoes[age=7]", + "143:0": "minecraft:oak_button[powered=false,facing=east,face=ceiling]", + "143:1": "minecraft:oak_button[powered=false,facing=east,face=wall]", + "143:2": "minecraft:oak_button[powered=false,facing=west,face=wall]", + "143:3": "minecraft:oak_button[powered=false,facing=south,face=wall]", + "143:4": "minecraft:oak_button[powered=false,facing=north,face=wall]", + "143:5": "minecraft:oak_button[powered=false,facing=east,face=floor]", + "143:8": "minecraft:oak_button[powered=true,facing=south,face=ceiling]", + "143:9": "minecraft:oak_button[powered=true,facing=east,face=wall]", + "143:10": "minecraft:oak_button[powered=true,facing=west,face=wall]", + "143:11": "minecraft:oak_button[powered=true,facing=south,face=wall]", + "143:12": "minecraft:oak_button[powered=true,facing=north,face=wall]", + "143:13": "minecraft:oak_button[powered=true,facing=south,face=floor]", + "144:0": "minecraft:skeleton_skull[rotation=0]", + "144:1": "minecraft:skeleton_skull[rotation=4]", + "144:2": "minecraft:skeleton_wall_skull[facing=north]", + "144:3": "minecraft:skeleton_wall_skull[facing=south]", + "144:4": "minecraft:skeleton_wall_skull[facing=west]", + "144:5": "minecraft:skeleton_wall_skull[facing=east]", + "144:8": "minecraft:skeleton_skull[rotation=8]", + "144:9": "minecraft:skeleton_skull[rotation=12]", + "144:10": "minecraft:skeleton_wall_skull[facing=north]", + "144:11": "minecraft:skeleton_wall_skull[facing=south]", + "144:12": "minecraft:skeleton_wall_skull[facing=west]", + "144:13": "minecraft:skeleton_wall_skull[facing=east]", + "145:0": "minecraft:anvil[facing=south]", + "145:1": "minecraft:anvil[facing=west]", + "145:2": "minecraft:anvil[facing=north]", + "145:3": "minecraft:anvil[facing=east]", + "145:4": "minecraft:chipped_anvil[facing=south]", + "145:5": "minecraft:chipped_anvil[facing=west]", + "145:6": "minecraft:chipped_anvil[facing=north]", + "145:7": "minecraft:chipped_anvil[facing=east]", + "145:8": "minecraft:damaged_anvil[facing=south]", + "145:9": "minecraft:damaged_anvil[facing=west]", + "145:10": "minecraft:damaged_anvil[facing=north]", + "145:11": "minecraft:damaged_anvil[facing=east]", + "146:2": "minecraft:trapped_chest[facing=north,type=single]", + "146:3": "minecraft:trapped_chest[facing=south,type=single]", + "146:4": "minecraft:trapped_chest[facing=west,type=single]", + "146:5": "minecraft:trapped_chest[facing=east,type=single]", + "147:0": "minecraft:light_weighted_pressure_plate[power=0]", + "147:1": "minecraft:light_weighted_pressure_plate[power=1]", + "147:2": "minecraft:light_weighted_pressure_plate[power=2]", + "147:3": "minecraft:light_weighted_pressure_plate[power=3]", + "147:4": "minecraft:light_weighted_pressure_plate[power=4]", + "147:5": "minecraft:light_weighted_pressure_plate[power=5]", + "147:6": "minecraft:light_weighted_pressure_plate[power=6]", + "147:7": "minecraft:light_weighted_pressure_plate[power=7]", + "147:8": "minecraft:light_weighted_pressure_plate[power=8]", + "147:9": "minecraft:light_weighted_pressure_plate[power=9]", + "147:10": "minecraft:light_weighted_pressure_plate[power=10]", + "147:11": "minecraft:light_weighted_pressure_plate[power=11]", + "147:12": "minecraft:light_weighted_pressure_plate[power=12]", + "147:13": "minecraft:light_weighted_pressure_plate[power=13]", + "147:14": "minecraft:light_weighted_pressure_plate[power=14]", + "147:15": "minecraft:light_weighted_pressure_plate[power=15]", + "148:0": "minecraft:heavy_weighted_pressure_plate[power=0]", + "148:1": "minecraft:heavy_weighted_pressure_plate[power=1]", + "148:2": "minecraft:heavy_weighted_pressure_plate[power=2]", + "148:3": "minecraft:heavy_weighted_pressure_plate[power=3]", + "148:4": "minecraft:heavy_weighted_pressure_plate[power=4]", + "148:5": "minecraft:heavy_weighted_pressure_plate[power=5]", + "148:6": "minecraft:heavy_weighted_pressure_plate[power=6]", + "148:7": "minecraft:heavy_weighted_pressure_plate[power=7]", + "148:8": "minecraft:heavy_weighted_pressure_plate[power=8]", + "148:9": "minecraft:heavy_weighted_pressure_plate[power=9]", + "148:10": "minecraft:heavy_weighted_pressure_plate[power=10]", + "148:11": "minecraft:heavy_weighted_pressure_plate[power=11]", + "148:12": "minecraft:heavy_weighted_pressure_plate[power=12]", + "148:13": "minecraft:heavy_weighted_pressure_plate[power=13]", + "148:14": "minecraft:heavy_weighted_pressure_plate[power=14]", + "148:15": "minecraft:heavy_weighted_pressure_plate[power=15]", + "149:0": "minecraft:comparator[mode=compare,powered=false,facing=south]", + "149:1": "minecraft:comparator[mode=compare,powered=false,facing=west]", + "149:2": "minecraft:comparator[mode=compare,powered=false,facing=north]", + "149:3": "minecraft:comparator[mode=compare,powered=false,facing=east]", + "149:4": "minecraft:comparator[mode=subtract,powered=false,facing=south]", + "149:5": "minecraft:comparator[mode=subtract,powered=false,facing=west]", + "149:6": "minecraft:comparator[mode=subtract,powered=false,facing=north]", + "149:7": "minecraft:comparator[mode=subtract,powered=false,facing=east]", + "149:8": "minecraft:comparator[mode=compare,powered=false,facing=south]", + "149:9": "minecraft:comparator[mode=compare,powered=false,facing=west]", + "149:10": "minecraft:comparator[mode=compare,powered=false,facing=north]", + "149:11": "minecraft:comparator[mode=compare,powered=false,facing=east]", + "149:12": "minecraft:comparator[mode=subtract,powered=false,facing=south]", + "149:13": "minecraft:comparator[mode=subtract,powered=false,facing=west]", + "149:14": "minecraft:comparator[mode=subtract,powered=false,facing=north]", + "149:15": "minecraft:comparator[mode=subtract,powered=false,facing=east]", + "150:0": "minecraft:comparator[mode=compare,powered=true,facing=south]", + "150:1": "minecraft:comparator[mode=compare,powered=true,facing=west]", + "150:2": "minecraft:comparator[mode=compare,powered=true,facing=north]", + "150:3": "minecraft:comparator[mode=compare,powered=true,facing=east]", + "150:4": "minecraft:comparator[mode=subtract,powered=true,facing=south]", + "150:5": "minecraft:comparator[mode=subtract,powered=true,facing=west]", + "150:6": "minecraft:comparator[mode=subtract,powered=true,facing=north]", + "150:7": "minecraft:comparator[mode=subtract,powered=true,facing=east]", + "150:8": "minecraft:comparator[mode=compare,powered=true,facing=south]", + "150:9": "minecraft:comparator[mode=compare,powered=true,facing=west]", + "150:10": "minecraft:comparator[mode=compare,powered=true,facing=north]", + "150:11": "minecraft:comparator[mode=compare,powered=true,facing=east]", + "150:12": "minecraft:comparator[mode=subtract,powered=true,facing=south]", + "150:13": "minecraft:comparator[mode=subtract,powered=true,facing=west]", + "150:14": "minecraft:comparator[mode=subtract,powered=true,facing=north]", + "150:15": "minecraft:comparator[mode=subtract,powered=true,facing=east]", + "151:0": "minecraft:daylight_detector[inverted=false,power=0]", + "151:1": "minecraft:daylight_detector[inverted=false,power=1]", + "151:2": "minecraft:daylight_detector[inverted=false,power=2]", + "151:3": "minecraft:daylight_detector[inverted=false,power=3]", + "151:4": "minecraft:daylight_detector[inverted=false,power=4]", + "151:5": "minecraft:daylight_detector[inverted=false,power=5]", + "151:6": "minecraft:daylight_detector[inverted=false,power=6]", + "151:7": "minecraft:daylight_detector[inverted=false,power=7]", + "151:8": "minecraft:daylight_detector[inverted=false,power=8]", + "151:9": "minecraft:daylight_detector[inverted=false,power=9]", + "151:10": "minecraft:daylight_detector[inverted=false,power=10]", + "151:11": "minecraft:daylight_detector[inverted=false,power=11]", + "151:12": "minecraft:daylight_detector[inverted=false,power=12]", + "151:13": "minecraft:daylight_detector[inverted=false,power=13]", + "151:14": "minecraft:daylight_detector[inverted=false,power=14]", + "151:15": "minecraft:daylight_detector[inverted=false,power=15]", + "152:0": "minecraft:redstone_block", + "153:0": "minecraft:nether_quartz_ore", + "154:0": "minecraft:hopper[facing=down,enabled=true]", + "154:2": "minecraft:hopper[facing=north,enabled=true]", + "154:3": "minecraft:hopper[facing=south,enabled=true]", + "154:4": "minecraft:hopper[facing=west,enabled=true]", + "154:5": "minecraft:hopper[facing=east,enabled=true]", + "154:8": "minecraft:hopper[facing=down,enabled=false]", + "154:10": "minecraft:hopper[facing=north,enabled=false]", + "154:11": "minecraft:hopper[facing=south,enabled=false]", + "154:12": "minecraft:hopper[facing=west,enabled=false]", + "154:13": "minecraft:hopper[facing=east,enabled=false]", + "155:0": "minecraft:quartz_block", + "155:1": "minecraft:chiseled_quartz_block", + "155:2": "minecraft:quartz_pillar[axis=y]", + "155:3": "minecraft:quartz_pillar[axis=x]", + "155:4": "minecraft:quartz_pillar[axis=z]", + "155:6": "minecraft:quartz_pillar[axis=x]", + "155:10": "minecraft:quartz_pillar[axis=z]", + "156:0": "minecraft:quartz_stairs[half=bottom,shape=outer_right,facing=east]", + "156:1": "minecraft:quartz_stairs[half=bottom,shape=outer_right,facing=west]", + "156:2": "minecraft:quartz_stairs[half=bottom,shape=outer_right,facing=south]", + "156:3": "minecraft:quartz_stairs[half=bottom,shape=outer_right,facing=north]", + "156:4": "minecraft:quartz_stairs[half=top,shape=outer_right,facing=east]", + "156:5": "minecraft:quartz_stairs[half=top,shape=outer_right,facing=west]", + "156:6": "minecraft:quartz_stairs[half=top,shape=outer_right,facing=south]", + "156:7": "minecraft:quartz_stairs[half=top,shape=outer_right,facing=north]", + "157:0": "minecraft:activator_rail[shape=north_south,powered=false]", + "157:1": "minecraft:activator_rail[shape=east_west,powered=false]", + "157:2": "minecraft:activator_rail[shape=ascending_east,powered=false]", + "157:3": "minecraft:activator_rail[shape=ascending_west,powered=false]", + "157:4": "minecraft:activator_rail[shape=ascending_north,powered=false]", + "157:5": "minecraft:activator_rail[shape=ascending_south,powered=false]", + "157:8": "minecraft:activator_rail[shape=north_south,powered=true]", + "157:9": "minecraft:activator_rail[shape=east_west,powered=true]", + "157:10": "minecraft:activator_rail[shape=ascending_east,powered=true]", + "157:11": "minecraft:activator_rail[shape=ascending_west,powered=true]", + "157:12": "minecraft:activator_rail[shape=ascending_north,powered=true]", + "157:13": "minecraft:activator_rail[shape=ascending_south,powered=true]", + "158:0": "minecraft:dropper[triggered=false,facing=down]", + "158:1": "minecraft:dropper[triggered=false,facing=up]", + "158:2": "minecraft:dropper[triggered=false,facing=north]", + "158:3": "minecraft:dropper[triggered=false,facing=south]", + "158:4": "minecraft:dropper[triggered=false,facing=west]", + "158:5": "minecraft:dropper[triggered=false,facing=east]", + "158:8": "minecraft:dropper[triggered=true,facing=down]", + "158:9": "minecraft:dropper[triggered=true,facing=up]", + "158:10": "minecraft:dropper[triggered=true,facing=north]", + "158:11": "minecraft:dropper[triggered=true,facing=south]", + "158:12": "minecraft:dropper[triggered=true,facing=west]", + "158:13": "minecraft:dropper[triggered=true,facing=east]", + "159:0": "minecraft:white_terracotta", + "159:1": "minecraft:orange_terracotta", + "159:2": "minecraft:magenta_terracotta", + "159:3": "minecraft:light_blue_terracotta", + "159:4": "minecraft:yellow_terracotta", + "159:5": "minecraft:lime_terracotta", + "159:6": "minecraft:pink_terracotta", + "159:7": "minecraft:gray_terracotta", + "159:8": "minecraft:light_gray_terracotta", + "159:9": "minecraft:cyan_terracotta", + "159:10": "minecraft:purple_terracotta", + "159:11": "minecraft:blue_terracotta", + "159:12": "minecraft:brown_terracotta", + "159:13": "minecraft:green_terracotta", + "159:14": "minecraft:red_terracotta", + "159:15": "minecraft:black_terracotta", + "160:0": "minecraft:white_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:1": "minecraft:orange_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:2": "minecraft:magenta_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:3": "minecraft:light_blue_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:4": "minecraft:yellow_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:5": "minecraft:lime_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:6": "minecraft:pink_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:7": "minecraft:gray_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:8": "minecraft:light_gray_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:9": "minecraft:cyan_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:10": "minecraft:purple_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:11": "minecraft:blue_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:12": "minecraft:brown_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:13": "minecraft:green_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:14": "minecraft:red_stained_glass_pane[east=false,south=false,north=false,west=false]", + "160:15": "minecraft:black_stained_glass_pane[east=false,south=false,north=false,west=false]", + "161:0": "minecraft:acacia_leaves[persistent=false,distance=1]", + "161:1": "minecraft:dark_oak_leaves[persistent=false,distance=1]", + "161:4": "minecraft:acacia_leaves[persistent=true,distance=1]", + "161:5": "minecraft:dark_oak_leaves[persistent=true,distance=1]", + "161:8": "minecraft:acacia_leaves[persistent=false,distance=1]", + "161:9": "minecraft:dark_oak_leaves[persistent=false,distance=1]", + "161:12": "minecraft:acacia_leaves[persistent=true,distance=1]", + "161:13": "minecraft:dark_oak_leaves[persistent=true,distance=1]", + "162:0": "minecraft:acacia_log[axis=y]", + "162:1": "minecraft:dark_oak_log[axis=y]", + "162:4": "minecraft:acacia_log[axis=x]", + "162:5": "minecraft:dark_oak_log[axis=x]", + "162:8": "minecraft:acacia_log[axis=z]", + "162:9": "minecraft:dark_oak_log[axis=z]", + "162:12": "minecraft:acacia_wood", + "162:13": "minecraft:dark_oak_wood", + "163:0": "minecraft:acacia_stairs[half=bottom,shape=outer_right,facing=east]", + "163:1": "minecraft:acacia_stairs[half=bottom,shape=outer_right,facing=west]", + "163:2": "minecraft:acacia_stairs[half=bottom,shape=outer_right,facing=south]", + "163:3": "minecraft:acacia_stairs[half=bottom,shape=outer_right,facing=north]", + "163:4": "minecraft:acacia_stairs[half=top,shape=outer_right,facing=east]", + "163:5": "minecraft:acacia_stairs[half=top,shape=outer_right,facing=west]", + "163:6": "minecraft:acacia_stairs[half=top,shape=outer_right,facing=south]", + "163:7": "minecraft:acacia_stairs[half=top,shape=outer_right,facing=north]", + "164:0": "minecraft:dark_oak_stairs[half=bottom,shape=outer_right,facing=east]", + "164:1": "minecraft:dark_oak_stairs[half=bottom,shape=outer_right,facing=west]", + "164:2": "minecraft:dark_oak_stairs[half=bottom,shape=outer_right,facing=south]", + "164:3": "minecraft:dark_oak_stairs[half=bottom,shape=outer_right,facing=north]", + "164:4": "minecraft:dark_oak_stairs[half=top,shape=outer_right,facing=east]", + "164:5": "minecraft:dark_oak_stairs[half=top,shape=outer_right,facing=west]", + "164:6": "minecraft:dark_oak_stairs[half=top,shape=outer_right,facing=south]", + "164:7": "minecraft:dark_oak_stairs[half=top,shape=outer_right,facing=north]", + "165:0": "minecraft:slime_block", + "166:0": "minecraft:barrier", + "167:0": "minecraft:iron_trapdoor[half=bottom,facing=north,open=false]", + "167:1": "minecraft:iron_trapdoor[half=bottom,facing=south,open=false]", + "167:2": "minecraft:iron_trapdoor[half=bottom,facing=west,open=false]", + "167:3": "minecraft:iron_trapdoor[half=bottom,facing=east,open=false]", + "167:4": "minecraft:iron_trapdoor[half=bottom,facing=north,open=true]", + "167:5": "minecraft:iron_trapdoor[half=bottom,facing=south,open=true]", + "167:6": "minecraft:iron_trapdoor[half=bottom,facing=west,open=true]", + "167:7": "minecraft:iron_trapdoor[half=bottom,facing=east,open=true]", + "167:8": "minecraft:iron_trapdoor[half=top,facing=north,open=false]", + "167:9": "minecraft:iron_trapdoor[half=top,facing=south,open=false]", + "167:10": "minecraft:iron_trapdoor[half=top,facing=west,open=false]", + "167:11": "minecraft:iron_trapdoor[half=top,facing=east,open=false]", + "167:12": "minecraft:iron_trapdoor[half=top,facing=north,open=true]", + "167:13": "minecraft:iron_trapdoor[half=top,facing=south,open=true]", + "167:14": "minecraft:iron_trapdoor[half=top,facing=west,open=true]", + "167:15": "minecraft:iron_trapdoor[half=top,facing=east,open=true]", + "168:0": "minecraft:prismarine", + "168:1": "minecraft:prismarine_bricks", + "168:2": "minecraft:dark_prismarine", + "169:0": "minecraft:sea_lantern", + "170:0": "minecraft:hay_block[axis=y]", + "170:4": "minecraft:hay_block[axis=x]", + "170:8": "minecraft:hay_block[axis=z]", + "171:0": "minecraft:white_carpet", + "171:1": "minecraft:orange_carpet", + "171:2": "minecraft:magenta_carpet", + "171:3": "minecraft:light_blue_carpet", + "171:4": "minecraft:yellow_carpet", + "171:5": "minecraft:lime_carpet", + "171:6": "minecraft:pink_carpet", + "171:7": "minecraft:gray_carpet", + "171:8": "minecraft:light_gray_carpet", + "171:9": "minecraft:cyan_carpet", + "171:10": "minecraft:purple_carpet", + "171:11": "minecraft:blue_carpet", + "171:12": "minecraft:brown_carpet", + "171:13": "minecraft:green_carpet", + "171:14": "minecraft:red_carpet", + "171:15": "minecraft:black_carpet", + "172:0": "minecraft:terracotta", + "173:0": "minecraft:coal_block", + "174:0": "minecraft:packed_ice", + "175:0": "minecraft:sunflower[half=lower]", + "175:1": "minecraft:lilac[half=lower]", + "175:2": "minecraft:tall_grass[half=lower]", + "175:3": "minecraft:large_fern[half=lower]", + "175:4": "minecraft:rose_bush[half=lower]", + "175:5": "minecraft:peony[half=lower]", + "175:8": "minecraft:sunflower[half=upper]", + "175:9": "minecraft:lilac[half=upper]", + "175:10": "minecraft:tall_grass[half=upper]", + "175:11": "minecraft:large_fern[half=upper]", + "175:12": "minecraft:rose_bush[half=upper]", + "175:13": "minecraft:peony[half=upper]", + "176:0": "minecraft:white_banner[rotation=0]", + "176:1": "minecraft:white_banner[rotation=1]", + "176:2": "minecraft:white_banner[rotation=2]", + "176:3": "minecraft:white_banner[rotation=3]", + "176:4": "minecraft:white_banner[rotation=4]", + "176:5": "minecraft:white_banner[rotation=5]", + "176:6": "minecraft:white_banner[rotation=6]", + "176:7": "minecraft:white_banner[rotation=7]", + "176:8": "minecraft:white_banner[rotation=8]", + "176:9": "minecraft:white_banner[rotation=9]", + "176:10": "minecraft:white_banner[rotation=10]", + "176:11": "minecraft:white_banner[rotation=11]", + "176:12": "minecraft:white_banner[rotation=12]", + "176:13": "minecraft:white_banner[rotation=13]", + "176:14": "minecraft:white_banner[rotation=14]", + "176:15": "minecraft:white_banner[rotation=15]", + "177:2": "minecraft:white_wall_banner[facing=north]", + "177:3": "minecraft:white_wall_banner[facing=south]", + "177:4": "minecraft:white_wall_banner[facing=west]", + "177:5": "minecraft:white_wall_banner[facing=east]", + "178:0": "minecraft:daylight_detector[inverted=true,power=0]", + "178:1": "minecraft:daylight_detector[inverted=true,power=1]", + "178:2": "minecraft:daylight_detector[inverted=true,power=2]", + "178:3": "minecraft:daylight_detector[inverted=true,power=3]", + "178:4": "minecraft:daylight_detector[inverted=true,power=4]", + "178:5": "minecraft:daylight_detector[inverted=true,power=5]", + "178:6": "minecraft:daylight_detector[inverted=true,power=6]", + "178:7": "minecraft:daylight_detector[inverted=true,power=7]", + "178:8": "minecraft:daylight_detector[inverted=true,power=8]", + "178:9": "minecraft:daylight_detector[inverted=true,power=9]", + "178:10": "minecraft:daylight_detector[inverted=true,power=10]", + "178:11": "minecraft:daylight_detector[inverted=true,power=11]", + "178:12": "minecraft:daylight_detector[inverted=true,power=12]", + "178:13": "minecraft:daylight_detector[inverted=true,power=13]", + "178:14": "minecraft:daylight_detector[inverted=true,power=14]", + "178:15": "minecraft:daylight_detector[inverted=true,power=15]", + "179:0": "minecraft:red_sandstone", + "179:1": "minecraft:chiseled_red_sandstone", + "179:2": "minecraft:cut_red_sandstone", + "180:0": "minecraft:red_sandstone_stairs[half=bottom,shape=outer_right,facing=east]", + "180:1": "minecraft:red_sandstone_stairs[half=bottom,shape=outer_right,facing=west]", + "180:2": "minecraft:red_sandstone_stairs[half=bottom,shape=outer_right,facing=south]", + "180:3": "minecraft:red_sandstone_stairs[half=bottom,shape=outer_right,facing=north]", + "180:4": "minecraft:red_sandstone_stairs[half=top,shape=outer_right,facing=east]", + "180:5": "minecraft:red_sandstone_stairs[half=top,shape=outer_right,facing=west]", + "180:6": "minecraft:red_sandstone_stairs[half=top,shape=outer_right,facing=south]", + "180:7": "minecraft:red_sandstone_stairs[half=top,shape=outer_right,facing=north]", + "181:0": "minecraft:red_sandstone_slab[type=double]", + "181:8": "minecraft:smooth_red_sandstone", + "182:0": "minecraft:red_sandstone_slab[type=bottom]", + "182:8": "minecraft:red_sandstone_slab[type=top]", + "183:0": "minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=south,open=false]", + "183:1": "minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=west,open=false]", + "183:2": "minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=north,open=false]", + "183:3": "minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=east,open=false]", + "183:4": "minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=south,open=true]", + "183:5": "minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=west,open=true]", + "183:6": "minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=north,open=true]", + "183:7": "minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=east,open=true]", + "183:8": "minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=south,open=false]", + "183:9": "minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=west,open=false]", + "183:10": "minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=north,open=false]", + "183:11": "minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=east,open=false]", + "183:12": "minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=south,open=true]", + "183:13": "minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=west,open=true]", + "183:14": "minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=north,open=true]", + "183:15": "minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=east,open=true]", + "184:0": "minecraft:birch_fence_gate[in_wall=false,powered=false,facing=south,open=false]", + "184:1": "minecraft:birch_fence_gate[in_wall=false,powered=false,facing=west,open=false]", + "184:2": "minecraft:birch_fence_gate[in_wall=false,powered=false,facing=north,open=false]", + "184:3": "minecraft:birch_fence_gate[in_wall=false,powered=false,facing=east,open=false]", + "184:4": "minecraft:birch_fence_gate[in_wall=false,powered=false,facing=south,open=true]", + "184:5": "minecraft:birch_fence_gate[in_wall=false,powered=false,facing=west,open=true]", + "184:6": "minecraft:birch_fence_gate[in_wall=false,powered=false,facing=north,open=true]", + "184:7": "minecraft:birch_fence_gate[in_wall=false,powered=false,facing=east,open=true]", + "184:8": "minecraft:birch_fence_gate[in_wall=false,powered=true,facing=south,open=false]", + "184:9": "minecraft:birch_fence_gate[in_wall=false,powered=true,facing=west,open=false]", + "184:10": "minecraft:birch_fence_gate[in_wall=false,powered=true,facing=north,open=false]", + "184:11": "minecraft:birch_fence_gate[in_wall=false,powered=true,facing=east,open=false]", + "184:12": "minecraft:birch_fence_gate[in_wall=false,powered=true,facing=south,open=true]", + "184:13": "minecraft:birch_fence_gate[in_wall=false,powered=true,facing=west,open=true]", + "184:14": "minecraft:birch_fence_gate[in_wall=false,powered=true,facing=north,open=true]", + "184:15": "minecraft:birch_fence_gate[in_wall=false,powered=true,facing=east,open=true]", + "185:0": "minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=south,open=false]", + "185:1": "minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=west,open=false]", + "185:2": "minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=north,open=false]", + "185:3": "minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=east,open=false]", + "185:4": "minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=south,open=true]", + "185:5": "minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=west,open=true]", + "185:6": "minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=north,open=true]", + "185:7": "minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=east,open=true]", + "185:8": "minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=south,open=false]", + "185:9": "minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=west,open=false]", + "185:10": "minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=north,open=false]", + "185:11": "minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=east,open=false]", + "185:12": "minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=south,open=true]", + "185:13": "minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=west,open=true]", + "185:14": "minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=north,open=true]", + "185:15": "minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=east,open=true]", + "186:0": "minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=south,open=false]", + "186:1": "minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=west,open=false]", + "186:2": "minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=north,open=false]", + "186:3": "minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=east,open=false]", + "186:4": "minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=south,open=true]", + "186:5": "minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=west,open=true]", + "186:6": "minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=north,open=true]", + "186:7": "minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=east,open=true]", + "186:8": "minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=south,open=false]", + "186:9": "minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=west,open=false]", + "186:10": "minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=north,open=false]", + "186:11": "minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=east,open=false]", + "186:12": "minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=south,open=true]", + "186:13": "minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=west,open=true]", + "186:14": "minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=north,open=true]", + "186:15": "minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=east,open=true]", + "187:0": "minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=south,open=false]", + "187:1": "minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=west,open=false]", + "187:2": "minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=north,open=false]", + "187:3": "minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=east,open=false]", + "187:4": "minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=south,open=true]", + "187:5": "minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=west,open=true]", + "187:6": "minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=north,open=true]", + "187:7": "minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=east,open=true]", + "187:8": "minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=south,open=false]", + "187:9": "minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=west,open=false]", + "187:10": "minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=north,open=false]", + "187:11": "minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=east,open=false]", + "187:12": "minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=south,open=true]", + "187:13": "minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=west,open=true]", + "187:14": "minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=north,open=true]", + "187:15": "minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=east,open=true]", + "188:0": "minecraft:spruce_fence[east=false,south=false,north=false,west=false]", + "189:0": "minecraft:birch_fence[east=false,south=false,north=false,west=false]", + "190:0": "minecraft:jungle_fence[east=false,south=false,north=false,west=false]", + "191:0": "minecraft:dark_oak_fence[east=false,south=false,north=false,west=false]", + "192:0": "minecraft:acacia_fence[east=false,south=false,north=false,west=false]", + "193:0": "minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=east,open=false]", + "193:1": "minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=south,open=false]", + "193:2": "minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=west,open=false]", + "193:3": "minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=north,open=false]", + "193:4": "minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=east,open=true]", + "193:5": "minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=south,open=true]", + "193:6": "minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=west,open=true]", + "193:7": "minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=north,open=true]", + "193:8": "minecraft:spruce_door[hinge=left,half=upper,powered=false,facing=east,open=false]", + "193:9": "minecraft:spruce_door[hinge=right,half=upper,powered=false,facing=east,open=false]", + "193:10": "minecraft:spruce_door[hinge=left,half=upper,powered=true,facing=east,open=false]", + "193:11": "minecraft:spruce_door[hinge=right,half=upper,powered=true,facing=east,open=false]", + "194:0": "minecraft:birch_door[hinge=right,half=lower,powered=false,facing=east,open=false]", + "194:1": "minecraft:birch_door[hinge=right,half=lower,powered=false,facing=south,open=false]", + "194:2": "minecraft:birch_door[hinge=right,half=lower,powered=false,facing=west,open=false]", + "194:3": "minecraft:birch_door[hinge=right,half=lower,powered=false,facing=north,open=false]", + "194:4": "minecraft:birch_door[hinge=right,half=lower,powered=false,facing=east,open=true]", + "194:5": "minecraft:birch_door[hinge=right,half=lower,powered=false,facing=south,open=true]", + "194:6": "minecraft:birch_door[hinge=right,half=lower,powered=false,facing=west,open=true]", + "194:7": "minecraft:birch_door[hinge=right,half=lower,powered=false,facing=north,open=true]", + "194:8": "minecraft:birch_door[hinge=left,half=upper,powered=false,facing=east,open=false]", + "194:9": "minecraft:birch_door[hinge=right,half=upper,powered=false,facing=east,open=false]", + "194:10": "minecraft:birch_door[hinge=left,half=upper,powered=true,facing=east,open=false]", + "194:11": "minecraft:birch_door[hinge=right,half=upper,powered=true,facing=east,open=false]", + "195:0": "minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=east,open=false]", + "195:1": "minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=south,open=false]", + "195:2": "minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=west,open=false]", + "195:3": "minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=north,open=false]", + "195:4": "minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=east,open=true]", + "195:5": "minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=south,open=true]", + "195:6": "minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=west,open=true]", + "195:7": "minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=north,open=true]", + "195:8": "minecraft:jungle_door[hinge=left,half=upper,powered=false,facing=east,open=false]", + "195:9": "minecraft:jungle_door[hinge=right,half=upper,powered=false,facing=east,open=false]", + "195:10": "minecraft:jungle_door[hinge=left,half=upper,powered=true,facing=east,open=false]", + "195:11": "minecraft:jungle_door[hinge=right,half=upper,powered=true,facing=east,open=false]", + "196:0": "minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=east,open=false]", + "196:1": "minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=south,open=false]", + "196:2": "minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=west,open=false]", + "196:3": "minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=north,open=false]", + "196:4": "minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=east,open=true]", + "196:5": "minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=south,open=true]", + "196:6": "minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=west,open=true]", + "196:7": "minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=north,open=true]", + "196:8": "minecraft:acacia_door[hinge=left,half=upper,powered=false,facing=east,open=false]", + "196:9": "minecraft:acacia_door[hinge=right,half=upper,powered=false,facing=east,open=false]", + "196:10": "minecraft:acacia_door[hinge=left,half=upper,powered=true,facing=east,open=false]", + "196:11": "minecraft:acacia_door[hinge=right,half=upper,powered=true,facing=east,open=false]", + "197:0": "minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=east,open=false]", + "197:1": "minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=south,open=false]", + "197:2": "minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=west,open=false]", + "197:3": "minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=north,open=false]", + "197:4": "minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=east,open=true]", + "197:5": "minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=south,open=true]", + "197:6": "minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=west,open=true]", + "197:7": "minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=north,open=true]", + "197:8": "minecraft:dark_oak_door[hinge=left,half=upper,powered=false,facing=east,open=false]", + "197:9": "minecraft:dark_oak_door[hinge=right,half=upper,powered=false,facing=east,open=false]", + "197:10": "minecraft:dark_oak_door[hinge=left,half=upper,powered=true,facing=east,open=false]", + "197:11": "minecraft:dark_oak_door[hinge=right,half=upper,powered=true,facing=east,open=false]", + "198:0": "minecraft:end_rod[facing=down]", + "198:1": "minecraft:end_rod[facing=up]", + "198:2": "minecraft:end_rod[facing=north]", + "198:3": "minecraft:end_rod[facing=south]", + "198:4": "minecraft:end_rod[facing=west]", + "198:5": "minecraft:end_rod[facing=east]", + "199:0": "minecraft:chorus_plant[east=false,south=false,north=false,west=false,up=false,down=false]", + "200:0": "minecraft:chorus_flower[age=0]", + "200:1": "minecraft:chorus_flower[age=1]", + "200:2": "minecraft:chorus_flower[age=2]", + "200:3": "minecraft:chorus_flower[age=3]", + "200:4": "minecraft:chorus_flower[age=4]", + "200:5": "minecraft:chorus_flower[age=5]", + "201:0": "minecraft:purpur_block", + "202:0": "minecraft:purpur_pillar[axis=y]", + "202:4": "minecraft:purpur_pillar[axis=x]", + "202:8": "minecraft:purpur_pillar[axis=z]", + "203:0": "minecraft:purpur_stairs[half=bottom,shape=outer_right,facing=east]", + "203:1": "minecraft:purpur_stairs[half=bottom,shape=outer_right,facing=west]", + "203:2": "minecraft:purpur_stairs[half=bottom,shape=outer_right,facing=south]", + "203:3": "minecraft:purpur_stairs[half=bottom,shape=outer_right,facing=north]", + "203:4": "minecraft:purpur_stairs[half=top,shape=outer_right,facing=east]", + "203:5": "minecraft:purpur_stairs[half=top,shape=outer_right,facing=west]", + "203:6": "minecraft:purpur_stairs[half=top,shape=outer_right,facing=south]", + "203:7": "minecraft:purpur_stairs[half=top,shape=outer_right,facing=north]", + "204:0": "minecraft:purpur_slab[type=double]", + "205:0": "minecraft:purpur_slab[type=bottom]", + "205:8": "minecraft:purpur_slab[type=top]", + "206:0": "minecraft:end_stone_bricks", + "207:0": "minecraft:beetroots[age=0]", + "207:1": "minecraft:beetroots[age=1]", + "207:2": "minecraft:beetroots[age=2]", + "207:3": "minecraft:beetroots[age=3]", + "208:0": "minecraft:grass_path", + "209:0": "minecraft:end_gateway", + "210:0": "minecraft:repeating_command_block[conditional=false,facing=down]", + "210:1": "minecraft:repeating_command_block[conditional=false,facing=up]", + "210:2": "minecraft:repeating_command_block[conditional=false,facing=north]", + "210:3": "minecraft:repeating_command_block[conditional=false,facing=south]", + "210:4": "minecraft:repeating_command_block[conditional=false,facing=west]", + "210:5": "minecraft:repeating_command_block[conditional=false,facing=east]", + "210:8": "minecraft:repeating_command_block[conditional=true,facing=down]", + "210:9": "minecraft:repeating_command_block[conditional=true,facing=up]", + "210:10": "minecraft:repeating_command_block[conditional=true,facing=north]", + "210:11": "minecraft:repeating_command_block[conditional=true,facing=south]", + "210:12": "minecraft:repeating_command_block[conditional=true,facing=west]", + "210:13": "minecraft:repeating_command_block[conditional=true,facing=east]", + "211:0": "minecraft:chain_command_block[conditional=false,facing=down]", + "211:1": "minecraft:chain_command_block[conditional=false,facing=up]", + "211:2": "minecraft:chain_command_block[conditional=false,facing=north]", + "211:3": "minecraft:chain_command_block[conditional=false,facing=south]", + "211:4": "minecraft:chain_command_block[conditional=false,facing=west]", + "211:5": "minecraft:chain_command_block[conditional=false,facing=east]", + "211:8": "minecraft:chain_command_block[conditional=true,facing=down]", + "211:9": "minecraft:chain_command_block[conditional=true,facing=up]", + "211:10": "minecraft:chain_command_block[conditional=true,facing=north]", + "211:11": "minecraft:chain_command_block[conditional=true,facing=south]", + "211:12": "minecraft:chain_command_block[conditional=true,facing=west]", + "211:13": "minecraft:chain_command_block[conditional=true,facing=east]", + "212:0": "minecraft:frosted_ice[age=0]", + "212:1": "minecraft:frosted_ice[age=1]", + "212:2": "minecraft:frosted_ice[age=2]", + "212:3": "minecraft:frosted_ice[age=3]", + "213:0": "minecraft:magma_block", + "214:0": "minecraft:nether_wart_block", + "215:0": "minecraft:red_nether_bricks", + "216:0": "minecraft:bone_block[axis=y]", + "216:4": "minecraft:bone_block[axis=x]", + "216:8": "minecraft:bone_block[axis=z]", + "217:0": "minecraft:structure_void", + "218:0": "minecraft:observer[powered=false,facing=down]", + "218:1": "minecraft:observer[powered=false,facing=up]", + "218:2": "minecraft:observer[powered=false,facing=north]", + "218:3": "minecraft:observer[powered=false,facing=south]", + "218:4": "minecraft:observer[powered=false,facing=west]", + "218:5": "minecraft:observer[powered=false,facing=east]", + "218:8": "minecraft:observer[powered=true,facing=down]", + "218:9": "minecraft:observer[powered=true,facing=up]", + "218:10": "minecraft:observer[powered=true,facing=north]", + "218:11": "minecraft:observer[powered=true,facing=south]", + "218:12": "minecraft:observer[powered=true,facing=west]", + "218:13": "minecraft:observer[powered=true,facing=east]", + "219:0": "minecraft:white_shulker_box[facing=down]", + "219:1": "minecraft:white_shulker_box[facing=up]", + "219:2": "minecraft:white_shulker_box[facing=north]", + "219:3": "minecraft:white_shulker_box[facing=south]", + "219:4": "minecraft:white_shulker_box[facing=west]", + "219:5": "minecraft:white_shulker_box[facing=east]", + "220:0": "minecraft:orange_shulker_box[facing=down]", + "220:1": "minecraft:orange_shulker_box[facing=up]", + "220:2": "minecraft:orange_shulker_box[facing=north]", + "220:3": "minecraft:orange_shulker_box[facing=south]", + "220:4": "minecraft:orange_shulker_box[facing=west]", + "220:5": "minecraft:orange_shulker_box[facing=east]", + "221:0": "minecraft:magenta_shulker_box[facing=down]", + "221:1": "minecraft:magenta_shulker_box[facing=up]", + "221:2": "minecraft:magenta_shulker_box[facing=north]", + "221:3": "minecraft:magenta_shulker_box[facing=south]", + "221:4": "minecraft:magenta_shulker_box[facing=west]", + "221:5": "minecraft:magenta_shulker_box[facing=east]", + "222:0": "minecraft:light_blue_shulker_box[facing=down]", + "222:1": "minecraft:light_blue_shulker_box[facing=up]", + "222:2": "minecraft:light_blue_shulker_box[facing=north]", + "222:3": "minecraft:light_blue_shulker_box[facing=south]", + "222:4": "minecraft:light_blue_shulker_box[facing=west]", + "222:5": "minecraft:light_blue_shulker_box[facing=east]", + "223:0": "minecraft:yellow_shulker_box[facing=down]", + "223:1": "minecraft:yellow_shulker_box[facing=up]", + "223:2": "minecraft:yellow_shulker_box[facing=north]", + "223:3": "minecraft:yellow_shulker_box[facing=south]", + "223:4": "minecraft:yellow_shulker_box[facing=west]", + "223:5": "minecraft:yellow_shulker_box[facing=east]", + "224:0": "minecraft:lime_shulker_box[facing=down]", + "224:1": "minecraft:lime_shulker_box[facing=up]", + "224:2": "minecraft:lime_shulker_box[facing=north]", + "224:3": "minecraft:lime_shulker_box[facing=south]", + "224:4": "minecraft:lime_shulker_box[facing=west]", + "224:5": "minecraft:lime_shulker_box[facing=east]", + "225:0": "minecraft:pink_shulker_box[facing=down]", + "225:1": "minecraft:pink_shulker_box[facing=up]", + "225:2": "minecraft:pink_shulker_box[facing=north]", + "225:3": "minecraft:pink_shulker_box[facing=south]", + "225:4": "minecraft:pink_shulker_box[facing=west]", + "225:5": "minecraft:pink_shulker_box[facing=east]", + "226:0": "minecraft:gray_shulker_box[facing=down]", + "226:1": "minecraft:gray_shulker_box[facing=up]", + "226:2": "minecraft:gray_shulker_box[facing=north]", + "226:3": "minecraft:gray_shulker_box[facing=south]", + "226:4": "minecraft:gray_shulker_box[facing=west]", + "226:5": "minecraft:gray_shulker_box[facing=east]", + "227:0": "minecraft:light_gray_shulker_box[facing=down]", + "227:1": "minecraft:light_gray_shulker_box[facing=up]", + "227:2": "minecraft:light_gray_shulker_box[facing=north]", + "227:3": "minecraft:light_gray_shulker_box[facing=south]", + "227:4": "minecraft:light_gray_shulker_box[facing=west]", + "227:5": "minecraft:light_gray_shulker_box[facing=east]", + "228:0": "minecraft:cyan_shulker_box[facing=down]", + "228:1": "minecraft:cyan_shulker_box[facing=up]", + "228:2": "minecraft:cyan_shulker_box[facing=north]", + "228:3": "minecraft:cyan_shulker_box[facing=south]", + "228:4": "minecraft:cyan_shulker_box[facing=west]", + "228:5": "minecraft:cyan_shulker_box[facing=east]", + "229:0": "minecraft:purple_shulker_box[facing=down]", + "229:1": "minecraft:purple_shulker_box[facing=up]", + "229:2": "minecraft:purple_shulker_box[facing=north]", + "229:3": "minecraft:purple_shulker_box[facing=south]", + "229:4": "minecraft:purple_shulker_box[facing=west]", + "229:5": "minecraft:purple_shulker_box[facing=east]", + "230:0": "minecraft:blue_shulker_box[facing=down]", + "230:1": "minecraft:blue_shulker_box[facing=up]", + "230:2": "minecraft:blue_shulker_box[facing=north]", + "230:3": "minecraft:blue_shulker_box[facing=south]", + "230:4": "minecraft:blue_shulker_box[facing=west]", + "230:5": "minecraft:blue_shulker_box[facing=east]", + "231:0": "minecraft:brown_shulker_box[facing=down]", + "231:1": "minecraft:brown_shulker_box[facing=up]", + "231:2": "minecraft:brown_shulker_box[facing=north]", + "231:3": "minecraft:brown_shulker_box[facing=south]", + "231:4": "minecraft:brown_shulker_box[facing=west]", + "231:5": "minecraft:brown_shulker_box[facing=east]", + "232:0": "minecraft:green_shulker_box[facing=down]", + "232:1": "minecraft:green_shulker_box[facing=up]", + "232:2": "minecraft:green_shulker_box[facing=north]", + "232:3": "minecraft:green_shulker_box[facing=south]", + "232:4": "minecraft:green_shulker_box[facing=west]", + "232:5": "minecraft:green_shulker_box[facing=east]", + "233:0": "minecraft:red_shulker_box[facing=down]", + "233:1": "minecraft:red_shulker_box[facing=up]", + "233:2": "minecraft:red_shulker_box[facing=north]", + "233:3": "minecraft:red_shulker_box[facing=south]", + "233:4": "minecraft:red_shulker_box[facing=west]", + "233:5": "minecraft:red_shulker_box[facing=east]", + "234:0": "minecraft:black_shulker_box[facing=down]", + "234:1": "minecraft:black_shulker_box[facing=up]", + "234:2": "minecraft:black_shulker_box[facing=north]", + "234:3": "minecraft:black_shulker_box[facing=south]", + "234:4": "minecraft:black_shulker_box[facing=west]", + "234:5": "minecraft:black_shulker_box[facing=east]", + "235:0": "minecraft:white_glazed_terracotta[facing=south]", + "235:1": "minecraft:white_glazed_terracotta[facing=west]", + "235:2": "minecraft:white_glazed_terracotta[facing=north]", + "235:3": "minecraft:white_glazed_terracotta[facing=east]", + "236:0": "minecraft:orange_glazed_terracotta[facing=south]", + "236:1": "minecraft:orange_glazed_terracotta[facing=west]", + "236:2": "minecraft:orange_glazed_terracotta[facing=north]", + "236:3": "minecraft:orange_glazed_terracotta[facing=east]", + "237:0": "minecraft:magenta_glazed_terracotta[facing=south]", + "237:1": "minecraft:magenta_glazed_terracotta[facing=west]", + "237:2": "minecraft:magenta_glazed_terracotta[facing=north]", + "237:3": "minecraft:magenta_glazed_terracotta[facing=east]", + "238:0": "minecraft:light_blue_glazed_terracotta[facing=south]", + "238:1": "minecraft:light_blue_glazed_terracotta[facing=west]", + "238:2": "minecraft:light_blue_glazed_terracotta[facing=north]", + "238:3": "minecraft:light_blue_glazed_terracotta[facing=east]", + "239:0": "minecraft:yellow_glazed_terracotta[facing=south]", + "239:1": "minecraft:yellow_glazed_terracotta[facing=west]", + "239:2": "minecraft:yellow_glazed_terracotta[facing=north]", + "239:3": "minecraft:yellow_glazed_terracotta[facing=east]", + "240:0": "minecraft:lime_glazed_terracotta[facing=south]", + "240:1": "minecraft:lime_glazed_terracotta[facing=west]", + "240:2": "minecraft:lime_glazed_terracotta[facing=north]", + "240:3": "minecraft:lime_glazed_terracotta[facing=east]", + "241:0": "minecraft:pink_glazed_terracotta[facing=south]", + "241:1": "minecraft:pink_glazed_terracotta[facing=west]", + "241:2": "minecraft:pink_glazed_terracotta[facing=north]", + "241:3": "minecraft:pink_glazed_terracotta[facing=east]", + "242:0": "minecraft:gray_glazed_terracotta[facing=south]", + "242:1": "minecraft:gray_glazed_terracotta[facing=west]", + "242:2": "minecraft:gray_glazed_terracotta[facing=north]", + "242:3": "minecraft:gray_glazed_terracotta[facing=east]", + "243:0": "minecraft:light_gray_glazed_terracotta[facing=south]", + "243:1": "minecraft:light_gray_glazed_terracotta[facing=west]", + "243:2": "minecraft:light_gray_glazed_terracotta[facing=north]", + "243:3": "minecraft:light_gray_glazed_terracotta[facing=east]", + "244:0": "minecraft:cyan_glazed_terracotta[facing=south]", + "244:1": "minecraft:cyan_glazed_terracotta[facing=west]", + "244:2": "minecraft:cyan_glazed_terracotta[facing=north]", + "244:3": "minecraft:cyan_glazed_terracotta[facing=east]", + "245:0": "minecraft:purple_glazed_terracotta[facing=south]", + "245:1": "minecraft:purple_glazed_terracotta[facing=west]", + "245:2": "minecraft:purple_glazed_terracotta[facing=north]", + "245:3": "minecraft:purple_glazed_terracotta[facing=east]", + "246:0": "minecraft:blue_glazed_terracotta[facing=south]", + "246:1": "minecraft:blue_glazed_terracotta[facing=west]", + "246:2": "minecraft:blue_glazed_terracotta[facing=north]", + "246:3": "minecraft:blue_glazed_terracotta[facing=east]", + "247:0": "minecraft:brown_glazed_terracotta[facing=south]", + "247:1": "minecraft:brown_glazed_terracotta[facing=west]", + "247:2": "minecraft:brown_glazed_terracotta[facing=north]", + "247:3": "minecraft:brown_glazed_terracotta[facing=east]", + "248:0": "minecraft:green_glazed_terracotta[facing=south]", + "248:1": "minecraft:green_glazed_terracotta[facing=west]", + "248:2": "minecraft:green_glazed_terracotta[facing=north]", + "248:3": "minecraft:green_glazed_terracotta[facing=east]", + "249:0": "minecraft:red_glazed_terracotta[facing=south]", + "249:1": "minecraft:red_glazed_terracotta[facing=west]", + "249:2": "minecraft:red_glazed_terracotta[facing=north]", + "249:3": "minecraft:red_glazed_terracotta[facing=east]", + "250:0": "minecraft:black_glazed_terracotta[facing=south]", + "250:1": "minecraft:black_glazed_terracotta[facing=west]", + "250:2": "minecraft:black_glazed_terracotta[facing=north]", + "250:3": "minecraft:black_glazed_terracotta[facing=east]", + "251:0": "minecraft:white_concrete", + "251:1": "minecraft:orange_concrete", + "251:2": "minecraft:magenta_concrete", + "251:3": "minecraft:light_blue_concrete", + "251:4": "minecraft:yellow_concrete", + "251:5": "minecraft:lime_concrete", + "251:6": "minecraft:pink_concrete", + "251:7": "minecraft:gray_concrete", + "251:8": "minecraft:light_gray_concrete", + "251:9": "minecraft:cyan_concrete", + "251:10": "minecraft:purple_concrete", + "251:11": "minecraft:blue_concrete", + "251:12": "minecraft:brown_concrete", + "251:13": "minecraft:green_concrete", + "251:14": "minecraft:red_concrete", + "251:15": "minecraft:black_concrete", + "252:0": "minecraft:white_concrete_powder", + "252:1": "minecraft:orange_concrete_powder", + "252:2": "minecraft:magenta_concrete_powder", + "252:3": "minecraft:light_blue_concrete_powder", + "252:4": "minecraft:yellow_concrete_powder", + "252:5": "minecraft:lime_concrete_powder", + "252:6": "minecraft:pink_concrete_powder", + "252:7": "minecraft:gray_concrete_powder", + "252:8": "minecraft:light_gray_concrete_powder", + "252:9": "minecraft:cyan_concrete_powder", + "252:10": "minecraft:purple_concrete_powder", + "252:11": "minecraft:blue_concrete_powder", + "252:12": "minecraft:brown_concrete_powder", + "252:13": "minecraft:green_concrete_powder", + "252:14": "minecraft:red_concrete_powder", + "252:15": "minecraft:black_concrete_powder", + "255:0": "minecraft:structure_block[mode=save]", + "255:1": "minecraft:structure_block[mode=load]", + "255:2": "minecraft:structure_block[mode=corner]", + "255:3": "minecraft:structure_block[mode=data]" + }, + "items": { + "0:0": "minecraft:air", + "1:0": "minecraft:stone", + "1:1": "minecraft:granite", + "1:2": "minecraft:polished_granite", + "1:3": "minecraft:diorite", + "1:4": "minecraft:polished_diorite", + "1:5": "minecraft:andesite", + "1:6": "minecraft:polished_andesite", + "2:0": "minecraft:grass_block", + "3:0": "minecraft:dirt", + "3:1": "minecraft:coarse_dirt", + "3:2": "minecraft:podzol", + "4:0": "minecraft:cobblestone", + "5:0": "minecraft:oak_planks", + "5:1": "minecraft:spruce_planks", + "5:2": "minecraft:birch_planks", + "5:3": "minecraft:jungle_planks", + "5:4": "minecraft:acacia_planks", + "5:5": "minecraft:dark_oak_planks", + "6:0": "minecraft:oak_sapling", + "6:1": "minecraft:spruce_sapling", + "6:2": "minecraft:birch_sapling", + "6:3": "minecraft:jungle_sapling", + "6:4": "minecraft:acacia_sapling", + "6:5": "minecraft:dark_oak_sapling", + "7:0": "minecraft:bedrock", + "12:0": "minecraft:sand", + "12:1": "minecraft:red_sand", + "13:0": "minecraft:gravel", + "14:0": "minecraft:gold_ore", + "15:0": "minecraft:iron_ore", + "16:0": "minecraft:coal_ore", + "17:0": "minecraft:oak_log", + "17:1": "minecraft:spruce_log", + "17:2": "minecraft:birch_log", + "17:3": "minecraft:jungle_log", + "18:0": "minecraft:oak_leaves", + "18:1": "minecraft:spruce_leaves", + "18:2": "minecraft:birch_leaves", + "18:3": "minecraft:jungle_leaves", + "19:0": "minecraft:sponge", + "19:1": "minecraft:wet_sponge", + "20:0": "minecraft:glass", + "21:0": "minecraft:lapis_ore", + "22:0": "minecraft:lapis_block", + "23:0": "minecraft:dispenser", + "24:0": "minecraft:sandstone", + "24:1": "minecraft:chiseled_sandstone", + "24:2": "minecraft:cut_sandstone", + "25:0": "minecraft:note_block", + "27:0": "minecraft:powered_rail", + "28:0": "minecraft:detector_rail", + "29:0": "minecraft:sticky_piston", + "30:0": "minecraft:cobweb", + "31:1": "minecraft:grass", + "31:2": "minecraft:fern", + "32:0": "minecraft:dead_bush", + "33:0": "minecraft:piston", + "35:0": "minecraft:white_wool", + "35:1": "minecraft:orange_wool", + "35:2": "minecraft:magenta_wool", + "35:3": "minecraft:light_blue_wool", + "35:4": "minecraft:yellow_wool", + "35:5": "minecraft:lime_wool", + "35:6": "minecraft:pink_wool", + "35:7": "minecraft:gray_wool", + "35:8": "minecraft:light_gray_wool", + "35:9": "minecraft:cyan_wool", + "35:10": "minecraft:purple_wool", + "35:11": "minecraft:blue_wool", + "35:12": "minecraft:brown_wool", + "35:13": "minecraft:green_wool", + "35:14": "minecraft:red_wool", + "35:15": "minecraft:black_wool", + "37:0": "minecraft:dandelion", + "38:0": "minecraft:poppy", + "38:1": "minecraft:blue_orchid", + "38:2": "minecraft:allium", + "38:3": "minecraft:azure_bluet", + "38:4": "minecraft:red_tulip", + "38:5": "minecraft:orange_tulip", + "38:6": "minecraft:white_tulip", + "38:7": "minecraft:pink_tulip", + "38:8": "minecraft:oxeye_daisy", + "39:0": "minecraft:brown_mushroom", + "40:0": "minecraft:red_mushroom", + "41:0": "minecraft:gold_block", + "42:0": "minecraft:iron_block", + "44:0": "minecraft:stone_slab", + "44:1": "minecraft:sandstone_slab", + "44:3": "minecraft:cobblestone_slab", + "44:4": "minecraft:brick_slab", + "44:5": "minecraft:stone_brick_slab", + "44:6": "minecraft:nether_brick_slab", + "44:7": "minecraft:quartz_slab", + "45:0": "minecraft:bricks", + "46:0": "minecraft:tnt", + "47:0": "minecraft:bookshelf", + "48:0": "minecraft:mossy_cobblestone", + "49:0": "minecraft:obsidian", + "50:0": "minecraft:torch", + "52:0": "minecraft:mob_spawner", + "53:0": "minecraft:oak_stairs", + "54:0": "minecraft:chest", + "56:0": "minecraft:diamond_ore", + "57:0": "minecraft:diamond_block", + "58:0": "minecraft:crafting_table", + "60:0": "minecraft:farmland", + "61:0": "minecraft:furnace", + "65:0": "minecraft:ladder", + "66:0": "minecraft:rail", + "67:0": "minecraft:cobblestone_stairs", + "69:0": "minecraft:lever", + "70:0": "minecraft:stone_pressure_plate", + "72:0": "minecraft:oak_pressure_plate", + "73:0": "minecraft:redstone_ore", + "76:0": "minecraft:redstone_torch", + "77:0": "minecraft:stone_button", + "78:0": "minecraft:snow", + "79:0": "minecraft:ice", + "80:0": "minecraft:snow_block", + "81:0": "minecraft:cactus", + "82:0": "minecraft:clay", + "84:0": "minecraft:jukebox", + "85:0": "minecraft:oak_fence", + "86:0": "minecraft:carved_pumpkin", + "87:0": "minecraft:netherrack", + "88:0": "minecraft:soul_sand", + "89:0": "minecraft:glowstone", + "91:0": "minecraft:jack_o_lantern", + "95:0": "minecraft:white_stained_glass", + "95:1": "minecraft:orange_stained_glass", + "95:2": "minecraft:magenta_stained_glass", + "95:3": "minecraft:light_blue_stained_glass", + "95:4": "minecraft:yellow_stained_glass", + "95:5": "minecraft:lime_stained_glass", + "95:6": "minecraft:pink_stained_glass", + "95:7": "minecraft:gray_stained_glass", + "95:8": "minecraft:light_gray_stained_glass", + "95:9": "minecraft:cyan_stained_glass", + "95:10": "minecraft:purple_stained_glass", + "95:11": "minecraft:blue_stained_glass", + "95:12": "minecraft:brown_stained_glass", + "95:13": "minecraft:green_stained_glass", + "95:14": "minecraft:red_stained_glass", + "95:15": "minecraft:black_stained_glass", + "96:0": "minecraft:oak_trapdoor", + "97:0": "minecraft:infested_stone", + "97:1": "minecraft:infested_cobblestone", + "97:2": "minecraft:infested_stone_bricks", + "97:3": "minecraft:infested_mossy_stone_bricks", + "97:4": "minecraft:infested_cracked_stone_bricks", + "97:5": "minecraft:infested_chiseled_stone_bricks", + "98:0": "minecraft:stone_bricks", + "98:1": "minecraft:mossy_stone_bricks", + "98:2": "minecraft:cracked_stone_bricks", + "98:3": "minecraft:chiseled_stone_bricks", + "99:0": "minecraft:brown_mushroom_block", + "100:0": "minecraft:red_mushroom_block", + "101:0": "minecraft:iron_bars", + "102:0": "minecraft:glass_pane", + "103:0": "minecraft:melon", + "106:0": "minecraft:vine", + "107:0": "minecraft:oak_fence_gate", + "108:0": "minecraft:brick_stairs", + "109:0": "minecraft:stone_brick_stairs", + "110:0": "minecraft:mycelium", + "111:0": "minecraft:lily_pad", + "112:0": "minecraft:nether_bricks", + "113:0": "minecraft:nether_brick_fence", + "114:0": "minecraft:nether_brick_stairs", + "116:0": "minecraft:enchanting_table", + "120:0": "minecraft:end_portal_frame", + "121:0": "minecraft:end_stone", + "122:0": "minecraft:dragon_egg", + "123:0": "minecraft:redstone_lamp", + "126:0": "minecraft:oak_slab", + "126:1": "minecraft:spruce_slab", + "126:2": "minecraft:birch_slab", + "126:3": "minecraft:jungle_slab", + "126:4": "minecraft:acacia_slab", + "126:5": "minecraft:dark_oak_slab", + "128:0": "minecraft:sandstone_stairs", + "129:0": "minecraft:emerald_ore", + "130:0": "minecraft:ender_chest", + "131:0": "minecraft:tripwire_hook", + "133:0": "minecraft:emerald_block", + "134:0": "minecraft:spruce_stairs", + "135:0": "minecraft:birch_stairs", + "136:0": "minecraft:jungle_stairs", + "137:0": "minecraft:command_block", + "138:0": "minecraft:beacon", + "139:0": "minecraft:cobblestone_wall", + "139:1": "minecraft:mossy_cobblestone_wall", + "143:0": "minecraft:oak_button", + "145:0": "minecraft:anvil", + "145:1": "minecraft:chipped_anvil", + "145:2": "minecraft:damaged_anvil", + "146:0": "minecraft:trapped_chest", + "147:0": "minecraft:light_weighted_pressure_plate", + "148:0": "minecraft:heavy_weighted_pressure_plate", + "151:0": "minecraft:daylight_detector", + "152:0": "minecraft:redstone_block", + "153:0": "minecraft:nether_quartz_ore", + "154:0": "minecraft:hopper", + "155:0": "minecraft:quartz_block", + "155:1": "minecraft:chiseled_quartz_block", + "155:2": "minecraft:quartz_pillar", + "156:0": "minecraft:quartz_stairs", + "157:0": "minecraft:activator_rail", + "158:0": "minecraft:dropper", + "159:0": "minecraft:white_terracotta", + "159:1": "minecraft:orange_terracotta", + "159:2": "minecraft:magenta_terracotta", + "159:3": "minecraft:light_blue_terracotta", + "159:4": "minecraft:yellow_terracotta", + "159:5": "minecraft:lime_terracotta", + "159:6": "minecraft:pink_terracotta", + "159:7": "minecraft:gray_terracotta", + "159:8": "minecraft:light_gray_terracotta", + "159:9": "minecraft:cyan_terracotta", + "159:10": "minecraft:purple_terracotta", + "159:11": "minecraft:blue_terracotta", + "159:12": "minecraft:brown_terracotta", + "159:13": "minecraft:green_terracotta", + "159:14": "minecraft:red_terracotta", + "159:15": "minecraft:black_terracotta", + "160:0": "minecraft:white_stained_glass_pane", + "160:1": "minecraft:orange_stained_glass_pane", + "160:2": "minecraft:magenta_stained_glass_pane", + "160:3": "minecraft:light_blue_stained_glass_pane", + "160:4": "minecraft:yellow_stained_glass_pane", + "160:5": "minecraft:lime_stained_glass_pane", + "160:6": "minecraft:pink_stained_glass_pane", + "160:7": "minecraft:gray_stained_glass_pane", + "160:8": "minecraft:light_gray_stained_glass_pane", + "160:9": "minecraft:cyan_stained_glass_pane", + "160:10": "minecraft:purple_stained_glass_pane", + "160:11": "minecraft:blue_stained_glass_pane", + "160:12": "minecraft:brown_stained_glass_pane", + "160:13": "minecraft:green_stained_glass_pane", + "160:14": "minecraft:red_stained_glass_pane", + "160:15": "minecraft:black_stained_glass_pane", + "161:0": "minecraft:acacia_leaves", + "161:1": "minecraft:dark_oak_leaves", + "162:0": "minecraft:acacia_log", + "162:1": "minecraft:dark_oak_log", + "163:0": "minecraft:acacia_stairs", + "164:0": "minecraft:dark_oak_stairs", + "165:0": "minecraft:slime_block", + "166:0": "minecraft:barrier", + "167:0": "minecraft:iron_trapdoor", + "168:0": "minecraft:prismarine", + "168:1": "minecraft:prismarine_bricks", + "168:2": "minecraft:dark_prismarine", + "169:0": "minecraft:sea_lantern", + "170:0": "minecraft:hay_block", + "171:0": "minecraft:white_carpet", + "171:1": "minecraft:orange_carpet", + "171:2": "minecraft:magenta_carpet", + "171:3": "minecraft:light_blue_carpet", + "171:4": "minecraft:yellow_carpet", + "171:5": "minecraft:lime_carpet", + "171:6": "minecraft:pink_carpet", + "171:7": "minecraft:gray_carpet", + "171:8": "minecraft:light_gray_carpet", + "171:9": "minecraft:cyan_carpet", + "171:10": "minecraft:purple_carpet", + "171:11": "minecraft:blue_carpet", + "171:12": "minecraft:brown_carpet", + "171:13": "minecraft:green_carpet", + "171:14": "minecraft:red_carpet", + "171:15": "minecraft:black_carpet", + "172:0": "minecraft:terracotta", + "173:0": "minecraft:coal_block", + "174:0": "minecraft:packed_ice", + "175:0": "minecraft:sunflower", + "175:1": "minecraft:lilac", + "175:2": "minecraft:tall_grass", + "175:3": "minecraft:large_fern", + "175:4": "minecraft:rose_bush", + "175:5": "minecraft:peony", + "179:0": "minecraft:red_sandstone", + "179:1": "minecraft:chiseled_red_sandstone", + "179:2": "minecraft:cut_red_sandstone", + "180:0": "minecraft:red_sandstone_stairs", + "182:0": "minecraft:red_sandstone_slab", + "183:0": "minecraft:spruce_fence_gate", + "184:0": "minecraft:birch_fence_gate", + "185:0": "minecraft:jungle_fence_gate", + "186:0": "minecraft:dark_oak_fence_gate", + "187:0": "minecraft:acacia_fence_gate", + "188:0": "minecraft:spruce_fence", + "189:0": "minecraft:birch_fence", + "190:0": "minecraft:jungle_fence", + "191:0": "minecraft:dark_oak_fence", + "192:0": "minecraft:acacia_fence", + "198:0": "minecraft:end_rod", + "199:0": "minecraft:chorus_plant", + "200:0": "minecraft:chorus_flower", + "201:0": "minecraft:purpur_block", + "202:0": "minecraft:purpur_pillar", + "203:0": "minecraft:purpur_stairs", + "205:0": "minecraft:purpur_slab", + "206:0": "minecraft:end_stone_bricks", + "208:0": "minecraft:grass_path", + "210:0": "minecraft:repeating_command_block", + "211:0": "minecraft:chain_command_block", + "213:0": "minecraft:magma_block", + "214:0": "minecraft:nether_wart_block", + "215:0": "minecraft:red_nether_bricks", + "216:0": "minecraft:bone_block", + "217:0": "minecraft:structure_void", + "218:0": "minecraft:observer", + "219:0": "minecraft:white_shulker_box", + "220:0": "minecraft:orange_shulker_box", + "221:0": "minecraft:magenta_shulker_box", + "222:0": "minecraft:light_blue_shulker_box", + "223:0": "minecraft:yellow_shulker_box", + "224:0": "minecraft:lime_shulker_box", + "225:0": "minecraft:pink_shulker_box", + "226:0": "minecraft:gray_shulker_box", + "227:0": "minecraft:light_gray_shulker_box", + "228:0": "minecraft:cyan_shulker_box", + "229:0": "minecraft:purple_shulker_box", + "230:0": "minecraft:blue_shulker_box", + "231:0": "minecraft:brown_shulker_box", + "232:0": "minecraft:green_shulker_box", + "233:0": "minecraft:red_shulker_box", + "234:0": "minecraft:black_shulker_box", + "235:0": "minecraft:white_glazed_terracotta", + "236:0": "minecraft:orange_glazed_terracotta", + "237:0": "minecraft:magenta_glazed_terracotta", + "238:0": "minecraft:light_blue_glazed_terracotta", + "239:0": "minecraft:yellow_glazed_terracotta", + "240:0": "minecraft:lime_glazed_terracotta", + "241:0": "minecraft:pink_glazed_terracotta", + "242:0": "minecraft:gray_glazed_terracotta", + "243:0": "minecraft:light_gray_glazed_terracotta", + "244:0": "minecraft:cyan_glazed_terracotta", + "245:0": "minecraft:purple_glazed_terracotta", + "246:0": "minecraft:blue_glazed_terracotta", + "247:0": "minecraft:brown_glazed_terracotta", + "248:0": "minecraft:green_glazed_terracotta", + "249:0": "minecraft:red_glazed_terracotta", + "250:0": "minecraft:black_glazed_terracotta", + "251:0": "minecraft:white_concrete", + "251:1": "minecraft:orange_concrete", + "251:2": "minecraft:magenta_concrete", + "251:3": "minecraft:light_blue_concrete", + "251:4": "minecraft:yellow_concrete", + "251:5": "minecraft:lime_concrete", + "251:6": "minecraft:pink_concrete", + "251:7": "minecraft:gray_concrete", + "251:8": "minecraft:light_gray_concrete", + "251:9": "minecraft:cyan_concrete", + "251:10": "minecraft:purple_concrete", + "251:11": "minecraft:blue_concrete", + "251:12": "minecraft:brown_concrete", + "251:13": "minecraft:green_concrete", + "251:14": "minecraft:red_concrete", + "251:15": "minecraft:black_concrete", + "252:0": "minecraft:white_concrete_powder", + "252:1": "minecraft:orange_concrete_powder", + "252:2": "minecraft:magenta_concrete_powder", + "252:3": "minecraft:light_blue_concrete_powder", + "252:4": "minecraft:yellow_concrete_powder", + "252:5": "minecraft:lime_concrete_powder", + "252:6": "minecraft:pink_concrete_powder", + "252:7": "minecraft:gray_concrete_powder", + "252:8": "minecraft:light_gray_concrete_powder", + "252:9": "minecraft:cyan_concrete_powder", + "252:10": "minecraft:purple_concrete_powder", + "252:11": "minecraft:blue_concrete_powder", + "252:12": "minecraft:brown_concrete_powder", + "252:13": "minecraft:green_concrete_powder", + "252:14": "minecraft:red_concrete_powder", + "252:15": "minecraft:black_concrete_powder", + "255:0": "minecraft:structure_block", + "256:0": "minecraft:iron_shovel", + "257:0": "minecraft:iron_pickaxe", + "258:0": "minecraft:iron_axe", + "259:0": "minecraft:flint_and_steel", + "260:0": "minecraft:apple", + "261:0": "minecraft:bow", + "262:0": "minecraft:arrow", + "263:0": "minecraft:coal", + "263:1": "minecraft:charcoal", + "264:0": "minecraft:diamond", + "265:0": "minecraft:iron_ingot", + "266:0": "minecraft:gold_ingot", + "267:0": "minecraft:iron_sword", + "268:0": "minecraft:wooden_sword", + "269:0": "minecraft:wooden_shovel", + "270:0": "minecraft:wooden_pickaxe", + "271:0": "minecraft:wooden_axe", + "272:0": "minecraft:stone_sword", + "273:0": "minecraft:stone_shovel", + "274:0": "minecraft:stone_pickaxe", + "275:0": "minecraft:stone_axe", + "276:0": "minecraft:diamond_sword", + "277:0": "minecraft:diamond_shovel", + "278:0": "minecraft:diamond_pickaxe", + "279:0": "minecraft:diamond_axe", + "280:0": "minecraft:stick", + "281:0": "minecraft:bowl", + "282:0": "minecraft:mushroom_stew", + "283:0": "minecraft:golden_sword", + "284:0": "minecraft:golden_shovel", + "285:0": "minecraft:golden_pickaxe", + "286:0": "minecraft:golden_axe", + "287:0": "minecraft:string", + "288:0": "minecraft:feather", + "289:0": "minecraft:gunpowder", + "290:0": "minecraft:wooden_hoe", + "291:0": "minecraft:stone_hoe", + "292:0": "minecraft:iron_hoe", + "293:0": "minecraft:diamond_hoe", + "294:0": "minecraft:golden_hoe", + "295:0": "minecraft:wheat_seeds", + "296:0": "minecraft:wheat", + "297:0": "minecraft:bread", + "298:0": "minecraft:leather_helmet", + "299:0": "minecraft:leather_chestplate", + "300:0": "minecraft:leather_leggings", + "301:0": "minecraft:leather_boots", + "302:0": "minecraft:chainmail_helmet", + "303:0": "minecraft:chainmail_chestplate", + "304:0": "minecraft:chainmail_leggings", + "305:0": "minecraft:chainmail_boots", + "306:0": "minecraft:iron_helmet", + "307:0": "minecraft:iron_chestplate", + "308:0": "minecraft:iron_leggings", + "309:0": "minecraft:iron_boots", + "310:0": "minecraft:diamond_helmet", + "311:0": "minecraft:diamond_chestplate", + "312:0": "minecraft:diamond_leggings", + "313:0": "minecraft:diamond_boots", + "314:0": "minecraft:golden_helmet", + "315:0": "minecraft:golden_chestplate", + "316:0": "minecraft:golden_leggings", + "317:0": "minecraft:golden_boots", + "318:0": "minecraft:flint", + "319:0": "minecraft:porkchop", + "320:0": "minecraft:cooked_porkchop", + "321:0": "minecraft:painting", + "322:0": "minecraft:golden_apple", + "322:1": "minecraft:enchanted_golden_apple", + "323:0": "minecraft:sign", + "324:0": "minecraft:oak_door", + "325:0": "minecraft:bucket", + "326:0": "minecraft:water_bucket", + "327:0": "minecraft:lava_bucket", + "328:0": "minecraft:minecart", + "329:0": "minecraft:saddle", + "330:0": "minecraft:iron_door", + "331:0": "minecraft:redstone", + "332:0": "minecraft:snowball", + "333:0": "minecraft:oak_boat", + "334:0": "minecraft:leather", + "335:0": "minecraft:milk_bucket", + "336:0": "minecraft:brick", + "337:0": "minecraft:clay_ball", + "338:0": "minecraft:sugar_cane", + "339:0": "minecraft:paper", + "340:0": "minecraft:book", + "341:0": "minecraft:slime_ball", + "342:0": "minecraft:chest_minecart", + "343:0": "minecraft:furnace_minecart", + "344:0": "minecraft:egg", + "345:0": "minecraft:compass", + "346:0": "minecraft:fishing_rod", + "347:0": "minecraft:clock", + "348:0": "minecraft:glowstone_dust", + "349:0": "minecraft:cod", + "349:1": "minecraft:salmon", + "349:2": "minecraft:tropical_fish", + "349:3": "minecraft:pufferfish", + "350:0": "minecraft:cooked_cod", + "350:1": "minecraft:cooked_salmon", + "351:0": "minecraft:ink_sac", + "351:1": "minecraft:rose_red", + "351:2": "minecraft:cactus_green", + "351:3": "minecraft:cocoa_beans", + "351:4": "minecraft:lapis_lazuli", + "351:5": "minecraft:purple_dye", + "351:6": "minecraft:cyan_dye", + "351:7": "minecraft:light_gray_dye", + "351:8": "minecraft:gray_dye", + "351:9": "minecraft:pink_dye", + "351:10": "minecraft:lime_dye", + "351:11": "minecraft:dandelion_yellow", + "351:12": "minecraft:light_blue_dye", + "351:13": "minecraft:magenta_dye", + "351:14": "minecraft:orange_dye", + "351:15": "minecraft:bone_meal", + "352:0": "minecraft:bone", + "353:0": "minecraft:sugar", + "354:0": "minecraft:cake", + "355:0": "minecraft:white_bed", + "355:1": "minecraft:orange_bed", + "355:2": "minecraft:magenta_bed", + "355:3": "minecraft:light_blue_bed", + "355:4": "minecraft:yellow_bed", + "355:5": "minecraft:lime_bed", + "355:6": "minecraft:pink_bed", + "355:7": "minecraft:gray_bed", + "355:8": "minecraft:light_gray_bed", + "355:9": "minecraft:cyan_bed", + "355:10": "minecraft:purple_bed", + "355:11": "minecraft:blue_bed", + "355:12": "minecraft:brown_bed", + "355:13": "minecraft:green_bed", + "355:14": "minecraft:red_bed", + "355:15": "minecraft:black_bed", + "356:0": "minecraft:repeater", + "357:0": "minecraft:cookie", + "358:0": "minecraft:filled_map", + "359:0": "minecraft:shears", + "360:0": "minecraft:melon_slice", + "361:0": "minecraft:pumpkin_seeds", + "362:0": "minecraft:melon_seeds", + "363:0": "minecraft:beef", + "364:0": "minecraft:cooked_beef", + "365:0": "minecraft:chicken", + "366:0": "minecraft:cooked_chicken", + "367:0": "minecraft:rotten_flesh", + "368:0": "minecraft:ender_pearl", + "369:0": "minecraft:blaze_rod", + "370:0": "minecraft:ghast_tear", + "371:0": "minecraft:gold_nugget", + "372:0": "minecraft:nether_wart", + "373:0": "minecraft:potion", + "374:0": "minecraft:glass_bottle", + "375:0": "minecraft:spider_eye", + "376:0": "minecraft:fermented_spider_eye", + "377:0": "minecraft:blaze_powder", + "378:0": "minecraft:magma_cream", + "379:0": "minecraft:brewing_stand", + "380:0": "minecraft:cauldron", + "381:0": "minecraft:ender_eye", + "382:0": "minecraft:glistering_melon_slice", + "383:0": "minecraft:pig_spawn_egg", + "384:0": "minecraft:experience_bottle", + "385:0": "minecraft:fire_charge", + "386:0": "minecraft:writable_book", + "387:0": "minecraft:written_book", + "388:0": "minecraft:emerald", + "389:0": "minecraft:item_frame", + "390:0": "minecraft:flower_pot", + "391:0": "minecraft:carrot", + "392:0": "minecraft:potato", + "393:0": "minecraft:baked_potato", + "394:0": "minecraft:poisonous_potato", + "395:0": "minecraft:map", + "396:0": "minecraft:golden_carrot", + "397:0": "minecraft:skeleton_skull", + "397:1": "minecraft:wither_skeleton_skull", + "397:2": "minecraft:zombie_head", + "397:3": "minecraft:player_head", + "397:4": "minecraft:creeper_head", + "397:5": "minecraft:dragon_head", + "398:0": "minecraft:carrot_on_a_stick", + "399:0": "minecraft:nether_star", + "400:0": "minecraft:pumpkin_pie", + "401:0": "minecraft:firework_rocket", + "402:0": "minecraft:firework_star", + "403:0": "minecraft:enchanted_book", + "404:0": "minecraft:comparator", + "405:0": "minecraft:nether_brick", + "406:0": "minecraft:quartz", + "407:0": "minecraft:tnt_minecart", + "408:0": "minecraft:hopper_minecart", + "409:0": "minecraft:prismarine_shard", + "410:0": "minecraft:prismarine_crystals", + "411:0": "minecraft:rabbit", + "412:0": "minecraft:cooked_rabbit", + "413:0": "minecraft:rabbit_stew", + "414:0": "minecraft:rabbit_foot", + "415:0": "minecraft:rabbit_hide", + "416:0": "minecraft:armor_stand", + "417:0": "minecraft:iron_horse_armor", + "418:0": "minecraft:golden_horse_armor", + "419:0": "minecraft:diamond_horse_armor", + "420:0": "minecraft:lead", + "421:0": "minecraft:name_tag", + "422:0": "minecraft:command_block_minecart", + "423:0": "minecraft:mutton", + "424:0": "minecraft:cooked_mutton", + "425:0": "minecraft:black_banner", + "425:1": "minecraft:red_banner", + "425:2": "minecraft:green_banner", + "425:3": "minecraft:brown_banner", + "425:4": "minecraft:blue_banner", + "425:5": "minecraft:purple_banner", + "425:6": "minecraft:cyan_banner", + "425:7": "minecraft:light_gray_banner", + "425:8": "minecraft:gray_banner", + "425:9": "minecraft:pink_banner", + "425:10": "minecraft:lime_banner", + "425:11": "minecraft:yellow_banner", + "425:12": "minecraft:light_blue_banner", + "425:13": "minecraft:magenta_banner", + "425:14": "minecraft:orange_banner", + "425:15": "minecraft:white_banner", + "426:0": "minecraft:end_crystal", + "427:0": "minecraft:spruce_door", + "428:0": "minecraft:birch_door", + "429:0": "minecraft:jungle_door", + "430:0": "minecraft:acacia_door", + "431:0": "minecraft:dark_oak_door", + "432:0": "minecraft:chorus_fruit", + "433:0": "minecraft:popped_chorus_fruit", + "434:0": "minecraft:beetroot", + "435:0": "minecraft:beetroot_seeds", + "436:0": "minecraft:beetroot_soup", + "437:0": "minecraft:dragon_breath", + "438:0": "minecraft:splash_potion", + "439:0": "minecraft:spectral_arrow", + "440:0": "minecraft:tipped_arrow", + "441:0": "minecraft:lingering_potion", + "442:0": "minecraft:shield", + "443:0": "minecraft:elytra", + "444:0": "minecraft:spruce_boat", + "445:0": "minecraft:birch_boat", + "446:0": "minecraft:jungle_boat", + "447:0": "minecraft:acacia_boat", + "448:0": "minecraft:dark_oak_boat", + "449:0": "minecraft:totem_of_undying", + "450:0": "minecraft:shulker_shell", + "452:0": "minecraft:iron_nugget", + "453:0": "minecraft:knowledge_book", + "2256:0": "minecraft:music_disc_13", + "2257:0": "minecraft:music_disc_cat", + "2258:0": "minecraft:music_disc_blocks", + "2259:0": "minecraft:music_disc_chirp", + "2260:0": "minecraft:music_disc_far", + "2261:0": "minecraft:music_disc_mall", + "2262:0": "minecraft:music_disc_mellohi", + "2263:0": "minecraft:music_disc_stal", + "2264:0": "minecraft:music_disc_strad", + "2265:0": "minecraft:music_disc_ward", + "2266:0": "minecraft:music_disc_11", + "2267:0": "minecraft:music_disc_wait" + } +} \ No newline at end of file diff --git a/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java b/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java index bcdf19dd2..5cc3c1086 100644 --- a/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java +++ b/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java @@ -19,6 +19,12 @@ package com.sk89q.minecraft.util.commands; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import org.junit.Before; import org.junit.Test; @@ -27,8 +33,6 @@ import java.util.HashSet; import java.util.logging.Level; import java.util.logging.Logger; -import static org.junit.Assert.*; - public class CommandContextTest { private static final Logger log = Logger.getLogger(CommandContextTest.class.getCanonicalName()); @@ -38,7 +42,7 @@ public class CommandContextTest { @Before public void setUpTest() { try { - firstCommand = new CommandContext(firstCmdString, new HashSet(Arrays.asList('o', 'w'))); + firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w'))); } catch (CommandException e) { log.log(Level.WARNING, "Error", e); fail("Unexpected exception when creating CommandContext"); @@ -48,7 +52,7 @@ public class CommandContextTest { @Test(expected = CommandException.class) public void testInvalidFlags() throws CommandException { final String failingCommand = "herpderp -opw testers"; - new CommandContext(failingCommand, new HashSet(Arrays.asList('o', 'w'))); + new CommandContext(failingCommand, new HashSet<>(Arrays.asList('o', 'w'))); } @Test diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/CuboidClipboardTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/CuboidClipboardTest.java deleted file mode 100644 index 6a6997df1..000000000 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/CuboidClipboardTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit; - -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; -import org.junit.Test; - -import static org.junit.Assert.*; - -public class CuboidClipboardTest { - @Test - public void testFlipCenterPlane() throws Exception { - testFlip(0, 1, CuboidClipboard.FlipDirection.UP_DOWN); - testFlip(2, 3, CuboidClipboard.FlipDirection.NORTH_SOUTH); - testFlip(4, 5, CuboidClipboard.FlipDirection.WEST_EAST); - } - - private void testFlip(int data, int expectedDataAfterFlip, CuboidClipboard.FlipDirection flipDirection) { - final CuboidClipboard clipboard = new CuboidClipboard(new Vector(1, 1, 1)); - clipboard.setBlock(Vector.ZERO, new BaseBlock(BlockID.PISTON_BASE, data)); - clipboard.flip(flipDirection); - assertEquals(expectedDataAfterFlip, clipboard.getBlock(Vector.ZERO).getData()); - } -} diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/VectorTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/VectorTest.java index fea68dbf0..51d50f93b 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/VectorTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/VectorTest.java @@ -19,8 +19,10 @@ package com.sk89q.worldedit; -import org.junit.*; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; public class VectorTest { @Test diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/blocks/BlockDataTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/blocks/BlockDataTest.java deleted file mode 100644 index 044b6a88b..000000000 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/blocks/BlockDataTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.worldedit.CuboidClipboard.FlipDirection; -import org.junit.Test; - -import java.util.TreeSet; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class BlockDataTest { - - @Test - public void testRotateFlip() { - for (int type = 0; type < 256; ++type) { - for (int data = 0; data < 16; ++data) { - final String message = type + "/" + data; - - //Test r90(r-90(x))==x - assertEquals(message, data, BlockData.rotate90(type, BlockData.rotate90Reverse(type, data))); - //Test r-90(r90(x))==x - assertEquals(message, data, BlockData.rotate90Reverse(type, BlockData.rotate90(type, data))); - - final int flipped = BlockData.flip(type, BlockData.flip(type, data, FlipDirection.WEST_EAST), FlipDirection.NORTH_SOUTH); - - //Test r90(r90(x))==flipNS(flipWE(x)) - assertEquals(message, flipped, BlockData.rotate90(type, BlockData.rotate90(type, data))); - //Test r-90(r-90(x))==flipNS(flipWE(x)) - assertEquals(message, flipped, BlockData.rotate90Reverse(type, BlockData.rotate90Reverse(type, data))); - - //Test flipNS(flipNS(x))==x - assertEquals(message, data, BlockData.flip(type, BlockData.flip(type, data, FlipDirection.NORTH_SOUTH), FlipDirection.NORTH_SOUTH)); - //Test flipWE(flipWE(x))==x - assertEquals(message, data, BlockData.flip(type, BlockData.flip(type, data, FlipDirection.WEST_EAST), FlipDirection.WEST_EAST)); - //Test flipUD(flipUD(x))==x - assertEquals(message, data, BlockData.flip(type, BlockData.flip(type, data, FlipDirection.UP_DOWN), FlipDirection.UP_DOWN)); - - //Test r90(r90(r90(r90(x))))==x - assertEquals(message, data, BlockData.rotate90(type, BlockData.rotate90(type, BlockData.rotate90(type, BlockData.rotate90(type, data))))); - //Test r-90(r-90(r-90(r-90(x))))==x - assertEquals(message, data, BlockData.rotate90Reverse(type, BlockData.rotate90Reverse(type, BlockData.rotate90Reverse(type, BlockData.rotate90Reverse(type, data))))); - } - } - } - - private static final TreeSet datasTemplate = new TreeSet(); - static { - for (int data = 0; data < 16; ++data) { - datasTemplate.add(data); - } - } - - @Test - public void testCycle() { - // Test monotony and continuity - for (int type = 0; type < 256; ++type) { - // Cloth isn't monotonous, and thus excluded. - if (type == BlockID.CLOTH - || type == BlockID.STAINED_CLAY - || type == BlockID.STAINED_GLASS - || type == BlockID.STAINED_GLASS_PANE - || type == BlockID.CARPET) { - continue; - } - - for (int data = 0; data < 16; ++data) { - final String message = type + "/" + data; - - final int cycled = BlockData.cycle(type, data, 1); - - // If the cycle goes back (including -1), everything is ok. - if (cycled <= data) { - continue; - } - - // If there's a gap in the cycle, there's a problem. - assertEquals(message, data + 1, cycled); - } - } - - // Test cyclicity forwards - testCycle(1); - - // ...and backwards - testCycle(-1); - } - - private static void testCycle(final int increment) { - // Iterate each block type and data value that wasn't part of a cycle yet. - for (int type = 0; type < 256; ++type) { - @SuppressWarnings("unchecked") - final TreeSet datas = (TreeSet) datasTemplate.clone(); - while (!datas.isEmpty()) { - final int start = datas.pollFirst(); - String message = type + "/" + start; - int current = start; - boolean first = true; - while (true) { - current = BlockData.cycle(type, current, increment); - - // If the cycle immediately goes to -1, everything is ok. - if (first && current == -1) break; - - first = false; - message += "->" + current; - - // If the cycle goes off limits (including -1), there's a problem. - assertTrue(message, current >= 0); - assertTrue(message, current < 16); - - // The cycle completes, everything is ok. - if (current == start) break; - - // Mark the current element as walked. - assertTrue(message, datas.remove(current)); - } - } - } - } - -} diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java deleted file mode 100644 index f5c40a78f..000000000 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.extent.transform; - -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockData; -import com.sk89q.worldedit.blocks.BlockType; -import com.sk89q.worldedit.math.transform.AffineTransform; -import com.sk89q.worldedit.math.transform.Transform; -import com.sk89q.worldedit.world.registry.BlockRegistry; -import com.sk89q.worldedit.world.registry.LegacyBlockRegistry; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.HashSet; -import java.util.Set; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.junit.Assert.assertThat; - -@Ignore("Old BlockData class needs to be updated manually. Current block definitions are in blocks.json, " + - "which is automatically generated and generally accurate.") -public class BlockTransformExtentTest { - - private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90); - private static final Transform ROTATE_NEG_90 = new AffineTransform().rotateY(90); - private final Set ignored = new HashSet(); - - @Before - public void setUp() throws Exception { - ignored.add(BlockType.BED); // Broken in existing rotation code? - ignored.add(BlockType.WOODEN_DOOR); // Complicated - ignored.add(BlockType.IRON_DOOR); // Complicated - ignored.add(BlockType.END_PORTAL); // Not supported in existing rotation code - } - - @Test - public void testTransform() throws Exception { - BlockRegistry blockRegistry = new LegacyBlockRegistry(); - for (BlockType type : BlockType.values()) { - if (ignored.contains(type)) { - continue; - } - - BaseBlock orig = new BaseBlock(type.getID()); - for (int i = 1; i < 4; i++) { - BaseBlock rotated = BlockTransformExtent.transform(new BaseBlock(orig), ROTATE_90, blockRegistry); - BaseBlock reference = new BaseBlock(orig.getType(), BlockData.rotate90(orig.getType(), orig.getData())); - assertThat(type + "#" + type.getID() + " rotated " + (90 * i) + " degrees did not match BlockData.rotate90()'s expected result", rotated, equalTo(reference)); - orig = rotated; - } - - orig = new BaseBlock(type.getID()); - for (int i = 0; i < 4; i++) { - BaseBlock rotated = BlockTransformExtent.transform(new BaseBlock(orig), ROTATE_NEG_90, blockRegistry); - BaseBlock reference = new BaseBlock(orig.getType(), BlockData.rotate90Reverse(orig.getType(), orig.getData())); - assertThat(type + "#" + type.getID() + " rotated " + (-90 * i) + " degrees did not match BlockData.rotate90Reverse()'s expected result", rotated, equalTo(reference)); - orig = rotated; - } - } - } -} \ No newline at end of file diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java index d60ed68f9..1d0456d01 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java @@ -19,17 +19,17 @@ package com.sk89q.worldedit.internal.expression; +import static java.lang.Math.atan2; +import static java.lang.Math.sin; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import com.sk89q.worldedit.internal.expression.lexer.LexerException; import com.sk89q.worldedit.internal.expression.parser.ParserException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment; import org.junit.Test; -import static java.lang.Math.atan2; -import static java.lang.Math.sin; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - public class ExpressionTest { @Test public void testEvaluate() throws ExpressionException { diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/util/LocationTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/util/LocationTest.java index 1acdbc892..b7944d476 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/util/LocationTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/util/LocationTest.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.util; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.world.World; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; - /** * Tests {@link Location}. */ diff --git a/worldedit-forge/build.gradle b/worldedit-forge/build.gradle index c4b2dc971..f5c6e0f7d 100644 --- a/worldedit-forge/build.gradle +++ b/worldedit-forge/build.gradle @@ -7,18 +7,22 @@ buildscript { } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' + dependencies { compile project(':worldedit-core') - compile 'org.spongepowered:spongeapi:3.1.0-SNAPSHOT' + compile 'org.spongepowered:spongeapi:6.0.0-SNAPSHOT' testCompile group: 'org.mockito', name: 'mockito-core', version: '1.9.0-rc1' } +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + repositories { maven { name = "Sponge" @@ -26,11 +30,11 @@ repositories { } } -ext.forgeVersion = "13.19.1.2189" +ext.forgeVersion = "14.22.0.2456" minecraft { - version = "1.11-${project.forgeVersion}" - mappings = "snapshot_20161209" + version = "1.12.1-${project.forgeVersion}" + mappings = "snapshot_20170815" runDir = 'run' replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java" diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java index 38cd3c8ca..1ad0f10ca 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommandWrapper.java @@ -20,16 +20,17 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.util.command.CommandMapping; - -import java.util.Arrays; -import java.util.List; -import javax.annotation.Nullable; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.server.MinecraftServer; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Nullable; + public class CommandWrapper extends CommandBase { private CommandMapping command; diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java index fbb07b9d2..18a7de68f 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/CommonProxy.java @@ -19,9 +19,8 @@ package com.sk89q.worldedit.forge; -import net.minecraftforge.fml.common.network.NetworkRegistry; - import com.sk89q.worldedit.forge.gui.GuiHandler; +import net.minecraftforge.fml.common.network.NetworkRegistry; public class CommonProxy { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java index 42f40890f..59df06287 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java @@ -36,7 +36,7 @@ final class ForgeAdapter { } public static Vector adapt(Vec3d vector) { - return new Vector(vector.xCoord, vector.yCoord, vector.zCoord); + return new Vector(vector.x, vector.y, vector.z); } public static Vector adapt(BlockPos pos) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java index e637138f9..06a11ea76 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeBiomeRegistry.java @@ -22,10 +22,10 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.registry.BiomeRegistry; +import net.minecraft.world.biome.Biome; import java.util.ArrayList; import java.util.List; -import net.minecraft.world.biome.Biome; /** * Provides access to biome data in Forge. @@ -39,7 +39,7 @@ class ForgeBiomeRegistry implements BiomeRegistry { @Override public List getBiomes() { - List list = new ArrayList(); + List list = new ArrayList<>(); for (Biome biome : Biome.REGISTRY) { list.add(new BaseBiome(Biome.getIdForBiome(biome))); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java index efc32d43e..54e28c244 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java @@ -19,20 +19,22 @@ package com.sk89q.worldedit.forge; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; -import com.sk89q.worldedit.entity.metadata.EntityType; +import com.sk89q.worldedit.entity.metadata.EntityProperties; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.NullWorld; +import com.sk89q.worldedit.world.entity.EntityTypes; import net.minecraft.entity.EntityList; import net.minecraft.nbt.NBTTagCompound; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; class ForgeEntity implements Entity { @@ -40,7 +42,7 @@ class ForgeEntity implements Entity { ForgeEntity(net.minecraft.entity.Entity entity) { checkNotNull(entity); - this.entityRef = new WeakReference(entity); + this.entityRef = new WeakReference<>(entity); } @Override @@ -51,7 +53,7 @@ class ForgeEntity implements Entity { if (id != null) { NBTTagCompound tag = new NBTTagCompound(); entity.writeToNBT(tag); - return new BaseEntity(id, NBTConverter.fromNative(tag)); + return new BaseEntity(EntityTypes.get(id), NBTConverter.fromNative(tag)); } else { return null; } @@ -99,8 +101,8 @@ class ForgeEntity implements Entity { public T getFacet(Class cls) { net.minecraft.entity.Entity entity = entityRef.get(); if (entity != null) { - if (EntityType.class.isAssignableFrom(cls)) { - return (T) new ForgeEntityType(entity); + if (EntityProperties.class.isAssignableFrom(cls)) { + return (T) new ForgeEntityProperties(entity); } else { return null; } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityType.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityProperties.java similarity index 90% rename from worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityType.java rename to worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityProperties.java index a7a4b3cbd..bf6a16ae2 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityType.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntityProperties.java @@ -19,12 +19,15 @@ package com.sk89q.worldedit.forge; -import com.sk89q.worldedit.entity.metadata.EntityType; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.entity.metadata.EntityProperties; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.IMerchant; import net.minecraft.entity.INpc; import net.minecraft.entity.IProjectile; +import net.minecraft.entity.MultiPartEntityPart; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.item.EntityBoat; import net.minecraft.entity.item.EntityEnderEye; @@ -40,14 +43,13 @@ import net.minecraft.entity.passive.EntityAmbientCreature; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; -import static com.google.common.base.Preconditions.checkNotNull; - -public class ForgeEntityType implements EntityType { +public class ForgeEntityProperties implements EntityProperties { private final Entity entity; - public ForgeEntityType(Entity entity) { + public ForgeEntityProperties(Entity entity) { checkNotNull(entity); this.entity = entity; } @@ -141,4 +143,9 @@ public class ForgeEntityType implements EntityType { public boolean isArmorStand() { return entity instanceof EntityArmorStand; } + + @Override + public boolean isPasteable() { + return !(entity instanceof EntityPlayerMP || entity instanceof MultiPartEntityPart); + } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java index 83222c029..216657581 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeItemRegistry.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.blocks.BaseItem; +import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.registry.ItemRegistry; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; @@ -31,17 +32,7 @@ public class ForgeItemRegistry implements ItemRegistry { public BaseItem createFromId(String id) { Item match = Item.REGISTRY.getObject(new ResourceLocation(id)); if (match != null) { - return new BaseItem(Item.REGISTRY.getIDForObject(match), (short) 0); - } else { - return null; - } - } - - @Nullable - @Override - public BaseItem createFromId(int id) { - if (Item.REGISTRY.getObjectById(id) != null) { - return new BaseItem(id, (short) 0); + return new BaseItem(ItemTypes.get(id)); } else { return null; } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java index 1b80998dd..bc6820c0d 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePermissionsProvider.java @@ -19,20 +19,19 @@ package com.sk89q.worldedit.forge; -import org.spongepowered.api.entity.living.player.Player; - import net.minecraft.command.ICommand; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.GameType; import net.minecraftforge.fml.common.FMLCommonHandler; +import org.spongepowered.api.entity.living.player.Player; public interface ForgePermissionsProvider { - public boolean hasPermission(EntityPlayerMP player, String permission); + boolean hasPermission(EntityPlayerMP player, String permission); - public void registerPermission(ICommand command, String permission); + void registerPermission(ICommand command, String permission); - public static class VanillaPermissionsProvider implements ForgePermissionsProvider { + class VanillaPermissionsProvider implements ForgePermissionsProvider { private ForgePlatform platform; @@ -52,7 +51,7 @@ public interface ForgePermissionsProvider { public void registerPermission(ICommand command, String permission) {} } - public static class SpongePermissionsProvider implements ForgePermissionsProvider { + class SpongePermissionsProvider implements ForgePermissionsProvider { @Override public boolean hasPermission(EntityPlayerMP player, String permission) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java index 2ddf75c51..2eb66bf14 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java @@ -28,12 +28,10 @@ import com.sk89q.worldedit.extension.platform.Preference; import com.sk89q.worldedit.util.command.CommandMapping; import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.world.World; - -import net.minecraft.block.Block; +import com.sk89q.worldedit.world.registry.Registries; import net.minecraft.command.ServerCommandManager; import net.minecraft.entity.EntityList; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; import net.minecraft.server.MinecraftServer; import net.minecraft.server.management.PlayerList; import net.minecraft.util.ResourceLocation; @@ -41,14 +39,14 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.common.FMLCommonHandler; -import javax.annotation.Nullable; - import java.util.ArrayList; import java.util.Collection; import java.util.EnumMap; import java.util.List; import java.util.Map; +import javax.annotation.Nullable; + class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { private final ForgeWorldEdit mod; @@ -65,30 +63,8 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { } @Override - public int resolveItem(String name) { - if (name == null) return 0; - - int index = name.indexOf(':'); - - if (index != 0 && index != name.length() - 1) { - Block block = Block.getBlockFromName(name); - if (block != null) { - return Block.getIdFromBlock(block); - } - } - - for (Item item : Item.REGISTRY) { - if (item == null) continue; - if (item.getUnlocalizedName() == null) continue; - if (item.getUnlocalizedName().startsWith("item.")) { - if (item.getUnlocalizedName().equalsIgnoreCase("item." + name)) return Item.getIdFromItem(item); - } - if (item.getUnlocalizedName().startsWith("tile.")) { - if (item.getUnlocalizedName().equalsIgnoreCase("tile." + name)) return Item.getIdFromItem(item); - } - if (item.getUnlocalizedName().equalsIgnoreCase(name)) return Item.getIdFromItem(item); - } - return -1; + public Registries getRegistries() { + return ForgeRegistries.getInstance(); } @Override @@ -109,7 +85,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { @Override public List getWorlds() { WorldServer[] worlds = DimensionManager.getWorlds(); - List ret = new ArrayList(worlds.length); + List ret = new ArrayList<>(worlds.length); for (WorldServer world : worlds) { ret.add(new ForgeWorld(world)); } @@ -188,7 +164,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { @Override public Map getCapabilities() { - Map capabilities = new EnumMap(Capability.class); + Map capabilities = new EnumMap<>(Capability.class); capabilities.put(Capability.CONFIGURATION, Preference.PREFER_OTHERS); capabilities.put(Capability.WORLDEDIT_CUI, Preference.NORMAL); capabilities.put(Capability.GAME_HOOKS, Preference.NORMAL); @@ -200,7 +176,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { @Override public Collection getConnectedUsers() { - List users = new ArrayList(); + List users = new ArrayList<>(); PlayerList scm = server.getPlayerList(); for (EntityPlayerMP entity : scm.getPlayers()) { if (entity != null) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java index c0b1ed7ed..d4b906fc4 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java @@ -21,18 +21,16 @@ package com.sk89q.worldedit.forge; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.WorldVector; +import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; import com.sk89q.worldedit.extent.inventory.BlockBag; -import com.sk89q.worldedit.internal.LocalWorldAdapter; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.session.SessionKey; +import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; - +import com.sk89q.worldedit.world.item.ItemTypes; import io.netty.buffer.Unpooled; -import java.util.UUID; -import javax.annotation.Nullable; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -41,6 +39,11 @@ import net.minecraft.network.play.server.SPacketCustomPayload; import net.minecraft.util.EnumHand; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.fml.common.registry.ForgeRegistries; + +import java.util.UUID; + +import javax.annotation.Nullable; public class ForgePlayer extends AbstractPlayerActor { @@ -57,9 +60,9 @@ public class ForgePlayer extends AbstractPlayerActor { } @Override - public int getItemInHand() { - ItemStack is = this.player.getHeldItem(EnumHand.MAIN_HAND); - return is == null ? 0 : Item.getIdFromItem(is.getItem()); + public BaseItemStack getItemInHand(HandSide handSide) { + ItemStack is = this.player.getHeldItem(handSide == HandSide.MAIN_HAND ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND); + return new BaseItemStack(ItemTypes.get(ForgeRegistries.ITEMS.getKey(is.getItem()).toString())); } @Override @@ -82,30 +85,15 @@ public class ForgePlayer extends AbstractPlayerActor { this.player.rotationPitch); } - @SuppressWarnings("deprecation") - @Override - public WorldVector getPosition() { - return new WorldVector(LocalWorldAdapter.adapt(ForgeWorldEdit.inst.getWorld(this.player.world)), this.player.posX, this.player.posY, this.player.posZ); - } - @Override public com.sk89q.worldedit.world.World getWorld() { return ForgeWorldEdit.inst.getWorld(this.player.world); } @Override - public double getPitch() { - return this.player.rotationPitch; - } - - @Override - public double getYaw() { - return this.player.rotationYaw; - } - - @Override - public void giveItem(int type, int amt) { - this.player.inventory.addItemStackToInventory(new ItemStack(Item.getItemById(type), amt, 0)); + public void giveItem(BaseItemStack itemStack) { + this.player.inventory.addItemStackToInventory( + new ItemStack(Item.getByNameOrId(itemStack.getType().getId()), itemStack.getAmount(), 0)); } @Override diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldData.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeRegistries.java similarity index 86% rename from worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldData.java rename to worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeRegistries.java index de23b9a85..7b8737fd8 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldData.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeRegistries.java @@ -20,15 +20,15 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.world.registry.BiomeRegistry; +import com.sk89q.worldedit.world.registry.BundledRegistries; import com.sk89q.worldedit.world.registry.ItemRegistry; -import com.sk89q.worldedit.world.registry.LegacyWorldData; /** * World data for the Forge platform. */ -class ForgeWorldData extends LegacyWorldData { +class ForgeRegistries extends BundledRegistries { - private static final ForgeWorldData INSTANCE = new ForgeWorldData(); + private static final ForgeRegistries INSTANCE = new ForgeRegistries(); private final BiomeRegistry biomeRegistry = new ForgeBiomeRegistry(); private final ItemRegistry itemRegistry = new ForgeItemRegistry(); @@ -47,7 +47,7 @@ class ForgeWorldData extends LegacyWorldData { * * @return an instance */ - public static ForgeWorldData getInstance() { + public static ForgeRegistries getInstance() { return INSTANCE; } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index 562afb126..c35684059 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.forge; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.io.Files; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.BlockVector; @@ -27,10 +29,9 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.blocks.LazyBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.internal.Constants; @@ -41,8 +42,11 @@ import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.biome.BaseBiome; -import com.sk89q.worldedit.world.registry.WorldData; - +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.item.ItemTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; +import com.sk89q.worldedit.world.weather.WeatherType; import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockOldLeaf; @@ -84,15 +88,13 @@ import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.common.DimensionManager; -import javax.annotation.Nullable; - import java.io.File; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; import java.util.Random; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * An adapter to Minecraft worlds for WorldEdit. @@ -115,7 +117,7 @@ public class ForgeWorld extends AbstractWorld { */ ForgeWorld(World world) { checkNotNull(world); - this.worldRef = new WeakReference(world); + this.worldRef = new WeakReference<>(world); } /** @@ -154,7 +156,7 @@ public class ForgeWorld extends AbstractWorld { } @Override - public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException { + public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { checkNotNull(position); checkNotNull(block); @@ -167,18 +169,17 @@ public class ForgeWorld extends AbstractWorld { Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4); BlockPos pos = new BlockPos(x, y, z); IBlockState old = chunk.getBlockState(pos); - @SuppressWarnings("deprecation") - IBlockState newState = Block.getBlockById(block.getId()).getStateFromMeta(block.getData()); + IBlockState newState = Block.getBlockById(block.getBlockType().getLegacyId()).getDefaultState(); // TODO .getStateFromMeta(block.getData()); IBlockState successState = chunk.setBlockState(pos, newState); boolean successful = successState != null; // Create the TileEntity if (successful) { - if (block.hasNbtData()) { + if (block instanceof BaseBlock && ((BaseBlock) block).hasNbtData()) { // Kill the old TileEntity world.removeTileEntity(pos); - NBTTagCompound nativeTag = NBTConverter.toNative(block.getNbtData()); - nativeTag.setString("id", block.getNbtId()); + NBTTagCompound nativeTag = NBTConverter.toNative(((BaseBlock) block).getNbtData()); + nativeTag.setString("id", ((BaseBlock) block).getNbtId()); TileEntityUtils.setTileEntity(world, position, nativeTag); } } @@ -227,7 +228,7 @@ public class ForgeWorld extends AbstractWorld { checkNotNull(biome); Chunk chunk = getWorld().getChunkFromBlockCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ())); - if ((chunk != null) && (chunk.isLoaded())) { + if (chunk.isLoaded()) { chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId(); return true; } @@ -237,8 +238,13 @@ public class ForgeWorld extends AbstractWorld { @Override public boolean useItem(Vector position, BaseItem item, Direction face) { - Item nativeItem = Item.getItemById(item.getType()); - ItemStack stack = new ItemStack(nativeItem, 1, item.getData()); + Item nativeItem = Item.getByNameOrId(item.getType().getId()); + ItemStack stack = null; + if (item.getNbtData() == null) { + stack = new ItemStack(nativeItem, 1, 0); + } else { + stack = new ItemStack(nativeItem, 1, 0, NBTConverter.toNative(item.getNbtData())); + } World world = getWorld(); EnumActionResult used = stack.onItemUse(new WorldEditFakePlayer((WorldServer) world), world, ForgeAdapter.toBlockPos(position), EnumHand.MAIN_HAND, ForgeAdapter.adapt(face), 0, 0, 0); @@ -250,7 +256,7 @@ public class ForgeWorld extends AbstractWorld { checkNotNull(position); checkNotNull(item); - if (item.getType() == 0) { + if (item.getType() == ItemTypes.AIR) { return; } @@ -259,6 +265,14 @@ public class ForgeWorld extends AbstractWorld { getWorld().spawnEntity(entity); } + @Override + public void simulateBlockMine(Vector position) { + BlockPos pos = ForgeAdapter.toBlockPos(position); + IBlockState state = getWorld().getBlockState(pos); + state.getBlock().dropBlockAsItem(getWorld(), pos, state, 0); + getWorld().setBlockToAir(pos); + } + @Override public boolean regenerate(Region region, EditSession editSession) { // Don't even try to regen if it's going to fail. @@ -278,7 +292,7 @@ public class ForgeWorld extends AbstractWorld { AnvilSaveHandler saveHandler = new AnvilSaveHandler(saveFolder, originalWorld.getSaveHandler().getWorldDirectory().getName(), true, server.getDataFixer()); World freshWorld = new WorldServer(server, saveHandler, originalWorld.getWorldInfo(), - originalWorld.provider.getDimension(), originalWorld.theProfiler).init(); + originalWorld.provider.getDimension(), originalWorld.profiler).init(); // Pre-gen all the chunks // We need to also pull one more chunk in every direction @@ -290,7 +304,7 @@ public class ForgeWorld extends AbstractWorld { ForgeWorld from = new ForgeWorld(freshWorld); try { for (BlockVector vec : region) { - editSession.setBlock(vec, from.getBlock(vec)); + editSession.setBlock(vec, from.getFullBlock(vec)); } } catch (MaxChangedBlocksException e) { throw new RuntimeException(e); @@ -333,42 +347,51 @@ public class ForgeWorld extends AbstractWorld { @Override public boolean generateTree(TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException { WorldGenerator generator = createWorldGenerator(type); - return generator != null ? generator.generate(getWorld(), random, ForgeAdapter.toBlockPos(position)) : false; + return generator != null && generator.generate(getWorld(), random, ForgeAdapter.toBlockPos(position)); } @Override - public WorldData getWorldData() { - return ForgeWorldData.getInstance(); + public WeatherType getWeather() { + // TODO Weather implementation + return null; } @Override - public boolean isValidBlockType(int id) { - Block block = Block.getBlockById(id); - return Block.getIdFromBlock(block) == id; + public long getRemainingWeatherDuration() { + return 0; } @Override - public BaseBlock getBlock(Vector position) { + public void setWeather(WeatherType weatherType) { + + } + + @Override + public void setWeather(WeatherType weatherType, long duration) { + + } + + @Override + public BlockState getBlock(Vector position) { World world = getWorld(); BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); IBlockState state = world.getBlockState(pos); + + return LegacyMapper.getInstance().getBlockFromLegacy(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state)); + } + + @Override + public BaseBlock getFullBlock(Vector position) { + BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); TileEntity tile = getWorld().getTileEntity(pos); if (tile != null) { - return new TileEntityBaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), tile); + return new TileEntityBaseBlock(getBlock(position), tile); } else { - return new BaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state)); + return getBlock(position).toBaseBlock(); } } - @Override - public BaseBlock getLazyBlock(Vector position) { - World world = getWorld(); - BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - IBlockState state = world.getBlockState(pos); - return new LazyBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), this, position); - } - @Override public int hashCode() { return getWorld().hashCode(); @@ -382,7 +405,7 @@ public class ForgeWorld extends AbstractWorld { ForgeWorld other = ((ForgeWorld) o); World otherWorld = other.worldRef.get(); World thisWorld = worldRef.get(); - return otherWorld != null && thisWorld != null && otherWorld.equals(thisWorld); + return otherWorld != null && otherWorld.equals(thisWorld); } else if (o instanceof com.sk89q.worldedit.world.World) { return ((com.sk89q.worldedit.world.World) o).getName().equals(getName()); } else { @@ -392,7 +415,7 @@ public class ForgeWorld extends AbstractWorld { @Override public List getEntities(Region region) { - List entities = new ArrayList(); + List entities = new ArrayList<>(); for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) { if (region.contains(new Vector(entity.posX, entity.posY, entity.posZ))) { entities.add(new ForgeEntity(entity)); @@ -403,7 +426,7 @@ public class ForgeWorld extends AbstractWorld { @Override public List getEntities() { - List entities = new ArrayList(); + List entities = new ArrayList<>(); for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) { entities.add(new ForgeEntity(entity)); } @@ -414,7 +437,7 @@ public class ForgeWorld extends AbstractWorld { @Override public Entity createEntity(Location location, BaseEntity entity) { World world = getWorld(); - net.minecraft.entity.Entity createdEntity = EntityList.createEntityByIDFromName(new ResourceLocation(entity.getTypeId()), world); + net.minecraft.entity.Entity createdEntity = EntityList.createEntityByIDFromName(new ResourceLocation(entity.getType().getId()), world); if (createdEntity != null) { CompoundTag nativeTag = entity.getNbtData(); if (nativeTag != null) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index 5b08a260e..bf17292cd 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -19,27 +19,30 @@ package com.sk89q.worldedit.forge; -import org.apache.logging.log4j.Logger; +import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.Joiner; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.WorldVector; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.internal.LocalWorldAdapter; -import com.sk89q.worldedit.util.Java8Detector; - -import java.io.File; -import java.util.Map; +import com.sk89q.worldedit.forge.net.LeftClickAirEventMessage; +import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.item.ItemTypes; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.CommandEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickEmpty; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -53,22 +56,19 @@ import net.minecraftforge.fml.common.event.FMLServerStartedEvent; import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; import net.minecraftforge.fml.common.eventhandler.Event.Result; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.apache.logging.log4j.Logger; -import static com.google.common.base.Preconditions.checkNotNull; +import java.io.File; /** * The Forge implementation of WorldEdit. */ @Mod(modid = ForgeWorldEdit.MOD_ID, name = "WorldEdit", version = "%VERSION%", acceptableRemoteVersions = "*") public class ForgeWorldEdit { - - static { - Java8Detector.notifyIfNot8(); - } public static Logger logger; public static final String MOD_ID = "worldedit"; - public static final String CUI_PLUGIN_CHANNEL = "WECUI"; + public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui"; private ForgePermissionsProvider provider; @@ -99,6 +99,7 @@ public class ForgeWorldEdit { public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(this); WECUIPacketHandler.init(); + InternalPacketHandler.init(); proxy.registerHandlers(); } @@ -123,6 +124,14 @@ public class ForgeWorldEdit { } else { this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform); } + + for (Block block : Block.REGISTRY) { + BlockTypes.register(new BlockType(Block.REGISTRY.getNameForObject(block).toString())); + } + + for (Item item : Item.REGISTRY) { + ItemTypes.register(new ItemType(Item.REGISTRY.getNameForObject(item).toString())); + } } @EventHandler @@ -157,6 +166,12 @@ public class ForgeWorldEdit { if (!platform.isHookingEvents()) return; // We have to be told to catch these events + if (event.getWorld().isRemote && event instanceof LeftClickEmpty) { + // catch LCE, pass it to server + InternalPacketHandler.CHANNEL.sendToServer(new LeftClickAirEventMessage()); + return; + } + boolean isLeftDeny = event instanceof PlayerInteractEvent.LeftClickBlock && ((PlayerInteractEvent.LeftClickBlock) event) .getUseItem() == Result.DENY; @@ -172,10 +187,13 @@ public class ForgeWorldEdit { ForgePlayer player = wrap((EntityPlayerMP) event.getEntityPlayer()); ForgeWorld world = getWorld(event.getEntityPlayer().world); - if (event instanceof PlayerInteractEvent.LeftClickBlock) { - @SuppressWarnings("deprecation") - WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), - event.getPos().getX(), event.getPos().getY(), event.getPos().getZ()); + if (event instanceof PlayerInteractEvent.LeftClickEmpty) { + if (we.handleArmSwing(player)) { + // this event cannot be canceled + // event.setCanceled(true); + } + } else if (event instanceof PlayerInteractEvent.LeftClickBlock) { + Location pos = new Location(world, event.getPos().getX(), event.getPos().getY(), event.getPos().getZ()); if (we.handleBlockLeftClick(player, pos)) { event.setCanceled(true); @@ -185,9 +203,7 @@ public class ForgeWorldEdit { event.setCanceled(true); } } else if (event instanceof PlayerInteractEvent.RightClickBlock) { - @SuppressWarnings("deprecation") - WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), - event.getPos().getX(), event.getPos().getY(), event.getPos().getZ()); + Location pos = new Location(world, event.getPos().getX(), event.getPos().getY(), event.getPos().getZ()); if (we.handleBlockRightClick(player, pos)) { event.setCanceled(true); @@ -204,12 +220,11 @@ public class ForgeWorldEdit { } public static ItemStack toForgeItemStack(BaseItemStack item) { - ItemStack ret = new ItemStack(Item.getItemById(item.getType()), item.getAmount(), item.getData()); - for (Map.Entry entry : item.getEnchantments().entrySet()) { - ret.addEnchantment(net.minecraft.enchantment.Enchantment.getEnchantmentByID(entry.getKey()), entry.getValue()); + NBTTagCompound forgeCompound = null; + if (item.getNbtData() != null) { + forgeCompound = NBTConverter.toNative(item.getNbtData()); } - - return ret; + return new ItemStack(Item.getByNameOrId(item.getType().getId()), item.getAmount(), 0, forgeCompound); } /** diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitEntity.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/InternalPacketHandler.java similarity index 52% rename from worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitEntity.java rename to worldedit-forge/src/main/java/com/sk89q/worldedit/forge/InternalPacketHandler.java index e138b5cd1..afac351ac 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/entity/BukkitEntity.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/InternalPacketHandler.java @@ -17,34 +17,24 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.bukkit.entity; +package com.sk89q.worldedit.forge; -import com.sk89q.worldedit.LocalEntity; -import com.sk89q.worldedit.Location; -import com.sk89q.worldedit.bukkit.BukkitUtil; -import org.bukkit.entity.EntityType; +import com.sk89q.worldedit.forge.net.LeftClickAirEventMessage; +import net.minecraftforge.fml.common.network.NetworkRegistry; +import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import net.minecraftforge.fml.relauncher.Side; -import java.util.UUID; +import java.nio.charset.Charset; -public class BukkitEntity extends LocalEntity { +public class InternalPacketHandler { + public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8"); + public static SimpleNetworkWrapper CHANNEL; - private final EntityType type; - private final UUID entityId; - - public BukkitEntity(Location loc, EntityType type, UUID entityId) { - super(loc); - this.type = type; - this.entityId = entityId; + public static void init() { + CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(ForgeWorldEdit.MOD_ID); + CHANNEL.registerMessage(LeftClickAirEventMessage.Handler.class, LeftClickAirEventMessage.class, 0, Side.SERVER); } - public UUID getEntityId() { - return entityId; + private InternalPacketHandler() { } - - @Override - public boolean spawn(Location weLoc) { - org.bukkit.Location loc = BukkitUtil.toLocation(weLoc); - return loc.getWorld().spawn(loc, type.getEntityClass()) != null; - } - } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java index a89d2edc2..76e726884 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/KeyHandler.java @@ -20,13 +20,11 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.forge.gui.GuiHandler; - import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; - import org.lwjgl.input.Keyboard; public class KeyHandler { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java index 1b2eb4487..0992d3d4f 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/NBTConverter.java @@ -19,11 +19,40 @@ package com.sk89q.worldedit.forge; -import com.sk89q.jnbt.*; -import net.minecraft.nbt.*; +import com.sk89q.jnbt.ByteArrayTag; +import com.sk89q.jnbt.ByteTag; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.DoubleTag; +import com.sk89q.jnbt.EndTag; +import com.sk89q.jnbt.FloatTag; +import com.sk89q.jnbt.IntArrayTag; +import com.sk89q.jnbt.IntTag; +import com.sk89q.jnbt.ListTag; +import com.sk89q.jnbt.LongTag; +import com.sk89q.jnbt.ShortTag; +import com.sk89q.jnbt.StringTag; +import com.sk89q.jnbt.Tag; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagByte; +import net.minecraft.nbt.NBTTagByteArray; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagDouble; +import net.minecraft.nbt.NBTTagEnd; +import net.minecraft.nbt.NBTTagFloat; +import net.minecraft.nbt.NBTTagInt; +import net.minecraft.nbt.NBTTagIntArray; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagLong; +import net.minecraft.nbt.NBTTagShort; +import net.minecraft.nbt.NBTTagString; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; /** * Converts between JNBT and Minecraft NBT classes. @@ -176,7 +205,7 @@ final class NBTConverter { public static ListTag fromNative(NBTTagList other) { other = other.copy(); - List list = new ArrayList(); + List list = new ArrayList<>(); Class listClass = StringTag.class; int tags = other.tagCount(); for (int i = 0; i < tags; i++) { @@ -214,7 +243,7 @@ final class NBTConverter { public static CompoundTag fromNative(NBTTagCompound other) { Set tags = other.getKeySet(); - Map map = new HashMap(); + Map map = new HashMap<>(); for (String tagName : tags) { map.put(tagName, fromNative(other.getTag(tagName))); } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java index 6f3b4182d..a52233564 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java @@ -55,7 +55,7 @@ public class ThreadSafeCache { long now = System.currentTimeMillis(); if (now - lastRefresh > REFRESH_DELAY) { - Set onlineIds = new HashSet(); + Set onlineIds = new HashSet<>(); MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); if (server == null || server.getPlayerList() == null) { @@ -67,7 +67,7 @@ public class ThreadSafeCache { } } - this.onlineIds = new CopyOnWriteArraySet(onlineIds); + this.onlineIds = new CopyOnWriteArraySet<>(onlineIds); lastRefresh = now; } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityBaseBlock.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityBaseBlock.java index 068482408..c1700150f 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityBaseBlock.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityBaseBlock.java @@ -19,16 +19,16 @@ package com.sk89q.worldedit.forge; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.TileEntityBlock; +import com.sk89q.worldedit.world.block.BlockState; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; public class TileEntityBaseBlock extends BaseBlock implements TileEntityBlock { - public TileEntityBaseBlock(int type, int data, TileEntity tile) { - super(type, data); - setNbtData(NBTConverter.fromNative(copyNbtData(tile))); + public TileEntityBaseBlock(BlockState state, TileEntity tile) { + super(state, NBTConverter.fromNative(copyNbtData(tile))); } private static NBTTagCompound copyNbtData(TileEntity tile) { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java index 77befeb4a..803407766 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java @@ -19,17 +19,18 @@ package com.sk89q.worldedit.forge; -import com.sk89q.worldedit.Vector; +import static com.google.common.base.Preconditions.checkNotNull; -import java.lang.reflect.Constructor; -import javax.annotation.Nullable; +import com.sk89q.worldedit.Vector; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagInt; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import static com.google.common.base.Preconditions.checkNotNull; +import java.lang.reflect.Constructor; + +import javax.annotation.Nullable; /** * Utility methods for setting tile entities in the world. diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java index 4a87abba4..c6cf673e4 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java @@ -20,8 +20,6 @@ package com.sk89q.worldedit.forge; import com.sk89q.worldedit.LocalSession; - -import java.nio.charset.Charset; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.PacketBuffer; @@ -33,6 +31,8 @@ import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketE import net.minecraftforge.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; +import java.nio.charset.Charset; + public class WECUIPacketHandler { public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8"); public static FMLEventChannel WECUI_CHANNEL; @@ -67,6 +67,6 @@ public class WECUIPacketHandler { } private static EntityPlayerMP getPlayerFromEvent(ServerCustomPacketEvent event) { - return ((NetHandlerPlayServer) event.getHandler()).playerEntity; + return ((NetHandlerPlayServer) event.getHandler()).player; } } \ No newline at end of file diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/LeftClickAirEventMessage.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/LeftClickAirEventMessage.java new file mode 100644 index 000000000..1e3b2b20e --- /dev/null +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/net/LeftClickAirEventMessage.java @@ -0,0 +1,50 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.forge.net; + +import com.sk89q.worldedit.forge.ForgeWorldEdit; +import io.netty.buffer.ByteBuf; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; + +public class LeftClickAirEventMessage implements IMessage { + + public static final class Handler implements IMessageHandler { + + @Override + public IMessage onMessage(LeftClickAirEventMessage message, final MessageContext ctx) { + ctx.getServerHandler().player.mcServer.addScheduledTask( + () -> ForgeWorldEdit.inst.onPlayerInteract(new PlayerInteractEvent.LeftClickEmpty(ctx.getServerHandler().player))); + return null; + } + + } + + @Override + public void fromBytes(ByteBuf buf) { + } + + @Override + public void toBytes(ByteBuf buf) { + } + +} diff --git a/worldedit-forge/src/main/resources/defaults/worldedit.properties b/worldedit-forge/src/main/resources/defaults/worldedit.properties index 9c3f5d327..4fa5671d5 100644 --- a/worldedit-forge/src/main/resources/defaults/worldedit.properties +++ b/worldedit-forge/src/main/resources/defaults/worldedit.properties @@ -4,20 +4,21 @@ schematic-save-dir=schematics allow-extra-data-values=false super-pickaxe-many-drop-items=true register-help=true -nav-wand-item=345 +nav-wand-item=minecraft:compass profile=false super-pickaxe-drop-items=true -disallowed-blocks=6,26,27,28,31,32,34,36,37,38,39,40,46,50,51,55,59,66,69,75,76,93,94,77,81,83,7,14,15,16,56 +disallowed-blocks=minecraft:oak_sapling,minecraft:jungle_sapling,minecraft:dark_oak_sapling:,minecraft:spruce_sapling,minecraft:birch_sapling,minecraft:acacia_sapling,minecraft:black_bed,minecraft:blue_bed,minecraft:brown_bed,minecraft:cyan_bed,minecraft:gray_bed,minecraft:green_bed,minecraft:light_blue_bed,minecraft:light_gray_bed,minecraft:lime_bed,minecraft:magenta_bed,minecraft:orange_bed,minecraft:pink_bed,minecraft:purple_bed,minecraft:red_bed,minecraft:white_bed,minecraft:yellow_bed,minecraft:powered_rail,minecraft:detector_rail,minecraft:grass,minecraft:dead_bush,minecraft:moving_piston,minecraft:piston_head,minecraft:sunflower,minecraft:rose_bush,minecraft:dandelion,minecraft:poppy,minecraft:brown_mushroom,minecraft:red_mushroom,minecraft:tnt,minecraft:torch,minecraft:fire,minecraft:redstone_wire,minecraft:wheat,minecraft:potatoes,minecraft:carrots,minecraft:melon_stem,minecraft:pumpkin_stem,minecraft:beetroots,minecraft:rail,minecraft:lever,minecraft:redstone_torch,minecraft:redstone_wall_torch,minecraft:repeater,minecraft:comparator,minecraft:stone_button,minecraft:birch_button,minecraft:acacia_button,minecraft:dark_oak_button,minecraft:jungle_button,minecraft:oak_button,minecraft:spruce_button,minecraft:cactus,minecraft:sugar_cane,minecraft:bedrock max-super-pickaxe-size=5 max-brush-radius=10 craftscript-dir=craftscripts no-double-slash=false -wand-item=271 +wand-item=minecraft:wooden_axe shell-save-type= scripting-timeout=3000 snapshots-dir= use-inventory-creative-override=false log-file=worldedit.log +log-format=[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s]: %5$s%6$s%n max-changed-blocks=-1 nav-wand-distance=50 butcher-default-radius=-1 diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index abd772fa0..d068d4804 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -2,31 +2,24 @@ buildscript { repositories { mavenCentral() maven { url = "http://files.minecraftforge.net/maven" } - maven { url = "http://repo.minecrell.net/releases" } maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } jcenter() } - - dependencies { - classpath 'net.minecrell:VanillaGradle:2.0.3_1' - classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' - } } plugins { - id 'org.spongepowered.plugin' version '0.5.2' + id 'signing' + id 'org.spongepowered.plugin' version '0.8.1' } -apply plugin: 'net.minecrell.vanilla.server.library' - dependencies { compile project(':worldedit-core') - compile 'org.spongepowered:spongeapi:4.1.0-SNAPSHOT' + compile 'org.spongepowered:spongeapi:7.0.0-SNAPSHOT' testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1' } -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 sponge { plugin { @@ -34,14 +27,6 @@ sponge { } } -minecraft { - version = "1.8.9" - mappings = "stable_22" - runDir = 'run' -} - -project.archivesBaseName = "${project.archivesBaseName}-mc${minecraft.version}" - jar { manifest { attributes("Class-Path": "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar", @@ -55,17 +40,11 @@ shadowJar { } } -reobf { - shadowJar { - mappingType = 'SEARGE' - } -} - -task deobfJar(type: Jar) { - from sourceSets.main.output - classifier = 'dev' -} - artifacts { - archives deobfJar + archives shadowJar } + +signing { + required false + sign shadowJar +} \ No newline at end of file diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CUIChannelHandler.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CUIChannelHandler.java index 1be22b0b0..7be50e8d1 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CUIChannelHandler.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CUIChannelHandler.java @@ -23,12 +23,16 @@ import com.sk89q.worldedit.LocalSession; import org.spongepowered.api.Platform; import org.spongepowered.api.Sponge; import org.spongepowered.api.entity.living.player.Player; -import org.spongepowered.api.network.*; +import org.spongepowered.api.network.ChannelBinding; +import org.spongepowered.api.network.ChannelBuf; +import org.spongepowered.api.network.PlayerConnection; +import org.spongepowered.api.network.RawDataListener; +import org.spongepowered.api.network.RemoteConnection; import java.nio.charset.StandardCharsets; public class CUIChannelHandler implements RawDataListener { - public static final String CUI_PLUGIN_CHANNEL = "WECUI"; + public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui"; private static ChannelBinding.RawDataChannel channel; diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CommandAdapter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CommandAdapter.java index 1398ba389..f94bd3b08 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CommandAdapter.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/CommandAdapter.java @@ -44,7 +44,7 @@ public abstract class CommandAdapter implements CommandCallable { } @Override - public Optional getShortDescription(CommandSource source) { + public Optional getShortDescription(CommandSource source) { String description = command.getDescription().getDescription(); if (description != null && !description.isEmpty()) { return Optional.of(Text.of(description)); @@ -53,7 +53,7 @@ public abstract class CommandAdapter implements CommandCallable { } @Override - public Optional getHelp(CommandSource source) { + public Optional getHelp(CommandSource source) { String help = command.getDescription().getHelp(); if (help != null && !help.isEmpty()) { return Optional.of(Text.of(help)); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java deleted file mode 100644 index 51723964f..000000000 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.sponge; - -import com.flowpowered.math.vector.Vector3d; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.sponge.nms.SpongeNMSWorld; -import com.sk89q.worldedit.util.Location; -import com.sk89q.worldedit.world.World; - -final class SpongeAdapter { - - private SpongeAdapter() { - } - - public static World adapt(org.spongepowered.api.world.World world) { - return new SpongeNMSWorld(world); - } - - public static Location adapt(org.spongepowered.api.world.Location loc, Vector3d rot) { - Vector position = new Vector(loc.getX(), loc.getY(), loc.getZ()); - - return new Location(SpongeAdapter.adapt(loc.getExtent()), position, (float) rot.getY(), (float) rot.getX()); - } -} diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java index 3e5a0a2f1..1b1955bdb 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java @@ -19,17 +19,17 @@ package com.sk89q.worldedit.sponge; -import com.sk89q.worldedit.sponge.nms.IDHelper; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.registry.BiomeRegistry; import org.spongepowered.api.Sponge; import org.spongepowered.api.world.biome.BiomeType; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; + /** * Provides access to biome data in Sponge. */ @@ -43,9 +43,9 @@ class SpongeBiomeRegistry implements BiomeRegistry { @Override public List getBiomes() { - List list = new ArrayList(); + List list = new ArrayList<>(); for (BiomeType biome : Sponge.getGame().getRegistry().getAllOf(BiomeType.class)) { - list.add(new BaseBiome(IDHelper.resolve(biome))); + list.add(new BaseBiome(SpongeWorldEdit.inst().getAdapter().resolve(biome))); } return list; } @@ -53,7 +53,7 @@ class SpongeBiomeRegistry implements BiomeRegistry { @Nullable @Override public BiomeData getData(BaseBiome biome) { - return new SpongeBiomeData(IDHelper.resolveBiome(biome.getId())); + return new SpongeBiomeData(SpongeWorldEdit.inst().getAdapter().resolveBiome(biome.getId())); } private static class SpongeBiomeData implements BiomeData { diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeCommandSender.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeCommandSender.java index a2a3fa138..bf1ceb7bd 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeCommandSender.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeCommandSender.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.sponge; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.session.SessionKey; @@ -30,12 +33,10 @@ import org.spongepowered.api.text.format.TextColor; import org.spongepowered.api.text.format.TextColors; import org.spongepowered.api.text.serializer.TextSerializers; -import javax.annotation.Nullable; import java.io.File; import java.util.UUID; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; public class SpongeCommandSender implements Actor { diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java index b078f7fa2..9aa728310 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntity.java @@ -19,20 +19,20 @@ package com.sk89q.worldedit.sponge; +import static com.google.common.base.Preconditions.checkNotNull; + import com.flowpowered.math.vector.Vector3d; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; -import com.sk89q.worldedit.entity.metadata.EntityType; +import com.sk89q.worldedit.entity.metadata.EntityProperties; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.sponge.nms.NMSHelper; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.NullWorld; import org.spongepowered.api.world.World; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; class SpongeEntity implements Entity { @@ -47,7 +47,7 @@ class SpongeEntity implements Entity { public BaseEntity getState() { org.spongepowered.api.entity.Entity entity = entityRef.get(); if (entity != null) { - return NMSHelper.createBaseEntity(entity); + return SpongeWorldEdit.inst().getAdapter().createBaseEntity(entity); } else { return null; } @@ -60,7 +60,7 @@ class SpongeEntity implements Entity { org.spongepowered.api.world.Location entityLoc = entity.getLocation(); Vector3d entityRot = entity.getRotation(); - return SpongeAdapter.adapt(entityLoc, entityRot); + return SpongeWorldEdit.inst().getAdapter().adapt(entityLoc, entityRot); } else { return new Location(NullWorld.getInstance()); } @@ -70,7 +70,7 @@ class SpongeEntity implements Entity { public Extent getExtent() { org.spongepowered.api.entity.Entity entity = entityRef.get(); if (entity != null) { - return SpongeAdapter.adapt(entity.getWorld()); + return SpongeWorldEdit.inst().getAdapter().getWorld(entity.getWorld()); } else { return NullWorld.getInstance(); } @@ -91,8 +91,8 @@ class SpongeEntity implements Entity { public T getFacet(Class cls) { org.spongepowered.api.entity.Entity entity = entityRef.get(); if (entity != null) { - if (EntityType.class.isAssignableFrom(cls)) { - return (T) new SpongeEntityType(entity); + if (EntityProperties.class.isAssignableFrom(cls)) { + return (T) new SpongeEntityProperties(entity); } else { return null; } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntityType.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntityProperties.java similarity index 81% rename from worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntityType.java rename to worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntityProperties.java index d3d73cffa..2c2fb8852 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntityType.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeEntityProperties.java @@ -19,7 +19,9 @@ package com.sk89q.worldedit.sponge; -import com.sk89q.worldedit.entity.metadata.EntityType; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.sk89q.worldedit.entity.metadata.EntityProperties; import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.entity.Entity; import org.spongepowered.api.entity.ExperienceOrb; @@ -28,24 +30,27 @@ import org.spongepowered.api.entity.Item; import org.spongepowered.api.entity.explosive.PrimedTNT; import org.spongepowered.api.entity.hanging.ItemFrame; import org.spongepowered.api.entity.hanging.Painting; -import org.spongepowered.api.entity.living.*; +import org.spongepowered.api.entity.living.Ambient; +import org.spongepowered.api.entity.living.ArmorStand; +import org.spongepowered.api.entity.living.Humanoid; +import org.spongepowered.api.entity.living.Living; +import org.spongepowered.api.entity.living.Villager; import org.spongepowered.api.entity.living.animal.Animal; +import org.spongepowered.api.entity.living.complex.ComplexLivingPart; import org.spongepowered.api.entity.living.golem.Golem; +import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.projectile.Projectile; import org.spongepowered.api.entity.vehicle.Boat; import org.spongepowered.api.entity.vehicle.minecart.Minecart; import org.spongepowered.api.text.Text; import java.util.Optional; -import java.util.UUID; -import static com.google.common.base.Preconditions.checkNotNull; - -public class SpongeEntityType implements EntityType { +public class SpongeEntityProperties implements EntityProperties { private final Entity entity; - public SpongeEntityType(Entity entity) { + public SpongeEntityProperties(Entity entity) { checkNotNull(entity); this.entity = entity; } @@ -127,7 +132,7 @@ public class SpongeEntityType implements EntityType { @Override public boolean isTamed() { - return entity.get(Keys.TAMED_OWNER).orElse(Optional.empty()).isPresent(); + return entity.get(Keys.TAMED_OWNER).orElse(Optional.empty()).isPresent(); } @Override @@ -139,4 +144,9 @@ public class SpongeEntityType implements EntityType { public boolean isArmorStand() { return entity instanceof ArmorStand; } + + @Override + public boolean isPasteable() { + return !(entity instanceof Player || entity instanceof ComplexLivingPart); + } } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePermissionsProvider.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePermissionsProvider.java index 62c75d5f3..d9970ecb1 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePermissionsProvider.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePermissionsProvider.java @@ -19,8 +19,14 @@ package com.sk89q.worldedit.sponge; +import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandCallable; import org.spongepowered.api.entity.living.player.Player; +import org.spongepowered.api.service.permission.PermissionDescription; +import org.spongepowered.api.service.permission.PermissionService; +import org.spongepowered.api.service.permission.SubjectReference; + +import java.util.stream.Collectors; public class SpongePermissionsProvider { @@ -28,5 +34,16 @@ public class SpongePermissionsProvider { return player.hasPermission(permission); } - public void registerPermission(CommandCallable command, String permission) { } + public void registerPermission(CommandCallable command, String permission) { + Sponge.getGame().getServiceManager().getRegistration(PermissionService.class).ifPresent((permissionService -> { + PermissionDescription.Builder permissionBuilder = permissionService.getProvider().newDescriptionBuilder(SpongeWorldEdit.inst()); + permissionBuilder.id(permission).register(); + })); + } + + public String[] getGroups(Player player) { + return player.getParents().stream() + .map(SubjectReference::getSubjectIdentifier) + .collect(Collectors.toList()).toArray(new String[0]); + } } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java index 93dbc0174..774347645 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java @@ -23,22 +23,32 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.event.platform.CommandSuggestionEvent; -import com.sk89q.worldedit.extension.platform.*; +import com.sk89q.worldedit.extension.platform.AbstractPlatform; +import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.extension.platform.MultiUserPlatform; +import com.sk89q.worldedit.extension.platform.Preference; import com.sk89q.worldedit.sponge.config.SpongeConfiguration; -import com.sk89q.worldedit.sponge.nms.IDHelper; -import com.sk89q.worldedit.sponge.nms.SpongeNMSWorld; import com.sk89q.worldedit.util.command.CommandMapping; import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.registry.Registries; import org.spongepowered.api.Sponge; +import org.spongepowered.api.command.CommandException; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.entity.EntityType; -import org.spongepowered.api.item.ItemType; import org.spongepowered.api.scheduler.Task; +import org.spongepowered.api.world.Location; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; import javax.annotation.Nullable; -import java.util.*; class SpongePlatform extends AbstractPlatform implements MultiUserPlatform { @@ -54,16 +64,8 @@ class SpongePlatform extends AbstractPlatform implements MultiUserPlatform { } @Override - public int resolveItem(String name) { - if (name == null) return 0; - - Optional optType = Sponge.getRegistry().getType(ItemType.class, name); - - if (optType.isPresent()) { - return IDHelper.resolve(optType.get()); - } - - return 0; + public Registries getRegistries() { + return SpongeRegistries.getInstance(); } @Override @@ -87,7 +89,7 @@ class SpongePlatform extends AbstractPlatform implements MultiUserPlatform { Collection worlds = Sponge.getServer().getWorlds(); List ret = new ArrayList<>(worlds.size()); for (org.spongepowered.api.world.World world : worlds) { - ret.add(new SpongeNMSWorld(world)); + ret.add(SpongeWorldEdit.inst().getAdapter().getWorld(world)); } return ret; } @@ -99,7 +101,7 @@ class SpongePlatform extends AbstractPlatform implements MultiUserPlatform { return player; } else { Optional optPlayer = Sponge.getServer().getPlayer(player.getUniqueId()); - return optPlayer.isPresent() ? new SpongePlayer(this, optPlayer.get()) : null; + return optPlayer.map(player1 -> new SpongePlayer(this, player1)).orElse(null); } } @@ -111,7 +113,7 @@ class SpongePlatform extends AbstractPlatform implements MultiUserPlatform { } else { for (org.spongepowered.api.world.World ws : Sponge.getServer().getWorlds()) { if (ws.getName().equals(world.getName())) { - return new SpongeNMSWorld(ws); + return SpongeWorldEdit.inst().getAdapter().getWorld(ws); } } @@ -131,7 +133,7 @@ class SpongePlatform extends AbstractPlatform implements MultiUserPlatform { } @Override - public List getSuggestions(CommandSource source, String arguments) throws org.spongepowered.api.command.CommandException { + public List getSuggestions(CommandSource source, String arguments, @Nullable Location targetPosition) throws CommandException { CommandSuggestionEvent weEvent = new CommandSuggestionEvent(SpongeWorldEdit.inst().wrapCommandSource(source), command.getPrimaryAlias() + " " + arguments); WorldEdit.getInstance().getEventBus().post(weEvent); return weEvent.getSuggestions(); @@ -181,7 +183,7 @@ class SpongePlatform extends AbstractPlatform implements MultiUserPlatform { @Override public Collection getConnectedUsers() { - List users = new ArrayList(); + List users = new ArrayList<>(); for (org.spongepowered.api.entity.living.player.Player player : Sponge.getServer().getOnlinePlayers()) { users.add(new SpongePlayer(this, player)); } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java index d88f6ecc2..37774dbc8 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java @@ -22,16 +22,21 @@ package com.sk89q.worldedit.sponge; import com.flowpowered.math.vector.Vector3d; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.WorldVector; +import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; import com.sk89q.worldedit.extent.inventory.BlockBag; -import com.sk89q.worldedit.internal.LocalWorldAdapter; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.session.SessionKey; -import com.sk89q.worldedit.sponge.nms.IDHelper; +import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.gamemode.GameMode; +import com.sk89q.worldedit.world.gamemode.GameModes; +import com.sk89q.worldedit.world.item.ItemTypes; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.data.type.HandTypes; import org.spongepowered.api.entity.living.player.Player; +import org.spongepowered.api.item.ItemType; import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.text.Text; import org.spongepowered.api.text.format.TextColor; @@ -39,11 +44,12 @@ import org.spongepowered.api.text.format.TextColors; import org.spongepowered.api.text.serializer.TextSerializers; import org.spongepowered.api.world.World; -import javax.annotation.Nullable; import java.nio.charset.StandardCharsets; import java.util.Optional; import java.util.UUID; +import javax.annotation.Nullable; + public class SpongePlayer extends AbstractPlayerActor { private final Player player; @@ -59,9 +65,10 @@ public class SpongePlayer extends AbstractPlayerActor { } @Override - public int getItemInHand() { - Optional is = this.player.getItemInHand(); - return is.isPresent() ? IDHelper.resolve(is.get().getItem()) : 0; + public BaseItemStack getItemInHand(HandSide handSide) { + Optional is = this.player.getItemInHand(handSide == HandSide.MAIN_HAND + ? HandTypes.MAIN_HAND : HandTypes.OFF_HAND); + return is.map(itemStack -> new BaseItemStack(ItemTypes.get(itemStack.getType().getId()))).orElse(null); } @Override @@ -79,33 +86,20 @@ public class SpongePlayer extends AbstractPlayerActor { org.spongepowered.api.world.Location entityLoc = this.player.getLocation(); Vector3d entityRot = this.player.getRotation(); - return SpongeAdapter.adapt(entityLoc, entityRot); - } - - @Override - public WorldVector getPosition() { - Vector3d pos = this.player.getLocation().getPosition(); - return new WorldVector(LocalWorldAdapter.adapt(SpongeAdapter.adapt(this.player.getWorld())), pos.getX(), pos.getY(), pos.getZ()); + return SpongeWorldEdit.inst().getAdapter().adapt(entityLoc, entityRot); } @Override public com.sk89q.worldedit.world.World getWorld() { - return SpongeAdapter.adapt(player.getWorld()); + return SpongeWorldEdit.inst().getAdapter().getWorld(player.getWorld()); } @Override - public double getPitch() { - return getLocation().getPitch(); - } - - @Override - public double getYaw() { - return getLocation().getYaw(); - } - - @Override - public void giveItem(int type, int amt) { - this.player.getInventory().offer(ItemStack.of(IDHelper.resolveItem(type), amt)); + public void giveItem(BaseItemStack itemStack) { + this.player.getInventory().offer( + ItemStack.of(Sponge.getGame().getRegistry().getType(ItemType.class, itemStack.getType().getId()).get(), + itemStack.getAmount()) + ); } @Override @@ -123,7 +117,7 @@ public class SpongePlayer extends AbstractPlayerActor { @Override public void printRaw(String msg) { for (String part : msg.split("\n")) { - this.player.sendMessage(TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part)); + this.player.sendMessage(TextSerializers.FORMATTING_CODE.deserialize(part)); } } @@ -144,7 +138,7 @@ public class SpongePlayer extends AbstractPlayerActor { private void sendColorized(String msg, TextColor formatting) { for (String part : msg.split("\n")) { - this.player.sendMessage(Text.of(formatting, TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part))); + this.player.sendMessage(Text.of(formatting, TextSerializers.FORMATTING_CODE.deserialize(part))); } } @@ -159,7 +153,7 @@ public class SpongePlayer extends AbstractPlayerActor { @Override public String[] getGroups() { - return new String[]{}; // WorldEditMod.inst.getPermissionsResolver().getGroups(this.player.username); + return SpongeWorldEdit.inst().getPermissionsProvider().getGroups(this.player); } @Override @@ -178,6 +172,17 @@ public class SpongePlayer extends AbstractPlayerActor { return null; } + @Override + public GameMode getGameMode() { + return GameModes.get(player.getGameModeData().type().get().getId()); + } + + @Override + public void setGameMode(GameMode gameMode) { + player.getGameModeData().type().set(Sponge.getRegistry().getType(org.spongepowered.api.entity.living.player.gamemode.GameMode.class, + gameMode.getId()).get()); + } + @Override public SessionKey getSessionKey() { return new SessionKeyImpl(player.getUniqueId(), player.getName()); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldData.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeRegistries.java similarity index 83% rename from worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldData.java rename to worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeRegistries.java index 789dfc0c3..6e2777b7e 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldData.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeRegistries.java @@ -20,14 +20,14 @@ package com.sk89q.worldedit.sponge; import com.sk89q.worldedit.world.registry.BiomeRegistry; -import com.sk89q.worldedit.world.registry.LegacyWorldData; +import com.sk89q.worldedit.world.registry.BundledRegistries; /** * World data for the Sponge platform. */ -class SpongeWorldData extends LegacyWorldData { +class SpongeRegistries extends BundledRegistries { - private static final SpongeWorldData INSTANCE = new SpongeWorldData(); + private static final SpongeRegistries INSTANCE = new SpongeRegistries(); private final BiomeRegistry biomeRegistry = new SpongeBiomeRegistry(); @Override @@ -40,7 +40,7 @@ class SpongeWorldData extends LegacyWorldData { * * @return an instance */ - public static SpongeWorldData getInstance() { + public static SpongeRegistries getInstance() { return INSTANCE; } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java index 00dda0444..fe3db9e16 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java @@ -19,53 +19,55 @@ package com.sk89q.worldedit.sponge; +import static com.google.common.base.Preconditions.checkNotNull; + import com.flowpowered.math.vector.Vector3d; import com.flowpowered.math.vector.Vector3i; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.sponge.nms.IDHelper; +import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.biome.BaseBiome; -import com.sk89q.worldedit.world.registry.WorldData; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.item.ItemTypes; +import com.sk89q.worldedit.world.weather.WeatherType; +import com.sk89q.worldedit.world.weather.WeatherTypes; import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockSnapshot; import org.spongepowered.api.block.BlockState; +import org.spongepowered.api.block.BlockType; +import org.spongepowered.api.block.BlockTypes; import org.spongepowered.api.block.tileentity.TileEntity; import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.data.property.block.GroundLuminanceProperty; import org.spongepowered.api.data.property.block.SkyLuminanceProperty; import org.spongepowered.api.entity.EntityType; import org.spongepowered.api.entity.EntityTypes; -import org.spongepowered.api.event.cause.Cause; -import org.spongepowered.api.event.cause.NamedCause; -import org.spongepowered.api.event.cause.entity.spawn.SpawnCause; -import org.spongepowered.api.event.cause.entity.spawn.SpawnTypes; +import org.spongepowered.api.world.BlockChangeFlags; import org.spongepowered.api.world.World; +import org.spongepowered.api.world.weather.Weather; -import javax.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Optional; -import java.util.Random; -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; /** * An adapter to Minecraft worlds for WorldEdit. */ public abstract class SpongeWorld extends AbstractWorld { - protected static final Random random = new Random(); - private final WeakReference worldRef; /** @@ -113,14 +115,26 @@ public abstract class SpongeWorld extends AbstractWorld { return getWorld().getName(); } - protected abstract BlockState getBlockState(BaseBlock block); + @SuppressWarnings("WeakerAccess") + protected BlockState getBlockState(BlockStateHolder block) { + if (block instanceof com.sk89q.worldedit.world.block.BlockState) { + BlockState state = Sponge.getRegistry().getType(BlockType.class, block.getBlockType().getId()).orElse(BlockTypes.AIR).getDefaultState(); + for (Map.Entry, Object> entry : block.getStates().entrySet()) { + // TODO Convert across states + } + return state; + } else { + throw new UnsupportedOperationException("Missing Sponge adapter for WorldEdit!"); + } + } + @SuppressWarnings("WeakerAccess") protected abstract void applyTileEntityData(TileEntity entity, BaseBlock block); private static final BlockSnapshot.Builder builder = BlockSnapshot.builder(); @Override - public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException { + public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException { checkNotNull(position); checkNotNull(block); @@ -136,15 +150,12 @@ public abstract class SpongeWorld extends AbstractWorld { .world(world.getProperties()) .build(); - snapshot.restore(true, notifyAndLight); + snapshot.restore(true, notifyAndLight ? BlockChangeFlags.ALL : BlockChangeFlags.NONE); // Create the TileEntity - if (block.hasNbtData()) { + if (block instanceof BaseBlock && ((BaseBlock) block).hasNbtData()) { // Kill the old TileEntity - Optional optTile = world.getTileEntity(pos); - if (optTile.isPresent()) { - applyTileEntityData(optTile.get(), block); - } + world.getTileEntity(pos).ifPresent(tileEntity -> applyTileEntityData(tileEntity, (BaseBlock) block)); } return true; @@ -176,7 +187,7 @@ public abstract class SpongeWorld extends AbstractWorld { @Override public BaseBiome getBiome(Vector2D position) { checkNotNull(position); - return new BaseBiome(IDHelper.resolve(getWorld().getBiome(position.getBlockX(), position.getBlockZ()))); + return new BaseBiome(SpongeWorldEdit.inst().getAdapter().resolve(getWorld().getBiome(position.getBlockX(), 0, position.getBlockZ()))); } @Override @@ -184,7 +195,7 @@ public abstract class SpongeWorld extends AbstractWorld { checkNotNull(position); checkNotNull(biome); - getWorld().setBiome(position.getBlockX(), position.getBlockZ(), IDHelper.resolveBiome(biome.getId())); + getWorld().setBiome(position.getBlockX(), 0, position.getBlockZ(), SpongeWorldEdit.inst().getAdapter().resolveBiome(biome.getId())); return true; } @@ -193,30 +204,22 @@ public abstract class SpongeWorld extends AbstractWorld { checkNotNull(position); checkNotNull(item); - if (item.getType() == 0) { + if (item.getType() == ItemTypes.AIR) { return; } - Optional optItem = getWorld().createEntity( + org.spongepowered.api.entity.Entity entity = getWorld().createEntity( EntityTypes.ITEM, new Vector3d(position.getX(), position.getY(), position.getZ()) ); - if (optItem.isPresent()) { - org.spongepowered.api.entity.Entity entity = optItem.get(); - entity.offer(Keys.REPRESENTED_ITEM, SpongeWorldEdit.toSpongeItemStack(item).createSnapshot()); - getWorld().spawnEntity(entity, ENTITY_SPAWN_CAUSE); - } + entity.offer(Keys.REPRESENTED_ITEM, SpongeWorldEdit.toSpongeItemStack(item).createSnapshot()); + getWorld().spawnEntity(entity); } @Override - public WorldData getWorldData() { - return SpongeWorldData.getInstance(); - } - - @Override - public boolean isValidBlockType(int id) { - return (id == 0) || (IDHelper.resolveBlock(id) != null); + public void simulateBlockMine(Vector position) { + // TODO } @Override @@ -232,11 +235,10 @@ public abstract class SpongeWorld extends AbstractWorld { SpongeWorld other = ((SpongeWorld) o); World otherWorld = other.worldRef.get(); World thisWorld = worldRef.get(); - return otherWorld != null && thisWorld != null && otherWorld.equals(thisWorld); - } else if (o instanceof com.sk89q.worldedit.world.World) { - return ((com.sk89q.worldedit.world.World) o).getName().equals(getName()); + return otherWorld != null && otherWorld.equals(thisWorld); } else { - return false; + return o instanceof com.sk89q.worldedit.world.World + && ((com.sk89q.worldedit.world.World) o).getName().equals(getName()); } } @@ -263,42 +265,54 @@ public abstract class SpongeWorld extends AbstractWorld { protected abstract void applyEntityData(org.spongepowered.api.entity.Entity entity, BaseEntity data); - private static final Cause ENTITY_SPAWN_CAUSE = Cause - .source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()) - .suggestNamed(NamedCause.SOURCE, SpongeWorldEdit.inst()) - .build(); - @Nullable @Override public Entity createEntity(Location location, BaseEntity entity) { World world = getWorld(); - EntityType entityType = Sponge.getRegistry().getType(EntityType.class, entity.getTypeId()).get(); + EntityType entityType = Sponge.getRegistry().getType(EntityType.class, entity.getType().getId()).get(); Vector3d pos = new Vector3d(location.getX(), location.getY(), location.getZ()); - Optional optNewEnt = world.createEntity(entityType, pos); - if (optNewEnt.isPresent()) { - org.spongepowered.api.entity.Entity newEnt = optNewEnt.get(); - if (entity.hasNbtData()) { - applyEntityData(newEnt, entity); - } + org.spongepowered.api.entity.Entity newEnt = world.createEntity(entityType, pos); + if (entity.hasNbtData()) { + applyEntityData(newEnt, entity); + } - // Overwrite any data set by the NBT application - Vector dir = location.getDirection(); + // Overwrite any data set by the NBT application + Vector dir = location.getDirection(); - newEnt.setLocationAndRotation( - new org.spongepowered.api.world.Location<>(getWorld(), pos), - new Vector3d(dir.getX(), dir.getY(), dir.getZ()) - ); + newEnt.setLocationAndRotation( + new org.spongepowered.api.world.Location<>(getWorld(), pos), + new Vector3d(dir.getX(), dir.getY(), dir.getZ()) + ); - if (world.spawnEntity(newEnt, ENTITY_SPAWN_CAUSE)) { - return new SpongeEntity(newEnt); - } + if (world.spawnEntity(newEnt)) { + return new SpongeEntity(newEnt); } return null; } + @Override + public WeatherType getWeather() { + return WeatherTypes.get(getWorld().getWeather().getId()); + } + + @Override + public long getRemainingWeatherDuration() { + return getWorld().getRemainingDuration(); + } + + @Override + public void setWeather(WeatherType weatherType) { + getWorld().setWeather(Sponge.getRegistry().getType(Weather.class, weatherType.getId()).get()); + } + + @Override + public void setWeather(WeatherType weatherType, long duration) { + getWorld().setWeather(Sponge.getRegistry().getType(Weather.class, weatherType.getId()).get(), duration); + } + /** * Thrown when the reference to the world is lost. */ diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java index 96ec5c2b6..f2ba77982 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java @@ -19,19 +19,23 @@ package com.sk89q.worldedit.sponge; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.inject.Inject; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.WorldVector; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.internal.LocalWorldAdapter; +import com.sk89q.worldedit.sponge.adapter.AdapterLoadException; +import com.sk89q.worldedit.sponge.adapter.SpongeImplAdapter; +import com.sk89q.worldedit.sponge.adapter.SpongeImplLoader; import com.sk89q.worldedit.sponge.config.SpongeConfiguration; -import com.sk89q.worldedit.sponge.nms.NMSHelper; -import com.sk89q.worldedit.sponge.nms.SpongeNMSWorld; +import com.sk89q.worldedit.world.item.ItemTypes; import org.slf4j.Logger; +import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockSnapshot; import org.spongepowered.api.block.BlockType; import org.spongepowered.api.block.BlockTypes; @@ -41,7 +45,13 @@ import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.block.InteractBlockEvent; import org.spongepowered.api.event.filter.cause.Root; -import org.spongepowered.api.event.game.state.*; +import org.spongepowered.api.event.game.state.GameAboutToStartServerEvent; +import org.spongepowered.api.event.game.state.GameInitializationEvent; +import org.spongepowered.api.event.game.state.GamePostInitializationEvent; +import org.spongepowered.api.event.game.state.GamePreInitializationEvent; +import org.spongepowered.api.event.game.state.GameStartedServerEvent; +import org.spongepowered.api.event.game.state.GameStoppingServerEvent; +import org.spongepowered.api.item.ItemType; import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.plugin.Plugin; import org.spongepowered.api.plugin.PluginContainer; @@ -50,11 +60,10 @@ import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import java.io.File; +import java.io.IOException; import java.util.Optional; import java.util.concurrent.TimeUnit; -import static com.google.common.base.Preconditions.checkNotNull; - /** * The Sponge implementation of WorldEdit. */ @@ -84,6 +93,7 @@ public class SpongeWorldEdit { } private SpongePlatform platform; + private SpongeImplAdapter spongeAdapter; @Inject private SpongeConfiguration config; @@ -123,6 +133,15 @@ public class SpongeWorldEdit { this.platform = new SpongePlatform(this); this.provider = new SpongePermissionsProvider(); + for (BlockType blockType : Sponge.getRegistry().getAllOf(BlockType.class)) { + // TODO Handle blockstate stuff + com.sk89q.worldedit.world.block.BlockTypes.register(new com.sk89q.worldedit.world.block.BlockType(blockType.getId())); + } + + for (ItemType itemType : Sponge.getRegistry().getAllOf(ItemType.class)) { + ItemTypes.register(new com.sk89q.worldedit.world.item.ItemType(itemType.getId())); + } + WorldEdit.getInstance().getPlatformManager().register(platform); } @@ -134,6 +153,44 @@ public class SpongeWorldEdit { @Listener public void serverStarted(GameStartedServerEvent event) { WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent()); + + loadAdapter(); + } + + private void loadAdapter() { + WorldEdit worldEdit = WorldEdit.getInstance(); + + // Attempt to load a Sponge adapter + SpongeImplLoader adapterLoader = new SpongeImplLoader(); + + try { + adapterLoader.addFromPath(getClass().getClassLoader()); + } catch (IOException e) { + logger.warn("Failed to search path for Sponge adapters"); + } + + try { + adapterLoader.addFromJar(container.getSource().get().toFile()); + } catch (IOException e) { + logger.warn("Failed to search " + container.getSource().get().toFile() + " for Sponge adapters", e); + } + try { + spongeAdapter = adapterLoader.loadAdapter(); + logger.info("Using " + spongeAdapter.getClass().getCanonicalName() + " as the Sponge adapter"); + } catch (AdapterLoadException e) { + Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING); + if (platform instanceof SpongePlatform) { + logger.warn(e.getMessage()); + } else { + logger.info("WorldEdit could not find a Sponge adapter for this MC version, " + + "but it seems that you have another implementation of WorldEdit installed (" + platform.getPlatformName() + ") " + + "that handles the world editing."); + } + } + } + + public SpongeImplAdapter getAdapter() { + return this.spongeAdapter; } @Listener @@ -160,7 +217,8 @@ public class SpongeWorldEdit { } Location loc = optLoc.get(); - WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), loc.getX(), loc.getY(), loc.getZ()); + com.sk89q.worldedit.util.Location pos = new com.sk89q.worldedit.util.Location( + world, loc.getX(), loc.getY(), loc.getZ()); if (we.handleBlockLeftClick(player, pos)) { event.setCancelled(true); @@ -181,7 +239,8 @@ public class SpongeWorldEdit { } Location loc = optLoc.get(); - WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), loc.getX(), loc.getY(), loc.getZ()); + com.sk89q.worldedit.util.Location pos = new com.sk89q.worldedit.util.Location( + world, loc.getX(), loc.getY(), loc.getZ()); if (we.handleBlockRightClick(player, pos)) { event.setCancelled(true); @@ -199,7 +258,7 @@ public class SpongeWorldEdit { } public static ItemStack toSpongeItemStack(BaseItemStack item) { - return NMSHelper.makeSpongeStack(item); + return inst().getAdapter().makeSpongeStack(item); } /** @@ -249,7 +308,7 @@ public class SpongeWorldEdit { */ public SpongeWorld getWorld(World world) { checkNotNull(world); - return new SpongeNMSWorld(world); + return getAdapter().getWorld(world); } /** diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfSpaceException.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/AdapterLoadException.java similarity index 66% rename from worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfSpaceException.java rename to worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/AdapterLoadException.java index c5379db5d..957786d64 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/bags/OutOfSpaceException.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/AdapterLoadException.java @@ -17,30 +17,25 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.bags; - +package com.sk89q.worldedit.sponge.adapter; /** - * @deprecated Block bags are currently not a supported feature of WorldEdit + * Thrown when no adapter can be found. */ -@Deprecated -public class OutOfSpaceException extends BlockBagException { +public class AdapterLoadException extends Exception { - private int id; - - /** - * Construct the object. - * - * @param id the type ID - */ - public OutOfSpaceException(int id) { - this.id = id; + public AdapterLoadException() { } - /** - * @return the id - */ - public int getID() { - return id; + public AdapterLoadException(String message) { + super(message); + } + + public AdapterLoadException(String message, Throwable cause) { + super(message, cause); + } + + public AdapterLoadException(Throwable cause) { + super(cause); } } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java new file mode 100644 index 000000000..a134e1ac3 --- /dev/null +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java @@ -0,0 +1,63 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.sponge.adapter; + +import com.flowpowered.math.vector.Vector3d; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.blocks.BaseItemStack; +import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.sponge.SpongeWorld; +import com.sk89q.worldedit.util.Location; +import org.spongepowered.api.entity.Entity; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.world.World; +import org.spongepowered.api.world.biome.BiomeType; + +/** + * An interface for various things that can't be done through the Sponge API. + */ +public interface SpongeImplAdapter { + + /** + * Resolves the numerical ID from this {@link BiomeType} + * + * @param type The biometype + * @return The numerical ID + */ + int resolve(BiomeType type); + + BiomeType resolveBiome(int intID); + + BaseEntity createBaseEntity(Entity entity); + + ItemStack makeSpongeStack(BaseItemStack itemStack); + + SpongeWorld getWorld(World world); + + default boolean isBest() { + return true; + } + + default Location adapt(org.spongepowered.api.world.Location loc, Vector3d rot) { + Vector position = new Vector(loc.getX(), loc.getY(), loc.getZ()); + + return new Location(getWorld(loc.getExtent()), position, (float) rot.getY(), (float) rot.getX()); + } +} diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java new file mode 100644 index 000000000..17c9800ce --- /dev/null +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java @@ -0,0 +1,193 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.sponge.adapter; + +import com.google.common.collect.Lists; +import com.sk89q.worldedit.util.io.Closer; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Loads Sponge implementation adapters. + */ +public class SpongeImplLoader { + + private static final Logger log = Logger.getLogger(SpongeImplLoader.class.getCanonicalName()); + private final List adapterCandidates = new ArrayList<>(); + private String customCandidate; + + private static final String SEARCH_PACKAGE = "com.sk89q.worldedit.sponge.adapter.impl"; + private static final String SEARCH_PACKAGE_DOT = SEARCH_PACKAGE + "."; + private static final String SEARCH_PATH = SEARCH_PACKAGE.replace(".", "/"); + private static final String CLASS_SUFFIX = ".class"; + + private static final String LOAD_ERROR_MESSAGE = + "\n**********************************************\n" + + "** This WorldEdit version does not support your version of Sponge.\n" + + "** WorldEdit will not function! \n" + + "** \n" + + "** Please ensure you are running the latest version\n" + + "**********************************************\n"; + + /** + * Create a new instance. + */ + public SpongeImplLoader() { + addDefaults(); + } + + /** + * Add default candidates, such as any defined with + * {@code -Dworldedit.sponge.adapter}. + */ + private void addDefaults() { + String className = System.getProperty("worldedit.sponge.adapter"); + if (className != null) { + customCandidate = className; + adapterCandidates.add(className); + log.log(Level.INFO, "-Dworldedit.sponge.adapter used to add " + className + " to the list of available Sponge adapters"); + } + } + + /** + * Search the given JAR for candidate implementations. + * + * @param file the file + * @throws IOException thrown on I/O error + */ + public void addFromJar(File file) throws IOException { + Closer closer = Closer.create(); + JarFile jar = closer.register(new JarFile(file)); + try { + Enumeration entries = jar.entries(); + while (entries.hasMoreElements()) { + JarEntry jarEntry = (JarEntry) entries.nextElement(); + + String className = jarEntry.getName().replaceAll("[/\\\\]+", "."); + + if (!className.startsWith(SEARCH_PACKAGE_DOT) || jarEntry.isDirectory() || className.contains("$")) continue; + + int beginIndex = 0; + int endIndex = className.length() - CLASS_SUFFIX.length(); + className = className.substring(beginIndex, endIndex); + adapterCandidates.add(className); + } + } finally { + closer.close(); + } + } + + /** + * Search for classes stored as separate files available via the given + * class loader. + * + * @param classLoader the class loader + * @throws IOException thrown on error + */ + public void addFromPath(ClassLoader classLoader) throws IOException { + Enumeration resources = classLoader.getResources(SEARCH_PATH); + while (resources.hasMoreElements()) { + File file = new File(resources.nextElement().getFile()); + addFromPath(file); + } + } + + /** + * Search for classes stored as separate files available via the given + * path. + * + * @param file the path + */ + private void addFromPath(File file) { + String resource = SEARCH_PACKAGE_DOT + file.getName(); + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (files != null) { + for (File child : files) { + addFromPath(child); + } + } + } else if (resource.endsWith(CLASS_SUFFIX)) { + int beginIndex = 0; + int endIndex = resource.length() - CLASS_SUFFIX.length(); + String className = resource.substring(beginIndex, endIndex); + if (!className.contains("$")) { + adapterCandidates.add(className); + } + } + } + + /** + * Iterate through the list of candidates and load an adapter. + * + * @return an adapter + * @throws AdapterLoadException thrown if no adapter could be found + */ + public SpongeImplAdapter loadAdapter() throws AdapterLoadException { + List suitableAdapters = Lists.newArrayList(); + for (String className : adapterCandidates) { + try { + Class cls = Class.forName(className); + if (SpongeImplAdapter.class.isAssignableFrom(cls)) { + suitableAdapters.add((SpongeImplAdapter) cls.newInstance()); + } else { + log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + + "' because it does not implement " + SpongeImplAdapter.class.getCanonicalName()); + } + } catch (ClassNotFoundException e) { + log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + + "' that is not supposed to be missing", e); + } catch (IllegalAccessException e) { + log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + + "' that is not supposed to be raising this error", e); + } catch (Throwable e) { + if (className.equals(customCandidate)) { + log.log(Level.WARNING, "Failed to load the Sponge adapter class '" + className + "'", e); + } + } + } + + if (suitableAdapters.isEmpty()) { + throw new AdapterLoadException(LOAD_ERROR_MESSAGE); + } else { + if (suitableAdapters.size() == 1) { + return suitableAdapters.get(0); + } else { + return suitableAdapters.stream().sorted((o1, o2) -> { + if (o1.isBest() && !o2.isBest()) { + return -1; + } else if (!o1.isBest() && o2.isBest()) { + return 1; + } + return 0; + }).findFirst().orElse(suitableAdapters.get(0)); + } + } + } +} diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java index 7db17801b..e38140bb4 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java @@ -23,6 +23,7 @@ import com.google.common.reflect.TypeToken; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.session.SessionManager; +import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.snapshot.SnapshotRepository; import ninja.leaping.configurate.ConfigurationOptions; import ninja.leaping.configurate.commented.CommentedConfigurationNode; @@ -57,7 +58,11 @@ public class ConfigurateConfiguration extends LocalConfiguration { } profile = node.getNode("debug").getBoolean(profile); - wandItem = node.getNode("wand-item").getInt(wandItem); + wandItem = node.getNode("wand-item").getString(wandItem); + try { + wandItem = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(wandItem)).getId(); + } catch (Throwable e) { + } defaultChangeLimit = Math.max(-1, node.getNode("limits", "max-blocks-changed", "default").getInt(defaultChangeLimit)); maxChangeLimit = Math.max(-1, node.getNode("limits", "max-blocks-changed", "maximum").getInt(maxChangeLimit)); @@ -73,12 +78,12 @@ public class ConfigurateConfiguration extends LocalConfiguration { butcherMaxRadius = Math.max(-1, node.getNode("limits", "butcher-radius", "maximum").getInt(butcherMaxRadius)); try { - disallowedBlocks = new HashSet<>(node.getNode("limits", "disallowed-blocks").getList(TypeToken.of(Integer.class))); + disallowedBlocks = new HashSet<>(node.getNode("limits", "disallowed-blocks").getList(TypeToken.of(String.class))); } catch (ObjectMappingException e) { logger.warn("Error loading WorldEdit configuration", e); } try { - allowedDataCycleBlocks = new HashSet<>(node.getNode("limits", "allowed-data-cycle-blocks").getList(TypeToken.of(Integer.class))); + allowedDataCycleBlocks = new HashSet<>(node.getNode("limits", "allowed-data-cycle-blocks").getList(TypeToken.of(String.class))); } catch (ObjectMappingException e) { logger.warn("Error loading WorldEdit configuration", e); } @@ -86,6 +91,7 @@ public class ConfigurateConfiguration extends LocalConfiguration { registerHelp = node.getNode("register-help").getBoolean(true); logCommands = node.getNode("logging", "log-commands").getBoolean(logCommands); logFile = node.getNode("logging", "file").getString(logFile); + logFormat = node.getNode("logging", "format").getString(logFormat); superPickaxeDrop = node.getNode("super-pickaxe", "drop-items").getBoolean(superPickaxeDrop); superPickaxeManyDrop = node.getNode("super-pickaxe", "many-drop-items").getBoolean(superPickaxeManyDrop); @@ -96,7 +102,11 @@ public class ConfigurateConfiguration extends LocalConfiguration { useInventoryOverride = node.getNode("use-inventory", "allow-override").getBoolean(useInventoryOverride); useInventoryCreativeOverride = node.getNode("use-inventory", "creative-mode-overrides").getBoolean(useInventoryCreativeOverride); - navigationWand = node.getNode("navigation-wand", "item").getInt(navigationWand); + navigationWand = node.getNode("navigation-wand", "item").getString(navigationWand); + try { + navigationWand = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(navigationWand)).getId(); + } catch (Throwable e) { + } navigationWandMaxDistance = node.getNode("navigation-wand", "max-distance").getInt(navigationWandMaxDistance); navigationUseGlass = node.getNode("navigation", "use-glass").getBoolean(navigationUseGlass); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/IDHelper.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/IDHelper.java deleted file mode 100644 index 52aa06c0c..000000000 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/IDHelper.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.sponge.nms; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.world.biome.BiomeGenBase; -import org.spongepowered.api.block.BlockType; -import org.spongepowered.api.item.ItemType; -import org.spongepowered.api.world.biome.BiomeType; - -@Deprecated -public final class IDHelper { - - private IDHelper() { } - - public static int resolve(ItemType type) { - return Item.getIdFromItem((Item) type); - } - - public static int resolve(BlockType type) { - return Block.getIdFromBlock((Block) type); - } - - public static int resolve(BiomeType type) { - return ((BiomeGenBase) type).biomeID; - } - - public static ItemType resolveItem(int intID) { - return (ItemType) Item.getItemById(intID); - } - - public static BlockType resolveBlock(int intID) { - return (BlockType) Block.getBlockById(intID); - } - - public static BiomeType resolveBiome(int intID) { - return (BiomeType) BiomeGenBase.getBiome(intID); - } -} diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NBTConverter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NBTConverter.java deleted file mode 100644 index 48e8b5da0..000000000 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NBTConverter.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.sponge.nms; - -import com.sk89q.jnbt.*; -import net.minecraft.nbt.*; - -import java.util.*; -import java.util.Map.Entry; - -/** - * Converts between JNBT and Minecraft NBT classes. - */ -@Deprecated -final class NBTConverter { - - private NBTConverter() { - } - - public static NBTBase toNative(Tag tag) { - if (tag instanceof IntArrayTag) { - return toNative((IntArrayTag) tag); - - } else if (tag instanceof ListTag) { - return toNative((ListTag) tag); - - } else if (tag instanceof LongTag) { - return toNative((LongTag) tag); - - } else if (tag instanceof StringTag) { - return toNative((StringTag) tag); - - } else if (tag instanceof IntTag) { - return toNative((IntTag) tag); - - } else if (tag instanceof ByteTag) { - return toNative((ByteTag) tag); - - } else if (tag instanceof ByteArrayTag) { - return toNative((ByteArrayTag) tag); - - } else if (tag instanceof CompoundTag) { - return toNative((CompoundTag) tag); - - } else if (tag instanceof FloatTag) { - return toNative((FloatTag) tag); - - } else if (tag instanceof ShortTag) { - return toNative((ShortTag) tag); - - } else if (tag instanceof DoubleTag) { - return toNative((DoubleTag) tag); - } else { - throw new IllegalArgumentException("Can't convert tag of type " + tag.getClass().getCanonicalName()); - } - } - - public static NBTTagIntArray toNative(IntArrayTag tag) { - int[] value = tag.getValue(); - return new NBTTagIntArray(Arrays.copyOf(value, value.length)); - } - - public static NBTTagList toNative(ListTag tag) { - NBTTagList list = new NBTTagList(); - for (Tag child : tag.getValue()) { - if (child instanceof EndTag) { - continue; - } - list.appendTag(toNative(child)); - } - return list; - } - - public static NBTTagLong toNative(LongTag tag) { - return new NBTTagLong(tag.getValue()); - } - - public static NBTTagString toNative(StringTag tag) { - return new NBTTagString(tag.getValue()); - } - - public static NBTTagInt toNative(IntTag tag) { - return new NBTTagInt(tag.getValue()); - } - - public static NBTTagByte toNative(ByteTag tag) { - return new NBTTagByte(tag.getValue()); - } - - public static NBTTagByteArray toNative(ByteArrayTag tag) { - byte[] value = tag.getValue(); - return new NBTTagByteArray(Arrays.copyOf(value, value.length)); - } - - public static NBTTagCompound toNative(CompoundTag tag) { - NBTTagCompound compound = new NBTTagCompound(); - for (Entry child : tag.getValue().entrySet()) { - compound.setTag(child.getKey(), toNative(child.getValue())); - } - return compound; - } - - public static NBTTagFloat toNative(FloatTag tag) { - return new NBTTagFloat(tag.getValue()); - } - - public static NBTTagShort toNative(ShortTag tag) { - return new NBTTagShort(tag.getValue()); - } - - public static NBTTagDouble toNative(DoubleTag tag) { - return new NBTTagDouble(tag.getValue()); - } - - public static Tag fromNative(NBTBase other) { - if (other instanceof NBTTagIntArray) { - return fromNative((NBTTagIntArray) other); - - } else if (other instanceof NBTTagList) { - return fromNative((NBTTagList) other); - - } else if (other instanceof NBTTagEnd) { - return fromNative((NBTTagEnd) other); - - } else if (other instanceof NBTTagLong) { - return fromNative((NBTTagLong) other); - - } else if (other instanceof NBTTagString) { - return fromNative((NBTTagString) other); - - } else if (other instanceof NBTTagInt) { - return fromNative((NBTTagInt) other); - - } else if (other instanceof NBTTagByte) { - return fromNative((NBTTagByte) other); - - } else if (other instanceof NBTTagByteArray) { - return fromNative((NBTTagByteArray) other); - - } else if (other instanceof NBTTagCompound) { - return fromNative((NBTTagCompound) other); - - } else if (other instanceof NBTTagFloat) { - return fromNative((NBTTagFloat) other); - - } else if (other instanceof NBTTagShort) { - return fromNative((NBTTagShort) other); - - } else if (other instanceof NBTTagDouble) { - return fromNative((NBTTagDouble) other); - } else { - throw new IllegalArgumentException("Can't convert other of type " + other.getClass().getCanonicalName()); - } - } - - public static IntArrayTag fromNative(NBTTagIntArray other) { - int[] value = other.getIntArray(); - return new IntArrayTag(Arrays.copyOf(value, value.length)); - } - - public static ListTag fromNative(NBTTagList other) { - other = (NBTTagList) other.copy(); - List list = new ArrayList(); - Class listClass = StringTag.class; - int tags = other.tagCount(); - for (int i = 0; i < tags; i++) { - Tag child = fromNative(other.removeTag(0)); - list.add(child); - listClass = child.getClass(); - } - return new ListTag(listClass, list); - } - - public static EndTag fromNative(NBTTagEnd other) { - return new EndTag(); - } - - public static LongTag fromNative(NBTTagLong other) { - return new LongTag(other.getLong()); - } - - public static StringTag fromNative(NBTTagString other) { - return new StringTag(other.getString()); - } - - public static IntTag fromNative(NBTTagInt other) { - return new IntTag(other.getInt()); - } - - public static ByteTag fromNative(NBTTagByte other) { - return new ByteTag(other.getByte()); - } - - public static ByteArrayTag fromNative(NBTTagByteArray other) { - byte[] value = other.getByteArray(); - return new ByteArrayTag(Arrays.copyOf(value, value.length)); - } - - public static CompoundTag fromNative(NBTTagCompound other) { - @SuppressWarnings("unchecked") Set tags = other.getKeySet(); - Map map = new HashMap(); - for (String tagName : tags) { - map.put(tagName, fromNative(other.getTag(tagName))); - } - return new CompoundTag(map); - } - - public static FloatTag fromNative(NBTTagFloat other) { - return new FloatTag(other.getFloat()); - } - - public static ShortTag fromNative(NBTTagShort other) { - return new ShortTag(other.getShort()); - } - - public static DoubleTag fromNative(NBTTagDouble other) { - return new DoubleTag(other.getDouble()); - } - -} diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NMSHelper.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NMSHelper.java deleted file mode 100644 index 4917c1f68..000000000 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/NMSHelper.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.sponge.nms; - -import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.entity.BaseEntity; -import net.minecraft.item.Item; -import net.minecraft.nbt.NBTTagCompound; -import org.spongepowered.api.entity.Entity; -import org.spongepowered.api.item.inventory.ItemStack; - -import java.util.Map; - -@Deprecated -public final class NMSHelper { - - private NMSHelper() { } - - public static ItemStack makeSpongeStack(BaseItemStack itemStack) { - net.minecraft.item.ItemStack newStack = new net.minecraft.item.ItemStack(Item.getItemById(itemStack.getType()), itemStack.getAmount(), itemStack.getData()); - for (Map.Entry entry : itemStack.getEnchantments().entrySet()) { - newStack.addEnchantment(net.minecraft.enchantment.Enchantment.getEnchantmentById(entry.getKey()), entry.getValue()); - } - return (ItemStack) (Object) newStack; - } - - public static BaseEntity createBaseEntity(Entity entity) { - String id = entity.getType().getId(); - NBTTagCompound tag = new NBTTagCompound(); - ((net.minecraft.entity.Entity) entity).writeToNBT(tag); - return new BaseEntity(id, NBTConverter.fromNative(tag)); - } -} diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/SpongeNMSWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/SpongeNMSWorld.java deleted file mode 100644 index 4e1c38d23..000000000 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/SpongeNMSWorld.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.sponge.nms; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.LazyBlock; -import com.sk89q.worldedit.entity.BaseEntity; -import com.sk89q.worldedit.internal.Constants; -import com.sk89q.worldedit.sponge.SpongeWorld; -import com.sk89q.worldedit.util.TreeGenerator; -import net.minecraft.block.*; -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; -import net.minecraft.inventory.IInventory; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagInt; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.world.gen.feature.*; -import org.spongepowered.api.block.BlockState; -import org.spongepowered.api.entity.Entity; -import org.spongepowered.api.world.Location; -import org.spongepowered.api.world.World; - -import javax.annotation.Nullable; - -import static com.google.common.base.Preconditions.checkNotNull; - -@Deprecated -public class SpongeNMSWorld extends SpongeWorld { - - private static final IBlockState JUNGLE_LOG = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); - private static final IBlockState JUNGLE_LEAF = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); - private static final IBlockState JUNGLE_SHRUB = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); - - /** - * Construct a new world. - * - * @param world the world - */ - public SpongeNMSWorld(World world) { - super(world); - } - - @Override - protected BlockState getBlockState(BaseBlock block) { - return (BlockState) Block.getBlockById(block.getId()).getStateFromMeta(block.getData()); - } - - private NBTTagCompound updateForSet(NBTTagCompound tag, Vector position) { - checkNotNull(tag); - checkNotNull(position); - - tag.setTag("x", new NBTTagInt(position.getBlockX())); - tag.setTag("y", new NBTTagInt(position.getBlockY())); - tag.setTag("z", new NBTTagInt(position.getBlockZ())); - - return tag; - } - - @Override - protected void applyTileEntityData(org.spongepowered.api.block.tileentity.TileEntity entity, BaseBlock block) { - NBTTagCompound tag = NBTConverter.toNative(block.getNbtData()); - - Location loc = entity.getLocation(); - - updateForSet(tag, new Vector(loc.getX(), loc.getY(), loc.getZ())); - ((TileEntity) entity).readFromNBT(tag); - } - - @Override - protected void applyEntityData(Entity entity, BaseEntity data) { - NBTTagCompound tag = NBTConverter.toNative(data.getNbtData()); - for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { - tag.removeTag(name); - } - ((net.minecraft.entity.Entity) entity).readFromNBT(tag); - } - - @Override - public boolean clearContainerBlockContents(Vector position) { - BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - TileEntity tile =((net.minecraft.world.World) getWorld()).getTileEntity(pos); - if (tile instanceof IInventory) { - IInventory inv = (IInventory) tile; - int size = inv.getSizeInventory(); - for (int i = 0; i < size; i++) { - inv.setInventorySlotContents(i, null); - } - return true; - } - return false; - } - - @Nullable - private static WorldGenerator createWorldGenerator(TreeGenerator.TreeType type) { - switch (type) { - case TREE: return new WorldGenTrees(true); - case BIG_TREE: return new WorldGenBigTree(true); - case REDWOOD: return new WorldGenTaiga2(true); - case TALL_REDWOOD: return new WorldGenTaiga1(); - case BIRCH: return new WorldGenForest(true, false); - case JUNGLE: return new WorldGenMegaJungle(true, 10, 20, JUNGLE_LOG, JUNGLE_LEAF); - case SMALL_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, false); - case SHORT_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, true); - case JUNGLE_BUSH: return new WorldGenShrub(JUNGLE_LOG, JUNGLE_SHRUB); - case RED_MUSHROOM: return new WorldGenBigMushroom(Blocks.brown_mushroom_block); - case BROWN_MUSHROOM: return new WorldGenBigMushroom(Blocks.red_mushroom_block); - case SWAMP: return new WorldGenSwamp(); - case ACACIA: return new WorldGenSavannaTree(true); - case DARK_OAK: return new WorldGenCanopyTree(true); - case MEGA_REDWOOD: return new WorldGenMegaPineTree(false, random.nextBoolean()); - case TALL_BIRCH: return new WorldGenForest(true, true); - case RANDOM: - case PINE: - case RANDOM_REDWOOD: - default: - return null; - } - } - - @Override - public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector pos) throws MaxChangedBlocksException { - WorldGenerator generator = createWorldGenerator(type); - return generator != null && generator.generate((net.minecraft.world.World) getWorld(), random, new BlockPos(pos.getX(), pos.getY(), pos.getZ())); - } - - @Override - public BaseBlock getBlock(Vector position) { - World world = getWorld(); - BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - IBlockState state = ((net.minecraft.world.World) world).getBlockState(pos); - TileEntity tile = ((net.minecraft.world.World) world).getTileEntity(pos); - - if (tile != null) { - return new TileEntityBaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), tile); - } else { - return new BaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state)); - } - } - - @Override - public BaseBlock getLazyBlock(Vector position) { - World world = getWorld(); - BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - IBlockState state = ((net.minecraft.world.World) world).getBlockState(pos); - return new LazyBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), this, position); - } -} diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityBaseBlock.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityBaseBlock.java deleted file mode 100644 index 524d680de..000000000 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityBaseBlock.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.sponge.nms; - -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.TileEntityBlock; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -@Deprecated -public class TileEntityBaseBlock extends BaseBlock implements TileEntityBlock { - - public TileEntityBaseBlock(int type, int data, TileEntity tile) { - super(type, data); - setNbtData(NBTConverter.fromNative(copyNbtData(tile))); - } - - private static NBTTagCompound copyNbtData(TileEntity tile) { - NBTTagCompound tag = new NBTTagCompound(); - tile.writeToNBT(tag); - return tag; - } - -} \ No newline at end of file diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityUtils.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityUtils.java deleted file mode 100644 index 357cf53ad..000000000 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/nms/TileEntityUtils.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.sponge.nms; - -import com.sk89q.worldedit.Vector; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagInt; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -import javax.annotation.Nullable; -import java.lang.reflect.Constructor; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Utility methods for setting tile entities in the world. - */ -@Deprecated -final class TileEntityUtils { - - private TileEntityUtils() { - } - - /** - * Update the given tag compound with position information. - * - * @param tag the tag - * @param position the position - * @return a tag compound - */ - private static NBTTagCompound updateForSet(NBTTagCompound tag, Vector position) { - checkNotNull(tag); - checkNotNull(position); - - tag.setTag("x", new NBTTagInt(position.getBlockX())); - tag.setTag("y", new NBTTagInt(position.getBlockY())); - tag.setTag("z", new NBTTagInt(position.getBlockZ())); - - return tag; - } - - /** - * Set a tile entity at the given location. - * - * @param world the world - * @param position the position - * @param clazz the tile entity class - * @param tag the tag for the tile entity (may be null to not set NBT data) - */ - static void setTileEntity(World world, Vector position, Class clazz, @Nullable NBTTagCompound tag) { - checkNotNull(world); - checkNotNull(position); - checkNotNull(clazz); - - TileEntity tileEntity = constructTileEntity(world, position, clazz); - - if (tileEntity == null) { - return; - } - - if (tag != null) { - // Set X, Y, Z - updateForSet(tag, position); - tileEntity.readFromNBT(tag); - } - - world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity); - } - - /** - * Set a tile entity at the given location using the tile entity ID from - * the tag. - * - * @param world the world - * @param position the position - * @param tag the tag for the tile entity (may be null to do nothing) - */ - static void setTileEntity(World world, Vector position, @Nullable NBTTagCompound tag) { - if (tag != null) { - updateForSet(tag, position); - TileEntity tileEntity = TileEntity.createAndLoadEntity(tag); - if (tileEntity != null) { - world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity); - } - } - } - - /** - * Construct a tile entity from the given class. - * - * @param world the world - * @param position the position - * @param clazz the class - * @return a tile entity (may be null if it failed) - */ - @Nullable - static TileEntity constructTileEntity(World world, Vector position, Class clazz) { - Constructor baseConstructor; - try { - baseConstructor = clazz.getConstructor(); // creates "blank" TE - } catch (Throwable e) { - return null; // every TE *should* have this constructor, so this isn't necessary - } - - TileEntity genericTE; - try { - // Downcast here for return while retaining the type - genericTE = (TileEntity) baseConstructor.newInstance(); - } catch (Throwable e) { - return null; - } - - /* - genericTE.blockType = Block.blocksList[block.getId()]; - genericTE.blockMetadata = block.getData(); - genericTE.xCoord = pt.getBlockX(); - genericTE.yCoord = pt.getBlockY(); - genericTE.zCoord = pt.getBlockZ(); - genericTE.worldObj = world; - */ // handled by internal code - - return genericTE; - } - - -} diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl$1.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl$1.class new file mode 100644 index 000000000..0194fc40b Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl$1.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl$SpongeNMSWorld.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl$SpongeNMSWorld.class new file mode 100644 index 000000000..3b24d6c4d Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl$SpongeNMSWorld.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl$TileEntityBaseBlock.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl$TileEntityBaseBlock.class new file mode 100644 index 000000000..247fa0d3a Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl$TileEntityBaseBlock.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl.class new file mode 100644 index 000000000..456c101a4 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_10_Impl.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl$1.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl$1.class new file mode 100644 index 000000000..954d9f03a Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl$1.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl$SpongeNMSWorld.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl$SpongeNMSWorld.class new file mode 100644 index 000000000..ab33bdfa7 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl$SpongeNMSWorld.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl$TileEntityBaseBlock.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl$TileEntityBaseBlock.class new file mode 100644 index 000000000..05f63946b Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl$TileEntityBaseBlock.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl.class new file mode 100644 index 000000000..f26ed1ec6 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_2_Impl.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl$1.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl$1.class new file mode 100644 index 000000000..5b7177726 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl$1.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl$SpongeNMSWorld.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl$SpongeNMSWorld.class new file mode 100644 index 000000000..4da53c21f Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl$SpongeNMSWorld.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl$TileEntityBaseBlock.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl$TileEntityBaseBlock.class new file mode 100644 index 000000000..0f0a4f1e8 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl$TileEntityBaseBlock.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl.class new file mode 100644 index 000000000..61273203f Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_11_Impl.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl$1.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl$1.class new file mode 100644 index 000000000..256a05661 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl$1.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl$SpongeNMSWorld.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl$SpongeNMSWorld.class new file mode 100644 index 000000000..61ce0a7db Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl$SpongeNMSWorld.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl$TileEntityBaseBlock.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl$TileEntityBaseBlock.class new file mode 100644 index 000000000..1c5b4c31c Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl$TileEntityBaseBlock.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl.class new file mode 100644 index 000000000..cdc162c16 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_1_Impl.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl$1.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl$1.class new file mode 100644 index 000000000..cb18d7835 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl$1.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl$SpongeNMSWorld.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl$SpongeNMSWorld.class new file mode 100644 index 000000000..a684ee39b Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl$SpongeNMSWorld.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl$TileEntityBaseBlock.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl$TileEntityBaseBlock.class new file mode 100644 index 000000000..52178975f Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl$TileEntityBaseBlock.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl.class new file mode 100644 index 000000000..6ac56f5fb Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_2_Impl.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl$1.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl$1.class new file mode 100644 index 000000000..d3e8da114 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl$1.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl$SpongeNMSWorld.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl$SpongeNMSWorld.class new file mode 100644 index 000000000..69e7875f2 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl$SpongeNMSWorld.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl$TileEntityBaseBlock.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl$TileEntityBaseBlock.class new file mode 100644 index 000000000..2a5b4e62a Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl$TileEntityBaseBlock.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl.class new file mode 100644 index 000000000..45e6a76bf Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_1_12_Impl.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl$1.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl$1.class new file mode 100644 index 000000000..dcd0e9bb1 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl$1.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl$SpongeNMSWorld.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl$SpongeNMSWorld.class new file mode 100644 index 000000000..00fad03ee Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl$SpongeNMSWorld.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl$TileEntityBaseBlock.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl$TileEntityBaseBlock.class new file mode 100644 index 000000000..8f7f5118a Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl$TileEntityBaseBlock.class differ diff --git a/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl.class b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl.class new file mode 100644 index 000000000..ad7408135 Binary files /dev/null and b/worldedit-sponge/src/main/resources/com/sk89q/worldedit/sponge/adapter/impl/Sponge_Dev_Impl.class differ