use of com.sk89q.jnbt.DoubleTag in project FastAsyncWorldEdit by IntellectualSites.
the class MutableEntityChange method create.
public void create(UndoContext context) {
Map<String, Tag> map = tag.getValue();
Tag posTag = map.get("Pos");
if (posTag == null) {
LOGGER.warn("Missing pos tag: {}", tag);
return;
}
List<DoubleTag> pos = (List<DoubleTag>) posTag.getValue();
double x = pos.get(0).getValue();
double y = pos.get(1).getValue();
double z = pos.get(2).getValue();
Extent extent = context.getExtent();
Location location = new Location(extent, x, y, z, 0, 0);
String id = tag.getString("Id");
EntityType type = EntityTypes.parse(id);
BaseEntity entity = new BaseEntity(type, tag);
context.getExtent().createEntity(location, entity);
}
use of com.sk89q.jnbt.DoubleTag in project FastAsyncWorldEdit by IntellectualSites.
the class ClipboardWriter method writeVector.
// FAWE start
default Tag writeVector(Vector3 vector) {
List<DoubleTag> list = new ArrayList<>();
list.add(new DoubleTag(vector.getX()));
list.add(new DoubleTag(vector.getY()));
list.add(new DoubleTag(vector.getZ()));
return new ListTag(DoubleTag.class, list);
}
use of com.sk89q.jnbt.DoubleTag 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);
}
Aggregations