mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Convert the data system to a state system. This doesn't work, needs new data
This commit is contained in:
@ -23,23 +23,12 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.BlockType;
|
||||
import com.sk89q.worldedit.blocks.ClothColor;
|
||||
import com.sk89q.worldedit.blocks.MobSpawnerBlock;
|
||||
import com.sk89q.worldedit.blocks.NoteBlock;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.registry.BundledBlockData;
|
||||
import com.sk89q.worldedit.world.registry.SimpleState;
|
||||
import com.sk89q.worldedit.world.registry.State;
|
||||
import com.sk89q.worldedit.world.registry.StateValue;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* Looks up information about a block.
|
||||
@ -57,13 +46,12 @@ public class QueryTool implements BlockTool {
|
||||
World world = (World) clicked.getExtent();
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
BaseBlock block = editSession.getBlock(clicked.toVector());
|
||||
BlockType type = BlockType.fromID(block.getType().getLegacyId());
|
||||
|
||||
player.print("\u00A79@" + clicked.toVector() + ": " + "\u00A7e"
|
||||
+ "#" + block.getType() + "\u00A77" + " ("
|
||||
+ (type == null ? "Unknown" : type.getName()) + ") "
|
||||
+ block.getType().getId() + ") "
|
||||
+ "\u00A7f"
|
||||
+ "[" + block.getData() + "]" + " (" + world.getBlockLightLevel(clicked.toVector()) + "/" + world.getBlockLightLevel(clicked.toVector().add(0, 1, 0)) + ")");
|
||||
+ "[" + block.getStates().toString() + "]" + " (" + world.getBlockLightLevel(clicked.toVector()) + "/" + world.getBlockLightLevel(clicked.toVector().add(0, 1, 0)) + ")");
|
||||
|
||||
if (block instanceof MobSpawnerBlock) {
|
||||
player.printRaw("\u00A7e" + "Mob Type: "
|
||||
@ -73,36 +61,6 @@ public class QueryTool implements BlockTool {
|
||||
+ ((NoteBlock) block).getNote());
|
||||
}
|
||||
|
||||
Map<String, ? extends State> states = BundledBlockData.getInstance().getStatesById(block.getType().getId());
|
||||
if (states == null || states.isEmpty()) return true;
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("States: ");
|
||||
boolean first = true;
|
||||
boolean hasVisibleStates = false;
|
||||
for (Entry<String, ? extends State> e : states.entrySet()) {
|
||||
String name = e.getKey();
|
||||
State state = e.getValue();
|
||||
if (state instanceof SimpleState && ((SimpleState) state).getDataMask() == 0) {
|
||||
continue; // don't try to determine states that aren't reflected in their data value
|
||||
}
|
||||
hasVisibleStates = true;
|
||||
if (!first) {
|
||||
builder.append(", ");
|
||||
}
|
||||
first = false;
|
||||
String valName = "";
|
||||
for (Entry<String, ? extends StateValue> entry : state.valueMap().entrySet()) {
|
||||
if (entry.getValue().isSet(block)) {
|
||||
valName = entry.getKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
builder.append("\u00A79").append(name).append(": \u00A7f").append(valName != null ? valName : "set");
|
||||
}
|
||||
if (hasVisibleStates) {
|
||||
player.printRaw(builder.toString());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user