Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 01:50:06 +01:00
block set test
Dieser Commit ist enthalten in:
Ursprung
eec08c81ad
Commit
f96760b36c
@ -1,10 +1,15 @@
|
||||
package com.boydti.fawe.bukkit.beta;
|
||||
|
||||
import com.boydti.fawe.beta.Filter;
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IGetBlocks;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.beta.implementation.blocks.CharSetBlocks;
|
||||
import com.boydti.fawe.beta.implementation.holder.ChunkHolder;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import net.minecraft.server.v1_13_R2.Chunk;
|
||||
import net.minecraft.server.v1_13_R2.ChunkSection;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
@ -25,6 +30,20 @@ public class BukkitChunkHolder<T extends Future<T>> extends ChunkHolder {
|
||||
BukkitQueue extent = (BukkitQueue) getExtent();
|
||||
BukkitGetBlocks get = (BukkitGetBlocks) getOrCreateGet();
|
||||
CharSetBlocks set = (CharSetBlocks) getOrCreateSet();
|
||||
int X = getX();
|
||||
int Z = getZ();
|
||||
|
||||
Chunk currentNmsChunk = extent.ensureLoaded(X, Z);
|
||||
ChunkSection[] sections = currentNmsChunk.getSections();
|
||||
World world = extent.getBukkitWorld();
|
||||
boolean hasSky = world.getEnvironment() == World.Environment.NORMAL;
|
||||
|
||||
for (int layer = 0; layer < 16; layer++) {
|
||||
if (!set.hasSection(layer)) continue;
|
||||
char[] arr = set.blocks[layer];
|
||||
ChunkSection newSection = extent.newChunkSection(layer, hasSky, arr);
|
||||
sections[layer] = newSection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -48,8 +67,10 @@ public class BukkitChunkHolder<T extends Future<T>> extends ChunkHolder {
|
||||
|
||||
*/
|
||||
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
// throw new UnsupportedOperationException("Not implemented");
|
||||
// return true;
|
||||
return null;
|
||||
// return (T) (Future) Futures.immediateFuture(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,8 +160,8 @@ public class BukkitQueue extends SimpleCharQueueExtent {
|
||||
NMS conversion
|
||||
*/
|
||||
|
||||
public static ChunkSection newChunkSection(final int y2, final boolean flag, final char[] blocks) {
|
||||
ChunkSection section = new ChunkSection(y2 << 4, flag);
|
||||
public static ChunkSection newChunkSection(final int layer, final boolean flag, final char[] blocks) {
|
||||
ChunkSection section = new ChunkSection(layer << 4, flag);
|
||||
if (blocks == null) {
|
||||
return section;
|
||||
}
|
||||
|
@ -287,6 +287,26 @@ public class RegionCommands extends MethodCommands {
|
||||
System.out.println(diff);
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"db2"},
|
||||
usage = "",
|
||||
desc = "db2",
|
||||
help = "db2"
|
||||
)
|
||||
public void db2(Player player, @Selection Region region) throws WorldEditException {
|
||||
QueueHandler queueHandler = Fawe.get().getQueueHandler();
|
||||
World world = player.getWorld();
|
||||
IQueueExtent queue = queueHandler.getQueue(world);
|
||||
BlockState block = BlockTypes.STONE.getDefaultState();
|
||||
long start = System.currentTimeMillis();
|
||||
for (BlockVector3 p : region) {
|
||||
queue.setBlock(p.getX(), p.getY(), p.getZ(), block);
|
||||
}
|
||||
queue.flush();
|
||||
long diff = System.currentTimeMillis() - start;
|
||||
System.out.println(diff);
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"/curve", "/spline"},
|
||||
usage = "<pattern> [thickness]",
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren