Allow server to disable the forced preset override
This commit is contained in:
parent
910314a1e8
commit
e670fea21a
6 changed files with 22 additions and 5 deletions
|
@ -70,6 +70,8 @@ public class BCLib implements ModInitializer {
|
||||||
PlacementModifiers.ensureStaticInitialization();
|
PlacementModifiers.ensureStaticInitialization();
|
||||||
Configs.save();
|
Configs.save();
|
||||||
|
|
||||||
|
WorldsTogether.FORCE_SERVER_TO_BETTERX_PRESET = Configs.SERVER_CONFIG.forceBetterXPreset();
|
||||||
|
|
||||||
if (false && isDevEnvironment()) {
|
if (false && isDevEnvironment()) {
|
||||||
BCLBiome theYellow = BCLBiomeBuilder
|
BCLBiome theYellow = BCLBiomeBuilder
|
||||||
.start(makeID("the_yellow"))
|
.start(makeID("the_yellow"))
|
||||||
|
|
|
@ -55,6 +55,11 @@ public class ServerConfig extends NamedPathConfig {
|
||||||
"excludeMods",
|
"excludeMods",
|
||||||
AutoSync.SYNC_CATEGORY
|
AutoSync.SYNC_CATEGORY
|
||||||
);
|
);
|
||||||
|
public static final ConfigToken<Boolean> FORCE_BETTERX_PRESET = ConfigToken.Boolean(
|
||||||
|
true,
|
||||||
|
"forceBetterXPreset",
|
||||||
|
AutoSync.SYNC_CATEGORY
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public ServerConfig() {
|
public ServerConfig() {
|
||||||
|
@ -85,4 +90,8 @@ public class ServerConfig extends NamedPathConfig {
|
||||||
return get(SEND_ALL_MOD_INFO) /*&& isAllowingAutoSync()*/;
|
return get(SEND_ALL_MOD_INFO) /*&& isAllowingAutoSync()*/;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean forceBetterXPreset() {
|
||||||
|
return get(FORCE_BETTERX_PRESET);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
|
||||||
public class WorldsTogether {
|
public class WorldsTogether {
|
||||||
public static boolean SURPRESS_EXPERIMENTAL_DIALOG = false;
|
public static boolean SURPRESS_EXPERIMENTAL_DIALOG = false;
|
||||||
|
public static boolean FORCE_SERVER_TO_BETTERX_PRESET = false;
|
||||||
public static final String MOD_ID = "worlds_together";
|
public static final String MOD_ID = "worlds_together";
|
||||||
public static final Logger LOGGER = new Logger(MOD_ID);
|
public static final Logger LOGGER = new Logger(MOD_ID);
|
||||||
public static final boolean RUNS_TERRABLENDER = FabricLoader.getInstance()
|
public static final boolean RUNS_TERRABLENDER = FabricLoader.getInstance()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.betterx.bclib.mixin.common;
|
package org.betterx.worlds.together.mixin.common;
|
||||||
|
|
||||||
|
import org.betterx.worlds.together.WorldsTogether;
|
||||||
import org.betterx.worlds.together.worldPreset.WorldPresets;
|
import org.betterx.worlds.together.worldPreset.WorldPresets;
|
||||||
|
|
||||||
import net.minecraft.server.dedicated.DedicatedServerProperties;
|
import net.minecraft.server.dedicated.DedicatedServerProperties;
|
||||||
|
@ -10,9 +11,13 @@ import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||||
|
|
||||||
@Mixin(DedicatedServerProperties.class)
|
@Mixin(DedicatedServerProperties.class)
|
||||||
public class DedicatedServerPropertiesMixin {
|
public class DedicatedServerPropertiesMixin {
|
||||||
//Make sure the default server properties use our Default World Preset
|
//Make sure the default server properties use our Default World Preset by default (read from "level-type")
|
||||||
@ModifyArg(method = "<init>", index = 3, at = @At(value = "INVOKE", target = "Lnet/minecraft/server/dedicated/DedicatedServerProperties$WorldGenProperties;<init>(Ljava/lang/String;Lcom/google/gson/JsonObject;ZLjava/lang/String;)V"))
|
@ModifyArg(method = "<init>", index = 3, at = @At(value = "INVOKE", target = "Lnet/minecraft/server/dedicated/DedicatedServerProperties$WorldGenProperties;<init>(Ljava/lang/String;Lcom/google/gson/JsonObject;ZLjava/lang/String;)V"))
|
||||||
private String bcl_init(String levelType) {
|
protected String wt_defaultPreset(String string) {
|
||||||
return WorldPresets.getDEFAULT().location().toString();
|
if (WorldsTogether.FORCE_SERVER_TO_BETTERX_PRESET) {
|
||||||
|
return WorldPresets.getDEFAULT().location().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return string;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,7 +15,6 @@
|
||||||
"ChunkGeneratorsMixin",
|
"ChunkGeneratorsMixin",
|
||||||
"ComposterBlockAccessor",
|
"ComposterBlockAccessor",
|
||||||
"CraftingMenuMixin",
|
"CraftingMenuMixin",
|
||||||
"DedicatedServerPropertiesMixin",
|
|
||||||
"DiggerItemMixin",
|
"DiggerItemMixin",
|
||||||
"EnchantingTableBlockMixin",
|
"EnchantingTableBlockMixin",
|
||||||
"ItemStackMixin",
|
"ItemStackMixin",
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"BuiltinRegistriesMixin",
|
"BuiltinRegistriesMixin",
|
||||||
|
"DedicatedServerPropertiesMixin",
|
||||||
"DiggerItemAccessor",
|
"DiggerItemAccessor",
|
||||||
"MainMixin",
|
"MainMixin",
|
||||||
"MinecraftServerMixin",
|
"MinecraftServerMixin",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue