Make Sure BCLibs Default WorldPreset is applied by default for fresh Clients/Servers
This commit is contained in:
parent
9f8409ebe0
commit
ab0895d48c
12 changed files with 226 additions and 44 deletions
|
@ -11,6 +11,7 @@ import org.betterx.bclib.api.ModIntegrationAPI;
|
|||
import org.betterx.bclib.api.PostInitAPI;
|
||||
import org.betterx.bclib.api.dataexchange.DataExchangeAPI;
|
||||
import org.betterx.bclib.client.models.CustomModelBakery;
|
||||
import org.betterx.bclib.client.presets.WorldPresetsUI;
|
||||
import org.betterx.bclib.registry.BaseBlockEntityRenders;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -27,6 +28,8 @@ public class BCLibClient implements ClientModInitializer, ModelResourceProvider,
|
|||
modelBakery = new CustomModelBakery();
|
||||
ModelLoadingRegistry.INSTANCE.registerResourceProvider(rm -> this);
|
||||
ModelLoadingRegistry.INSTANCE.registerVariantProvider(rm -> this);
|
||||
|
||||
WorldPresetsUI.setupClientside();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package org.betterx.bclib.client.presets;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.PresetEditor;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import org.betterx.bclib.gui.worldgen.WorldSetupScreen;
|
||||
import org.betterx.bclib.presets.WorldPresets;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class WorldPresetsUI {
|
||||
public static void registerCustomizeUI(ResourceKey<WorldPreset> key, PresetEditor setupScreen) {
|
||||
if (setupScreen != null) {
|
||||
PresetEditor.EDITORS.put(Optional.of(key), setupScreen);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setupClientside() {
|
||||
registerCustomizeUI(WorldPresets.BCL_WORLD, (createWorldScreen, worldCreationContext) -> {
|
||||
return new WorldSetupScreen(createWorldScreen);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue