mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 13:45:36 +01:00
Some fixes for 1.7.10
This commit is contained in:
parent
843fd98d4e
commit
30d544b57d
@ -28,7 +28,7 @@ ext {
|
||||
date = git.head().date.format("yy.MM.dd")
|
||||
revision = "-${git.head().abbreviatedId}"
|
||||
parents = git.head().parentIds;
|
||||
index = -95; // Offset to match CI
|
||||
index = -96; // Offset to match CI
|
||||
int major, minor, patch;
|
||||
major = minor = patch = 0;
|
||||
for (;parents != null && !parents.isEmpty();index++) {
|
||||
|
@ -261,6 +261,7 @@ public class NMSRelighter implements Relighter {
|
||||
}
|
||||
|
||||
public void fixLightingSafe(boolean sky) {
|
||||
if (isEmpty()) return;
|
||||
try {
|
||||
if (sky) {
|
||||
fixSkyLighting();
|
||||
|
@ -236,18 +236,18 @@ public class SetQueue {
|
||||
}
|
||||
|
||||
public void flush(FaweQueue queue) {
|
||||
queue.startSet(Settings.IMP.QUEUE.PARALLEL_THREADS > 1);
|
||||
try {
|
||||
queue.startSet(Settings.IMP.QUEUE.PARALLEL_THREADS > 1);
|
||||
queue.next(Settings.IMP.QUEUE.PARALLEL_THREADS, Long.MAX_VALUE);
|
||||
} catch (Throwable e) {
|
||||
pool.awaitQuiescence(Settings.IMP.QUEUE.DISCARD_AFTER_MS, TimeUnit.MILLISECONDS);
|
||||
completer = new ExecutorCompletionService(pool);
|
||||
MainUtil.handleError(e);
|
||||
} finally {
|
||||
queue.endSet(Settings.IMP.QUEUE.PARALLEL_THREADS > 1);
|
||||
queue.setStage(QueueStage.NONE);
|
||||
queue.runTasks();
|
||||
}
|
||||
queue.endSet(Settings.IMP.QUEUE.PARALLEL_THREADS > 1);
|
||||
}
|
||||
|
||||
public FaweQueue getNextQueue() {
|
||||
|
@ -26,7 +26,6 @@ import com.sk89q.worldedit.session.SessionKey;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TargetBlock;
|
||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
@ -52,7 +51,7 @@ public class PlayerWrapper extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return WorldWrapper.wrap((AbstractWorld) parent.getWorld());
|
||||
return WorldWrapper.wrap(parent.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,6 +50,9 @@ public class WorldWrapper extends LocalWorld {
|
||||
if (world instanceof LocalWorldAdapter) {
|
||||
return unwrap(LocalWorldAdapter.unwrap(world));
|
||||
}
|
||||
else if (world instanceof EditSession) {
|
||||
return unwrap(((EditSession) world).getWorld());
|
||||
}
|
||||
return world;
|
||||
}
|
||||
|
||||
|
@ -905,7 +905,7 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + ":" + extent.toString();
|
||||
return super.toString() + ":" + extent;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -370,7 +370,6 @@ public final class CommandManager {
|
||||
Request.reset();
|
||||
locals.put(Actor.class, actor);
|
||||
final Actor finalActor = actor;
|
||||
|
||||
locals.put("arguments", args);
|
||||
long start = System.currentTimeMillis();
|
||||
try {
|
||||
|
@ -26,6 +26,7 @@ import com.boydti.fawe.object.pattern.PatternTraverser;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||
import com.boydti.fawe.wrappers.PlayerWrapper;
|
||||
import com.boydti.fawe.wrappers.WorldWrapper;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.ServerInterface;
|
||||
@ -258,6 +259,7 @@ public class PlatformManager {
|
||||
*/
|
||||
public World getWorldForEditing(World base) {
|
||||
checkNotNull(base);
|
||||
base = WorldWrapper.unwrap(base);
|
||||
World match = queryCapability(Capability.WORLD_EDITING).matchWorld(base);
|
||||
return match != null ? match : base;
|
||||
}
|
||||
|
@ -134,10 +134,11 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
||||
}
|
||||
BlockStateContainer palette = new BlockStateContainer();
|
||||
char[] blocks = getIdArray(layer);
|
||||
int index = 0;
|
||||
for (int y = 0; y < 16; y++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
char combinedId = blocks[FaweCache.CACHE_J[y][z][x]];
|
||||
char combinedId = blocks[index++];
|
||||
if (combinedId > 1) {
|
||||
palette.set(x, y, z, Block.getBlockById(combinedId >> 4).getStateFromMeta(combinedId & 0xF));
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ import javax.management.InstanceAlreadyExistsException;
|
||||
import net.minecraft.command.ServerCommandManager;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class FaweForge implements IFawe {
|
||||
@ -120,6 +122,13 @@ public class FaweForge implements IFawe {
|
||||
}
|
||||
|
||||
public String getWorldName(net.minecraft.world.World w) {
|
||||
Integer[] ids = DimensionManager.getIDs();
|
||||
WorldServer[] worlds = DimensionManager.getWorlds();
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (worlds[i] == w) {
|
||||
return w.getWorldInfo().getWorldName() + ";" + ids[i];
|
||||
}
|
||||
}
|
||||
return w.getWorldInfo().getWorldName() + ";" + w.provider.dimensionId;
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,7 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
||||
this.count[i]++;
|
||||
switch (id) {
|
||||
case 0:
|
||||
this.air[i]++;
|
||||
vs[j] = 0;
|
||||
vs2[j] = (char) 1;
|
||||
return;
|
||||
@ -280,15 +281,13 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
||||
section.setBlockLSBArray(newIdArray);
|
||||
if (newDataArray != null) {
|
||||
section.setBlockMetadataArray(newDataArray);
|
||||
} else {
|
||||
NibbleArray nibble = section.getMetadataArray();
|
||||
Arrays.fill(nibble.data, (byte) 0);
|
||||
} else if (section.getMetadataArray() != null) {
|
||||
Arrays.fill(section.getMetadataArray().data, (byte) 0);
|
||||
}
|
||||
if (extendedArray != null) {
|
||||
section.setBlockMSBArray(extendedArray);
|
||||
} else {
|
||||
NibbleArray nibble = section.getBlockMSBArray();
|
||||
Arrays.fill(nibble.data, (byte) 0);
|
||||
} else if (section.getBlockMSBArray() != null) {
|
||||
Arrays.fill(section.getBlockMSBArray().data, (byte) 0);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -326,6 +325,7 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
||||
solid++;
|
||||
currentIdArray[k] = newIdArray[k];
|
||||
if (data) {
|
||||
if (FaweCache.hasData(combined >> 4)) {
|
||||
int dataByte = FaweCache.getData(combined);
|
||||
int x = FaweCache.CACHE_X[0][k];
|
||||
int y = FaweCache.CACHE_Y[0][k];
|
||||
@ -333,15 +333,24 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
||||
int newData = newDataArray.get(x, y, z);
|
||||
currentDataArray.set(x, y, z, newData);
|
||||
}
|
||||
if (extra) {
|
||||
} else if (currentDataArray != null) {
|
||||
int x = FaweCache.CACHE_X[0][k];
|
||||
int y = FaweCache.CACHE_Y[0][k];
|
||||
int z = FaweCache.CACHE_Z[0][k];
|
||||
currentDataArray.set(x, y, z, 0);
|
||||
}
|
||||
int extraId = FaweCache.getId(combined) >> 8;
|
||||
if (extraId != 0) {
|
||||
if (extra && extraId != 0) {
|
||||
int x = FaweCache.CACHE_X[0][k];
|
||||
int y = FaweCache.CACHE_Y[0][k];
|
||||
int z = FaweCache.CACHE_Z[0][k];
|
||||
int newExtra = extendedArray.get(x, y, z);
|
||||
currentExtraArray.set(x, y, z, newExtra);
|
||||
}
|
||||
} else if (currentExtraArray != null) {
|
||||
int x = FaweCache.CACHE_X[0][k];
|
||||
int y = FaweCache.CACHE_Y[0][k];
|
||||
int z = FaweCache.CACHE_Z[0][k];
|
||||
currentExtraArray.set(x, y, z, 0);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -373,8 +382,8 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
||||
if (tileEntity != null) {
|
||||
NBTTagCompound tag = (NBTTagCompound) ForgeQueue_All.methodFromNative.invoke(null, nativeTag);
|
||||
tag.setInteger("x", x);
|
||||
tag.setInteger("y", x);
|
||||
tag.setInteger("z", x);
|
||||
tag.setInteger("y", y);
|
||||
tag.setInteger("z", z);
|
||||
tileEntity.readFromNBT(tag); // ReadTagIntoTile
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
||||
@Override
|
||||
public CompoundTag getTileEntity(Chunk chunk, int x, int y, int z) {
|
||||
Map<ChunkPosition, TileEntity> tiles = chunk.chunkTileEntityMap;
|
||||
ChunkPosition pos = new ChunkPosition(x, y, z);
|
||||
ChunkPosition pos = new ChunkPosition(x & 15, y, z & 15);
|
||||
TileEntity tile = tiles.get(pos);
|
||||
return tile != null ? getTag(tile) : null;
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ import javax.management.InstanceAlreadyExistsException;
|
||||
import net.minecraft.command.ServerCommandManager;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.ModMetadata;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -123,6 +125,13 @@ public class FaweForge implements IFawe {
|
||||
}
|
||||
|
||||
public String getWorldName(net.minecraft.world.World w) {
|
||||
Integer[] ids = DimensionManager.getIDs();
|
||||
WorldServer[] worlds = DimensionManager.getWorlds();
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (worlds[i] == w) {
|
||||
return w.getWorldInfo().getWorldName() + ";" + ids[i];
|
||||
}
|
||||
}
|
||||
return w.getWorldInfo().getWorldName() + ";" + w.provider.getDimensionId();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user