Compare commits

...
Author SHA1 Message Date
MeAlam1 433a66124b Fucking JavaDocs 2026-09-27 18:05:15 +02:00
MeAlam1 4209ca3845 License 2026-09-27 17:44:25 +02:00
MeAlam1 6edd81c0f5 I think all weird Merge Conflicts are gone now 2026-09-27 17:19:57 +02:00
MeAlam1 7939b4ca71 Weird formatting 2026-09-27 17:14:21 +02:00
MeAlam1 0cc22b6675 Fixed some more weird MR Conflict inconsistancies 2026-09-27 17:05:08 +02:00
MeAlam1 0405eea167 Fixing Merge Conflicts 2026-09-27 16:56:06 +02:00
MeAlam1 17d07774d2 merge conflicts 2026-09-27 16:51:48 +02:00
MeAlam1 d71373c237 Merge branch 'main' into hello_world-but_worse 2026-09-27 16:41:23 +02:00
MeAlam1 fc2335f5d5 Fixed Biomes 2026-09-08 14:04:46 +02:00
MeAlam1 7d8329b311 Update from Main 2026-09-08 13:19:56 +02:00
MeAlam1 9b46757d14 Merge branch 'main' into hello_world-but_worse 2026-09-08 13:19:28 +02:00
MeAlam1 fe5970180d Fixed the merge confilicts, Biomes are still broken tho 2026-09-06 15:52:50 +02:00
MeAlam1 89b81d6882 Update from main (Merge Conflicts will be fixed in the upcoming commits) 2026-09-06 15:01:08 +02:00
MeAlam1 2eb6042d06 Created a simple way to add Custom Biome Data Parsers 2026-04-16 00:04:06 +02:00
MeAlam1 5ec2fc7937 Revert Change
https://minecraft.wiki/w/World_generation
2026-04-15 23:46:09 +02:00
MeAlam1 f57093b835 DATA DRIVEN BIOMES WORK + COMPATIBILITY 2026-04-14 19:04:58 +02:00
MeAlam1 03bb782dc4 Big Boy cleanup 2026-04-14 18:14:11 +02:00
Aram d296fa81dc Cleanup 2026-04-13 15:09:20 +02:00
Aram 1621bada06 Fixed JSON Loading 2026-04-10 15:56:58 +02:00
Aram 873ccc8109 JSON Loading Works!!!! 2026-04-10 15:01:06 +02:00
Aram eb4257cc26 Biome Registry Order is broken 2026-04-10 14:28:09 +02:00
Aram dfcb988f1e Got some issues with JSON loading, but ill work on it when i got time 2026-04-09 16:59:10 +02:00
Aram 2ca2a77333 Cobblemon Biomes are now accessible in World Generation 2026-04-09 15:39:43 +02:00
MeAlam1 b468e4eb6c Forgor 2026-04-09 02:01:55 +02:00
MeAlam1 c39397413f Final Renaming of Methods 2026-04-09 01:54:31 +02:00
MeAlam1 b3fe03194a Cleanup of all the Code 2026-04-09 01:52:33 +02:00
MeAlam1 d2eafe7b41 Added all Mixin Docs 2026-04-09 01:09:41 +02:00
MeAlam1 7f78c15f6b Hello World be Worlding 2026-04-08 23:02:29 +02:00
MeAlam1 0cd1f8a2fd Commit 2026-04-08 16:10:51 +02:00
MeAlam1 d6c2da3d90 Update CobblemonBiomes.kt 2026-04-07 22:10:23 +02:00
MeAlam1 ba84883eae Evolved to Registry is already frozen ERROR 2026-04-06 23:18:06 +02:00
MeAlam1 fcfdfb270d Slowly Start working on Biome Registry 2026-03-26 14:13:46 +01:00
MeAlam1 96d1d9d552 Started implementing custom biomes 2026-03-26 00:36:33 +01:00
MeAlam1 0d1de548a0 Test Hello *World* 2026-03-25 23:06:41 +01:00
43 changed files with 920 additions and 93 deletions

No files matched your search

