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