Merge branch 'main' of github.com-quiqueck:paulevsGitch/BCLib
This commit is contained in:
commit
6adbe5dd04
5 changed files with 30 additions and 9 deletions
|
@ -11,7 +11,7 @@ loader_version= 0.12.8
|
|||
fabric_version = 0.44.0+1.18
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.1
|
||||
mod_version = 1.0.2
|
||||
maven_group = ru.bclib
|
||||
archives_base_name = bclib
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package ru.bclib.mixin.common;
|
||||
package ru.bclib.mixin.client;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.Registry;
|
|
@ -1,19 +1,41 @@
|
|||
package ru.bclib.mixin.common;
|
||||
|
||||
import joptsimple.ArgumentAcceptingOptionSpec;
|
||||
import joptsimple.OptionParser;
|
||||
import joptsimple.OptionSet;
|
||||
import net.minecraft.server.Main;
|
||||
import net.minecraft.server.dedicated.DedicatedServerSettings;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import ru.bclib.api.LifeCycleAPI;
|
||||
import ru.bclib.api.datafixer.DataFixerAPI;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Optional;
|
||||
|
||||
@Mixin(Main.class)
|
||||
abstract public class MainMixin {
|
||||
@ModifyArg(method="main", at=@At(value="INVOKE_ASSIGN", target="Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;getSummary()Lnet/minecraft/world/level/storage/LevelSummary;"))
|
||||
private static LevelStorageSource.LevelStorageAccess bclib_callServerFix(LevelStorageSource.LevelStorageAccess session){
|
||||
DataFixerAPI.fixData(session, false, (didFix)->{/* not called when showUI==false */});
|
||||
@Inject(method="main", at=@At(value="INVOKE", target="Lnet/minecraft/world/level/storage/LevelStorageSource;createDefault(Ljava/nio/file/Path;)Lnet/minecraft/world/level/storage/LevelStorageSource;"))
|
||||
private static void bclib_callServerFix(String[] args, CallbackInfo ci){
|
||||
OptionParser parser = new OptionParser();
|
||||
ArgumentAcceptingOptionSpec<String> optionUniverse = parser.accepts("universe").withRequiredArg().defaultsTo(".", new String[0]);
|
||||
ArgumentAcceptingOptionSpec<String> optionWorld = parser.accepts("world").withRequiredArg();
|
||||
OptionSet options = parser.parse(args);
|
||||
|
||||
Path settingPath = Paths.get("server.properties", new String[0]);
|
||||
DedicatedServerSettings settings = new DedicatedServerSettings(settingPath);
|
||||
|
||||
File file = new File(options.valueOf(optionUniverse));
|
||||
String levelID = Optional.ofNullable(options.valueOf(optionWorld)).orElse(settings.getProperties().levelName);
|
||||
|
||||
LevelStorageSource levelStorageSource = LevelStorageSource.createDefault(file.toPath());
|
||||
DataFixerAPI.fixData(levelStorageSource, levelID, false, (didFix)->{/* not called when showUI==false */});
|
||||
|
||||
LifeCycleAPI._runBeforeLevelLoad();
|
||||
return session;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"ModelBakeryMixin",
|
||||
"MinecraftMixin",
|
||||
"GameMixin",
|
||||
"GameMixin"
|
||||
"WorldPresetMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
"shears.SheepMixin",
|
||||
"PortalShapeMixin",
|
||||
"ServerLevelMixin",
|
||||
"WorldPresetMixin",
|
||||
"AnvilBlockMixin",
|
||||
"AnvilMenuMixin",
|
||||
"TagLoaderMixin",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue