mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
More deprecation removal
This commit is contained in:
@ -46,8 +46,9 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
int type = world.getBlockType(clicked.toVector());
|
||||
int data = world.getBlockData(clicked.toVector());
|
||||
BaseBlock block = world.getLazyBlock(clicked.toVector());
|
||||
int type = block.getId();
|
||||
int data = block.getData();
|
||||
|
||||
if (!config.allowedDataCycleBlocks.isEmpty()
|
||||
&& !player.hasPermission("worldedit.override.data-cycler")
|
||||
@ -57,14 +58,14 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
}
|
||||
|
||||
int increment = forward ? 1 : -1;
|
||||
BaseBlock block = new BaseBlock(type, BlockData.cycle(type, data, increment));
|
||||
BaseBlock newBlock = new BaseBlock(type, BlockData.cycle(type, data, increment));
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
if (block.getData() < 0) {
|
||||
if (newBlock.getData() < 0) {
|
||||
player.printError("That block's data cannot be cycled!");
|
||||
} else {
|
||||
try {
|
||||
editSession.setBlock(clicked.toVector(), block);
|
||||
editSession.setBlock(clicked.toVector(), newBlock);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
|
@ -56,7 +56,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
|
||||
final World world = (World) clicked.getExtent();
|
||||
|
||||
switch (world.getBlockType(clicked.toVector())) {
|
||||
switch (world.getLazyBlock(clicked.toVector()).getId()) {
|
||||
case BlockID.LOG:
|
||||
case BlockID.LOG2:
|
||||
case BlockID.LEAVES:
|
||||
@ -119,8 +119,8 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
* @return a set containing all blocks in the tree/shroom or null if this is not a floating tree/shroom.
|
||||
*/
|
||||
private Set<Vector> bfs(World world, Vector origin) throws MaxChangedBlocksException {
|
||||
final Set<Vector> visited = new HashSet<Vector>();
|
||||
final LinkedList<Vector> queue = new LinkedList<Vector>();
|
||||
final Set<Vector> visited = new HashSet<>();
|
||||
final LinkedList<Vector> queue = new LinkedList<>();
|
||||
|
||||
queue.addLast(origin);
|
||||
visited.add(origin);
|
||||
@ -135,7 +135,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
}
|
||||
|
||||
if (visited.add(next)) {
|
||||
switch (world.getBlockType(next)) {
|
||||
switch (world.getLazyBlock(next).getId()) {
|
||||
case BlockID.AIR:
|
||||
case BlockID.SNOW:
|
||||
// we hit air or snow => stop walking this route
|
||||
@ -154,7 +154,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
|
||||
default:
|
||||
// we hit something solid - evaluate where we came from
|
||||
final int curId = world.getBlockType(current);
|
||||
final int curId = world.getLazyBlock(current).getId();
|
||||
if (curId == BlockID.LEAVES || curId == BlockID.LEAVES2
|
||||
|| curId == BlockID.VINE) {
|
||||
// leaves touching a wall/the ground => stop walking this route
|
||||
|
@ -20,7 +20,8 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.type.BlockType;
|
||||
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;
|
||||
@ -53,13 +54,13 @@ public class FloodFillTool implements BlockTool {
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
int initialType = world.getBlockType(clicked.toVector());
|
||||
BlockType initialType = world.getLazyBlock(clicked.toVector()).getType();
|
||||
|
||||
if (initialType == BlockID.AIR) {
|
||||
if (initialType == BlockTypes.AIR) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (initialType == BlockID.BEDROCK && !player.canDestroyBedrock()) {
|
||||
if (initialType == BlockTypes.BEDROCK && !player.canDestroyBedrock()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -67,7 +68,7 @@ public class FloodFillTool implements BlockTool {
|
||||
|
||||
try {
|
||||
recurse(server, editSession, world, clicked.toVector().toBlockVector(),
|
||||
clicked.toVector(), range, initialType, new HashSet<BlockVector>());
|
||||
clicked.toVector(), range, initialType.getLegacyId(), new HashSet<>());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
|
@ -21,7 +21,6 @@ package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.type.BlockType;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -69,7 +68,7 @@ public class RecursivePickaxe implements BlockTool {
|
||||
|
||||
try {
|
||||
recurse(server, editSession, world, clicked.toVector().toBlockVector(),
|
||||
clicked.toVector(), range, initialType, new HashSet<BlockVector>());
|
||||
clicked.toVector(), range, initialType, new HashSet<>());
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
|
@ -25,6 +25,7 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
@ -43,7 +44,7 @@ public class SinglePickaxe implements BlockTool {
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||
World world = (World) clicked.getExtent();
|
||||
final int blockType = world.getBlockType(clicked.toVector());
|
||||
final int blockType = world.getLazyBlock(clicked.toVector()).getId();
|
||||
if (blockType == BlockID.BEDROCK
|
||||
&& !player.canDestroyBedrock()) {
|
||||
return true;
|
||||
@ -53,7 +54,7 @@ public class SinglePickaxe implements BlockTool {
|
||||
editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);
|
||||
|
||||
try {
|
||||
editSession.setBlock(clicked.toVector(), new BaseBlock(BlockID.AIR));
|
||||
editSession.setBlock(clicked.toVector(), new BaseBlock(BlockTypes.AIR));
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
} finally {
|
||||
|
@ -24,7 +24,6 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.util.*;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
/**
|
||||
* Plants a tree.
|
||||
|
@ -23,7 +23,6 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
|
||||
@ -44,7 +43,7 @@ public class GravityBrush implements Brush {
|
||||
for (double x = position.getBlockX() + size; x > position.getBlockX() - size; --x) {
|
||||
for (double z = position.getBlockZ() + size; z > position.getBlockZ() - size; --z) {
|
||||
double y = startY;
|
||||
final List<BaseBlock> blockTypes = new ArrayList<BaseBlock>();
|
||||
final List<BaseBlock> blockTypes = new ArrayList<>();
|
||||
for (; y > position.getBlockY() - size; --y) {
|
||||
final Vector pt = new Vector(x, y, z);
|
||||
final BaseBlock block = editSession.getBlock(pt);
|
||||
|
Reference in New Issue
Block a user