Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-19 09:20:08 +01:00
Move to Fawe/LinTag
Dieser Commit ist enthalten in:
Ursprung
6f387ef391
Commit
5b1c7e00a4
@ -12,6 +12,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.material.Fluids;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
|
import org.enginehub.linbus.tree.LinCompoundTag;
|
||||||
import sun.misc.Unsafe;
|
import sun.misc.Unsafe;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -50,7 +51,7 @@ public class PaperweightLevelProxy extends ServerLevel {
|
|||||||
if (blockPos.getX() == Integer.MAX_VALUE) {
|
if (blockPos.getX() == Integer.MAX_VALUE) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
com.sk89q.jnbt.CompoundTag tag = processor.getTileAt(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
LinCompoundTag tag = processor.getTileAt(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||||
if (tag == null) {
|
if (tag == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -59,7 +60,7 @@ public class PaperweightLevelProxy extends ServerLevel {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BlockEntity tileEntity = entityBlock.newBlockEntity(blockPos, state);
|
BlockEntity tileEntity = entityBlock.newBlockEntity(blockPos, state);
|
||||||
tileEntity.load((CompoundTag) adapter.fromNative(tag));
|
tileEntity.load((CompoundTag) adapter.fromNativeLin(tag));
|
||||||
return tileEntity;
|
return tileEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.material.Fluids;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
|
import org.enginehub.linbus.tree.LinCompoundTag;
|
||||||
import sun.misc.Unsafe;
|
import sun.misc.Unsafe;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -50,7 +51,7 @@ public class PaperweightLevelProxy extends ServerLevel {
|
|||||||
if (blockPos.getY() == Integer.MAX_VALUE) {
|
if (blockPos.getY() == Integer.MAX_VALUE) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
com.sk89q.jnbt.CompoundTag tag = processor.getTileAt(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
LinCompoundTag tag = processor.getTileAt(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||||
if (tag == null) {
|
if (tag == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -59,7 +60,7 @@ public class PaperweightLevelProxy extends ServerLevel {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BlockEntity tileEntity = entityBlock.newBlockEntity(blockPos, state);
|
BlockEntity tileEntity = entityBlock.newBlockEntity(blockPos, state);
|
||||||
tileEntity.load((CompoundTag) adapter.fromNative(tag));
|
tileEntity.load((CompoundTag) adapter.fromNativeLin(tag));
|
||||||
return tileEntity;
|
return tileEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.material.Fluids;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
|
import org.enginehub.linbus.tree.LinCompoundTag;
|
||||||
import sun.misc.Unsafe;
|
import sun.misc.Unsafe;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -50,7 +51,7 @@ public class PaperweightLevelProxy extends ServerLevel {
|
|||||||
if (blockPos.getX() == Integer.MAX_VALUE) {
|
if (blockPos.getX() == Integer.MAX_VALUE) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
com.sk89q.jnbt.CompoundTag tag = processor.getTileAt(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
LinCompoundTag tag = processor.getTileAt(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||||
if (tag == null) {
|
if (tag == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -59,7 +60,7 @@ public class PaperweightLevelProxy extends ServerLevel {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BlockEntity tileEntity = entityBlock.newBlockEntity(blockPos, state);
|
BlockEntity tileEntity = entityBlock.newBlockEntity(blockPos, state);
|
||||||
tileEntity.loadWithComponents((CompoundTag) adapter.fromNative(tag), serverLevel.registryAccess());
|
tileEntity.loadWithComponents((CompoundTag) adapter.fromNativeLin(tag), serverLevel.registryAccess());
|
||||||
return tileEntity;
|
return tileEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.material.Fluids;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
|
import org.enginehub.linbus.tree.LinCompoundTag;
|
||||||
import sun.misc.Unsafe;
|
import sun.misc.Unsafe;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -50,7 +51,7 @@ public class PaperweightLevelProxy extends ServerLevel {
|
|||||||
if (blockPos.getX() == Integer.MAX_VALUE) {
|
if (blockPos.getX() == Integer.MAX_VALUE) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
com.sk89q.jnbt.CompoundTag tag = processor.getTileAt(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
LinCompoundTag tag = processor.getTileAt(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||||
if (tag == null) {
|
if (tag == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -59,7 +60,7 @@ public class PaperweightLevelProxy extends ServerLevel {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BlockEntity tileEntity = entityBlock.newBlockEntity(blockPos, state);
|
BlockEntity tileEntity = entityBlock.newBlockEntity(blockPos, state);
|
||||||
tileEntity.loadWithComponents((CompoundTag) adapter.fromNative(tag), serverLevel.registryAccess());
|
tileEntity.loadWithComponents((CompoundTag) adapter.fromNativeLin(tag), serverLevel.registryAccess());
|
||||||
return tileEntity;
|
return tileEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,12 +7,12 @@ import com.fastasyncworldedit.core.function.mask.AdjacentAny2DMask;
|
|||||||
import com.fastasyncworldedit.core.math.BlockVector3ChunkMap;
|
import com.fastasyncworldedit.core.math.BlockVector3ChunkMap;
|
||||||
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||||
import com.fastasyncworldedit.core.math.MutableVector3;
|
import com.fastasyncworldedit.core.math.MutableVector3;
|
||||||
|
import com.fastasyncworldedit.core.nbt.FaweCompoundTag;
|
||||||
import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||||
import com.fastasyncworldedit.core.queue.IChunk;
|
import com.fastasyncworldedit.core.queue.IChunk;
|
||||||
import com.fastasyncworldedit.core.queue.IChunkGet;
|
import com.fastasyncworldedit.core.queue.IChunkGet;
|
||||||
import com.fastasyncworldedit.core.queue.IChunkSet;
|
import com.fastasyncworldedit.core.queue.IChunkSet;
|
||||||
import com.fastasyncworldedit.core.registry.state.PropertyKey;
|
import com.fastasyncworldedit.core.registry.state.PropertyKey;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
@ -213,7 +213,7 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
private IChunkSet process() {
|
private IChunkSet process() {
|
||||||
Map<BlockVector3, CompoundTag> setTiles = processChunkSet.getTiles();
|
Map<BlockVector3, FaweCompoundTag> setTiles = processChunkSet.tiles();
|
||||||
for (int layer = processChunkGet.getMinSectionPosition(); layer <= processChunkGet.getMaxSectionPosition(); layer++) {
|
for (int layer = processChunkGet.getMinSectionPosition(); layer <= processChunkGet.getMaxSectionPosition(); layer++) {
|
||||||
int layerY = layer << 4;
|
int layerY = layer << 4;
|
||||||
char[] set = processChunkSet.loadIfPresent(layer);
|
char[] set = processChunkSet.loadIfPresent(layer);
|
||||||
@ -230,7 +230,7 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkAndPerformUpdate(
|
private void checkAndPerformUpdate(
|
||||||
Map<BlockVector3, CompoundTag> setTiles,
|
Map<BlockVector3, FaweCompoundTag> setTiles,
|
||||||
char[] set,
|
char[] set,
|
||||||
int index,
|
int index,
|
||||||
int blockY,
|
int blockY,
|
||||||
@ -254,7 +254,7 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
|||||||
blockX,
|
blockX,
|
||||||
blockY,
|
blockY,
|
||||||
blockZ,
|
blockZ,
|
||||||
setTiles.isEmpty() ? null : ((BlockVector3ChunkMap<CompoundTag>) setTiles).remove(x, blockY, z)
|
setTiles.isEmpty() ? null : ((BlockVector3ChunkMap<FaweCompoundTag>) setTiles).remove(x, blockY, z)
|
||||||
), ordinal);
|
), ordinal);
|
||||||
set[index] = BlockTypesCache.ReservedIDs.__RESERVED__;
|
set[index] = BlockTypesCache.ReservedIDs.__RESERVED__;
|
||||||
continue;
|
continue;
|
||||||
@ -300,7 +300,7 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (secondPass.tile != null) {
|
if (secondPass.tile != null) {
|
||||||
extent.setTile(secondPass.x, secondPass.y, secondPass.z, secondPass.tile);
|
extent.tile(secondPass.x, secondPass.y, secondPass.z, secondPass.tile);
|
||||||
}
|
}
|
||||||
extent.setBlock(secondPass.x, secondPass.y, secondPass.z, BlockTypesCache.states[newOrdinal]);
|
extent.setBlock(secondPass.x, secondPass.y, secondPass.z, BlockTypesCache.states[newOrdinal]);
|
||||||
}
|
}
|
||||||
@ -337,7 +337,7 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
|||||||
return processChunkGet.getBlock(x & 15, y, z & 15);
|
return processChunkGet.getBlock(x & 15, y, z & 15);
|
||||||
}
|
}
|
||||||
BlockState state = BlockTypesCache.states[ordinal];
|
BlockState state = BlockTypesCache.states[ordinal];
|
||||||
// "Hack" for stairs as internal server methods will only accept "single" chests for joining
|
// "Hack" for chests as internal server methods will only accept "single" chests for joining
|
||||||
if (state.getBlockType().equals(BlockTypes.CHEST) || state.getBlockType().equals(BlockTypes.TRAPPED_CHEST)) {
|
if (state.getBlockType().equals(BlockTypes.CHEST) || state.getBlockType().equals(BlockTypes.TRAPPED_CHEST)) {
|
||||||
String shape = state.getState(PropertyKey.TYPE).toString();
|
String shape = state.getState(PropertyKey.TYPE).toString();
|
||||||
if (shape.equals("right")) {
|
if (shape.equals("right")) {
|
||||||
@ -361,34 +361,34 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
|||||||
return BlockTypesCache.states[ordinal];
|
return BlockTypesCache.states[ordinal];
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompoundTag getTileAt(int x, int y, int z) {
|
public LinCompoundTag getTileAt(int x, int y, int z) {
|
||||||
SecondPass secondPass = new SecondPass(x, y, z, null);
|
SecondPass secondPass = new SecondPass(x, y, z, null);
|
||||||
Character ord = postCompleteSecondPasses.get(secondPass);
|
Character ord = postCompleteSecondPasses.get(secondPass);
|
||||||
if (ord != null && ord != 0) {
|
if (ord != null && ord != 0) {
|
||||||
// This should be rare enough...
|
// This should be rare enough...
|
||||||
for (SecondPass pass : postCompleteSecondPasses.keySet()) {
|
for (SecondPass pass : postCompleteSecondPasses.keySet()) {
|
||||||
if (pass.hashCode() == secondPass.hashCode()) {
|
if (pass.hashCode() == secondPass.hashCode()) {
|
||||||
return pass.tile != null ? pass.tile : BlockTypesCache.states[ord].getNbtData();
|
return pass.tile != null ? pass.tile.linTag() : BlockTypesCache.states[ord].getNbt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BlockTypesCache.states[ord].getNbtData();
|
return BlockTypesCache.states[ord].getNbt();
|
||||||
}
|
}
|
||||||
if (processChunkSet == null || (x & CHUNK_BLOCK_POS_MASK) != processChunkX || (z & CHUNK_BLOCK_POS_MASK) != processChunkZ) {
|
if (processChunkSet == null || (x & CHUNK_BLOCK_POS_MASK) != processChunkX || (z & CHUNK_BLOCK_POS_MASK) != processChunkZ) {
|
||||||
return extent.getFullBlock(x, y, z).getNbtData();
|
return extent.getFullBlock(x, y, z).getNbt();
|
||||||
}
|
}
|
||||||
CompoundTag tile = processChunkSet.getTile(x & 15, y, z & 15);
|
FaweCompoundTag tile = processChunkSet.tile(x & 15, y, z & 15);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
return tile;
|
return tile.linTag();
|
||||||
}
|
}
|
||||||
char[] set = processChunkSet.loadIfPresent(y >> 4);
|
char[] set = processChunkSet.loadIfPresent(y >> 4);
|
||||||
if (set == null) {
|
if (set == null) {
|
||||||
return processChunkGet.getFullBlock(x & 15, y, z & 15).getNbtData();
|
return processChunkGet.getFullBlock(x & 15, y, z & 15).getNbt();
|
||||||
}
|
}
|
||||||
char ordinal = set[(y & 15) << 8 | (z & 15) << 4 | (x & 15)];
|
char ordinal = set[(y & 15) << 8 | (z & 15) << 4 | (x & 15)];
|
||||||
if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) {
|
if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) {
|
||||||
return processChunkGet.getFullBlock(x & 15, y, z & 15).getNbtData();
|
return processChunkGet.getFullBlock(x & 15, y, z & 15).getNbt();
|
||||||
}
|
}
|
||||||
return BlockTypesCache.states[ordinal].getNbtData();
|
return BlockTypesCache.states[ordinal].getNbt();
|
||||||
}
|
}
|
||||||
|
|
||||||
private char getBlockOrdinal(int blockX, int blockY, int blockZ, BlockState state) {
|
private char getBlockOrdinal(int blockX, int blockY, int blockZ, BlockState state) {
|
||||||
@ -487,9 +487,9 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
|||||||
if (block.getOrdinalChar() != newOrdinal) {
|
if (block.getOrdinalChar() != newOrdinal) {
|
||||||
BlockState newState = BlockTypesCache.states[newOrdinal];
|
BlockState newState = BlockTypesCache.states[newOrdinal];
|
||||||
orDefault.setBlock(set.x(), set.y(), set.z(), newState);
|
orDefault.setBlock(set.x(), set.y(), set.z(), newState);
|
||||||
CompoundTag nbt = block.getNbtData();
|
LinCompoundTag nbt = block.getNbt();
|
||||||
if (nbt != null && newState.getBlockType() == block.getBlockType()) {
|
if (nbt != null && newState.getBlockType() == block.getBlockType()) {
|
||||||
orDefault.setTile(set.x(), set.y(), set.z(), nbt);
|
orDefault.tile(set.x(), set.y(), set.z(), FaweCompoundTag.of(nbt));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -521,7 +521,7 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected record SecondPass(int x, int y, int z, CompoundTag tile) {
|
protected record SecondPass(int x, int y, int z, FaweCompoundTag tile) {
|
||||||
|
|
||||||
private SecondPass(BlockVector3 pos) {
|
private SecondPass(BlockVector3 pos) {
|
||||||
this(pos.x(), pos.y(), pos.z(), null);
|
this(pos.x(), pos.y(), pos.z(), null);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren