3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-17 08:30:04 +01:00

Update 1.20.3/4 adapters

Dieser Commit ist enthalten in:
dordsor21 2023-12-12 17:28:36 +00:00
Ursprung 7092209d38
Commit 61eb5ecb06
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
7 geänderte Dateien mit 46 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -688,7 +688,6 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
}
@Override
public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) {
final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);

Datei anzeigen

@ -906,6 +906,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
ConfiguredFeatureType.REGISTRY.register(name.toString(), new ConfiguredFeatureType(name.toString()));
}
}
// Structures
for (ResourceLocation name : server.registryAccess().registryOrThrow(Registries.STRUCTURE).keySet()) {
if (StructureType.REGISTRY.get(name.toString()) == null) {
@ -962,7 +963,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
ServerChunkCache chunkManager = originalWorld.getChunkSource();
WorldGenLevel proxyLevel = PaperweightServerLevelDelegateProxy.newInstance(session, originalWorld, this);
ChunkPos chunkPos = new ChunkPos(new BlockPos(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()));
StructureStart structureStart = k.generate(originalWorld.registryAccess(), chunkManager.getGenerator(), chunkManager.getGenerator().getBiomeSource(), chunkManager.randomState(), chunkManager.chunkMap.structureTemplateManager, originalWorld.getSeed(), chunkPos, 0, proxyLevel, biome -> true);
StructureStart structureStart = k.generate(originalWorld.registryAccess(), chunkManager.getGenerator(), chunkManager.getGenerator().getBiomeSource(), chunkManager.randomState(), originalWorld.getStructureManager(), originalWorld.getSeed(), chunkPos, 0, proxyLevel, biome -> true);
if (!structureStart.isValid()) {
return false;

Datei anzeigen

@ -35,7 +35,7 @@ import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
public class PaperweightServerLevelDelegateProxy implements InvocationHandler {
public class PaperweightServerLevelDelegateProxy implements InvocationHandler {
private final EditSession editSession;
private final ServerLevel serverLevel;

Datei anzeigen

@ -5,6 +5,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.Holder;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeManager;
@ -103,4 +104,29 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator {
return world.getWorldBorder();
}
@Override
public boolean setBlock(final BlockPos pos, final BlockState state, final int flags, final int maxUpdateDepth) {
return world.setBlock(pos, state, flags, maxUpdateDepth);
}
@Override
public boolean removeBlock(final BlockPos pos, final boolean move) {
return world.removeBlock(pos, move);
}
@Override
public boolean destroyBlock(final BlockPos pos, final boolean drop, final Entity breakingEntity, final int maxUpdateDepth) {
return world.destroyBlock(pos, drop, breakingEntity, maxUpdateDepth);
}
@Override
public BlockState getBlockState(final BlockPos pos) {
return world.getBlockState(pos);
}
@Override
public boolean setBlock(final BlockPos pos, final BlockState state, final int flags) {
return world.setBlock(pos, state, flags);
}
}

Datei anzeigen

@ -529,6 +529,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
@Override
public boolean generateFeature(ConfiguredFeatureType feature, World world, EditSession editSession, BlockVector3 pt) {
//FAWE start
ServerLevel serverLevel = ((CraftWorld) world).getHandle();
ChunkGenerator generator = serverLevel.getMinecraftWorld().getChunkSource().getGenerator();
@ -595,7 +596,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
serverLevel.getSeed(),
chunkPos,
0,
serverLevel,
populator,
biome -> true
);
if (!structureStart.isValid()) {
@ -611,7 +612,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
SectionPos.blockToSectionCoord(boundingBox.maxZ())
);
ChunkPos.rangeClosed(min, max).forEach((chunkPosx) -> structureStart.placeInChunk(
serverLevel,
populator,
serverLevel.structureManager(),
chunkManager.getGenerator(),
serverLevel.getRandom(),
@ -625,10 +626,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
),
chunkPosx
));
return populator.getList().stream().collect(Collectors.toMap(
Map<BlockPos, CraftBlockState> placedBlocks = populator.getList().stream().collect(Collectors.toMap(
CraftBlockState::getPosition,
craftBlockState -> craftBlockState
));
placedBlocks.putAll(serverLevel.capturedBlockStates);
return placedBlocks;
}
} finally {
serverLevel.captureBlockStates = false;

Datei anzeigen

@ -610,7 +610,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
serverLevel.getSeed(),
chunkPos,
0,
serverLevel,
populator,
biome -> true
);
if (!structureStart.isValid()) {
@ -626,7 +626,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
SectionPos.blockToSectionCoord(boundingBox.maxZ())
);
ChunkPos.rangeClosed(min, max).forEach((chunkPosx) -> structureStart.placeInChunk(
serverLevel,
populator,
serverLevel.structureManager(),
chunkManager.getGenerator(),
serverLevel.getRandom(),
@ -640,10 +640,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
),
chunkPosx
));
return populator.getList().stream().collect(Collectors.toMap(
Map<BlockPos, CraftBlockState> placedBlocks = populator.getList().stream().collect(Collectors.toMap(
CraftBlockState::getPosition,
craftBlockState -> craftBlockState
));
placedBlocks.putAll(serverLevel.capturedBlockStates);
return placedBlocks;
}
} finally {
serverLevel.captureBlockStates = false;

Datei anzeigen

@ -582,6 +582,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
@Override
public boolean generateStructure(StructureType type, World world, EditSession editSession, BlockVector3 pt) {
//FAWE start
ServerLevel serverLevel = ((CraftWorld) world).getHandle();
Structure k = serverLevel
.registryAccess()
@ -610,7 +611,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
serverLevel.getSeed(),
chunkPos,
0,
serverLevel,
populator,
biome -> true
);
if (!structureStart.isValid()) {
@ -626,7 +627,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
SectionPos.blockToSectionCoord(boundingBox.maxZ())
);
ChunkPos.rangeClosed(min, max).forEach((chunkPosx) -> structureStart.placeInChunk(
serverLevel,
populator,
serverLevel.structureManager(),
chunkManager.getGenerator(),
serverLevel.getRandom(),
@ -640,10 +641,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
),
chunkPosx
));
return populator.getList().stream().collect(Collectors.toMap(
Map<BlockPos, CraftBlockState> placedBlocks = populator.getList().stream().collect(Collectors.toMap(
CraftBlockState::getPosition,
craftBlockState -> craftBlockState
));
placedBlocks.putAll(serverLevel.capturedBlockStates);
return placedBlocks;
}
} finally {
serverLevel.captureBlockStates = false;