Skip to content

Commit

Permalink
Update blocks.json.
Browse files Browse the repository at this point in the history
This fixes a lot of issues with block rotations for various blocks.
Additionally, the //info tool will now report states (only works for
states that use data values) for easier lookups.

Note that some doors still have update issues, and //fast is needed
to paste them if they drop as items.
  • Loading branch information
wizjany committed May 15, 2016
1 parent 32fb5b3 commit b3fbe8b
Show file tree
Hide file tree
Showing 4 changed files with 11,274 additions and 3,173 deletions.
Expand Up @@ -22,11 +22,22 @@
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.blocks.*;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.blocks.ClothColor;
import com.sk89q.worldedit.blocks.MobSpawnerBlock;
import com.sk89q.worldedit.blocks.NoteBlock;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.registry.BundledBlockData;
import com.sk89q.worldedit.world.registry.State;
import com.sk89q.worldedit.world.registry.StateValue;

import java.util.Map;
import java.util.Map.Entry;

/**
* Looks up information about a block.
Expand Down Expand Up @@ -64,6 +75,28 @@ public boolean actPrimary(Platform server, LocalConfiguration config, Player pla
+ ClothColor.fromID(block.getData()).getName());
}

Map<String, ? extends State> states = BundledBlockData.getInstance().getStatesById(block.getId());
if (states == null || states.isEmpty()) return true;
StringBuilder builder = new StringBuilder();
builder.append("States: ");
boolean first = true;
for (Entry<String, ? extends State> e : states.entrySet()) {
String name = e.getKey();
State state = e.getValue();
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();
}
}
builder.append("\u00A79").append(name).append(": \u00A7f").append(valName != null ? valName : "set");
}
player.printRaw(builder.toString());

return true;
}

Expand Down
Expand Up @@ -154,6 +154,11 @@ public Operation resume(RunContext run) throws WorldEditException {

switch (type) {
case BlockID.WOODEN_DOOR:
case BlockID.ACACIA_DOOR:
case BlockID.BIRCH_DOOR:
case BlockID.JUNGLE_DOOR:
case BlockID.DARK_OAK_DOOR:
case BlockID.SPRUCE_DOOR:

This comment has been minimized.

Copy link
@ZitrODavidOrtiZ

ZitrODavidOrtiZ May 17, 2016

Contributor

Those new doors also need to be added to BlockType.shouldPlaceFinal Set.

case BlockID.IRON_DOOR:
if ((data & 0x8) == 0) {
// Deal with lower door halves being attached to the floor AND the upper half
Expand Down

0 comments on commit b3fbe8b

Please sign in to comment.