Jump to content

KristenStuffs

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by KristenStuffs

  1. Sorry if my first question came across as basic Java, I was basically just trying to ask where there would be example placements, albeit in a pretty round about way. I've gotten to another point, where there is no errors anywhere within the code from what I can tell. I also used the AquaticFeatures class as an example. Minecraft launches, though I don't see any of the Sponges which should be generating. I ran the debug tool and can confirm, it is being called. Currently this is how the code looks. package com.kristen.almts.world; import java.util.List; import com.kristen.almts.ALMTS; import com.kristen.almts.world.gen.plants.LivingSpongeGeneration; import net.minecraft.core.Registry; import net.minecraft.data.worldgen.placement.PlacementUtils; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.placement.BiomeFilter; import net.minecraft.world.level.levelgen.placement.InSquarePlacement; import net.minecraft.world.level.levelgen.placement.NoiseBasedCountPlacement; import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; public class ModWorldEventsAlt { private static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(Registry.FEATURE_REGISTRY, ALMTS.MOD_ID); private static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, ALMTS.MOD_ID); private static final DeferredRegister<PlacedFeature> PLACED_FEATURES = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, ALMTS.MOD_ID); // Feature public static final RegistryObject<Feature<NoneFeatureConfiguration>> MY_KELP = FEATURES.register("my_kelp", () -> new LivingSpongeGeneration(NoneFeatureConfiguration.CODEC)); public static final RegistryObject<ConfiguredFeature<?, ?>> MY_KELP_CONFIGURED = CONFIGURED_FEATURES.register("my_kelp", () -> new ConfiguredFeature<>(MY_KELP.get(), NoneFeatureConfiguration.INSTANCE)); // Placement public static final RegistryObject<PlacedFeature> MY_KELP_PLACED = PLACED_FEATURES.register("my_kelp", () -> new PlacedFeature(MY_KELP_CONFIGURED.getHolder().get(), List.of(NoiseBasedCountPlacement.of(73, 730D, 0.0D), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_TOP_SOLID, BiomeFilter.biome()))))); public static void register(IEventBus bus) { CONFIGURED_FEATURES.register(bus); PLACED_FEATURES.register(bus); FEATURES.register(bus); } @SubscribeEvent public static void biomeLoadingEvent(final BiomeLoadingEvent event) { if (event.getCategory() == Biome.BiomeCategory.OCEAN) { event.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MY_KELP_PLACED.getHolder().get()); } } }
  2. So a couple of things (sorry, you have been helping me a lot already) I added in a Placed Features Section private static final DeferredRegister<PlacedFeature> PLACED_FEATURES = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, ALMTS.MOD_ID); public static final RegistryObject<PlacedFeature> MY_KELP_PLACED = PLACED_FEATURES.register("my_kelp", () -> new PlacedFeature(MY_KELP_CONFIGURED.getHolder().get())))); However it is telling me: The constructor PlacedFeature(Holder<ConfiguredFeature<?,?>>) is undefined 1 quick fix avaiable: + Add Arguement to match 'PlacedFeature(Holder<ConfiguredFeature<?, ?>>, List<PlacementModifier>)' I've also tried implementing the biomeLoadingEvent as you've told me to do since I am using 1.18.2, but I've been getting an error with that as well and admittedly I have a lack of understanding with the biomeLoadingEvent in general. This is what I currently have: @SubscribeEvent public static void biomeLoadingEvent(final BiomeLoadingEvent event) { if (event.getCategory() == Biome.BiomeCategory.OCEAN) { event.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MY_KELP_PLACED); } } The error is: The method addFeature(GenerationStep.Decoration, Holder<PlacedFeature>) in the type BiomeGenerationSettings.Builder is not applicable for the arguments (GenerationStep.Decoration, RegistryObject<PlacedFeature>) 1 quick fix avaiable: Change type of 'My_KELP_PLACED' to 'Holder<PlacedFeature>' Here is my whole class if you need to need to see anything else: package com.kristen.almts.world; import com.kristen.almts.ALMTS; import com.kristen.almts.world.gen.plants.LivingSpongeGeneration; import net.minecraft.core.Registry; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; public class ModWorldEventsAlt { private static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, ALMTS.MOD_ID); private static final DeferredRegister<PlacedFeature> PLACED_FEATURES = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, ALMTS.MOD_ID); private static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(Registry.FEATURE_REGISTRY, ALMTS.MOD_ID); // Feature public static final RegistryObject<Feature<NoneFeatureConfiguration>> MY_KELP = FEATURES.register("my_kelp", () -> new LivingSpongeGeneration(NoneFeatureConfiguration.CODEC)); // Configuration public static final RegistryObject<ConfiguredFeature<?, ?>> MY_KELP_CONFIGURED = CONFIGURED_FEATURES.register("my_kelp", () -> new ConfiguredFeature<>(MY_KELP.get(), NoneFeatureConfiguration.INSTANCE)); // Placement public static final RegistryObject<PlacedFeature> MY_KELP_PLACED = PLACED_FEATURES.register("my_kelp", () -> new PlacedFeature(MY_KELP_CONFIGURED.getHolder().get())))); public static void register(IEventBus bus) { CONFIGURED_FEATURES.register(bus); PLACED_FEATURES.register(bus); FEATURES.register(bus); } @SubscribeEvent public static void biomeLoadingEvent(final BiomeLoadingEvent event) { if (event.getCategory() == Biome.BiomeCategory.OCEAN) { event.getGeneration().addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, MY_KELP_PLACED); } } }
  3. I have something quite similar to this class and there's no errors at all in it, but nothing spawns in game. My code looks like this, is there anything wrong with it? package com.kristen.almts.world; import com.kristen.almts.ALMTS; import com.kristen.almts.world.gen.plants.LivingSpongeGeneration; import net.minecraft.core.Registry; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; public class ModWorldEventsAlt { private static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES = DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, ALMTS.MOD_ID); private static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(Registry.FEATURE_REGISTRY, ALMTS.MOD_ID); // Placement public static final RegistryObject<Feature<NoneFeatureConfiguration>> MY_KELP = FEATURES.register("my_kelp", () -> new LivingSpongeGeneration(NoneFeatureConfiguration.CODEC)); // Configuration public static final RegistryObject<ConfiguredFeature<?, ?>> MY_KELP_CONFIGURED = CONFIGURED_FEATURES.register("my_kelp", () -> new ConfiguredFeature<>(MY_KELP.get(), NoneFeatureConfiguration.INSTANCE)); public static void register(IEventBus bus) { CONFIGURED_FEATURES.register(bus); FEATURES.register(bus); } }
  4. Sorry, I've never worked with this in particular before so this is a first time experience for me as I took a few years break from modding. I don't see where I would reference my own custom class (LivingSpongeGeneration), where would I register that within the code?
  5. How does this work with NoneFeatureConfiguration which is used in the default KelpFeature Registry?
  6. I have looked at the page even before I posted this question, I've gone through the forge external libraries as well. I simply cannot see what else I could do which I haven't yet done.
  7. Specifics: I created an underwater plant called, "Living Sponge" based on Kelp which I have confirmed working in game and works as fully intended, now I am trying to get register generation for the plant. The LivingSpongeGeneration class has no errors attached to it, though I expect there to be depending on how much I need to change in my ModWorldEventAlts class which I'm currently using to register LivingSpongeGeneration. I have tried fixing it multiple times, but when I do another error will popup. Error message in console: "Exception message: java.lang.IllegalStateException: Can not register to a locked registry. Modder should use Forge Register methods." This only displays in the console as the game will say, "null". Project Github: https://github.com/KristenStuffs/ALMTS
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.