I guarantee this is broken. Start some form of string ID for blocks

This commit is contained in:
Matthew Miller
2018-01-03 15:35:51 +10:00
parent e6c6a2cfea
commit 41a80064f5
39 changed files with 349 additions and 118 deletions

View File

@ -69,7 +69,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
World world = (World) clicked.getExtent();
EditSession editSession = session.createEditSession(player);
targetBlock = (editSession).getBlock(clicked.toVector());
BlockType type = BlockType.fromID(targetBlock.getType());
BlockType type = BlockType.fromID(targetBlock.getType().getLegacyId());
if (type != null) {
player.print("Replacer tool switched to: " + type.getName());

View File

@ -80,7 +80,7 @@ public class FloatingTreeRemover implements BlockTool {
}
for (Vector blockVector : blockSet) {
final int typeId = editSession.getBlock(blockVector).getType();
final int typeId = editSession.getBlock(blockVector).getType().getLegacyId();
switch (typeId) {
case BlockID.LOG:
case BlockID.LOG2:

View File

@ -86,7 +86,7 @@ public class FloodFillTool implements BlockTool {
visited.add(pos);
if (editSession.getBlock(pos).getType() == initialType) {
if (editSession.getBlock(pos).getType().getLegacyId() == initialType) {
editSession.setBlock(pos, pattern.next(pos));
} else {
return;

View File

@ -51,7 +51,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
if (pos == null) return false;
EditSession eS = session.createEditSession(player);
try {
if (secondary.getType() == BlockID.AIR) {
if (secondary.getType().getLegacyId() == BlockID.AIR) {
eS.setBlock(pos, secondary);
} else {
eS.setBlock(pos.getFaceVector(), secondary);
@ -70,7 +70,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
if (pos == null) return false;
EditSession eS = session.createEditSession(player);
try {
if (primary.getType() == BlockID.AIR) {
if (primary.getType().getLegacyId() == BlockID.AIR) {
eS.setBlock(pos, primary);
} else {
eS.setBlock(pos.getFaceVector(), primary);

View File

@ -28,6 +28,7 @@ import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.blocks.ClothColor;
import com.sk89q.worldedit.blocks.MobSpawnerBlock;
import com.sk89q.worldedit.blocks.NoteBlock;
import com.sk89q.worldedit.blocks.type.BlockTypes;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
@ -56,7 +57,7 @@ public class QueryTool implements BlockTool {
World world = (World) clicked.getExtent();
EditSession editSession = session.createEditSession(player);
BaseBlock block = (editSession).rawGetBlock(clicked.toVector());
BlockType type = BlockType.fromID(block.getType());
BlockType type = BlockType.fromID(block.getType().getLegacyId());
player.print("\u00A79@" + clicked.toVector() + ": " + "\u00A7e"
+ "#" + block.getType() + "\u00A77" + " ("
@ -70,7 +71,7 @@ public class QueryTool implements BlockTool {
} else if (block instanceof NoteBlock) {
player.printRaw("\u00A7e" + "Note block: "
+ ((NoteBlock) block).getNote());
} else if (block.getType() == BlockID.CLOTH) {
} else if (block.getType().getId().equals(BlockTypes.WOOL)) {
// Should never be null
player.printRaw("\u00A7e" + "Color: "
+ ClothColor.fromID(block.getData()).getName());

View File

@ -88,7 +88,7 @@ public class RecursivePickaxe implements BlockTool {
visited.add(pos);
if (editSession.getBlock(pos).getType() != initialType) {
if (editSession.getBlock(pos).getType().getLegacyId() != initialType) {
return;
}

View File

@ -24,6 +24,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.type.BlockTypes;
import com.sk89q.worldedit.function.pattern.Pattern;
import java.util.*;
@ -55,7 +56,7 @@ public class GravityBrush implements Brush {
Vector pt = new Vector(x, y, z);
Collections.reverse(blockTypes);
for (int i = 0; i < blockTypes.size();) {
if (editSession.getBlock(pt).getType() == BlockID.AIR) {
if (editSession.getBlock(pt).getType().getId().equals(BlockTypes.AIR)) {
editSession.setBlock(pt, blockTypes.get(i++));
}
pt = pt.add(0, 1, 0);