This commit is contained in:
Jesse Boyd 2017-08-28 23:48:18 +10:00
parent 9a430f3232
commit 0ebc73d17f
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 16 additions and 7 deletions

View File

@ -39,7 +39,7 @@ public abstract class NMSMappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> ex
public void runTasks() {
super.runTasks();
if (!getRelighter().isEmpty()) {
TaskManager.IMP.taskNowAsync(new Runnable() {
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
getRelighter().fixLightingSafe(hasSky());

View File

@ -108,18 +108,20 @@ public class SetQueue {
boolean wait = false;
do {
Runnable task = tasks.poll();
if (task != null) {
task.run();
wait = true;
} else {
if (task == null) {
if (wait) {
synchronized (tasks) {
tasks.wait(1);
}
task = tasks.poll();
wait = false;
continue;
} else {
break;
}
break;
}
if (task != null) {
task.run();
wait = true;
}
} while ((used = System.currentTimeMillis() - now) < taskAllocate);
currentAllocate -= used;

View File

@ -134,6 +134,7 @@ public class ExtentEntityCopy implements EntityFunction {
private BaseEntity transformNbtData(BaseEntity state) {
CompoundTag tag = state.getNbtData();
if (tag != null) {
boolean changed = false;
// Handle hanging entities (paintings, item frames, etc.)
tag = tag.createBuilder().build();
@ -146,6 +147,7 @@ public class ExtentEntityCopy implements EntityFunction {
boolean hasFacing = tag.containsKey("Facing");
if (hasTilePosition) {
changed = true;
Vector tilePosition = new Vector(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
Vector newTilePosition = transform.apply(tilePosition.subtract(from)).add(to);
@ -181,6 +183,7 @@ public class ExtentEntityCopy implements EntityFunction {
ListTag rotation = tag.getListTag("Rotation");
if (rotation != null && rotation.getValue().size() >= 2) {
changed = true;
double yaw = Math.toRadians(rotation.getFloat(0));
double pitch = Math.toRadians(rotation.getFloat(1));
@ -191,6 +194,10 @@ public class ExtentEntityCopy implements EntityFunction {
FloatTag pitchTag = new FloatTag(direction.toPitch());
values.put("Rotation", new ListTag(FloatTag.class, Arrays.asList(yawTag, pitchTag)));
}
if (changed) {
return new BaseEntity(state.getTypeId(), tag);
}
}
return state;