mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2025-04-12 14:40:42 +08:00
Fix Fabric regenerate outside of overworld (#2016)
* Fix Fabric regenerate outside of overworld * License
This commit is contained in:
parent
0ad3ab14d9
commit
ab61a849e8
@ -38,6 +38,7 @@ import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.fabric.internal.ExtendedMinecraftServer;
|
||||
import com.sk89q.worldedit.fabric.internal.FabricWorldNativeAccess;
|
||||
import com.sk89q.worldedit.fabric.internal.NBTConverter;
|
||||
import com.sk89q.worldedit.fabric.mixin.AccessorDerivedLevelData;
|
||||
import com.sk89q.worldedit.fabric.mixin.AccessorPrimaryLevelData;
|
||||
import com.sk89q.worldedit.fabric.mixin.AccessorServerChunkCache;
|
||||
import com.sk89q.worldedit.internal.Constants;
|
||||
@ -316,8 +317,12 @@ public class FabricWorld extends AbstractWorld {
|
||||
LevelStorageSource levelStorage = LevelStorageSource.createDefault(tempDir);
|
||||
try (LevelStorageSource.LevelStorageAccess session = levelStorage.createAccess("WorldEditTempGen")) {
|
||||
ServerLevel originalWorld = (ServerLevel) getWorld();
|
||||
AccessorPrimaryLevelData levelProperties = (AccessorPrimaryLevelData)
|
||||
originalWorld.getLevelData();
|
||||
AccessorPrimaryLevelData levelProperties;
|
||||
if (originalWorld.getLevelData() instanceof AccessorDerivedLevelData derivedLevelData) {
|
||||
levelProperties = (AccessorPrimaryLevelData) derivedLevelData.getWrapped();
|
||||
} else {
|
||||
levelProperties = (AccessorPrimaryLevelData) originalWorld.getLevelData();
|
||||
}
|
||||
WorldGenSettings originalOpts = levelProperties.worldGenSettings();
|
||||
|
||||
long seed = options.getSeed().orElse(originalWorld.getSeed());
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.fabric.mixin;
|
||||
|
||||
import net.minecraft.world.level.storage.DerivedLevelData;
|
||||
import net.minecraft.world.level.storage.ServerLevelData;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(DerivedLevelData.class)
|
||||
public interface AccessorDerivedLevelData extends ServerLevelData {
|
||||
|
||||
@Accessor
|
||||
ServerLevelData getWrapped();
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
"mixins": [
|
||||
"AccessorClientboundBlockEntityDataPacket",
|
||||
"AccessorPrimaryLevelData",
|
||||
"AccessorDerivedLevelData",
|
||||
"AccessorServerChunkCache",
|
||||
"MixinLevelChunkSetBlockHook",
|
||||
"MixinMinecraftServer",
|
||||
|
Loading…
x
Reference in New Issue
Block a user