@@ -0,0 +1,18 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.duck.biome;
import net.minecraft.core.Holder;
import net.minecraft.world.level.biome.Biome;
import java.util.List;
public interface BiomeSourceDuck {
void addPossibleBiomes(List<Holder<Biome>> biomes);
}
@@ -8,14 +8,21 @@
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.Cobblemon;
import com.cobblemon.mod.common.duck.MinecraftServerDuck;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.core.LayeredRegistryAccess;
import net.minecraft.core.RegistryAccess;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.RegistryLayer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import java.util.Map;
import java.util.Optional;
@@ -23,18 +30,41 @@ import java.util.Optional;
@Mixin(MinecraftServer.class)
public class MinecraftServerMixin implements MinecraftServerDuck {
@Shadow
@Final
private Map<ResourceKey<Level>, ServerLevel> levels;
@Shadow
@Final
private Map<ResourceKey<Level>, ServerLevel> levels;
@Override
public Optional<ResourceKey<Level>> cobblemon$getLevelKey(final Level level) {
return this.levels.entrySet()
.stream()
// Reference equality is intended here, the level we're handed is the same one as in the
// map so we don't need to check value semantics.
.filter(entry -> entry.getValue() == level)
.map(Map.Entry::getKey)
.findFirst();
}
@Override
public Optional<ResourceKey<Level>> cobblemon$getLevelKey(final Level level) {
return this.levels.entrySet()
.stream()
// Reference equality is intended here, the level we're handed is the same one as in the
// map so we don't need to check value semantics.
.filter(entry -> entry.getValue() == level)
.map(Map.Entry::getKey)
.findFirst();
}
/**
* Wraps the earliest {@code compositeAccess()} call in {@link MinecraftServer}'s constructor
* so Cobblemon can capture the server registry access as soon as it exists.
*
* <p>This sets {@link Cobblemon#registryAccess} before downstream initialization
* depends on biome lookups, while still delegating to the original call unchanged.</p>
*
* @author MeAlam
* @since April 9th 2026
*/
@WrapOperation(method = "<init>", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/core/LayeredRegistryAccess;compositeAccess()Lnet/minecraft/core/RegistryAccess$Frozen;",
ordinal = 0
))
private RegistryAccess.Frozen cobblemon$captureRegistryAccess
(LayeredRegistryAccess<RegistryLayer> instance, Operation<RegistryAccess.Frozen> original) {
Cobblemon.registryAccess = instance.compositeAccess();
return original.call(instance);
}
}
@@ -0,0 +1,51 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin.biome;
import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.data.worldgen.biome.BiomeData;
import net.minecraft.world.level.biome.Biome;
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.CallbackInfo;
/**
* TODO (MeAlam):<br>
* This mixin is currently disabled, as it does not appear to be required at this time.
* It is retained for potential future use if biome registration issues arise.
*
* <p>
* When enabled, this mixin registers biomes into the bootstrap context
* of Minecraft's {@code BiomeData} class.
* </p>
*
* <p>
* Example usage:
* <pre>{@code
* context.register(MY_BIOME_KEY, createMyBiome());
*
* // e.g.
* context.register(
* CobblemonBiomes.TEST_BIOME,
* CobblemonBiomes.createTestBiome()
* );
* }</pre>
*
* @author MeAlam
* @since April 9th 2026
*/
@Mixin(BiomeData.class)
public class BiomeDataMixin {
@Inject(method = "bootstrap", at = @At("TAIL"))
private static void cobblemon$registerBiomes(BootstrapContext<Biome> context, CallbackInfo ci) {
}
}
@@ -0,0 +1,68 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin.biome;
import com.cobblemon.mod.common.duck.biome.BiomeSourceDuck;
import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
import net.minecraft.core.Holder;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeResolver;
import net.minecraft.world.level.biome.BiomeSource;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;
/**
* TODO (MeAlam):<br>
* This mixin is currently disabled, as it does not appear to be required at this time.
* It is retained for potential future use if biome injection becomes necessary.
*
* <p>
* When enabled, this mixin extends the {@code BiomeSource} by modifying the
* {@code possibleBiomes} supplier to include additional biomes at runtime.
* It merges existing biomes with new ones while ensuring uniqueness.
* </p>
*
* <p>
* Example usage:
* <pre>{@code
* ((BiomeSourceDuck) biomeSource).addPossibleBiomes(List.of(
* biomeHolderA,
* biomeHolderB
* ));
*
* // Existing and new biomes are merged with duplicates removed.
* }</pre>
*
* @author MeAlam
* @since April 9th 2026
*/
@Mixin(BiomeSource.class)
public abstract class BiomeSourceMixin implements BiomeResolver, BiomeSourceDuck {
@Mutable
@Final
@Shadow
private Supplier<Set<Holder<Biome>>> possibleBiomes;
@Override
public void addPossibleBiomes(List<Holder<Biome>> biomes) {
List<Holder<Biome>> combined = new ArrayList<>();
combined.addAll(this.possibleBiomes.get());
combined.addAll(biomes);
this.possibleBiomes = () -> new ObjectLinkedOpenHashSet<>(combined.stream().distinct().collect(Collectors.toList()));
}
}
@@ -0,0 +1,123 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin.biome;
import com.cobblemon.mod.common.Cobblemon;
import com.cobblemon.mod.common.util.biome.RegistryExtensions;
import com.cobblemon.mod.common.world.biome.CobblemonBiome;
import com.cobblemon.mod.common.world.biome.CobblemonBiomeLoader;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.mojang.datafixers.util.Either;
import com.mojang.datafixers.util.Pair;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.*;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
/**
* Ensures compatibility with Biolith by applying this mixin before its biome modifications.
*
* <p>
* Biolith uses mixins (see
* <a href="https://github.com/TerraformersMC/Biolith/blob/1.21.1/common/src/main/java/com/terraformersmc/biolith/impl/mixin/MixinMultiNoiseBiomeSource.java">
* MixinMultiNoiseBiomeSource
* </a>)
* with a priority of {@code 900}, allowing it to run before Terrablender.
* </p>
*
* <p>
* Because Biolith includes functionality to disable vanilla biomes, this mixin must
* execute before Biolith’s transformations to ensure compatibility and prevent
* unintended biome removal or conflicts.
* </p>
*
* @author MeAlam
* @since April 9th 2026
*/
@Mixin(value = MultiNoiseBiomeSource.class, priority = 850)
public abstract class MultiNoiseBiomeSourceMixin extends BiomeSource {
@Shadow
protected abstract Climate.ParameterList<Holder<Biome>> parameters();
@Unique
private Climate.ParameterList<Holder.Reference<Biome>> cobblemon$parameters;
@WrapOperation(
method = "parameters",
at = @At(value = "INVOKE", target = "Lcom/mojang/datafixers/util/Either;map(Ljava/util/function/Function;Ljava/util/function/Function;)Ljava/lang/Object;"),
remap = false
)
private Object cobblemon$injectBiomes(
Either<Climate.ParameterList<RegistryAccess.RegistryEntry<Biome>>,
RegistryAccess.RegistryEntry<MultiNoiseBiomeSourceParameterList>> instance,
Function<Climate.ParameterList<RegistryAccess.RegistryEntry<Biome>>,
Climate.ParameterList<RegistryAccess.RegistryEntry<Biome>>> leftMap,
Function<RegistryAccess.RegistryEntry<MultiNoiseBiomeSourceParameterList>,
Climate.ParameterList<RegistryAccess.RegistryEntry<Biome>>> rightMap,
Operation<Object> original) {
synchronized (this) {
if (cobblemon$parameters == null) {
/* NOTE:
* Minecraft also does this exact cast on the return of this operation, so we know it's safe.
*/
@SuppressWarnings("unchecked")
Climate.ParameterList<Holder.Reference<Biome>> originalEntries =
(Climate.ParameterList<Holder.Reference<Biome>>) original.call(instance, leftMap, rightMap);
Map<ResourceLocation, CobblemonBiome> loadedBiomes = CobblemonBiomeLoader.getLoadedBiomes();
List<Pair<Climate.ParameterPoint, Holder.Reference<Biome>>> parameterList =
new ArrayList<>(originalEntries.values().size() + loadedBiomes.size());
parameterList.addAll(originalEntries.values());
HolderGetter<Biome> biomeEntryGetter = RegistryExtensions.getRegistryLookup(Registries.BIOME).orElseThrow();
int appended = 0;
int skipped = 0;
for (Map.Entry<ResourceLocation, CobblemonBiome> loadedEntry : loadedBiomes.entrySet()) {
ResourceKey<Biome> biomeKey = ResourceKey.create(Registries.BIOME, loadedEntry.getKey());
Optional<Holder.Reference<Biome>> biomeHolder = biomeEntryGetter.get(biomeKey);
if (biomeHolder.isEmpty()) {
skipped++;
Cobblemon.LOGGER.warn("MEALAM Skipping cobblemon biome climate entry for missing biome {}", loadedEntry.getKey());
continue;
}
parameterList.add(new Pair<>(loadedEntry.getValue().getParameters(), biomeHolder.get()));
appended++;
}
Cobblemon.LOGGER.info(
"MEALAM Biome source climate entries: base={}, appended={}, skipped={}.",
originalEntries.values().size(),
appended,
skipped
);
cobblemon$parameters = new Climate.ParameterList<>(parameterList);
}
return cobblemon$parameters;
}
}
}
@@ -0,0 +1,67 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin.biome;
import com.cobblemon.mod.common.Cobblemon;
import com.cobblemon.mod.common.CobblemonBiomes;
import com.cobblemon.mod.common.world.biome.CobblemonBiomeLoader;
import com.mojang.serialization.Decoder;
import net.minecraft.core.WritableRegistry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.RegistryDataLoader;
import net.minecraft.resources.RegistryOps;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.world.level.biome.Biome;
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.CallbackInfo;
import java.util.Map;
/**
* Registers Cobblemon biomes during datapack registry loading.
*
* <p>Injected into {@link RegistryDataLoader} at the tail of
* {@code loadContentsFromManager}.</p>
*
* <p>At this point, vanilla biome JSON has already been decoded, but registries are not frozen
* yet, making this the safest point to add biome entries.</p>
*
* <p>Only applies when the currently loaded registry is {@link Registries#BIOME}.</p>
*
* @author MeAlam
* @since April 9th 2026
*/
@Mixin(RegistryDataLoader.class)
public class RegistryDataLoaderMixin {
@Inject(method = "loadContentsFromManager", at = @At("TAIL"))
private static <E> void cobblemon$registerBiomes(
ResourceManager resourceManager,
RegistryOps.RegistryInfoLookup registryInfoLookup,
WritableRegistry<E> registry,
Decoder<E> codec,
Map<ResourceKey<?>, Exception> loadingErrors,
CallbackInfo ci
) {
if (!registry.key().equals(Registries.BIOME)) {
return;
}
@SuppressWarnings("unchecked")
WritableRegistry<Biome> biomeRegistry = (WritableRegistry<Biome>) registry;
CobblemonBiomes.register(
CobblemonBiomeLoader.load(resourceManager, registryInfoLookup)
);
CobblemonBiomes.INSTANCE.setRegistry(biomeRegistry);
Cobblemon.implementation.registerBiomes();
}
}
@@ -137,6 +137,7 @@ import kotlin.reflect.jvm.isAccessible
import kotlin.reflect.jvm.javaField
import net.minecraft.client.Minecraft
import net.minecraft.commands.synchronization.SingletonArgumentInfo
import net.minecraft.core.RegistryAccess
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerPlayer
@@ -182,7 +183,10 @@ object Cobblemon {
var seasonResolver: SeasonResolver = TagSeasonResolver
var wallpapers = mutableMapOf<UUID, Set<ResourceLocation>>()
val serverPlayerStructs = mutableMapOf<UUID, ObjectValue<Player>>()
@JvmField
var registryAccess: RegistryAccess.Frozen = RegistryAccess.EMPTY
val serverPlayerStructs = mutableMapOf<UUID, ObjectValue<Player>>()
val statistics: CobblemonStats = CobblemonStats
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common
import com.cobblemon.mod.common.platform.PlatformRegistry
import com.cobblemon.mod.common.world.biome.CobblemonBiome
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.core.Registry
import net.minecraft.core.registries.Registries
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.biome.Biome
object CobblemonBiomes : PlatformRegistry<Registry<Biome>, ResourceKey<Registry<Biome>>, Biome>() {
override var registry: Registry<Biome>? = null
override val resourceKey: ResourceKey<Registry<Biome>> = Registries.BIOME
@JvmField
val TEST_BIOME: ResourceKey<Biome> = registerKey("test_biome")
@JvmStatic
fun register(data: Map<ResourceLocation, CobblemonBiome>) {
data.forEach { (identifier, cobblemonBiome) ->
create(identifier, cobblemonBiome.biome)
}
}
private fun registerKey(key: String): ResourceKey<Biome> {
return ResourceKey.create(Registries.BIOME, cobblemonResource(key))
}
}
@@ -20,7 +20,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType
object CobblemonBlockEntities : PlatformRegistry<Registry<BlockEntityType<*>>, ResourceKey<Registry<BlockEntityType<*>>>, BlockEntityType<*>>() {
override val registry: Registry<BlockEntityType<*>> = BuiltInRegistries.BLOCK_ENTITY_TYPE
override var registry: Registry<BlockEntityType<*>>? = BuiltInRegistries.BLOCK_ENTITY_TYPE
override val resourceKey: ResourceKey<Registry<BlockEntityType<*>>> = Registries.BLOCK_ENTITY_TYPE
@JvmField
@@ -59,7 +59,7 @@ import net.minecraft.world.level.material.PushReaction
@Suppress("SameParameterValue", "HasPlatformType", "MemberVisibilityCanBePrivate", "unused")
object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<Block>>, Block>() {
override val registry: Registry<Block> = BuiltInRegistries.BLOCK
override var registry: Registry<Block>? = BuiltInRegistries.BLOCK
override val resourceKey: ResourceKey<Registry<Block>> = Registries.BLOCK
val APRICORN_BLOCK_SET_TYPE = BlockSetType("apricorn")
@@ -30,7 +30,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeSupplier
object CobblemonEntities : PlatformRegistry<Registry<EntityType<*>>, ResourceKey<Registry<EntityType<*>>>, EntityType<*>>() {
override val registry: Registry<EntityType<*>> = BuiltInRegistries.ENTITY_TYPE
override var registry: Registry<EntityType<*>>? = BuiltInRegistries.ENTITY_TYPE
override val resourceKey: ResourceKey<Registry<EntityType<*>>> = Registries.ENTITY_TYPE
@JvmField
@@ -123,6 +123,8 @@ interface CobblemonImplementation {
* TODO
*/
fun registerMobEffects()
fun registerBiomes()
/**
@@ -114,7 +114,7 @@ object CobblemonItemComponents : PlatformRegistry<Registry<DataComponentType<*>>
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:held_item_effect"), HELD_ITEM_EFFECT)
}
override val registry = BuiltInRegistries.DATA_COMPONENT_TYPE
override var registry = BuiltInRegistries.DATA_COMPONENT_TYPE
override val resourceKey = Registries.DATA_COMPONENT_TYPE
}
@@ -68,7 +68,7 @@ import net.minecraft.world.level.block.Block
@Suppress("unused", "SameParameterValue")
object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<Item>>, Item>() {
override val registry: Registry<Item> = BuiltInRegistries.ITEM
override var registry: Registry<Item>? = BuiltInRegistries.ITEM
override val resourceKey: ResourceKey<Registry<Item>> = Registries.ITEM
@JvmField
@@ -23,8 +23,7 @@ object CobblemonMenuType : PlatformRegistry<Registry<MenuType<*>>, ResourceKey<R
val COOKING_POT = MenuType.register("cooking_pot_menu", ::CookingPotMenu)
val TM_MACHINE = MenuType.register("tm_machine_menu", ::TMMachineMenu)
override val registry: Registry<MenuType<*>>
get() = BuiltInRegistries.MENU
override var registry: Registry<MenuType<*>>? = BuiltInRegistries.MENU
override val resourceKey: ResourceKey<Registry<MenuType<*>>>
get() = Registries.MENU
}
@@ -19,7 +19,7 @@ import net.minecraft.resources.ResourceKey
import net.minecraft.world.effect.MobEffect
object CobblemonMobEffects : PlatformRegistry<Registry<MobEffect>, ResourceKey<Registry<MobEffect>>, MobEffect>() {
override val registry: Registry<MobEffect> = BuiltInRegistries.MOB_EFFECT
override var registry: Registry<MobEffect>? = BuiltInRegistries.MOB_EFFECT
override val resourceKey: ResourceKey<Registry<MobEffect>> = Registries.MOB_EFFECT
@JvmField
@@ -20,7 +20,7 @@ import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.state.BlockState
object CobblemonPoiTypes: PlatformRegistry<Registry<PoiType>, ResourceKey<Registry<PoiType>>, PoiType>() {
override val registry: Registry<PoiType> = BuiltInRegistries.POINT_OF_INTEREST_TYPE
override var registry: Registry<PoiType>? = BuiltInRegistries.POINT_OF_INTEREST_TYPE
override val resourceKey: ResourceKey<Registry<PoiType>> = Registries.POINT_OF_INTEREST_TYPE
@JvmField
@@ -27,8 +27,7 @@ object CobblemonRecipeSerializers : PlatformRegistry<Registry<RecipeSerializer<*
val BREWING_STAND: RecipeSerializer<*> = register("cobblemon:brewing_stand", BrewingStandRecipe.Serializer())
override val registry: Registry<RecipeSerializer<*>>
get() = BuiltInRegistries.RECIPE_SERIALIZER
override var registry: Registry<RecipeSerializer<*>>? = BuiltInRegistries.RECIPE_SERIALIZER
override val resourceKey: ResourceKey<Registry<RecipeSerializer<*>>>
get() = Registries.RECIPE_SERIALIZER
@@ -27,8 +27,7 @@ object CobblemonRecipeTypes : PlatformRegistry<Registry<RecipeType<*>>, Resource
val BREWING_STAND: RecipeType<BrewingStandRecipe> = register("cobblemon:brewing_stand")
override val registry: Registry<RecipeType<*>>
get() = BuiltInRegistries.RECIPE_TYPE
override var registry: Registry<RecipeType<*>>? = BuiltInRegistries.RECIPE_TYPE
override val resourceKey: ResourceKey<Registry<RecipeType<*>>>
get() = Registries.RECIPE_TYPE
@@ -20,7 +20,7 @@ import net.minecraft.world.level.block.SoundType
object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, ResourceKey<Registry<SoundEvent>>, SoundEvent>() {
override val registry: Registry<SoundEvent> = BuiltInRegistries.SOUND_EVENT
override var registry: Registry<SoundEvent>? = BuiltInRegistries.SOUND_EVENT
override val resourceKey: ResourceKey<Registry<SoundEvent>> = Registries.SOUND_EVENT
@JvmField
@@ -20,7 +20,7 @@ import net.minecraft.world.entity.ai.village.poi.PoiType
import net.minecraft.world.entity.npc.VillagerProfession
object CobblemonVillagerProfessions: PlatformRegistry<Registry<VillagerProfession>, ResourceKey<Registry<VillagerProfession>>, VillagerProfession>() {
override val registry: Registry<VillagerProfession> = BuiltInRegistries.VILLAGER_PROFESSION
override var registry: Registry<VillagerProfession>? = BuiltInRegistries.VILLAGER_PROFESSION
override val resourceKey: ResourceKey<Registry<VillagerProfession>> = Registries.VILLAGER_PROFESSION
@JvmField
@@ -95,6 +95,6 @@ object CobblemonCriteria : PlatformRegistry<Registry<CriterionTrigger<*>>, Resou
@JvmField
val LEARN_TM_COUNT = this.create("tms_learned", SimpleCriterionTrigger(CountableCriterion.CODEC))
override val registry = BuiltInRegistries.TRIGGER_TYPES
override var registry = BuiltInRegistries.TRIGGER_TYPES
override val resourceKey = Registries.TRIGGER_TYPE
}
@@ -21,7 +21,7 @@ object CobblemonEntitySubPredicates : PlatformRegistry<Registry<MapCodec<out Ent
@JvmStatic
val POKE_POBBER = this.create("poke_bobber", FishingBobberPredicate.CODEC)
override val registry: Registry<MapCodec<out EntitySubPredicate>> = BuiltInRegistries.ENTITY_SUB_PREDICATE_TYPE
override var registry: Registry<MapCodec<out EntitySubPredicate>>? = BuiltInRegistries.ENTITY_SUB_PREDICATE_TYPE
override val resourceKey: ResourceKey<Registry<MapCodec<out EntitySubPredicate>>> = Registries.ENTITY_SUB_PREDICATE_TYPE
@@ -44,8 +44,15 @@ interface JsonDataRegistry<T> : DataRegistry {
*/
val resourcePath: String
override fun reload(manager: ResourceManager) {
val data = hashMapOf<ResourceLocation, T>()
/**
* Traverses JSON resources for this registry and maps them to their resolved identifiers.
* Returning null from [parse] skips the resource.
*/
fun <R> loadJsonData(
manager: ResourceManager,
parse: (reader: BufferedReader, sourceIdentifier: ResourceLocation, resolvedIdentifier: ResourceLocation) -> R?
): Map<ResourceLocation, R> {
val data = hashMapOf<ResourceLocation, R>()
manager.listResources(resourcePath) { path -> path.endsWith(JSON_EXTENSION) }.forEach { (identifier, resource) ->
if (identifier.namespace == "pixelmon") {
return@forEach
@@ -54,11 +61,21 @@ interface JsonDataRegistry<T> : DataRegistry {
resource.open().use { stream ->
stream.bufferedReader().use { reader ->
val resolvedIdentifier = ResourceLocation.fromNamespaceAndPath(identifier.namespace, File(identifier.path).nameWithoutExtension)
data[resolvedIdentifier] = parse(reader, resolvedIdentifier)
parse(reader, identifier, resolvedIdentifier)?.let { parsed ->
data[resolvedIdentifier] = parsed
}
}
}
}
return data
}
override fun reload(manager: ResourceManager) {
val data = loadJsonData(manager) { reader, _, resolvedIdentifier ->
parse(reader, resolvedIdentifier)
}
reload(data)
}
@@ -53,6 +53,7 @@ import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.ifClient
import com.cobblemon.mod.common.util.server
import net.minecraft.core.HolderLookup
import com.cobblemon.mod.common.world.biome.CobblemonBiomeLoader
import java.util.UUID
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerPlayer
@@ -91,6 +92,7 @@ object CobblemonDataProvider : DataProvider {
this.register(PokeBalls, reloadable = false)
this.register(PropertiesCompletionProvider, reloadable = false)
this.register(CobblemonPartyPools, reloadable = false)
this.register(CobblemonBiomeLoader, reloadable = true)
this.register(CobblemonPartyCompositions, reloadable = false)
this.register(SpawnDetailPresets, reloadable = true)
this.register(CobblemonSpawnRules, reloadable = true)
@@ -17,7 +17,7 @@ import net.minecraft.resources.ResourceKey
object CobblemonParticles : PlatformRegistry<Registry<ParticleType<*>>, ResourceKey<Registry<ParticleType<*>>>, ParticleType<*>>() {
override val registry: Registry<ParticleType<*>> = BuiltInRegistries.PARTICLE_TYPE
override var registry: Registry<ParticleType<*>>? = BuiltInRegistries.PARTICLE_TYPE
override val resourceKey: ResourceKey<Registry<ParticleType<*>>> = Registries.PARTICLE_TYPE
val SNOWSTORM_PARTICLE_TYPE = this.create("snowstorm", SnowstormParticleType())
@@ -26,66 +26,58 @@ import net.minecraft.resources.ResourceLocation
* @author Licious
* @since February 11th, 2023
*/
abstract class PlatformRegistry<R : Registry<T>, K : ResourceKey<R>, T> {
abstract class PlatformRegistry<R : Registry<T>, K : ResourceKey<R>, T>(
open var registry: R? = null,
open val resourceKey: K? = null
) {
protected val queue = hashMapOf<ResourceLocation, T>()
/**
* The vanilla [Registry].
*/
abstract val registry: R
/**
* Creates a new entry in this registry.
*
* @param E The type of the entry.
* @param name The name of the entry, this will be an [ResourceLocation.path].
* @param entry The entry being added.
* @return The entry created.
*/
open fun <E : T> create(name: String, entry: E): E {
val resourceLocation = cobblemonResource(name)
return this.create(resourceLocation, entry)
}
/**
* The vanilla [ResourceKey].
*/
abstract val resourceKey: K
/**
* Creates a new entry in this registry. Introduced for sidemod usage
*
* @param E The type of the entry.
* @param resourceLocation The name of the entry, this will be an [ResourceLocation.path].
* @param entry The entry being added.
* @return The entry created.
*/
open fun <E : T> create(resourceLocation: ResourceLocation, entry: E): E {
this.queue[resourceLocation] = entry
if (entry is BagItemLike) {
BagItems.bagItems.add(
priority = Priority.NORMAL,
value = entry
)
}
return entry
}
protected val queue = hashMapOf<ResourceLocation, T>()
/**
* Handles the registration of this registry into the platform specific one.
*
* @param consumer The consumer that will handle the logic for registering every entry in this registry into the platform specific one.
*/
open fun register(consumer: (ResourceLocation, T) -> Unit) {
this.queue.forEach(consumer)
}
/**
* Creates a new entry in this registry.
*
* @param E The type of the entry.
* @param name The name of the entry, this will be an [ResourceLocation.path].
* @param entry The entry being added.
* @return The entry created.
*/
open fun <E : T> create(name: String, entry: E): E {
val resourceLocation = cobblemonResource(name)
return this.create(resourceLocation, entry)
}
/**
* Creates a new entry in this registry. Introduced for sidemod usage
*
* @param E The type of the entry.
* @param name The name of the entry, this will be an [ResourceLocation.path].
* @param entry The entry being added.
* @return The entry created.
*/
open fun <E : T> create(resourceLocation: ResourceLocation, entry: E): E {
this.queue[resourceLocation] = entry
if (entry is BagItemLike) {
BagItems.bagItems.add(
priority = Priority.NORMAL,
value = entry
)
}
return entry
}
/**
* Handles the registration of this registry into the platform specific one.
*
* @param consumer The consumer that will handle the logic for registering every entry in this registry into the platform specific one.
*/
open fun register(consumer: (ResourceLocation, T) -> Unit) {
this.queue.forEach(consumer)
}
/**
* Returns a collection of every entry in this registry.
*
* @return The entries of this registry.
*/
open fun all(): Collection<T> = this.queue.values.toList()
/**
* Returns a collection of every entry in this registry.
*
* @return The entries of this registry.
*/
open fun all(): Collection<T> = this.queue.values.toList()
}
@@ -52,6 +52,10 @@ fun Collection<JsonElement>.toJsonArray(): JsonArray {
return array
}
fun JsonElement.asJsonObjectOrNull(): JsonObject? =
if (isJsonObject) asJsonObject else null
fun JsonObject.isEmpty() = size() <= 0
fun JsonObject.isNotEmpty() = size() > 0
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.util.biome
import com.cobblemon.mod.common.Cobblemon
import net.minecraft.core.HolderLookup
import net.minecraft.core.Registry
import net.minecraft.core.RegistryAccess
import net.minecraft.resources.ResourceKey
import java.util.*
object RegistryExtensions {
@JvmStatic
fun <T> getRegistryLookup(
registryKey: ResourceKey<out Registry<T>>
): Optional<HolderLookup.RegistryLookup<T>> {
return Cobblemon.registryAccess.getRegistryLookup(registryKey)
}
}
fun <T> RegistryAccess?.getRegistryLookup(
registryKey: ResourceKey<out Registry<T>>
): Optional<HolderLookup.RegistryLookup<T>> {
if (this == null || this == RegistryAccess.EMPTY) {
return Optional.empty()
}
return this.lookup(registryKey)
}
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.world.biome
import com.google.gson.JsonElement
import net.minecraft.world.level.biome.Biome
import net.minecraft.world.level.biome.Climate
data class CobblemonBiome(
val biome: Biome,
val parameters: Climate.ParameterPoint,
val customData: Map<String, JsonElement> = emptyMap()
)
@@ -0,0 +1,75 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.world.biome
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.data.JsonDataRegistry
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.world.biome.parse.CobblemonBiomeJsonParser
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.JsonElement
import com.google.gson.reflect.TypeToken
import com.mojang.serialization.JsonOps
import net.minecraft.resources.RegistryOps
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerPlayer
import net.minecraft.server.packs.PackType
import net.minecraft.server.packs.resources.ResourceManager
import java.io.Reader
object CobblemonBiomeLoader : JsonDataRegistry<CobblemonBiome> {
override val gson: Gson = GsonBuilder().setPrettyPrinting().create()
override val typeToken: TypeToken<CobblemonBiome> = TypeToken.get(CobblemonBiome::class.java)
override val resourcePath = "biomes"
override val id = cobblemonResource(resourcePath)
override val type = PackType.SERVER_DATA
override val observable = SimpleObservable<CobblemonBiomeLoader>()
private var loadedBiomes: Map<ResourceLocation, CobblemonBiome> = emptyMap()
@JvmStatic
fun load(
manager: ResourceManager,
registryInfoLookup: RegistryOps.RegistryInfoLookup
): Map<ResourceLocation, CobblemonBiome> {
val ops = RegistryOps.create(JsonOps.INSTANCE, registryInfoLookup)
val result = loadJsonData(manager) { reader, _, _ ->
parseBiome(reader, ops)
}
loadedBiomes = result.toMap()
observable.emit(this)
Cobblemon.LOGGER.info("MEALAM Loaded {} cobblemon biomes.", result.size)
return result
}
private fun parseBiome(
reader: Reader,
ops: RegistryOps<JsonElement>
): CobblemonBiome? = CobblemonBiomeJsonParser.parse(reader, ops)
override fun reload(manager: ResourceManager) = observable.emit(this)
override fun reload(data: Map<ResourceLocation, CobblemonBiome>) = Unit
override fun sync(player: ServerPlayer) = Unit
@JvmStatic
fun getLoadedBiomes(): Map<ResourceLocation, CobblemonBiome> = loadedBiomes
@JvmStatic
fun getLoadedBiome(location: ResourceLocation): CobblemonBiome =
loadedBiomes[location]
?: error("MEALAM Unknown location: $location")
}
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.world.biome.parse
import com.cobblemon.mod.common.Cobblemon
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import com.mojang.serialization.JsonOps
import net.minecraft.resources.RegistryOps
import net.minecraft.world.level.biome.Climate
object ClimateParametersSectionParser : CobblemonBiomeSectionParser {
override val id = "parameters"
override fun parse(
root: JsonObject,
ops: RegistryOps<JsonElement>,
builder: CobblemonBiomeParseBuilder
): Boolean {
val params = root.getAsJsonObject("parameters")
if (params == null) {
Cobblemon.LOGGER.error("MEALAM Missing 'parameters' section in biome JSON")
return false
}
val result = Climate.ParameterPoint.CODEC.parse(JsonOps.INSTANCE, params)
val parameterPoint = result.result().orElse(null)
if (parameterPoint == null) {
val errorMessage = result.error().map { it.message() }.orElse("unknown error")
Cobblemon.LOGGER.error("MEALAM Failed to parse climate parameters: {}", errorMessage)
return false
}
builder.parameters = parameterPoint
return true
}
}
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.world.biome.parse
import com.cobblemon.mod.common.util.asJsonObjectOrNull
import com.cobblemon.mod.common.world.biome.CobblemonBiome
import com.google.gson.JsonElement
import com.google.gson.JsonParser
import net.minecraft.resources.RegistryOps
import java.io.Reader
object CobblemonBiomeJsonParser {
private val sectionParsers = mutableListOf(
VanillaBiomeSectionParser,
ClimateParametersSectionParser,
CustomDataSectionParser(setOf("parameters"))
)
fun parse(reader: Reader, ops: RegistryOps<JsonElement>): CobblemonBiome? {
val root = JsonParser.parseReader(reader).asJsonObjectOrNull() ?: return null
val builder = CobblemonBiomeParseBuilder()
for (parser in getParsers()) {
if (!parser.parse(root, ops, builder) && parser.required) {
return null
}
}
return builder.buildOrNull()
}
fun register(parser: CobblemonBiomeSectionParser) {
sectionParsers.add(parser)
}
private fun getParsers(): List<CobblemonBiomeSectionParser> = sectionParsers.toList()
}
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.world.biome.parse
import com.cobblemon.mod.common.world.biome.CobblemonBiome
import com.google.gson.JsonElement
import net.minecraft.world.level.biome.Biome
import net.minecraft.world.level.biome.Climate
class CobblemonBiomeParseBuilder {
var biome: Biome? = null
var parameters: Climate.ParameterPoint? = null
val customData: MutableMap<String, JsonElement> = linkedMapOf()
fun buildOrNull(): CobblemonBiome? {
val parsedBiome = biome ?: return null
val parsedParameters = parameters ?: return null
return CobblemonBiome(parsedBiome, parsedParameters, customData.toMap())
}
}
@@ -0,0 +1,26 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.world.biome.parse
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import net.minecraft.resources.RegistryOps
interface CobblemonBiomeSectionParser {
val id: String
val required: Boolean
get() = true
fun parse(
root: JsonObject,
ops: RegistryOps<JsonElement>,
builder: CobblemonBiomeParseBuilder
): Boolean
}
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.world.biome.parse
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import net.minecraft.resources.RegistryOps
class CustomDataSectionParser(
private val reservedKeys: Set<String>
) : CobblemonBiomeSectionParser {
override val id = "custom_data"
override val required = false
override fun parse(
root: JsonObject,
ops: RegistryOps<JsonElement>,
builder: CobblemonBiomeParseBuilder
): Boolean {
for ((key, value) in root.entrySet()) {
if (key !in reservedKeys) {
builder.customData[key] = value.deepCopy()
}
}
return true
}
}
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.world.biome.parse
import com.cobblemon.mod.common.Cobblemon
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import net.minecraft.resources.RegistryOps
import net.minecraft.world.level.biome.Biome
object VanillaBiomeSectionParser : CobblemonBiomeSectionParser {
override val id = "vanilla_biome"
override fun parse(
root: JsonObject,
ops: RegistryOps<JsonElement>,
builder: CobblemonBiomeParseBuilder
): Boolean {
val result = Biome.DIRECT_CODEC.parse(ops, root)
val biome = result.result().orElse(null)
if (biome == null) {
val errorMessage = result.error().map { it.message() }.orElse("unknown error")
Cobblemon.LOGGER.error("MEALAM Failed to parse vanilla biome: {}", errorMessage)
return false
}
builder.biome = biome
return true
}
}
@@ -18,7 +18,7 @@ import net.minecraft.world.level.levelgen.feature.Feature
object CobblemonFeatures : PlatformRegistry<Registry<Feature<*>>, ResourceKey<Registry<Feature<*>>>, Feature<*>>() {
override val registry: Registry<Feature<*>> = BuiltInRegistries.FEATURE
override var registry: Registry<Feature<*>>? = BuiltInRegistries.FEATURE
override val resourceKey: ResourceKey<Registry<Feature<*>>> = Registries.FEATURE
@JvmField
@@ -138,6 +138,8 @@ transitive-accessible method net/minecraft/world/inventory/MenuType <init> (Lnet
transitive-accessible class net/minecraft/client/gui/screens/MenuScreens$ScreenConstructor
transitive-accessible method net/minecraft/client/gui/screens/MenuScreens register (Lnet/minecraft/world/inventory/MenuType;Lnet/minecraft/client/gui/screens/MenuScreens$ScreenConstructor;)V
transitive-accessible method net/minecraft/resources/ResourceLocation <init> (Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible class net/minecraft/resources/RegistryDataLoader$LoadingFunction
transitive-accessible method net/minecraft/resources/RegistryDataLoader$LoadingFunction apply (Lnet/minecraft/resources/RegistryDataLoader$Loader;Lnet/minecraft/resources/RegistryOps$RegistryInfoLookup;)V
transitive-accessible field net/minecraft/stats/RecipeBookSettings states Ljava/util/Map;
transitive-accessible class net/minecraft/stats/RecipeBookSettings$TypeSettings
transitive-accessible field net/minecraft/client/gui/screens/recipebook/RecipeBookComponent tabButtons Ljava/util/List;
@@ -0,0 +1,57 @@
{
"carvers": {},
"downfall": 0.0,
"effects": {
"fog_color": 12638463,
"mood_sound": {
"block_search_extent": 8,
"offset": 2.0,
"sound": "minecraft:ambient.cave",
"tick_delay": 6000
},
"sky_color": 8103167,
"water_color": 4159204,
"water_fog_color": 329011
},
"features": [],
"has_precipitation": false,
"temperature": 2,
"spawn_costs": {},
"spawners": {
"ambient": [],
"axolotls": [],
"creature": [],
"misc": [],
"monster": [],
"underground_water_creature": [],
"water_ambient": [],
"water_creature": []
},
"parameters": {
"temperature": {
"min": 2,
"max": 2
},
"humidity": {
"min": 2,
"max": 2
},
"continentalness": {
"min": 2,
"max": 2
},
"erosion": {
"min": 2,
"max": 2
},
"depth": {
"min": 0.0,
"max": 0.0
},
"weirdness": {
"min": 2,
"max": 2
},
"offset": 0.0
}
}
@@ -95,6 +95,8 @@
"accessor.SinglePoolElementAccessor",
"accessor.StatusEffectInstanceAccessor",
"accessor.TrackedEntityAccessor",
"biome.MultiNoiseBiomeSourceMixin",
"biome.RegistryDataLoaderMixin",
"brewing.BrewingStandBlockEntityMixin",
"brewing.BrewingStandMenuMixin",
"brewing.IngredientSlotMixin",
@@ -407,6 +407,12 @@ object CobblemonFabric : CobblemonImplementation {
}
}
override fun registerBiomes() {
CobblemonBiomes.register { location, biome ->
Registry.register(CobblemonBiomes.registry, location, biome)
}
}
private class CobblemonReloadListener(private val identifier: ResourceLocation, private val reloader: PreparableReloadListener, private val dependencies: Collection<ResourceLocation>) : IdentifiableResourceReloadListener {
override fun reload(synchronizer: PreparableReloadListener.PreparationBarrier, manager: ResourceManager, prepareProfiler: ProfilerFiller, applyProfiler: ProfilerFiller, prepareExecutor: Executor, applyExecutor: Executor): CompletableFuture<Void> = this.reloader.reload(synchronizer, manager, prepareProfiler, applyProfiler, prepareExecutor, applyExecutor)
@@ -445,6 +445,14 @@ class CobblemonNeoForge : CobblemonImplementation {
}
}
override fun registerBiomes() {
MOD_BUS.addListener<RegisterEvent> { event ->
event.register(CobblemonBiomes.resourceKey) { helper ->
CobblemonBiomes.register { identifier, biome -> helper.register(identifier, biome) }
}
}
}
override fun registerResourceReloader(
identifier: ResourceLocation,
type: PackType,