Further modernise and remove legacy item classes

Dieser Commit ist enthalten in:
Matthew Miller 2018-06-17 17:50:04 +10:00
Ursprung c43109bde5
Commit e2608bc0c9
35 geänderte Dateien mit 392 neuen und 1045 gelöschten Zeilen

Datei anzeigen

@ -23,11 +23,13 @@ import com.sk89q.util.StringUtil;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; import com.sk89q.worldedit.extension.platform.AbstractPlayerActor;
import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -55,14 +57,18 @@ public class BukkitPlayer extends AbstractPlayerActor {
} }
@Override @Override
public int getItemInHand() { public BaseItemStack getItemInHand(HandSide handSide) {
ItemStack itemStack = player.getItemInHand(); ItemStack itemStack = handSide == HandSide.MAIN_HAND
return itemStack != null ? itemStack.getTypeId() : 0; ? player.getInventory().getItemInMainHand()
: player.getInventory().getItemInOffHand();
return BukkitUtil.toBaseItemStack(itemStack);
} }
@Override @Override
public BaseBlock getBlockInHand() throws WorldEditException { public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException {
ItemStack itemStack = player.getItemInHand(); ItemStack itemStack = handSide == HandSide.MAIN_HAND
? player.getInventory().getItemInMainHand()
: player.getInventory().getItemInOffHand();
return BukkitUtil.toBlock(getWorld(), itemStack); return BukkitUtil.toBlock(getWorld(), itemStack);
} }

Datei anzeigen

@ -22,7 +22,6 @@ package com.sk89q.worldedit.bukkit;
import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.ItemType;
import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.extent.inventory.BlockBagException; import com.sk89q.worldedit.extent.inventory.BlockBagException;
import com.sk89q.worldedit.extent.inventory.OutOfBlocksException; import com.sk89q.worldedit.extent.inventory.OutOfBlocksException;
@ -65,11 +64,11 @@ public class BukkitPlayerBlockBag extends BlockBag {
@Override @Override
public void fetchItem(BaseItem item) throws BlockBagException { public void fetchItem(BaseItem item) throws BlockBagException {
final int id = item.getType(); final int id = item.getLegacyId();
final int damage = item.getData(); final int damage = item.getData();
int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1; int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1;
assert(amount == 1); assert(amount == 1);
boolean usesDamageValue = ItemType.usesDamageValue(id); boolean usesDamageValue = true;// TODO ItemType.usesDamageValue(id);
if (id == BlockID.AIR) { if (id == BlockID.AIR) {
throw new IllegalArgumentException("Can't fetch air block"); throw new IllegalArgumentException("Can't fetch air block");
@ -120,11 +119,11 @@ public class BukkitPlayerBlockBag extends BlockBag {
@Override @Override
public void storeItem(BaseItem item) throws BlockBagException { public void storeItem(BaseItem item) throws BlockBagException {
final int id = item.getType(); final int id = item.getLegacyId();
final int damage = item.getData(); final int damage = item.getData();
int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1; int amount = (item instanceof BaseItemStack) ? ((BaseItemStack) item).getAmount() : 1;
assert(amount <= 64); assert(amount <= 64);
boolean usesDamageValue = ItemType.usesDamageValue(id); boolean usesDamageValue = true; //TODO ItemType.usesDamageValue(id);
if (id == BlockID.AIR) { if (id == BlockID.AIR) {
throw new IllegalArgumentException("Can't store air block"); throw new IllegalArgumentException("Can't store air block");

Datei anzeigen

@ -24,6 +24,7 @@ import com.sk89q.worldedit.NotABlockException;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.blocks.ItemID; import com.sk89q.worldedit.blocks.ItemID;
@ -152,4 +153,8 @@ public final class BukkitUtil {
throw new NotABlockException(typeId); throw new NotABlockException(typeId);
} }
public static BaseItemStack toBaseItemStack(ItemStack itemStack) {
return new BaseItemStack(itemStack.getTypeId(), itemStack.getDurability());
}
} }

Datei anzeigen

@ -324,7 +324,7 @@ public class BukkitWorld extends AbstractWorld {
@Override @Override
public void dropItem(Vector pt, BaseItemStack item) { public void dropItem(Vector pt, BaseItemStack item) {
World world = getWorld(); World world = getWorld();
ItemStack bukkitItem = new ItemStack(item.getType(), item.getAmount(), ItemStack bukkitItem = new ItemStack(item.getLegacyId(), item.getAmount(),
item.getData()); item.getData());
world.dropItemNaturally(BukkitUtil.toLocation(world, pt), bukkitItem); world.dropItemNaturally(BukkitUtil.toLocation(world, pt), bukkitItem);
} }

Datei anzeigen

@ -19,8 +19,8 @@
package com.sk89q.worldedit; package com.sk89q.worldedit;
import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.type.BlockTypes;
import com.sk89q.worldedit.blocks.ItemID; import com.sk89q.worldedit.blocks.type.ItemTypes;
import com.sk89q.worldedit.util.logging.LogFormat; import com.sk89q.worldedit.util.logging.LogFormat;
import com.sk89q.worldedit.world.snapshot.SnapshotRepository; import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
@ -33,53 +33,73 @@ import java.util.Set;
*/ */
public abstract class LocalConfiguration { public abstract class LocalConfiguration {
protected static final int[] defaultDisallowedBlocks = new int[] { protected static final String[] defaultDisallowedBlocks = new String[] {
// dangerous stuff (physics/drops items) // dangerous stuff (physics/drops items)
BlockID.SAPLING, BlockTypes.OAK_SAPLING.getId(),
BlockID.BED, BlockTypes.JUNGLE_SAPLING.getId(),
BlockID.POWERED_RAIL, BlockTypes.DARK_OAK_SAPLING.getId(),
BlockID.DETECTOR_RAIL, BlockTypes.SPRUCE_SAPLING.getId(),
BlockID.LONG_GRASS, BlockTypes.BIRCH_SAPLING.getId(),
BlockID.DEAD_BUSH, BlockTypes.ACACIA_SAPLING.getId(),
BlockID.PISTON_EXTENSION, BlockTypes.BLACK_BED.getId(),
BlockID.PISTON_MOVING_PIECE, BlockTypes.BLUE_BED.getId(),
BlockID.YELLOW_FLOWER, BlockTypes.BROWN_BED.getId(),
BlockID.RED_FLOWER, BlockTypes.CYAN_BED.getId(),
BlockID.BROWN_MUSHROOM, BlockTypes.GRAY_BED.getId(),
BlockID.RED_MUSHROOM, BlockTypes.GREEN_BED.getId(),
BlockID.TNT, BlockTypes.LIGHT_BLUE_BED.getId(),
BlockID.TORCH, BlockTypes.LIGHT_GRAY_BED.getId(),
BlockID.FIRE, BlockTypes.LIME_BED.getId(),
BlockID.REDSTONE_WIRE, BlockTypes.MAGENTA_BED.getId(),
BlockID.CROPS, BlockTypes.ORANGE_BED.getId(),
BlockID.MINECART_TRACKS, BlockTypes.PINK_BED.getId(),
BlockID.LEVER, BlockTypes.PURPLE_BED.getId(),
BlockID.REDSTONE_TORCH_OFF, BlockTypes.RED_BED.getId(),
BlockID.REDSTONE_TORCH_ON, BlockTypes.WHITE_BED.getId(),
BlockID.REDSTONE_REPEATER_OFF, BlockTypes.YELLOW_BED.getId(),
BlockID.REDSTONE_REPEATER_ON, BlockTypes.POWERED_RAIL.getId(),
BlockID.STONE_BUTTON, BlockTypes.DETECTOR_RAIL.getId(),
BlockID.CACTUS, BlockTypes.GRASS.getId(),
BlockID.REED, 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 // ores and stuff
BlockID.BEDROCK, BlockTypes.BEDROCK.getId(),
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.
}; };
public boolean profile = false; public boolean profile = false;
public Set<Integer> disallowedBlocks = new HashSet<>(); public Set<String> disallowedBlocks = new HashSet<>();
public int defaultChangeLimit = -1; public int defaultChangeLimit = -1;
public int maxChangeLimit = -1; public int maxChangeLimit = -1;
public int defaultMaxPolygonalPoints = -1; public int defaultMaxPolygonalPoints = -1;
@ -95,7 +115,7 @@ public abstract class LocalConfiguration {
public String logFile = ""; public String logFile = "";
public String logFormat = LogFormat.DEFAULT_FORMAT; public String logFormat = LogFormat.DEFAULT_FORMAT;
public boolean registerHelp = true; // what is the point of this, it's not even used 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 superPickaxeDrop = true;
public boolean superPickaxeManyDrop = true; public boolean superPickaxeManyDrop = true;
public boolean noDoubleSlash = false; public boolean noDoubleSlash = false;
@ -103,7 +123,7 @@ public abstract class LocalConfiguration {
public boolean useInventoryOverride = false; public boolean useInventoryOverride = false;
public boolean useInventoryCreativeOverride = false; public boolean useInventoryCreativeOverride = false;
public boolean navigationUseGlass = true; public boolean navigationUseGlass = true;
public int navigationWand = ItemID.COMPASS; public String navigationWand = ItemTypes.COMPASS.getId();
public int navigationWandMaxDistance = 50; public int navigationWandMaxDistance = 50;
public int scriptTimeout = 3000; public int scriptTimeout = 3000;
public Set<Integer> allowedDataCycleBlocks = new HashSet<>(); public Set<Integer> allowedDataCycleBlocks = new HashSet<>();

Datei anzeigen

@ -25,6 +25,8 @@ import com.sk89q.jchronic.Chronic;
import com.sk89q.jchronic.Options; import com.sk89q.jchronic.Options;
import com.sk89q.jchronic.utils.Span; import com.sk89q.jchronic.utils.Span;
import com.sk89q.jchronic.utils.Time; import com.sk89q.jchronic.utils.Time;
import com.sk89q.worldedit.blocks.type.ItemType;
import com.sk89q.worldedit.blocks.type.ItemTypes;
import com.sk89q.worldedit.command.tool.BlockTool; import com.sk89q.worldedit.command.tool.BlockTool;
import com.sk89q.worldedit.command.tool.BrushTool; import com.sk89q.worldedit.command.tool.BrushTool;
import com.sk89q.worldedit.command.tool.InvalidToolBindException; import com.sk89q.worldedit.command.tool.InvalidToolBindException;
@ -76,7 +78,7 @@ public class LocalSession {
private transient boolean toolControl = true; private transient boolean toolControl = true;
private transient boolean superPickaxe = false; private transient boolean superPickaxe = false;
private transient BlockTool pickaxeMode = new SinglePickaxe(); private transient BlockTool pickaxeMode = new SinglePickaxe();
private transient Map<Integer, Tool> tools = new HashMap<>(); private transient Map<ItemType, Tool> tools = new HashMap<>();
private transient int maxBlocksChanged = -1; private transient int maxBlocksChanged = -1;
private transient boolean useInventory; private transient boolean useInventory;
private transient Snapshot snapshot; private transient Snapshot snapshot;
@ -517,11 +519,11 @@ public class LocalSession {
/** /**
* Get the tool assigned to the item. * 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} * @return the tool, which may be {@link null}
*/ */
@Nullable @Nullable
public Tool getTool(int item) { public Tool getTool(ItemType item) {
return tools.get(item); return tools.get(item);
} }
@ -530,14 +532,14 @@ public class LocalSession {
* or the tool is not assigned, the slot will be replaced with the * or the tool is not assigned, the slot will be replaced with the
* brush tool. * brush tool.
* *
* @param item the item type ID * @param item the item type
* @return the tool, or {@code null} * @return the tool, or {@code null}
* @throws InvalidToolBindException if the item can't be bound to that item * @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); Tool tool = getTool(item);
if (tool == null || !(tool instanceof BrushTool)) { if (!(tool instanceof BrushTool)) {
tool = new BrushTool("worldedit.brush.sphere"); tool = new BrushTool("worldedit.brush.sphere");
setTool(item, tool); setTool(item, tool);
} }
@ -548,16 +550,16 @@ public class LocalSession {
/** /**
* Set the tool. * 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} * @param tool the tool to set, which can be {@code null}
* @throws InvalidToolBindException if the item can't be bound to that item * @throws InvalidToolBindException if the item can't be bound to that item
*/ */
public void setTool(int item, @Nullable Tool tool) throws InvalidToolBindException { public void setTool(ItemType item, @Nullable Tool tool) throws InvalidToolBindException {
if (item > 0 && item < 255) { if (false /*TODO item > 0 && item < 255*/) {
throw new InvalidToolBindException(item, "Blocks can't be used"); throw new InvalidToolBindException(item, "Blocks can't be used");
} else if (item == config.wandItem) { } else if (item == ItemTypes.getItemType(config.wandItem)) {
throw new InvalidToolBindException(item, "Already used for the wand"); throw new InvalidToolBindException(item, "Already used for the wand");
} else if (item == config.navigationWand) { } else if (item == ItemTypes.getItemType(config.navigationWand)) {
throw new InvalidToolBindException(item, "Already used for the navigation wand"); throw new InvalidToolBindException(item, "Already used for the navigation wand");
} }

Datei anzeigen

@ -65,7 +65,7 @@ public class BaseItem {
*/ */
@Deprecated @Deprecated
public BaseItem(int id, short data) { public BaseItem(int id, short data) {
setType(id); setLegacyId(id);
this.damage = data; this.damage = data;
} }
@ -86,7 +86,7 @@ public class BaseItem {
* @return the id * @return the id
*/ */
@Deprecated @Deprecated
public int getType() { public int getLegacyId() {
return this.itemType.getLegacyId(); return this.itemType.getLegacyId();
} }
@ -96,9 +96,18 @@ public class BaseItem {
* @param id the id to set * @param id the id to set
*/ */
@Deprecated @Deprecated
public void setType(int id) { public void setLegacyId(int id) {
ItemType type = ItemTypes.getItemType(BundledItemData.getInstance().fromLegacyId(id)); ItemType type = ItemTypes.getItemType(BundledItemData.getInstance().fromLegacyId(id));
setItemType(type); setType(type);
}
/**
* Get the type of item.
*
* @return the type
*/
public ItemType getType() {
return this.itemType;
} }
/** /**
@ -106,7 +115,7 @@ public class BaseItem {
* *
* @param itemType The type to set * @param itemType The type to set
*/ */
public void setItemType(ItemType itemType) { public void setType(ItemType itemType) {
this.itemType = itemType; this.itemType = itemType;
} }

Datei anzeigen

@ -1633,24 +1633,6 @@ public enum BlockType {
} }
} }
/**
* 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. * Get the block drop for this type given a data value.
* *

Datei anzeigen

@ -1,790 +0,0 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* 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 <http://www.gnu.org/licenses/>.
*/
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.
*
* {@Deprecated Please use {@link com.sk89q.worldedit.blocks.type.ItemType}}
*/
@Deprecated
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_WHITE(BlockID.SHULKER_BOX_WHITE, "White Shulker Box", "shulkerboxwhite"),
SHULKER_BOX_ORANGE(BlockID.SHULKER_BOX_ORANGE, "Orange Shulker Box", "shulkerboxorange"),
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"),
TERRACOTTA_WHITE(BlockID.TERRACOTTA_WHITE, "White Terracotta", "terracottawhite"),
TERRACOTTA_ORANGE(BlockID.TERRACOTTA_ORANGE, "Orange Terracotta", "terracottaorange"),
TERRACOTTA_MAGENTA(BlockID.TERRACOTTA_MAGENTA, "Magenta Terracotta", "terracottamagenta"),
TERRACOTTA_LIGHT_BLUE(BlockID.TERRACOTTA_LIGHT_BLUE, "Light Blue Terracotta", "terracottalightblue"),
TERRACOTTA_YELLOW(BlockID.TERRACOTTA_YELLOW, "Yellow Terracotta", "terracottayellow"),
TERRACOTTA_LIME(BlockID.TERRACOTTA_LIME, "Lime Terracotta", "terracottalime"),
TERRACOTTA_PINK(BlockID.TERRACOTTA_PINK, "Pink Terracotta", "terracottapink"),
TERRACOTTA_GRAY(BlockID.TERRACOTTA_GRAY, "Gray Terracotta", "terracottagray"),
TERRACOTTA_LIGHT_GRAY(BlockID.TERRACOTTA_LIGHT_GRAY, "Light Gray Terracotta", "terracottalightgray"),
TERRACOTTA_CYAN(BlockID.TERRACOTTA_CYAN, "Cyan Terracotta", "terracottacyan"),
TERRACOTTA_PURPLE(BlockID.TERRACOTTA_PURPLE, "Purple Terracotta", "terracottapurple"),
TERRACOTTA_BLUE(BlockID.TERRACOTTA_BLUE, "Blue Terracotta", "terracottablue"),
TERRACOTTA_BROWN(BlockID.TERRACOTTA_BROWN, "Brown Terracotta", "terracottabrown"),
TERRACOTTA_GREEN(BlockID.TERRACOTTA_GREEN, "Green Terracotta", "terracottagreen"),
TERRACOTTA_RED(BlockID.TERRACOTTA_RED, "Red Terracotta", "terracottared"),
TERRACOTTA_BLACK(BlockID.TERRACOTTA_BLACK, "Black Terracotta", "terracottablack"),
CONCRETE(BlockID.CONCRETE, "Concrete", "concrete"),
CONCRETE_POWDER(BlockID.CONCRETE_POWDER, "Concrete Powder", "concretepowder"),
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"),
IRON_NUGGET(ItemID.IRON_NUGGET, "Iron Nugget", "ironnugget"),
KNOWLEDGE_BOOK(ItemID.KNOWLEDGE_BOOK, "Knowledge Book", "knowledgebook", "recipebook"),
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<Integer, ItemType> ids = new HashMap<>();
/**
* Stores a map of the names for fast access.
*/
private static final Map<String, ItemType> 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.
*
* <p>If the item type is not null, the numeric ID will be returned.</p>
*
* @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.
*
* <p>If the item type is not null, the numeric ID will be returned.</p>
*
* @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<Integer> 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<Integer> 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(BlockID.CONCRETE);
usesDamageValue.add(BlockID.CONCRETE_POWDER);
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.BED_ITEM);
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);
}
}

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit.blocks.type; package com.sk89q.worldedit.blocks.type;
import com.sk89q.worldedit.world.registry.BundledBlockData;
import com.sk89q.worldedit.world.registry.BundledItemData; import com.sk89q.worldedit.world.registry.BundledItemData;
public class ItemType { public class ItemType {
@ -37,6 +38,20 @@ public class ItemType {
return this.id; 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 the legacy ID. Needed for legacy reasons. * Gets the legacy ID. Needed for legacy reasons.
* *

Datei anzeigen

@ -20,6 +20,7 @@
package com.sk89q.worldedit.blocks.type; package com.sk89q.worldedit.blocks.type;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -772,4 +773,8 @@ public class ItemTypes {
} }
return itemMapping.get(id); return itemMapping.get(id);
} }
public static Collection<ItemType> values() {
return itemMapping.values();
}
} }

Datei anzeigen

@ -46,6 +46,7 @@ import com.sk89q.worldedit.function.mask.BlockMask;
import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.BlockPattern;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.session.ClipboardHolder; 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.binding.Switch;
import com.sk89q.worldedit.util.command.parametric.Optional; import com.sk89q.worldedit.util.command.parametric.Optional;
@ -84,7 +85,7 @@ public class BrushCommands {
@Optional("2") double radius, @Switch('h') boolean hollow) throws WorldEditException { @Optional("2") double radius, @Switch('h') boolean hollow) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
BrushTool tool = session.getBrushTool(player.getItemInHand()); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
tool.setFill(fill); tool.setFill(fill);
tool.setSize(radius); tool.setSize(radius);
@ -114,7 +115,7 @@ public class BrushCommands {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
worldEdit.checkMaxBrushRadius(height); worldEdit.checkMaxBrushRadius(height);
BrushTool tool = session.getBrushTool(player.getItemInHand()); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
tool.setFill(fill); tool.setFill(fill);
tool.setSize(radius); tool.setSize(radius);
@ -149,7 +150,7 @@ public class BrushCommands {
worldEdit.checkMaxBrushRadius(size.getBlockY()); worldEdit.checkMaxBrushRadius(size.getBlockY());
worldEdit.checkMaxBrushRadius(size.getBlockZ()); 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"); tool.setBrush(new ClipboardBrush(holder, ignoreAir, usingOrigin), "worldedit.brush.clipboard");
player.print("Clipboard brush shape equipped."); player.print("Clipboard brush shape equipped.");
@ -173,7 +174,7 @@ public class BrushCommands {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
BrushTool tool = session.getBrushTool(player.getItemInHand()); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
tool.setSize(radius); tool.setSize(radius);
tool.setBrush(new SmoothBrush(iterations, naturalBlocksOnly), "worldedit.brush.smooth"); tool.setBrush(new SmoothBrush(iterations, naturalBlocksOnly), "worldedit.brush.smooth");
@ -192,7 +193,7 @@ public class BrushCommands {
public void extinguishBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius) throws WorldEditException { public void extinguishBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
BrushTool tool = session.getBrushTool(player.getItemInHand()); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
Pattern fill = new BlockPattern(new BaseBlock(BlockTypes.AIR)); Pattern fill = new BlockPattern(new BaseBlock(BlockTypes.AIR));
tool.setFill(fill); tool.setFill(fill);
tool.setSize(radius); tool.setSize(radius);
@ -218,7 +219,7 @@ public class BrushCommands {
public void gravityBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius, @Switch('h') boolean fromMaxY) throws WorldEditException { public void gravityBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius, @Switch('h') boolean fromMaxY) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
BrushTool tool = session.getBrushTool(player.getItemInHand()); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
tool.setSize(radius); tool.setSize(radius);
tool.setBrush(new GravityBrush(fromMaxY), "worldedit.brush.gravity"); tool.setBrush(new GravityBrush(fromMaxY), "worldedit.brush.gravity");
@ -265,7 +266,7 @@ public class BrushCommands {
CreatureButcher flags = new CreatureButcher(player); CreatureButcher flags = new CreatureButcher(player);
flags.fromCommand(args); flags.fromCommand(args);
BrushTool tool = session.getBrushTool(player.getItemInHand()); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
tool.setSize(radius); tool.setSize(radius);
tool.setBrush(new ButcherBrush(flags), "worldedit.brush.butcher"); tool.setBrush(new ButcherBrush(flags), "worldedit.brush.butcher");

Datei anzeigen

@ -19,11 +19,13 @@
package com.sk89q.worldedit.command; package com.sk89q.worldedit.command;
import com.google.common.collect.Sets;
import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.ItemType; import com.sk89q.worldedit.blocks.type.ItemType;
import com.sk89q.worldedit.blocks.type.ItemTypes;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
@ -161,21 +163,11 @@ public class GeneralCommands {
boolean blocksOnly = args.hasFlag('b'); boolean blocksOnly = args.hasFlag('b');
boolean itemsOnly = args.hasFlag('i'); boolean itemsOnly = args.hasFlag('i');
try { ItemType type = ItemTypes.getItemType(query);
int id = Integer.parseInt(query);
ItemType type = ItemType.fromID(id);
if (type != null) { if (type != null) {
actor.print("#" + type.getID() + " (" + type.getName() + ")"); actor.print(type.getId() + " (" + type.getName() + ")");
} else { } else {
actor.printError("No item found by ID " + id);
}
return;
} catch (NumberFormatException ignored) {
}
if (query.length() <= 2) { if (query.length() <= 2) {
actor.printError("Enter a longer search string (len > 2)."); actor.printError("Enter a longer search string (len > 2).");
return; return;
@ -194,23 +186,23 @@ public class GeneralCommands {
int found = 0; int found = 0;
for (ItemType type : ItemType.values()) { for (ItemType searchType : ItemTypes.values()) {
if (found >= 15) { if (found >= 15) {
actor.print("Too many results!"); actor.print("Too many results!");
break; break;
} }
if (blocksOnly && type.getID() > 255) { // TODO if (blocksOnly && searchType.getID() > 255) {
continue; // continue;
} // }
//
// if (itemsOnly && searchType.getID() <= 255) {
// continue;
// }
if (itemsOnly && type.getID() <= 255) { for (String alias : Sets.newHashSet(searchType.getId(), searchType.getName())) {
continue;
}
for (String alias : type.getAliases()) {
if (alias.contains(query)) { if (alias.contains(query)) {
actor.print("#" + type.getID() + " (" + type.getName() + ")"); actor.print(searchType.getId() + " (" + searchType.getName() + ")");
++found; ++found;
break; break;
} }
@ -221,5 +213,6 @@ public class GeneralCommands {
actor.printError("No items found."); actor.printError("No items found.");
} }
} }
}
} }

Datei anzeigen

@ -34,6 +34,7 @@ import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.type.ItemTypes;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
@ -276,7 +277,7 @@ public class SelectionCommands {
@CommandPermissions("worldedit.wand") @CommandPermissions("worldedit.wand")
public void wand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { public void wand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
player.giveItem(we.getConfiguration().wandItem, 1); player.giveItem(ItemTypes.getItemType(we.getConfiguration().wandItem).getLegacyId(), 1);
player.print("Left click: select pos #1; Right click: select pos #2"); player.print("Left click: select pos #1; Right click: select pos #2");
} }

Datei anzeigen

@ -24,11 +24,12 @@ import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.ItemType; import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.command.tool.*; import com.sk89q.worldedit.command.tool.*;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.TreeGenerator;
public class ToolCommands { public class ToolCommands {
@ -47,7 +48,7 @@ public class ToolCommands {
) )
public void none(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { 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."); player.print("Tool unbound from your current item.");
} }
@ -61,9 +62,10 @@ public class ToolCommands {
@CommandPermissions("worldedit.tool.info") @CommandPermissions("worldedit.tool.info")
public void info(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { 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 " player.print("Info tool bound to "
+ ItemType.toHeldName(player.getItemInHand()) + "."); + itemStack.getType().getName() + ".");
} }
@Command( @Command(
@ -76,8 +78,8 @@ public class ToolCommands {
@CommandPermissions("worldedit.tool.tree") @CommandPermissions("worldedit.tool.tree")
public void tree(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { public void tree(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
TreeGenerator.TreeType type = args.argsLength() > 0 ? TreeGenerator.TreeType type = args.argsLength() > 0
type = TreeGenerator.lookup(args.getString(0)) ? TreeGenerator.lookup(args.getString(0))
: TreeGenerator.TreeType.TREE; : TreeGenerator.TreeType.TREE;
if (type == null) { if (type == null) {
@ -85,9 +87,9 @@ public class ToolCommands {
return; return;
} }
session.setTool(player.getItemInHand(), new TreePlanter(new TreeGenerator(type))); BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
player.print("Tree tool bound to " session.setTool(itemStack.getType(), new TreePlanter(new TreeGenerator(type)));
+ ItemType.toHeldName(player.getItemInHand()) + "."); player.print("Tree tool bound to " + itemStack.getType().getName() + ".");
} }
@Command( @Command(
@ -108,9 +110,9 @@ public class ToolCommands {
context.setPreferringWildcard(false); context.setPreferringWildcard(false);
BaseBlock targetBlock = we.getBlockFactory().parseFromInput(args.getString(0), context); BaseBlock targetBlock = we.getBlockFactory().parseFromInput(args.getString(0), context);
session.setTool(player.getItemInHand(), new BlockReplacer(targetBlock)); BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
player.print("Block replacer tool bound to " session.setTool(itemStack.getType(), new BlockReplacer(targetBlock));
+ ItemType.toHeldName(player.getItemInHand()) + "."); player.print("Block replacer tool bound to " + itemStack.getType().getName() + ".");
} }
@Command( @Command(
@ -123,9 +125,9 @@ public class ToolCommands {
@CommandPermissions("worldedit.tool.data-cycler") @CommandPermissions("worldedit.tool.data-cycler")
public void cycler(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { public void cycler(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
session.setTool(player.getItemInHand(), new BlockDataCyler()); BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
player.print("Block data cycler tool bound to " session.setTool(itemStack.getType(), new BlockDataCyler());
+ ItemType.toHeldName(player.getItemInHand()) + "."); player.print("Block data cycler tool bound to " + itemStack.getType().getName() + ".");
} }
@Command( @Command(
@ -152,9 +154,9 @@ public class ToolCommands {
context.setSession(session); context.setSession(session);
Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context);
session.setTool(player.getItemInHand(), new FloodFillTool(range, pattern)); BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
player.print("Block flood fill tool bound to " session.setTool(itemStack.getType(), new FloodFillTool(range, pattern));
+ ItemType.toHeldName(player.getItemInHand()) + "."); player.print("Block flood fill tool bound to " + itemStack.getType().getName() + ".");
} }
@Command( @Command(
@ -167,9 +169,10 @@ public class ToolCommands {
@CommandPermissions("worldedit.tool.deltree") @CommandPermissions("worldedit.tool.deltree")
public void deltree(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { public void deltree(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
session.setTool(player.getItemInHand(), new FloatingTreeRemover()); BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
session.setTool(itemStack.getType(), new FloatingTreeRemover());
player.print("Floating tree remover tool bound to " player.print("Floating tree remover tool bound to "
+ ItemType.toHeldName(player.getItemInHand()) + "."); + itemStack.getType().getName() + ".");
} }
@Command( @Command(
@ -182,8 +185,9 @@ public class ToolCommands {
@CommandPermissions("worldedit.tool.farwand") @CommandPermissions("worldedit.tool.farwand")
public void farwand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { public void farwand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
session.setTool(player.getItemInHand(), new DistanceWand()); BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
player.print("Far wand tool bound to " + ItemType.toHeldName(player.getItemInHand()) + "."); session.setTool(itemStack.getType(), new DistanceWand());
player.print("Far wand tool bound to " + itemStack.getType().getName() + ".");
} }
@Command( @Command(
@ -206,9 +210,11 @@ public class ToolCommands {
BaseBlock secondary = we.getBlockFactory().parseFromInput(args.getString(0), context); BaseBlock secondary = we.getBlockFactory().parseFromInput(args.getString(0), context);
BaseBlock primary = we.getBlockFactory().parseFromInput(args.getString(1), context); BaseBlock primary = we.getBlockFactory().parseFromInput(args.getString(1), context);
session.setTool(player.getItemInHand(), new LongRangeBuildTool(primary, secondary)); BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
player.print("Long-range building tool bound to " + ItemType.toHeldName(player.getItemInHand()) + ".");
player.print("Left-click set to " + ItemType.toName(secondary.getType().getLegacyId()) + "; right-click set to " session.setTool(itemStack.getType(), new LongRangeBuildTool(primary, secondary));
+ ItemType.toName(primary.getType().getLegacyId()) + "."); player.print("Long-range building tool bound to " + itemStack.getType().getName() + ".");
player.print("Left-click set to " + secondary.getType().getName() + "; right-click set to "
+ primary.getType().getName() + ".");
} }
} }

Datei anzeigen

@ -26,6 +26,7 @@ import com.sk89q.worldedit.*;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.command.parametric.Optional; import com.sk89q.worldedit.util.command.parametric.Optional;
/** /**
@ -78,10 +79,10 @@ public class ToolUtilCommands {
@CommandPermissions("worldedit.brush.options.mask") @CommandPermissions("worldedit.brush.options.mask")
public void mask(Player player, LocalSession session, EditSession editSession, @Optional Mask mask) throws WorldEditException { public void mask(Player player, LocalSession session, EditSession editSession, @Optional Mask mask) throws WorldEditException {
if (mask == null) { if (mask == null) {
session.getBrushTool(player.getItemInHand()).setMask(null); session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setMask(null);
player.print("Brush mask disabled."); player.print("Brush mask disabled.");
} else { } else {
session.getBrushTool(player.getItemInHand()).setMask(mask); session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setMask(mask);
player.print("Brush mask set."); player.print("Brush mask set.");
} }
} }
@ -95,7 +96,7 @@ public class ToolUtilCommands {
) )
@CommandPermissions("worldedit.brush.options.material") @CommandPermissions("worldedit.brush.options.material")
public void material(Player player, LocalSession session, EditSession editSession, Pattern pattern) throws WorldEditException { 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."); player.print("Brush material set.");
} }
@ -109,7 +110,7 @@ public class ToolUtilCommands {
@CommandPermissions("worldedit.brush.options.range") @CommandPermissions("worldedit.brush.options.range")
public void range(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { public void range(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
int range = args.getInteger(0); 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."); player.print("Brush range set.");
} }
@ -126,7 +127,7 @@ public class ToolUtilCommands {
int radius = args.getInteger(0); int radius = args.getInteger(0);
we.checkMaxBrushRadius(radius); we.checkMaxBrushRadius(radius);
session.getBrushTool(player.getItemInHand()).setSize(radius); session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setSize(radius);
player.print("Brush size set."); player.print("Brush size set.");
} }
} }

Datei anzeigen

@ -35,6 +35,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.function.Contextual; import com.sk89q.worldedit.function.Contextual;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.regions.factory.RegionFactory; 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.argument.CommandArgs;
import com.sk89q.worldedit.util.command.composition.CommandExecutor; import com.sk89q.worldedit.util.command.composition.CommandExecutor;
import com.sk89q.worldedit.util.command.composition.SimpleCommand; import com.sk89q.worldedit.util.command.composition.SimpleCommand;
@ -71,7 +72,7 @@ public class ShapedBrushCommand extends SimpleCommand<Object> {
try { try {
WorldEdit.getInstance().checkMaxBrushRadius(radius); WorldEdit.getInstance().checkMaxBrushRadius(radius);
BrushTool tool = session.getBrushTool(player.getItemInHand()); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
tool.setSize(radius); tool.setSize(radius);
tool.setBrush(new OperationFactoryBrush(factory, regionFactory), permission); tool.setBrush(new OperationFactoryBrush(factory, regionFactory), permission);
} catch (MaxBrushRadiusException | InvalidToolBindException e) { } catch (MaxBrushRadiusException | InvalidToolBindException e) {

Datei anzeigen

@ -20,18 +20,19 @@
package com.sk89q.worldedit.command.tool; package com.sk89q.worldedit.command.tool;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.type.ItemType;
public class InvalidToolBindException extends WorldEditException { 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); super(msg);
this.itemId = itemId; this.item = item;
} }
public int getItemId() { public ItemType getItemType() {
return itemId; return this.item;
} }
} }

Datei anzeigen

@ -23,8 +23,11 @@ import com.sk89q.worldedit.PlayerDirection;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.blocks.type.ItemType;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
@ -56,18 +59,18 @@ public interface Player extends Entity, Actor {
PlayerDirection getCardinalDirection(int yawOffset); 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. * Get the Block that the player is holding.
* *
* @return the item id of the item 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. * Gives the player an item.

Datei anzeigen

@ -29,6 +29,7 @@ import com.sk89q.worldedit.extension.input.NoMatchException;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
/** /**
@ -40,10 +41,10 @@ class DefaultBlockParser extends InputParser<BaseBlock> {
super(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) { if (actor instanceof Player) {
try { try {
return ((Player) actor).getBlockInHand(); return ((Player) actor).getBlockInHand(handSide);
} catch (NotABlockException e) { } catch (NotABlockException e) {
throw new InputParseException("You're not holding a block!"); throw new InputParseException("You're not holding a block!");
} catch (WorldEditException e) { } catch (WorldEditException e) {
@ -108,7 +109,17 @@ class DefaultBlockParser extends InputParser<BaseBlock> {
if ("hand".equalsIgnoreCase(testId)) { if ("hand".equalsIgnoreCase(testId)) {
// Get the block type from the item in the user's hand. // Get the block type from the item in the user's hand.
final BaseBlock blockInHand = getBlockInHand(context.requireActor()); final BaseBlock blockInHand = getBlockInHand(context.requireActor(), HandSide.MAIN_HAND);
if (blockInHand.getClass() != BaseBlock.class) {
return blockInHand;
}
blockId = blockInHand.getId();
blockType = BlockType.fromID(blockId);
data = blockInHand.getData();
} else if ("offhand".equalsIgnoreCase(testId)) {
// 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) { if (blockInHand.getClass() != BaseBlock.class) {
return blockInHand; return blockInHand;
} }

Datei anzeigen

@ -26,11 +26,13 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.blocks.ItemID;
import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.blocks.type.BlockTypes;
import com.sk89q.worldedit.blocks.type.ItemType;
import com.sk89q.worldedit.blocks.type.ItemTypes;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TargetBlock; import com.sk89q.worldedit.util.TargetBlock;
import com.sk89q.worldedit.util.auth.AuthorizationException; import com.sk89q.worldedit.util.auth.AuthorizationException;
@ -81,12 +83,12 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override @Override
public boolean isHoldingPickAxe() { public boolean isHoldingPickAxe() {
int item = getItemInHand(); ItemType item = getItemInHand(HandSide.MAIN_HAND).getType();
return item == ItemID.IRON_PICK return item == ItemTypes.IRON_PICKAXE
|| item == ItemID.WOOD_PICKAXE || item == ItemTypes.WOODEN_PICKAXE
|| item == ItemID.STONE_PICKAXE || item == ItemTypes.STONE_PICKAXE
|| item == ItemID.DIAMOND_PICKAXE || item == ItemTypes.DIAMOND_PICKAXE
|| item == ItemID.GOLD_PICKAXE; || item == ItemTypes.GOLDEN_PICKAXE;
} }
@Override @Override
@ -362,12 +364,12 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
} }
@Override @Override
public BaseBlock getBlockInHand() throws WorldEditException { public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException {
final int typeId = getItemInHand(); final ItemType typeId = getItemInHand(handSide).getType();
if (!getWorld().isValidBlockType(typeId)) { if (!getWorld().isValidBlockType(typeId.getLegacyId())) {
throw new NotABlockException(typeId); throw new NotABlockException(typeId.getId());
} }
return new BaseBlock(typeId); return new BaseBlock(typeId.getLegacyId());
} }
/** /**

Datei anzeigen

@ -41,6 +41,7 @@ import com.sk89q.worldedit.event.platform.PlayerInputEvent;
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
import com.sk89q.worldedit.internal.ServerInterfaceAdapter; import com.sk89q.worldedit.internal.ServerInterfaceAdapter;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.util.eventbus.Subscribe;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
@ -318,7 +319,7 @@ public class PlatformManager {
LocalSession session = worldEdit.getSessionManager().get(actor); LocalSession session = worldEdit.getSessionManager().get(actor);
if (event.getType() == Interaction.HIT) { if (event.getType() == Interaction.HIT) {
if (player.getItemInHand() == getConfiguration().wandItem) { if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().wandItem)) {
if (!session.isToolControlEnabled()) { if (!session.isToolControlEnabled()) {
return; return;
} }
@ -345,8 +346,8 @@ public class PlatformManager {
} }
} }
Tool tool = session.getTool(player.getItemInHand()); Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
if (tool != null && tool instanceof DoubleActionBlockTool) { if (tool instanceof DoubleActionBlockTool) {
if (tool.canUse(player)) { if (tool.canUse(player)) {
((DoubleActionBlockTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location); ((DoubleActionBlockTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location);
event.setCancelled(true); event.setCancelled(true);
@ -354,7 +355,7 @@ public class PlatformManager {
} }
} else if (event.getType() == Interaction.OPEN) { } 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()) { if (!session.isToolControlEnabled()) {
return; return;
} }
@ -372,8 +373,8 @@ public class PlatformManager {
return; return;
} }
Tool tool = session.getTool(player.getItemInHand()); Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
if (tool != null && tool instanceof BlockTool) { if (tool instanceof BlockTool) {
if (tool.canUse(player)) { if (tool.canUse(player)) {
((BlockTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location); ((BlockTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location);
event.setCancelled(true); event.setCancelled(true);
@ -391,7 +392,7 @@ public class PlatformManager {
switch (event.getInputType()) { switch (event.getInputType()) {
case PRIMARY: { case PRIMARY: {
if (player.getItemInHand() == getConfiguration().navigationWand) { if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().navigationWand)) {
if (getConfiguration().navigationWandMaxDistance <= 0) { if (getConfiguration().navigationWandMaxDistance <= 0) {
return; return;
} }
@ -413,7 +414,7 @@ public class PlatformManager {
LocalSession session = worldEdit.getSessionManager().get(player); LocalSession session = worldEdit.getSessionManager().get(player);
Tool tool = session.getTool(player.getItemInHand()); Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
if (tool instanceof DoubleActionTraceTool) { if (tool instanceof DoubleActionTraceTool) {
if (tool.canUse(player)) { if (tool.canUse(player)) {
((DoubleActionTraceTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session); ((DoubleActionTraceTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session);
@ -426,7 +427,7 @@ public class PlatformManager {
} }
case SECONDARY: { case SECONDARY: {
if (player.getItemInHand() == getConfiguration().navigationWand) { if (player.getItemInHand(HandSide.MAIN_HAND).getType().getId().equals(getConfiguration().navigationWand)) {
if (getConfiguration().navigationWandMaxDistance <= 0) { if (getConfiguration().navigationWandMaxDistance <= 0) {
return; return;
} }
@ -445,8 +446,8 @@ public class PlatformManager {
LocalSession session = worldEdit.getSessionManager().get(player); LocalSession session = worldEdit.getSessionManager().get(player);
Tool tool = session.getTool(player.getItemInHand()); Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
if (tool != null && tool instanceof TraceTool) { if (tool instanceof TraceTool) {
if (tool.canUse(player)) { if (tool.canUse(player)) {
((TraceTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session); ((TraceTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session);
event.setCancelled(true); event.setCancelled(true);

Datei anzeigen

@ -20,11 +20,13 @@
package com.sk89q.worldedit.extension.platform; package com.sk89q.worldedit.extension.platform;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
@ -58,8 +60,8 @@ class PlayerProxy extends AbstractPlayerActor {
} }
@Override @Override
public int getItemInHand() { public BaseItemStack getItemInHand(HandSide handSide) {
return basePlayer.getItemInHand(); return basePlayer.getItemInHand(handSide);
} }
@Override @Override

Datei anzeigen

@ -20,6 +20,7 @@
package com.sk89q.worldedit.extent.inventory; package com.sk89q.worldedit.extent.inventory;
import com.sk89q.worldedit.blocks.*; import com.sk89q.worldedit.blocks.*;
import com.sk89q.worldedit.blocks.type.ItemTypes;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
/** /**
@ -49,7 +50,7 @@ public abstract class BlockBag {
public void storeDroppedBlock(int id, int data) throws BlockBagException { public void storeDroppedBlock(int id, int data) throws BlockBagException {
BaseItem dropped = BlockType.getBlockBagItem(id, data); BaseItem dropped = BlockType.getBlockBagItem(id, data);
if (dropped == null) return; if (dropped == null) return;
if (dropped.getType() == BlockID.AIR) return; if (dropped.getType() == ItemTypes.AIR) return;
storeItem(dropped); storeItem(dropped);
} }
@ -107,7 +108,7 @@ public abstract class BlockBag {
} catch (OutOfBlocksException e) { } catch (OutOfBlocksException e) {
BaseItem placed = BlockType.getBlockBagItem(id, data); BaseItem placed = BlockType.getBlockBagItem(id, data);
if (placed == null) throw e; // TODO: check if (placed == null) throw e; // TODO: check
if (placed.getType() == BlockID.AIR) throw e; // TODO: check if (placed.getType() == ItemTypes.AIR) throw e; // TODO: check
fetchItem(placed); fetchItem(placed);
} }
@ -134,7 +135,7 @@ public abstract class BlockBag {
* @throws BlockBagException on error * @throws BlockBagException on error
*/ */
public void fetchItem(BaseItem item) throws BlockBagException { public void fetchItem(BaseItem item) throws BlockBagException {
fetchBlock(item.getType()); fetchBlock(item.getLegacyId());
} }
/** /**
@ -158,7 +159,7 @@ public abstract class BlockBag {
* @throws BlockBagException on error * @throws BlockBagException on error
*/ */
public void storeItem(BaseItem item) throws BlockBagException { public void storeItem(BaseItem item) throws BlockBagException {
storeBlock(item.getType()); storeBlock(item.getLegacyId());
} }
/** /**

Datei anzeigen

@ -19,9 +19,20 @@
package com.sk89q.worldedit.internal.command; 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.CommandException;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.DisallowedItemException;
import com.sk89q.worldedit.blocks.ItemType; 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.InsufficientArgumentsException;
import com.sk89q.worldedit.command.tool.InvalidToolBindException; import com.sk89q.worldedit.command.tool.InvalidToolBindException;
import com.sk89q.worldedit.internal.expression.ExpressionException; 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.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* converts WorldEdit exceptions and converts them into {@link CommandException}s. * converts WorldEdit exceptions and converts them into {@link CommandException}s.
*/ */
@ -138,8 +147,7 @@ public class WorldEditExceptionConverter extends ExceptionConverterHelper {
@ExceptionMatch @ExceptionMatch
public void convert(InvalidToolBindException e) throws CommandException { public void convert(InvalidToolBindException e) throws CommandException {
throw new CommandException("Can't bind tool to " throw new CommandException("Can't bind tool to " + e.getItemType().getName() + ": " + e.getMessage());
+ ItemType.toHeldName(e.getItemId()) + ": " + e.getMessage());
} }
@ExceptionMatch @ExceptionMatch

Datei anzeigen

@ -0,0 +1,25 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* 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 <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.util;
public enum HandSide {
MAIN_HAND,
OFF_HAND
}

Datei anzeigen

@ -33,6 +33,7 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
@ -73,7 +74,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
loadExtra(); loadExtra();
profile = getBool("profile", profile); profile = getBool("profile", profile);
disallowedBlocks = getIntSet("disallowed-blocks", defaultDisallowedBlocks); disallowedBlocks = getStringSet("disallowed-blocks", defaultDisallowedBlocks);
defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit); defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit);
maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit); maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit);
defaultMaxPolygonalPoints = getInt("default-max-polygon-points", defaultMaxPolygonalPoints); defaultMaxPolygonalPoints = getInt("default-max-polygon-points", defaultMaxPolygonalPoints);
@ -88,14 +89,14 @@ public class PropertiesConfiguration extends LocalConfiguration {
logFile = getString("log-file", logFile); logFile = getString("log-file", logFile);
logFormat = getString("log-format", logFormat); logFormat = getString("log-format", logFormat);
registerHelp = getBool("register-help", registerHelp); registerHelp = getBool("register-help", registerHelp);
wandItem = getInt("wand-item", wandItem); wandItem = getString("wand-item", wandItem);
superPickaxeDrop = getBool("super-pickaxe-drop-items", superPickaxeDrop); superPickaxeDrop = getBool("super-pickaxe-drop-items", superPickaxeDrop);
superPickaxeManyDrop = getBool("super-pickaxe-many-drop-items", superPickaxeManyDrop); superPickaxeManyDrop = getBool("super-pickaxe-many-drop-items", superPickaxeManyDrop);
noDoubleSlash = getBool("no-double-slash", noDoubleSlash); noDoubleSlash = getBool("no-double-slash", noDoubleSlash);
useInventory = getBool("use-inventory", useInventory); useInventory = getBool("use-inventory", useInventory);
useInventoryOverride = getBool("use-inventory-override", useInventoryOverride); useInventoryOverride = getBool("use-inventory-override", useInventoryOverride);
useInventoryCreativeOverride = getBool("use-inventory-creative-override", useInventoryCreativeOverride); useInventoryCreativeOverride = getBool("use-inventory-creative-override", useInventoryCreativeOverride);
navigationWand = getInt("nav-wand-item", navigationWand); navigationWand = getString("nav-wand-item", navigationWand);
navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance); navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance);
navigationUseGlass = getBool("nav-use-glass", navigationUseGlass); navigationUseGlass = getBool("nav-use-glass", navigationUseGlass);
scriptTimeout = getInt("scripting-timeout", scriptTimeout); scriptTimeout = getInt("scripting-timeout", scriptTimeout);
@ -238,4 +239,30 @@ public class PropertiesConfiguration extends LocalConfiguration {
} }
} }
/**
* Get a String set.
*
* @param key the key
* @param def the default value
* @return the value
*/
protected Set<String> 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<String> set = new HashSet<>();
String[] parts = val.split(",");
for (String part : parts) {
try {
String v = part.trim();
set.add(v);
} catch (NumberFormatException ignored) {
}
}
return set;
}
}
} }

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit.util; package com.sk89q.worldedit.util;
import com.google.common.collect.Lists;
import com.sk89q.util.yaml.YAMLProcessor; import com.sk89q.util.yaml.YAMLProcessor;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
@ -53,7 +54,7 @@ public class YAMLConfiguration extends LocalConfiguration {
} }
profile = config.getBoolean("debug", profile); profile = config.getBoolean("debug", profile);
wandItem = config.getInt("wand-item", wandItem); wandItem = config.getString("wand-item", wandItem);
defaultChangeLimit = Math.max(-1, config.getInt( defaultChangeLimit = Math.max(-1, config.getInt(
"limits.max-blocks-changed.default", defaultChangeLimit)); "limits.max-blocks-changed.default", defaultChangeLimit));
@ -76,7 +77,7 @@ public class YAMLConfiguration extends LocalConfiguration {
butcherDefaultRadius = Math.max(-1, config.getInt("limits.butcher-radius.default", butcherDefaultRadius)); butcherDefaultRadius = Math.max(-1, config.getInt("limits.butcher-radius.default", butcherDefaultRadius));
butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius)); butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius));
disallowedBlocks = new HashSet<>(config.getIntList("limits.disallowed-blocks", null)); disallowedBlocks = new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(defaultDisallowedBlocks)));
allowedDataCycleBlocks = new HashSet<>(config.getIntList("limits.allowed-data-cycle-blocks", null)); allowedDataCycleBlocks = new HashSet<>(config.getIntList("limits.allowed-data-cycle-blocks", null));
registerHelp = config.getBoolean("register-help", true); registerHelp = config.getBoolean("register-help", true);
@ -97,7 +98,7 @@ public class YAMLConfiguration extends LocalConfiguration {
useInventoryCreativeOverride = config.getBoolean("use-inventory.creative-mode-overrides", useInventoryCreativeOverride = config.getBoolean("use-inventory.creative-mode-overrides",
useInventoryCreativeOverride); useInventoryCreativeOverride);
navigationWand = config.getInt("navigation-wand.item", navigationWand); navigationWand = config.getString("navigation-wand.item", navigationWand);
navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance); navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance);
navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass); navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass);

Datei anzeigen

@ -97,8 +97,7 @@ public class BundledItemData {
* @param id the ID * @param id the ID
* @return the entry, or null * @return the entry, or null
*/ */
@Nullable @Nullable public ItemEntry findById(String id) {
private ItemEntry findById(String id) {
// If it has no namespace, assume minecraft. // If it has no namespace, assume minecraft.
if (!id.contains(":")) { if (!id.contains(":")) {
id = "minecraft:" + id; id = "minecraft:" + id;
@ -158,12 +157,12 @@ public class BundledItemData {
return INSTANCE; return INSTANCE;
} }
private static class ItemEntry { public static class ItemEntry {
private int legacyId; // -1 for items without legacy IDs. private int legacyId; // -1 for items without legacy IDs.
private short legacyData; private short legacyData;
private String id; private String id;
private String unlocalizedName; private String unlocalizedName;
private String localizedName; public String localizedName;
private int maxDamage; private int maxDamage;
private int maxStackSize; private int maxStackSize;
} }

Datei anzeigen

@ -21,11 +21,14 @@ package com.sk89q.worldedit.forge;
import com.sk89q.util.StringUtil; import com.sk89q.util.StringUtil;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.blocks.type.ItemTypes;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; import com.sk89q.worldedit.extension.platform.AbstractPlayerActor;
import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
@ -36,6 +39,7 @@ import net.minecraft.network.play.server.SPacketCustomPayload;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import java.util.UUID; import java.util.UUID;
@ -56,9 +60,9 @@ public class ForgePlayer extends AbstractPlayerActor {
} }
@Override @Override
public int getItemInHand() { public BaseItemStack getItemInHand(HandSide handSide) {
ItemStack is = this.player.getHeldItem(EnumHand.MAIN_HAND); ItemStack is = this.player.getHeldItem(handSide == HandSide.MAIN_HAND ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND);
return Item.getIdFromItem(is.getItem()); return new BaseItemStack(ItemTypes.getItemType(ForgeRegistries.ITEMS.getKey(is.getItem()).toString()));
} }
@Override @Override

Datei anzeigen

@ -31,6 +31,7 @@ import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.blocks.LazyBlock; import com.sk89q.worldedit.blocks.LazyBlock;
import com.sk89q.worldedit.blocks.type.ItemTypes;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.internal.Constants;
@ -226,7 +227,7 @@ public class ForgeWorld extends AbstractWorld {
checkNotNull(biome); checkNotNull(biome);
Chunk chunk = getWorld().getChunkFromBlockCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ())); 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(); chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId();
return true; return true;
} }
@ -236,7 +237,7 @@ public class ForgeWorld extends AbstractWorld {
@Override @Override
public boolean useItem(Vector position, BaseItem item, Direction face) { public boolean useItem(Vector position, BaseItem item, Direction face) {
Item nativeItem = Item.getItemById(item.getType()); Item nativeItem = Item.getByNameOrId(item.getType().getId());
ItemStack stack = new ItemStack(nativeItem, 1, item.getData()); ItemStack stack = new ItemStack(nativeItem, 1, item.getData());
World world = getWorld(); World world = getWorld();
EnumActionResult used = stack.onItemUse(new WorldEditFakePlayer((WorldServer) world), world, ForgeAdapter.toBlockPos(position), EnumActionResult used = stack.onItemUse(new WorldEditFakePlayer((WorldServer) world), world, ForgeAdapter.toBlockPos(position),
@ -249,7 +250,7 @@ public class ForgeWorld extends AbstractWorld {
checkNotNull(position); checkNotNull(position);
checkNotNull(item); checkNotNull(item);
if (item.getType() == 0) { if (item.getType() == ItemTypes.AIR) {
return; return;
} }

Datei anzeigen

@ -214,7 +214,7 @@ public class ForgeWorldEdit {
} }
public static ItemStack toForgeItemStack(BaseItemStack item) { public static ItemStack toForgeItemStack(BaseItemStack item) {
ItemStack ret = new ItemStack(Item.getItemById(item.getType()), item.getAmount(), item.getData()); ItemStack ret = new ItemStack(Item.getByNameOrId(item.getType().getId()), item.getAmount(), item.getData());
for (Map.Entry<Integer, Integer> entry : item.getEnchantments().entrySet()) { for (Map.Entry<Integer, Integer> entry : item.getEnchantments().entrySet()) {
ret.addEnchantment(net.minecraft.enchantment.Enchantment.getEnchantmentByID(entry.getKey()), entry.getValue()); ret.addEnchantment(net.minecraft.enchantment.Enchantment.getEnchantmentByID(entry.getKey()), entry.getValue());
} }

Datei anzeigen

@ -22,11 +22,14 @@ package com.sk89q.worldedit.sponge;
import com.flowpowered.math.vector.Vector3d; import com.flowpowered.math.vector.Vector3d;
import com.sk89q.util.StringUtil; import com.sk89q.util.StringUtil;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.blocks.type.ItemTypes;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; import com.sk89q.worldedit.extension.platform.AbstractPlayerActor;
import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import org.spongepowered.api.data.type.HandTypes; import org.spongepowered.api.data.type.HandTypes;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
@ -58,9 +61,10 @@ public class SpongePlayer extends AbstractPlayerActor {
} }
@Override @Override
public int getItemInHand() { public BaseItemStack getItemInHand(HandSide handSide) {
Optional<ItemStack> is = this.player.getItemInHand(HandTypes.MAIN_HAND); Optional<ItemStack> is = this.player.getItemInHand(handSide == HandSide.MAIN_HAND
return is.map(itemStack -> SpongeWorldEdit.inst().getAdapter().resolve(itemStack.getItem())).orElse(0); ? HandTypes.MAIN_HAND : HandTypes.OFF_HAND);
return is.map(itemStack -> new BaseItemStack(ItemTypes.getItemType(itemStack.getType().getId()))).orElse(null);
} }
@Override @Override

Datei anzeigen

@ -27,6 +27,7 @@ import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.blocks.type.ItemTypes;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
@ -183,7 +184,7 @@ public abstract class SpongeWorld extends AbstractWorld {
checkNotNull(position); checkNotNull(position);
checkNotNull(item); checkNotNull(item);
if (item.getType() == 0) { if (item.getType() == ItemTypes.AIR) {
return; return;
} }

Datei anzeigen

@ -57,7 +57,7 @@ public class ConfigurateConfiguration extends LocalConfiguration {
} }
profile = node.getNode("debug").getBoolean(profile); profile = node.getNode("debug").getBoolean(profile);
wandItem = node.getNode("wand-item").getInt(wandItem); wandItem = node.getNode("wand-item").getString(wandItem);
defaultChangeLimit = Math.max(-1, node.getNode("limits", "max-blocks-changed", "default").getInt(defaultChangeLimit)); 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)); maxChangeLimit = Math.max(-1, node.getNode("limits", "max-blocks-changed", "maximum").getInt(maxChangeLimit));
@ -73,7 +73,7 @@ public class ConfigurateConfiguration extends LocalConfiguration {
butcherMaxRadius = Math.max(-1, node.getNode("limits", "butcher-radius", "maximum").getInt(butcherMaxRadius)); butcherMaxRadius = Math.max(-1, node.getNode("limits", "butcher-radius", "maximum").getInt(butcherMaxRadius));
try { 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) { } catch (ObjectMappingException e) {
logger.warn("Error loading WorldEdit configuration", e); logger.warn("Error loading WorldEdit configuration", e);
} }
@ -97,7 +97,7 @@ public class ConfigurateConfiguration extends LocalConfiguration {
useInventoryOverride = node.getNode("use-inventory", "allow-override").getBoolean(useInventoryOverride); useInventoryOverride = node.getNode("use-inventory", "allow-override").getBoolean(useInventoryOverride);
useInventoryCreativeOverride = node.getNode("use-inventory", "creative-mode-overrides").getBoolean(useInventoryCreativeOverride); 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);
navigationWandMaxDistance = node.getNode("navigation-wand", "max-distance").getInt(navigationWandMaxDistance); navigationWandMaxDistance = node.getNode("navigation-wand", "max-distance").getInt(navigationWandMaxDistance);
navigationUseGlass = node.getNode("navigation", "use-glass").getBoolean(navigationUseGlass); navigationUseGlass = node.getNode("navigation", "use-glass").getBoolean(navigationUseGlass);