Merge branch '1.18' of github.com-quiqueck:paulevsGitch/BCLib into 1.18
This commit is contained in:
commit
64c3d90458
7 changed files with 26 additions and 4 deletions
|
@ -96,8 +96,8 @@ public class BiomeAPI {
|
||||||
*
|
*
|
||||||
* @param server - {@link MinecraftServer}
|
* @param server - {@link MinecraftServer}
|
||||||
*/
|
*/
|
||||||
public static void initRegistry(MinecraftServer server) {
|
public static void initRegistry( Registry<Biome> biomeRegistry) {
|
||||||
biomeRegistry = server.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
|
BiomeAPI.biomeRegistry = biomeRegistry;
|
||||||
CLIENT.clear();
|
CLIENT.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class MinecraftServerMixin {
|
||||||
@Inject(method = "loadLevel", at = @At(value = "RETURN"), cancellable = true)
|
@Inject(method = "loadLevel", at = @At(value = "RETURN"), cancellable = true)
|
||||||
private void bclib_loadLevel(CallbackInfo info) {
|
private void bclib_loadLevel(CallbackInfo info) {
|
||||||
bclib_injectRecipes();
|
bclib_injectRecipes();
|
||||||
BiomeAPI.initRegistry(MinecraftServer.class.cast(this));
|
//BiomeAPI.initRegistry(MinecraftServer.class.cast(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bclib_injectRecipes() {
|
private void bclib_injectRecipes() {
|
||||||
|
|
|
@ -38,7 +38,7 @@ public abstract class ServerLevelMixin extends Level {
|
||||||
ServerLevel world = ServerLevel.class.cast(this);
|
ServerLevel world = ServerLevel.class.cast(this);
|
||||||
LifeCycleAPI._runLevelLoad(world, server, executor, levelStorageAccess, serverLevelData, resourceKey, dimensionType, chunkProgressListener, chunkGenerator, bl, l, list, bl2);
|
LifeCycleAPI._runLevelLoad(world, server, executor, levelStorageAccess, serverLevelData, resourceKey, dimensionType, chunkProgressListener, chunkGenerator, bl, l, list, bl2);
|
||||||
|
|
||||||
BiomeAPI.initRegistry(server);
|
//BiomeAPI.initRegistry(server);
|
||||||
BiomeAPI.applyModifications(ServerLevel.class.cast(this));
|
BiomeAPI.applyModifications(ServerLevel.class.cast(this));
|
||||||
|
|
||||||
if (bclib_lastWorld != null && bclib_lastWorld.equals(levelStorageAccess.getLevelId())) {
|
if (bclib_lastWorld != null && bclib_lastWorld.equals(levelStorageAccess.getLevelId())) {
|
||||||
|
|
19
src/main/java/ru/bclib/mixin/common/WorldPresetMixin.java
Normal file
19
src/main/java/ru/bclib/mixin/common/WorldPresetMixin.java
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package ru.bclib.mixin.common;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
|
import net.minecraft.core.RegistryAccess;
|
||||||
|
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
import ru.bclib.api.biomes.BiomeAPI;
|
||||||
|
|
||||||
|
@Mixin(WorldPreset.class)
|
||||||
|
public class WorldPresetMixin {
|
||||||
|
@Inject(method = "create", at = @At("HEAD"))
|
||||||
|
private void create(RegistryAccess.RegistryHolder registryHolder, long l, boolean bl, boolean bl2, CallbackInfoReturnable<WorldGenSettings> info) {
|
||||||
|
BiomeAPI.initRegistry(registryHolder.registryOrThrow(Registry.BIOME_REGISTRY));
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,6 +50,7 @@ public class BCLibEndBiomeSource extends BiomeSource {
|
||||||
public BCLibEndBiomeSource(Registry<Biome> biomeRegistry, long seed) {
|
public BCLibEndBiomeSource(Registry<Biome> biomeRegistry, long seed) {
|
||||||
super(getBiomes(biomeRegistry));
|
super(getBiomes(biomeRegistry));
|
||||||
|
|
||||||
|
BiomeAPI.initRegistry(biomeRegistry);
|
||||||
BiomeAPI.END_LAND_BIOME_PICKER.clearMutables();
|
BiomeAPI.END_LAND_BIOME_PICKER.clearMutables();
|
||||||
BiomeAPI.END_VOID_BIOME_PICKER.clearMutables();
|
BiomeAPI.END_VOID_BIOME_PICKER.clearMutables();
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ public class BCLibNetherBiomeSource extends BiomeSource {
|
||||||
public BCLibNetherBiomeSource(Registry<Biome> biomeRegistry, long seed) {
|
public BCLibNetherBiomeSource(Registry<Biome> biomeRegistry, long seed) {
|
||||||
super(getBiomes(biomeRegistry));
|
super(getBiomes(biomeRegistry));
|
||||||
|
|
||||||
|
BiomeAPI.initRegistry(biomeRegistry);
|
||||||
BiomeAPI.NETHER_BIOME_PICKER.clearMutables();
|
BiomeAPI.NETHER_BIOME_PICKER.clearMutables();
|
||||||
|
|
||||||
this.possibleBiomes().forEach(biome -> {
|
this.possibleBiomes().forEach(biome -> {
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
"shears.SheepMixin",
|
"shears.SheepMixin",
|
||||||
"PortalShapeMixin",
|
"PortalShapeMixin",
|
||||||
"ServerLevelMixin",
|
"ServerLevelMixin",
|
||||||
|
"WorldPresetMixin",
|
||||||
"AnvilBlockMixin",
|
"AnvilBlockMixin",
|
||||||
"AnvilMenuMixin",
|
"AnvilMenuMixin",
|
||||||
"TagLoaderMixin",
|
"TagLoaderMixin",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue