Search in sources :

Example 1 with LongTag

use of com.sk89q.jnbt.LongTag in project FastAsyncWorldEdit by IntellectualSites.

the class MutableEntityChange method delete.

@SuppressWarnings({ "unchecked" })
public void delete(UndoContext context) {
    Map<String, Tag> map = tag.getValue();
    long most;
    long least;
    if (map.containsKey("UUIDMost")) {
        most = ((LongTag) map.get("UUIDMost")).getValue();
        least = ((LongTag) map.get("UUIDLeast")).getValue();
    } else if (map.containsKey("PersistentIDMSB")) {
        most = ((LongTag) map.get("PersistentIDMSB")).getValue();
        least = ((LongTag) map.get("PersistentIDLSB")).getValue();
    } else {
        LOGGER.info("Skipping entity without uuid.");
        return;
    }
    List<DoubleTag> pos = (List<DoubleTag>) map.get("Pos").getValue();
    int x = MathMan.roundInt(pos.get(0).getValue());
    int y = MathMan.roundInt(pos.get(1).getValue());
    int z = MathMan.roundInt(pos.get(2).getValue());
    UUID uuid = new UUID(most, least);
    context.getExtent().removeEntity(x, y, z, uuid);
}
Also used : List(java.util.List) DoubleTag(com.sk89q.jnbt.DoubleTag) CompoundTag(com.sk89q.jnbt.CompoundTag) Tag(com.sk89q.jnbt.Tag) LongTag(com.sk89q.jnbt.LongTag) DoubleTag(com.sk89q.jnbt.DoubleTag) UUID(java.util.UUID) LongTag(com.sk89q.jnbt.LongTag)

Aggregations

CompoundTag (com.sk89q.jnbt.CompoundTag)1 DoubleTag (com.sk89q.jnbt.DoubleTag)1 LongTag (com.sk89q.jnbt.LongTag)1 Tag (com.sk89q.jnbt.Tag)1 List (java.util.List)1 UUID (java.util.UUID)1