Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Loris Accordino

Members
  • Posts

    3
  • Joined

  • Last visited

Loris Accordino's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thanks so much for your help! I managed to get it to work
  2. Hello. I tried to add what the link was asking for and I added the json file, but it doesn't work, on the contrary: it deletes every mob in my world. These are the various files: BiomeInit: package com.loris.tutorialmod.init; import com.loris.tutorialmod.ExampleBiomeModifier; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraftforge.common.world.BiomeModifier; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class BiomeInit { static DeferredRegister<Codec<? extends BiomeModifier>> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(ForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, "tutorialmod"); public static RegistryObject<Codec<ExampleBiomeModifier>> EXAMPLE_CODEC = BIOME_MODIFIER_SERIALIZERS.register("example", () -> RecordCodecBuilder.create(builder -> builder.group( // declare fields Biome.LIST_CODEC.fieldOf("biomes").forGetter(ExampleBiomeModifier::biomes), PlacedFeature.CODEC.fieldOf("feature").forGetter(ExampleBiomeModifier::feature) // declare constructor ).apply(builder, ExampleBiomeModifier::new))); } ExampleBiomeModifier: package com.loris.tutorialmod; import com.loris.tutorialmod.init.BiomeInit; import com.mojang.serialization.Codec; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraftforge.common.world.BiomeModifier; import net.minecraftforge.common.world.ModifiableBiomeInfo.BiomeInfo.Builder; public record ExampleBiomeModifier(HolderSet<Biome> biomes, Holder<PlacedFeature> feature) implements BiomeModifier { public void modify(Holder<Biome> biome, Phase phase, Builder builder) { // add a feature to all specified biomes if (phase == Phase.ADD && biomes.contains(biome)) { } } @Override public Codec<? extends BiomeModifier> codec() { // TODO Auto-generated method stub return BiomeInit.EXAMPLE_CODEC.get(); } @Override public boolean equals(Object obj) { // TODO Auto-generated method stub return false; } @Override public int hashCode() { // TODO Auto-generated method stub return 0; } @Override public String toString() { // TODO Auto-generated method stub return null; } } biome_modifier_serializers.json (I'm not sure it should be called that, is that the problem?): { "type": "forge:add_spawns", "biomes": "#tutorialmod:is_overworld", "spawners": { "type": "tutorialmod:raccoon", // Type of mob to spawn "weight": 100, // int, spawn weighting "minCount": 1, // int, minimum pack size "maxCount": 4 // int, maximum pack size } } Could you help me?
  3. Hello. I state that I am new to this forum, so I apologize for any errors in the title, description or guidelines or anything else. I'm new to Java too. I have a problem with a mod in Forge 1.19. I have to make my entity (Raccoon) naturally spawn in any minecraft world with the mod applied. I followed a tutorial and it worked in 1.18.2, but in 1.19, with the same code, it doesn't work, but it doesn't throw an exception, but it doesn't spawn the Raccoon in my world at all. (I don't put the Raccoon code because I understand that it works and, I believe, that you shouldn't change that part) The TutorialMod.java code (Forget the imports that have nothing to do with it, moreover the interested part is in the void clientSetup­čś× package com.loris.tutorialmod; import com.loris.tutorialmod.entity.ModEntityTypes; import com.loris.tutorialmod.entity.client.RaccoonRenderer; import com.loris.tutorialmod.entity.custom.RaccoonEntity; import com.loris.tutorialmod.fluids.ModFluidTypes; import com.loris.tutorialmod.init.BlockInit; import com.loris.tutorialmod.init.ConfiguredFeatureInit; import com.loris.tutorialmod.init.FluidInit; import com.loris.tutorialmod.init.ItemInit; import com.loris.tutorialmod.init.PlacedFeatureInit; import com.loris.tutorialmod.init.SoundInit; import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import software.bernie.example.registry.EntityRegistry; import software.bernie.geckolib3.GeckoLib; @Mod("tutorialmod") public class TutorialMod { public static final String MOD_ID = "tutorialmod"; public static final CreativeModeTab ANIMALS = new CreativeModeTab("animals") { @Override @OnlyIn(Dist.CLIENT) public ItemStack makeIcon() { return new ItemStack(ItemInit.RACCOON_SPAWN_EGG.get()); } }; @SuppressWarnings("removal") public TutorialMod() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); GeckoLib.initialize(); ModEntityTypes.register(bus); EntityRegistry.ENTITIES.register(bus); bus.addListener(this::clientSetup); MinecraftForge.EVENT_BUS.register(this); } private void clientSetup(final FMLClientSetupEvent event) { EntityRenderers.register(ModEntityTypes.RACCOON.get(), RaccoonRenderer::new); SpawnPlacements.register(ModEntityTypes.RACCOON.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, RaccoonEntity::checkAnimalSpawnRules); } } Any help is appreciated
×
×
  • Create New...

Important Information

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